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 endpoint for listing connector features #6612

Merged
merged 53 commits into from
Dec 24, 2024

Conversation

AkshayaFoiger
Copy link
Contributor

@AkshayaFoiger AkshayaFoiger commented Nov 19, 2024

Type of Change

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

Description

-> Why?
With new features being added, it is becoming increasingly difficult to track all the additions. This information is essential for accurately representing Hyperswitch's offerings. Having this solution will eliminate inconsistencies between the documentation and the actual implementation, ensuring clarity and alignment.

-> What?

Introduce an API endpoint that provides:
-> A list of all connectors.
-> The payment methods supported by each connector.
-> The status of these payment methods.
-> Features supported by the connector

-> How?
-> ConnectorSpecifications Connector trait :
Function in this trait, will provide all the connector specific details like payment methods supported, refunds supported and etc.

-> Pre-validation for Payment Methods
Before invoking a connector to process a payment, this function will check if the specified payment_method is implemented, using the data provided in the ConnectorSpecifications trait. This ensures developers update the relevant functions during development and testing.

-> Unified API Endpoint:
Build an endpoint that collects information from all connectors and consolidates it into a unified JSON response. This will act as a single source of truth for supported features.

Additionally, this PR

  1. Adds country and currency filter for Bambora in configs.
  2. Refactors validate_capture_method() to get data from ConnectorSpecifications trait

Additional Changes

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

How did you test it?

Test the validation.
Create a Klarna payment with Bambora. It should fail with "payment method not supported" error.

curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_JHPIA2kkwO2PZt5kIZtkqGbjUotOyUD9ByNeEHTIVMPeLCqsU3qPIqJQ72Jtbdn5' \
--data-raw '{
    "amount": 6540,
    "currency": "GBP",
    "confirm": true,
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "amount_to_capture": 6540,
    "customer_id": "StripeCustomer",
    "phone_country_code": "+1",
    "description": "Its my first payment request",
    "authentication_type": "no_three_ds",
    "return_url": "https://duck.com",
    "payment_method": "pay_later",
    "payment_method_type": "klarna",
    "payment_experience": "redirect_to_url",
    "payment_method_data": {
        "pay_later": {
            "klarna_redirect": {}
        },
        "billing": {
            "address": {
                "country": "GB"
            },
            "email": "[email protected]"
        }
    }  
}'

Response

{
    "error": {
        "type": "invalid_request",
        "message": "Payment method type not supported",
        "code": "IR_19",
        "reason": "pay_later is not supported by bambora"
    }
}

The payment intent status will be requires_payment_method

  1. Test the endpoint /feature_matrix
curl --location --request GET 'http://localhost:8080/feature_matrix' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: test_admin' \
--header 'X-Merchant-Id: postman_merchant_GHAction_e70f1cfe-b545-46a4-bb39-4ceb21392117' \
--data '{
     "connectors" : ["zsl"]   // Provide list of connectors, for which you need to list the features 
                                                      // currently implemented for bambora , zsl and deutsche bank. 
}'

Response

{
    "connector_count": 1,
    "connectors": [
        {
            "name": "zsl",
            "description": "Zsl is a payment gateway operating in China, specializing in facilitating local bank transfers",
            "category": "payment_gateway",
            "supported_payment_methods": [
                {
                    "payment_method": "bank_transfer",
                    "payment_method_type": "local_bank_transfer",
                    "mandates": "not_supported",
                    "refunds": "not_supported",
                    "supported_capture_methods": [
                        "automatic"
                    ],
                    "supported_countries": [
                        "CN"
                    ],
                    "supported_currencies": [
                        "CNY"
                    ]
                }
            ],
            "supported_webhook_flows": []
        }
    ]
}

List for all connector (that implements this feature)

curl --location --request GET 'http://localhost:8080/feature_matrix' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: test_admin' \
--header 'X-Merchant-Id: postman_merchant_GHAction_e70f1cfe-b545-46a4-bb39-4ceb21392117' \
--data '{
    
}'

Response

{
    "connector_count": 3,
    "connectors": [
        {
            "name": "bambora",
            "description": "Bambora is a leading online payment provider in Canada and United States.",
            "category": "payment_gateway",
            "supported_payment_methods": [
                {
                    "payment_method": "card",
                    "payment_method_type": "credit",
                    "mandates": "not_supported",
                    "refunds": "supported",
                    "supported_capture_methods": [
                        "automatic",
                        "manual",
                        "sequential_automatic"
                    ],
                    "supported_countries": [
                        "US",
                        "CA"
                    ],
                    "supported_currencies": [
                        "USD"
                    ]
                },
                {
                    "payment_method": "card",
                    "payment_method_type": "debit",
                    "mandates": "not_supported",
                    "refunds": "supported",
                    "supported_capture_methods": [
                        "automatic",
                        "manual",
                        "sequential_automatic"
                    ],
                    "supported_countries": [
                        "US",
                        "CA"
                    ],
                    "supported_currencies": [
                        "USD"
                    ]
                }
            ],
            "supported_webhook_flows": []
        },
        {
            "name": "deutschebank",
            "description": "Deutsche Bank is a German multinational investment bank and financial services company ",
            "category": "bank_acquirer",
            "supported_payment_methods": [
                {
                    "payment_method": "bank_debit",
                    "payment_method_type": "sepa",
                    "mandates": "not_supported",
                    "refunds": "not_supported",
                    "supported_capture_methods": [
                        "automatic",
                        "manual",
                        "sequential_automatic"
                    ],
                    "supported_countries": null,
                    "supported_currencies": null
                }
            ],
            "supported_webhook_flows": []
        },
        {
            "name": "zsl",
            "description": "Zsl is a payment gateway operating in China, specializing in facilitating local bank transfers",
            "category": "payment_gateway",
            "supported_payment_methods": [
                {
                    "payment_method": "bank_transfer",
                    "payment_method_type": "local_bank_transfer",
                    "mandates": "not_supported",
                    "refunds": "not_supported",
                    "supported_capture_methods": [
                        "automatic"
                    ],
                    "supported_countries": [
                        "CN"
                    ],
                    "supported_currencies": [
                        "CNY"
                    ]
                }
            ],
            "supported_webhook_flows": []
        }
    ]
}

Additional,
Create a Automatic/SequentialAutomatic payment with deutsche bank

curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_jdLdftKuRTXWX9RsqzbDOndff6PeQsl5Ltlg3W4PcIlRWdjBycM0YHC4vtVPH8E1' \
--data-raw '{
    "amount": 1234,
    "currency": "EUR",
    "confirm": true,
    "customer_id": "customer123",
    "email": "[email protected]",
    "capture_method": "automatic",
    "payment_method": "bank_debit",
    "payment_method_type": "sepa",
    "payment_method_data": {
        "bank_debit": {
            "sepa_bank_debit": {
                "iban": "DE87123456781234567890"
            }
        }
    },
    "billing": {
        "address": {
            "first_name": "joseph",
            "last_name": "doe"
        }
    },
    "customer_acceptance": {
        "acceptance_type": "offline"
    },
    "setup_future_usage": "off_session"
}'

Response

{
    "payment_id": "pay_PJGPf0dnRUO2Cs44N6nN",
    "merchant_id": "postman_merchant_GHAction_3f754a63-9a43-434a-8386-6529bb12136d",
    "status": "requires_customer_action",
    "amount": 1234,
    "net_amount": 1234,
    "shipping_cost": null,
    "amount_capturable": 1234,
    "amount_received": null,
    "connector": "deutschebank",
    "client_secret": "pay_PJGPf0dnRUO2Cs44N6nN_secret_OIf3R7djl4FvRJJv4kDd",
    "created": "2024-12-24T07:20:41.449Z",
    "currency": "EUR",
    "customer_id": "customer123",
    "customer": {
        "id": "customer123",
        "name": null,
        "email": "[email protected]",
        "phone": null,
        "phone_country_code": null
    },
    "description": null,
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": "off_session",
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "bank_debit",
    "payment_method_data": {
        "bank_debit": {
            "sepa": {
                "iban": "DE871************67890",
                "bank_account_holder_name": null
            }
        },
        "billing": null
    },
    "payment_token": "token_dHaseB7u8Xj3iLGUgkuA",
    "shipping": null,
    "billing": {
        "address": {
            "city": null,
            "country": null,
            "line1": null,
            "line2": null,
            "line3": null,
            "zip": null,
            "state": null,
            "first_name": "joseph",
            "last_name": "doe"
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "[email protected]",
    "name": null,
    "phone": null,
    "return_url": null,
    "authentication_type": "no_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_PJGPf0dnRUO2Cs44N6nN/postman_merchant_GHAction_3f754a63-9a43-434a-8386-6529bb12136d/pay_PJGPf0dnRUO2Cs44N6nN_1"
    },
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "sepa",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "customer123",
        "created_at": 1735024841,
        "expires": 1735028441,
        "secret": "epk_194860e2d9214ea7b9aa1fed3411cade"
    },
    "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_n17q78fbnGngmdtYaYbl",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_PMwnyzykz65zs2XSTIvB",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2024-12-24T07:35:41.449Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_method_id": "pm_ARrC7UL1P78NjgGyewwT",
    "payment_method_status": "inactive",
    "updated": "2024-12-24T07:20:43.432Z",
    "split_payments": null,
    "frm_metadata": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": "f5e5af1e52d453f0a606ea1120edd951"
}

Psync Response

{
    "payment_id": "pay_PJGPf0dnRUO2Cs44N6nN",
    "merchant_id": "postman_merchant_GHAction_3f754a63-9a43-434a-8386-6529bb12136d",
    "status": "succeeded",
    "amount": 1234,
    "net_amount": 1234,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 1234,
    "connector": "deutschebank",
    "client_secret": "pay_PJGPf0dnRUO2Cs44N6nN_secret_OIf3R7djl4FvRJJv4kDd",
    "created": "2024-12-24T07:20:41.449Z",
    "currency": "EUR",
    "customer_id": "customer123",
    "customer": {
        "id": "customer123",
        "name": null,
        "email": "[email protected]",
        "phone": null,
        "phone_country_code": null
    },
    "description": null,
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": "off_session",
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "bank_debit",
    "payment_method_data": {
        "bank_debit": {
            "sepa": {
                "iban": "DE871************67890",
                "bank_account_holder_name": null
            }
        },
        "billing": null
    },
    "payment_token": "token_dHaseB7u8Xj3iLGUgkuA",
    "shipping": null,
    "billing": {
        "address": {
            "city": null,
            "country": null,
            "line1": null,
            "line2": null,
            "line3": null,
            "zip": null,
            "state": null,
            "first_name": "joseph",
            "last_name": "doe"
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "[email protected]",
    "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": "sepa",
    "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": "8tgsX9KWpHfJHlgaF5dIOM",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": null,
    "payment_link": null,
    "profile_id": "pro_n17q78fbnGngmdtYaYbl",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_PMwnyzykz65zs2XSTIvB",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2024-12-24T07:35:41.449Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_method_id": "pm_ARrC7UL1P78NjgGyewwT",
    "payment_method_status": "active",
    "updated": "2024-12-24T07:20:49.827Z",
    "split_payments": null,
    "frm_metadata": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null
}

Create a manual payment with deutsche bank

curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_jdLdftKuRTXWX9RsqzbDOndff6PeQsl5Ltlg3W4PcIlRWdjBycM0YHC4vtVPH8E1' \
--data-raw '{
    "amount": 1234,
    "currency": "EUR",
    "confirm": true,
    "customer_id": "customer123",
    "email": "[email protected]",
    "capture_method": "manual",
    "payment_method": "bank_debit",
    "payment_method_type": "sepa",
    "payment_method_data": {
        "bank_debit": {
            "sepa_bank_debit": {
                "iban": "DE87123456781234567890"
            }
        }
    },
    "billing": {
        "address": {
            "first_name": "joseph",
            "last_name": "doe"
        }
    },
    "customer_acceptance": {
        "acceptance_type": "offline"
    },
    "setup_future_usage": "off_session"
}'

Response

{
    "payment_id": "pay_CAS5XgcroXwOESWGdu49",
    "merchant_id": "postman_merchant_GHAction_3f754a63-9a43-434a-8386-6529bb12136d",
    "status": "requires_customer_action",
    "amount": 1234,
    "net_amount": 1234,
    "shipping_cost": null,
    "amount_capturable": 1234,
    "amount_received": null,
    "connector": "deutschebank",
    "client_secret": "pay_CAS5XgcroXwOESWGdu49_secret_ZjlFv55QSgksNxbaAASN",
    "created": "2024-12-24T07:27:13.878Z",
    "currency": "EUR",
    "customer_id": "customer123",
    "customer": {
        "id": "customer123",
        "name": null,
        "email": "[email protected]",
        "phone": null,
        "phone_country_code": null
    },
    "description": null,
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": "off_session",
    "off_session": null,
    "capture_on": null,
    "capture_method": "manual",
    "payment_method": "bank_debit",
    "payment_method_data": {
        "bank_debit": {
            "sepa": {
                "iban": "DE871************67890",
                "bank_account_holder_name": null
            }
        },
        "billing": null
    },
    "payment_token": "token_82FJHIG0GY4q6YXaseyL",
    "shipping": null,
    "billing": {
        "address": {
            "city": null,
            "country": null,
            "line1": null,
            "line2": null,
            "line3": null,
            "zip": null,
            "state": null,
            "first_name": "joseph",
            "last_name": "doe"
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "[email protected]",
    "name": null,
    "phone": null,
    "return_url": null,
    "authentication_type": "no_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_CAS5XgcroXwOESWGdu49/postman_merchant_GHAction_3f754a63-9a43-434a-8386-6529bb12136d/pay_CAS5XgcroXwOESWGdu49_1"
    },
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "sepa",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "customer123",
        "created_at": 1735025233,
        "expires": 1735028833,
        "secret": "epk_8e32a48d04cb49cea675f2e9a600342f"
    },
    "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_n17q78fbnGngmdtYaYbl",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_PMwnyzykz65zs2XSTIvB",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2024-12-24T07:42:13.878Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_method_id": "pm_NWsFWDKjiy56eR1MwJYP",
    "payment_method_status": "inactive",
    "updated": "2024-12-24T07:27:16.188Z",
    "split_payments": null,
    "frm_metadata": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": "81daea9d34130809aeb76a7c4681eba2"
}

Capture

curl --location 'http://localhost:8080/payments/pay_CAS5XgcroXwOESWGdu49/capture' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_jdLdftKuRTXWX9RsqzbDOndff6PeQsl5Ltlg3W4PcIlRWdjBycM0YHC4vtVPH8E1' \
--data '{
    "amount_to_capture": 1234,
    "statement_descriptor_name": "Joseph",
    "statement_descriptor_suffix": "JS"
}'

Response

{
    "payment_id": "pay_CAS5XgcroXwOESWGdu49",
    "merchant_id": "postman_merchant_GHAction_3f754a63-9a43-434a-8386-6529bb12136d",
    "status": "succeeded",
    "amount": 1234,
    "net_amount": 1234,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 1234,
    "connector": "deutschebank",
    "client_secret": "pay_CAS5XgcroXwOESWGdu49_secret_ZjlFv55QSgksNxbaAASN",
    "created": "2024-12-24T07:27:13.878Z",
    "currency": "EUR",
    "customer_id": "customer123",
    "customer": {
        "id": "customer123",
        "name": null,
        "email": "[email protected]",
        "phone": null,
        "phone_country_code": null
    },
    "description": null,
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": "off_session",
    "off_session": null,
    "capture_on": null,
    "capture_method": "manual",
    "payment_method": "bank_debit",
    "payment_method_data": {
        "bank_debit": {
            "sepa": {
                "iban": "DE871************67890",
                "bank_account_holder_name": null
            }
        },
        "billing": null
    },
    "payment_token": "token_82FJHIG0GY4q6YXaseyL",
    "shipping": null,
    "billing": {
        "address": {
            "city": null,
            "country": null,
            "line1": null,
            "line2": null,
            "line3": null,
            "zip": null,
            "state": null,
            "first_name": "joseph",
            "last_name": "doe"
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "[email protected]",
    "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": "sepa",
    "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": "pvXN4K0EUCkC5gk95yAn1r",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": null,
    "payment_link": null,
    "profile_id": "pro_n17q78fbnGngmdtYaYbl",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_PMwnyzykz65zs2XSTIvB",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2024-12-24T07:42:13.878Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_method_id": "pm_NWsFWDKjiy56eR1MwJYP",
    "payment_method_status": null,
    "updated": "2024-12-24T07:28:39.887Z",
    "split_payments": null,
    "frm_metadata": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null
}

Create a automatic payment with ZSL

curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_2ZvCqVsfjQepFQo0HhHlG9fgJe9Si8GfGIf3LpAXLRiFsk2MdTuc0P6W3vBO5P4G' \
--data-raw '{
    "amount": 6540,
    "amount_to_capture": 6540,
    "authentication_type": "three_ds",
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "CN",
            "first_name": "PiX",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "state": "California",
            "zip": "94122"
        }
    },
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "confirm": true,
    "currency": "CNY",
    "customer_id": "StripeCustomer",
    "description": "Its my first payment request",
    "email": "[email protected]",
    "metadata": {
        "login_date": "2019-09-10T10:11:12Z",
        "new_customer": "true",
        "udf1": "value1"
    },
    "name": "John Doe",
    "payment_method": "bank_transfer",
    "payment_method_type": "local_bank_transfer",
    "payment_method_data": {
        "bank_transfer": {
            "local_bank_transfer": {}
        }
    },
    "phone": "999999999",
    "phone_country_code": "+1",
    "return_url": "https://duck.com",
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "first_name": "PiX",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "state": "California",
            "zip": "94122"
        }
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "browser_info": {
        "language": "en-EN"   
    }
}'

Response

{
    "payment_id": "pay_1sr0mbA1bHTO1i10Pe4Y",
    "merchant_id": "postman_merchant_GHAction_a99972f4-8763-4586-ad62-6792151f3fe2",
    "status": "requires_customer_action",
    "amount": 6540,
    "net_amount": 6540,
    "shipping_cost": null,
    "amount_capturable": 6540,
    "amount_received": null,
    "connector": "zsl",
    "client_secret": "pay_1sr0mbA1bHTO1i10Pe4Y_secret_jGStHPhPOtQyDOx0gn0x",
    "created": "2024-12-24T07:36:46.948Z",
    "currency": "CNY",
    "customer_id": "StripeCustomer",
    "customer": {
        "id": "StripeCustomer",
        "name": "John Doe",
        "email": "[email protected]",
        "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": "bank_transfer",
    "payment_method_data": {
        "bank_transfer": {
            "local_bank_transfer": {
                "bank_code": null
            }
        },
        "billing": null
    },
    "payment_token": null,
    "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 Fransico",
            "country": "CN",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "PiX",
            "last_name": null
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "[email protected]",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://duck.com/",
    "authentication_type": "three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": {
        "type": "redirect_to_url",
        "redirect_to_url": "http://localhost:8080/payments/redirect/pay_1sr0mbA1bHTO1i10Pe4Y/postman_merchant_GHAction_a99972f4-8763-4586-ad62-6792151f3fe2/pay_1sr0mbA1bHTO1i10Pe4Y_1"
    },
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "local_bank_transfer",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "StripeCustomer",
        "created_at": 1735025806,
        "expires": 1735029406,
        "secret": "epk_5137137c032346e9b635bd843bb29acf"
    },
    "manual_retry_allowed": null,
    "connector_transaction_id": null,
    "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_1sr0mbA1bHTO1i10Pe4Y_1",
    "payment_link": null,
    "profile_id": "pro_fZz6ebkNyN5HPQW4MEqP",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_YqojaoQ3Mz6XUf2nev9A",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2024-12-24T07:51:46.948Z",
    "fingerprint": null,
    "browser_info": {
        "language": "en-EN"
    },
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2024-12-24T07:36:47.924Z",
    "split_payments": null,
    "frm_metadata": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null
}

Screenshot 2024-12-24 at 1 42 32 PM

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

@AkshayaFoiger AkshayaFoiger requested review from a team as code owners November 19, 2024 12:35
Copy link

semanticdiff-com bot commented Nov 19, 2024

Review changes with  SemanticDiff

Changed Files
File Status
  crates/router/src/services/api.rs  91% smaller
  crates/router/src/types/api/payments.rs  85% smaller
  crates/router/src/utils/connector_onboarding/paypal.rs  84% smaller
  crates/hyperswitch_connectors/src/connectors/amazonpay.rs  80% smaller
  crates/hyperswitch_connectors/src/connectors/bitpay.rs  80% smaller
  crates/hyperswitch_connectors/src/connectors/cryptopay.rs  80% smaller
  crates/hyperswitch_connectors/src/connectors/ctp_mastercard.rs  80% smaller
  crates/hyperswitch_connectors/src/connectors/globepay.rs  80% smaller
  crates/hyperswitch_connectors/src/connectors/inespay.rs  80% smaller
  crates/hyperswitch_connectors/src/connectors/nomupay.rs  80% smaller
  crates/hyperswitch_connectors/src/connectors/prophetpay.rs  80% smaller
  crates/hyperswitch_connectors/src/connectors/razorpay.rs  80% smaller
  crates/hyperswitch_connectors/src/connectors/redsys.rs  80% smaller
  crates/hyperswitch_connectors/src/connectors/taxjar.rs  80% smaller
  crates/hyperswitch_connectors/src/connectors/thunes.rs  80% smaller
  crates/hyperswitch_connectors/src/connectors/unified_authentication_service.rs  80% smaller
  crates/hyperswitch_connectors/src/connectors/volt.rs  80% smaller
  crates/hyperswitch_connectors/src/connectors/xendit.rs  80% smaller
  crates/hyperswitch_interfaces/src/api/payments_v2.rs  79% smaller
  crates/router/src/lib.rs  75% smaller
  crates/hyperswitch_connectors/src/connectors/bamboraapac.rs  59% smaller
  crates/hyperswitch_connectors/src/connectors/billwerk.rs  59% smaller
  crates/hyperswitch_connectors/src/connectors/boku.rs  59% smaller
  crates/hyperswitch_connectors/src/connectors/cashtocode.rs  59% smaller
  crates/hyperswitch_connectors/src/connectors/coinbase.rs  59% smaller
  crates/hyperswitch_connectors/src/connectors/dlocal.rs  59% smaller
  crates/hyperswitch_connectors/src/connectors/fiserv.rs  59% smaller
  crates/hyperswitch_connectors/src/connectors/fiservemea.rs  59% smaller
  crates/hyperswitch_connectors/src/connectors/forte.rs  59% smaller
  crates/hyperswitch_connectors/src/connectors/gocardless.rs  59% smaller
  crates/hyperswitch_connectors/src/connectors/helcim.rs  59% smaller
  crates/hyperswitch_connectors/src/connectors/jpmorgan.rs  59% smaller
  crates/hyperswitch_connectors/src/connectors/multisafepay.rs  59% smaller
  crates/hyperswitch_connectors/src/connectors/nexinets.rs  59% smaller
  crates/hyperswitch_connectors/src/connectors/nexixpay.rs  59% smaller
  crates/hyperswitch_connectors/src/connectors/payu.rs  59% smaller
  crates/hyperswitch_connectors/src/connectors/placetopay.rs  59% smaller
  crates/hyperswitch_connectors/src/connectors/powertranz.rs  59% smaller
  crates/hyperswitch_connectors/src/connectors/shift4.rs  59% smaller
  crates/hyperswitch_connectors/src/connectors/square.rs  59% smaller
  crates/hyperswitch_connectors/src/connectors/stax.rs  59% smaller
  crates/hyperswitch_connectors/src/connectors/tsys.rs  59% smaller
  crates/hyperswitch_connectors/src/connectors/datatrans.rs  58% smaller
  crates/hyperswitch_connectors/src/connectors/elavon.rs  58% smaller
  crates/hyperswitch_connectors/src/connectors/fiuu.rs  58% smaller
  crates/hyperswitch_connectors/src/connectors/payeezy.rs  58% smaller
  crates/hyperswitch_connectors/src/connectors/rapyd.rs  54% smaller
  crates/router/src/routes.rs  44% smaller
  crates/openapi/src/openapi.rs  27% smaller
  crates/hyperswitch_interfaces/src/api.rs  25% smaller
  crates/hyperswitch_interfaces/src/api/payments.rs  18% smaller
  crates/hyperswitch_connectors/src/connectors/zsl.rs  14% smaller
  crates/hyperswitch_connectors/src/connectors/deutschebank.rs  14% smaller
  crates/hyperswitch_connectors/src/connectors/worldline.rs  11% smaller
  crates/hyperswitch_connectors/src/connectors/bambora.rs  10% smaller
  crates/openapi/src/openapi_v2.rs  5% smaller
  crates/hyperswitch_connectors/src/connectors/mollie.rs  2% smaller
  crates/hyperswitch_connectors/src/connectors/zen.rs  2% smaller
  crates/router/src/connector/wise.rs  2% smaller
  crates/router/src/connector/iatapay.rs  1% smaller
  crates/router/src/connector/mifinity.rs  1% smaller
  crates/router/src/connector/opennode.rs  1% smaller
  crates/router/src/connector/payone.rs  1% smaller
  crates/router/src/connector/plaid.rs  1% smaller
  crates/router/src/connector/threedsecureio.rs  1% smaller
  crates/router/src/connector/trustpay.rs  1% smaller
  crates/router/src/connector/wellsfargopayout.rs  1% smaller
  crates/router/src/connector/adyenplatform.rs  1% smaller
  crates/router/src/connector/ebanx.rs  1% smaller
  crates/router/src/connector/riskified.rs  1% smaller
  crates/router/src/connector/gpayments.rs  1% smaller
  crates/router/src/connector/itaubank.rs  1% smaller
  crates/router/src/connector/netcetera.rs  1% smaller
  crates/router/src/connector/signifyd.rs  1% smaller
  crates/hyperswitch_connectors/src/connectors/airwallex.rs  1% smaller
  crates/hyperswitch_connectors/src/connectors/bluesnap.rs  1% smaller
  crates/hyperswitch_connectors/src/connectors/digitalvirgo.rs  1% smaller
  crates/hyperswitch_connectors/src/connectors/novalnet.rs  1% smaller
  crates/hyperswitch_connectors/src/connectors/paybox.rs  1% smaller
  crates/hyperswitch_connectors/src/connectors/worldpay.rs  1% smaller
  crates/router/src/connector/adyen.rs  1% smaller
  crates/router/src/connector/klarna.rs  1% smaller
  crates/router/src/connector/stripe.rs  1% smaller
  crates/router/src/connector/bankofamerica.rs  1% smaller
  crates/router/src/connector/braintree.rs  1% smaller
  crates/router/src/connector/checkout.rs  1% smaller
  crates/router/src/connector/cybersource.rs  1% smaller
  crates/router/src/connector/dummyconnector.rs  1% smaller
  crates/router/src/connector/globalpay.rs  1% smaller
  crates/router/src/connector/noon.rs  1% smaller
  crates/router/src/connector/opayo.rs  1% smaller
  crates/router/src/connector/wellsfargo.rs  1% smaller
  crates/router/src/connector/paypal.rs  1% smaller
  crates/router/src/connector/authorizedotnet.rs  1% smaller
  crates/router/src/connector/nmi.rs  1% smaller
  crates/router/src/connector/nuvei.rs  1% smaller
  crates/router/src/connector/payme.rs  1% smaller
  Cargo.lock Unsupported file format
  api-reference-v2/openapi_spec.json  0% smaller
  api-reference/openapi_spec.json  0% smaller
  config/config.example.toml Unsupported file format
  config/deployments/integration_test.toml Unsupported file format
  config/deployments/production.toml Unsupported file format
  config/deployments/sandbox.toml Unsupported file format
  config/development.toml Unsupported file format
  config/docker_compose.toml Unsupported file format
  connector-template/mod.rs Unsupported file format
  crates/api_models/src/feature_matrix.rs  0% smaller
  crates/api_models/src/lib.rs  0% smaller
  crates/common_enums/src/enums.rs  0% smaller
  crates/hyperswitch_connectors/Cargo.toml Unsupported file format
  crates/hyperswitch_domain_models/src/router_response_types.rs  0% smaller
  crates/hyperswitch_interfaces/src/types.rs  0% smaller
  crates/router/src/connector/aci.rs  0% smaller
  crates/router/src/core/payments/flows/authorize_flow.rs  0% smaller
  crates/router/src/routes/app.rs  0% smaller
  crates/router/src/routes/feature_matrix.rs  0% smaller
  crates/router/src/routes/lock_utils.rs  0% smaller
  crates/router/src/services/connector_integration_interface.rs Unsupported file format
  crates/router/src/types/api.rs  0% smaller
  crates/router_env/src/logger/types.rs  0% smaller
  cypress-tests/cypress/e2e/PaymentTest/00000-CoreFlows.cy.js  0% smaller
  cypress-tests/cypress/support/commands.js  0% smaller
  loadtest/config/development.toml Unsupported file format

@AkshayaFoiger AkshayaFoiger self-assigned this Nov 19, 2024
@AkshayaFoiger AkshayaFoiger added C-feature Category: Feature request or enhancement C-refactor Category: Refactor M-api-contract-changes Metadata: This PR involves API contract changes labels Nov 19, 2024
@AkshayaFoiger AkshayaFoiger changed the title feat(router): add an api for listing connector features and add a payment method function feat(router): add endpoint for listing connector features Nov 19, 2024
@hyperswitch-bot hyperswitch-bot bot removed the M-api-contract-changes Metadata: This PR involves API contract changes label Nov 19, 2024
crates/common_enums/src/enums.rs Outdated Show resolved Hide resolved
crates/router/src/routes/feature_matrix.rs Outdated Show resolved Hide resolved
crates/api_models/src/feature_matrix.rs Outdated Show resolved Hide resolved
crates/common_enums/src/enums.rs Outdated Show resolved Hide resolved
crates/common_enums/src/enums.rs Outdated Show resolved Hide resolved
crates/hyperswitch_connectors/src/connectors/bambora.rs Outdated Show resolved Hide resolved
crates/hyperswitch_interfaces/src/api.rs Outdated Show resolved Hide resolved
@AkshayaFoiger AkshayaFoiger requested a review from a team as a code owner December 5, 2024 11:28
Narayanbhat166
Narayanbhat166 previously approved these changes Dec 20, 2024
pixincreate
pixincreate previously approved these changes Dec 20, 2024
Copy link
Member

@pixincreate pixincreate left a comment

Choose a reason for hiding this comment

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

ci changes look good

apoorvdixit88
apoorvdixit88 previously approved these changes Dec 20, 2024
jarnura
jarnura previously approved these changes Dec 23, 2024
@pixincreate pixincreate added the S-needs-conflict-resolution Status: This PR needs conflicts to be resolved by the author label Dec 23, 2024
@AkshayaFoiger AkshayaFoiger removed the S-needs-conflict-resolution Status: This PR needs conflicts to be resolved by the author label Dec 24, 2024
@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue Dec 24, 2024
Merged via the queue into main with commit a423ff5 Dec 24, 2024
29 of 31 checks passed
@Gnanasundari24 Gnanasundari24 deleted the pm-details-doc branch December 24, 2024 09:35
pixincreate added a commit to Ankesh2004/hyperswitch that referenced this pull request Dec 26, 2024
…r-verifyurl-in-redirection-handler

* 'main' of github.com:juspay/hyperswitch: (444 commits)
  ci: add tests that make use of locker (juspay#6735)
  chore(version): 2024.12.26.1
  fix(router): populate `profile_id` in for the HeaderAuth of v1 (juspay#6936)
  docs(openapi): update /relay request example (juspay#6942)
  chore(version): 2024.12.26.0
  fix(payments_list): handle same payment/attempt ids for different merchants (juspay#6917)
  refactor(core): remove merchant return url from `router_data` (juspay#6895)
  feat(router): add endpoint for listing connector features  (juspay#6612)
  fix(wasm): remove chasenet from jpmorgan wasm as ChaseNet doesn’t exist in PMT (juspay#6927)
  fix(cors): expose all headers set by application in `access-control-expose-headers` header value (juspay#6877)
  chore(version): 2024.12.24.0
  feat(cypress): valdiate `error_code` and `error_message` and make it visible in `reports` (juspay#6913)
  fix(wasm): remove extra space from wasm for payment_method_type of JPMorgan (juspay#6923)
  fix(wasm): fix feature dependencies in `connector_configs` crate for WASM builds  (juspay#6832)
  feat(router): add /retrieve api for relay (juspay#6918)
  feat(core): implemented platform merchant account (juspay#6882)
  feat(payments_v2): add payment method list endpoint (juspay#6805)
  fix(connector): [Cybersource] fix the required fields for wallet mandate payments (juspay#6911)
  chore(version): 2024.12.23.0
  feat(connector): [JPMORGAN] add Payment flows for cards (juspay#6668)
  ...
pixincreate added a commit to Ankesh2004/hyperswitch that referenced this pull request Dec 26, 2024
…r-verifyurl-in-redirection-handler

* 'main' of github.com:juspay/hyperswitch: (444 commits)
  ci: add tests that make use of locker (juspay#6735)
  chore(version): 2024.12.26.1
  fix(router): populate `profile_id` in for the HeaderAuth of v1 (juspay#6936)
  docs(openapi): update /relay request example (juspay#6942)
  chore(version): 2024.12.26.0
  fix(payments_list): handle same payment/attempt ids for different merchants (juspay#6917)
  refactor(core): remove merchant return url from `router_data` (juspay#6895)
  feat(router): add endpoint for listing connector features  (juspay#6612)
  fix(wasm): remove chasenet from jpmorgan wasm as ChaseNet doesn’t exist in PMT (juspay#6927)
  fix(cors): expose all headers set by application in `access-control-expose-headers` header value (juspay#6877)
  chore(version): 2024.12.24.0
  feat(cypress): valdiate `error_code` and `error_message` and make it visible in `reports` (juspay#6913)
  fix(wasm): remove extra space from wasm for payment_method_type of JPMorgan (juspay#6923)
  fix(wasm): fix feature dependencies in `connector_configs` crate for WASM builds  (juspay#6832)
  feat(router): add /retrieve api for relay (juspay#6918)
  feat(core): implemented platform merchant account (juspay#6882)
  feat(payments_v2): add payment method list endpoint (juspay#6805)
  fix(connector): [Cybersource] fix the required fields for wallet mandate payments (juspay#6911)
  chore(version): 2024.12.23.0
  feat(connector): [JPMORGAN] add Payment flows for cards (juspay#6668)
  ...
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 C-refactor Category: Refactor M-api-contract-changes Metadata: This PR involves API contract changes M-configuration-changes Metadata: This PR involves configuration changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] add endpoint for listing connector features
7 participants