Skip to content

Conversation

sumanmaji4
Copy link
Contributor

@sumanmaji4 sumanmaji4 commented Nov 27, 2024

Type of Change

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

Description

  • Added payout_method_id to Payout API requests and responses.

  • Added validations for requests with payout_method_id.

  • Added payout_method to PayoutData.

  • Added transfer_method_id to PayoutsResponseData.

  • Changed connector_mandate_details structure to distinguish between payins and payouts.

  • Fetch/update payment_methods using payout_method_id or transfer_method_id.

Additional Changes

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

Motivation and Context

Nomupay requires storing customer payment method details (like cards, bank accounts or id corresponding to them) to process payouts, which is not handled in HyperSwitch. Attempting to re-add the same customer payment method results in errors from Nomupay.

To address this, we are leveraging the payment_methods table to store these details in the connector_mandate_details column, linking them to a customer and distinguishing entries by a new column transaction_flow (to identify payins vs. payouts).

This change ensures seamless payouts for existing customers by reusing stored mandate details while maintaining compatibility with HyperSwitch's architecture. Additionally, it introduces a payout_method_id field in requests and responses to enhance clarity and functionality.

This update lays the groundwork for integrating Nomupay while preserving existing payout functionality for other connectors.

How did you test it?

As it is a core change in payouts and Nomupay is yet to be added, it should be tested with an existing connector to ensure it is working as before.

Wise Create BACS Payout Request

curl --location 'http://localhost:8080/payouts/create' \
--header 'Content-Type: application/json' \
--header 'api-key: dev_BIhanGFzYRX7djOLsCHESaaM.......6xzDP3COyRL6a4TDdep' \
--data-raw '{
    "amount": 10,
    "currency": "GBP",
    "customer_id": "cus_cXrLjesq3XJ2TpQm5tMh",
    "email": "[email protected]",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+65",
    "description": "Its my first payout request",
    "payout_type": "bank",
    "connector": [
        "wise"
    ],
    "payout_method_data": {
        "bank": {
            "bank_sort_code": "23...0",
            "bank_account_number": ".....22",
            "bank_name": "Deutsche Bank",
            "bank_country_code": "NL",
            "bank_city": "Amsterdam"
        }
    },
    "billing": {
        "address": {
            "line1": "1467",
            
            
            "city": "San Fransico",
            "state": "CA",
            "zip": "94122",
            "country": "US",
            "first_name": "John",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    },
    "entity_type": "Individual",
    "recurring": true,
    "metadata": {
        "ref": "123"
    },
    "confirm": true,
    "auto_fulfill": true,
    "profile_id": "pro_CieYHTbv5frbdGhOLkfa"
}'

Wise Create BACS Payout Response

{
    "payout_id": "db30ae7e-9d77-48d3-9c61-01910701881f",
    "merchant_id": "merchant_1733466428",
    "amount": 10,
    "currency": "GBP",
    "connector": "wise",
    "payout_type": "bank",
    "payout_method_data": {
        "bank": {
            "bank_sort_code": "23**70",
            "bank_account_number": "****1822",
            "bank_name": "Deutsche Bank",
            "bank_country_code": "NL",
            "bank_city": "Amsterdam"
        }
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": null,
            "line3": null,
            "zip": "94122",
            "state": "CA",
            "first_name": "John",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "auto_fulfill": true,
    "customer_id": "cus_cXrLjesq3XJ2TpQm5tMh",
    "customer": {
        "id": "cus_cXrLjesq3XJ2TpQm5tMh",
        "name": "John Doe",
        "email": "[email protected]",
        "phone": "6168205366",
        "phone_country_code": "+1"
    },
    "client_secret": "payout_db30ae7e-9d77-48d3.......01881f_secret_CqkySjvEP.....faBT",
    "return_url": null,
    "business_country": null,
    "business_label": null,
    "description": "Its my first payout request",
    "entity_type": "Individual",
    "recurring": true,
    "metadata": {
        "ref": "123"
    },
    "merchant_connector_id": "mca_MPP7hcHFcMyGRgAh7s7j",
    "status": "success",
    "error_message": null,
    "error_code": null,
    "profile_id": "pro_CieYHTbv5frbdGhOLkfa",
    "created": "2024-12-06T06:27:33.590Z",
    "connector_transaction_id": "54574691",
    "priority": null,
    "payout_link": null,
    "email": "[email protected]",
    "name": "John Doe",
    "phone": "6168205366",
    "phone_country_code": "+1",
    "unified_code": null,
    "unified_message": null,
    "payout_method_id": "pm_vFihj3xNZzOtBRyRLRZ1"
}

Wise Create SEPA Payout Request

curl --location 'http://localhost:8080/payouts/create' \
--header 'x-feature: integ-custom' \
--header 'Content-Type: application/json' \
--header 'api-key: dev_BIhanGFzYRX7djOLs..........M6xzDP3COyRL6a4TDdep' \
--data-raw '{
    "amount": 10,
    "currency": "GBP",
    "customer_id": "cus_cXrLjesq3XJ2TpQm5tMh",
    "email": "[email protected]",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+65",
    "description": "Its my first payout request",
    "payout_type": "bank",
    "connector": [
        "wise"
    ],
    "payout_method_data": {
        "bank": {
            "iban": "NL46T....169112",
            "bic": "ABNANL2A",
            "bank_name": "Deutsche Bank",
            "bank_country_code": "NL",
            "bank_city": "Amsterdam"
        }
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "CA",
            "zip": "94122",
            "country": "US",
            "first_name": "John",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    },
    "entity_type": "NaturalPerson",
    "recurring": true,
    "metadata": {
        "ref": "123"
    },
    "confirm": true,
    "auto_fulfill": true,
    "profile_id": "pro_CieYHTbv5frbdGhOLkfa"
}'

Wise Create SEPA Payout Response

{
    "payout_id": "24f870ee-5257-415d-a13c-7ce9d7fd9374",
    "merchant_id": "merchant_1733466428",
    "amount": 10,
    "currency": "GBP",
    "connector": "wise",
    "payout_type": "bank",
    "payout_method_data": {
        "bank": {
            "iban": "NL46T********69112",
            "bank_name": "Deutsche Bank",
            "bank_country_code": "NL",
            "bank_city": "Amsterdam",
            "bic": "ABN**L2A"
        }
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "CA",
            "first_name": "John",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "auto_fulfill": true,
    "customer_id": "cus_cXrLjesq3XJ2TpQm5tMh",
    "customer": {
        "id": "cus_cXrLjesq3XJ2TpQm5tMh",
        "name": "John Doe",
        "email": "[email protected]",
        "phone": "6168205366",
        "phone_country_code": "+1"
    },
    "client_secret": "payout_24f870ee-5257-.......7fd9374_secret_tKAQLKqQd......Mk2XV",
    "return_url": null,
    "business_country": null,
    "business_label": null,
    "description": "Its my first payout request",
    "entity_type": "NaturalPerson",
    "recurring": true,
    "metadata": {
        "ref": "123"
    },
    "merchant_connector_id": "mca_MPP7hcHFcMyGRgAh7s7j",
    "status": "success",
    "error_message": null,
    "error_code": null,
    "profile_id": "pro_CieYHTbv5frbdGhOLkfa",
    "created": "2024-12-06T07:01:07.314Z",
    "connector_transaction_id": "54574754",
    "priority": null,
    "payout_link": null,
    "email": "[email protected]",
    "name": "John Doe",
    "phone": "6168205366",
    "phone_country_code": "+1",
    "unified_code": null,
    "unified_message": null,
    "payout_method_id": "pm_347aDYo0h5aIYJeBiu0L"
}

Create SEPA Payout Request

curl --location 'http://localhost:8080/payouts/create' \
--header 'x-feature: integ-custom' \
--header 'Content-Type: application/json' \
--header 'api-key: dev_BIhanGFzYRX7djOLs.......t02eWxipM6xzDP3COyRL6a4TDdep' \
--data '{
    "amount": 1,
    "currency": "GBP",
    "description": "Its my first payout request",
    "payout_type": "bank",
    "entity_type": "NaturalPerson",
    "recurring": true,
    "metadata": {
        "ref": "123"
    },
    "confirm": false,
    "auto_fulfill": false
}'

Create SEPA Payout Response

