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(billing): store payment_method_data_billing for recurring payments #4513

Conversation

Narayanbhat166
Copy link
Member

@Narayanbhat166 Narayanbhat166 commented May 2, 2024

Type of Change

  • Refactoring

Description

When a card or any payment method is saved, the billing address associated with it is also stored. This has to be presented back when the payment method is listed. This PR adds support for storing and retrieving the payment_method_billing during listing the payment methods associated to a customer.

Motivation and Context

How did you test it?

  • Create a CIT payment with payment_method_data.billing.
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'api-key: dev_oN54ym4AmrV4om0Cs5Roq2JShISv69npT9BgwdsYABeTkhCmI77V5Gdpeqy7hwWE' \
--data-raw '{
    "amount": 6540,
    "currency": "USD",
    "confirm": true,
    "customer": {
        "id": "cus_abc",
        "email": "example@juspay.in"
    },
    "customer_acceptance": {
        "acceptance_type": "offline",
        "accepted_at": "1963-05-03T04:07:52.723Z",
        "online": {
            "ip_address": "127.0.0.1",
            "user_agent": "amet irure esse"
        }
    },
    "payment_method": "card",
    "payment_method_type": "debit",
    "payment_method_data": {
        "card": {
            "card_number": "4000000000001091",
            "card_exp_month": "12",
            "card_exp_year": "26",
            "card_holder_name": "joseph Doe",
            "card_cvc": "123"
        },
        "billing": {
            "address": {
                "line1": "1467",
                "line2": "Harrison Street",
                "city": "San Fransico",
                "state": "California",
                "zip": "94122",
                "country": "US",
                "first_name": "Narayan",
                "last_name": "Bhat"
            }
        }
    },
    "setup_future_usage": "off_session"
}'
  • Do list customer payment methods, and ensure that the billing field is populated
curl --location 'http://localhost:8080/customers/payment_methods?client_secret=pay_Dv3zMLDiCbpiVY3bgwXB_secret_33wrwysfn34oFovDKio8' \
--header 'Accept: application/json' \
--header 'api-key: pk_dev_3c59efb2965a45c980c044cd764b1f42'

Impact

  • Customer list payment methods.
  • Save payment method.

Checklist

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

@Narayanbhat166 Narayanbhat166 added S-waiting-on-review Status: This PR has been implemented and needs to be reviewed C-refactor Category: Refactor labels May 2, 2024
@Narayanbhat166 Narayanbhat166 added this to the April 2024 milestone May 2, 2024
@Narayanbhat166 Narayanbhat166 self-assigned this May 2, 2024
@Narayanbhat166 Narayanbhat166 requested review from a team as code owners May 2, 2024 05:47
hrithikesh026
hrithikesh026 previously approved these changes May 3, 2024
@bernard-eugine bernard-eugine modified the milestones: April 2024, May 2024 May 3, 2024
Aprabhat19
Aprabhat19 previously approved these changes May 3, 2024
sahkal
sahkal previously approved these changes May 3, 2024
hrithikesh026
hrithikesh026 previously approved these changes May 6, 2024
sahkal
sahkal previously approved these changes May 7, 2024
@Narayanbhat166 Narayanbhat166 dismissed stale reviews from sahkal and hrithikesh026 via a1f590f May 9, 2024 06:36
@Narayanbhat166 Narayanbhat166 added the M-database-changes Metadata: This PR involves database schema changes label May 9, 2024
@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue May 9, 2024
Merged via the queue into main with commit 55ae0fc May 9, 2024
12 of 15 checks passed
@Gnanasundari24 Gnanasundari24 deleted the 4641-refactor-store-payment-method-data-billing-for-recurring-payments branch May 9, 2024 13:28
@SanchithHegde SanchithHegde removed the S-waiting-on-review Status: This PR has been implemented and needs to be reviewed label May 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-refactor Category: Refactor M-database-changes Metadata: This PR involves database schema changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants