Skip to content

Commit def716e

Browse files
committed
Add referral code on PayPal plugins
1 parent 90dd4e1 commit def716e

File tree

4 files changed

+29
-2
lines changed

4 files changed

+29
-2
lines changed

src/Plugins/Nop.Plugin.Payments.PayPalDirect/Description.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Group: Payment methods
22
FriendlyName: Credit Card
33
SystemName: Payments.PayPalDirect
4-
Version: 2.11
4+
Version: 2.12
55
SupportedVersions: 3.90
66
Author: nopCommerce team
77
DisplayOrder: 1

src/Plugins/Nop.Plugin.Payments.PayPalDirect/PaypalHelper.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,17 @@ namespace Nop.Plugin.Payments.PayPalDirect
88
/// </summary>
99
public class PaypalHelper
1010
{
11+
#region Constants
12+
13+
/// <summary>
14+
/// nopCommerce partner code
15+
/// </summary>
16+
private const string BN_CODE = "nopCommerce_SP";
17+
18+
#endregion
19+
20+
#region Methods
21+
1122
/// <summary>
1223
/// Get PayPal Api context
1324
/// </summary>
@@ -27,8 +38,14 @@ public static APIContext GetApiContext(PayPalDirectPaymentSettings payPalDirectP
2738
var accessToken = new OAuthTokenCredential(config).GetAccessToken();
2839
var apiContext = new APIContext(accessToken) { Config = config };
2940

41+
if (apiContext.HTTPHeaders == null)
42+
apiContext.HTTPHeaders = new Dictionary<string, string>();
43+
apiContext.HTTPHeaders["PayPal-Partner-Attribution-Id"] = BN_CODE;
44+
3045
return apiContext;
3146
}
47+
48+
#endregion
3249
}
3350
}
3451

src/Plugins/Nop.Plugin.Payments.PayPalStandard/Description.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Group: Payment methods
22
FriendlyName: PayPal Standard
33
SystemName: Payments.PayPalStandard
4-
Version: 1.31
4+
Version: 1.32
55
SupportedVersions: 3.90
66
Author: nopCommerce team
77
DisplayOrder: 1

src/Plugins/Nop.Plugin.Payments.PayPalStandard/PayPalStandardPaymentProcessor.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,15 @@ namespace Nop.Plugin.Payments.PayPalStandard
2727
/// </summary>
2828
public class PayPalStandardPaymentProcessor : BasePlugin, IPaymentMethod
2929
{
30+
#region Constants
31+
32+
/// <summary>
33+
/// nopCommerce partner code
34+
/// </summary>
35+
private const string BN_CODE = "nopCommerce_SP";
36+
37+
#endregion
38+
3039
#region Fields
3140

3241
private readonly CurrencySettings _currencySettings;
@@ -286,6 +295,7 @@ private string GenerationRedirectionUrl(PostProcessPaymentRequest postProcessPay
286295

287296
builder.AppendFormat("&custom={0}", postProcessPaymentRequest.Order.OrderGuid);
288297
builder.AppendFormat("&charset={0}", "utf-8");
298+
builder.AppendFormat("&bn={0}", BN_CODE);
289299
builder.Append(string.Format("&no_note=1&currency_code={0}", HttpUtility.UrlEncode(_currencyService.GetCurrencyById(_currencySettings.PrimaryStoreCurrencyId).CurrencyCode)));
290300
builder.AppendFormat("&invoice={0}", postProcessPaymentRequest.Order.Id);
291301
builder.AppendFormat("&rm=2", new object[0]);

0 commit comments

Comments
 (0)