Skip to content

Commit 95fcf2a

Browse files
feat(core): implemented platform merchant account (#6882)
Co-authored-by: Narayanbhat166 <[email protected]>
1 parent d4b3dbc commit 95fcf2a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+595
-16
lines changed

.github/workflows/postman-collection-runner.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ env:
1717
CONNECTORS: stripe
1818
RUST_BACKTRACE: short
1919
RUSTUP_MAX_RETRIES: 10
20-
RUST_MIN_STACK: 8388608
20+
RUST_MIN_STACK: 10485760
2121

2222
jobs:
2323
runner:

config/deployments/integration_test.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,3 +428,6 @@ card_networks = "Visa, AmericanExpress, Mastercard"
428428

429429
[network_tokenization_supported_connectors]
430430
connector_list = "cybersource"
431+
432+
[platform]
433+
enabled = true

config/deployments/production.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,3 +444,6 @@ card_networks = "Visa, AmericanExpress, Mastercard"
444444

445445
[network_tokenization_supported_connectors]
446446
connector_list = "cybersource"
447+
448+
[platform]
449+
enabled = false

config/deployments/sandbox.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,3 +446,6 @@ card_networks = "Visa, AmericanExpress, Mastercard"
446446

447447
[network_tokenization_supported_connectors]
448448
connector_list = "cybersource"
449+
450+
[platform]
451+
enabled = false

config/development.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -830,3 +830,6 @@ entity_logo_url = "https://example.com/logo.svg" # Logo URL of the entity to be
830830
foreground_color = "#000000" # Foreground color of email text
831831
primary_color = "#006DF9" # Primary color of email body
832832
background_color = "#FFFFFF" # Background color of email body
833+
834+
[platform]
835+
enabled = true

config/docker_compose.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -710,3 +710,6 @@ entity_logo_url = "https://example.com/logo.svg" # Logo URL of the entity to be
710710
foreground_color = "#000000" # Foreground color of email text
711711
primary_color = "#006DF9" # Primary color of email body
712712
background_color = "#FFFFFF" # Background color of email body
713+
714+
[platform]
715+
enabled = true

crates/diesel_models/src/merchant_account.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ pub struct MerchantAccount {
5151
pub payment_link_config: Option<serde_json::Value>,
5252
pub pm_collect_link_config: Option<serde_json::Value>,
5353
pub version: common_enums::ApiVersion,
54+
pub is_platform_account: bool,
5455
}
5556

5657
#[cfg(feature = "v1")]
@@ -83,6 +84,7 @@ pub struct MerchantAccountSetter {
8384
pub payment_link_config: Option<serde_json::Value>,
8485
pub pm_collect_link_config: Option<serde_json::Value>,
8586
pub version: common_enums::ApiVersion,
87+
pub is_platform_account: bool,
8688
}
8789

8890
#[cfg(feature = "v1")]
@@ -117,6 +119,7 @@ impl From<MerchantAccountSetter> for MerchantAccount {
117119
payment_link_config: item.payment_link_config,
118120
pm_collect_link_config: item.pm_collect_link_config,
119121
version: item.version,
122+
is_platform_account: item.is_platform_account,
120123
}
121124
}
122125
}
@@ -148,6 +151,7 @@ pub struct MerchantAccount {
148151
pub recon_status: storage_enums::ReconStatus,
149152
pub version: common_enums::ApiVersion,
150153
pub id: common_utils::id_type::MerchantId,
154+
pub is_platform_account: bool,
151155
}
152156

153157
#[cfg(feature = "v2")]
@@ -165,6 +169,7 @@ impl From<MerchantAccountSetter> for MerchantAccount {
165169
organization_id: item.organization_id,
166170
recon_status: item.recon_status,
167171
version: item.version,
172+
is_platform_account: item.is_platform_account,
168173
}
169174
}
170175
}
@@ -182,6 +187,7 @@ pub struct MerchantAccountSetter {
182187
pub organization_id: common_utils::id_type::OrganizationId,
183188
pub recon_status: storage_enums::ReconStatus,
184189
pub version: common_enums::ApiVersion,
190+
pub is_platform_account: bool,
185191
}
186192

