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(connector): [MIFINITY] Implement payment flows and Mifinity payment method #4592

Merged
merged 49 commits into from
Jun 6, 2024

Conversation

swangi-kumari
Copy link
Contributor

@swangi-kumari swangi-kumari commented May 8, 2024

Type of Change

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

Description

  1. Implement Payments and PSync flows for Mifinity connector.
  2. Implement Mifinity Payment Method.

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 a Merchant
{
  "merchant_id": "merchant_{{$timestamp}}",
  "locker_id": "m0010",
  "merchant_name": "NewAge Retailer",
  "merchant_details": {
    "primary_contact_person": "John Test",
    "primary_email": "JohnTest@test.com",
    "primary_phone": "sunt laborum",
    "secondary_contact_person": "John Test2",
    "secondary_email": "JohnTest2@test.com",
    "secondary_phone": "cillum do dolor id",
    "website": "https://www.example.com",
    "about_business": "Online Retail with a wide selection of organic products for North America",
    "address": {
      "line1": "1467",
      "line2": "Harrison Street",
      "line3": "Harrison Street",
      "city": "San Fransico",
      "state": "California",
      "zip": "94122",
      "country": "US"
    }
  },
  "return_url": "https://google.com/success",
  "webhook_details": {
    "webhook_version": "1.0.1",
    "webhook_username": "ekart_retail",
    "webhook_password": "password_ekart@123",
    "payment_created_enabled": true,
    "payment_succeeded_enabled": true,
    "payment_failed_enabled": true
  },
  "sub_merchants_enabled": false,
  "metadata": {
    "city": "NY",
    "unit": "245"
  },
  "primary_business_details": [
    {
      "country": "US",
      "business": "food"
    }
  ]
}

  1. Create API Key
{
  "name": "API Key 1",
  "description": null,
  "expiration": "2038-01-19T03:14:08.000Z"
}

  1. Payment Connector Create
{
    "connector_type": "fiz_operations",
    "connector_name": "mifinity",
    "connector_account_details": {
        "auth_type": "HeaderKey",
        "api_key": "{______}"
    },
    "test_mode": false,
    "disabled": false,
    "payment_methods_enabled": [
                 {
            "payment_method": "wallet",
            "payment_method_types": [
                {
                    "payment_method_type": "mifinity",
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                }
            ]
        }
    ],
    "metadata": {
        "city": "NY",
        "unit": "245",
        "brand_id": "001"
    },
    "business_country": "US",
    "business_label": "food"
}

  1. Create a Mifinity Wallet Payment via Mifinity
    "amount": 1000,
    "currency": "EUR",
    "confirm": true,
      "capture_method": "automatic",
      "capture_on": "2022-09-10T10:11:12Z",
      "amount_to_capture": 1000,
    "customer_id": "StripeCustomer",
    "email": "guest@example.com",
    "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": {
                "destination_account_number": "5001000001223369",
                "dob": "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": "swangi@gmail.com"
    },
    "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"
    }
    // "business_label": "food", 
    // "business_country": "US",
    // "profile_id": "pro_vsFxMOhOqXt4FMYjVral"
}

Response

  • Using redirection_url in response complete the payment
{
    "payment_id": "pay_QoGz4Pu98CFsMxtT5HWZ",
    "merchant_id": "merchant_1716269219",
    "status": "requires_customer_action",
    "amount": 1000,
    "net_amount": 1000,
    "amount_capturable": 1000,
    "amount_received": null,
    "connector": "mifinity",
    "client_secret": "pay_QoGz4Pu98CFsMxtT5HWZ_secret_2cbvKwEt2LffCDYhFIgQ",
    "created": "2024-05-21T05:43:12.607Z",
    "currency": "EUR",
    "customer_id": "StripeCustomer",
    "customer": {
        "id": "StripeCustomer",
        "name": "John Doe",
        "email": "guest@example.com",
        "phone": "999999999",
        "phone_country_code": "+1"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "wallet",
    "payment_method_data": {
        "wallet": {},
        "billing": null
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "DE",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "DE",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "swangi@gmail.com"
    },
    "order_details": null,
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://www.google.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": {
        "type": "redirect_to_url",
        "redirect_to_url": "http://localhost:8080/payments/redirect/pay_QoGz4Pu98CFsMxtT5HWZ/merchant_1716269219/pay_QoGz4Pu98CFsMxtT5HWZ_1"
    },
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "mifinity",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "StripeCustomer",
        "created_at": 1716270192,
        "expires": 1716273792,
        "secret": "epk_91cebf4aba1241c0be573e5bd807b070"
    },
    "manual_retry_allowed": null,
    "connector_transaction_id": "pay_QoGz4Pu98CFsMxtT5HWZ_1",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2019-09-10T10:11:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "pay_QoGz4Pu98CFsMxtT5HWZ_1",
    "payment_link": null,
    "profile_id": "pro_HqWDRNDr8bL3Wi7Z5wIN",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_RkJnWGLzO9fDEYXEP1cb",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2024-05-21T05:58:12.607Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2024-05-21T05:43:13.983Z",
    "frm_metadata": null
}

  1. do a PSync with same payment_id
  • Response
{
    "payment_id": "pay_QoGz4Pu98CFsMxtT5HWZ",
    "merchant_id": "merchant_1716269219",
    "status": "succeeded",
    "amount": 1000,
    "net_amount": 1000,
    "amount_capturable": 0,
    "amount_received": 1000,
    "connector": "mifinity",
    "client_secret": "pay_QoGz4Pu98CFsMxtT5HWZ_secret_2cbvKwEt2LffCDYhFIgQ",
    "created": "2024-05-21T05:43:12.607Z",
    "currency": "EUR",
    "customer_id": "StripeCustomer",
    "customer": {
        "id": "StripeCustomer",
        "name": "John Doe",
        "email": "guest@example.com",
        "phone": "999999999",
        "phone_country_code": "+1"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "wallet",
    "payment_method_data": {
        "wallet": {},
        "billing": null
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "DE",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "DE",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "swangi@gmail.com"
    },
    "order_details": null,
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://www.google.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "mifinity",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": false,
    "connector_transaction_id": "aea08e48-68cb-44f3-8fca-c3c5c659700c",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2019-09-10T10:11:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "pay_QoGz4Pu98CFsMxtT5HWZ_1",
    "payment_link": null,
    "profile_id": "pro_HqWDRNDr8bL3Wi7Z5wIN",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_RkJnWGLzO9fDEYXEP1cb",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2024-05-21T05:58:12.607Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2024-05-21T05:47:52.254Z",
    "frm_metadata": null
}

Create a payment with "capture_method": "manual",

{
    "amount": 1000,
    "currency": "EUR",
    "confirm": true,
    "capture_method": "manual",
    "capture_on": "2022-09-10T10:11:12Z",
    "amount_to_capture": 1000,
    "customer_id": "StripeCustomer",
    "email": "guest@example.com",
    "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": {
                "destination_account_number": "5001000001223369",
                "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": "swangi@gmail.com"
    },
    "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"
    }
}

Response

{
    "error": {
        "type": "invalid_request",
        "message": "Payment method type not supported",
        "code": "HE_03",
        "reason": "manual is not supported by mifinity"
    }
}

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 added A-connector-integration Area: Connector integration C-feature Category: Feature request or enhancement labels May 8, 2024
@swangi-kumari swangi-kumari self-assigned this May 8, 2024

#[derive(Debug, Default, Serialize, Deserialize)]
pub struct MifinityConnectorMetadataObject {
pub brand_id: String,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
pub brand_id: String,
pub brand_id: Secret<String>,

srujanchikke
srujanchikke previously approved these changes Jun 5, 2024
SamraatBansal
SamraatBansal previously approved these changes Jun 5, 2024
pub struct MifinityAddress {
address_line1: Secret<String>,
country_code: api_models::enums::CountryAlpha2,
city: String,
Copy link
Member

Choose a reason for hiding this comment

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

@SamraatBansal Should we consider making this a Secret<String>?

Copy link
Contributor

Choose a reason for hiding this comment

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

City and Country are not sensitive info according to pii guidelines.
Core also does not consider it as secret so same is translated here

SamraatBansal
SamraatBansal previously approved these changes Jun 5, 2024
SanchithHegde
SanchithHegde previously approved these changes Jun 5, 2024
srujanchikke
srujanchikke previously approved these changes Jun 6, 2024
ShankarSinghC
ShankarSinghC previously approved these changes Jun 6, 2024
@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue Jun 6, 2024
Merged via the queue into main with commit 6750be5 Jun 6, 2024
10 checks passed
@Gnanasundari24 Gnanasundari24 deleted the mifinity-impl branch June 6, 2024 12:33
pixincreate added a commit that referenced this pull request Jun 7, 2024
…out-fix

* 'main' of github.com:juspay/hyperswitch:
  refactor(connector): convert init payment flow to preprocessing flow for shift4 (#4884)
  ci(cypress): Add billing address for bank redirects (#4903)
  refactor(openapi): move openapi to a separate folder (#4859)
  chore(version): 2024.06.07.0
  refactor(outgoing_webhooks): raise errors in the analytics pipeline in case of API client errors or non-2xx responses (#4894)
  chore(config): [MIFINITY] add configs for Mifinity in WASM (#4895)
  feat(router): add `acquirer_country_code` in acquirer_details and send it in netcetera authentication flow (#4835)
  refactor(connector): convert init payment flow to preprocessing flow for nuvei (#4878)
  feat(connector): [MIFINITY] Implement payment flows and Mifinity payment method (#4592)
  fix(connectors): [BOA/CYBS] make avs code optional (#4898)
  feat(events): add metadata info to events (#4875)
pixincreate added a commit that referenced this pull request Jun 8, 2024
…atus_pt

* 'main' of github.com:juspay/hyperswitch: (45 commits)
  feat(connector): [BOA/CYB] Make state,zip optional for Non US CA Txns (#4915)
  refactor(payout): move payout quote call to payout core from execute_pretasks (#4900)
  feat(Cypress): Add routing test (#4768)
  feat(connector): [BOA] Handle refund status 201 (#4908)
  refactor(connector): convert init payment flow to preprocessing flow for shift4 (#4884)
  ci(cypress): Add billing address for bank redirects (#4903)
  refactor(openapi): move openapi to a separate folder (#4859)
  chore(version): 2024.06.07.0
  refactor(outgoing_webhooks): raise errors in the analytics pipeline in case of API client errors or non-2xx responses (#4894)
  chore(config): [MIFINITY] add configs for Mifinity in WASM (#4895)
  feat(router): add `acquirer_country_code` in acquirer_details and send it in netcetera authentication flow (#4835)
  refactor(connector): convert init payment flow to preprocessing flow for nuvei (#4878)
  feat(connector): [MIFINITY] Implement payment flows and Mifinity payment method (#4592)
  fix(connectors): [BOA/CYBS] make avs code optional (#4898)
  feat(events): add metadata info to events (#4875)
  chore(version): 2024.06.06.1
  ci(cypress): Add bank redirects for stripe (#4772)
  refactor(webhooks): extract incoming and outgoing webhooks into separate modules (#4870)
  feat(router): add an api to migrate the apple pay certificates from connector metadata to `connector_wallets_details` column in merchant connector account (#4790)
  chore(version): 2024.06.06.0
  ...
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-feature Category: Feature request or enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants