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(address): use first_name if last_name is not passed #4360

Merged
merged 4 commits into from
Apr 16, 2024

Conversation

Narayanbhat166
Copy link
Member

Type of Change

  • Bugfix

Description

This PR fixes the issue which arises when creating a payement with cybersource and bank of america connectors where billing first name and last name are mandatory.

Motivation and Context

How did you test it?

  • Create a payment by passing billing address in payment create request, with confirm set to false.
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'api-key: dev_uHrHd27n2djqmWLoWqhpHPf1NmU2dsIbEguhDIB9ji7bQmzf9rLqw9TqrsRybqwm' \
--data-raw '{
    "amount": 6540,
    "currency": "USD",
    "confirm": false,
    "customer": {
        "id": "cus_abc",
        "email": "[email protected]"
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "Narayan",
            "last_name": "Bhat"
        }
    }
}'
  • Confirm the payment with card_holder_name, by not passing last name
curl --location 'http://localhost:8080/payments/pay_QHybdDJQVMZVgS4BX4IQ/confirm' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_uHrHd27n2djqmWLoWqhpHPf1NmU2dsIbEguhDIB9ji7bQmzf9rLqw9TqrsRybqwm' \
--data '{
    "payment_method_data": {
        "card": {
            "card_number": "4242424242424242",
            "card_exp_month": "10",
            "card_exp_year": "25",
            "card_holder_name": "Narayan",
            "card_cvc": "123"
        }
    },
    "payment_method": "card"
}'

Checklist

  • I formatted the code cargo +nightly fmt --all
  • I addressed lints thrown by cargo clippy
  • I reviewed the submitted code

@Narayanbhat166 Narayanbhat166 added C-bug Category: Bug S-waiting-on-review Status: This PR has been implemented and needs to be reviewed labels Apr 15, 2024
@Narayanbhat166 Narayanbhat166 self-assigned this Apr 15, 2024
@Narayanbhat166 Narayanbhat166 requested a review from a team as a code owner April 15, 2024 14:00
@Narayanbhat166 Narayanbhat166 requested a review from a team as a code owner April 15, 2024 15:01
@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue Apr 16, 2024
Merged via the queue into main with commit 1b7cde2 Apr 16, 2024
10 of 12 checks passed
@Gnanasundari24 Gnanasundari24 deleted the use_first_name_if_last_name_is_not_passed branch April 16, 2024 06:42
@SanchithHegde SanchithHegde removed the S-waiting-on-review Status: This PR has been implemented and needs to be reviewed label Apr 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants