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

feat(router): add network transaction id support for mit payments #6245

Merged
merged 13 commits into from
Oct 10, 2024

Conversation

ShankarSinghC
Copy link
Contributor

@ShankarSinghC ShankarSinghC commented Oct 7, 2024

Type of Change

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

Description

Support needs to be added in order to accept the card details and network transaction id in recurring_details for an MIT. This will be only in the Sever-to-Server call where the customer is off_session and merchant is initiating the transaction who is a PCI entity and has stored his customer card details and network transaction id.

Support needs to be added to accept card details and the network transaction ID in recurring_details for a Merchant Initiated Transaction (MIT). This will only apply to the Server-to-Server call, where the customer is off-session, and the merchant, as a PCI entity, initiates the transaction using stored customer card details and the network transaction ID.

As in this case we are not creating customer or any payment method entries in hyperswitch we have separate proxy_for_payments_operation_core to decouple this flow from the actual payments flow.

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?

-> Create the cybersource connector
-> Make a payment

curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_tsD2yHJdXXW6s9EMzxgsDgJiJbQEzCLt0l0ysqlOc0tV9F1CACTCTWdHOdtJcoYs' \
--data-raw '{
    "amount": 100,
    "amount_to_capture": 100,
    "currency": "USD",
    "confirm": true,
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "customer": {
        "id": "cu_1728547396",
        "name": "John Doe",
        "email": "guest@example.com",
        "phone": "999999999",
        "phone_country_code": "+1"
    },
    "phone_country_code": "+1",
    "description": "Its my first payment request",
    "authentication_type": "no_three_ds",
    "return_url": "http://127.0.0.1:4040",
    "customer_acceptance": {
        "acceptance_type": "offline",
        "accepted_at": "1963-05-03T04:07:52.723Z",
        "online": {
            "ip_address": "in sit",
            "user_agent": "amet irure esse"
        }
    },
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "card_number": "4000000000000119",
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "card_cvc": "838"
        }
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "PiX",
            "last_name": "ss"
        }
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "PiX"
        }
    },
    "browser_info": {
        "user_agent": "Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/70.0.3538.110 Safari\/537.36",
        "accept_header": "text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,image\/apng,*\/*;q=0.8",
        "language": "nl-NL",
        "color_depth": 24,
        "screen_height": 723,
        "screen_width": 1536,
        "time_zone": 0,
        "java_enabled": true,
        "java_script_enabled": true,
        "ip_address": "125.0.0.1"
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    }
}'
{
    "payment_id": "pay_LJtnKnvXs8jKvnKuXMIX",
    "merchant_id": "merchant_1728547347",
    "status": "succeeded",
    "amount": 100,
    "net_amount": 100,
    "amount_capturable": 0,
    "amount_received": 100,
    "connector": "cybersource",
    "client_secret": "pay_LJtnKnvXs8jKvnKuXMIX_secret_FEM1cSMicyLY98zCFteH",
    "created": "2024-10-10T08:03:13.122Z",
    "currency": "USD",
    "customer_id": "cu_1728547393",
    "customer": {
        "id": "cu_1728547393",
        "name": "John Doe",
        "email": "guest@example.com",
        "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": "card",
    "payment_method_data": {
        "card": {
            "last4": "0119",
            "card_type": "CREDIT",
            "card_network": null,
            "card_issuer": "INTL HDQTRS-CENTER OWNED",
            "card_issuing_country": "UNITEDSTATES",
            "card_isin": "400000",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": null,
            "payment_checks": {
                "avs_response": {
                    "code": "Y",
                    "codeRaw": "Y"
                },
                "card_verification": null
            },
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": "token_QroHqbvm2W37jpJ2F3Dm",
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "PiX",
            "last_name": null
        },
        "phone": null,
        "email": null
    },
    "billing": {
        "address": {
            "city": "San",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "PiX",
            "last_name": "ss"
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "http://127.0.0.1:4040/",
    "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": null,
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "cu_1728547393",
        "created_at": 1728547393,
        "expires": 1728550993,
        "secret": "epk_77cc29d490214a0782d6f50b05451576"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "7285473978946309103955",
    "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_LJtnKnvXs8jKvnKuXMIX_1",
    "payment_link": null,
    "profile_id": "pro_VVvrfmL3csO2vjvGjf3E",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_ahtWpAsQ9RYW7eyEOZs4",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2024-10-10T08:18:13.122Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "125.0.0.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2024-10-10T08:03:18.498Z",
    "charges": null,
    "frm_metadata": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null
}

-> make an off_session payment

curl --location 'http://localhost:8080/payments' \
--header 'Accept: application/json' \
--header 'api-key: dev_tsD2yHJdXXW6s9EMzxgsDgJiJbQEzCLt0l0ysqlOc0tV9F1CACTCTWdHOdtJcoYs' \
--header 'Content-Type: application/json' \
--data-raw '{
    "amount": 100,
    "currency": "USD",
    "confirm": true,
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "customer_id": "cu_1728547463",
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+65",
    "description": "Its my first payment request",
    "authentication_type": "no_three_ds",
    "return_url": "https://google.com",
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_data": {
        "card": {
            "card_number": "4242424242424242",
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "name name",
            "card_cvc": "737"
        }
    },
    "setup_future_usage": "off_session",
    "customer_acceptance": {
        "acceptance_type": "offline",
        "accepted_at": "1963-05-03T04:07:52.723Z",
        "online": {
            "ip_address": "in sit",
            "user_agent": "amet irure esse"
        }
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "PiX",
            "last_name": "ss"
        }
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "John",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    },
    "browser_info": {
        "user_agent": "Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/70.0.3538.110 Safari\/537.36",
        "accept_header": "text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,image\/apng,*\/*;q=0.8",
        "language": "nl-NL",
        "color_depth": 24,
        "screen_height": 723,
        "screen_width": 1536,
        "time_zone": 0,
        "java_enabled": true,
        "java_script_enabled": true,
        "ip_address": "125.0.0.1"
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "metadata": {},
    "order_details": [
        {
            "product_name": "Apple iphone 15",
            "quantity": 1,
            "amount": 0,
            "account_name": "transaction_processing"
        }
    ]
}'
{
    "payment_id": "pay_FldSIzn6XLw6GFlo4jgv",
    "merchant_id": "merchant_1728547347",
    "status": "succeeded",
    "amount": 100,
    "net_amount": 100,
    "amount_capturable": 0,
    "amount_received": 100,
    "connector": "cybersource",
    "client_secret": "pay_FldSIzn6XLw6GFlo4jgv_secret_2vnIsPxnnDtw0fBkjk1h",
    "created": "2024-10-10T08:04:16.308Z",
    "currency": "USD",
    "customer_id": "cu_1728547456",
    "customer": {
        "id": "cu_1728547456",
        "name": "John Doe",
        "email": "guest@example.com",
        "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": "card",
    "payment_method_data": {
        "card": {
            "last4": "4242",
            "card_type": "CREDIT",
            "card_network": null,
            "card_issuer": "STRIPE PAYMENTS UK LIMITED",
            "card_issuing_country": "UNITEDKINGDOM",
            "card_isin": "424242",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": null,
            "payment_checks": {
                "avs_response": {
                    "code": "Y",
                    "codeRaw": "Y"
                },
                "card_verification": null
            },
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": "token_Krvco9uW970Wfgkh17k5",
    "shipping": {
        "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": null
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "PiX",
            "last_name": "ss"
        },
        "phone": null,
        "email": null
    },
    "order_details": [
        {
            "brand": null,
            "amount": 0,
            "category": null,
            "quantity": 1,
            "product_id": null,
            "product_name": "Apple iphone 15",
            "product_type": null,
            "sub_category": null,
            "product_img_link": null,
            "product_tax_code": null,
            "requires_shipping": null
        }
    ],
    "email": "guest@example.com",
    "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": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "cu_1728547456",
        "created_at": 1728547456,
        "expires": 1728551056,
        "secret": "epk_789e4d9885f641eebdf614a13aca5ce7"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "7285474566096322903955",
    "frm_message": null,
    "metadata": {},
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "pay_FldSIzn6XLw6GFlo4jgv_1",
    "payment_link": null,
    "profile_id": "pro_VVvrfmL3csO2vjvGjf3E",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_ahtWpAsQ9RYW7eyEOZs4",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2024-10-10T08:19:16.308Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "125.0.0.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_method_id": "pm_8XMshMDnMmX0kTJdW8nN",
    "payment_method_status": null,
    "updated": "2024-10-10T08:04:17.464Z",
    "charges": null,
    "frm_metadata": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null
}

-> Recurring payment with payment_method_id

curl --location 'http://localhost:8080/payments' \
--header 'Accept: application/json' \
--header 'api-key: dev_tsD2yHJdXXW6s9EMzxgsDgJiJbQEzCLt0l0ysqlOc0tV9F1CACTCTWdHOdtJcoYs' \
--header 'Content-Type: application/json' \
--data-raw '{
    "amount": 499,
    "currency": "USD",
    "confirm": true,
    "capture_method": "automatic",
    "email": "guest@example.com",
    "payment_method": "card",
    "payment_method_type": "credit",
    "customer_id": "cu_1728547456",
    "off_session": true,
    "recurring_details": {
        "type": "payment_method_id",
        "data": "pm_8XMshMDnMmX0kTJdW8nN"
    },
    "routing": {
        "type": "single",
        "data": {
            "connector": "cybersource",
            "merchant_connector_id": "mca_Du9p7M4scSePxCvcT0sB"
        }
    },
    "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"
    }
}'
{
    "payment_id": "pay_ztOyuYK1URN4ZjrmoVFG",
    "merchant_id": "merchant_1728547347",
    "status": "succeeded",
    "amount": 499,
    "net_amount": 499,
    "amount_capturable": 0,
    "amount_received": 499,
    "connector": "cybersource",
    "client_secret": "pay_ztOyuYK1URN4ZjrmoVFG_secret_MKkEQBQ39hyV8Glvn6ys",
    "created": "2024-10-10T08:06:17.284Z",
    "currency": "USD",
    "customer_id": "cu_1728547456",
    "customer": {
        "id": "cu_1728547456",
        "name": "John 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": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "4242",
            "card_type": "CREDIT",
            "card_network": null,
            "card_issuer": "STRIPE PAYMENTS UK LIMITED",
            "card_issuing_country": "UNITEDKINGDOM",
            "card_isin": "424242",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "name name",
            "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": "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": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "cu_1728547456",
        "created_at": 1728547577,
        "expires": 1728551177,
        "secret": "epk_b997deec53b847a4a1604344d3c34a71"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "7285475783556350603955",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "pay_ztOyuYK1URN4ZjrmoVFG_1",
    "payment_link": null,
    "profile_id": "pro_VVvrfmL3csO2vjvGjf3E",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_ahtWpAsQ9RYW7eyEOZs4",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2024-10-10T08:21:17.284Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_method_id": "pm_8XMshMDnMmX0kTJdW8nN",
    "payment_method_status": "active",
    "updated": "2024-10-10T08:06:19.048Z",
    "charges": null,
    "frm_metadata": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": "241BC28127133EFFE063AF598E0A1D8A"
}

-> Create payment with recurring details "type": "network_transaction_id_and_card_details"

curl --location 'http://localhost:8080/payments' \
--header 'Accept: application/json' \
--header 'api-key: dev_tsD2yHJdXXW6s9EMzxgsDgJiJbQEzCLt0l0ysqlOc0tV9F1CACTCTWdHOdtJcoYs' \
--header 'Content-Type: application/json' \
--data-raw '{
    "amount": 499,
    "currency": "USD",
    "confirm": true,
    "capture_method": "automatic",
    "email": "guest@example.com",
    "payment_method": "card",
    "payment_method_type": "credit",
    "off_session": true,
    "recurring_details": {
        "type": "network_transaction_id_and_card_details",
        "data": {
            "card_number": "5454545454545454",
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "name name",
            "network_transaction_id": "737"
        }
    },
    "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"
    }
}'
{
    "payment_id": "pay_wm0BK9Bja4vD9JGmo2dS",
    "merchant_id": "merchant_1728547347",
    "status": "succeeded",
    "amount": 499,
    "net_amount": 499,
    "amount_capturable": 0,
    "amount_received": 499,
    "connector": null,
    "client_secret": "pay_wm0BK9Bja4vD9JGmo2dS_secret_ScT0wh8z52QQoeBiDKqz",
    "created": "2024-10-10T08:08:24.405Z",
    "currency": "USD",
    "customer_id": null,
    "customer": {
        "id": null,
        "name": null,
        "email": "guest@example.com",
        "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": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "5454",
            "card_type": "CREDIT",
            "card_network": null,
            "card_issuer": "BANKHANDLOWYWWARSZAWIE.S.A.",
            "card_issuing_country": "POLAND",
            "card_isin": "545454",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": null,
            "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": null,
    "name": null,
    "phone": null,
    "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": null,
    "manual_retry_allowed": false,
    "connector_transaction_id": "7285477054756884503954",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "pay_wm0BK9Bja4vD9JGmo2dS_1",
    "payment_link": null,
    "profile_id": "pro_VVvrfmL3csO2vjvGjf3E",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_ahtWpAsQ9RYW7eyEOZs4",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2024-10-10T08:23:24.405Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2024-10-10T08:08:26.073Z",
    "charges": null,
    "frm_metadata": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null
}

-> Retrieve the payment

curl --location 'http://localhost:8080/payments/pay_wm0BK9Bja4vD9JGmo2dS' \
--header 'Accept: application/json' \
--header 'api-key: dev_tsD2yHJdXXW6s9EMzxgsDgJiJbQEzCLt0l0ysqlOc0tV9F1CACTCTWdHOdtJcoYs'
{
    "payment_id": "pay_wm0BK9Bja4vD9JGmo2dS",
    "merchant_id": "merchant_1728547347",
    "status": "succeeded",
    "amount": 499,
    "net_amount": 499,
    "amount_capturable": 0,
    "amount_received": 499,
    "connector": null,
    "client_secret": "pay_wm0BK9Bja4vD9JGmo2dS_secret_ScT0wh8z52QQoeBiDKqz",
    "created": "2024-10-10T08:08:24.405Z",
    "currency": "USD",
    "customer_id": null,
    "customer": {
        "id": null,
        "name": null,
        "email": "guest@example.com",
        "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": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "5454",
            "card_type": "CREDIT",
            "card_network": null,
            "card_issuer": "BANKHANDLOWYWWARSZAWIE.S.A.",
            "card_issuing_country": "POLAND",
            "card_isin": "545454",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": null,
            "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": null,
    "name": null,
    "phone": null,
    "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": null,
    "manual_retry_allowed": false,
    "connector_transaction_id": "7285477054756884503954",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "pay_wm0BK9Bja4vD9JGmo2dS_1",
    "payment_link": null,
    "profile_id": "pro_VVvrfmL3csO2vjvGjf3E",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_ahtWpAsQ9RYW7eyEOZs4",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2024-10-10T08:23:24.405Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2024-10-10T08:08:26.073Z",
    "charges": null,
    "frm_metadata": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null
}

Test PG_agnostic mandates
-> Create a connector and enable is_connector_agnostic_mit_enabled

curl --location 'http://localhost:8080/account/merchant_1728548411/business_profile/pro_YarikMeqoVUIawALRJS7' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: test_admin' \
--data '{
    "is_connector_agnostic_mit_enabled": true

}'

-> Create a off_session payment

curl --location 'http://localhost:8080/payments' \
--header 'Accept: application/json' \
--header 'api-key: dev_Hy7bgv6IGxvVGfWAtdSIuZolXWpCcXwDZsvBm4qGB3SjwYIOE3KbNZh4aPpkifsz' \
--header 'Content-Type: application/json' \
--data-raw '{
    "amount": 100,
    "currency": "USD",
    "confirm": true,
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "customer_id": "cu_1728554157",
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+65",
    "description": "Its my first payment request",
    "authentication_type": "no_three_ds",
    "return_url": "https://google.com",
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_data": {
        "card": {
            "card_number": "4242424242424242",
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "name name",
            "card_cvc": "737"
        }
    },
    "setup_future_usage": "off_session",
    "customer_acceptance": {
        "acceptance_type": "offline",
        "accepted_at": "1963-05-03T04:07:52.723Z",
        "online": {
            "ip_address": "in sit",
            "user_agent": "amet irure esse"
        }
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "PiX",
            "last_name": "ss"
        }
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "John",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    },
    "browser_info": {
        "user_agent": "Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/70.0.3538.110 Safari\/537.36",
        "accept_header": "text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,image\/apng,*\/*;q=0.8",
        "language": "nl-NL",
        "color_depth": 24,
        "screen_height": 723,
        "screen_width": 1536,
        "time_zone": 0,
        "java_enabled": true,
        "java_script_enabled": true,
        "ip_address": "125.0.0.1"
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "metadata": {},
    "order_details": [
        {
            "product_name": "Apple iphone 15",
            "quantity": 1,
            "amount": 0,
            "account_name": "transaction_processing"
        }
    ]
}'
{
    "payment_id": "pay_krHDNyFZpvRwM3R28PC6",
    "merchant_id": "merchant_1728548411",
    "status": "succeeded",
    "amount": 100,
    "net_amount": 100,
    "amount_capturable": 0,
    "amount_received": 100,
    "connector": "cybersource",
    "client_secret": "pay_krHDNyFZpvRwM3R28PC6_secret_n3KXhz6TKmDAMyVm2okC",
    "created": "2024-10-10T08:23:17.564Z",
    "currency": "USD",
    "customer_id": "cu_1728548597",
    "customer": {
        "id": "cu_1728548597",
        "name": "John Doe",
        "email": "guest@example.com",
        "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": "card",
    "payment_method_data": {
        "card": {
            "last4": "4242",
            "card_type": "CREDIT",
            "card_network": null,
            "card_issuer": "STRIPE PAYMENTS UK LIMITED",
            "card_issuing_country": "UNITEDKINGDOM",
            "card_isin": "424242",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": null,
            "payment_checks": {
                "avs_response": {
                    "code": "Y",
                    "codeRaw": "Y"
                },
                "card_verification": null
            },
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": "token_Funtb7OO6L5wRhd7DsaY",
    "shipping": {
        "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": null
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "PiX",
            "last_name": "ss"
        },
        "phone": null,
        "email": null
    },
    "order_details": [
        {
            "brand": null,
            "amount": 0,
            "category": null,
            "quantity": 1,
            "product_id": null,
            "product_name": "Apple iphone 15",
            "product_type": null,
            "sub_category": null,
            "product_img_link": null,
            "product_tax_code": null,
            "requires_shipping": null
        }
    ],
    "email": "guest@example.com",
    "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": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "cu_1728548597",
        "created_at": 1728548597,
        "expires": 1728552197,
        "secret": "epk_19f37752f10d44e89e55d60bc9a94e03"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "7285485985906199003954",
    "frm_message": null,
    "metadata": {},
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "pay_krHDNyFZpvRwM3R28PC6_1",
    "payment_link": null,
    "profile_id": "pro_YarikMeqoVUIawALRJS7",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_4St9u5v9GZvl7FoAwEiU",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2024-10-10T08:38:17.564Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "125.0.0.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_method_id": "pm_N6t0gBJt1ktj4tef5mCT",
    "payment_method_status": null,
    "updated": "2024-10-10T08:23:19.342Z",
    "charges": null,
    "frm_metadata": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null
}

-> Using the above payment method id make a recurring payment with other connector

curl --location 'http://localhost:8080/payments' \
--header 'Accept: application/json' \
--header 'api-key: dev_Hy7bgv6IGxvVGfWAtdSIuZolXWpCcXwDZsvBm4qGB3SjwYIOE3KbNZh4aPpkifsz' \
--header 'Content-Type: application/json' \
--data-raw '{
    "amount": 499,
    "currency": "USD",
    "confirm": true,
    "capture_method": "automatic",
    "email": "guest@example.com",
    "payment_method": "card",
    "payment_method_type": "credit",
    "off_session": true,
    "customer_id": "cu_1728548597",
    "recurring_details": {
        "type": "payment_method_id",
        "data": "pm_N6t0gBJt1ktj4tef5mCT"
    },
    "routing": {
        "type": "single",
        "data": {
            "connector": "stripe",
            "merchant_connector_id": "mca_kMKyXTBRlW8K3Ywzi2mT"
        }
    },
    "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"
    }
}'
{
    "payment_id": "pay_JzDuaak6BLm00of1QK3a",
    "merchant_id": "merchant_1728548411",
    "status": "succeeded",
    "amount": 499,
    "net_amount": 499,
    "amount_capturable": 0,
    "amount_received": 499,
    "connector": "stripe",
    "client_secret": "pay_JzDuaak6BLm00of1QK3a_secret_nGLRTZD7785H9Xbuz2gN",
    "created": "2024-10-10T09:50:24.069Z",
    "currency": "USD",
    "customer_id": "cu_1728548597",
    "customer": {
        "id": "cu_1728548597",
        "name": "John 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": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "4242",
            "card_type": "CREDIT",
            "card_network": null,
            "card_issuer": "STRIPE PAYMENTS UK LIMITED",
            "card_issuing_country": "UNITEDKINGDOM",
            "card_isin": "424242",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": null,
            "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": "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": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "cu_1728548597",
        "created_at": 1728553824,
        "expires": 1728557424,
        "secret": "epk_f703b591d98b42d095e7bf2da08b3b6e"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "pi_3Q8J0mEOqOywnAIx1Ud59gRb",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "pi_3Q8J0mEOqOywnAIx1Ud59gRb",
    "payment_link": null,
    "profile_id": "pro_YarikMeqoVUIawALRJS7",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_kMKyXTBRlW8K3Ywzi2mT",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2024-10-10T10:05:24.069Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_method_id": "pm_N6t0gBJt1ktj4tef5mCT",
    "payment_method_status": "active",
    "updated": "2024-10-10T09:50:25.782Z",
    "charges": null,
    "frm_metadata": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null
}

Ran cybersource test cases locally. There are some know test case that have failed.
image

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

@ShankarSinghC ShankarSinghC requested review from a team as code owners October 7, 2024 04:35
Copy link

semanticdiff-com bot commented Oct 7, 2024

Review changes with SemanticDiff.

Analyzed 65 of 65 files.

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

File Information
Filename Status
✔️ crates/router/src/routes/payments.rs 75.38% smaller
✔️ crates/router/src/core/payments.rs 0.61% smaller
✔️ crates/router/src/core/routing.rs 2.37% smaller
✔️ crates/router/src/core/payments/helpers.rs 13.52% smaller
✔️ crates/router/src/core/payments/routing.rs 0.22% smaller
✔️ crates/router/src/core/payments/operations/payment_response.rs Analyzed
✔️ crates/router/src/connector/klarna.rs 73.49% smaller
✔️ crates/router/src/connector/utils.rs Analyzed
✔️ crates/router/src/connector/zsl/transformers.rs 17.95% smaller
✔️ crates/router/src/connector/zen/transformers.rs 73.49% smaller
✔️ crates/router/src/connector/worldpay/transformers.rs 72.15% smaller
✔️ crates/router/src/connector/wellsfargo/transformers.rs 74.66% smaller
✔️ crates/router/src/connector/trustpay/transformers.rs 73.49% smaller
✔️ crates/router/src/connector/stripe/transformers.rs 78.39% smaller
✔️ crates/router/src/connector/shift4/transformers.rs 59.29% smaller
✔️ crates/router/src/connector/razorpay/transformers.rs 73.49% smaller
✔️ crates/router/src/connector/placetopay/transformers.rs 73.49% smaller
✔️ crates/router/src/connector/paypal/transformers.rs 73.49% smaller
✔️ crates/router/src/connector/payme/transformers.rs 74.07% smaller
✔️ crates/router/src/connector/payeezy/transformers.rs 72.15% smaller
✔️ crates/router/src/connector/opayo/transformers.rs 73.49% smaller
✔️ crates/router/src/connector/nuvei/transformers.rs 59.29% smaller
✔️ crates/router/src/connector/noon/transformers.rs 75.82% smaller
✔️ crates/router/src/connector/nmi/transformers.rs 73.49% smaller
✔️ crates/router/src/connector/nexinets/transformers.rs 79.66% smaller
✔️ crates/router/src/connector/multisafepay/transformers.rs 73.49% smaller
✔️ crates/router/src/connector/mifinity/transformers.rs 73.49% smaller
✔️ crates/router/src/connector/itaubank/transformers.rs 73.49% smaller
✔️ crates/router/src/connector/iatapay/transformers.rs 74.71% smaller
✔️ crates/router/src/connector/gocardless/transformers.rs 73.49% smaller
✔️ crates/router/src/connector/forte/transformers.rs 73.49% smaller
✔️ crates/router/src/connector/datatrans/transformers.rs 73.49% smaller
✔️ crates/router/src/connector/cybersource/transformers.rs 15.64% smaller
✔️ crates/router/src/connector/checkout/transformers.rs 73.49% smaller
✔️ crates/router/src/connector/braintree/transformers.rs 73.8% smaller
✔️ crates/router/src/connector/boku/transformers.rs 73.49% smaller
✔️ crates/router/src/connector/bluesnap/transformers.rs 73.49% smaller
✔️ crates/router/src/connector/billwerk/transformers.rs 73.49% smaller
✔️ crates/router/src/connector/bankofamerica/transformers.rs 74.66% smaller
✔️ crates/router/src/connector/authorizedotnet/transformers.rs 74.68% smaller
✔️ crates/router/src/connector/airwallex/transformers.rs 73.49% smaller
✔️ crates/router/src/connector/adyen/transformers.rs 82.64% smaller
✔️ crates/router/src/connector/aci/transformers.rs 73.49% smaller
✔️ crates/openapi/src/openapi.rs 3.85% smaller
✔️ crates/openapi/src/openapi_v2.rs 8.95% smaller
✔️ crates/hyperswitch_domain_models/src/payment_method_data.rs 9.39% smaller
✔️ crates/hyperswitch_connectors/src/utils.rs Analyzed
✔️ crates/hyperswitch_connectors/src/connectors/worldline/transformers.rs 97.35% smaller
✔️ crates/hyperswitch_connectors/src/connectors/volt/transformers.rs 83.76% smaller
✔️ crates/hyperswitch_connectors/src/connectors/tsys/transformers.rs 80.15% smaller
✔️ crates/hyperswitch_connectors/src/connectors/stax/transformers.rs 80.15% smaller
✔️ crates/hyperswitch_connectors/src/connectors/square/transformers.rs 80.15% smaller
✔️ crates/hyperswitch_connectors/src/connectors/powertranz/transformers.rs 83.76% smaller
✔️ crates/hyperswitch_connectors/src/connectors/nexixpay/transformers.rs 78.99% smaller
✔️ crates/hyperswitch_connectors/src/connectors/helcim/transformers.rs 80.15% smaller
✔️ crates/hyperswitch_connectors/src/connectors/globepay/transformers.rs 80.15% smaller
✔️ crates/hyperswitch_connectors/src/connectors/fiuu/transformers.rs 83.76% smaller
✔️ crates/hyperswitch_connectors/src/connectors/fiserv/transformers.rs 74.22% smaller
✔️ crates/hyperswitch_connectors/src/connectors/dlocal/transformers.rs 80.15% smaller
✔️ crates/hyperswitch_connectors/src/connectors/cryptopay/transformers.rs 80.15% smaller
✔️ crates/hyperswitch_connectors/src/connectors/bambora/transformers.rs 83.76% smaller
✔️ crates/api_models/src/mandates.rs Analyzed
✔️ crates/api_models/src/payments.rs Analyzed
✔️ api-reference-v2/openapi_spec.json Analyzed
✔️ api-reference/openapi_spec.json Analyzed

@ShankarSinghC ShankarSinghC self-assigned this Oct 7, 2024
@ShankarSinghC ShankarSinghC added A-core Area: Core flows C-feature Category: Feature request or enhancement A-payment-methods Area: Payment Methods labels Oct 7, 2024
@@ -1821,16 +1825,60 @@ pub async fn retrieve_card_with_permanent_token(
})?;

