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

feat(router): collect billing details from wallet connector based on the collect_billing_details_from_wallet_connector field #5065

Merged
merged 11 commits into from
Jul 2, 2024

Conversation

ShankarSinghC
Copy link
Contributor

@ShankarSinghC ShankarSinghC commented Jun 20, 2024

Type of Change

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

Description

We were always passing in some parameters in the wallet session token in order to collect the billing details form the wallet connectors (like google pay and apple pay) always. Instead of collecting it always this feature adds a field (collect_billing_details_from_wallet_connector) in the business profile which if set to true we will add some fields in the session token to collect the shipping details from the wallet connectors.
Reference: #4601

Additional Changes

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

Motivation and Context

How did you test it?

-> Create a merchant connector account
-> Use the below curl to set the collect_billing_details_from_wallet_connector

curl --location 'http:https://localhost:8080/account/merchant_1718903636/business_profile/pro_D1HEnlPrKdJ33sefpb8W' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: test_admin' \
--data '{
    "collect_billing_details_from_wallet_connector": false
}'
image

-> Create a payment with confirm false

{
    "amount": 6500,
    "currency": "USD",
    "confirm": false,
    "amount_to_capture": 6500,
    "customer_id": "test_priority_routing",
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "authentication_type": "three_ds",
    "return_url": "https://google.com",
    "email": "[email protected]",
    "name": "Joseph Doe",
    "phone": "999999999",
    "phone_country_code": "+65",
    "description": "Its my first payment request",
    "statement_descriptor_name": "Juspay",
    "statement_descriptor_suffix": "Router",
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
       
    }
}
image

-> Make a session call for the above payment id and client secret

curl --location 'http:https://localhost:8080/payments/session_tokens' \
--header 'Content-Type: application/json' \
--header 'api-key: pk_dev_f0a9fbe61ae744049578ca94244364b6' \
--data '{
    "payment_id": "pay_eX276M1t9ndwv0elPVHj",
    "wallets": [],
    "client_secret": "pay_eX276M1t9ndwv0elPVHj_secret_wjXQi2f5fRJkrhJWIbcs"
}'
image image

In the above screenshots we can see that there is no billing details parameter for apple pay and for google pay its set to false as it is collect_billing_details_from_wallet_connector is set to false.

-> Set the collect_billing_details_from_wallet_connector to true
image

-> Create a payment with confirm false and make a session call
image
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

@ShankarSinghC ShankarSinghC added A-core Area: Core flows A-payment-methods Area: Payment Methods A-payments Area: payments labels Jun 20, 2024
@ShankarSinghC ShankarSinghC self-assigned this Jun 20, 2024
@ShankarSinghC ShankarSinghC requested review from a team as code owners June 20, 2024 17:11
@hyperswitch-bot hyperswitch-bot bot added the M-database-changes Metadata: This PR involves database schema changes label Jun 20, 2024
@hyperswitch-bot hyperswitch-bot bot added the M-api-contract-changes Metadata: This PR involves API contract changes label Jun 20, 2024
crates/api_models/src/admin.rs Outdated Show resolved Hide resolved
crates/router/src/core/payments/flows/session_flow.rs Outdated Show resolved Hide resolved
crates/router/src/core/routing/helpers.rs Show resolved Hide resolved
crates/router/src/types/api/admin.rs Outdated Show resolved Hide resolved
@ShankarSinghC ShankarSinghC requested a review from a team as a code owner June 25, 2024 09:34
@ShankarSinghC ShankarSinghC removed the request for review from a team July 1, 2024 15:28
Narayanbhat166
Narayanbhat166 previously approved these changes Jul 1, 2024
@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue Jul 2, 2024
Merged via the queue into main with commit ee9190b Jul 2, 2024
11 checks passed
@Gnanasundari24 Gnanasundari24 deleted the apple_pay/add-billing-config branch July 2, 2024 08:10
pixincreate added a commit that referenced this pull request Jul 3, 2024
…ror-handling-in-cypress

* 'main' of github.com:juspay/hyperswitch:
  fix: realtime user analytics (#5129)
  refactor: use hashmap deserializer for generic_link options (#5157)
  refactor(router): changed payment method token TTL to api contract based config from const value (#5115)
  feat(router): collect billing details from wallet connector based on the `collect_billing_details_from_wallet_connector` field (#5065)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-core Area: Core flows A-payment-methods Area: Payment Methods A-payments Area: payments M-api-contract-changes Metadata: This PR involves API contract changes M-database-changes Metadata: This PR involves database schema changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Collect billing details from wallet connector based on the collect_billing_details_from_wallet_connector field
4 participants