Skip to content

Conversation

noagbmn
Copy link
Contributor

@noagbmn noagbmn commented Sep 23, 2024

Type of Change

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

Description

Fixes #5966 (in both v1 and v2). Now the router cleans up the configs table (or business_profile in v2) when a connector is deleted.

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?

Added a payment and payout processor, checked if values are present in config, deleted and rechecked.
v1:
v1test

v2:
v2test

Test on Integ

  • Create any 2 MCA's
curl --location 'http://localhost:8080/account/merchant_1733401776/connectors' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: test_admin' \
--data '{
    "connector_type": "payment_processor",
    "connector_name": "stripe",
    "connector_account_details": {
        "auth_type": "HeaderKey",
        "api_key": "{{api_key}}"
    },
     "connector_label": "stripe_US_default7777",
    "test_mode": false,
    "disabled": false,
    "payment_methods_enabled": [
        {
            "payment_method": "card",
            "payment_method_types": [
                {
                    "payment_method_type": "credit",
                    "card_networks": [
                        "Visa"
                    ],
                    "minimum_amount": 1,
                    "maximum_amount": 200000,
                    "recurring_enabled": false,
                    "installment_payment_enabled": false
                },
                {
                    "payment_method_type": "debit",
                    "card_networks": [
                        "JCB"
                    ],
                    "minimum_amount": 1,
                    "maximum_amount": 200000,
                    "recurring_enabled": false,
                    "installment_payment_enabled": false
                }
            ]
        },
        {
            "payment_method": "wallet",
            "payment_method_types": [
                {
                    "payment_method_type": "google_pay",
                    "payment_experience": "invoke_sdk_client",
                    "card_networks": null,
                    "minimum_amount": 1,
                    "maximum_amount": 50000,
                    "recurring_enabled": false,
                    "installment_payment_enabled": false
                },
                {
                    "payment_method_type": "apple_pay",
                    "payment_experience": "invoke_sdk_client",
                    "card_networks": null,
                    "minimum_amount": 600,
                    "maximum_amount": 800,
                    "recurring_enabled": false,
                    "installment_payment_enabled": false
                }
            ]
        },
        {
            "payment_method": "pay_later",
            "payment_method_types": [
                {
                    "payment_method_type": "affirm",
                    "payment_experience": "redirect_to_url",
                    "card_networks": null,
                    "minimum_amount": 1,
                    "maximum_amount": 50000,
                    "recurring_enabled": false,
                    "installment_payment_enabled": false
                }
            ]
        }
    ],
    "metadata": {
        "city": "NY",
        "unit": "245"
    }
    
        
}'
  • Do the list for default fallback routing connectors, the connector should be present
curl --location 'http://localhost:8080/routing/default/profile' \
--header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiYWQyMTRiZjUtMjgyYS00OWRiLWIzMjEtZGM3ZTExODRlNTliIiwibWVyY2hhbnRfaWQiOiJzZW5kZXJfbmV0Iiwicm9sZV9pZCI6ImludGVybmFsX3ZpZXdfb25seSIsImV4cCI6MTcyMTMxMDI0NCwib3JnX2lkIjoib3JnX2JmQXZqZWZRMG5oTjVJVm95VTZGIn0.hCH_Pd0d2d08ESOUy1PMGfyuh5TzXQLfi0wBIev1O6U' \
--data ''
  • Delete the one of those 2 MCA's
curl --location --request DELETE 'http://localhost:8080/account/merchant_1733401776/connectors/mca_jIEg3gZxzs54aMMrhT9D' \
--header 'Accept: application/json' \
--header 'api-key: test_admin'
  • The list for default fallback routing connectors, the connector shouldn't be present
curl --location 'http://localhost:8080/routing/default/profile' \
--header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiYWQyMTRiZjUtMjgyYS00OWRiLWIzMjEtZGM3ZTExODRlNTliIiwibWVyY2hhbnRfaWQiOiJzZW5kZXJfbmV0Iiwicm9sZV9pZCI6ImludGVybmFsX3ZpZXdfb25seSIsImV4cCI6MTcyMTMxMDI0NCwib3JnX2lkIjoib3JnX2JmQXZqZWZRMG5oTjVJVm95VTZGIn0.hCH_Pd0d2d08ESOUy1PMGfyuh5TzXQLfi0wBIev1O6U' \
--data ''

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

@noagbmn noagbmn requested review from a team as code owners September 23, 2024 13:34
Copy link

semanticdiff-com bot commented Sep 23, 2024

Review changes with  SemanticDiff

Changed Files
File Status
  crates/common_enums/src/enums.rs  0% smaller
  crates/router/src/core/admin.rs  0% smaller

@noagbmn
Copy link
Contributor Author

noagbmn commented Oct 1, 2024

@SanchithHegde Hi, is this PR going to get reviewed? The issue also didn't get labeled

@SanchithHegde SanchithHegde added C-bug Category: Bug A-routing Area: Routing labels Oct 1, 2024
@noagbmn noagbmn requested a review from Aprabhat19 October 3, 2024 05:49
@noagbmn
Copy link
Contributor Author

noagbmn commented Oct 7, 2024

@Aprabhat19 Hi again! Re-requested your review

Aprabhat19
Aprabhat19 previously approved these changes Oct 8, 2024
@noagbmn
Copy link
Contributor Author

noagbmn commented Oct 11, 2024

@SanchithHegde Hi sorry can we get a second reviewer?

SanchithHegde
SanchithHegde previously approved these changes Nov 27, 2024
Copy link
Member

@SanchithHegde SanchithHegde left a comment

Choose a reason for hiding this comment

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

Looks good to me!

Thanks for the contribution, and apologies for the delay!

@noagbmn noagbmn dismissed stale reviews from SanchithHegde and Aprabhat19 via 817dc6a December 3, 2024 12:28
@noagbmn noagbmn force-pushed the fix_delete_merchant_connector_account_from_config branch from 817dc6a to 0c4b1bd Compare December 3, 2024 12:31
@likhinbopanna likhinbopanna added this pull request to the merge queue Dec 6, 2024
Merged via the queue into juspay:main with commit 512ae85 Dec 6, 2024
19 of 21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-routing Area: Routing C-bug Category: Bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Bug in merchant connector account create - delete flows
5 participants