{
    "payout_id": "07d0bef5-c22e-4ff7-acd5-75e7055ae4b0",
    "merchant_id": "merchant_1733466428",
    "amount": 1,
    "currency": "GBP",
    "connector": null,
    "payout_type": "bank",
    "payout_method_data": null,
    "billing": null,
    "auto_fulfill": false,
    "customer_id": null,
    "customer": null,
    "client_secret": "payout_07d0bef5..........055ae4b0_secret_yTgzRXFbUuKXe5UJYNR7",
    "return_url": null,
    "business_country": null,
    "business_label": null,
    "description": "Its my first payout request",
    "entity_type": "NaturalPerson",
    "recurring": true,
    "metadata": {
        "ref": "123"
    },
    "merchant_connector_id": null,
    "status": "requires_payout_method_data",
    "error_message": null,
    "error_code": null,
    "profile_id": "pro_CieYHTbv5frbdGhOLkfa",
    "created": "2024-12-06T07:03:09.973Z",
    "connector_transaction_id": null,
    "priority": null,
    "payout_link": null,
    "email": null,
    "name": null,
    "phone": null,
    "phone_country_code": null,
    "unified_code": null,
    "unified_message": null,
    "payout_method_id": null
}

Update payout Request

curl --location --request PUT 'http://localhost:8080/payouts/07d0bef5-c22e-4ff7-acd5-75e7055ae4b0' \
--header 'Content-Type: application/json' \
--header 'api-key: dev_BIhanGFzYRX7djOLsCHESa.........COyRL6a4TDdep' \
--data '{
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "CA",
            "zip": "94122",
            "country": "US",
            "first_name": "John",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    },
    "customer_id": "cus_cXrLjesq3XJ2TpQm5tMh"
}'

Update payout Response

{
    "payout_id": "07d0bef5-c22e-4ff7-acd5-75e7055ae4b0",
    "merchant_id": "merchant_1733466428",
    "amount": 1,
    "currency": "GBP",
    "connector": null,
    "payout_type": "bank",
    "payout_method_data": null,
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "CA",
            "first_name": "John",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "auto_fulfill": false,
    "customer_id": "cus_cXrLjesq3XJ2TpQm5tMh",
    "customer": {
        "id": "cus_cXrLjesq3XJ2TpQm5tMh",
        "name": "John Doe",
        "email": "[email protected]",
        "phone": "6168205366",
        "phone_country_code": "+1"
    },
    "client_secret": "payout_07d0bef5-c22e-4ff7-...........gzRXFbUuKXe5UJYNR7",
    "return_url": null,
    "business_country": null,
    "business_label": null,
    "description": "Its my first payout request",
    "entity_type": "NaturalPerson",
    "recurring": true,
    "metadata": {
        "ref": "123"
    },
    "merchant_connector_id": null,
    "status": "requires_payout_method_data",
    "error_message": null,
    "error_code": null,
    "profile_id": "pro_CieYHTbv5frbdGhOLkfa",
    "created": "2024-12-06T07:03:09.973Z",
    "connector_transaction_id": null,
    "priority": null,
    "payout_link": null,
    "email": "[email protected]",
    "name": "John Doe",
    "phone": "6168205366",
    "phone_country_code": "+1",
    "unified_code": null,
    "unified_message": null,
    "payout_method_id": null
}

Confirm payout Request

curl --location 'http://localhost:8080/payouts/07d0bef5-c22e-4ff7-acd5-75e7055ae4b0/confirm' \
--header 'Content-Type: application/json' \
--header 'api-key: dev_BIhanGFzYRX7djOLsCHESa.........6xzDP3COyRL6a4TDdep' \
--data '{
    "payout_method_data": {
        "bank": {
            "iban": "NL46TEST0136169112",
            "bic": "ABNANL2A",
            "bank_name": "Deutsche Bank",
            "bank_country_code": "NL",
            "bank_city": "Amsterdam"
        }
    }
}'

Confirm payout Response

