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(pm_auth): Added pm_auth_config to merchant_connector_account #2183

Merged
merged 15 commits into from
Oct 3, 2023

Conversation

Sarthak1799
Copy link
Contributor

@Sarthak1799 Sarthak1799 commented Sep 18, 2023

Type of Change

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

Description

We will treat pm_auth services as connectors hence requiring a change in the MCA table.
The pm_auth will be of connector type = "payment_method_auth".
Additionally, a new column called pm_auth_config will relate MCA records to their respective chosen auth services, based on payment_method and pmt. Should be configured in dashboard.

VAS conjugate PR - https://github.com/juspay/hyperswitch-cloud/pull/2191
Updated VAS conjugate PR - https://github.com/juspay/hyperswitch-cloud/pull/2172

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?

Configure a pm auth connector -
curl --location --request POST 'http://localhost:8080/account/sarthak1/connectors' \ --header 'Content-Type: application/json' \ --header 'Accept: application/json' \ --header 'api-key: test_admin' \ --data-raw '{ "connector_type": "payment_method_auth", "connector_name": "plaid", "business_country": "US", "business_label": "default", "connector_account_details": { "auth_type": "BodyKey", "api_key": "some_key", "key1": "secret" }, "test_mode": false, "disabled": false }'

configure a PG connector with pm_auth_config provided -
curl --location --request POST 'http://localhost:8080/account/sarthak1/connectors' \ --header 'Content-Type: application/json' \ --header 'Accept: application/json' \ --header 'api-key: test_admin' \ --data-raw '{ "connector_type": "fiz_operations", "connector_name": "stripe", "business_country": "US", "business_label": "default", "connector_account_details": { "auth_type": "HeaderKey", "api_key": "some_key" }, "test_mode": false, "disabled": false, "payment_methods_enabled": [ { "payment_method": "card", "payment_method_types": [ { "payment_method_type": "credit", "card_networks": [ "AmericanExpress", "DinersClub", "Discover", "JCB", "Mastercard", "Visa" ], "minimum_amount": 1, "maximum_amount": 68607706, "recurring_enabled": true, "installment_payment_enabled": true, "accepted_currencies": { "type": "enable_only", "list": [ "CZK", "RON", "TRY", "USD", "GBP", "CAD", "AUD", "ARS", "CHF", "CNY", "DKK", "GHS", "JPY", "PLN", "NGN", "NOK", "KES", "SEK", "NZD", "ZAR", "SGD", "INR" ] } }, { "payment_method_type": "debit", "card_networks": [ "AmericanExpress", "DinersClub", "Discover", "JCB", "Mastercard", "Visa" ], "minimum_amount": 1, "maximum_amount": 68607706, "recurring_enabled": true, "installment_payment_enabled": true, "accepted_currencies": { "type": "enable_only", "list": [ "CZK", "RON", "TRY", "USD", "GBP", "CAD", "AUD", "ARS", "CHF", "CNY", "DKK", "GHS", "JPY", "PLN", "NGN", "NOK", "KES", "SEK", "NZD", "ZAR", "SGD", "INR" ] } }, { "payment_method_type": "credit", "card_networks": [ "Mastercard", "Visa" ], "minimum_amount": 1, "maximum_amount": 68607706, "recurring_enabled": true, "installment_payment_enabled": true, "accepted_currencies": { "type": "enable_only", "list": [ "EUR" ] } }, { "payment_method_type": "debit", "card_networks": [ "Mastercard", "Visa" ], "minimum_amount": 1, "maximum_amount": 68607706, "recurring_enabled": true, "installment_payment_enabled": true, "accepted_currencies": { "type": "enable_only", "list": [ "EUR" ] } } ] }, { "payment_method": "bank_redirect", "payment_method_types": [ { "payment_method_type": "eps", "recurring_enabled": true, "installment_payment_enabled": true, "accepted_currencies": { "type": "enable_only", "list": [ "EUR" ] } }, { "payment_method_type": "giropay", "recurring_enabled": true, "installment_payment_enabled": true, "accepted_currencies": { "type": "enable_only", "list": [ "EUR" ] } }, { "payment_method_type": "ideal", "recurring_enabled": true, "installment_payment_enabled": true, "accepted_currencies": { "type": "enable_only", "list": [ "EUR" ] } } ] }, { "payment_method": "wallet", "payment_method_types": [ { "payment_method_type": "apple_pay", "payment_experience": "invoke_sdk_client", "card_networks": null, "accepted_countries": null, "minimum_amount": 1, "maximum_amount": 68607706, "recurring_enabled": true, "installment_payment_enabled": true, "accepted_currencies": { "type": "enable_only", "list": [ "USD", "GBP", "CAD", "AUD", "EUR" ] } } ] } ], "metadata": { "city": "NY", "unit": "245" }, "pm_auth_config": { "pm_auth_configs": [ { "payment_method": "card", "payment_method_type": "credit", "auth_service": "plaid_US_default" } ] } }'

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

@Sarthak1799 Sarthak1799 self-assigned this Sep 18, 2023
@Sarthak1799 Sarthak1799 requested review from a team as code owners September 18, 2023 10:31
@Sarthak1799 Sarthak1799 added M-database-changes Metadata: This PR involves database schema changes C-feature Category: Feature request or enhancement S-waiting-on-review Status: This PR has been implemented and needs to be reviewed labels Sep 18, 2023
@Sarthak1799 Sarthak1799 requested a review from a team as a code owner September 20, 2023 07:31
Comment on lines +636 to +637

pub pm_auth_config: Option<serde_json::Value>,
Copy link
Contributor

Choose a reason for hiding this comment

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

Could u plz add a doc comment. can be taken up in another PR

Comment on lines +741 to +742

pub pm_auth_config: Option<serde_json::Value>,
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here, doc comment

Comment on lines +812 to +813

pub pm_auth_config: Option<serde_json::Value>,
Copy link
Contributor

Choose a reason for hiding this comment

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

Doc comment

@@ -682,6 +682,7 @@ pub async fn create_payment_connector(
},
profile_id: Some(profile_id.clone()),
applepay_verified_domains: None,
pm_auth_config: req.pm_auth_config.clone(),
Copy link
Contributor

Choose a reason for hiding this comment

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

is this clone required?

@vspecky vspecky added S-ready-for-merge R-L1-completed Review: L1 Review completed R-L2-completed Review: L2 Review completed and removed S-waiting-on-review Status: This PR has been implemented and needs to be reviewed labels Oct 3, 2023
@vspecky vspecky added this pull request to the merge queue Oct 3, 2023
Merged via the queue into main with commit abfdea2 Oct 3, 2023
10 checks passed
@vspecky vspecky deleted the plaid-connector branch October 3, 2023 07:45
@SanchithHegde SanchithHegde removed S-ready-for-merge R-L1-completed Review: L1 Review completed R-L2-completed Review: L2 Review completed labels Oct 8, 2023
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 M-database-changes Metadata: This PR involves database schema changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants