-
Notifications
You must be signed in to change notification settings - Fork 4.2k
refactor: check allowed payment method types in enabled options #7019
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
Conversation
Changed Files
|
a783ba7
to
fad712c
Compare
); | ||
} | ||
|
||
if unsupported_payment_methods.len() == allowed_payment_method_types.len() { |
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.
use fp_utils::when
@@ -309,6 +311,93 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest> | |||
) | |||
.await?; | |||
|
|||
let allowed_payment_method_types = payment_intent_new |
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.
do this validation before we create any database entities. I see that shipping and billing address are already created, and the payment_intent
as well.
common_enums::ConnectorType::PaymentProcessor, | ||
); | ||
|
||
let supporting_payment_method_types: HashSet<_> = filtered_connector_accounts |
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.
can we move this logic to an impl based on the MerchantConnectorAccount
domain type and use it in both of the places?
@@ -863,3 +863,5 @@ pub trait ShouldCallConnector { | |||
force_sync: Option<bool>, | |||
) -> bool; | |||
} | |||
|
|||
pub const MERCHANT_ID: &str = "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.
can you move this to constants, also name it appropriately so as to know where all this can be used
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.
removing this as this const is not needed, we can directly use "merchant_id"
f37301e
to
1d1317c
Compare
4ade2f6
to
e409729
Compare
c9182ba
to
9fbcc36
Compare
5f72a83
147237d
5f72a83
to
147237d
Compare
…d-memory-cache * 'main' of github.com:juspay/hyperswitch: (38 commits) fix(cypress): uncaught exceptions thrown by `hyperswitch.io` (#7092) ci(workflows): Add code coverage reporting for v2 (#6884) chore(version): 2025.01.23.0 refactor: [CYBERSOURCE, BANKOFAMERICA, WELLSFARGO] Move code to crate hyperswitch_connectors (#6908) Documentation edits made through Mintlify web editor chore: enable 128-column-tables feature for diesel crate (#6857) feat(connector): [ADYEN ] Consume transaction id for PaymentsPreProcessing error (#7061) chore(version): 2025.01.22.0 feat(routing): Integrate global success rates (#6950) feat(email): Add mailhog by default in docker-compose for local smtp server (#6869) refactor: check allowed payment method types in enabled options (#7019) feat(router): add payment method-specific features to connector feature list (#6963) Refactor: Customer email and browser Information (#7034) feat(connectors): fiuu,novalnet,worldpay - extend NTI flows (#6946) fix(cypress): address cybersource redirection inconsistency (#7057) chore(version): 2025.01.21.0 refactor(payment-link): use shouldRemoveBeforeUnloadEvents flag for handling removal of beforeunload events through SDK (#7072) refactor(router): refactor ctp flow to fetch mca_id and get the connector creds instead of connector_name (#6859) chore(version): 2025.01.20.0 fix(relay): populate connector metadata in the refunds flow (#7045) ...
Type of Change
Description
Using values in allowed_payment_method_types that were not configured during the creation of the connector results in breaking the SDK flow which shows something went wrong, as the PML call returned an empty payment method list. We need to apply this check during intent creation call.
Additional Changes
Motivation and Context
How did you test it?
Tested manually by hitting payments create api.
Test cases-
Curl:
Checklist
cargo +nightly fmt --all
cargo clippy