-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
refactor(payments): Add platform merchant account checks for payment intent #7204
base: main
Are you sure you want to change the base?
Conversation
@@ -3419,6 +3419,27 @@ pub(crate) fn validate_payment_status_against_not_allowed_statuses( | |||
}) | |||
} | |||
|
|||
pub fn validate_platform_merchant( | |||
data_platform_merchant_id: Option<&id_type::MerchantId>, | |||
auth_platform_merchant_id: Option<&id_type::MerchantId>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can add a trait function to get the platform merchant id and then any generic that implements this trait can be passed to this function
) -> CustomResult<(), errors::ApiErrorResponse> { | ||
match (data_platform_merchant_id, auth_platform_merchant_id) { | ||
(Some(data_platform_merchant_id), Some(auth_platform_merchant_id)) => { | ||
if data_platform_merchant_id != auth_platform_merchant_id { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: you can use fp_utils::when
Type of Change
Description
Currently payment_intent stores platform_merchant_id. This can be used to identify if the payment was created by platform merchant.
If the payment was initialized by platform merchant, the merchant who is the owner of the payment should not be able to do any operations on the payment and vice versa.
So, we need those validations on payment intents to check if the current merchant can be allowed to perform those operations even if the authentication module allows it.
These payment ops are modified in the process.
Additional Changes
Motivation and Context
Closes #7203.
How did you test it?
todo!()
Checklist
cargo +nightly fmt --all
cargo clippy