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(router): restricted list payment method Customer to api-key based #3100

Merged
merged 4 commits into from
Jan 11, 2024

Conversation

sahkal
Copy link
Contributor

@sahkal sahkal commented Dec 11, 2023

Type of Change

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

Description

Restricted list payment method Customer to api-key based

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?

Test Cases

Do Payment Create with "setup_future_usage":"off_session",

curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_dpV0WBFhNBI2VOXN2aHyvXJXHbOXtGZcSQc5nsmisOip5RgInU0UpFDCTfxL0vQ3' \
--data '{
    "amount": 250,
    "currency": "USD",
    "confirm": true,
    "customer_id": "sahkal",
    "return_url": "https://google.com",
    "setup_future_usage":"off_session",
    "description": "For selling Tea",
    "order_details": [
        {
            "product_name": "Tea",
            "quantity": 1,
            "amount": 100,
            "product_img_link": null
        },
        {
            "product_name": "Tea",
            "quantity": 1,
            "amount": 100,
            "product_img_link": "https://thumbs.dreamstime.com/b/indian-tea-spices-masala-chai-33827904.jpg"
        },
        {
            "product_name": "Tea",
            "quantity": 5,
            "amount": 10,
            "product_img_link": "https://thumbs.dreamstime.com/b/indian-tea-spices-masala-chai-33827904.jpg"
        }
    ],
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_data": {
    "card": {
      "card_number": "4242424242424242",
      "card_exp_month": "10",
      "card_exp_year": "2025",
      "card_holder_name": "joseph Doe",
      "card_cvc": "123"
    }
  }
}'

Now do List customer payment method

with api-key

path : 'http://localhost:8080/customers/sahkal/payment_methods' -- it should return 200

curl --location 'http://localhost:8080/customers/sahkal/payment_methods' \
--header 'Accept: application/json' \
--header 'api-key: dev_dpV0WBFhNBI2VOXN2aHyvXJXHbOXtGZcSQc5nsmisOip5RgInU0UpFDCTfxL0vQ3'
Screenshot 2023-12-11 at 4 27 33 PM

now same path change the auth type to publishable key and client secret

curl --location 'http://localhost:8080/customers/sahkal/payment_methods?client_secret=pay_c5jC9CVzAT76VBn4GPJB_secret_Ttbgq0SwcBe3bAX1cGtY' \
--header 'Accept: application/json' \
--header 'api-key: pk_dev_78f80f99d954495b994facf501f92c45'
Screenshot 2023-12-11 at 4 29 11 PM

now change path to http://localhost:8080/customers/payment_methods'

curl --location 'http://localhost:8080/customers/payment_methods?client_secret=pay_c5jC9CVzAT76VBn4GPJB_secret_Ttbgq0SwcBe3bAX1cGtY' \
--header 'Accept: application/json' \
--header 'api-key: pk_dev_78f80f99d954495b994facf501f92c45'
Screenshot 2023-12-11 at 4 30 22 PM

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

@sahkal sahkal added A-core Area: Core flows S-waiting-on-review Status: This PR has been implemented and needs to be reviewed C-refactor Category: Refactor labels Dec 11, 2023
@sahkal sahkal added this to the December 2023 Release milestone Dec 11, 2023
@sahkal sahkal self-assigned this Dec 11, 2023
@sahkal sahkal requested a review from a team as a code owner December 11, 2023 08:05
@sahkal sahkal added the M-api-contract-changes Metadata: This PR involves API contract changes label Dec 11, 2023
Comment on lines -462 to -463
#[serde(skip_deserializing)]
pub customer_id: Option<CustomerId>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check with the @juspay/hyperswitch-sdk-devs folks once to ensure that this field is not being passed. If it is removed here, then any client who was passing this field will fail to work because of #[serde(deny_unknown_fields)]

@likhinbopanna likhinbopanna added this pull request to the merge queue Jan 11, 2024
Merged via the queue into main with commit 9eaebe8 Jan 11, 2024
10 of 12 checks passed
@likhinbopanna likhinbopanna deleted the restrict-client-secret-when-customer-id-passed branch January 11, 2024 08:43
pixincreate added a commit that referenced this pull request Jan 12, 2024
…-router

* 'main' of github.com:juspay/hyperswitch: (84 commits)
  chore(config): add merchant_secret config for webhooks for  cashtocode and volt in wasm dashboard (#3333)
  chore(version): 2024.01.12.0
  fix: update amount_capturable based on intent_status and payment flow (#3278)
  feat: add support for card extended bin in payment attempt (#3312)
  feat(connector): [cybersource] Implement 3DS flow for cards (#3290)
  chore: remove connector auth TOML files from `.gitignore` and `.dockerignore` (#3330)
  fix(refund): add merchant_connector_id in refund (#3303)
  feat(connector): [BOA/CYB] Store AVS response in connector_metadata (#3271)
  feat(outgoingwebhookevent): adding api for query to fetch outgoing webhook events log (#3310)
  feat(router): payment_method block (#3056)
  feat(connector): [Volt] Add support for refund webhooks  (#3326)
  feat(users): invite user without email (#3328)
  feat(euclid_wasm): config changes for NMI (#3329)
  refactor(router): restricted list payment method Customer to api-key based (#3100)
  feat(connector): [BOA/Cyb] Include merchant metadata in capture and void requests (#3308)
  fix(router): add config to avoid connector tokenization for `apple pay` `simplified flow` (#3234)
  refactor(router): flagged order_details validation to skip validation (#3116)
  fix(core): surcharge with saved card failure (#3318)
  feat(payment_link): Added sdk layout option payment link (#3207)
  chore(version): 2024.01.11.0
  ...
pixincreate added a commit that referenced this pull request Jan 13, 2024
* 'main' of github.com:juspay/hyperswitch: (22 commits)
  chore(version): 2024.01.12.1
  chore: add api reference for blocklist (#3336)
  chore(config): add merchant_secret config for webhooks for  cashtocode and volt in wasm dashboard (#3333)
  chore(version): 2024.01.12.0
  fix: update amount_capturable based on intent_status and payment flow (#3278)
  feat: add support for card extended bin in payment attempt (#3312)
  feat(connector): [cybersource] Implement 3DS flow for cards (#3290)
  chore: remove connector auth TOML files from `.gitignore` and `.dockerignore` (#3330)
  fix(refund): add merchant_connector_id in refund (#3303)
  feat(connector): [BOA/CYB] Store AVS response in connector_metadata (#3271)
  feat(outgoingwebhookevent): adding api for query to fetch outgoing webhook events log (#3310)
  feat(router): payment_method block (#3056)
  feat(connector): [Volt] Add support for refund webhooks  (#3326)
  feat(users): invite user without email (#3328)
  feat(euclid_wasm): config changes for NMI (#3329)
  refactor(router): restricted list payment method Customer to api-key based (#3100)
  feat(connector): [BOA/Cyb] Include merchant metadata in capture and void requests (#3308)
  fix(router): add config to avoid connector tokenization for `apple pay` `simplified flow` (#3234)
  refactor(router): flagged order_details validation to skip validation (#3116)
  fix(core): surcharge with saved card failure (#3318)
  ...
@SanchithHegde SanchithHegde removed the S-waiting-on-review Status: This PR has been implemented and needs to be reviewed label Jan 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-core Area: Core flows C-refactor Category: Refactor M-api-contract-changes Metadata: This PR involves API contract changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants