Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

refactor(euclid): make the disabled node's relation as negative #5710

Merged
merged 2 commits into from
Aug 27, 2024

Conversation

prajjwalkumar17
Copy link
Contributor

Type of Change

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

Description

This Pr will change the node relation of the Disabled_only field passed in mca for any connector to be Negative.
#5701

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?

The flow for testing this is as follows:

  1. Mca create for crypto_pay
curl --location 'http://127.0.0.1:8080/account/merchant_1724687132/connectors' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: test_admin' \
--data '{
    "connector_type": "payment_processor",
    "connector_name": "cryptopay",
    "connector_account_details": {
        "auth_type": "BodyKey",
        "api_key": "xxxxx",
        "key1": "xxxxxxx"
    },
    "test_mode": false,
    "disabled": false,
    "payment_methods_enabled": [
        {
            "payment_method": "crypto",
            "payment_method_types": [
                {
                    "payment_method_type": "crypto_currency",
                    "payment_experience": "redirect_to_url",
                    "card_networks": null,
                    "accepted_currencies": null,
                    "accepted_countries": {
                        "type": "disable_only",
                        "list": [
                            "AF",
                            "AL",
                            "DZ",
                            "AM",
                            "AZ",
                            "BS",
                            "BO",
                            "BA",
                            "BW",
                            "KH",
                            "CD",
                            "CO",
                            "CU",
                            "EC",
                            "EG",
                            "GH",
                            "GW",
                            "HT",
                            "IS",
                            "IR",
                            "IQ",
                            "LY",
                            "MU",
                            "MN",
                            "MA",
                            "MM",
                            "NP",
                            "NI",
                            "KP",
                            "PK",
                            "PA",
                            "SO",
                            "SS",
                            "SD",
                            "SY",
                            "TT",
                            "TN",
                            "UG",
                            "US",
                            "VI",
                            "VE",
                            "VN",
                            "YE"
                        ]
                    },
                    "minimum_amount": 1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": false
                }
            ]
        }
    ],
    "metadata": {
        "city": "NY",
        "unit": "245"
    },
    "connector_webhook_details": {
        "merchant_secret": "xxxxxxx"
    }
}'
  1. Payment create (country not in list)
curl --location 'http://127.0.0.1:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key:xxxxxx' \
--data '
{
  "amount": 1699,
  "currency": "EUR",
  "amount_to_capture": null,
  "merchant_id": null,
  "routing": null,
  "connector": null,
  "capture_method": null,
  "authentication_type": "three_ds",
  "billing": {
    "address": {
      "city": "Bangalore",
      "country": "NL"
    },
    "phone": null,
    "email": null
  },
  "capture_on": null,
  "confirm": null,
  "customer": null,
  "phone": null,
  "phone_country_code": null,
  "off_session": null,
  "description": null,
  "return_url": null,
  "setup_future_usage": null,
  "payment_token": null,
  "card_cvc": null,
  "shipping": null,
  "statement_descriptor_name": "RLHero3382",
  "statement_descriptor_suffix": null,
  "order_details": null,
  "client_secret": null,
  "mandate_data": null,
  "customer_acceptance": null,
  "mandate_id": null,
  "browser_info": null,
  "payment_experience": null,
  "payment_method_type": null,
  "business_country": null,
  "business_label": null,
  "merchant_connector_details": null,
  "allowed_payment_method_types": [
    "credit",
    "debit",
    "crypto_currency",
    "apple_pay",
    "google_pay",
    "ideal",
    "classic",
    "evoucher",
    "mifinity"
  ],
  "business_sub_label": null,
  "retry_action": null,
  "metadata": null,
  "connector_metadata": null,
  "feature_metadata": null,
  "payment_link": null,
  "payment_link_config": null,
  "payment_link_config_id": null,
  "profile_id": null,
  "surcharge_details": null,
  "payment_type": null,
  "request_incremental_authorization": null,
  "session_expiry": null,
  "frm_metadata": null,
  "request_external_three_ds_authentication": null,
  "recurring_details": null,
  "charges": null,
  "merchant_order_reference_id": null
}'
  1. PML list
curl --location 'http://localhost:8080/account/payment_methods?client_secret=pay_lxRTp662ABmgiHDrXI5C_secret_5JjsJ8zx6svjMffX7wlD' \
--header 'Accept: application/json' \
--header 'api-key:xxxxxx' \
--data ''

It should have crypto PM

{
            "payment_method": "crypto",
            "payment_method_types": [
                {
                    "payment_method_type": "crypto_currency",
                    "payment_experience": [
                        {
                            "payment_experience_type": "redirect_to_url",
                            "eligible_connectors": [
                                "cryptopay"
                            ]
                        }
                    ],
  1. Payment create (country in list)
curl --location 'http://127.0.0.1:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key:xxxxxx' \
--data '
{
  "amount": 1699,
  "currency": "EUR",
  "amount_to_capture": null,
  "merchant_id": null,
  "routing": null,
  "connector": null,
  "capture_method": null,
  "authentication_type": "three_ds",
  "billing": {
    "address": {
      "city": "Bangalore",
      "country": "NI"
    },
    "phone": null,
    "email": null
  },
  "capture_on": null,
  "confirm": null,
  "customer": null,
  "phone": null,
  "phone_country_code": null,
  "off_session": null,
  "description": null,
  "return_url": null,
  "setup_future_usage": null,
  "payment_token": null,
  "card_cvc": null,
  "shipping": null,
  "statement_descriptor_name": "RLHero3382",
  "statement_descriptor_suffix": null,
  "order_details": null,
  "client_secret": null,
  "mandate_data": null,
  "customer_acceptance": null,
  "mandate_id": null,
  "browser_info": null,
  "payment_experience": null,
  "payment_method_type": null,
  "business_country": null,
  "business_label": null,
  "merchant_connector_details": null,
  "allowed_payment_method_types": [
    "credit",
    "debit",
    "crypto_currency",
    "apple_pay",
    "google_pay",
    "ideal",
    "classic",
    "evoucher",
    "mifinity"
  ],
  "business_sub_label": null,
  "retry_action": null,
  "metadata": null,
  "connector_metadata": null,
  "feature_metadata": null,
  "payment_link": null,
  "payment_link_config": null,
  "payment_link_config_id": null,
  "profile_id": null,
  "surcharge_details": null,
  "payment_type": null,
  "request_incremental_authorization": null,
  "session_expiry": null,
  "frm_metadata": null,
  "request_external_three_ds_authentication": null,
  "recurring_details": null,
  "charges": null,
  "merchant_order_reference_id": null
}'
  1. PML list
curl --location 'http://localhost:8080/account/payment_methods?client_secret=pay_lxRTp662ABmgiHDrXI5C_secret_5JjsJ8zx6svjMffX7wlD' \
--header 'Accept: application/json' \
--header 'api-key:xxxxxx' \
--data ''

It shouldn't have crypto PM

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

@prajjwalkumar17 prajjwalkumar17 added C-refactor Category: Refactor A-routing Area: Routing labels Aug 27, 2024
@prajjwalkumar17 prajjwalkumar17 added this to the August 2024 Release milestone Aug 27, 2024
@prajjwalkumar17 prajjwalkumar17 self-assigned this Aug 27, 2024
@prajjwalkumar17 prajjwalkumar17 requested a review from a team as a code owner August 27, 2024 07:46
Copy link

semanticdiff-com bot commented Aug 27, 2024

Review changes with SemanticDiff.

Analyzed 2 of 2 files.

Filename Status
✔️ crates/router/src/core/payment_methods/utils.rs Analyzed
✔️ api-reference-v2/openapi_spec.json Analyzed

Chethan-rao
Chethan-rao previously approved these changes Aug 27, 2024
@hyperswitch-bot hyperswitch-bot bot requested a review from a team as a code owner August 27, 2024 07:48
@hyperswitch-bot hyperswitch-bot bot added the M-api-contract-changes Metadata: This PR involves API contract changes label Aug 27, 2024
@likhinbopanna likhinbopanna merged commit 78d0830 into hotfix-2024.08.23.0 Aug 27, 2024
15 checks passed
@likhinbopanna likhinbopanna deleted the refactor__pml branch August 27, 2024 09:10
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-routing Area: Routing C-refactor Category: Refactor M-api-contract-changes Metadata: This PR involves API contract changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Payment Method List refactor for disable_country / currency fields
5 participants