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

refactor(address): pass payment method billing to the connector module #3828

Merged

Conversation

Narayanbhat166
Copy link
Member

@Narayanbhat166 Narayanbhat166 commented Feb 26, 2024

Type of Change

  • Refactoring

Description

This PR consolidates the billing details and pass payment_method_data.billing to the connector module.

Motivation and Context

The below scenarios are covered.

  • if order_billing passed and payment_method_billing not passed -> copy over order_billing to payment_method_billing
  • If order_billing passed and payment_method_billing passed -> use payment_method_billing.
  • If order_billing not passed and payment_method_billing passed -> use payment_method_billing.
  • If order_billing not passed and payment_method_billing not passed -> pass None.

How did you test it?

  • Create a payment with payment billing address.
curl --location 'https://integ-api.hyperswitch.io/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: <api-key>' \
--data-raw '{
    "amount": 6540,
    "currency": "USD",
    "confirm": true,
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "amount_to_capture": 6540,
    "customer_id": "bernard123",
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+65",
    "description": "Its my first payment request",
    "authentication_type": "no_three_ds",
    "return_url": "https://duck.com",
    "payment_method": "card",
    "payment_method_type": "debit",
    "payment_method_data": {
        "card": {
            "card_number": "4242424242424242",
            "card_exp_month": "12",
            "card_exp_year": "26",
            "card_holder_name": "joseph Doe",
            "card_cvc": "123"
        }
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "sundari",
            "last_name": "sundari"
        }
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "sundari",
            "last_name": "sundari"
        }
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    }
}'
image
  • Create a payment with payment_method_billing.
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_eK9wGYuPHBFhgITq94377mEz19euYyHf8aTCLT5Vgjo31gawycngkf0OqwTTGIjU' \
--data-raw '{
    "amount": 6540,
    "currency": "USD",
    "confirm": true,
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "amount_to_capture": 6540,
    "customer_id": "bernard123",
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+65",
    "description": "Its my first payment request",
    "authentication_type": "no_three_ds",
    "return_url": "https://duck.com",
    "payment_method": "card",
    "payment_method_type": "debit",
    "payment_method_data": {
        "card": {
            "card_number": "4242424242424242",
            "card_exp_month": "12",
            "card_exp_year": "26",
            "card_holder_name": "joseph Doe",
            "card_cvc": "123"
        },
        "billing": {
            "address": {
                "line1": "1467",
                "line2": "Harrison Street",
                "line3": "Harrison Street",
                "city": "San Fransico",
                "state": "California",
                "zip": "94122",
                "country": "US",
                "first_name": "sundari",
                "last_name": "sundari"
            }
        }
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "sundari",
            "last_name": "sundari"
        }
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    }
}'
image

Checklist

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

@Narayanbhat166 Narayanbhat166 added A-connector-compatibility Area: Connector compatibility A-core Area: Core flows S-waiting-on-review Status: This PR has been implemented and needs to be reviewed labels Feb 26, 2024
@Narayanbhat166 Narayanbhat166 added this to the February 2024 Release milestone Feb 26, 2024
@Narayanbhat166 Narayanbhat166 self-assigned this Feb 26, 2024
@Narayanbhat166 Narayanbhat166 requested review from a team as code owners February 26, 2024 14:11
@Narayanbhat166 Narayanbhat166 changed the title refactor(addrress): pass payment method billing to the connector module refactor(address): pass payment method billing to the connector module Feb 26, 2024
Base automatically changed from 4239-refactor-add-payment-method-billing-details to main March 1, 2024 12:21
@Narayanbhat166 Narayanbhat166 requested review from a team as code owners March 1, 2024 12:21
@Narayanbhat166 Narayanbhat166 requested a review from a team as a code owner March 9, 2024 14:35
hrithikesh026
hrithikesh026 previously approved these changes Mar 10, 2024
Copy link
Contributor

@hrithikesh026 hrithikesh026 left a comment

Choose a reason for hiding this comment

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

LGTM

ArjunKarthik
ArjunKarthik previously approved these changes Mar 11, 2024
hrithikesh026
hrithikesh026 previously approved these changes Mar 11, 2024
ArjunKarthik
ArjunKarthik previously approved these changes Mar 11, 2024
Copy link
Member

@vspecky vspecky left a comment

Choose a reason for hiding this comment

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

Approving on behalf of @juspay/hyperswitch-routing

Copy link
Contributor

@ThisIsMani ThisIsMani left a comment

Choose a reason for hiding this comment

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

Dashboard changes looks fine.

@likhinbopanna likhinbopanna added this pull request to the merge queue Mar 12, 2024
Merged via the queue into main with commit 195c700 Mar 12, 2024
13 of 15 checks passed
@likhinbopanna likhinbopanna deleted the 4320-refactor-pass-payment_method_billing-to-connector-module branch March 12, 2024 10:38
@pixincreate pixincreate removed the S-waiting-on-review Status: This PR has been implemented and needs to be reviewed label Mar 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-connector-compatibility Area: Connector compatibility A-core Area: Core flows
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants