Skip to content
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(payments): propagate additional payment method data for google pay during MIT #6644

Merged
merged 3 commits into from
Nov 26, 2024

Conversation

kashif-m
Copy link
Contributor

@kashif-m kashif-m commented Nov 22, 2024

Type of Change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring
  • Dependency updates
  • Documentation
  • CI/CD

Description

Described in #5858 # 2 point

Additional Changes

  • This PR modifies the API contract
  • This PR modifies the database schema
  • This PR modifies application configuration/environment variables

Motivation and Context

Helps the requestor identify the cards used for GooglePay MIT

How did you test it?

Using Adyen's GPay CIT and MIT transactions

1. Create a payment link (CIT for future uses)

cURL

curl --location --request POST 'http://localhost:8080/payments' \
    --header 'Content-Type: application/json' \
    --header 'Accept: application/json' \
    --header 'api-key: dev_y1KsGsLkn9B3ZruidtCYZVHA5sGL6u9vlIwTMhLD1QsVp04x766uWdrvc7st37At' \
    --data-raw '{"authentication_type":"no_three_ds","customer_id":"cus_DYMtbNUqf3wErjOjcZXy","profile_id":"pro_sM6tKJWMBFyr4lsWTpcI","amount":100,"currency":"USD","payment_link":true,"setup_future_usage":"off_session","connector":["adyen"],"capture_method":"automatic","email":"[email protected]","session_expiry":10000,"return_url":"https://example.com","payment_link_config":{"theme":"#14356f","logo":"https://hyperswitch.io/favicon.ico","seller_name":"Hyperswitch Inc."}}'

Response

{"payment_id":"pay_GSNRKMc5gDRwEeJjSryk","merchant_id":"merchant_1732617559","status":"requires_payment_method","amount":100,"net_amount":100,"shipping_cost":null,"amount_capturable":100,"amount_received":null,"connector":null,"client_secret":"pay_GSNRKMc5gDRwEeJjSryk_secret_X3NpMpozPum0Gi8rBM80","created":"2024-11-26T10:41:59.952Z","currency":"USD","customer_id":"cus_DYMtbNUqf3wErjOjcZXy","customer":{"id":"cus_DYMtbNUqf3wErjOjcZXy","name":"John Doe","email":"[email protected]","phone":"6168205366","phone_country_code":"+1"},"description":null,"refunds":null,"disputes":null,"mandate_id":null,"mandate_data":null,"setup_future_usage":"off_session","off_session":null,"capture_on":null,"capture_method":"automatic","payment_method":null,"payment_method_data":null,"payment_token":null,"shipping":null,"billing":null,"order_details":null,"email":"[email protected]","name":"John Doe","phone":"6168205366","return_url":"https://example.com/","authentication_type":"no_three_ds","statement_descriptor_name":null,"statement_descriptor_suffix":null,"next_action":null,"cancellation_reason":null,"error_code":null,"error_message":null,"unified_code":null,"unified_message":null,"payment_experience":null,"payment_method_type":null,"connector_label":null,"business_country":null,"business_label":"default","business_sub_label":null,"allowed_payment_method_types":null,"ephemeral_key":{"customer_id":"cus_DYMtbNUqf3wErjOjcZXy","created_at":1732617719,"expires":1732621319,"secret":"epk_7d5167d10116455fa27c36a38a6fa3e7"},"manual_retry_allowed":null,"connector_transaction_id":null,"frm_message":null,"metadata":null,"connector_metadata":null,"feature_metadata":null,"reference_id":null,"payment_link":{"link":"http://localhost:8080/payment_link/merchant_1732617559/pay_GSNRKMc5gDRwEeJjSryk?locale=en","secure_link":null,"payment_link_id":"plink_gR2yXhCPMRKid7pKDuaH"},"profile_id":"pro_sM6tKJWMBFyr4lsWTpcI","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":null,"incremental_authorization_allowed":null,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2024-11-26T13:28:39.951Z","fingerprint":null,"browser_info":null,"payment_method_id":null,"payment_method_status":null,"updated":"2024-11-26T10:41:59.963Z","charges":null,"frm_metadata":null,"merchant_order_reference_id":null,"order_tax_amount":null,"connector_mandate_id":null}

Open payment link and process using GPay

Retrieve payment

curl --location --request GET 'http://localhost:8080/payments/pay_GSNRKMc5gDRwEeJjSryk' \
    --header 'Accept: application/json' \
    --header 'api-key: dev_y1KsGsLkn9B3ZruidtCYZVHA5sGL6u9vlIwTMhLD1QsVp04x766uWdrvc7st37At'

Response (verify payment_method_data in response)

{"payment_id":"pay_GSNRKMc5gDRwEeJjSryk","merchant_id":"merchant_1732617559","status":"succeeded","amount":100,"net_amount":100,"shipping_cost":null,"amount_capturable":0,"amount_received":100,"connector":"adyen","client_secret":"pay_GSNRKMc5gDRwEeJjSryk_secret_X3NpMpozPum0Gi8rBM80","created":"2024-11-26T10:41:59.952Z","currency":"USD","customer_id":"cus_DYMtbNUqf3wErjOjcZXy","customer":{"id":"cus_DYMtbNUqf3wErjOjcZXy","name":"John Doe","email":"[email protected]","phone":"6168205366","phone_country_code":"+1"},"description":null,"refunds":null,"disputes":null,"mandate_id":null,"mandate_data":null,"setup_future_usage":"off_session","off_session":null,"capture_on":null,"capture_method":"automatic","payment_method":"wallet","payment_method_data":{"wallet":{"google_pay":{"last4":"0002","card_network":"AMEX","type":"CARD"}},"billing":null},"payment_token":null,"shipping":null,"billing":null,"order_details":null,"email":"[email protected]","name":"John Doe","phone":"6168205366","return_url":"https://example.com/","authentication_type":"three_ds","statement_descriptor_name":null,"statement_descriptor_suffix":null,"next_action":null,"cancellation_reason":null,"error_code":null,"error_message":null,"unified_code":null,"unified_message":null,"payment_experience":null,"payment_method_type":"google_pay","connector_label":null,"business_country":null,"business_label":"default","business_sub_label":null,"allowed_payment_method_types":null,"ephemeral_key":null,"manual_retry_allowed":false,"connector_transaction_id":"G3KHBBJPBCKN2S65","frm_message":null,"metadata":null,"connector_metadata":null,"feature_metadata":null,"reference_id":"pay_GSNRKMc5gDRwEeJjSryk_1","payment_link":null,"profile_id":"pro_sM6tKJWMBFyr4lsWTpcI","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_xYTHzmcNXozYAu6ILLf2","incremental_authorization_allowed":null,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2024-11-26T13:28:39.951Z","fingerprint":null,"browser_info":{"language":"en-US","time_zone":-330,"ip_address":"::1","user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.4 Safari/605.1.15","color_depth":24,"java_enabled":true,"screen_width":1728,"accept_header":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8","screen_height":1117,"java_script_enabled":true},"payment_method_id":"pm_6OLW7u9HRIGE1RcfAPIk","payment_method_status":"active","updated":"2024-11-26T10:44:13.616Z","charges":null,"frm_metadata":null,"merchant_order_reference_id":null,"order_tax_amount":null,"connector_mandate_id":null}
2. Create GPay MIT

