Skip to content

Conversation

kashif-m
Copy link
Contributor

Type of Change

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

Description

This PR corrects the Worldpay integration for NTI flows by removing threeDS from Authorize request.

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 in keeping NTI flow consistent with Worldpay.

How did you test it?

Locally, on top of #7017

Pre-requisites

  • Enable is_connector_agnostic_mit_enabled in business_profile
1. Perform CIT through Adyen

cURL

curl --location --request POST 'http://localhost:8080/payments' \
    --header 'Content-Type: application/json' \
    --header 'Accept: application/json' \
    --header 'api-key: dev_lIho0vjguqEI0zDMwln3I2u0aGHXrmoxQt2iSSDBBhN6vAh7vYN4rUlPy0jjML1d' \
    --data-raw '{"amount":100,"currency":"USD","confirm":true,"capture_method":"automatic","capture_on":"2022-09-10T10:11:12Z","customer_id":"cus_IoFeOlGhEeD54AbBdvxI","email":"[email protected]","name":"John Doe","phone":"999999999","profile_id":"pro_7kIKHNtq6xvKHlBfazbc","phone_country_code":"+65","description":"Its my first payment request","authentication_type":"three_ds","return_url":"https://hyperswitch.io","setup_future_usage":"off_session","customer_acceptance":{"acceptance_type":"online","accepted_at":"1963-05-03T04:07:52.723Z","online":{"ip_address":"127.0.0.1","user_agent":"amet irure esse"}},"connector":["adyen"],"payment_method":"card","payment_method_data":{"card":{"card_number":"4917610000000000","card_exp_month":"03","card_exp_year":"2030","card_cvc":"737","nick_name":"JD"},"billing":{"email":"[email protected]","address":{"first_name":"John","last_name":"US"}}},"billing":{"address":{"line1":"1467","line2":"Harrison Street","line3":"Harrison Street","city":"San Fransico","state":"California","zip":"94122","country":"US","first_name":"John","last_name":"US"}},"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

{"payment_id":"pay_H7rvl8msRLrDEATj7fJl","merchant_id":"merchant_1737699414","status":"requires_customer_action","amount":100,"net_amount":100,"shipping_cost":null,"amount_capturable":100,"amount_received":null,"connector":"adyen","client_secret":"pay_H7rvl8msRLrDEATj7fJl_secret_L7zRGUvytBKuDjEOSh3j","created":"2025-01-24T06:17:19.142Z","currency":"USD","customer_id":"cus_IoFeOlGhEeD54AbBdvxI","customer":{"id":"cus_IoFeOlGhEeD54AbBdvxI","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":"off_session","off_session":null,"capture_on":null,"capture_method":"automatic","payment_method":"card","payment_method_data":{"card":{"last4":"0000","card_type":null,"card_network":null,"card_issuer":null,"card_issuing_country":null,"card_isin":"491761","card_extended_bin":null,"card_exp_month":"03","card_exp_year":"2030","card_holder_name":"John US","payment_checks":null,"authentication_data":null},"billing":{"address":{"city":null,"country":null,"line1":null,"line2":null,"line3":null,"zip":null,"state":null,"first_name":"John","last_name":"US"},"phone":null,"email":"[email protected]"}},"payment_token":null,"shipping":null,"billing":{"address":{"city":"San Fransico","country":"US","line1":"1467","line2":"Harrison Street","line3":"Harrison Street","zip":"94122","state":"California","first_name":"John","last_name":"US"},"phone":null,"email":null},"order_details":null,"email":"[email protected]","name":"John Doe","phone":"999999999","return_url":"https://hyperswitch.io/","authentication_type":"three_ds","statement_descriptor_name":"joseph","statement_descriptor_suffix":"JS","next_action":{"type":"redirect_to_url","redirect_to_url":"http://localhost:8080/payments/redirect/pay_H7rvl8msRLrDEATj7fJl/merchant_1737699414/pay_H7rvl8msRLrDEATj7fJl_1"},"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_IoFeOlGhEeD54AbBdvxI","created_at":1737699439,"expires":1737703039,"secret":"epk_a77abad3e68440f386b2bfae90f7b404"},"manual_retry_allowed":null,"connector_transaction_id":"QWXC56XWVQS54FV5","frm_message":null,"metadata":{"udf1":"value1","login_date":"2019-09-10T10:11:12Z","new_customer":"true"},"connector_metadata":null,"feature_metadata":null,"reference_id":"QWXC56XWVQS54FV5","payment_link":null,"profile_id":"pro_7kIKHNtq6xvKHlBfazbc","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_hQArBUWZB4ivXfFBBr9m","incremental_authorization_allowed":null,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-01-24T06:32:19.142Z","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_19peBlu9TYmWO2bASPQL","payment_method_status":"inactive","updated":"2025-01-24T06:17:19.590Z","split_payments":null,"frm_metadata":null,"merchant_order_reference_id":null,"order_tax_amount":null,"connector_mandate_id":null}
  • Open 3DS link and complete the txn
  • Retrieve payment_method_id
2. MIT through Worldpay (three_ds)

cURL

curl --location --request POST 'http://localhost:8080/payments' \
    --header 'Content-Type: application/json' \
    --header 'Accept: application/json' \
    --header 'api-key: dev_lIho0vjguqEI0zDMwln3I2u0aGHXrmoxQt2iSSDBBhN6vAh7vYN4rUlPy0jjML1d' \
    --data-raw '{"amount":6500,"currency":"USD","confirm":true,"capture_method":"automatic","capture_on":"2022-09-10T10:11:12Z","customer_id":"cus_IoFeOlGhEeD54AbBdvxI","email":"[email protected]","name":"John Doe","phone":"999999999","profile_id":"pro_7kIKHNtq6xvKHlBfazbc","phone_country_code":"+65","description":"Its my first payment request","authentication_type":"three_ds","return_url":"https://hyperswitch.io","off_session":true,"recurring_details":{"type":"payment_method_id","data":"pm_19peBlu9TYmWO2bASPQL"},"connector":["worldpay"],"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

{"payment_id":"pay_5LvOZ6RQsFmyQqDvaqXh","merchant_id":"merchant_1737699414","status":"succeeded","amount":6500,"net_amount":6500,"shipping_cost":null,"amount_capturable":0,"amount_received":6500,"connector":"worldpay","client_secret":"pay_5LvOZ6RQsFmyQqDvaqXh_secret_njW4m0eWv4WWrYHXyUws","created":"2025-01-24T06:49:49.063Z","currency":"USD","customer_id":"cus_IoFeOlGhEeD54AbBdvxI","customer":{"id":"cus_IoFeOlGhEeD54AbBdvxI","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":"card","payment_method_data":{"card":{"last4":"0000","card_type":null,"card_network":null,"card_issuer":null,"card_issuing_country":null,"card_isin":"491761","card_extended_bin":null,"card_exp_month":"03","card_exp_year":"2030","card_holder_name":"John US","payment_checks":null,"authentication_data":null},"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":"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":null,"connector_label":null,"business_country":null,"business_label":"default","business_sub_label":null,"allowed_payment_method_types":null,"ephemeral_key":{"customer_id":"cus_IoFeOlGhEeD54AbBdvxI","created_at":1737701389,"expires":1737704989,"secret":"epk_37a0d95869a44072afca52b6a53523b0"},"manual_retry_allowed":false,"connector_transaction_id":"eyJrIjoiazNhYjYzMiIsImxpbmtWZXJzaW9uIjoiNi4wLjAifQ==.sN:g8wd64bwkbrp0md+bPxcanBnk2zLdsIqSa1pR99GGg8fCNQpPLoWNslSzWNPFBM5Tpa8tW7EFI5onKINsgChMHeJVoeH2lrBWCRyjZYT6h+lbqfJa+1BSoKFSY8HLWG3iYvLMl12v8Akq6Pt+SKmRV:l4OVG3XzCOZGpobnymfgF9Uk2Www3mSVoKRxeIXIe9pic4l22Rveu3MW0qp:7+4GYJYOg3e9WdLnxDKf8zDOVuNV9Smp3TrKAPuNF+l9HY8h4r+1y1WBHupQz59qPpv59wMMnZCI15w9voaKGUgn8jvCNhmdUlN6uDEfAu3+Gpx8cadeYO0VLI6Wl9IlaVI4eDFRFhVVWboq417XA0B7A7omqvwyPr9UpXP4WEW0OwEozD:UT7vKzbOBIqfC+WwXVvDoxGmrxlJztOw0Zye5zF6oXedJ3PRFO1S38DZNrYIkRNlWpYaVeOJiIYYJegfV4WMVmEHXUV1JsgVeJ7ye7vUhLQaQWH669jc7KxCb6UloO7ZTj7Q+18PY5jSOT91RpDIiNOKkj:oboIAbw=","frm_message":null,"metadata":{"udf1":"value1","login_date":"2019-09-10T10:11:12Z","new_customer":"true"},"connector_metadata":null,"feature_metadata":null,"reference_id":"92b96418-ccfc-4a41-b882-c196f2d17d91","payment_link":null,"profile_id":"pro_7kIKHNtq6xvKHlBfazbc","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_c38WWereiWnpVCtrDTmH","incremental_authorization_allowed":null,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-01-24T07:04:49.062Z","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_19peBlu9TYmWO2bASPQL","payment_method_status":"active","updated":"2025-01-24T06:49:51.258Z","split_payments":null,"frm_metadata":null,"merchant_order_reference_id":null,"order_tax_amount":null,"connector_mandate_id":null}
3. MIT through Worldpay (no_three_ds)

cURL

curl --location --request POST 'http://localhost:8080/payments' \
    --header 'Content-Type: application/json' \
    --header 'Accept: application/json' \
    --header 'api-key: dev_lIho0vjguqEI0zDMwln3I2u0aGHXrmoxQt2iSSDBBhN6vAh7vYN4rUlPy0jjML1d' \
    --data-raw '{"amount":6500,"currency":"USD","confirm":true,"capture_method":"automatic","capture_on":"2022-09-10T10:11:12Z","customer_id":"cus_IoFeOlGhEeD54AbBdvxI","email":"[email protected]","name":"John Doe","phone":"999999999","profile_id":"pro_7kIKHNtq6xvKHlBfazbc","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_19peBlu9TYmWO2bASPQL"},"connector":["worldpay"],"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

{"payment_id":"pay_aKGXEEjMffosxq4yATfF","merchant_id":"merchant_1737699414","status":"succeeded","amount":6500,"net_amount":6500,"shipping_cost":null,"amount_capturable":0,"amount_received":6500,"connector":"worldpay","client_secret":"pay_aKGXEEjMffosxq4yATfF_secret_0t5aKcNGKvMSBZ73rq7Q","created":"2025-01-24T06:54:15.005Z","currency":"USD","customer_id":"cus_IoFeOlGhEeD54AbBdvxI","customer":{"id":"cus_IoFeOlGhEeD54AbBdvxI","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":"card","payment_method_data":{"card":{"last4":"0000","card_type":null,"card_network":null,"card_issuer":null,"card_issuing_country":null,"card_isin":"491761","card_extended_bin":null,"card_exp_month":"03","card_exp_year":"2030","card_holder_name":"John US","payment_checks":null,"authentication_data":null},"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":null,"connector_label":null,"business_country":null,"business_label":"default","business_sub_label":null,"allowed_payment_method_types":null,"ephemeral_key":{"customer_id":"cus_IoFeOlGhEeD54AbBdvxI","created_at":1737701654,"expires":1737705254,"secret":"epk_f22c70c671db4033ab961e4c22ae527e"},"manual_retry_allowed":false,"connector_transaction_id":"eyJrIjoiazNhYjYzMiIsImxpbmtWZXJzaW9uIjoiNi4wLjAifQ==.sN:g8wd64bwkbrp0md+bPxcanBnk2zLdsIqSa1pR99GGg8fCNQpPLoWNslSzWNPFBM5Tpa8tW7EFI5onKINsgChMHeJVoeH2lrBWCRyjZYT6h+lbqfJa+1BSoKFSY8HLGSTASY95iq12AOTIBUlbsIGcbISmRKqyXIcHxP13A3qmfgF9Uk2Www3mSVoKRxeIXIe9pic4l22Rveu3MW0qp:7+4GYJYOg3e9WdLnxDKf8zDOVuNV9Smp3TrKAPuNF+l9HY8h4r+1y1WBHupQz59qPpv59wMMnZCI15w9voaKGUgn8jvCNhmdUlN6uDEfAu3+Gpx8cadeYO0VLI6Wl9InLGVywmC7PhBaHgcQaHenojnpgUJrlrQeSkmSEIXwt1fH1esPYY8WNPjoRYtjOHTS+WwXVvDoxGmrxlJztOw0Zye5zF6oXedJ3PRFO1S38DZNrYIkRNlWpYaVeOJiIYYJegfV4WMVmEHXUV1JsgVeJ7ye7vUhLQaQWH669jc7Kx9M5pRUpP39THyBJ9inGcU+T91RpDIiNOKkj:oboIAbw=","frm_message":null,"metadata":{"udf1":"value1","login_date":"2019-09-10T10:11:12Z","new_customer":"true"},"connector_metadata":null,"feature_metadata":null,"reference_id":"845551ad-c9a7-4722-8f8c-42d05097f692","payment_link":null,"profile_id":"pro_7kIKHNtq6xvKHlBfazbc","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_c38WWereiWnpVCtrDTmH","incremental_authorization_allowed":null,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-01-24T07:09:15.005Z","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_19peBlu9TYmWO2bASPQL","payment_method_status":"active","updated":"2025-01-24T06:54:16.779Z","split_payments":null,"frm_metadata":null,"merchant_order_reference_id":null,"order_tax_amount":null,"connector_mandate_id":null}

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 added the A-connector-integration Area: Connector integration label Jan 24, 2025
@kashif-m kashif-m self-assigned this Jan 24, 2025
@kashif-m kashif-m requested a review from a team as a code owner January 24, 2025 06:54
Copy link

semanticdiff-com bot commented Jan 24, 2025

Review changes with  SemanticDiff

Changed Files
File Status
  crates/hyperswitch_connectors/src/connectors/worldpay/transformers.rs  52% smaller
  crates/hyperswitch_connectors/src/connectors/worldpay/requests.rs  0% smaller

@kashif-m kashif-m linked an issue Jan 24, 2025 that may be closed by this pull request
@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue Jan 27, 2025
@Gnanasundari24 Gnanasundari24 removed this pull request from the merge queue due to a manual request Jan 27, 2025
@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue Jan 31, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Jan 31, 2025
@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue Feb 3, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 3, 2025
@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue Feb 5, 2025
Merged via the queue into main with commit d443a4c Feb 5, 2025
18 of 21 checks passed
@Gnanasundari24 Gnanasundari24 deleted the 7070-wp-nti-fix branch February 5, 2025 15:13
Narayanbhat166 pushed a commit that referenced this pull request Feb 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-connector-integration Area: Connector integration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[INTEGRATION] Worldpay Integration
4 participants