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

refactor(connector): [Mifinity]dynamic fields for mifinity #5056

Merged
merged 1 commit into from
Jun 20, 2024

Conversation

swangi-kumari
Copy link
Contributor

@swangi-kumari swangi-kumari commented Jun 20, 2024

Type of Change

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

Description

Refactor path for dynamic field name - first_name , last_name and 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

How did you test it?

  1. create mca for Mifinity
{
    "connector_type": "fiz_operations",
    "connector_name": "mifinity",
    "connector_account_details": {
        "auth_type": "HeaderKey",
        "api_key": "7KU1tRYnjar-AnkFGJZdUa244czauGxOCuOZq9HYOUciSOZY5Oj5Q5IsvJRSZkZNM2IPJI5MKpo_jVJ_2Ay1HavSdGwkplc0z7zZE9OAJ0Djxbvo-ae-1_Ui6jTjQdDx"
    },
    "test_mode": false,
    "disabled": false,
    "payment_methods_enabled": [
                 {
            "payment_method": "wallet",
            "payment_method_types": [
                {
                    "payment_method_type": "mifinity",
                    "payment_experience": "redirect_to_url",
                    "minimum_amount": 1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": false,
                    "installment_payment_enabled": false,
                    "accepted_countries": {
                        "type": "enable_only",
                        "list": [
                            "DE"
                        ]
                    }
                }
            ]
        }
    ],
    "metadata": {
        "city": "NY",
        "unit": "245",
        "brand_id": "001",
        "destination_account_number": "5001000001223369"
    },
    "business_country": "US",
    "business_label": "food"
}

  1. Create a Mifinity Payment via Mifinity Connector with confirm = false
{
    "amount": 2000,
    "currency": "EUR",
    "confirm": true,
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "amount_to_capture": 2000,
    "customer_id": "StripeCustomer", 
    "email": "[email protected]",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+1",
    "description": "Its my first payment request",
    "authentication_type": "no_three_ds",
    "return_url": "https://www.google.com/",
    "payment_method": "wallet",
    "payment_method_type": "mifinity",
    "payment_method_data": {
        "wallet": {
            "mifinity": {
                "date_of_birth": "2001-10-16"
            }
        }
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "DE",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "[email protected]"
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "DE",
            "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"
    }
}

  1. List Payment Method for merchant
curl --location 'http:https://localhost:8080/account/payment_methods?client_secret={client_secrte}' \
--header 'Accept: application/json' \
--header 'api-key: {api_key}'

Response

