Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(connector): Handle Sequential Automatic case in MIT payments #6833

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

awasthi21
Copy link
Contributor

@awasthi21 awasthi21 commented Dec 13, 2024

Type of Change

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

Description

Handle Missing Sequential Automatic case for Paybox MIT

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?

CIT Payments

Request
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_kHPzYM5Uswd1YML6yqjBYuZgFJaRFnAeTv40MYW8WQMZ9gxAeCEBkSnHYpV3sdcv' \
--data-raw '{
    "amount":4501,
    "currency": "EUR",
    "confirm": true,
    "capture_method": "sequential_automatic",
    "email":"[email protected]",
    "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": "no_three_ds",
    "return_url": "https://google.com",
    "setup_future_usage": "off_session"
}'
Response
{
    "payment_id": "pay_D2ENFkStYUgugx0Q9NW2",
    "merchant_id": "postman_merchant_GHAction_1884421b-a074-44dc-924d-bc781cdbdd54",
    "status": "succeeded",
    "amount": 4501,
    "net_amount": 4501,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 4501,
    "connector": "paybox",
    "client_secret": "pay_D2ENFkStYUgugx0Q9NW2_secret_8i8Z2z18FRRo840ImOtR",
    "created": "2024-12-13T07:17:33.311Z",
    "currency": "EUR",
    "customer_id": "test_mit",
    "customer": {
        "id": "test_mit",
        "name": null,
        "email": "[email protected]",
        "phone": null,
        "phone_country_code": null
    },
    "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": "CREDIT",
            "card_network": "Mastercard",
            "card_issuer": "PUBLICBANKBERHAD",
            "card_issuing_country": "MALAYSIA",
            "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": "token_EktIgFXmeOAPrmcj9wXQ",
    "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": null,
    "phone": null,
    "return_url": "https://google.com/",
    "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": "credit",
    "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": 1734074253,
        "expires": 1734077853,
        "secret": "epk_60cc1d953798429a956ae369531e0d28"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "0080323748",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": null,
    "payment_link": null,
    "profile_id": "pro_2WtFSPeeLofbFL53TWqQ",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_dKNEXIRHiiqcvbrnp0Ov",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2024-12-13T07:32:33.311Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_method_id": "pm_AJMluoicgaqijRnjgIzF",
    "payment_method_status": "active",
    "updated": "2024-12-13T07:17:35.747Z",
    "charges": null,
    "frm_metadata": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": "SM@LpCp@L@C"
}

MIT Payment with CaptureMethod: sequential_automatic

Request
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_kHPzYM5Uswd1YML6yqjBYuZgFJaRFnAeTv40MYW8WQMZ9gxAeCEBkSnHYpV3sdcv' \
--data-raw '{"amount": 7100,
    "currency": "EUR",
    "confirm": true,
    "customer_id": "test_mit",
    "capture_method":"sequential_automatic",
    "return_url": "https://google.com",
    "recurring_details": {
        "type": "payment_method_id",
        "data": "pm_AJMluoicgaqijRnjgIzF"
    },
    "off_session": true,
    "payment_method":"card",
    "billing": {
        "address": {
            "first_name":"John",
            "last_name":"Doe",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US"
        },
         "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email":"[email protected]"
    }
}'
Response
{
    "payment_id": "pay_GNFxctJ9uUJpVMw7pMS8",
    "merchant_id": "postman_merchant_GHAction_1884421b-a074-44dc-924d-bc781cdbdd54",
    "status": "succeeded",
    "amount": 7100,
    "net_amount": 7100,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 7100,
    "connector": "paybox",
    "client_secret": "pay_GNFxctJ9uUJpVMw7pMS8_secret_TUY8vVAHyJtqHHt9h0Tu",
    "created": "2024-12-13T07:17:45.709Z",
    "currency": "EUR",
    "customer_id": "test_mit",
    "customer": {
        "id": "test_mit",
        "name": null,
        "email": "[email protected]",
        "phone": null,
        "phone_country_code": null
    },
    "description": null,
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": true,
    "capture_on": null,
    "capture_method": "sequential_automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "0007",
            "card_type": "CREDIT",
            "card_network": "Mastercard",
            "card_issuer": "PUBLICBANKBERHAD",
            "card_issuing_country": "MALAYSIA",
            "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": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "John",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "[email protected]"
    },
    "order_details": null,
    "email": "[email protected]",
    "name": null,
    "phone": null,
    "return_url": "https://google.com/",
    "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": "credit",
    "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": 1734074265,
        "expires": 1734077865,
        "secret": "epk_3ba90473fec549a0ba30a2b4823f5118"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "0080323750",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": null,
    "payment_link": null,
    "profile_id": "pro_2WtFSPeeLofbFL53TWqQ",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_dKNEXIRHiiqcvbrnp0Ov",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2024-12-13T07:32:45.709Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_method_id": "pm_AJMluoicgaqijRnjgIzF",
    "payment_method_status": "active",
    "updated": "2024-12-13T07:17:46.985Z",
    "charges": null,
    "frm_metadata": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": "******"
}

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

@awasthi21 awasthi21 requested a review from a team as a code owner December 13, 2024 07:25
Copy link

semanticdiff-com bot commented Dec 13, 2024

Review changes with  SemanticDiff

Changed Files
File Status
  crates/hyperswitch_connectors/src/connectors/paybox/transformers.rs  82% smaller

@awasthi21 awasthi21 self-assigned this Dec 13, 2024
@awasthi21 awasthi21 added the A-connector-integration Area: Connector integration label Dec 13, 2024
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.

1 participant