-
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_v2): create customer at connector end and populate connector customer ID #7246
Merged
Gnanasundari24
merged 5 commits into
main
from
payments-v2-create-customer-at-connector
Feb 14, 2025
Merged
refactor(payments_v2): create customer at connector end and populate connector customer ID #7246
Gnanasundari24
merged 5 commits into
main
from
payments-v2-create-customer-at-connector
Feb 14, 2025
+356
−114
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
…stomer in database
…serde_json::Value` for the `connector_customer` field
… during authorize and setup mandate flows
…arising with the `CustomerUpdate` enum
…lick_to_pay_enabled` field
Changed Files
|
SanchithHegde
commented
Feb 11, 2025
jarnura
approved these changes
Feb 12, 2025
Narayanbhat166
approved these changes
Feb 12, 2025
kashif-m
approved these changes
Feb 13, 2025
14 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
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
This PR updates the payments v2 flows to create a customer at connector's end, where applicable, and populate the connector's customer ID in
RouterData
, so that the connector integrations which need the connector customer ID can access the field and pass it along.Additionally, this PR includes some refactors done around relevant code:
serde_json::Value
for theconnector_customer
field in the customer v2 diesel and domain models.clippy::large_enum_variant
warning arising with theCustomerUpdate
v2 enum.is_click_to_pay_enabled
field in the business profile v2 code. (I just opened the file and my IDE displayed only this warning in the entire file, so I ended up fixing it.)Motivation and Context
As of opening this PR, a customer is not created on the connector's end for those connectors that support / require such an operation. And with respect to the multi-use tokens that were created with Stripe (support added in #7106), the payment methods were created on Stripe's end, but were not associated with a customer, due to which they could not be used to make transactions again, we used to receive such an error:
To address this, we have to create a customer on Stripe's end first, and then pass Stripe's customer ID when saving the payment method with Stripe.
How did you test it?
Locally, via Postman.
customer_id
field with the customer ID obtained in the previous step.connector_token_details
field) to create payments with Stripe directly (provided we pass the same connector customer ID as well).Checklist
cargo +nightly fmt --all
cargo clippy