hyperswitch
hyperswitch copied to clipboard
fix(connector): [Nexixpay] update status mapping nexixpay
Type of Change
- [x] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
Description
Update status mapping in case of setup mandate flow response for nexixpay connector. PR also involves config changes, added new supported countries.
Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
Motivation and Context
Nexixpay sends Authorized in case of zero auth mandate creation where as it send Executed in other cases, thus in case of zero auth mandate we will map Authorized as Charged in our case or else it stores status as requires capture and thus merchant will not be able to do MIT payments.
How did you test it?
Cypress test:
Below curls should be used for testing zero auth mandates:
- Payments CIT
curl --location 'localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_gFobRGpbRTGmapARon0ds1JZFYuKmGZC8jYB6HExbLxzxNKZaGueiidTWL953H3a' \
--data-raw '{
"amount": 0,
"currency": "EUR",
"confirm": false,
"capture_method": "automatic",
"capture_on": "2022-09-10T10:11:12Z",
"authentication_type": "three_ds",
"return_url": "https://abc.com",
"email": "[email protected]",
"name": "Joseph Doe",
"phone": "999999999",
"phone_country_code": "+65",
"description": "Its my first payment request",
"setup_future_usage": "off_session"
}'
Response:
{
"payment_id": "pay_VLJOwAzyFdQHi7aVMdlg",
"merchant_id": "merchant_1742812910",
"status": "requires_payment_method",
"amount": 0,
"net_amount": 0,
"shipping_cost": null,
"amount_capturable": 0,
"amount_received": null,
"connector": null,
"client_secret": "pay_VLJOwAzyFdQHi7aVMdlg_secret_HlLFpDS74gXBcvVmMjRl",
"created": "2025-03-26T13:32:02.998Z",
"currency": "EUR",
"customer_id": null,
"customer": {
"id": null,
"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": "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": null,
"name": null,
"phone": null,
"return_url": "https://abc.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": null,
"connector_label": null,
"business_country": null,
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": null,
"manual_retry_allowed": null,
"connector_transaction_id": null,
"frm_message": null,
"metadata": null,
"connector_metadata": null,
"feature_metadata": null,
"reference_id": null,
"payment_link": null,
"profile_id": "pro_MZDxE6XWcFTIYu3d1i7e",
"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": "2025-03-26T13:47:02.997Z",
"fingerprint": null,
"browser_info": null,
"payment_method_id": null,
"payment_method_status": null,
"updated": "2025-03-26T13:32:03.085Z",
"split_payments": null,
"frm_metadata": null,
"extended_authorization_applied": null,
"capture_before": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": null,
"card_discovery": null,
"issuer_error_code": null,
"issuer_error_message": null
}
- Confirm CIT
curl --location 'http://localhost:8080/payments/pay_VLJOwAzyFdQHi7aVMdlg/confirm' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_gFobRGpbRTGmapARon0ds1JZFYuKmGZC8jYB6HExbLxzxNKZaGueiidTWL953H3a' \
--data-raw '{
"amount": 0,
"currency": "EUR",
"confirm": true,
"capture_method": "automatic",
"capture_on": "2022-09-10T10:11:12Z",
"customer_id": "cus_5inf88m3Z23QaujgoIMh",
"email": "[email protected]",
"name": "John Doe",
"phone": "999999999",
"phone_country_code": "+65",
"description": "Its my first payment request",
"authentication_type": "three_ds",
"return_url": "https://hyperswitch.io",
"payment_method": "card",
"payment_method_type": "debit",
"payment_method_data": {
"card": {
"card_number": "4111111111111111",
"card_exp_month": "08",
"card_exp_year": "35",
"card_holder_name": "joseph Doe",
"card_cvc": "999"
}
},
"setup_future_usage": "off_session",
"mandate_data": {
"customer_acceptance": {
"acceptance_type": "offline",
"accepted_at": "1963-05-03T04:07:52.723Z",
"online": {
"ip_address": "125.0.0.1",
"user_agent": "amet irure esse"
}
},
"mandate_type": {
"multi_use": {
"amount": 8000,
"currency": "EUR"
}
}
},
"payment_type": "setup_mandate",
"billing": {
"address": {
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"city": "San Fransico",
"state": "California",
"zip": "94122",
"country": "IT",
"first_name": "john",
"last_name": "Doe"
}
},
"shipping": {
"address": {
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"city": "San Fransico",
"state": "California",
"zip": "94122",
"country": "IT",
"first_name": "john",
"last_name": "Doe"
}
},
"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_VLJOwAzyFdQHi7aVMdlg",
"merchant_id": "merchant_1742812910",
"status": "requires_customer_action",
"amount": 0,
"net_amount": 0,
"shipping_cost": null,
"amount_capturable": 0,
"amount_received": null,
"connector": "nexixpay",
"client_secret": "pay_VLJOwAzyFdQHi7aVMdlg_secret_HlLFpDS74gXBcvVmMjRl",
"created": "2025-03-26T13:32:02.998Z",
"currency": "EUR",
"customer_id": "cus_5inf88m3Z23QaujgoIMh",
"customer": {
"id": "cus_5inf88m3Z23QaujgoIMh",
"name": "John Doe",
"email": "[email protected]",
"phone": "999999999",
"phone_country_code": "+65"
},
"description": "Its my first payment request",
"refunds": null,
"disputes": null,
"mandate_id": "man_wd71297StV8xbHazC2i2",
"mandate_data": {
"update_mandate_id": null,
"customer_acceptance": {
"acceptance_type": "offline",
"accepted_at": "1963-05-03T04:07:52.723Z",
"online": {
"ip_address": "125.0.0.1",
"user_agent": "amet irure esse"
}
},
"mandate_type": {
"multi_use": {
"amount": 8000,
"currency": "EUR",
"start_date": null,
"end_date": null,
"metadata": null
}
}
},
"setup_future_usage": "off_session",
"off_session": null,
"capture_on": null,
"capture_method": "automatic",
"payment_method": "card",
"payment_method_data": {
"card": {
"last4": "1111",
"card_type": null,
"card_network": null,
"card_issuer": null,
"card_issuing_country": null,
"card_isin": "411111",
"card_extended_bin": null,
"card_exp_month": "08",
"card_exp_year": "35",
"card_holder_name": "joseph Doe",
"payment_checks": null,
"authentication_data": null
},
"billing": null
},
"payment_token": "token_RE7I1YmPboj7757fLIWj",
"shipping": {
"address": {
"city": "San Fransico",
"country": "IT",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "john",
"last_name": "Doe"
},
"phone": null,
"email": null
},
"billing": {
"address": {
"city": "San Fransico",
"country": "IT",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "john",
"last_name": "Doe"
},
"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": null,
"statement_descriptor_suffix": null,
"next_action": {
"type": "redirect_to_url",
"redirect_to_url": "http://localhost:8080/payments/redirect/pay_VLJOwAzyFdQHi7aVMdlg/merchant_1742812910/pay_VLJOwAzyFdQHi7aVMdlg_1"
},
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": "debit",
"connector_label": null,
"business_country": null,
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": null,
"manual_retry_allowed": null,
"connector_transaction_id": "pay_VLJOwAzyFdQHi7aVMdlg_1",
"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_VLJOwAzyFdQHi7aVMdlg_1",
"payment_link": null,
"profile_id": "pro_MZDxE6XWcFTIYu3d1i7e",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_uqfybtv2ddcJufNx01dQ",
"incremental_authorization_allowed": null,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-03-26T13:47:02.997Z",
"fingerprint": null,
"browser_info": {
"os_type": null,
"language": "en-US",
"time_zone": -330,
"ip_address": "129.0.0.1",
"os_version": null,
"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,
"device_model": null,
"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,
"accept_language": "en",
"java_script_enabled": true
},
"payment_method_id": "pm_cpJ7qqi8nV7W7RWnFflm",
"payment_method_status": "inactive",
"updated": "2025-03-26T13:41:42.365Z",
"split_payments": null,
"frm_metadata": null,
"extended_authorization_applied": null,
"capture_before": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": "AuFkgsHLirF6MZGenR",
"card_discovery": "manual",
"issuer_error_code": null,
"issuer_error_message": null
}
User redirection:
- MIT payment
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_gFobRGpbRTGmapARon0ds1JZFYuKmGZC8jYB6HExbLxzxNKZaGueiidTWL953H3a' \
--data '{
"amount": 3545,
"currency": "EUR",
"confirm": true,
"customer_id": "cus_5inf88m3Z23QaujgoIMh",
"recurring_details": {
"type": "payment_method_id",
"data": "pm_cpJ7qqi8nV7W7RWnFflm"
},
"off_session": true
}'
Response:
{
"payment_id": "pay_zHaZeNIqIhXSrcVXBPLn",
"merchant_id": "merchant_1742812910",
"status": "succeeded",
"amount": 3545,
"net_amount": 3545,
"shipping_cost": null,
"amount_capturable": 0,
"amount_received": 3545,
"connector": "nexixpay",
"client_secret": "pay_zHaZeNIqIhXSrcVXBPLn_secret_EFhgotsY8avN3HfdlheV",
"created": "2025-03-26T13:42:41.902Z",
"currency": "EUR",
"customer_id": "cus_5inf88m3Z23QaujgoIMh",
"customer": {
"id": "cus_5inf88m3Z23QaujgoIMh",
"name": "John Doe",
"email": "[email protected]",
"phone": "999999999",
"phone_country_code": "+65"
},
"description": null,
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": null,
"off_session": true,
"capture_on": null,
"capture_method": null,
"payment_method": "card",
"payment_method_data": {
"card": {
"last4": "1111",
"card_type": null,
"card_network": null,
"card_issuer": null,
"card_issuing_country": null,
"card_isin": "411111",
"card_extended_bin": null,
"card_exp_month": "08",
"card_exp_year": "35",
"card_holder_name": "joseph Doe",
"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": null,
"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": "debit",
"connector_label": null,
"business_country": null,
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": {
"customer_id": "cus_5inf88m3Z23QaujgoIMh",
"created_at": 1742996561,
"expires": 1743000161,
"secret": "epk_ec43e67106fa48c1b572cafcf6e21a40"
},
"manual_retry_allowed": false,
"connector_transaction_id": "pay_zHaZeNIqIhXSrcVXBPLn_1",
"frm_message": null,
"metadata": null,
"connector_metadata": null,
"feature_metadata": null,
"reference_id": "pay_zHaZeNIqIhXSrcVXBPLn_1",
"payment_link": null,
"profile_id": "pro_MZDxE6XWcFTIYu3d1i7e",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_uqfybtv2ddcJufNx01dQ",
"incremental_authorization_allowed": null,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-03-26T13:57:41.902Z",
"fingerprint": null,
"browser_info": null,
"payment_method_id": "pm_cpJ7qqi8nV7W7RWnFflm",
"payment_method_status": "active",
"updated": "2025-03-26T13:42:44.906Z",
"split_payments": null,
"frm_metadata": null,
"extended_authorization_applied": null,
"capture_before": null,
"merchant_order_reference_id": null,
"order_tax_amount": null,
"connector_mandate_id": "AuFkgsHLirF6MZGenR",
"card_discovery": "manual",
"issuer_error_code": null,
"issuer_error_message": null
}
Checklist
- [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