hyperswitch icon indicating copy to clipboard operation
hyperswitch copied to clipboard

fix(connector): [WISE] Changed error status to string

Open Debarshi-Gupta opened this issue 9 months ago • 2 comments

Type of Change

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

Description

The error status was previously being accepted as i32, which was causing Hyperswitch to throw an error because the connector returns the status as a String. The status has been changed to type String in this PR.

Additional Changes

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

Motivation and Context

Issue Link: https://github.com/juspay/hyperswitch/issues/7469

How did you test it?

Postman Tests

1. Payouts Create

-Request

curl --location 'http://localhost:8080/payouts/create' \
--header 'Content-Type: application/json' \
--header 'api-key: dev_gBOBAd2KdnQ2Sicn24ETzOLMqRjdMVtjSjy17FYmjQjmj26klfRIWLOnspqQX9YW' \
--data-raw '{
    "amount": 10,
    "currency": "GBP",
    "customer_id": "cus_wtc11I3P4ObeIZk0FpBR",
    "email": "[email protected]",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+65",
    "description": "Its my first payout request",
    "payout_type": "bank",
    "connector": [
        "wise"
    ],
    "payout_method_data": {
        "bank": {
            "bank_sort_code": "231470",
            "bank_account_number": "28821822",
            "bank_name": "Deutsche Bank",
            "bank_country_code": "NL",
            "bank_city": "Amsterdam"
        }
    },
    "billing": {
        "address": {
            "line1": "1467",
            
            
            "city": "San Fransico",
            "state": "CA",
            "zip": "94122",
            "country": "US",
            "first_name": "John",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    },
    "entity_type": "Individual",
    "recurring": true,
    "metadata": {
        "ref": "123"
    },
    "confirm": true,
    "auto_fulfill": true,
    "profile_id": "pro_U84OKvi5otdXGYq6tjlx"
}'

-Response

{
    "payout_id": "5f7ac2b0-69cb-4916-9ad5-a901770bbc72",
    "merchant_id": "merchant_1741598972",
    "amount": 10,
    "currency": "GBP",
    "connector": "wise",
    "payout_type": "bank",
    "payout_method_data": {
        "bank": {
            "bank_sort_code": "23**70",
            "bank_account_number": "****1822",
            "bank_name": "Deutsche Bank",
            "bank_country_code": "NL",
            "bank_city": "Amsterdam"
        }
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": null,
            "line3": null,
            "zip": "94122",
            "state": "CA",
            "first_name": "John",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "auto_fulfill": true,
    "customer_id": "cus_wtc11I3P4ObeIZk0FpBR",
    "customer": {
        "id": "cus_wtc11I3P4ObeIZk0FpBR",
        "name": "John Doe",
        "email": "[email protected]",
        "phone": "999999999",
        "phone_country_code": "+65"
    },
    "client_secret": "payout_5f7ac2b0-69cb-4916-9ad5-a901770bbc72_secret_B0h34yZciT2HwmmcHKgu",
    "return_url": null,
    "business_country": null,
    "business_label": null,
    "description": "Its my first payout request",
    "entity_type": "Individual",
    "recurring": true,
    "metadata": {
        "ref": "123"
    },
    "merchant_connector_id": "mca_d6VH9HeZfA07bVki7LMf",
    "status": "failed",
    "error_message": "",
    "error_code": "REJECTED",
    "profile_id": "pro_U84OKvi5otdXGYq6tjlx",
    "created": "2025-03-10T09:48:10.143Z",
    "connector_transaction_id": "54879667",
    "priority": null,
    "payout_link": null,
    "email": "[email protected]",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+65",
    "unified_code": null,
    "unified_message": null,
    "payout_method_id": null
}

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

Debarshi-Gupta avatar Mar 10 '25 09:03 Debarshi-Gupta

Review changes with  SemanticDiff

Changed Files
File Status
  crates/router/src/connector/wise/transformers.rs  0% smaller

semanticdiff-com[bot] avatar Mar 10 '25 09:03 semanticdiff-com[bot]

Disabling auto merge since the Cypress check still seems to have some failures.

SanchithHegde avatar Mar 10 '25 17:03 SanchithHegde