hyperswitch icon indicating copy to clipboard operation
hyperswitch copied to clipboard

feat(billing): feature add a config to use `billing` as `payment_method_billing`

Open Narayanbhat166 opened this issue 1 year ago • 0 comments

Type of Change

  • [x] New feature

Description

This PR adds support for a config which controls whether to use the billing as payment_method_billing. Based on this config the address is unified and accessed at the connector module. This also affects the payment method list to either populate or not populate the billing fields.

Additional Changes

  • [x] This PR modifies the API contract A new field called use_billing_as_payment_method_billing is added to business profile create and update.

  • [x] This PR modifies the database schema A new field called use_billing_as_payment_method_billing is added to business profile table.

Motivation and Context

How did you test it?

  • Create a payment with default config, by passing billing details in payment.
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'api-key: dev_3Ehos25h2Ro9Y6jh7wz3RTQHm4Hfk7xenFpl56S1BPZG3YsTzK8j1YHD9XhBdI46' \
--data-raw '{
    "amount": 6540,
    "currency": "USD",
    "confirm": true,
    "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"
        }
    }
}'
  • The SDK will not collect any billing data ( for cybersource connector ) image

  • Disable the config for the business profile

curl --location 'http://localhost:8080/account/merchant_1714987557/business_profile/pro_nEF5mTQDHBMNbJejr85j' \
--header 'Content-Type: application/json' \
--header 'api-key: test_admin' \
--data '{
  "use_billing_as_payment_method_billing": false
}'
  • Now the SDK should collect all billing details image

Checklist

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

Narayanbhat166 avatar May 06 '24 09:05 Narayanbhat166