-
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
feat: list payment_methods with the required fields in each method #1310
Merged
Conversation
This file contains 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
Chethan-rao
added
C-feature
Category: Feature request or enhancement
S-waiting-on-review
Status: This PR has been implemented and needs to be reviewed
M-api-contract-changes
Metadata: This PR involves API contract changes
labels
May 29, 2023
Chethan-rao
requested review from
SanchithHegde,
Narayanbhat166 and
NishantJoshi00
May 29, 2023 17:22
2 tasks
Chethan-rao
changed the title
feat: list payment_methods with the missing required fields in each method
feat: list payment_methods with the required fields in each method
May 29, 2023
Chethan-rao
added
the
M-configuration-changes
Metadata: This PR involves configuration changes
label
May 29, 2023
…uired_fields_in_pmd
…uired_fields_in_pmd
…uired_fields_in_pmd
…uired_fields_in_pmd
…perswitch into required_fields_in_pmd
Chethan-rao
added
S-waiting-on-author
Status: This PR is incomplete or needs to address review comments
and removed
S-waiting-on-review
Status: This PR has been implemented and needs to be reviewed
labels
Jun 6, 2023
…uired_fields_in_pmd
…uired_fields_in_pmd
SanchithHegde
added
the
S-needs-conflict-resolution
Status: This PR needs conflicts to be resolved by the author
label
Jul 4, 2023
…uired_fields_in_pmd
Chethan-rao
dismissed stale reviews from SanchithHegde and Narayanbhat166
via
July 4, 2023 07:39
d39d4df
Chethan-rao
added
S-waiting-on-review
Status: This PR has been implemented and needs to be reviewed
and removed
S-waiting-on-author
Status: This PR is incomplete or needs to address review comments
S-needs-conflict-resolution
Status: This PR needs conflicts to be resolved by the author
labels
Jul 4, 2023
SanchithHegde
previously approved these changes
Jul 4, 2023
Narayanbhat166
previously approved these changes
Jul 4, 2023
jarnura
previously approved these changes
Jul 4, 2023
Chethan-rao
dismissed stale reviews from jarnura, Narayanbhat166, and SanchithHegde
via
July 4, 2023 09:38
84ae9a2
Narayanbhat166
approved these changes
Jul 4, 2023
SanchithHegde
approved these changes
Jul 4, 2023
SanchithHegde
added
S-ready-for-merge
and removed
S-waiting-on-review
Status: This PR has been implemented and needs to be reviewed
labels
Jul 4, 2023
SanchithHegde
removed
S-ready-for-merge
low-risk
label to track PRs which might have less impact on hyperswitch after merge
labels
Jul 4, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
C-feature
Category: Feature request or enhancement
M-api-contract-changes
Metadata: This PR involves API contract changes
M-configuration-changes
Metadata: This PR involves configuration changes
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 when
/payments
API call is made withconfirm = false
from merchant server, payment is created. Assuming the customer hasn't sent the required field in this call, when a confirm API call is made, since customer has missed to send the required filed during create call, confirm call triggers an error.So, after Payment create call is made, when payment_methods_list call will be made, along with the payment_methods we need to send the required fields for each method, so that it could be sent during confirm call.
Api changes - Added a new field
required_fields
inpayment_method_data
which lists all the required fields with its appropriate display_name, field_type and field_options.payment_method_data: {"payment_method": {"payment_method_type": "", "required_fields": {} } }
Config changes - Added
required_fields
in config which is a tuple struct containing aHashMap<PaymentMethod, PaymentMethodType>
. PaymentMethodType is also tuple struct containingHashMap<PaymentMethodType, ConnectorFields>
. ConnectorFields is a named field struct containingHashMap<Connector, HashSet<RequiredFieldInfo>>>>
and RequiredFieldInfo is a struct defined inapi_models
crate, containing info about each required field. The default implementation for the same is provided indefaults.rs
which contains data of required fields for each payment_method and payment_method_type.required_fields are added in defaults.rs in connector level. But while listing, it would be in payment_method_type level as we are not sure about which connector the payment is going through during confirm call. So we get a union of all required_fields of connectors for a particular payment_method_type
Additional Changes
Motivation and Context
To avoid failure of payments due to missing required fields
How did you test it?
Postman
Checklist
cargo +nightly fmt --all
cargo clippy