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(core): Add ability to verify connector credentials before integrating the connector #2986

Merged
merged 19 commits into from
Nov 30, 2023

Conversation

ThisIsMani
Copy link
Contributor

@ThisIsMani ThisIsMani commented Nov 27, 2023

Type of Change

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

Description

This PR adds a new route /account/connectors/verify.

Additional Changes

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

Motivation and Context

To enable merchants to test their credentials before integrating the connector.

How did you test it?

Postman.

curl --location 'http://localhost:8080/account/connectors/verify' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer JWT Token' \
--data '{
  "connector_name": "stripe",
  "connector_account_details": {
    "auth_type": "HeaderKey",
    "api_key": "some secret"
  }
}'
curl --location 'http://localhost:8080/account/connectors/verify' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer JWT Token' \
--data '{
  "connector_name": "paypal",
  "connector_account_details": {
    "auth_type": "BodyKey",
    "api_key": "some secret",
    "key1": "some other secret"
  }
}'

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

@ThisIsMani ThisIsMani added A-connector-compatibility Area: Connector compatibility C-feature Category: Feature request or enhancement S-waiting-on-review Status: This PR has been implemented and needs to be reviewed labels Nov 27, 2023
@ThisIsMani ThisIsMani added this to the November 2023 Release milestone Nov 27, 2023
@ThisIsMani ThisIsMani self-assigned this Nov 27, 2023
@ThisIsMani ThisIsMani marked this pull request as ready for review November 27, 2023 12:48
@ThisIsMani ThisIsMani requested review from a team as code owners November 27, 2023 12:48
apoorvdixit88
apoorvdixit88 previously approved these changes Nov 28, 2023
apoorvdixit88
apoorvdixit88 previously approved these changes Nov 28, 2023
Narayanbhat166
Narayanbhat166 previously approved these changes Nov 28, 2023
Comment on lines +620 to +647
#[derive(Default, Debug, Clone, serde::Deserialize, serde::Serialize)]
#[serde(tag = "auth_type")]
pub enum ConnectorAuthType {
TemporaryAuth,
HeaderKey {
api_key: Secret<String>,
},
BodyKey {
api_key: Secret<String>,
key1: Secret<String>,
},
SignatureKey {
api_key: Secret<String>,
key1: Secret<String>,
api_secret: Secret<String>,
},
MultiAuthKey {
api_key: Secret<String>,
key1: Secret<String>,
api_secret: Secret<String>,
key2: Secret<String>,
},
CurrencyAuthKey {
auth_key_map: HashMap<common_enums::Currency, pii::SecretSerdeValue>,
},
#[default]
NoKey,
}
Copy link
Member

@vspecky vspecky Nov 30, 2023

Choose a reason for hiding this comment

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

Remove the ConnectorAuthType type from the router crate if you're re-defining it here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Making this change will effect a lot of files which are out of scope of this PR. Will be picking this up in a separate PR. This issue tracks it #3018.

@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue Nov 30, 2023
Merged via the queue into main with commit 39f255b Nov 30, 2023
12 of 14 checks passed
@Gnanasundari24 Gnanasundari24 deleted the verify-connector branch November 30, 2023 07:49
@SanchithHegde SanchithHegde removed the S-waiting-on-review Status: This PR has been implemented and needs to be reviewed label Dec 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-connector-compatibility Area: Connector compatibility C-feature Category: Feature request or enhancement
Projects
No open projects
Status: Merged
Development

Successfully merging this pull request may close these issues.

6 participants