Skip to content

Conversation

prajjwalkumar17
Copy link
Member

@prajjwalkumar17 prajjwalkumar17 commented Jul 24, 2024

Type of Change

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

Description

Currently Shipping country is being used in SessionFlowRouting, which affects the PaymentMethodList as the later depends on billing country.

Additional Changes

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

Motivation and Context

Payment method list was failing due to shipping country being used in SessionFlowRouting.

How did you test it?

Flow followed

Request 1: mca create request (Adyen)

curl --location 'http://127.0.0.1:8080/account/merchant_1721842730/connectors' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: xxxxxx' \
--data '
{
    "connector_type": "fiz_operations",
    "connector_name": "adyen",
    "connector_account_details": {
        "auth_type": "BodyKey",
        "api_key": "{{connector_api_key}}",
        "key1": "{{connector_key1}}",
        "api_secret": "{{connector_api_secret}}"
    },
    "test_mode": false,
    "disabled": false,
    "business_country": "US",
    "business_label": "default",
    "payment_methods_enabled": [
        {
            "payment_method": "bank_redirect",
            "payment_method_types": [
                {
                    "payment_method_type": "ideal",
                    "recurring_enabled": true,
                    "installment_payment_enabled": true,
                    "payment_experience": "redirect_to_url"
                }
            ]
        }
    ],
    "metadata": {
        "endpoint_prefix": ""
    },
    "connector_webhook_details": {
        "merchant_secret": "xxxxxx"
    }
}'

Request 2: Payment Create Request (with billing_country = NL & shipping_country = IN)

curl --location 'http://127.0.0.1:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key:xxxxxx' \
--data-raw '
{
    "amount": 6540,
    "currency": "EUR",
    "confirm": false,
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "amount_to_capture": 6540,
    "customer_id": "cus26",
    "email": "[email protected]",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+65",
    "description": "Its my first payment request",
    "authentication_type": "no_three_ds",
    "return_url": "https://google.com",
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "NL",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "IN",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    }
}
'

Request 3: List Merchant Payment Methods

curl --location 'http://127.0.0.1:8080/account/payment_methods?client_secret=pay_pjPrnplx4iezrnZVq9OP_secret_G0Oc8N6SoTMKJpfYMEqZ' \
--header 'Accept: application/json' \
--header 'api-key: pk_dev_a5ea68aa142c4bb8ad07d0570166d26a' \
--data ''

Response
Ideal should come

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-euclid-foc Area: Euclid Family of Crates labels Jul 24, 2024
@prajjwalkumar17 prajjwalkumar17 self-assigned this Jul 24, 2024
@prajjwalkumar17 prajjwalkumar17 requested a review from a team as a code owner July 24, 2024 17:45
@prajjwalkumar17 prajjwalkumar17 marked this pull request as draft July 24, 2024 17:45
@prajjwalkumar17 prajjwalkumar17 marked this pull request as ready for review July 25, 2024 02:56
@prajjwalkumar17 prajjwalkumar17 linked an issue Jul 25, 2024 that may be closed by this pull request
@prajjwalkumar17 prajjwalkumar17 added this to the July 2024 Release milestone Jul 25, 2024
@likhinbopanna likhinbopanna added this pull request to the merge queue Jul 25, 2024
Merged via the queue into main with commit 9ca9545 Jul 25, 2024
@likhinbopanna likhinbopanna deleted the fix/routing_shipping_country branch July 25, 2024 10:16
pixincreate added a commit that referenced this pull request Jul 30, 2024
* 'main' of github.com:juspay/hyperswitch:
  refactor(router): remove `connector_account_details` and `connector_webhook_details` in merchant_connector_account list response (#5457)
  feat: add env variable for enable key manager service (#5442)
  chore(version): 2024.07.29.0
  feat(payments): support sort criteria in payments list (#5389)
  refactor(connector):  add amount conversion framework to placetopay (#4988)
  feat(connector): [Bambora APAC] add mandate flow (#5376)
  ci: set code owners for payment methods files (#5453)
  refactor(opensearch): Add Error Handling for Empty Query and Filters in Request (#5432)
  chore: address Rust 1.80 clippy lints (#5447)
  feat(connector): [FISERV] Move connector to hyperswitch_connectors (#5441)
  ci: add support for just hack_v2 check for PRs (#5426)
  fix: added created at and modified at keys in PaymentAttemptResponse (#5412)
  refactor(merchant_account_v2): recreate id for `merchant_account` v2  (#5439)
  chore(version): 2024.07.26.0
  feat(events): forward the tenant configuration as part of the kafka message (#5224)
  refactor(connector):  add amount conversion framework to payone (#4981)
  refactor(user_roles): make org and merchant id nullable (#5353)
  fix(euclid): change the address taken in SessionFlowRouting from shipping to billing address (#5435)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-euclid-foc Area: Euclid Family of Crates C-refactor Category: Refactor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fix: change country in SessionFlowRouting
4 participants