Skip to content

Commit

Permalink
Simplified a way to init schedule tasks from plugins. There's no need…
Browse files Browse the repository at this point in the history
… to specify the fully qualified assembly name now
  • Loading branch information
AndreiMaz committed Nov 8, 2017
1 parent e23d595 commit 6841ffd
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/Libraries/Nop.Services/Tasks/Task.cs
@@ -1,4 +1,5 @@
using System;
using System.Linq;
using Nop.Core.Caching;
using Nop.Core.Configuration;
using Nop.Core.Domain.Tasks;
Expand Down Expand Up @@ -43,7 +44,10 @@ private void ExecuteTask()
if (!Enabled)
return;

var type = Type.GetType(ScheduleTask.Type);
var type = Type.GetType(ScheduleTask.Type) ??
AppDomain.CurrentDomain.GetAssemblies()
.Select(a => a.GetType(ScheduleTask.Type))
.FirstOrDefault(t => t != null);
if (type == null)
throw new Exception($"Schedule task ({ScheduleTask.Type}) cannot by instantiated");

Expand Down
Expand Up @@ -39,7 +39,7 @@ public static class SquarePaymentDefaults
/// <summary>
/// Type of the renew access token schedule task
/// </summary>
public static string RenewAccessTokenTask => $"Nop.Plugin.Payments.Square.Services.RenewAccessTokenTask, {typeof(SquarePaymentDefaults).Assembly.FullName}";
public static string RenewAccessTokenTask => "Nop.Plugin.Payments.Square.Services.RenewAccessTokenTask";

/// <summary>
/// Default access token renewal period in days
Expand Down
2 changes: 1 addition & 1 deletion src/Plugins/Nop.Plugin.Payments.Square/plugin.json
Expand Up @@ -2,7 +2,7 @@
"Group": "Payment methods",
"FriendlyName": "Credit Card",
"SystemName": "Payments.Square",
"Version": "1.06",
"Version": "1.07",
"SupportedVersions": [ "4.00" ],
"Author": "nopCommerce team",
"DisplayOrder": 1,
Expand Down

0 comments on commit 6841ffd

Please sign in to comment.