Skip to content

feat(connector): [Loonio] implement payouts#9718

Merged
likhinbopanna merged 9 commits intomainfrom
loonio-payout
Oct 8, 2025
Merged

feat(connector): [Loonio] implement payouts#9718
likhinbopanna merged 9 commits intomainfrom
loonio-payout

Conversation

@swangi-kumari
Copy link
Contributor

@swangi-kumari swangi-kumari commented Oct 7, 2025

Type of Change

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

Description

implement payouts for Loonio

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 Loonio Payout

curl --location 'http://localhost:8080/account/merchant_1759832187/connectors' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_sCP4vFLQ6aoU7Hi1kFSxUfGZXKkYrRBBlaykRucf8qtPDgCz34JI7EJ7x7ZOt0Up' \
--data '{
    "connector_type": "payout_processor",
    "connector_name": "loonio",
    "connector_account_details": {
        "auth_type": "BodyKey",
        "api_key": "_",
        "key1": "_"
    },
    "test_mode": false,
    "disabled": false
}'

Create a interac Payout

curl --location 'http://localhost:8080/payouts/create' \
--header 'x-feature: integ-custom' \
--header 'Content-Type: application/json' \
--header 'api-key: dev_sCP4vFLQ6aoU7Hi1kFSxUfGZXKkYrRBBlaykRucf8qtPDgCz34JI7EJ7x7ZOt0Up' \
--data-raw '{
    "amount": 1,
    "currency": "CAD",
    "customer_id": "cus_T1nIsYGhYLX9gpGLk5A1",
    "email": "payout_customer@example.com",
    "name": "Doest John",
    "phone": "6168205366",
    "phone_country_code": "+1",
    "description": "Its my first payout request",
    "payout_type": "bank_redirect",
    "payout_method_data": {
        "bank_redirect": {
            "interac": {
                "email": "example@example.com"
            }
        }
    },
    "connector": [
        "loonio"
    ],
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "CA",
            "zip": "94122",
            "country": "US",
            "first_name": "Doest",
            "last_name": "John"
        },
        "phone": {
            "number": "6168205366",
            "country_code": "1"
        }
    },
    "entity_type": "Individual",
    "recurring": false,
    "confirm": true,
    "auto_fulfill": true
}'

Response

{
    "payout_id": "payout_Wo7WSccu3gsj3nHjAceu",
    "merchant_id": "merchant_1759832187",
    "merchant_order_reference_id": null,
    "amount": 1,
    "currency": "CAD",
    "connector": "loonio",
    "payout_type": "bank_redirect",
    "payout_method_data": {
        "bank_redirect": {
            "email": "ex*****@example.com"
        }
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "CA",
            "first_name": "Doest",
            "last_name": "John",
            "origin_zip": null
        },
        "phone": {
            "number": "6168205366",
            "country_code": "1"
        },
        "email": null
    },
    "auto_fulfill": true,
    "customer_id": "cus_T1nIsYGhYLX9gpGLk5A1",
    "customer": {
        "id": "cus_T1nIsYGhYLX9gpGLk5A1",
        "name": "John Doe",
        "email": "guest@example.com",
        "phone": "6168205366",
        "phone_country_code": "+1"
    },
    "client_secret": "payout_payout_Wo7WSccu3gsj3nHjAceu_secret_R0cRg0Ghrp3E1p111dyu",
    "return_url": null,
    "business_country": null,
    "business_label": null,
    "description": "Its my first payout request",
    "entity_type": "Individual",
    "recurring": false,
    "metadata": {},
    "merchant_connector_id": "mca_CAgv5aZcOkJDxFyidjhp",
    "status": "initiated",
    "error_message": null,
    "error_code": null,
    "profile_id": "pro_1NTfzZKyGXpM6RZZna3r",
    "created": "2025-10-07T11:16:00.091Z",
    "connector_transaction_id": "payout_Wo7WSccu3gsj3nHjAceu_1",
    "priority": null,
    "payout_link": null,
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "6168205366",
    "phone_country_code": "+1",
    "unified_code": null,
    "unified_message": null,
    "payout_method_id": null
}

