Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(connector): [CASHTOCODE] Fix Error Response Handling #2926

Merged
merged 6 commits into from
Nov 21, 2023

Conversation

deepanshu-iiitu
Copy link
Contributor

@deepanshu-iiitu deepanshu-iiitu commented Nov 20, 2023

Type of Change

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

Description

This PR will fix the error response handling in connector cashtocode.
The error response can now handle 2 datatypes(string,int) for the value error in the Cashtocode Error Response.

Additional Changes

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

Motivation and Context

https://github.com/juspay/hyperswitch-cloud/issues/3265

How did you test it?

Testing can be done by creating a payment for connector Cashtocode

curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key:API_KEY' \
--data-raw '{
    "amount": 1000,
    "currency": "EUR",
    "confirm": true,
    "customer_id": "e064f3fe-a027-458a-a373-09eb38122b67",
    "capture_method": "manual",
    "capture_on": "2022-09-10T10:11:12Z",
    "amount_to_capture": 1000,
    "email": "[email protected]",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+65",
    "description": "Its my first payment request",
    "authentication_type": "no_three_ds",
    "return_url": "https://google.com",
    "payment_method": "reward",
    "payment_method_type": "classic",
    "payment_method_data": "reward",
    "billing": {
        "address": {
            "city": "北九州市",
            "country": "JP",
            "line1": "福岡県",
            "line2": null,
            "line3": null,
            "zip": "8000201",
            "state": null,
            "first_name": "SHIHO",
            "last_name": "YAMAGUCHI"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    },
    "shipping": {
        "address": {
            "city": "北九州市",
            "country": "JP",
            "line1": "福岡県",
            "line2": null,
            "line3": null,
            "zip": "8000201",
            "state": null,
            "first_name": "SHIHO",
            "last_name": "YAMAGUCHI"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    }
}'

Use the above curl to create error response
Screenshot 2023-11-21 at 6 36 59 PM

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
  • I added a CHANGELOG entry if applicable

@deepanshu-iiitu deepanshu-iiitu requested a review from a team as a code owner November 20, 2023 13:26
@deepanshu-iiitu deepanshu-iiitu self-assigned this Nov 20, 2023
@deepanshu-iiitu deepanshu-iiitu added A-connector-integration Area: Connector integration C-bug Category: Bug S-waiting-on-review Status: This PR has been implemented and needs to be reviewed labels Nov 20, 2023
@deepanshu-iiitu deepanshu-iiitu requested review from prasunna09 and removed request for SamraatBansal and nitesh-balla November 20, 2023 13:57
@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue Nov 21, 2023
Merged via the queue into main with commit 938b63a Nov 21, 2023
18 of 20 checks passed
@Gnanasundari24 Gnanasundari24 deleted the cashtocode-fix branch November 21, 2023 13:29
@SanchithHegde SanchithHegde removed the S-waiting-on-review Status: This PR has been implemented and needs to be reviewed label Nov 27, 2023
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-bug Category: Bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants