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): [BOA/CYBERSOURCE] Update error handling #3157

Merged
merged 3 commits into from
Dec 18, 2023

Conversation

deepanshu-iiitu
Copy link
Contributor

@deepanshu-iiitu deepanshu-iiitu commented Dec 18, 2023

Type of Change

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

Description

HOTFIX PR:
The field reason in struct BankOfAmericaErrorResponse/ ErrorResponse(in cybersource) will be handled as a string instead of handling it as an enum. The reason for this is the absence of proper documentation for error reason at the connector's end.

Authentication error will also be handled properly now.

Additional Changes

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

Motivation and Context

Original PR: #3156

How did you test it?

  1. Try to create a payment by passing billing.last_name as an empty string. You should be then able to successfully generate an error.
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: API_KEY_HERE' \
--data-raw '{
  "amount": 100,
  "currency": "USD",
  "confirm": true,
  "capture_method": "automatic",
  "email": "[email protected]",
  "name": "John Doe",
  "authentication_type": "no_three_ds",
  "return_url": "https://google.com",
  "payment_method": "card",
  "payment_method_type": "credit",
  "payment_method_data": {
    "card": {
      "card_number": "4111111111111111",
      "card_exp_month": "12",
      "card_exp_year": "30",
      "card_holder_name": "joseph Doe",
      "card_cvc": "123"
    }
  },
  "billing": {
    "address": {
      "line1": "1467",
      "city": "San Fransico",
      "state": "Dubai",
      "zip": "94122",
      "country": "AE",
      "first_name": "joseph",
      "last_name": ""
    }
  }
}'

Response:

image

  1. To generate an authentication error response just put wrong api keys and try to do a payment. You should get the following error in that case:
    image

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 December 18, 2023 09:16
@deepanshu-iiitu deepanshu-iiitu changed the title fix(connector): [BOA/CYBERSOURCE] Handle error reason as string fix(connector): [BOA/CYBERSOURCE] Update error handling Dec 18, 2023
@deepanshu-iiitu deepanshu-iiitu self-assigned this Dec 18, 2023
@deepanshu-iiitu deepanshu-iiitu added A-connector-integration Area: Connector integration C-bug Category: Bug labels Dec 18, 2023
ArjunKarthik
ArjunKarthik previously approved these changes Dec 18, 2023
@Gnanasundari24 Gnanasundari24 merged commit e1de1ba into hotfix-1.102.0 Dec 18, 2023
11 of 13 checks passed
@Gnanasundari24 Gnanasundari24 deleted the boa-cyb-fix branch December 18, 2023 10:44
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
No open projects
Status: Merged
Development

Successfully merging this pull request may close these issues.

4 participants