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(payment_methods): add support for passing ttl to locker entries #4690

Merged
merged 3 commits into from
May 28, 2024

Conversation

Chethan-rao
Copy link
Contributor

@Chethan-rao Chethan-rao commented May 17, 2024

Type of Change

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

Description

This PR adds config support for passing ttl to locker entries as application config. By default ttl is kept to 7 years.

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?

TTL assignment in locker cannot be known (unless we access the locker db). Hyperswitch just sends the TTL as 7 years to locker. Hyperswitch doesn't store the TTL. Even during payment methods retrieve in Hyperswitch, the TTL is not fetched from locker.
So basic card saving flow has to be tested

Local testing -

  1. Save card in locker
curl --location 'http://localhost:8080/payment_methods' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_sQtjddP5dtSitN2ZB01xgmzYnQboxyx4u3m9nWjMSRCZlApGGjqAnXyVGAPl8OlI' \
--data '{
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_issuer": "Visa",
    "card": {
        "card_number": "4111111111111111",
        "card_exp_month": "04",
        "card_exp_year": "25",
        "card_holder_name": "John",
        "card_network": "Visa"
    },
    "customer_id": "cus_kr9m9hY3ZpS7oJLtJ4mo",
    "metadata": {
        "city": "NY",
        "unit": "245"
    }
}'

image

  1. Locker DB (ttl is 7 years from created time)

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

@Chethan-rao Chethan-rao added S-waiting-on-review Status: This PR has been implemented and needs to be reviewed A-payment-methods Area: Payment Methods C-refactor Category: Refactor labels May 17, 2024
@Chethan-rao Chethan-rao added this to the May 2024 Release milestone May 17, 2024
@Chethan-rao Chethan-rao self-assigned this May 17, 2024
@Chethan-rao Chethan-rao requested review from a team as code owners May 17, 2024 13:43
@Chethan-rao Chethan-rao linked an issue May 17, 2024 that may be closed by this pull request
@Chethan-rao Chethan-rao added the M-configuration-changes Metadata: This PR involves configuration changes label May 17, 2024
@likhinbopanna likhinbopanna added this pull request to the merge queue May 28, 2024
Merged via the queue into main with commit 7ca9c6e May 28, 2024
10 checks passed
@likhinbopanna likhinbopanna deleted the add-ttl-to-locker-entries branch May 28, 2024 14:46
ghost pushed a commit that referenced this pull request May 29, 2024
…actor

* 'main' of github.com:juspay/hyperswitch: (39 commits)
  Fix(Cypress): Fixing 3DS payment failure in headless mode (#4807)
  feat(users): Add redis in Begin and Verify TOTP and create a new API that updates TOTP (#4765)
  refactor(connector): [Klarna] Refactor Authorize call and configs for prod (#4750)
  fix: implement StrongEq for Vec<u8> (#4795)
  refactor(core): move router data response and request models to hyperswitch domain models crate (#4789)
  chore(version): 2024.05.29.0
  refactor: retrieve extended card info config during business profile get call (#4784)
  refactor(payment_methods): add support for passing ttl to locker entries (#4690)
  feat(connector): [CRYPTOPAY] Pass network details in payment request (#4779)
  fix: include client columns in payment attempts response struct (#4761)
  fix(docker-compose): fix docker compose syntax (#4782)
  feat(connector): [Iatapay] add upi qr support (#4728)
  docs(analytics): Add documentation for setting up data services and enabling data features in control center (#4741)
  chore(version): 2024.05.28.0
  feat(connector): [AUTHORIZEDOTNET] Implement non-zero mandates (#4758)
  feat(core): [Paypal] Add session_token flow for Paypal sdk (#4697)
  chore(version): 2024.05.27.0
  chore: add missing migrations for recently added currencies (#4760)
  Refactor(core): Inclusion of constraint graph for merchant Payment Method list (#4626)
  chore(version): 2024.05.24.1
  ...
@SanchithHegde SanchithHegde removed the S-waiting-on-review Status: This PR has been implemented and needs to be reviewed label Jun 2, 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-refactor Category: Refactor M-configuration-changes Metadata: This PR involves configuration changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[REFACTOR] add support for passing ttl to locker entries
5 participants