-
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(payment_methods_v2): implement a barebones version of list customer payment methods v2 #6649
base: main
Are you sure you want to change the base?
feat(payment_methods_v2): implement a barebones version of list customer payment methods v2 #6649
Conversation
… in `CustomerPaymentMethod`
…ch on `payment_method_data` instead
…alias for `payment_method_data` field
…chant reference ID
…ning with v2 features enabled
…_ops()` call in `list_customer_payment_method()`
Changed Files
|
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.
Dashboard specific changes looks fine.
Some(payment_methods::PaymentMethodsData::BankDetails(bank_details)) => { | ||
let get_bank_account_token_data = | ||
|| -> errors::CustomResult<payment_methods::BankAccountTokenData, errors::ApiErrorResponse> { | ||
let connector_details = bank_details |
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.
why we need to take first here?
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.
This seems to be related to payment method authentication flows.
Looping in @Sarthak1799.
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.
The types and flow here seem specific to PM auth flows in v1.
The first connector details are stored in redis for payment token flow (This would later on be fetched in payments confirm for calling connector).
…o `token_data` in `PaymentMethodListContext`
Type of Change
Description
This PR implements a very basic version of the list customer payment methods v2 route, including some refactors made along the way.
This PR includes the following changes:
created
field to be a required field inCustomerPaymentMethod
. I've also fixed a minor error in the documentation comment for that field.get_pm_list_context()
function to match on thepayment_method_data
field, which simplifies code to some extent.PaymentMethodListContext
type to be an enum (only in v2), since this helps simplify some logic.TODO
comment aroundperform_surcharge_ops()
call inlist_customer_payment_method()
, since that hasn't been implemented yet.payment_method_data
field in thePaymentMethod
v2 domain model to useOptionalEncryptableJsonType
type alias. (This addresses a comment on my previous PR: refactor(payment_methods_v2): renamepayment_method
andpayment_method_type
fields and use concrete type forpayment_method_data
#6555 (comment).)Additionally, I've included these fixes I identified when testing my code changes:
AuthenticationDataV2
type was renamed toAuthenticationData
.Testing this involved some manual insertion of data with SQL queries, and fiddling of data in the database. Additionally, I could not test the scenario where the API call is associated with a payment, because there are a couple of panics in that code path, and I'm not completely sure what the implementations of those functions should be.
Feel free to review the PR one commit at a time, if that helps.
Additional Changes
This PR makes the
created
field to be a required field inCustomerPaymentMethod
type, and updates the documentation comment for the same field.Motivation and Context
Partially implements a new route related to payment methods v2.
How did you test it?
Testing this on hosted environments is not directly possible, since this involves inserting data into the database using SQL queries rather than with APIs.
To test the changes in this PR, I had to manually insert some data into the database using SQL queries, since the save payment methods v2 route is not completely implemented.
Once the data was inserted, I tried the endpoint by using a request as follows (the response is also attached):
Also, I could not test the scenario where the API call is associated with a payment, because there are a couple of panics in that code path, and I'm not completely sure what the implementations of those functions should be.
Checklist
cargo +nightly fmt --all
cargo clippy