{
    "payout_id": "07d0bef5-c22e-4ff7-acd5-75e7055ae4b0",
    "merchant_id": "merchant_1733466428",
    "amount": 1,
    "currency": "GBP",
    "connector": "wise",
    "payout_type": "bank",
    "payout_method_data": {
        "bank": {
            "iban": "NL46T********69112",
            "bank_name": "Deutsche Bank",
            "bank_country_code": "NL",
            "bank_city": "Amsterdam",
            "bic": "ABN**L2A"
        }
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "CA",
            "first_name": "John",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "auto_fulfill": false,
    "customer_id": "cus_cXrLjesq3XJ2TpQm5tMh",
    "customer": {
        "id": "cus_cXrLjesq3XJ2TpQm5tMh",
        "name": "John Doe",
        "email": "[email protected]",
        "phone": "6168205366",
        "phone_country_code": "+1"
    },
    "client_secret": "payout_07d0bef5.......secret_yTgzRXFbUuKXe5UJYNR7",
    "return_url": null,
    "business_country": null,
    "business_label": null,
    "description": "Its my first payout request",
    "entity_type": "NaturalPerson",
    "recurring": true,
    "metadata": {
        "ref": "123"
    },
    "merchant_connector_id": "mca_MPP7hcHFcMyGRgAh7s7j",
    "status": "requires_fulfillment",
    "error_message": null,
    "error_code": null,
    "profile_id": "pro_CieYHTbv5frbdGhOLkfa",
    "created": "2024-12-06T07:03:09.973Z",
    "connector_transaction_id": "54574758",
    "priority": null,
    "payout_link": null,
    "email": "[email protected]",
    "name": "John Doe",
    "phone": "6168205366",
    "phone_country_code": "+1",
    "unified_code": null,
    "unified_message": null,
    "payout_method_id": null
}

Fulfill payout Request

curl --location 'http://localhost:8080/payouts/07d0bef5-c22e-4ff7-acd5-75e7055ae4b0/fulfill' \
--header 'Content-Type: application/json' \
--header 'api-key: dev_BIhanGFzYRX7djOLsCH........M6xzDP3COyRL6a4TDdep' \
--data '{
    "connector_payout_id" : "c3a71c4d-cbc5-47f1-9950-b59a687d7124"
}'

Fulfill payout Response