Do sync

curl --location 'http://localhost:8080/payouts/payout_Wo7WSccu3gsj3nHjAceu?force_sync=true' \
--header 'api-key: dev_sCP4vFLQ6aoU7Hi1kFSxUfGZXKkYrRBBlaykRucf8qtPDgCz34JI7EJ7x7ZOt0Up'

Response

{
    "payout_id": "payout_Wo7WSccu3gsj3nHjAceu",
    "merchant_id": "merchant_1759832187",
    "merchant_order_reference_id": null,
    "amount": 1,
    "currency": "CAD",
    "connector": "loonio",
    "payout_type": "bank_redirect",
    "payout_method_data": {
        "bank_redirect": {
            "email": "ex*****@example.com"
        }
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "CA",
            "first_name": "Doest",
            "last_name": "John",
            "origin_zip": null
        },
        "phone": {
            "number": "6168205366",
            "country_code": "1"
        },
        "email": null
    },
    "auto_fulfill": true,
    "customer_id": "cus_T1nIsYGhYLX9gpGLk5A1",
    "customer": {
        "id": "cus_T1nIsYGhYLX9gpGLk5A1",
        "name": "John Doe",
        "email": "guest@example.com",
        "phone": "6168205366",
        "phone_country_code": "+1"
    },
    "client_secret": "payout_payout_Wo7WSccu3gsj3nHjAceu_secret_R0cRg0Ghrp3E1p111dyu",
    "return_url": null,
    "business_country": null,
    "business_label": null,
    "description": "Its my first payout request",
    "entity_type": "Individual",
    "recurring": false,
    "metadata": {},
    "merchant_connector_id": "mca_CAgv5aZcOkJDxFyidjhp",
    "status": "pending",
    "error_message": null,
    "error_code": null,
    "profile_id": "pro_1NTfzZKyGXpM6RZZna3r",
    "created": "2025-10-07T11:16:00.091Z",
    "connector_transaction_id": "payout_Wo7WSccu3gsj3nHjAceu_1",
    "priority": null,
    "payout_link": null,
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "6168205366",
    "phone_country_code": "+1",
    "unified_code": null,
    "unified_message": null,
    "payout_method_id": null
}

We will get pending status, as per doc in sbx we can not fullfill the payouts.

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

@swangi-kumari swangi-kumari requested review from a team as code owners October 7, 2025 13:26
@semanticdiff-com
Copy link

semanticdiff-com bot commented Oct 7, 2025

Review changes with  SemanticDiff

Changed Files
File Status
  crates/router/src/types/api/payouts.rs  98% smaller
  crates/hyperswitch_connectors/src/connectors/payone/transformers.rs  96% smaller
  crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs  89% smaller
  crates/hyperswitch_connectors/src/connectors/ebanx/transformers.rs  88% smaller
  crates/hyperswitch_connectors/src/connectors/wise/transformers.rs  84% smaller
  crates/hyperswitch_connectors/src/connectors/adyenplatform/transformers/payouts.rs  83% smaller
  crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs  75% smaller
  crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs  42% smaller
  crates/router/src/core/payouts/helpers.rs  30% smaller
  crates/hyperswitch_connectors/src/connectors/adyen.rs  29% smaller
  crates/hyperswitch_connectors/src/default_implementations.rs  23% smaller
  crates/openapi/src/openapi.rs  12% smaller
  crates/openapi/src/openapi_v2.rs  12% smaller
  api-reference/v1/openapi_spec_v1.json  3% smaller
  api-reference/v2/openapi_spec_v2.json  3% 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
  crates/api_models/src/enums.rs  0% smaller
  crates/api_models/src/payouts.rs  0% smaller
  crates/common_enums/src/connector_enums.rs  0% smaller
  crates/common_enums/src/enums.rs  0% smaller
  crates/common_utils/src/payout_method_utils.rs  0% smaller
  crates/connector_configs/src/connector.rs  0% smaller
  crates/connector_configs/toml/development.toml Unsupported file format
  crates/connector_configs/toml/production.toml Unsupported file format
  crates/connector_configs/toml/sandbox.toml Unsupported file format
  crates/euclid/src/enums.rs  0% smaller
  crates/hyperswitch_connectors/src/connectors/loonio.rs  0% smaller
  crates/hyperswitch_connectors/src/connectors/loonio/transformers.rs  0% smaller
  crates/hyperswitch_connectors/src/connectors/stripe/transformers/connect.rs  0% smaller
  crates/router/src/configs/defaults/payout_required_fields.rs  0% smaller
  crates/router/src/core/payment_methods/cards.rs  0% smaller
  crates/router/src/core/payment_methods/vault.rs  0% smaller
  crates/router/src/types/transformers.rs  0% smaller
  crates/router/tests/connectors/adyen.rs  0% smaller
  migrations/2025-10-07-100547-0000_add_bank_redirect_in/down.sql Unsupported file format
  migrations/2025-10-07-100547-0000_add_bank_redirect_in/up.sql Unsupported file format