if !business_profile.is_network_tokenization_enabled {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in profile if the is_network_tokenization_enabled is false then only the if block will get executed.

Is the below implementation of network_tokenization is in right place?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in profile if the is_network_tokenization_enabled is false then only the if block will get executed.

Is the below implementation of network_tokenization is in right place?

Yes, it is in the right place.
This change is required when we do the MIT with the card details stored in locker and network transaction id stored in the payment methods table (it will be populated in the mandate_reference_id). So in this case the card details retrieved from locker should be used to construct CardDetailsForNetworkTransactionId as we will not have cvc.

crates/router/src/core/payments/helpers.rs Show resolved Hide resolved
@@ -1510,6 +1510,45 @@ pub fn get_incremental_authorization_allowed_value(
}
}

pub trait GetPaymentMethodDataForNetworkTransactionId {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need trait if this function is not polymorphic, instead move this function to impl block of api_models::mandates::RecurringDetails


let cloned_payment_data = payment_data.clone();

crate::utils::trigger_payments_webhook(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
crate::utils::trigger_payments_webhook(
utils::trigger_payments_webhook(

));

// Construct routing data using the selected connector information, which will be set in the payment attempt.
let routing_data = storage::RoutingData {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is setting this data in attempt is really needed? because we are storing the necessary information in attempt directly and why another source of truth is required?

Ok(mit_first_connector.clone())
}

pub async fn filter_eligible_connectors<F, D>(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

function name can be better, this is more generic and what underlying functionality is not expressed fully

@ShankarSinghC ShankarSinghC linked an issue Oct 9, 2024 that may be closed by this pull request
@ShankarSinghC ShankarSinghC requested a review from jarnura October 9, 2024 19:28
jarnura
jarnura previously approved these changes Oct 10, 2024
@hyperswitch-bot hyperswitch-bot bot added the M-api-contract-changes Metadata: This PR involves API contract changes label Oct 10, 2024
@ShankarSinghC ShankarSinghC requested a review from jarnura October 10, 2024 07:48
jarnura
jarnura previously approved these changes Oct 10, 2024
Copy link
Contributor

@prajjwalkumar17 prajjwalkumar17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Routing related changes seems fine!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-core Area: Core flows A-payment-methods Area: Payment Methods C-feature Category: Feature request or enhancement M-api-contract-changes Metadata: This PR involves API contract changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for network transaction id and card details based MIT
4 participants