{
    "redirect_url": "https://google.com/success",
    "currency": "EUR",
    "payment_methods": [
        {
            "payment_method": "wallet",
            "payment_method_types": [
                {
                    "payment_method_type": "mifinity",
                    "payment_experience": [
                        {
                            "payment_experience_type": "redirect_to_url",
                            "eligible_connectors": [
                                "mifinity"
                            ]
                        }
                    ],
                    "card_networks": null,
                    "bank_names": null,
                    "bank_debits": null,
                    "bank_transfers": null,
                    "required_fields": {
                        "billing.address.line1": {
                            "required_field": "payment_method_data.billing.address.line1",
                            "display_name": "line1",
                            "field_type": "user_address_line1",
                            "value": "1467"
                        },
                        "billing.address.city": {
                            "required_field": "payment_method_data.billing.address.city",
                            "display_name": "city",
                            "field_type": "user_address_city",
                            "value": "San Fransico"
                        },
                        "payment_method_data.wallet.mifinity.date_of_birth": {
                            "required_field": "payment_method_data.wallet.mifinity.date_of_birth",
                            "display_name": "date_of_birth",
                            "field_type": "user_date_of_birth",
                            "value": null
                        },
                        "billing.phone.number": {
                            "required_field": "payment_method_data.billing.phone.number",
                            "display_name": "phone",
                            "field_type": "user_phone_number",
                            "value": "8056594427"
                        },
                        "billing.phone.country_code": {
                            "required_field": "payment_method_data.billing.phone.country_code",
                            "display_name": "dialing_code",
                            "field_type": "user_phone_number_country_code",
                            "value": "+91"
                        },
                        "billing.address.country": {
                            "required_field": "payment_method_data.billing.address.country",
                            "display_name": "nationality",
                            "field_type": {
                                "user_country": {
                                    "options": [
                                        "BR",
                                        "CN",
                                        "SG",
                                        "MY",
                                        "DE",
                                        "CH",
                                        "DK",
                                        "GB",
                                        "ES",
                                        "AD",
                                        "GI",
                                        "FI",
                                        "FR",
                                        "GR",
                                        "HR",
                                        "IT",
                                        "JP",
                                        "MX",
                                        "AR",
                                        "CO",
                                        "CL",
                                        "PE",
                                        "VE",
                                        "UY",
                                        "PY",
                                        "BO",
                                        "EC",
                                        "GT",
                                        "HN",
                                        "SV",
                                        "NI",
                                        "CR",
                                        "PA",
                                        "DO",
                                        "CU",
                                        "PR",
                                        "NL",
                                        "NO",
                                        "PL",
                                        "PT",
                                        "SE",
                                        "RU",
                                        "TR",
                                        "TW",
                                        "HK",
                                        "MO"
                                    ]
                                }
                            },
                            "value": "DE"
                        },
                        "billing.address.last_name": {
                            "required_field": "payment_method_data.billing.address.last_name",
                            "display_name": "last_name",
                            "field_type": "user_full_name",
                            "value": "Doe"
                        },
                        "billing.email": {
                            "required_field": "payment_method_data.billing.email",
                            "display_name": "email_address",
                            "field_type": "user_email_address",
                            "value": "[email protected]"
                        },
                        "billing.address.first_name": {
                            "required_field": "payment_method_data.billing.address.first_name",
                            "display_name": "first_name",
                            "field_type": "user_full_name",
                            "value": "joseph"
                        }
                    },
                    "surcharge_details": null,
                    "pm_auth_connector": null
                }
            ]
        }
    ],
    "mandate_payment": null,
    "merchant_name": "NewAge Retailer",
    "show_surcharge_breakup_screen": false,
    "payment_type": "normal",
    "request_external_three_ds_authentication": false
}

In dynamic field response verify path of these fields

"payment_method_data.billing.address.last_name",
"payment_method_data.billing.address.country",
"payment_method_data.billing.address.first_name",

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

@swangi-kumari swangi-kumari requested a review from a team as a code owner June 20, 2024 11:01
@swangi-kumari swangi-kumari self-assigned this Jun 20, 2024
@swangi-kumari swangi-kumari added A-connector-integration Area: Connector integration C-refactor Category: Refactor labels Jun 20, 2024
@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue Jun 20, 2024
Merged via the queue into main with commit 6f58b4e Jun 20, 2024
26 of 27 checks passed
@Gnanasundari24 Gnanasundari24 deleted the mifinity-dyn-fields branch June 20, 2024 12:29
pixincreate added a commit that referenced this pull request Jun 24, 2024
…ough-hyperswitch-cypress

* 'main' of github.com:juspay/hyperswitch:
  feat(router): add support for googlepay step up flow (#2744)
  fix(access_token): use `merchant_connector_id` in access token (#5106)
  feat: added kafka events for authentication create and update (#4991)
  feat(ci): add vector to handle logs pipeline (#5021)
  feat(users): Decision manager flow changes for SSO (#4995)
  ci(cypress): Fix payment method id for non supported connectors (#5075)
  refactor(core): introduce an interface to switch between old and new connector integration implementations on the connectors (#5013)
  refactor(events): populate object identifiers in outgoing webhooks analytics events during retries (#5067)
  Refactor: [Fiserv] Remove Default Case Handling (#4767)
  chore(version): 2024.06.24.0
  fix(router): avoid considering pre-routing results during `perform_session_token_routing` (#5076)
  refactor(redis): spawn one subscriber thread for handling all the published messages to different channel (#5064)
  feat(users): setup user authentication methods schema and apis (#4999)
  feat(payment_methods): Implement Process tracker workflow for Payment method Status update (#4668)
  chore(version): 2024.06.20.1
  chore(postman): update Postman collection files
  fix(payment_methods): support last used for off session token payments (#5039)
  ci(postman): add net_amount field test cases (#3286)
  refactor(connector): [Mifinity]dynamic fields for mifinity (#5056)
  refactor(payment_method): [Klarna] store and populate payment_type for klarna_sdk Paylater in response (#4956)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-connector-integration Area: Connector integration C-refactor Category: Refactor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants