[ ] This PR modifies application configuration/environment variables
Motivation and Context
For Customer-Initiated Transactions (CIT) with Paybox, authorization and capture must be performed as two separate operations. Paybox does not support a combined authorization and capture in a single request. To avoid requiring the merchant to handle this process, we introduced a new capture method: SequentialAutomatic, which ensures that two API calls are made automatically.
Type of Change
Description
1) Added a new CaptureMethod : SequentialAutomatic -> does Auth and capture in two api calls one after the other
For Paybox:
Auth
)Capture
)SequentialAutomatic
will function the same asAutomatic
.For other connectors:
SequentialAutomatic
will behave the same asAutomatic
. https://docs.google.com/document/d/1pokpfrBJGVrHGcyeTkfArAxdIo2ZBR3jNefSj5qbG6E/edit?tab=t.0Additional Changes
Motivation and Context
For Customer-Initiated Transactions (CIT) with Paybox, authorization and capture must be performed as two separate operations. Paybox does not support a combined authorization and capture in a single request. To avoid requiring the merchant to handle this process, we introduced a new capture method: SequentialAutomatic, which ensures that two API calls are made automatically.
How did you test it?
curl --location 'http://localhost:8080/payments' \ --header 'Content-Type: application/json' \ --header 'Accept: application/json' \ --header 'api-key: dev_wmCOQW4LM2BHYugFWaU8crmipDtmGDsq0iozaQhe17CtM59tqCHSAtD8w646AkZU' \ --data '{ "amount": 501, "currency": "EUR", "confirm": true, "capture_method": "sequential_automatic", "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" } }, "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" } }, "payment_method": "card", "payment_method_data": { "card": { "card_number": "5200000000000007", "card_exp_month": "01", "card_exp_year": "26", "card_holder_name": "John T", "card_cvc": "123" } }, "customer_id":"test_mit", "authentication_type": "three_ds", "return_url": "https://google.com", "setup_future_usage": "off_session" }'
{ "payment_id": "pay_Q75JaLo7wPiCAh8nrkZc", "merchant_id": "postman_merchant_GHAction_3a560136-e947-4667-bb84-2f015fcc1196", "status": "requires_customer_action", "amount": 501, "net_amount": 501, "shipping_cost": null, "amount_capturable": 501, "amount_received": null, "connector": "paybox", "client_secret": "pay_Q75JaLo7wPiCAh8nrkZc_secret_Qa4XYmBSyuDUbaqKtJ7r", "created": "2024-11-19T03:58:16.513Z", "currency": "EUR", "customer_id": "test_mit", "customer": { "id": "test_mit", "name": "Joseph Doe", "email": "something@gmail.com", "phone": "999999999", "phone_country_code": "+65" }, "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": "sequential_automatic", "payment_method": "card", "payment_method_data": { "card": { "last4": "0007", "card_type": null, "card_network": null, "card_issuer": null, "card_issuing_country": null, "card_isin": "520000", "card_extended_bin": null, "card_exp_month": "01", "card_exp_year": "26", "card_holder_name": null, "payment_checks": null, "authentication_data": null }, "billing": null }, "payment_token": "token_9qL6FgoOzIVLvviNRNwL", "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": "something@gmail.com", "name": "Joseph Doe", "phone": "999999999", "return_url": "https://google.com/", "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_Q75JaLo7wPiCAh8nrkZc/postman_merchant_GHAction_3a560136-e947-4667-bb84-2f015fcc1196/pay_Q75JaLo7wPiCAh8nrkZc_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": "test_mit", "created_at": 1731988696, "expires": 1731992296, "secret": "epk_e83b819668e84eb99ab249e855471ed8" }, "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_hl5seUYAuPOk5MN8bSGO", "surcharge_details": null, "attempt_count": 1, "merchant_decision": null, "merchant_connector_id": "mca_DsQkwRcnsQVWJ7jbsSZl", "incremental_authorization_allowed": null, "authorization_count": null, "incremental_authorizations": null, "external_authentication_details": null, "external_3ds_authentication_attempted": false, "expires_on": "2024-11-19T04:13:16.513Z", "fingerprint": null, "browser_info": null, "payment_method_id": "pm_vdP2g5rwDJBoKDubJPvQ", "payment_method_status": "inactive", "updated": "2024-11-19T03:58:17.469Z", "charges": null, "frm_metadata": null, "merchant_order_reference_id": null, "order_tax_amount": null, "connector_mandate_id": null }
1.1. Payment Sync
curl --location 'http://localhost:8080/payments/pay_DMkbjecVspKCAf7Sjl2o' \ --header 'Accept: application/json' \ --header 'api-key: dev_wmCOQW4LM2BHYugFWaU8crmipDtmGDsq0iozaQhe17CtM59tqCHSAtD8w646AkZU'
{ "payment_id": "pay_Q75JaLo7wPiCAh8nrkZc", "merchant_id": "postman_merchant_GHAction_3a560136-e947-4667-bb84-2f015fcc1196", "status": "succeeded", "amount": 501, "net_amount": 501, "shipping_cost": null, "amount_capturable": 0, "amount_received": 501, "connector": "paybox", "client_secret": "pay_Q75JaLo7wPiCAh8nrkZc_secret_Qa4XYmBSyuDUbaqKtJ7r", "created": "2024-11-19T03:58:16.513Z", "currency": "EUR", "customer_id": "test_mit", "customer": { "id": "test_mit", "name": "Joseph Doe", "email": "something@gmail.com", "phone": "999999999", "phone_country_code": "+65" }, "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": "sequential_automatic", "payment_method": "card", "payment_method_data": { "card": { "last4": "0007", "card_type": null, "card_network": null, "card_issuer": null, "card_issuing_country": null, "card_isin": "520000", "card_extended_bin": null, "card_exp_month": "01", "card_exp_year": "26", "card_holder_name": null, "payment_checks": null, "authentication_data": null }, "billing": null }, "payment_token": "token_9qL6FgoOzIVLvviNRNwL", "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": "something@gmail.com", "name": "Joseph Doe", "phone": "999999999", "return_url": "https://google.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": false, "connector_transaction_id": "0080164085", "frm_message": null, "metadata": null, "connector_metadata": null, "feature_metadata": null, "reference_id": null, "payment_link": null, "profile_id": "pro_hl5seUYAuPOk5MN8bSGO", "surcharge_details": null, "attempt_count": 1, "merchant_decision": null, "merchant_connector_id": "mca_DsQkwRcnsQVWJ7jbsSZl", "incremental_authorization_allowed": null, "authorization_count": null, "incremental_authorizations": null, "external_authentication_details": null, "external_3ds_authentication_attempted": false, "expires_on": "2024-11-19T04:13:16.513Z", "fingerprint": null, "browser_info": null, "payment_method_id": "pm_vdP2g5rwDJBoKDubJPvQ", "payment_method_status": "active", "updated": "2024-11-19T03:59:47.678Z", "charges": null, "frm_metadata": null, "merchant_order_reference_id": null, "order_tax_amount": null, "connector_mandate_id": null }
1.3. MIT payment
2.2MIT payment -Request curl --location 'http://localhost:8080/payments' \ --header 'Content-Type: application/json' \ --header 'Accept: application/json' \ --header 'api-key: dev_wmCOQW4LM2BHYugFWaU8crmipDtmGDsq0iozaQhe17CtM59tqCHSAtD8w646AkZU' \ --data-raw '{ "amount": 7100, "currency": "EUR", "confirm": true, "customer_id": "test_mit", "email": "guest@example.com", "off_session": true, "recurring_details": { "type": "payment_method_id", "data": "pm_fjGE1FjOztrWm26w5gfS" }, "payment_method": "card", "billing": { "address": { "city": "test", "country": "US", "line1": "here", "line2": "there", "line3": "anywhere", "zip": "560095", "state": "Washington", "first_name": "One", "last_name": "Two" }, "phone": { "number": "1234567890", "country_code": "+1" }, "email": "guest@example.com" } }' -Response { "payment_id": "pay_ozT3qe38r1krdHLhyfDS", "merchant_id": "postman_merchant_GHAction_3a560136-e947-4667-bb84-2f015fcc1196", "status": "succeeded", "amount": 7100, "net_amount": 7100, "shipping_cost": null, "amount_capturable": 0, "amount_received": 7100, "connector": "paybox", "client_secret": "pay_ozT3qe38r1krdHLhyfDS_secret_RRTrzdf41k8C5J8CXFc4", "created": "2024-11-19T04:09:39.712Z", "currency": "EUR", "customer_id": "test_mit", "customer": { "id": "test_mit", "name": "Joseph Doe", "email": "guest@example.com", "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": "0007", "card_type": null, "card_network": null, "card_issuer": null, "card_issuing_country": null, "card_isin": "520000", "card_extended_bin": null, "card_exp_month": "01", "card_exp_year": "26", "card_holder_name": "John T", "payment_checks": null, "authentication_data": null }, "billing": null }, "payment_token": null, "shipping": null, "billing": { "address": { "city": "test", "country": "US", "line1": "here", "line2": "there", "line3": "anywhere", "zip": "560095", "state": "Washington", "first_name": "One", "last_name": "Two" }, "phone": { "number": "1234567890", "country_code": "+1" }, "email": "guest@example.com" }, "order_details": null, "email": "guest@example.com", "name": "Joseph 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": null, "connector_label": null, "business_country": null, "business_label": "default", "business_sub_label": null, "allowed_payment_method_types": null, "ephemeral_key": { "customer_id": "test_mit", "created_at": 1731989379, "expires": 1731992979, "secret": "epk_ad52b99e9b23445f8f7688e4941b84c2" }, "manual_retry_allowed": false, "connector_transaction_id": "0080164108", "frm_message": null, "metadata": null, "connector_metadata": null, "feature_metadata": null, "reference_id": null, "payment_link": null, "profile_id": "pro_hl5seUYAuPOk5MN8bSGO", "surcharge_details": null, "attempt_count": 1, "merchant_decision": null, "merchant_connector_id": "mca_DsQkwRcnsQVWJ7jbsSZl", "incremental_authorization_allowed": null, "authorization_count": null, "incremental_authorizations": null, "external_authentication_details": null, "external_3ds_authentication_attempted": false, "expires_on": "2024-11-19T04:24:39.712Z", "fingerprint": null, "browser_info": null, "payment_method_id": "pm_fjGE1FjOztrWm26w5gfS", "payment_method_status": "active", "updated": "2024-11-19T04:09:41.363Z", "charges": null, "frm_metadata": null, "merchant_order_reference_id": null, "order_tax_amount": null, "connector_mandate_id": "SM@LpCp@L@C" }
Checklist
cargo +nightly fmt --all
cargo clippy