{
    "payout_id": "07d0bef5-c22e-4ff7-acd5-75e7055ae4b0",
    "merchant_id": "merchant_1733466428",
    "amount": 1,
    "currency": "GBP",
    "connector": "wise",
    "payout_type": "bank",
    "payout_method_data": {
        "bank": {
            "iban": "NL46T********69112",
            "bank_name": "Deutsche Bank",
            "bank_country_code": "NL",
            "bank_city": "Amsterdam",
            "bic": "ABN**L2A"
        }
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "CA",
            "first_name": "John",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "auto_fulfill": false,
    "customer_id": "cus_cXrLjesq3XJ2TpQm5tMh",
    "customer": {
        "id": "cus_cXrLjesq3XJ2TpQm5tMh",
        "name": "John Doe",
        "email": "[email protected]",
        "phone": "6168205366",
        "phone_country_code": "+1"
    },
    "client_secret": "payout_07d0bef5-c22e-.....gzRXFbUuKXe5UJYNR7",
    "return_url": null,
    "business_country": null,
    "business_label": null,
    "description": "Its my first payout request",
    "entity_type": "NaturalPerson",
    "recurring": true,
    "metadata": {
        "ref": "123"
    },
    "merchant_connector_id": "mca_MPP7hcHFcMyGRgAh7s7j",
    "status": "success",
    "error_message": null,
    "error_code": null,
    "profile_id": "pro_CieYHTbv5frbdGhOLkfa",
    "created": "2024-12-06T07:03:09.973Z",
    "connector_transaction_id": "54574758",
    "priority": null,
    "payout_link": null,
    "email": "[email protected]",
    "name": "John Doe",
    "phone": "6168205366",
    "phone_country_code": "+1",
    "unified_code": null,
    "unified_message": null,
    "payout_method_id": "pm_raJAjS0VvYfhL4N8GuUp"
}

CIT and MIT test

Payments CIT request

curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_BxHQLlnzzHJZx9Ld4IvQ******ccVrQcbKTQ2BAxGyjt5' \
--data-raw '{
    "amount": 10,
    "currency": "EUR",
    "confirm": false,
    "capture_method": "manual",
    "capture_on": "2022-09-10T10:11:12Z",
    "authentication_type": "three_ds",
    "return_url": "https://abc.com",
    "email": "[email protected]",
    "name": "Joseph Doe",
    "phone": "999999999",
    "phone_country_code": "+65",
    "description": "Its my first payment request",
    "setup_future_usage": "off_session"
}'

Payments CIT response

{
    "payment_id": "pay_QGM2AC1GkymhTRUGFudi",
    "merchant_id": "merchant_1735909365",
    "status": "requires_payment_method",
    "amount": 10,
    "net_amount": 10,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": null,
    "connector": null,
    "client_secret": "pay_QGM2AC1GkymhTRUGFudi_secret_Alsj3tRoRXSA4jQyiZRB",
    "created": "2025-01-06T05:52:52.140Z",
    "currency": "EUR",
    "customer_id": null,
    "customer": {
        "id": null,
        "name": "Joseph Doe",
        "email": "[email protected]",
        "phone": "999999999",
        "phone_country_code": "+65"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": "off_session",
    "off_session": null,
    "capture_on": null,
    "capture_method": "manual",
    "payment_method": null,
    "payment_method_data": null,
    "payment_token": null,
    "shipping": null,
    "billing": null,
    "order_details": null,
    "email": null,
    "name": null,
    "phone": null,
    "return_url": "https://abc.com/",
    "authentication_type": "three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": null,
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": null,
    "connector_transaction_id": null,
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": null,
    "payment_link": null,
    "profile_id": "pro_Vqjv2CX86ySHR7gnmg1V",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": null,
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-01-06T06:07:52.139Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2025-01-06T05:52:52.375Z",
    "charges": null,
    "frm_metadata": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null
}

Confirm CIT request

curl --location 'http://localhost:8080/payments/pay_QGM2AC1GkymhTRUGFudi/confirm' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_BxHQLlnzzHJZx9Ld4IvQmJn*******ccVrQcbKTQ2BAxGyjt5' \
--data-raw '{
    "confirm": true,
    "customer_id": "StripeCustomer3",
    
    "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_type": "credit",
    "email": "[email protected]",
    "payment_method_data": {
        "card": {
            "card_number": "4000 0000 0000 1091",
            "card_exp_month": "12",
            "card_exp_year": "2025",
            "card_holder_name": "Max Mustermann",
            "card_cvc": "123"
        },
        "billing": {
            "address": {
                "line1": "1467",
                "line2": "CA",
                "line3": "CA",
                "city": "Musterhausen",
                "state": "California",
                "zip": "12345",
                "country": "DE",
                "first_name": "Max",
                "last_name": "Mustermann"
            },
            "email": "[email protected]",
            "phone": {
                "number": "8056594427",
                "country_code": "+91"
            }
        }
    }
}'

Confirm CIT response

{
    "payment_id": "pay_QGM2AC1GkymhTRUGFudi",
    "merchant_id": "merchant_1735909365",
    "status": "requires_customer_action",
    "amount": 10,
    "net_amount": 10,
    "shipping_cost": null,
    "amount_capturable": 10,
    "amount_received": null,
    "connector": "novalnet",
    "client_secret": "pay_QGM2AC1GkymhTRUGFudi_secret_Alsj3tRoRXSA4jQyiZRB",
    "created": "2025-01-06T05:52:52.140Z",
    "currency": "EUR",
    "customer_id": "StripeCustomer3",
    "customer": {
        "id": "StripeCustomer3",
        "name": "Joseph Doe",
        "email": "[email protected]",
        "phone": "999999999",
        "phone_country_code": "+65"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": "off_session",
    "off_session": null,
    "capture_on": null,
    "capture_method": "manual",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "1091",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "400000",
            "card_extended_bin": null,
            "card_exp_month": "12",
            "card_exp_year": "2025",
            "card_holder_name": null,
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": {
            "address": {
                "city": "Musterhausen",
                "country": "DE",
                "line1": "1467",
                "line2": "CA",
                "line3": "CA",
                "zip": "12345",
                "state": "California",
                "first_name": "Max",
                "last_name": "Mustermann"
            },
            "phone": {
                "number": "8056594427",
                "country_code": "+91"
            },
            "email": "[email protected]"
        }
    },
    "payment_token": null,
    "shipping": null,
    "billing": null,
    "order_details": null,
    "email": "[email protected]",
    "name": null,
    "phone": null,
    "return_url": "https://abc.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_QGM2AC1GkymhTRUGFudi/merchant_1735909365/pay_QGM2AC1GkymhTRUGFudi_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": null,
    "manual_retry_allowed": null,
    "connector_transaction_id": null,
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": null,
    "payment_link": null,
    "profile_id": "pro_Vqjv2CX86ySHR7gnmg1V",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_WnPQDTHYEHh1JW99nYVj",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-01-06T06:07:52.139Z",
    "fingerprint": null,
    "browser_info": {
        "language": null,
        "time_zone": null,
        "ip_address": "::1",
        "user_agent": null,
        "color_depth": null,
        "java_enabled": null,
        "screen_width": null,
        "accept_header": null,
        "screen_height": null,
        "java_script_enabled": null
    },
    "payment_method_id": "pm_TFQeOwfCGu3STWcdJ5pU",
    "payment_method_status": "inactive",
    "updated": "2025-01-06T05:53:01.837Z",
    "charges": null,
    "frm_metadata": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null
}

Payments MIT request

curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_BxHQLlnzzHJZx9Ld4IvQmJ*******LccVrQcbKTQ2BAxGyjt5' \
--data-raw '{
    "recurring_details": {
        "type": "payment_method_id",
        "data": "pm_TFQeOwfCGu3STWcdJ5pU"
    },
    "authentication_type": "three_ds",
    "customer": {
        "id": "StripeCustomer3",
        "email": "[email protected]"
    },
    "description": "This is the test payment made through Mule API",
    "currency": "EUR",
    "amount": 16,
    "confirm": true,
    "capture_method": "automatic",
    "off_session": true,
    "metadata": {
        "businessUnit": "ZG_GL_Group",
        "country": "US",
        "clientId": "N/A",
        "productName": "Travel insurance",
        "orderReference": "order-040724-001"
    }
}'

Payment MIT Response

{
    "payment_id": "pay_UWy1LMkXuSvsnrX1trk5",
    "merchant_id": "merchant_1735909365",
    "status": "succeeded",
    "amount": 16,
    "net_amount": 16,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 16,
    "connector": "novalnet",
    "client_secret": "pay_UWy1LMkXuSvsnr*****y5S64dkSx3kfoOaOH",
    "created": "2025-01-06T06:06:15.038Z",
    "currency": "EUR",
    "customer_id": "StripeCustomer3",
    "customer": {
        "id": "StripeCustomer3",
        "name": null,
        "email": "[email protected]",
        "phone": null,
        "phone_country_code": null
    },
    "description": "This is the test payment made through Mule API",
    "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": "1091",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "400000",
            "card_extended_bin": null,
            "card_exp_month": "12",
            "card_exp_year": "2025",
            "card_holder_name": "Max Mustermann",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": null,
    "billing": null,
    "order_details": null,
    "email": "[email protected]",
    "name": null,
    "phone": null,
    "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": {
        "customer_id": "StripeCustomer3",
        "created_at": 1736143575,
        "expires": 1736147175,
        "secret": "epk_b9b7b8e716754fcb894e737654bf9215"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "15133400010302056",
    "frm_message": null,
    "metadata": {
        "country": "US",
        "clientId": "N/A",
        "productName": "Travel insurance",
        "businessUnit": "ZG_GL_Group",
        "orderReference": "order-040724-001"
    },
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "15133400010302056",
    "payment_link": null,
    "profile_id": "pro_Vqjv2CX86ySHR7gnmg1V",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_WnPQDTHYEHh1JW99nYVj",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-01-06T06:21:15.038Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_method_id": "pm_TFQeOwfCGu3STWcdJ5pU",
    "payment_method_status": "active",
    "updated": "2025-01-06T06:06:16.951Z",
    "split_payments": null,
    "frm_metadata": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": "RcB2w22w00a02c-R22******0uBB18sBZ02c00aVZ18sT10k"
}

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

@sumanmaji4 sumanmaji4 self-assigned this Nov 27, 2024
@sumanmaji4 sumanmaji4 requested review from a team as code owners November 27, 2024 20:08
Copy link

semanticdiff-com bot commented Nov 27, 2024

Review changes with  SemanticDiff

Changed Files
File Status
  crates/router/src/core/payments/helpers.rs  92% smaller
  crates/router/src/core/payouts/helpers.rs  65% smaller
  crates/hyperswitch_domain_models/src/merchant_connector_account.rs  42% smaller
  crates/router/src/core/payouts/validator.rs  40% smaller
  crates/router/src/core/payments/operations/payment_response.rs  38% smaller
  crates/router/src/core/webhooks/incoming.rs  29% smaller
  crates/router/src/core/payments.rs  28% smaller
  crates/router/src/core/payments/tokenization.rs  22% smaller
  crates/router/src/core/payouts.rs  13% smaller
  crates/router/src/core/utils.rs  13% smaller
  crates/api_models/src/payment_methods.rs  12% smaller
  crates/router/src/core/payment_methods/cards.rs  10% smaller
  crates/hyperswitch_domain_models/src/mandates.rs  3% smaller
  crates/diesel_models/src/payment_method.rs  3% smaller
  crates/hyperswitch_domain_models/src/payment_methods.rs  2% smaller
  api-reference-v2/openapi_spec.json  0% smaller
  api-reference/openapi_spec.json  0% smaller
  crates/api_models/src/payouts.rs  0% smaller
  crates/hyperswitch_connectors/src/utils.rs  0% smaller
  crates/hyperswitch_domain_models/src/router_request_types.rs  0% smaller
  crates/router/src/core/payment_methods.rs  0% smaller
  crates/router/src/core/payments/routing.rs  0% smaller
  crates/router/src/core/payouts/transformers.rs  0% smaller
  crates/router/src/types/transformers.rs  0% smaller
  crates/router/tests/connectors/utils.rs  0% smaller

@hyperswitch-bot hyperswitch-bot bot added the M-database-changes Metadata: This PR involves database schema changes label Nov 27, 2024
@sumanmaji4 sumanmaji4 changed the title refactor(payout core): add recurring customer support for nomupay refactor(core): add recurring customer support for nomupay payouts. Nov 27, 2024
@hyperswitch-bot hyperswitch-bot bot added the M-api-contract-changes Metadata: This PR involves API contract changes label Nov 27, 2024
@sumanmaji4 sumanmaji4 force-pushed the core_changes_to_support_nomupay branch from b098698 to 13f9582 Compare November 29, 2024 08:17
@hyperswitch-bot hyperswitch-bot bot added M-api-contract-changes Metadata: This PR involves API contract changes and removed M-api-contract-changes Metadata: This PR involves API contract changes labels Nov 29, 2024
@sumanmaji4 sumanmaji4 force-pushed the core_changes_to_support_nomupay branch from a6d2247 to dba2017 Compare December 1, 2024 13:24
@hyperswitch-bot hyperswitch-bot bot added M-api-contract-changes Metadata: This PR involves API contract changes and removed M-api-contract-changes Metadata: This PR involves API contract changes labels Dec 1, 2024
@sumanmaji4 sumanmaji4 force-pushed the core_changes_to_support_nomupay branch from 403de74 to 9247d06 Compare December 2, 2024 18:32
@hyperswitch-bot hyperswitch-bot bot added M-api-contract-changes Metadata: This PR involves API contract changes and removed M-api-contract-changes Metadata: This PR involves API contract changes labels Dec 2, 2024
@sumanmaji4 sumanmaji4 force-pushed the core_changes_to_support_nomupay branch from fe546b0 to 0975259 Compare December 4, 2024 13:57
@hyperswitch-bot hyperswitch-bot bot added M-api-contract-changes Metadata: This PR involves API contract changes and removed M-api-contract-changes Metadata: This PR involves API contract changes labels Dec 4, 2024
kashif-m
kashif-m previously approved these changes Dec 5, 2024
Copy link
Contributor

@kashif-m kashif-m left a comment

Choose a reason for hiding this comment

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

Approved! Added a few nitpick suggestions

kashif-m
kashif-m previously approved these changes Jan 27, 2025
Aprabhat19
Aprabhat19 previously approved these changes Jan 27, 2025
@sumanmaji4 sumanmaji4 dismissed stale reviews from Aprabhat19 and kashif-m via 4ab0b34 January 27, 2025 18:33
@likhinbopanna likhinbopanna added this pull request to the merge queue Feb 3, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 3, 2025
@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue Feb 3, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 4, 2025
@likhinbopanna likhinbopanna added this pull request to the merge queue Feb 5, 2025
Merged via the queue into main with commit 8d8ebe9 Feb 5, 2025
18 of 21 checks passed
@likhinbopanna likhinbopanna deleted the core_changes_to_support_nomupay branch February 5, 2025 14:28
Narayanbhat166 pushed a commit that referenced this pull request Feb 6, 2025
…6687)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

9 participants