-
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(core): customer_details storage in payment_intent #5007
Conversation
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.
Try if we can update the customer details in payment intent only if necessary rather then updating all the time. This is not critical for now and can be taken up in a later PR as well
// For the case when we don't have Customer data directly stored in Payment intent | ||
let customer_table_response: Option<CustomerDetailsResponse> = | ||
customer.as_ref().map(ForeignInto::foreign_into); | ||
|
||
// If we have customer data in Payment Intent, We are populating the Retrieve response from the | ||
// same | ||
let customer_details_response = | ||
if let Some(customer_details_raw) = payment_intent.customer_details.clone() { | ||
let customer_details_encrypted = | ||
serde_json::from_value::<CustomerData>(customer_details_raw.into_inner().expose()); | ||
if let Ok(customer_details_encrypted_data) = customer_details_encrypted { |
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 move this to a function
…t/guest_customer_details
…ay/hyperswitch into feat/guest_customer_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.
Looks fine for Dashboard specific changes
…ror-handling-in-cypress * 'main' of github.com:juspay/hyperswitch: Docs: Api reference docs update for Payments - Create (#4955) feat(cypress): add iatapay connector (#5093) chore: fix ui-test configs (#5152) chore(cards): add configuration option to change the decryption scheme locker (#5140) refactor(hyperswitch_constraint_graph): Removal of lifetime from the Constraint Graph framework (#5132) feat(core): customer_details storage in payment_intent (#5007) fix(connector): [ADYEN] send `browser_info` for all the card and googlepay payments (#5153) fix(users): clear cookie and alter parsing for sso (#5147) refactor(connector): added amount framework to paypal, payouts and routing (#4865) chore(version): 2024.06.28.0 chore(postman): update Postman collection files chore: use generic phone numbers instead (#5142)
we should also consider the guest customer details that is provided as a part of the customer object in payments request. hyperswitch/crates/api_models/src/payments.rs Line 307 in f68cde7
The |
Type of Change
Description
This change will insure storage of customer_details in our payment_intent table.
if customer_id alone is passed -> Derive customer_details from customer_table and put it in guest_customer_details,
if customer_id is not present -> Put the details in guest_customer_details.
if both are present -> we are ignoring the email, phone etc and deriving them from customer_table and adding to the guest_customer_details field.
Additional Changes
The Db Migration:
Motivation and Context
How did you test it?
Testing Scenarios
Payment create request with no
cus_id
and fields name, email, phone, phone country codePayment create request with some random
cus_id
Payment create request with a created customer's
cus_id
Payment create request with
cus_id
and all other dataPayment create request with name and payment confirm with email and phone
Payment create request with name and payment update with email and phone
Payment create request with id, name and payment update with email and phone
MCA of BOA, email in Payment create request and then List Payment Method with client secret
{
"redirect_url": "https://google.com/success",
"currency": "USD",
"payment_methods": [
{
"payment_method": "wallet",
"payment_method_types": [
{
"payment_method_type": "google_pay",
"payment_experience": [
{
"payment_experience_type": "redirect_to_url",
"eligible_connectors": [
"bankofamerica"
]
}
],
"card_networks": null,
"bank_names": null,
"bank_debits": null,
"bank_transfers": null,
"required_fields": {
"billing.address.zip": {
"required_field": "payment_method_data.billing.address.zip",
"display_name": "zip",
"field_type": "user_address_pincode",
"value": "94122"
},
"email": {
"required_field": "email",
"display_name": "email",
"field_type": "user_email_address",
"value": "payme@example.com"
},
........
Checklist
cargo +nightly fmt --all
cargo clippy