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(payment_method): API to list countries and currencies supported by a country and payment method type #4126

Merged
merged 17 commits into from
Mar 28, 2024

Conversation

Aprabhat19
Copy link
Contributor

@Aprabhat19 Aprabhat19 commented Mar 19, 2024

Type of Change

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

Description

Make a api to fetch the countries and currencies supported by a particular connector.
This api will be used by the dashboard to restrict payment methods to specific countries/currencies.

Additional Changes

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

Motivation and Context

Closes #4163

How did you test it?

  • When the filters are set for the combination of connector and payment method type
     curl --location 'http:https://localhost:8080/payment_methods/filter?connector=stripe&paymentMethodType=affirm' \
     --header 'Authorization: Bearer JWT' \
    
     {
         "currencies": [
             "USD"
         ],
         "countries": [
             {
                 "code": "US",
                 "name": "UnitedStatesOfAmerica"
             }
         ]
     }
    
  • When the filters are not set for the given combination, we will use default filters to get the list
     curl --location 'http:https://localhost:8080/payment_methods/filter?connector=stripe&paymentMethodType=paypal' \
     --header 'Authorization: Bearer JWT' \
    
     {
         "currencies": [
             "BRL",
             "INR",
             "EUR",
             "JPY",
             "CHF",
             "USD",
             "PLN",
             "MYR",
             "PHP",
             "SGD",
             "THB",
             "SEK",
             "RUB",
             "CAD",
             "HKD",
             "CZK",
             "NOK",
             "NZD",
             "HUF",
             "GBP",
             "AUD",
             "DKK",
             "MXN"
         ],
         "countries": [
             {
                 "code": "DE",
                 "name": "Germany"
             },
             ...
             {
                 "code": "ZA",
                 "name": "SouthAfrica"
             }
         ]
     }
    
  • If the filters are not set in default also, then the list of all countries and currencies will be sent
  • When the filters are not set for the given combination, we will use default filters to get the list
     curl --location 'http:https://localhost:8080/payment_methods/filter?connector=stripe&paymentMethodType=paypal' \
     --header 'Authorization: Bearer JWT' \
    
     {
         "currencies": [
             "XPF",
             ...
             "ZMW"
         ],
         "countries": [
             {
                 "code": "DE",
                 "name": "Germany"
             },
             ...
             {
                 "code": "ZA",
                 "name": "SouthAfrica"
             }
         ]
     }
    

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
  • I added a CHANGELOG entry if applicable

@Aprabhat19 Aprabhat19 requested a review from vspecky March 19, 2024 09:33
@Aprabhat19 Aprabhat19 requested review from a team as code owners March 19, 2024 09:33
@Aprabhat19 Aprabhat19 added C-feature Category: Feature request or enhancement S-waiting-on-review Status: This PR has been implemented and needs to be reviewed labels Mar 19, 2024
@ThisIsMani ThisIsMani changed the title feat(payment_method): Make a api to fetch the countries and currencies supported by a particular connector feat(payment_method): API to list countries and currencies supported by a country and payment method type Mar 21, 2024
@likhinbopanna likhinbopanna added this pull request to the merge queue Mar 28, 2024
Merged via the queue into main with commit 74cd4a7 Mar 28, 2024
16 of 18 checks passed
@likhinbopanna likhinbopanna deleted the add-countries-currencies branch March 28, 2024 07:15
@SanchithHegde SanchithHegde removed the S-waiting-on-review Status: This PR has been implemented and needs to be reviewed label Mar 31, 2024
pixincreate added a commit that referenced this pull request Apr 1, 2024
* 'main' of github.com:juspay/hyperswitch:
  refactor(core): removed the processing status for payment_method_status (#4213)
  docs(README): remove link to outdated early access form
  build(deps): bump `error-stack` from version `0.3.1` to `0.4.1` (#4188)
  chore(version): 2024.04.01.0
  feat(mandates): allow off-session payments using `payment_method_id` (#4132)
  ci(CI-pr): determine modified crates more deterministically (#4233)
  chore(config): add billwerk base URL in deployment configs (#4243)
  feat(payment_method): API to list countries and currencies supported by a country and payment method type (#4126)
  chore(version): 2024.03.28.0
  refactor(config): allow wildcard origin for development and Docker Compose setups (#4231)
  fix(core): Amount capturable remain same for `processing` status in capture (#4229)
  fix(euclid_wasm): checkout wasm metadata issue (#4198)
  fix(trustpay): [Trustpay] Add error code mapping '800.100.100'  (#4224)
  feat(connector): [billwerk] add connector template code (#4123)
  fix(connectors): fix wallet token deserialization error  (#4133)
  fix(log): adding span metadata to `tokio` spawned futures (#4118)
  chore(version): 2024.03.27.0
  fix(connector): [CRYPTOPAY] Skip metadata serialization if none (#4205)
  fix(connector): [Trustpay] fix deserialization error for incoming webhook response for trustpay and add error code mapping '800.100.203' (#4199)
  fix(core): make eci in AuthenticationData optional (#4187)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature Category: Feature request or enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: create an api to get countries and currencies for a connector and pmt
6 participants