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(connector_onboarding): Add Connector onboarding APIs #3050

Merged
merged 14 commits into from
Dec 5, 2023

Conversation

ThisIsMani
Copy link
Contributor

@ThisIsMani ThisIsMani commented Dec 4, 2023

Type of Change

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

Description

This PR adds 2 new APIs which will allow merchants to onboarding to paypal directly from the Hyperswitch.

Additional Changes

  • This PR modifies the API contract
  • This PR modifies the database schema
  • This PR modifies application configuration/environment variables
  1. config
  2. loadtest/config

Motivation and Context

To support PayPal onboarding.

How did you test it?

Postman.

  1. Create a new user and login
curl --location 'https://integ-api.hyperswitch.io/user/v2/signin' \
--header 'Content-Type: application/json' \
--data-raw '{
    "email": "[email protected]",
    "password": "somepassword"
}'

You will get the following response

{
    "token": "JWTToken",
    "merchant_id": "merchant_id",
    "name": "name",
    "email": "[email protected]",
    "verification_days_left": null,
    "is_metadata_filled": true,
    "user_role": "merchant_admin"
}
  1. Use the merchant_id you received to create a paypal connector with the following body in the curl mentioned
curl --location 'https://integ-api.hyperswitch.io/account/merchant_id/connectors' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: ADMIN API KEY' \
--data '{
  "connector_type": "fiz_operations",
  "connector_name": "paypal",
  "connector_account_details": {
    "auth_type": "TemporaryAuth"
  },
}'
  1. Using the mca_id call the following api
curl --location 'https://integ-api.hyperswitch.io/connector_onboarding/action_url' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer JWTToken' \
--data '{
    "connector": "paypal",
    "connector_id": "mca_id",
    "return_url": "https://www.google.com"
}'

You will get the following response

{
    "paypal": {
        "action_url": "https://www.sandbox.paypal.com/bizsignup/partner/entry?referralToken=sometoken"
    }
}
  1. Login/Create a account from the above link and call the following api with mca_id and profile_id
curl --location 'https://integ-api.hyperswitch.io/connector_onboarding/sync' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer JWTToken' \
--data '{
    "connector": "paypal",
    "connector_id": "mca_id",
    "profile_id": "profile_id"
}'

You will get a mca response if signup has happened properly.

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 force-pushed the connector-onboarding branch from 94c2c15 to 9fb490b Compare December 4, 2023 13:10
@ThisIsMani ThisIsMani self-assigned this Dec 4, 2023
@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 Dec 4, 2023
@ThisIsMani ThisIsMani marked this pull request as ready for review December 4, 2023 13:15
@ThisIsMani ThisIsMani requested review from a team as code owners December 4, 2023 13:15
apoorvdixit88
apoorvdixit88 previously approved these changes Dec 4, 2023
products: vec![PayPalProducts::Ppcp, PayPalProducts::AdvancedVaulting],
capabilities: vec![PayPalCapabilities::PaypalWalletVaultingAdvanced],
partner_config_override: PartnerConfigOverride {
partner_logo_url: "https://live.hyperswitch.io/assets/Dark/hyperswitchLogoIcon.svg"
Copy link
Member

Choose a reason for hiding this comment

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

This being hard-coded is intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, for now I have changed the url to hyperswitch.io

crates/router/src/utils/connector_onboarding.rs Outdated Show resolved Hide resolved
@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue Dec 5, 2023
Merged via the queue into main with commit 7bd6e05 Dec 5, 2023
10 of 12 checks passed
@Gnanasundari24 Gnanasundari24 deleted the connector-onboarding branch December 5, 2023 10:21
@SanchithHegde SanchithHegde removed the S-waiting-on-review Status: This PR has been implemented and needs to be reviewed label Dec 17, 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.

5 participants