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(core): Payments core modification for open banking connectors #3947

Merged
merged 68 commits into from
Jul 17, 2024

Conversation

Sarthak1799
Copy link
Contributor

@Sarthak1799 Sarthak1799 commented Mar 4, 2024

Type of Change

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

Description

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. Add Plaid MCA with payment_method as open_banking and payment_method_type as open_banking_pis
curl --location --request POST 'http://localhost:8080/account/merchant_1720607250/connectors' \
--header 'api-key: test_admin' \
--header 'Content-Type: application/json' \
--data-raw '{
    "connector_type": "payment_processor",
    "connector_name": "plaid",
    "connector_account_details": {
        "auth_type": "BodyKey",
        "api_key": "some_key",
        "key1": "some_key"
    },
    "test_mode": false,
    "disabled": false,
    "payment_methods_enabled": [
        {
            "payment_method": "open_banking",
            "payment_method_types": [
                {
                    "payment_method_type": "open_banking_pis",
                    "recurring_enabled": false,
                    "installment_payment_enabled": false,
                    "accepted_currencies": {
                        "type": "enable_only",
                        "list": [
                            "EUR",
                            "GBP"
                        ]
                    }
                }
            ]
        }
    ],
    "additional_merchant_data": {
        "open_banking_recipient_data": {
            "account_data": {
                "bacs": {
                    "sort_code": "200000",
                    "account_number": "55779911",
                    "name": "merchant_name"
                }
            }
        }
    },
    "metadata": {
        "city": "NY",
        "unit": "246"
    }
}'

Response -

{
    "connector_type": "payment_processor",
    "connector_name": "plaid",
    "connector_label": "plaid3",
    "merchant_connector_id": "mca_gVM5IWhLHFsW5q8F3uez",
    "profile_id": "pro_UgP3FfqWGhfPLuUqYtJF",
    "connector_account_details": {
        "auth_type": "BodyKey",
        "api_key": "Some_key",
        "key1": "Some_key"
    },
    "payment_methods_enabled": [
        {
            "payment_method": "open_banking",
            "payment_method_types": [
                {
                    "payment_method_type": "open_banking_pis",
                    "payment_experience": null,
                    "card_networks": null,
                    "accepted_currencies": {
                        "type": "enable_only",
                        "list": [
                            "EUR",
                            "GBP"
                        ]
                    },
                    "accepted_countries": null,
                    "minimum_amount": null,
                    "maximum_amount": null,
                    "recurring_enabled": false,
                    "installment_payment_enabled": false
                }
            ]
        }
    ],
    "connector_webhook_details": null,
    "metadata": {
        "city": "NY",
        "unit": "246"
    },
    "test_mode": false,
    "disabled": false,
    "frm_configs": null,
    "business_country": null,
    "business_label": null,
    "business_sub_label": null,
    "applepay_verified_domains": null,
    "pm_auth_config": null,
    "status": "active",
    "additional_merchant_data": {
        "open_banking_recipient_data": {
            "account_data": {
                "bacs": {
                    "account_number": "55779911",
                    "sort_code": "200000",
                    "name": "merchant_name",
                    "connector_recipient_id": "recipient-id-sandbox-45beb880-9e3d-4ae3-927b-052f5610fd74"
                }
            }
        }
    }
}

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
  • I added a CHANGELOG entry if applicable

@Sarthak1799 Sarthak1799 added C-feature Category: Feature request or enhancement A-payments Area: payments labels Mar 4, 2024
@Sarthak1799 Sarthak1799 self-assigned this Mar 4, 2024
@Sarthak1799 Sarthak1799 requested review from a team as code owners March 4, 2024 13:21
@Sarthak1799 Sarthak1799 added the R-waiting-on-L1 Review: Waiting on L1 reviewer label Mar 4, 2024
@Sarthak1799 Sarthak1799 linked an issue Mar 7, 2024 that may be closed by this pull request
2 tasks
@Sarthak1799 Sarthak1799 changed the base branch from main to mca-merchant-recipient March 7, 2024 10:23
@hyperswitch-bot hyperswitch-bot bot removed the M-database-changes Metadata: This PR involves database schema changes label Jul 16, 2024
@@ -4669,6 +4692,40 @@ pub fn validate_session_expiry(session_expiry: u32) -> Result<(), errors::ApiErr
}
}

pub fn get_recipient_id_for_open_banking(
Copy link
Member

Choose a reason for hiding this comment

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

this can be an impl on the type

webhook_url: data.request.webhook_url,
complete_authorize_url: data.request.complete_authorize_url,
browser_info: data.request.browser_info,
connector_transaction_id: match data.response {
Copy link
Member

Choose a reason for hiding this comment

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

can we take this from the payment attempt? we should not be inferring fields from the response if we are not calling the connector

vspecky
vspecky previously approved these changes Jul 16, 2024
Copy link
Member

@vspecky vspecky left a comment

Choose a reason for hiding this comment

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

LGTM on behalf of @juspay/hyperswitch-routing

@@ -201,6 +202,10 @@ where
)
.await?;

let op_ref = &operation;
let should_trigger_post_processing_flows =
Copy link
Member

Choose a reason for hiding this comment

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

can use is_operation_confirm function

.payment_method
.get_required_value("PaymentMethod")?;

let merchant_recipient_data = if payment_method == enums::PaymentMethod::OpenBanking {
Copy link
Member

Choose a reason for hiding this comment

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

This check can be done inside the function

Narayanbhat166
Narayanbhat166 previously approved these changes Jul 16, 2024
Copy link
Member

@vspecky vspecky left a comment

Choose a reason for hiding this comment

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

LGTM on behalf of @juspay/hyperswitch-routing

@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue Jul 17, 2024
Merged via the queue into main with commit eb6f27d Jul 17, 2024
17 checks passed
@Gnanasundari24 Gnanasundari24 deleted the open-banking-payments-core branch July 17, 2024 09:53
@SanchithHegde SanchithHegde removed the R-waiting-on-L1 Review: Waiting on L1 reviewer label Jul 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-payments Area: payments C-feature Category: Feature request or enhancement M-api-contract-changes Metadata: This PR involves API contract changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] Incorporate Open Banking flows in Payments Core
6 participants