Use payment_method_id from previous step

curl --location --request POST 'http://localhost:8080/payments' \
    --header 'Content-Type: application/json' \
    --header 'Accept: application/json' \
    --header 'api-key: dev_y1KsGsLkn9B3ZruidtCYZVHA5sGL6u9vlIwTMhLD1QsVp04x766uWdrvc7st37At' \
    --data-raw '{"amount":6500,"currency":"USD","confirm":true,"capture_method":"automatic","capture_on":"2022-09-10T10:11:12Z","customer_id":"cus_DYMtbNUqf3wErjOjcZXy","email":"[email protected]","name":"John Doe","phone":"999999999","profile_id":"pro_sM6tKJWMBFyr4lsWTpcI","phone_country_code":"+65","description":"Its my first payment request","authentication_type":"no_three_ds","return_url":"https://hyperswitch.io","off_session":true,"recurring_details":{"type":"payment_method_id","data":"pm_6OLW7u9HRIGE1RcfAPIk"},"connector":["adyen"],"statement_descriptor_name":"joseph","statement_descriptor_suffix":"JS","metadata":{"udf1":"value1","new_customer":"true","login_date":"2019-09-10T10:11:12Z"},"browser_info":{"ip_address":"129.0.0.1","user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36","accept_header":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8","language":"en-US","color_depth":32,"screen_height":1117,"screen_width":1728,"time_zone":-330,"java_enabled":true,"java_script_enabled":true}}'

Response (Verify payment_method_data)