187193
impl MerchantAccount {
@@ -228,6 +234,7 @@ pub struct MerchantAccountNew {
228234
pub payment_link_config: Option<serde_json::Value>,
229235
pub pm_collect_link_config: Option<serde_json::Value>,
230236
pub version: common_enums::ApiVersion,
237+
pub is_platform_account: bool,
231238
}
232239

233240
#[cfg(feature = "v2")]
@@ -244,6 +251,7 @@ pub struct MerchantAccountNew {
244251
pub recon_status: storage_enums::ReconStatus,
245252
pub id: common_utils::id_type::MerchantId,
246253
pub version: common_enums::ApiVersion,
254+
pub is_platform_account: bool,
247255
}
248256

249257
#[cfg(feature = "v2")]
@@ -258,6 +266,7 @@ pub struct MerchantAccountUpdateInternal {
258266
pub modified_at: time::PrimitiveDateTime,
259267
pub organization_id: Option<common_utils::id_type::OrganizationId>,
260268
pub recon_status: Option<storage_enums::ReconStatus>,
269+
pub is_platform_account: Option<bool>,
261270
}
262271

263272
#[cfg(feature = "v2")]
@@ -272,6 +281,7 @@ impl MerchantAccountUpdateInternal {
272281
modified_at,
273282
organization_id,
274283
recon_status,
284+
is_platform_account,
275285
} = self;
276286

277287
MerchantAccount {
@@ -286,6 +296,7 @@ impl MerchantAccountUpdateInternal {
286296
recon_status: recon_status.unwrap_or(source.recon_status),
287297
version: source.version,
288298
id: source.id,
299+
is_platform_account: is_platform_account.unwrap_or(source.is_platform_account),
289300
}
290301
}
291302
}
@@ -319,6 +330,7 @@ pub struct MerchantAccountUpdateInternal {
319330
pub recon_status: Option<storage_enums::ReconStatus>,
320331
pub payment_link_config: Option<serde_json::Value>,
321332
pub pm_collect_link_config: Option<serde_json::Value>,
333+
pub is_platform_account: Option<bool>,
322334
}
323335

324336
#[cfg(feature = "v1")]
@@ -350,6 +362,7 @@ impl MerchantAccountUpdateInternal {
350362
recon_status,
351363
payment_link_config,
352364
pm_collect_link_config,
365+
is_platform_account,
353366
} = self;
354367

355368
MerchantAccount {
@@ -385,6 +398,7 @@ impl MerchantAccountUpdateInternal {
385398
payment_link_config: payment_link_config.or(source.payment_link_config),
386399
pm_collect_link_config: pm_collect_link_config.or(source.pm_collect_link_config),
387400
version: source.version,
401+
is_platform_account: is_platform_account.unwrap_or(source.is_platform_account),
388402
}
389403
}
390404
}

crates/diesel_models/src/payment_intent.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ pub struct PaymentIntent {
7474
pub id: common_utils::id_type::GlobalPaymentId,
7575
pub psd2_sca_exemption_type: Option<storage_enums::ScaExemptionType>,
7676
pub split_payments: Option<common_types::payments::SplitPaymentsRequest>,
77+
pub platform_merchant_id: Option<common_utils::id_type::MerchantId>,
7778
}
7879

7980
#[cfg(feature = "v1")]
@@ -140,6 +141,7 @@ pub struct PaymentIntent {
140141
pub skip_external_tax_calculation: Option<bool>,
141142
pub psd2_sca_exemption_type: Option<storage_enums::ScaExemptionType>,
142143
pub split_payments: Option<common_types::payments::SplitPaymentsRequest>,
144+
pub platform_merchant_id: Option<common_utils::id_type::MerchantId>,
143145
}
144146

145147
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize, diesel::AsExpression, PartialEq)]
@@ -300,6 +302,7 @@ pub struct PaymentIntentNew {
300302
pub enable_payment_link: Option<bool>,
301303
pub apply_mit_exemption: Option<bool>,
302304
pub id: common_utils::id_type::GlobalPaymentId,
305+
pub platform_merchant_id: Option<common_utils::id_type::MerchantId>,
303306
}
304307

305308
#[cfg(feature = "v1")]
@@ -366,6 +369,7 @@ pub struct PaymentIntentNew {
366369
pub tax_details: Option<TaxDetails>,
367370
pub skip_external_tax_calculation: Option<bool>,
368371
pub psd2_sca_exemption_type: Option<storage_enums::ScaExemptionType>,
372+
pub platform_merchant_id: Option<common_utils::id_type::MerchantId>,
369373
pub split_payments: Option<common_types::payments::SplitPaymentsRequest>,
370374
}
371375

crates/diesel_models/src/schema.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -717,6 +717,7 @@ diesel::table! {
717717
payment_link_config -> Nullable<Jsonb>,
718718
pm_collect_link_config -> Nullable<Jsonb>,
719719
version -> ApiVersion,
720+
is_platform_account -> Bool,
720721
}
721722
}
722723

@@ -970,6 +971,8 @@ diesel::table! {
970971
skip_external_tax_calculation -> Nullable<Bool>,
971972
psd2_sca_exemption_type -> Nullable<ScaExemptionType>,
972973
split_payments -> Nullable<Jsonb>,
974+
#[max_length = 64]
975+
platform_merchant_id -> Nullable<Varchar>,
973976
}
974977
}
975978

crates/diesel_models/src/schema_v2.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -708,6 +708,7 @@ diesel::table! {
708708
version -> ApiVersion,
709709
#[max_length = 64]
710710
id -> Varchar,
711+
is_platform_account -> Bool,
711712
}
712713
}
713714

@@ -933,6 +934,8 @@ diesel::table! {
933934
id -> Varchar,
934935
psd2_sca_exemption_type -> Nullable<ScaExemptionType>,
935936
split_payments -> Nullable<Jsonb>,
937+
#[max_length = 64]
938+
platform_merchant_id -> Nullable<Varchar>,
936939
}
937940
}
938941

0 commit comments

Comments
 (0)