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(payment_methods): populate card fields while saving card again during metadata change condition #5019

Merged
merged 1 commit into from
Jun 18, 2024

Conversation

Chethan-rao
Copy link
Contributor

@Chethan-rao Chethan-rao commented Jun 16, 2024

Type of Change

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

Description

When the same card is being saved with metadata changes, the other fields of card like card_network, card_issuer, scheme, card_type, card_isin, card_issuing_country were getting saved with hardcoded value as None instead of getting its value from the existing saved card. This PR fixes the issue

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?

  1. Save a card
curl --location 'http:https://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_bS3Uz99HdVusSOy9rHtZqcevmpHt9L4N6WvNt5d16SwBgz53crKKEd6pCMrvVVbH' \
--data-raw '{
    "amount": 499,
    "currency": "USD",
    "confirm": true,
    "capture_method": "automatic",
    "customer_id": "cus_6Syv31iU1EeDKyfN1U7O",
    "email": "[email protected]",
    "customer_acceptance": {
        "acceptance_type": "online"
    },
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_data": {
        "card": {
            "card_number": "4242424242424242",
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "Test Holder",
            "card_cvc": "737"
        }
    },
    "billing": {
        "address": {
            "city": "test",
            "country": "US",
            "line1": "here",
            "line2": "there",
            "line3": "anywhere",
            "zip": "560095",
            "state": "Washington",
            "first_name": "One",
            "last_name": "Two"
        },
        "phone": {
            "number": "1234567890",
            "country_code": "+1"
        },
        "email": "[email protected]"
    },
    "authentication_type": "no_three_ds"
}'
  1. Hit list customer payment methods and all the card fields like card_network, issuer country, scheme, etc should be listed.

image

  1. Save the same card again but with some different expiry.
  2. Hit list customer payment methods and still the above fields has to be listed which was not the case before.

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

@Chethan-rao Chethan-rao added C-bug Category: Bug S-waiting-on-review Status: This PR has been implemented and needs to be reviewed A-payment-methods Area: Payment Methods labels Jun 16, 2024
@Chethan-rao Chethan-rao added this to the June 2024 Release milestone Jun 16, 2024
@Chethan-rao Chethan-rao self-assigned this Jun 16, 2024
@Chethan-rao Chethan-rao requested a review from a team as a code owner June 16, 2024 13:00
@Chethan-rao Chethan-rao changed the title fix(payment_methods): populate card fields while saving card during metadata change condition fix(payment_methods): populate card fields while saving card again during metadata change condition Jun 16, 2024
@likhinbopanna likhinbopanna added this pull request to the merge queue Jun 18, 2024
Merged via the queue into main with commit 010e6fe Jun 18, 2024
27 checks passed
@likhinbopanna likhinbopanna deleted the populate-card-fields branch June 18, 2024 13:14
pixincreate added a commit that referenced this pull request Jun 20, 2024
…ress-skip

* 'main' of github.com:juspay/hyperswitch: (27 commits)
  feat(cypress): add 2 more payout connectors and bank transfer support for payout (#4993)
  chore(version): 2024.06.20.0
  Refactor(core): reverts the payment method list filtering using constraint graph (#5044)
  feat(router): add payment method type duplication check for `google_pay` (#5023)
  refactor(storage): remove `id` from payment intent, attempt and remove datamodel ext from payment intent (#4923)
  fix(events): Correct parsing of API events with user event_type for Clickhouse (#5022)
  fix(connector):  add local bank redirect type in compatibility layer, default the country to AT for Local Bank Redirect and add creds_identifier in access token  (#5038)
  refactor(connector): add amount conversion framework for noon (#4843)
  fix(logging): fix stack overflow on recording restricted keys (#4423)
  feat(core): Add logger for sessions call failure (#5036)
  chore(version): 2024.06.19.0
  fix(opensearch): handle index not present errors in search api (#4965)
  feat(multitenancy): add tenant_id as a field for data pipeline and support individual database for clickhouse  (#4867)
  refactor: add basic counter metrics for IMC (#5006)
  fix(payment_methods): populate card fields while saving card again during metadata change condition (#5019)
  feat(router): Override the `setup_future_usage` to `on_session` based on the merchant config (#5016)
  chore(docker-compose): pass correct configuration values for running SDK demo app  (#5012)
  refactor: Move trait ConnectorIntegration to crate hyperswitch_interfaces (#4946)
  chore(version): 2024.06.17.0
  chore(process_tracker): use `const` instead of `String` for `business_status` (#4849)
  ...
@SanchithHegde SanchithHegde removed the S-waiting-on-review Status: This PR has been implemented and needs to be reviewed label Jun 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-payment-methods Area: Payment Methods C-bug Category: Bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FIX] populate card fields while saving card again during metadata change condition
6 participants