-
Notifications
You must be signed in to change notification settings - Fork 4.2k
refactor(payments): Add platform merchant account checks for payment intent #7204
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -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
Narayanbhat166
previously approved these changes
Feb 10, 2025
apoorvdixit88
previously approved these changes
Feb 10, 2025
c7cf080
Narayanbhat166
approved these changes
Feb 10, 2025
jarnura
approved these changes
Feb 10, 2025
racnan
approved these changes
Feb 11, 2025
apoorvdixit88
approved these changes
Feb 11, 2025
Chethan-rao
approved these changes
Feb 11, 2025
maverox
approved these changes
Feb 11, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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?
Checklist
cargo +nightly fmt --all
cargo clippy