Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core): implemented platform merchant account #6882

Merged
merged 34 commits into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
1014f23
added is_platform_account column
racnan Nov 13, 2024
14601c0
added platform authentication functions
racnan Nov 19, 2024
38fe0be
added non connected flows error
racnan Nov 21, 2024
86c3f77
Merge branch 'main' into platform-merchant-account
racnan Nov 21, 2024
0f3fb99
added platform auth in apikeyauth
racnan Nov 25, 2024
5510f70
added platform merchant id to payment
racnan Nov 26, 2024
5af6299
happy flow fix
racnan Nov 28, 2024
ad51351
Merge branch 'main' into platform-merchant-account
racnan Nov 28, 2024
587205e
added invalid platform error
racnan Nov 29, 2024
9915ca0
platform checks in header auth
racnan Dec 2, 2024
ac4b57e
Merge branch 'main' into platform-merchant-account
racnan Dec 2, 2024
bbc907c
v2 compiles
racnan Dec 9, 2024
cd8b2c6
tests and fmt
racnan Dec 16, 2024
312735d
Merge branch 'main' into platform-merchant-account
racnan Dec 16, 2024
a84a4dc
post merge cleanup
racnan Dec 16, 2024
01deb60
post merge v2 cleanup
racnan Dec 17, 2024
00a063f
added route to enable platform account
racnan Dec 17, 2024
1624383
feature flagged
racnan Dec 18, 2024
d808672
cleanup
racnan Dec 18, 2024
5c7a963
schema fix
racnan Dec 19, 2024
a7385e5
feature flag into runtime checks
racnan Dec 19, 2024
a90500a
Merge branch 'main' into platform-merchant-account
racnan Dec 19, 2024
d609bff
env flags
racnan Dec 19, 2024
ac68b81
Merge branch 'main' into platform-merchant-account
racnan Dec 19, 2024
1ec1244
v2 disbaled
racnan Dec 19, 2024
d1f5880
restructure getter function
racnan Dec 20, 2024
f11c40e
Merge remote-tracking branch 'origin/main' into platform-merchant-acc…
racnan Dec 20, 2024
6be65ca
Merge branch 'main' into platform-merchant-account
racnan Dec 20, 2024
13fbda2
chore: increase min stack size in debug builds to solve postman errors
Narayanbhat166 Dec 21, 2024
7102076
stack size and v2
racnan Dec 21, 2024
009e692
min stack to 10mb
racnan Dec 23, 2024
cccf034
Merge branch 'main' into platform-merchant-account
racnan Dec 23, 2024
4049c6e
clean up
racnan Dec 23, 2024
a88d976
Merge branch 'main' into platform-merchant-account
racnan Dec 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/postman-collection-runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ env:
CONNECTORS: stripe
RUST_BACKTRACE: short
RUSTUP_MAX_RETRIES: 10
RUST_MIN_STACK: 8388608
RUST_MIN_STACK: 10485760

jobs:
runner:
Expand Down
3 changes: 3 additions & 0 deletions config/deployments/integration_test.toml
Copy link
Member

@SanchithHegde SanchithHegde Dec 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you make the same changes in the other config files as well: config/development.toml and config/docker_compose.toml?

Original file line number Diff line number Diff line change
Expand Up @@ -428,3 +428,6 @@ card_networks = "Visa, AmericanExpress, Mastercard"

[network_tokenization_supported_connectors]
connector_list = "cybersource"

[platform]
enabled = true
3 changes: 3 additions & 0 deletions config/deployments/production.toml
Original file line number Diff line number Diff line change
Expand Up @@ -444,3 +444,6 @@ card_networks = "Visa, AmericanExpress, Mastercard"

[network_tokenization_supported_connectors]
connector_list = "cybersource"

[platform]
enabled = false
3 changes: 3 additions & 0 deletions config/deployments/sandbox.toml
Original file line number Diff line number Diff line change
Expand Up @@ -446,3 +446,6 @@ card_networks = "Visa, AmericanExpress, Mastercard"

[network_tokenization_supported_connectors]
connector_list = "cybersource"

[platform]
enabled = false
14 changes: 14 additions & 0 deletions crates/diesel_models/src/merchant_account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ pub struct MerchantAccount {
pub payment_link_config: Option<serde_json::Value>,
pub pm_collect_link_config: Option<serde_json::Value>,
pub version: common_enums::ApiVersion,
pub is_platform_account: bool,
}

#[cfg(feature = "v1")]
Expand Down Expand Up @@ -83,6 +84,7 @@ pub struct MerchantAccountSetter {
pub payment_link_config: Option<serde_json::Value>,
pub pm_collect_link_config: Option<serde_json::Value>,
pub version: common_enums::ApiVersion,
pub is_platform_account: bool,
}

#[cfg(feature = "v1")]
Expand Down Expand Up @@ -117,6 +119,7 @@ impl From<MerchantAccountSetter> for MerchantAccount {
payment_link_config: item.payment_link_config,
pm_collect_link_config: item.pm_collect_link_config,
version: item.version,
is_platform_account: item.is_platform_account,
}
}
}
Expand Down Expand Up @@ -148,6 +151,7 @@ pub struct MerchantAccount {
pub recon_status: storage_enums::ReconStatus,
pub version: common_enums::ApiVersion,
pub id: common_utils::id_type::MerchantId,
pub is_platform_account: bool,
}

