Skip to content

feat(connector): [Loonio] Implement interac Bank Redirect Payment Method#9620

Merged
Gnanasundari24 merged 5 commits intomainfrom
loonio-interac
Sep 30, 2025
Merged

feat(connector): [Loonio] Implement interac Bank Redirect Payment Method#9620
Gnanasundari24 merged 5 commits intomainfrom
loonio-interac

Conversation

@swangi-kumari
Copy link
Contributor

@swangi-kumari swangi-kumari commented Sep 30, 2025

Type of Change

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

Description

Implement interac Bank Redirect Payment Method

  • Payments
  • Psync

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?

  1. Create MCA for Loonio
curl --location 'http://localhost:8080/account/merchant_1759170450/connectors' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: _' \
--data '{
    "connector_type": "payment_processor",
    "business_country": "US",
    "business_label": "food",
    "connector_name": "loonio",
    "connector_account_details": {
        "auth_type": "BodyKey",
        "api_key": "",
        "key1": "_"
    },
    "test_mode": false,
    "disabled": false,
    "payment_methods_enabled": [
        {
            "payment_method": "bank_redirect",
            "payment_method_types": [
                {
                    "payment_method_type": "interac",
                    "payment_experience": "invoke_sdk_client",
                    "minimum_amount": 1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                }
            ]
        }
    ]
}'
  1. Create a Interac Payment
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: _' \
--data-raw '{
    "amount": 1500,
    "currency": "CAD",
    "confirm": true,
    "capture_method": "automatic",
    "customer_id": "aaaa",
    "profile_id": "pro_C15ZRcjRQncWBGB2yuqm",
    "authentication_type": "three_ds",
    "payment_method": "bank_redirect",
    "payment_method_type": "interac",
    "payment_method_data": {
        "bank_redirect": {
            "interac": {}
        }
    },
    "billing": {
        "address": {
            "line1": "Singapore Changi Airport. 2nd flr",
            "line2": "",
            "line3": "",
            "city": "Downtown Core",
            "state": "Central Indiana America",
            "zip": "039393",
            "country": "SG",
            "first_name": "Swangi",
            "last_name": "Kumari"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "swangi.kumari@juspay.in"
    },
    "browser_info": {
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "language": "nl-NL",
        "color_depth": 24,
        "screen_height": 723,
        "screen_width": 1536,
        "time_zone": 0,
        "java_enabled": true,
        "java_script_enabled": true,
        "ip_address": "127.0.0.1"
    }
}'

Response

{
    "payment_id": "pay_pDnVks1Ok2xqEiTKSc3L",
    "merchant_id": "merchant_1759170450",
    "status": "failed",
    "amount": 1500,
    "net_amount": 1500,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": null,
    "connector": "loonio",
    "client_secret": "pay_pDnVks1Ok2xqEiTKSc3L_secret_BOt98GDVh1YUREeBj49y",
    "created": "2025-09-30T09:06:47.208Z",
    "currency": "CAD",
    "customer_id": "aaaa",
    "customer": {
        "id": "aaaa",
        "name": null,
        "email": null,
        "phone": null,
        "phone_country_code": null
    },
    "description": null,
    "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_redirect",
    "payment_method_data": {
        "bank_redirect": {
            "type": "BankRedirectResponse",
            "bank_name": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": null,
    "billing": {
        "address": {
            "city": "Downtown Core",
            "country": "SG",
            "line1": "Singapore Changi Airport. 2nd flr",
            "line2": "",
            "line3": "",
            "zip": "039393",
            "state": "Central Indiana America",
            "first_name": "Swangi",
            "last_name": "Kumari",
            "origin_zip": null
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "swangi.kumari@juspay.in"
    },
    "order_details": null,
    "email": null,
    "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": "BSC02005",
    "error_message": "Input field validation error: 'Missed required field 'transaction_id'.'.",
    "unified_code": "UE_9000",
    "unified_message": "Something went wrong",
    "payment_experience": null,
    "payment_method_type": "interac",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "aaaa",
        "created_at": 1759223207,
        "expires": 1759226807,
        "secret": "epk_e7a1dc4e967a490781a35fe9d93dcf9a"
    },
    "manual_retry_allowed": null,
    "connector_transaction_id": null,
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": null,
    "payment_link": null,
    "profile_id": "pro_C15ZRcjRQncWBGB2yuqm",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_1D5PxJd9ci3fD8Nj9hKL",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-09-30T09:21:47.208Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "127.0.0.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-09-30T09:06:48.505Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "request_extended_authorization": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": null,
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null,
    "enable_overcapture": null,
    "is_overcapture_enabled": null,
    "network_details": {
        "network_advice_code": null
    }
}

Complete payment using redirect_url

It takes about 1 minute after the redirection for the status to change to succeeded.
3. Do force sync for status get

curl --location 'http://localhost:8080/payments/pay_pDnVks1Ok2xqEiTKSc3L?force_sync=true' \
--header 'Accept: application/json' \
--header 'api-key: _'

Response

{
    "payment_id": "pay_hJ7WTdtJEsXcY53E7n0W",
    "merchant_id": "merchant_1759170450",
    "status": "succeeded",
    "amount": 1500,
    "net_amount": 1500,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 1500,
    "connector": "loonio",
    "client_secret": "pay_hJ7WTdtJEsXcY53E7n0W_secret_OzW8vHtTkedDIW8yt9Sn",
    "created": "2025-09-30T08:59:59.957Z",
    "currency": "CAD",
    "customer_id": "aaaa",
    "customer": {
        "id": "aaaa",
        "name": null,
        "email": null,
        "phone": null,
        "phone_country_code": null
    },
    "description": null,
    "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_redirect",
    "payment_method_data": {
        "bank_redirect": {
            "type": "BankRedirectResponse",
            "bank_name": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": null,
    "billing": {
        "address": {
            "city": "Downtown Core",
            "country": "SG",
            "line1": "Singapore Changi Airport. 2nd flr",
            "line2": "",
            "line3": "",
            "zip": "039393",
            "state": "Central Indiana America",
            "first_name": "Swangi",
            "last_name": "Kumari",
            "origin_zip": null
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "swangi.kumari@juspay.in"
    },
    "order_details": null,
    "email": null,
    "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": "interac",
    "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": "pay_hJ7WTdtJEsXcY53E7n0W_1",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": null,
    "payment_link": null,
    "profile_id": "pro_C15ZRcjRQncWBGB2yuqm",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_1D5PxJd9ci3fD8Nj9hKL",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-09-30T09:14:59.957Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "127.0.0.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-09-30T09:00:55.783Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "request_extended_authorization": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": null,
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null,
    "enable_overcapture": null,
    "is_overcapture_enabled": null,
    "network_details": null
}

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 self-assigned this Sep 30, 2025
@swangi-kumari swangi-kumari requested review from a team as code owners September 30, 2025 09:22
@semanticdiff-com
Copy link

semanticdiff-com bot commented Sep 30, 2025

Review changes with  SemanticDiff

Changed Files
File Status
  crates/hyperswitch_connectors/src/connectors/loonio.rs  36% smaller
  crates/hyperswitch_connectors/src/connectors/loonio/transformers.rs  26% smaller
  crates/common_enums/src/connector_enums.rs  11% smaller
  api-reference/v1/openapi_spec_v1.json  0% smaller
  api-reference/v2/openapi_spec_v2.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
  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/hyperswitch_connectors/src/constants.rs  0% smaller
  crates/payment_methods/src/configs/payment_connector_required_fields.rs  0% smaller
  crates/router/src/core/connector_validation.rs  0% smaller
  crates/router/src/types/api/connector_mapping.rs  0% smaller
  crates/router/src/types/api/feature_matrix.rs  0% smaller
  crates/router/src/types/connector_transformers.rs  0% smaller
  loadtest/config/development.toml Unsupported file format

@swangi-kumari swangi-kumari added A-connector-integration Area: Connector integration C-feature Category: Feature request or enhancement labels Sep 30, 2025
impl From<LoonioTransactionStatus> for enums::AttemptStatus {
fn from(item: LoonioTransactionStatus) -> Self {
match item {
LoonioTransactionStatus::Created => Self::Authorizing,
Copy link
Contributor

Choose a reason for hiding this comment

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

Mark created as pending as well

@hyperswitch-bot hyperswitch-bot bot added the M-api-contract-changes Metadata: This PR involves API contract changes label Sep 30, 2025
@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue Sep 30, 2025
Merged via the queue into main with commit c1f8b96 Sep 30, 2025
21 of 25 checks passed
@Gnanasundari24 Gnanasundari24 deleted the loonio-interac branch September 30, 2025 15:41
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 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.

[FEATURE] : [Loonio] Implement interac Bank Redirect Payment Method

5 participants