@hyperswitch-bot hyperswitch-bot bot added M-database-changes Metadata: This PR involves database schema changes M-api-contract-changes Metadata: This PR involves API contract changes labels Oct 7, 2025
@swangi-kumari swangi-kumari self-assigned this Oct 7, 2025
@swangi-kumari swangi-kumari linked an issue Oct 7, 2025 that may be closed by this pull request
@swangi-kumari swangi-kumari changed the title feat: loonio payouts feat(connector): [Loonio] implement payouts Oct 8, 2025
@swangi-kumari swangi-kumari added the A-connector-integration Area: Connector integration label Oct 8, 2025
deepanshu-iiitu
deepanshu-iiitu previously approved these changes Oct 8, 2025
PaymentMethodType::Interac => Self::Interac(api_models::payouts::Interac {
email: value1.email,
}),
_ => Err(errors::VaultError::PayoutMethodNotSupported)
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: you can use if let here

api_models::payouts::PayoutMethodData::Bank(_) => Self::BankTransfer,
api_models::payouts::PayoutMethodData::Card(_) => Self::Card,
api_models::payouts::PayoutMethodData::Wallet(_) => Self::Wallet,
api_models::payouts::PayoutMethodData::BankRedirect(_) => Self::BankTransfer,
Copy link
Contributor

Choose a reason for hiding this comment

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

should it be matched to bankredirect?

api_models::enums::PayoutType::Bank => Self::BankTransfer,
api_models::enums::PayoutType::Card => Self::Card,
api_models::enums::PayoutType::Wallet => Self::Wallet,
api_models::enums::PayoutType::BankRedirect => Self::BankTransfer,
Copy link
Contributor

Choose a reason for hiding this comment

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

same here

api_models::payouts::PayoutMethodData::Bank(_) => Self::Bank,
api_models::payouts::PayoutMethodData::Card(_) => Self::Card,
api_models::payouts::PayoutMethodData::Wallet(_) => Self::Wallet,
api_models::payouts::PayoutMethodData::BankRedirect(_) => Self::Bank,
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't bank redirect be a separate variant

@deepanshu-iiitu deepanshu-iiitu self-requested a review October 8, 2025 11:08
Copy link
Contributor

@Sarthak1799 Sarthak1799 left a comment

Choose a reason for hiding this comment

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

Routing changes LGTM

@likhinbopanna likhinbopanna added this pull request to the merge queue Oct 8, 2025
Merged via the queue into main with commit abcc70b Oct 8, 2025
26 of 29 checks passed
@likhinbopanna likhinbopanna deleted the loonio-payout branch October 8, 2025 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-connector-integration Area: Connector integration M-api-contract-changes Metadata: This PR involves API contract changes M-database-changes Metadata: This PR involves database schema changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]: [LOONIO] Add payouts

6 participants