Skip to content

feat(connector): [Gigadat] payouts for gigadat#9889

Merged
likhinbopanna merged 4 commits intomainfrom
gigadat-payout
Oct 17, 2025
Merged

feat(connector): [Gigadat] payouts for gigadat#9889
likhinbopanna merged 4 commits intomainfrom
gigadat-payout

Conversation

@swangi-kumari
Copy link
Contributor

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

Type of Change

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

Description

Implement Payouts for Gigadat Connector

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 Payout connector (Gigadat)

curl --location 'http://localhost:8080/account/merchant_1760348719/connectors' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_PuoUfSo6aoFykpXXJlF6UVprh9XHwXCnMi0MLjPTu5zYOcQn9kgpJ3vA1Rwi9RxM' \
--data '{
    "connector_type": "payout_processor",
    "connector_name": "gigadat",
    "connector_account_details": {
        "auth_type": "SignatureKey",
        "api_key": "_",
        "key1": "_",
        "api_secret" : "_"
    },
    "test_mode": true,
    "disabled": false,
    "metadata": {
        "site" : "https://google.com/"
    }
}
'
  1. create gigadat payout
curl --location 'http://localhost:8080/payouts/create' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_PuoUfSo6aoFykpXXJlF6UVprh9XHwXCnMi0MLjPTu5zYOcQn9kgpJ3vA1Rwi9RxM' \
--data-raw '{
    "amount": 1,
    "currency": "CAD",
    "customer_id": "cus_fDIasC4XVG8qjHVJIt4F",
    "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": [
        "gigadat"
    ],
    "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"
    },
    "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_dCVx6qrgapE1oSiO2wtw",
    "merchant_id": "merchant_1760348719",
    "merchant_order_reference_id": null,
    "amount": 1,
    "currency": "CAD",
    "connector": "gigadat",
    "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_fDIasC4XVG8qjHVJIt4F",
    "customer": {
        "id": "cus_fDIasC4XVG8qjHVJIt4F",
        "name": "John Doe",
        "email": "guest@example.com",
        "phone": "6168205366",
        "phone_country_code": "+1"
    },
    "client_secret": "payout_payout_dCVx6qrgapE1oSiO2wtw_secret_cZEKeZCe7d9V0JjIYdZo",
    "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_osRayrCN4GssPMYiVWb7",
    "status": "pending",
    "error_message": null,
    "error_code": null,
    "profile_id": "pro_BbnXGqrjkvcCDASkBts7",
    "created": "2025-10-15T17:03:40.180Z",
    "connector_transaction_id": "payout_dCVx6qrgapE1oSiO2wtw_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 self-assigned this Oct 16, 2025
@swangi-kumari swangi-kumari requested a review from a team as a code owner October 16, 2025 16:38
@swangi-kumari swangi-kumari added the A-connector-integration Area: Connector integration label Oct 16, 2025
@swangi-kumari swangi-kumari requested review from a team as code owners October 16, 2025 16:38
@semanticdiff-com
Copy link

semanticdiff-com bot commented Oct 16, 2025

Review changes with  SemanticDiff

Changed Files
File Status
  crates/router/src/configs/defaults/payout_required_fields.rs  54% smaller
  crates/router/src/types.rs  36% smaller
  crates/hyperswitch_connectors/src/connectors/gigadat/transformers.rs  31% smaller
  crates/hyperswitch_connectors/src/default_implementations.rs  21% smaller
  crates/hyperswitch_connectors/src/connectors/gigadat.rs  10% smaller
  crates/common_enums/src/connector_enums.rs  7% smaller
  crates/hyperswitch_domain_models/src/payouts/payout_attempt.rs  1% smaller
  crates/diesel_models/src/payout_attempt.rs  1% 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/diesel_models/src/schema.rs  0% smaller
  crates/diesel_models/src/schema_v2.rs  0% smaller
  crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs  0% smaller
  crates/hyperswitch_connectors/src/connectors/adyenplatform/transformers/payouts.rs  0% smaller
  crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs  0% smaller
  crates/hyperswitch_connectors/src/connectors/ebanx/transformers.rs  0% smaller
  crates/hyperswitch_connectors/src/connectors/loonio/transformers.rs  0% smaller
  crates/hyperswitch_connectors/src/connectors/nomupay/transformers.rs  0% smaller
  crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs  0% smaller
  crates/hyperswitch_connectors/src/connectors/payone/transformers.rs  0% smaller
  crates/hyperswitch_connectors/src/connectors/paypal/transformers.rs  0% smaller
  crates/hyperswitch_connectors/src/connectors/stripe/transformers/connect.rs  0% smaller
  crates/hyperswitch_connectors/src/connectors/wise/transformers.rs  0% smaller
  crates/hyperswitch_connectors/src/connectors/worldpay/payout_transformers.rs  0% smaller
  crates/hyperswitch_connectors/src/utils.rs  0% smaller
  crates/hyperswitch_domain_models/src/router_request_types.rs  0% smaller
  crates/hyperswitch_domain_models/src/router_response_types.rs  0% smaller
  crates/router/src/core/payouts.rs  0% smaller
  crates/router/src/core/payouts/retry.rs  0% smaller
  crates/router/src/core/utils.rs  0% smaller
  crates/router/src/core/webhooks/incoming.rs  0% smaller
  crates/router/tests/connectors/utils.rs  0% smaller
  crates/storage_impl/src/payouts/payout_attempt.rs  0% smaller
  migrations/2025-10-10-101024-0000_add_payout_connector_metadata_in_payout_attempt_table/down.sql Unsupported file format
  migrations/2025-10-10-101024-0000_add_payout_connector_metadata_in_payout_attempt_table/up.sql Unsupported file format

@hyperswitch-bot hyperswitch-bot bot added the M-database-changes Metadata: This PR involves database schema changes label Oct 16, 2025
@swangi-kumari swangi-kumari linked an issue Oct 16, 2025 that may be closed by this pull request
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.

  1. Make unstructured types a Secret in router data and diesel / domain models
  2. Check if wasm changes are needed?

Connector::Adyenplatform => Ok(Self::Adyenplatform),
Connector::Cybersource => Ok(Self::Cybersource),
Connector::Ebanx => Ok(Self::Ebanx),
Connector::Gigadat => Ok(Self::Gigadat),
Copy link
Contributor

Choose a reason for hiding this comment

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

Did we add Gigadat to PayoutConnectors enum?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes

is_eligible: payout_attempt.is_eligible,
unified_code: None,
unified_message: None,
payout_connector_metadata: payout_attempt.payout_connector_metadata.clone(),
Copy link
Contributor

Choose a reason for hiding this comment

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

Can cloning be avoided here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it is required here


// 4. Process data returned by the connector
let db = &*state.store;
// let a = router_data.connector_meta_data.clone();
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove this

.to_payout_failed_response()?
}
false => router_data,
false => router_data.clone(),
Copy link
Contributor

Choose a reason for hiding this comment

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

Possible to avoid clone?

let status = payout_response_data
.status
.unwrap_or(payout_attempt.status.to_owned());
// let a =router_data.connector_meta_data.clone();
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove

pub unified_message: Option<UnifiedMessage>,
pub additional_payout_method_data: Option<payout_method_utils::AdditionalPayoutMethodData>,
pub merchant_order_reference_id: Option<String>,
pub payout_connector_metadata: Option<serde_json::Value>,
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's make it SecretSerdeValue instead in diesel models?

connector_transfer_method_id,
webhook_url: Some(webhook_url),
browser_info,
payout_connector_metadata: payout_attempt.payout_connector_metadata.clone(),
Copy link
Contributor

Choose a reason for hiding this comment

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

Possible to avoid clone?

pub should_add_next_step_to_process_tracker: bool,
pub error_code: Option<String>,
pub error_message: Option<String>,
pub payout_connector_metadata: Option<serde_json::Value>,
Copy link
Contributor

Choose a reason for hiding this comment

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

Make this SecretSerdeValue

pub unified_message: Option<UnifiedMessage>,
pub additional_payout_method_data: Option<payout_method_utils::AdditionalPayoutMethodData>,
pub merchant_order_reference_id: Option<String>,
pub payout_connector_metadata: Option<serde_json::Value>,
Copy link
Contributor

Choose a reason for hiding this comment

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

Make it SecretSerdeValue

@swangi-kumari
Copy link
Contributor Author

swangi-kumari commented Oct 17, 2025

  1. Make unstructured types a Secret in router data and diesel / domain models
  2. Check if wasm changes are needed?

Wasm changes is already done in previous PR

fn try_from(
item: PayoutsResponseRouterData<F, GigadatPayoutQuoteResponse>,
) -> Result<Self, Self::Error> {
let connector_meta = serde_json::json!(GigadatPayoutMeta {
Copy link
Contributor

Choose a reason for hiding this comment

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

Add GigadatPayoutMeta validation to validate_auth_and_metadata_type_with_connector and in WASM files

Copy link
Contributor Author

Choose a reason for hiding this comment

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

its already added in previous PR

@likhinbopanna likhinbopanna added this pull request to the merge queue Oct 17, 2025
Merged via the queue into main with commit 21aba20 Oct 17, 2025
27 of 29 checks passed
@likhinbopanna likhinbopanna deleted the gigadat-payout branch October 17, 2025 13:22
drdholu pushed a commit to drdholu/hyperswitch that referenced this pull request Oct 30, 2025
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-database-changes Metadata: This PR involves database schema changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]: [GIGADAT] Implement Payout

5 participants