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(router): add an api to migrate the apple pay certificates from connector metadata to connector_wallets_details column in merchant connector account #4790

Merged
merged 40 commits into from
Jun 6, 2024

Conversation

ShankarSinghC
Copy link
Contributor

@ShankarSinghC ShankarSinghC commented May 28, 2024

Type of Change

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

Description

Currently apple pay related details are being stored in the connector metadata, as in future we are going to add apple pay decrypted flow support for ios app we will be collecting the apple pay payment processing certificates as well. As this ppc and ppc key needs to be securely stored, we need to move the existing certificates to a new column which stores the encrypted certificates.

This pr adds a api end point (/apple_pay_certificates_migration) to migrate the apple pay details form the merchant connector account metadata to the newly added column connector (connector_wallets_details). This api takes list of merchant_ids as input and then lists all the configured merchant connector accounts for that merchant id. After which it checks for the apple pay details in the metadata in the merchant connector account, if present it is encrypted by merchant's DEK (Data Encryption Key) and will be stored in the newly added column (connector_wallets_details) in the merchant connector account. Response contains the list of merchant_ids for migration succeeded (migration_successful) and failed (migraiton_failed).

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?

-> Apple pay certificate migration api

curl --location 'http://localhost:8080/apple_pay_certificates_migration' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: test_admin' \
--data '{
    "merchant_ids": ["merchant_1713176513", "merchant_1714122879"]
}'
image -> Check the db for connector_wallets_details of mca belonging to above merchants image

-> Create MCA with apple pay simplified and manual flow
metadata for apple pay simplified

"apple_pay_combined": {
            "simplified": {
                "session_token_data": {
                    "initiative_context": "sdk-test-app.netlify.app",
                    "merchant_business_country": "US"
                },
                "payment_request_data": {
                    "label": "applepay",
                    "supported_networks": [
                        "visa",
                        "masterCard",
                        "amex",
                        "discover"
                    ],
                    "merchant_capabilities": [
                        "supports3DS"
                    ]
                }
            }
        }

metadata for apple pay manual flow

"apple_pay_combined": {
            "manual": {
                "session_token_data": {
                    "initiative": "web",
                    "certificate": "",
                    "display_name": "applepay",
                    "certificate_keys": "",
                    "merchant_business_coountry": "US"
                },
                "payment_request_data": {
                    "label": "applepay",
                    "supported_networks": [
                        "visa",
                        "masterCard",
                        "amex",
                        "discover"
                    ],
                    "merchant_capabilities": [
                        "supports3DS"
                    ]
                }
            }
        }

-> Confirm an apple pay payment with above flows
image
-> Create a apple pay payment with the below metadata

"apple_pay_combined": {
            "manual": {
                "session_token_data": {
                    "initiative": "web",
                    "certificate": "",
                    "display_name": "applepay",
                    "certificate_keys": "",
                    "payment_processing_details_at": "Hyperswitch",
                    "payment_processing_certificate": "",
                    "payment_processing_certificate_key": "",
                    "initiative_context": "sdk-test-app.netlify.app",
                    "merchant_identifier": "",
                    "merchant_business_coountry": "US"
                },
                "payment_request_data": {
                    "label": "applepay",
                    "supported_networks": [
                        "visa",
                        "masterCard",
                        "amex",
                        "discover"
                    ],
                    "merchant_capabilities": [
                        "supports3DS"
                    ]
                }
            }
        }

-> Confirm apple pay payment
image

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

@ShankarSinghC ShankarSinghC requested review from a team as code owners May 28, 2024 13:19
@ShankarSinghC ShankarSinghC requested a review from a team as a code owner May 29, 2024 06:01
@ShankarSinghC ShankarSinghC requested a review from a team as a code owner May 29, 2024 10:51
crates/api_models/src/admin.rs Outdated Show resolved Hide resolved
crates/router/src/core/admin.rs Outdated Show resolved Hide resolved
crates/router/src/core/admin.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@Chethan-rao Chethan-rao left a comment

Choose a reason for hiding this comment

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

@juspay/hyperswitch-routing related changes LGTM

@likhinbopanna likhinbopanna added this pull request to the merge queue Jun 6, 2024
Merged via the queue into main with commit 7a94237 Jun 6, 2024
10 checks passed
@likhinbopanna likhinbopanna deleted the apple_pay/migrate-cert branch June 6, 2024 08:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-core Area: Core flows A-payment-methods Area: Payment Methods
Projects
None yet
6 participants