hyperswitch
hyperswitch copied to clipboard
feat(connector): add dynamic duitnow qr code, google pay and applpe pay for fiuu
Type of Change
- [ ] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
Description
This PR adds support for duitnow dynamic qr code flow, Googlepay, Applepay.
Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
Motivation and Context
How did you test it?
- duitnow cannot be tested in sbx, So i have tested it in prod env
- google pay request :
{
"amount": 300,
"currency": "USD",
"confirm": true,
"capture_method": "automatic",
"capture_on": "2022-09-10T10:11:12Z",
"amount_to_capture": 300,
"customer_id": "StripeCustomer",
"email": "[email protected]",
"name": "John Doe",
"phone": "999999999",
"phone_country_code": "+1",
"description": "Its my first payment request",
"authentication_type": "no_three_ds",
"return_url": "https://google.com",
"payment_method": "wallet",
"payment_method_type": "google_pay",
"payment_method_data": {
"wallet": {
"google_pay":{
"type" :"wallet",
"info" : {
"card_network":"visa",
"card_details":"ajd"
},
"description": "Its my first payment request",
"tokenization_data" :{
"type": "sdjh",
"token":"{\"signature\":\"MEUCIQDhc8VY22qWWGPHGGvsu7XPj/SkYdWtmPZYWBEsRjZo/wIgG4RFdnIExKiPDECBnEzLuzhes5+KGGFAAdkHBfgRkho\\u003d\",\"intermediateSigningKey\":{\"signedKey\":\"{\\\"keyValue\\\":\\\"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEItPcTdXMwAWYJfvcUnhC/zNTwD3rerU1P3kEUifXS+upKS3gLLiOod7cGmtYfybCOtXZCPWtF8Hm7phz3KXoVQ\\\\u003d\\\\u003d\\\",\\\"keyExpiration\\\":\\\"1728638833861\\\"}\",\"signatures\":[\"MEYCIQC524wPLpk2wb2UflHW7pcjVlWt3U6wftis+aSOi6IDpQIhAOXQIJcB2JwaDAISPR87q/FWfaN5OqKYju1QhHAMpSHg\"]},\"protocolVersion\":\"ECv2\",\"signedMessage\":\"{\\\"encryptedMessage\\\":\\\"UVeWcXQglAL3U545D6KEWV35CHjXUEA47v6QKBdLwo6Zu5JzyEdkqmOpRGm7GP83YRyIrFojhQ2QVM8vPP0kFbPuBTmne/6452lES2undtKlSy62VbXp5EUZQ1Ril3AL+FG3/r6JeNP7JUyUP0VCOMXOMW6DG+pE7M5HSQm2wCQJgf6BKj9SXn3MO4xJs6EALoXm361Yvo2QNzdv12RMLAcrdujVcDsfoY0ALNQAY/Ei9HOPLQcWqBNNNF0KH0ZLru0reSrS4vWJ4hyoAsr2hoa+Py11Kvdwks0f+my2/nliaGZXKeCNRMznWztu52dPQF1kHWRZTDNBVTBvKocoRmnGAfI6rS13qaWmkGkqxLAfgNVJrei8qLDVMCyYMOBcoaMga+3vw0MOvX3EoV+FjZAkToWS1aQUD8E0FrFgbBQqJxQLLDfhh6VjzOAJQv5ypmQLw1yKQTgyzzgcOtWVb9Kbyw6QZWDTxA\\\\u003d\\\\u003d\\\",\\\"ephemeralPublicKey\\\":\\\"BPrP92rJx4/fQZQItlgvyYF96u29hpavsUWa5LrfdDHnHt3/wq6YsfTDltkRPo5+WewNMLn/wJc6OySIYsGVQSU\\\\u003d\\\",\\\"tag\\\":\\\"D6iTFqN7W3rkMeLBwSka6jTv1Y+v9FppS3myc+MkGuM\\\\u003d\\\"}\"}"
}
}
}
},
"billing": {
"address": {
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"city": "San Fransico",
"state": "California",
"zip": "94122",
"country": "US",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": {
"number": "8056594427",
"country_code": "+91"
}
},
"shipping": {
"address": {
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"city": "San Fransico",
"state": "California",
"zip": "94122",
"country": "US",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": {
"number": "8056594427",
"country_code": "+91"
}
},
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"metadata": {
"udf1": "value1",
"new_customer": "true",
"login_date": "2019-09-10T10:11:12Z"
}
}```
response
{ "payment_id": "pay_0TvE1N3qd0gxFkgAB6fx", "merchant_id": "merchant_1727958908", "status": "succeeded", "amount": 300, "net_amount": 300, "amount_capturable": 0, "amount_received": 300, "connector": "fiuu", "client_secret": "pay_0TvE1N3qd0gxFkgAB6fx_secret_qGdokCqwpIc5M0klVaHf", "created": "2024-10-03T14:08:13.743Z", "currency": "USD", "customer_id": "StripeCustomer", "customer": { "id": "StripeCustomer", "name": "John Doe", "email": "[email protected]", "phone": "999999999", "phone_country_code": "+1" }, "description": "Its my first payment request", "refunds": null, "disputes": null, "mandate_id": null, "mandate_data": null, "setup_future_usage": null, "off_session": null, "capture_on": null, "capture_method": "automatic", "payment_method": "wallet", "payment_method_data": { "wallet": { "google_pay": { "last4": "ajd", "card_network": "visa", "type": "wallet" } }, "billing": null }, "payment_token": null, "shipping": { "address": { "city": "San Fransico", "country": "US", "line1": "1467", "line2": "Harrison Street", "line3": "Harrison Street", "zip": "94122", "state": "California", "first_name": "joseph", "last_name": "Doe" }, "phone": { "number": "8056594427", "country_code": "+91" }, "email": null }, "billing": { "address": { "city": "San Fransico", "country": "US", "line1": "1467", "line2": "Harrison Street", "line3": "Harrison Street", "zip": "94122", "state": "California", "first_name": "joseph", "last_name": "Doe" }, "phone": { "number": "8056594427", "country_code": "+91" }, "email": null }, "order_details": null, "email": "[email protected]", "name": "John Doe", "phone": "999999999", "return_url": "https://google.com/", "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": "StripeCustomer", "created_at": 1727964493, "expires": 1727968093, "secret": "epk_340c7bc950df4779b2be2e177b93a13c" }, "manual_retry_allowed": false, "connector_transaction_id": "30882067", "frm_message": null, "metadata": { "udf1": "value1", "login_date": "2019-09-10T10:11:12Z", "new_customer": "true" }, "connector_metadata": null, "feature_metadata": null, "reference_id": null, "payment_link": null, "profile_id": "pro_BxBe6yNCNIrIl2ZlRINC", "surcharge_details": null, "attempt_count": 1, "merchant_decision": null, "merchant_connector_id": "mca_M3jaHXlh8BQ3RJr1hysS", "incremental_authorization_allowed": null, "authorization_count": null, "incremental_authorizations": null, "external_authentication_details": null, "external_3ds_authentication_attempted": false, "expires_on": "2024-10-03T14:23:13.743Z", "fingerprint": null, "browser_info": null, "payment_method_id": null, "payment_method_status": null, "updated": "2024-10-03T14:08:14.252Z", "charges": null, "frm_metadata": null, "merchant_order_reference_id": null, "order_tax_amount": null, "connector_mandate_id": null }
applepay respone: apple decrypt flow needs to be tested in prod env, this currently fails with transaction not approved in fiuu sandbox account. This needs to be tested in custom pod after deployment.
{ "payment_id": "pay_f65jeQLCsKkrInUTxfLQ", "merchant_id": "merchant_1727976558", "status": "failed", "amount": 650, "net_amount": 650, "amount_capturable": 0, "amount_received": null, "connector": "fiuu", "client_secret": "pay_f65jeQLCsKkrInUTxfLQ_secret_KmLs0fu5NGG6VGM1kqJH", "created": "2024-10-03T17:30:31.588Z", "currency": "USD", "customer_id": "test_fb", "customer": { "id": "test_fb", "name": "Joseph 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": null, "capture_on": null, "capture_method": "automatic", "payment_method": "wallet", "payment_method_data": { "wallet": { "apple_pay": { "last4": "0326", "card_network": "Mastercard", "type": "debit" } }, "billing": null }, "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": "joseph", "last_name": "Doe" }, "phone": { "number": "8056594427", "country_code": "+91" }, "email": null }, "order_details": null, "email": "[email protected]", "name": "Joseph Doe", "phone": "999999999", "return_url": "https://google.com/", "authentication_type": "three_ds", "statement_descriptor_name": "Juspay", "statement_descriptor_suffix": "Router", "next_action": null, "cancellation_reason": null, "error_code": "300", "error_message": "Transaction not approved", "unified_code": "UE_000", "unified_message": "Something went wrong", "payment_experience": null, "payment_method_type": "apple_pay", "connector_label": null, "business_country": null, "business_label": "default", "business_sub_label": null, "allowed_payment_method_types": null, "ephemeral_key": { "customer_id": "test_fb", "created_at": 1727976631, "expires": 1727980231, "secret": "epk_6a202a2569dd49818f19120a2f7009fb" }, "manual_retry_allowed": true, "connector_transaction_id": null, "frm_message": null, "metadata": null, "connector_metadata": null, "feature_metadata": null, "reference_id": null, "payment_link": null, "profile_id": "pro_njKZKluJ5UYynFk6UCMX", "surcharge_details": null, "attempt_count": 1, "merchant_decision": null, "merchant_connector_id": "mca_CANN8EPyc5P0ppj8SQIB", "incremental_authorization_allowed": false, "authorization_count": null, "incremental_authorizations": null, "external_authentication_details": null, "external_3ds_authentication_attempted": false, "expires_on": "2024-10-03T17:45:31.588Z", "fingerprint": null, "browser_info": null, "payment_method_id": null, "payment_method_status": null, "updated": "2024-10-03T17:30:32.879Z", "charges": null, "frm_metadata": null, "merchant_order_reference_id": null, "order_tax_amount": null, "connector_mandate_id": null }
## Checklist
<!-- Put an `x` in the boxes that apply -->
- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible