hyperswitch icon indicating copy to clipboard operation
hyperswitch copied to clipboard

feat(payout): [Payone] add payone connector

Open KiranKBR opened this issue 9 months ago • 1 comments

Type of Change

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

Description

Payone is Payout connector and I have implemented payout fulfill flow

How did you test it?

I tested them through postman and here these are the requests and responses Merchant Connector:

--header 'Content-Type: application/json' \
--header 'api-key: test_admin' \
--data '{
    "connector_type": "payout_processor",
    "connector_name": "payone",
    "connector_account_details": {
        "auth_type": "SignatureKey",
        "api_key": "",
        "api_secret": "",
        "key1": ""
    },
    "test_mode": false,
    "disabled": false,
    "business_country": "US",
    "business_label": "default",
    "payment_methods_enabled": [
        {
            "payment_method": "card",
            "payment_method_types": [
                {
                    "payment_method_type": "credit",
                    "card_networks": [
                        
                
                        "Mastercard",
                        "Visa"
                    ],
                    "minimum_amount": 1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                },
                {
                    "payment_method_type": "debit",
                    "card_networks": [
                        "AmericanExpress",
                        "Discover",
                        "Interac",
                        "JCB",
                        "Mastercard",
                        "Visa",
                        "DinersClub",
                        "UnionPay",
                        "RuPay"
                    ],
                    "minimum_amount": 1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                }
            ]
        },
        {
            "payment_method": "wallet",
            "payment_method_types": [
                {
                    "payment_method_type": "paypal",
                    "payment_experience": "redirect_to_url",
                    "minimum_amount": 1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": false,
                    "installment_payment_enabled": false
                }
            ]
        }
    ],
    "metadata": {
        "city": "NY",
        "unit": "245"
    }
}'

response:

{
    "connector_type": "payout_processor",
    "connector_name": "payone",
    "connector_label": "payone_US_default",
    "merchant_connector_id": "mca_Rufh4UB4ctrHhOV8JQzG",
    "profile_id": "pro_cp4l2sD7NggkM66Cvrfz",
    "connector_account_details": {
        "auth_type": "SignatureKey",
        "api_key": "",
        "api_secret": "",
        "key1": ""
    },
    "payment_methods_enabled": [
        {
            "payment_method": "card",
            "payment_method_types": [
                {
                    "payment_method_type": "credit",
                    "payment_experience": null,
                    "card_networks": [
                        "Mastercard",
                        "Visa"
                    ],
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": 1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                },
                {
                    "payment_method_type": "debit",
                    "payment_experience": null,
                    "card_networks": [
                        "AmericanExpress",
                        "Discover",
                        "Interac",
                        "JCB",
                        "Mastercard",
                        "Visa",
                        "DinersClub",
                        "UnionPay",
                        "RuPay"
                    ],
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": 1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                }
            ]
        },
        {
            "payment_method": "wallet",
            "payment_method_types": [
                {
                    "payment_method_type": "paypal",
                    "payment_experience": "redirect_to_url",
                    "card_networks": null,
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": 1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": false,
                    "installment_payment_enabled": false
                }
            ]
        }
    ],
    "connector_webhook_details": null,
    "metadata": {
        "city": "NY",
        "unit": "245"
    },
    "test_mode": false,
    "disabled": false,
    "frm_configs": null,
    "business_country": "US",
    "business_label": "default",
    "business_sub_label": null,
    "applepay_verified_domains": null,
    "pm_auth_config": null,
    "status": "active"
}

Payout Creation:

{
    "amount": 100,
    "currency": "EUR",
    "customer_id": "payout_customer",
    "email": "[email protected]",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+65",
    "description": "Its my first payout request",
    "payout_type": "card",
    "payout_method_data": {
        "card": {
            "card_number": "4012000033330026",
            "expiry_month": "05",
            "expiry_year": "30",
            "card_holder_name": "John Smith"
        }
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "NY",
            "zip": "94122",
            "country": "US",
            "first_name": "John",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    },
    "entity_type": "Individual",
    "recurring": false,
    "metadata": {
        "ref": "123"
    },
        "business_country": "US",
    "business_label": "default",
    // "routing": {
    //     "type": "single",
    //     "data": "adyen"
    // },
    "auto_fulfill": true,
    "confirm": true
}

response:

{
    "payout_id": "5ec9e6ac-1bbc-4236-a217-e0ff890e7f2e",
    "merchant_id": "merchant_1715339934",
    "amount": 100,
    "currency": "EUR",
    "connector": "payone",
    "payout_type": "card",
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "NY",
            "first_name": "John",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "customer_id": "payout_customer",
    "auto_fulfill": true,
    "email": "[email protected]",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+65",
    "client_secret": null,
    "return_url": null,
    "business_country": "US",
    "business_label": "default",
    "description": "Its my first payout request",
    "entity_type": "Individual",
    "recurring": false,
    "metadata": {
        "ref": "123"
    },
    "status": "success",
    "error_message": null,
    "error_code": null,
    "profile_id": "pro_cp4l2sD7NggkM66Cvrfz",
    "created": "2024-05-10T11:25:54.497Z"
}

Additional Changes

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

Motivation and Context

4902

Checklist

  • [x] I formatted the code cargo +nightly fmt --all
  • [x] I addressed lints thrown by cargo clippy
  • [x] I reviewed the submitted code
  • [ ] I added unit tests for my changes where possible

KiranKBR avatar May 06 '24 06:05 KiranKBR

Required CI checks are failing, could you address that

Sakilmostak avatar May 06 '24 18:05 Sakilmostak