{"payment_id":"pay_xmeQ3ppk1UWZF2UI0NwW","merchant_id":"merchant_1732617559","status":"succeeded","amount":6500,"net_amount":6500,"shipping_cost":null,"amount_capturable":0,"amount_received":6500,"connector":"adyen","client_secret":"pay_xmeQ3ppk1UWZF2UI0NwW_secret_dUxHa4fXuMhhis3l2Uqw","created":"2024-11-26T10:45:17.654Z","currency":"USD","customer_id":"cus_DYMtbNUqf3wErjOjcZXy","customer":{"id":"cus_DYMtbNUqf3wErjOjcZXy","name":"John Doe","email":"[email protected]","phone":"999999999","phone_country_code":"+65"},"description":"Its my first payment request","refunds":null,"disputes":null,"mandate_id":null,"mandate_data":null,"setup_future_usage":null,"off_session":true,"capture_on":null,"capture_method":"automatic","payment_method":"wallet","payment_method_data":{"wallet":{"google_pay":{"last4":"0002","card_network":"AMEX","type":"CARD"}},"billing":null},"payment_token":null,"shipping":null,"billing":null,"order_details":null,"email":"[email protected]","name":"John Doe","phone":"999999999","return_url":"https://hyperswitch.io/","authentication_type":"no_three_ds","statement_descriptor_name":"joseph","statement_descriptor_suffix":"JS","next_action":null,"cancellation_reason":null,"error_code":null,"error_message":null,"unified_code":null,"unified_message":null,"payment_experience":null,"payment_method_type":"google_pay","connector_label":null,"business_country":null,"business_label":"default","business_sub_label":null,"allowed_payment_method_types":null,"ephemeral_key":{"customer_id":"cus_DYMtbNUqf3wErjOjcZXy","created_at":1732617917,"expires":1732621517,"secret":"epk_01c8c2825ebd4d09975d4ae28251704a"},"manual_retry_allowed":false,"connector_transaction_id":"N6L3PNWK585QJ2V5","frm_message":null,"metadata":{"udf1":"value1","login_date":"2019-09-10T10:11:12Z","new_customer":"true"},"connector_metadata":null,"feature_metadata":null,"reference_id":"pay_xmeQ3ppk1UWZF2UI0NwW_1","payment_link":null,"profile_id":"pro_sM6tKJWMBFyr4lsWTpcI","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_xYTHzmcNXozYAu6ILLf2","incremental_authorization_allowed":null,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2024-11-26T11:00:17.654Z","fingerprint":null,"browser_info":{"language":"en-US","time_zone":-330,"ip_address":"129.0.0.1","user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36","color_depth":32,"java_enabled":true,"screen_width":1728,"accept_header":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8","screen_height":1117,"java_script_enabled":true},"payment_method_id":"pm_6OLW7u9HRIGE1RcfAPIk","payment_method_status":"active","updated":"2024-11-26T10:45:19.145Z","charges":null,"frm_metadata":null,"merchant_order_reference_id":null,"order_tax_amount":null,"connector_mandate_id":"XR9D2WCG7NRH9275"}

Checklist

  • I formatted the code cargo +nightly fmt --all
  • I addressed lints thrown by cargo clippy
  • I reviewed the submitted code
  • I added unit tests for my changes where possible

@kashif-m kashif-m self-assigned this Nov 22, 2024
@kashif-m kashif-m requested review from a team as code owners November 22, 2024 12:36
Copy link

semanticdiff-com bot commented Nov 22, 2024

@kashif-m kashif-m linked an issue Nov 22, 2024 that may be closed by this pull request
2 tasks
@kashif-m kashif-m added A-core Area: Core flows A-payment-methods Area: Payment Methods labels Nov 22, 2024
@kashif-m kashif-m requested a review from Sarthak1799 November 26, 2024 06:50
@likhinbopanna likhinbopanna added this pull request to the merge queue Nov 26, 2024
Merged via the queue into main with commit 75fe9c0 Nov 26, 2024
19 of 21 checks passed
@likhinbopanna likhinbopanna deleted the 5868-wallets-additional-data-during-mit branch November 26, 2024 14:14
pixincreate added a commit that referenced this pull request Nov 27, 2024
…ed-cypress

* 'main' of github.com:juspay/hyperswitch:
  chore(version): 2024.11.27.0
  fix(core): add payment_id as query param in merchant return url (#6665)
  feat(connector): [Netcetera] add sca exemption (#6611)
  feat(payments): propagate additional payment method data for google pay during MIT (#6644)
  feat: Added grpc based health check (#6441)
  feat(analytics): add `sessionized_metrics` for disputes analytics (#6573)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-core Area: Core flows A-payment-methods Area: Payment Methods
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] Extend storage of additional payment method details to wallets
5 participants