diff --git a/src/Admin/Controllers/ToolsController.cs b/src/Admin/Controllers/ToolsController.cs index a0c0818325..d3d5b1783c 100644 --- a/src/Admin/Controllers/ToolsController.cs +++ b/src/Admin/Controllers/ToolsController.cs @@ -95,12 +95,13 @@ public class ToolsController : Controller SubmitForSettlement = true, PayPal = new Braintree.TransactionOptionsPayPalRequest { - CustomField = $"{btObjIdField}:{btObjId}" + CustomField = $"{btObjIdField}:{btObjId},region:{_globalSettings.BaseServiceUri.CloudRegion}" } }, CustomFields = new Dictionary { - [btObjIdField] = btObjId.ToString() + [btObjIdField] = btObjId.ToString(), + ["region"] = _globalSettings.BaseServiceUri.CloudRegion } }); diff --git a/src/Billing/Controllers/StripeController.cs b/src/Billing/Controllers/StripeController.cs index 8b9ef9b878..88f3f9e8a3 100644 --- a/src/Billing/Controllers/StripeController.cs +++ b/src/Billing/Controllers/StripeController.cs @@ -750,12 +750,13 @@ public class StripeController : Controller SubmitForSettlement = true, PayPal = new Braintree.TransactionOptionsPayPalRequest { - CustomField = $"{btObjIdField}:{btObjId}" + CustomField = $"{btObjIdField}:{btObjId},region:{_globalSettings.BaseServiceUri.CloudRegion}" } }, CustomFields = new Dictionary { - [btObjIdField] = btObjId.ToString() + [btObjIdField] = btObjId.ToString(), + ["region"] = _globalSettings.BaseServiceUri.CloudRegion } }); diff --git a/src/Core/Entities/ISubscriber.cs b/src/Core/Entities/ISubscriber.cs index 562b78f1d6..58510459e6 100644 --- a/src/Core/Entities/ISubscriber.cs +++ b/src/Core/Entities/ISubscriber.cs @@ -13,6 +13,7 @@ public interface ISubscriber string SubscriberName(); string BraintreeCustomerIdPrefix(); string BraintreeIdField(); + string BraintreeCloudRegionField(); string GatewayIdField(); bool IsUser(); string SubscriberType(); diff --git a/src/Core/Entities/Organization.cs b/src/Core/Entities/Organization.cs index 5d8ddf5855..0c451ae9b4 100644 --- a/src/Core/Entities/Organization.cs +++ b/src/Core/Entities/Organization.cs @@ -111,6 +111,11 @@ public class Organization : ITableObject, ISubscriber, IStorable, IStorabl return "organization_id"; } + public string BraintreeCloudRegionField() + { + return "region"; + } + public string GatewayIdField() { return "organizationId"; diff --git a/src/Core/Entities/User.cs b/src/Core/Entities/User.cs index 17c08801a3..a749fe8044 100644 --- a/src/Core/Entities/User.cs +++ b/src/Core/Entities/User.cs @@ -101,6 +101,11 @@ public class User : ITableObject, ISubscriber, IStorable, IStorableSubscri return "user_id"; } + public string BraintreeCloudRegionField() + { + return "region"; + } + public string GatewayIdField() { return "userId"; diff --git a/src/Core/Services/Implementations/StripePaymentService.cs b/src/Core/Services/Implementations/StripePaymentService.cs index 1776f19939..ad0fd19431 100644 --- a/src/Core/Services/Implementations/StripePaymentService.cs +++ b/src/Core/Services/Implementations/StripePaymentService.cs @@ -83,7 +83,8 @@ public class StripePaymentService : IPaymentService Id = org.BraintreeCustomerIdPrefix() + org.Id.ToString("N").ToLower() + randomSuffix, CustomFields = new Dictionary { - [org.BraintreeIdField()] = org.Id.ToString() + [org.BraintreeIdField()] = org.Id.ToString(), + [org.BraintreeCloudRegionField()] = _globalSettings.BaseServiceUri.CloudRegion } }); @@ -406,7 +407,8 @@ public class StripePaymentService : IPaymentService Id = user.BraintreeCustomerIdPrefix() + user.Id.ToString("N").ToLower() + randomSuffix, CustomFields = new Dictionary { - [user.BraintreeIdField()] = user.Id.ToString() + [user.BraintreeIdField()] = user.Id.ToString(), + [user.BraintreeCloudRegionField()] = _globalSettings.BaseServiceUri.CloudRegion } }); @@ -602,12 +604,13 @@ public class StripePaymentService : IPaymentService SubmitForSettlement = true, PayPal = new Braintree.TransactionOptionsPayPalRequest { - CustomField = $"{subscriber.BraintreeIdField()}:{subscriber.Id}" + CustomField = $"{subscriber.BraintreeIdField()}:{subscriber.Id},{subscriber.BraintreeCloudRegionField()}:{_globalSettings.BaseServiceUri.CloudRegion}" } }, CustomFields = new Dictionary { - [subscriber.BraintreeIdField()] = subscriber.Id.ToString() + [subscriber.BraintreeIdField()] = subscriber.Id.ToString(), + [subscriber.BraintreeCloudRegionField()] = _globalSettings.BaseServiceUri.CloudRegion } }); @@ -991,12 +994,13 @@ public class StripePaymentService : IPaymentService SubmitForSettlement = true, PayPal = new Braintree.TransactionOptionsPayPalRequest { - CustomField = $"{subscriber.BraintreeIdField()}:{subscriber.Id}" + CustomField = $"{subscriber.BraintreeIdField()}:{subscriber.Id},{subscriber.BraintreeCloudRegionField()}:{_globalSettings.BaseServiceUri.CloudRegion}" } }, CustomFields = new Dictionary { - [subscriber.BraintreeIdField()] = subscriber.Id.ToString() + [subscriber.BraintreeIdField()] = subscriber.Id.ToString(), + [subscriber.BraintreeCloudRegionField()] = _globalSettings.BaseServiceUri.CloudRegion } }); @@ -1290,7 +1294,8 @@ public class StripePaymentService : IPaymentService Utilities.CoreHelpers.RandomString(3, upper: false, numeric: false), CustomFields = new Dictionary { - [subscriber.BraintreeIdField()] = subscriber.Id.ToString() + [subscriber.BraintreeIdField()] = subscriber.Id.ToString(), + [subscriber.BraintreeCloudRegionField()] = _globalSettings.BaseServiceUri.CloudRegion } });