#[cfg(feature = "v2")]
Expand All @@ -165,6 +169,7 @@ impl From<MerchantAccountSetter> for MerchantAccount {
organization_id: item.organization_id,
recon_status: item.recon_status,
version: item.version,
is_platform_account: item.is_platform_account,
}
}
}
Expand All @@ -182,6 +187,7 @@ pub struct MerchantAccountSetter {
pub organization_id: common_utils::id_type::OrganizationId,
pub recon_status: storage_enums::ReconStatus,
pub version: common_enums::ApiVersion,
pub is_platform_account: bool,
}

impl MerchantAccount {
Expand Down Expand Up @@ -228,6 +234,7 @@ pub struct MerchantAccountNew {
pub payment_link_config: Option<serde_json::Value>,
pub pm_collect_link_config: Option<serde_json::Value>,
pub version: common_enums::ApiVersion,
pub is_platform_account: bool,
}

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

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

#[cfg(feature = "v2")]
Expand All @@ -272,6 +281,7 @@ impl MerchantAccountUpdateInternal {
modified_at,
organization_id,
recon_status,
is_platform_account,
} = self;

MerchantAccount {
Expand All @@ -286,6 +296,7 @@ impl MerchantAccountUpdateInternal {
recon_status: recon_status.unwrap_or(source.recon_status),
version: source.version,
id: source.id,
is_platform_account: is_platform_account.unwrap_or(source.is_platform_account),
}
}
}
Expand Down Expand Up @@ -319,6 +330,7 @@ pub struct MerchantAccountUpdateInternal {
pub recon_status: Option<storage_enums::ReconStatus>,
pub payment_link_config: Option<serde_json::Value>,
pub pm_collect_link_config: Option<serde_json::Value>,
pub is_platform_account: Option<bool>,
}

#[cfg(feature = "v1")]
Expand Down Expand Up @@ -350,6 +362,7 @@ impl MerchantAccountUpdateInternal {
recon_status,
payment_link_config,
pm_collect_link_config,
is_platform_account,
} = self;

MerchantAccount {
Expand Down Expand Up @@ -385,6 +398,7 @@ impl MerchantAccountUpdateInternal {
payment_link_config: payment_link_config.or(source.payment_link_config),
pm_collect_link_config: pm_collect_link_config.or(source.pm_collect_link_config),
version: source.version,
is_platform_account: is_platform_account.unwrap_or(source.is_platform_account),
}
}
}
4 changes: 4 additions & 0 deletions crates/diesel_models/src/payment_intent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ pub struct PaymentIntent {
pub id: common_utils::id_type::GlobalPaymentId,
pub psd2_sca_exemption_type: Option<storage_enums::ScaExemptionType>,
pub split_payments: Option<common_types::payments::SplitPaymentsRequest>,
pub platform_merchant_id: Option<common_utils::id_type::MerchantId>,
}

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

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

#[cfg(feature = "v1")]
Expand Down Expand Up @@ -366,6 +369,7 @@ pub struct PaymentIntentNew {
pub tax_details: Option<TaxDetails>,
pub skip_external_tax_calculation: Option<bool>,
pub psd2_sca_exemption_type: Option<storage_enums::ScaExemptionType>,
pub platform_merchant_id: Option<common_utils::id_type::MerchantId>,
pub split_payments: Option<common_types::payments::SplitPaymentsRequest>,
}

Expand Down
3 changes: 3 additions & 0 deletions crates/diesel_models/src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -717,6 +717,7 @@ diesel::table! {
payment_link_config -> Nullable<Jsonb>,
pm_collect_link_config -> Nullable<Jsonb>,
version -> ApiVersion,
is_platform_account -> Bool,
}
}

Expand Down Expand Up @@ -970,6 +971,8 @@ diesel::table! {
skip_external_tax_calculation -> Nullable<Bool>,
psd2_sca_exemption_type -> Nullable<ScaExemptionType>,
split_payments -> Nullable<Jsonb>,
#[max_length = 64]
platform_merchant_id -> Nullable<Varchar>,
}
}

Expand Down
3 changes: 3 additions & 0 deletions crates/diesel_models/src/schema_v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -708,6 +708,7 @@ diesel::table! {
version -> ApiVersion,
#[max_length = 64]
id -> Varchar,
is_platform_account -> Bool,
}
}

Expand Down Expand Up @@ -933,6 +934,8 @@ diesel::table! {
id -> Varchar,
psd2_sca_exemption_type -> Nullable<ScaExemptionType>,
split_payments -> Nullable<Jsonb>,
#[max_length = 64]
platform_merchant_id -> Nullable<Varchar>,
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,10 @@ pub enum ApiErrorResponse {
field_names: String,
connector_transaction_id: Option<String>,
},
#[error(error_type = ErrorType::InvalidRequestError, code = "IR_42", message = "API does not support platform account operation")]
PlatformAccountAuthNotSupported,
#[error(error_type = ErrorType::InvalidRequestError, code = "IR_43", message = "Invalid platform account operation")]
InvalidPlatformOperation,
}

#[derive(Clone)]
Expand Down Expand Up @@ -667,6 +671,12 @@ impl ErrorSwitch<api_models::errors::types::ApiErrorResponse> for ApiErrorRespon
..Default::default()
})
)),
Self::PlatformAccountAuthNotSupported => {
AER::BadRequest(ApiError::new("IR", 42, "API does not support platform operation", None))
}
Self::InvalidPlatformOperation => {
AER::Unauthorized(ApiError::new("IR", 43, "Invalid platform account operation", None))
}
}
}
}
Expand Down
Loading
Loading