hyperswitch icon indicating copy to clipboard operation
hyperswitch copied to clipboard

feat(connector): [Paybox] Add 3DS Flow

Open awasthi21 opened this issue 1 year ago • 1 comments

Type of Change

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

Description

Added 3DS flow

Additional Changes

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

Motivation and Context

How did you test it?

Request

curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_sBzGsZDNauMcWSI41iEiQEuPBoOSvmV8JJaZGHIwTr3M3iL43LL764gBbT9Ks3bL' \
--data-raw '{
    "amount": 500,
    "currency": "EUR",
    "confirm": true,
    "capture_method": "automatic",
    "authentication_type": "three_ds",
    "capture_on": "2022-09-10T10:11:12Z",
    "customer_id": "BamboraCustomer",
    "email": "[email protected]",
    "name": "John Doe",
    "phone": "999999999",
    "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": "9123456789",
            "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": "9123456789",
            "country_code": "+91"
        }
    },
    "phone_country_code": "+65",
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_data": {
        "card": {
            "card_number": "5200000000000007",
            "card_exp_month": "01",
            "card_exp_year": "26",
            "card_holder_name": "John Doe",
            "card_cvc": "123"
        }
    }
}'

Response

{
    "payment_id": "pay_saaYhGG1Xe0GGVK5Xp15",
    "merchant_id": "postman_merchant_GHAction_d664cf3a-5bc7-4146-be80-389e3a01dd62",
    "status": "requires_customer_action",
    "amount": 500,
    "net_amount": 500,
    "amount_capturable": 500,
    "amount_received": null,
    "connector": "paybox",
    "client_secret": "pay_saaYhGG1Xe0GGVK5Xp15_secret_uiX1ovdNcBwi0Q0Uyu6w",
    "created": "2024-09-26T05:38:08.428Z",
    "currency": "EUR",
    "customer_id": "BamboraCustomer",
    "customer": {
        "id": "BamboraCustomer",
        "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": null,
    "capture_on": null,
    "capture_method": "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_MmqMOuV3VI21yVG7cOIK",
    "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": "9123456789",
            "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": "9123456789",
            "country_code": "+91"
        },
        "email": null
    },
    "order_details": null,
    "email": "[email protected]",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": null,
    "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_saaYhGG1Xe0GGVK5Xp15/postman_merchant_GHAction_d664cf3a-5bc7-4146-be80-389e3a01dd62/pay_saaYhGG1Xe0GGVK5Xp15_1"
    },
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "BamboraCustomer",
        "created_at": 1727329088,
        "expires": 1727332688,
        "secret": "epk_e33dcd99ffe543d49119f34531f82d00"
    },
    "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_Cg9CHIHfjAx0HS7oeO0b",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_SNsSbss3vX1x5K1ztI8J",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2024-09-26T05:53:08.428Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2024-09-26T05:38:09.429Z",
    "charges": null,
    "frm_metadata": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null
}

Redirect Response

{
    "payment_id": "pay_saaYhGG1Xe0GGVK5Xp15",
    "merchant_id": "postman_merchant_GHAction_d664cf3a-5bc7-4146-be80-389e3a01dd62",
    "status": "succeeded",
    "amount": 500,
    "net_amount": 500,
    "amount_capturable": 0,
    "amount_received": 500,
    "connector": "paybox",
    "client_secret": "pay_saaYhGG1Xe0GGVK5Xp15_secret_uiX1ovdNcBwi0Q0Uyu6w",
    "created": "2024-09-26T05:38:08.428Z",
    "currency": "EUR",
    "customer_id": "BamboraCustomer",
    "customer": {
        "id": "BamboraCustomer",
        "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": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": null,
    "payment_token": "token_MmqMOuV3VI21yVG7cOIK",
    "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": "9123456789",
            "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": "9123456789",
            "country_code": "+91"
        },
        "email": null
    },
    "order_details": null,
    "email": "[email protected]",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": null,
    "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": "credit",
    "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": "0079839093",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": null,
    "payment_link": null,
    "profile_id": "pro_Cg9CHIHfjAx0HS7oeO0b",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_SNsSbss3vX1x5K1ztI8J",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2024-09-26T05:53:08.428Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2024-09-26T05:39:29.324Z",
    "charges": null,
    "frm_metadata": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": 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

awasthi21 avatar Sep 26 '24 05:09 awasthi21

Review changes with SemanticDiff.

Analyzed 5 of 15 files.

Overall, the semantic diff is 15% smaller than the GitHub diff.

Filename Status
:grey_question: loadtest/config/development.toml Unsupported file format
:heavy_check_mark: crates/router/src/core/payments/flows.rs 20.36% smaller
:heavy_check_mark: crates/router/src/connector/paybox.rs 11.26% smaller
:heavy_check_mark: crates/router/src/connector/paybox/transformers.rs 25.07% smaller
:heavy_check_mark: crates/router/src/configs/defaults.rs Analyzed
:heavy_check_mark: crates/hyperswitch_interfaces/src/configs.rs Analyzed
:grey_question: crates/connector_configs/toml/development.toml Unsupported file format
:grey_question: crates/connector_configs/toml/production.toml Unsupported file format
:grey_question: crates/connector_configs/toml/sandbox.toml Unsupported file format
:grey_question: config/config.example.toml Unsupported file format
:grey_question: config/development.toml Unsupported file format
:grey_question: config/docker_compose.toml Unsupported file format
:grey_question: config/deployments/integration_test.toml Unsupported file format
:grey_question: config/deployments/production.toml Unsupported file format
:grey_question: config/deployments/sandbox.toml Unsupported file format

semanticdiff-com[bot] avatar Sep 26 '24 05:09 semanticdiff-com[bot]