Skip to content

feat(connector): Add dummy billing connector auth flow#7819

Merged
Gnanasundari24 merged 14 commits intomainfrom
dummy_connectors_billing
Apr 23, 2025
Merged

feat(connector): Add dummy billing connector auth flow#7819
Gnanasundari24 merged 14 commits intomainfrom
dummy_connectors_billing

Conversation

@AdityaKumaar21
Copy link
Member

@AdityaKumaar21 AdityaKumaar21 commented Apr 15, 2025

Type of Change

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

Description

Added a dummy billing connector whose conector type is billing processor to support recovery flow.

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?

cURL request:-

curl --location 'http://localhost:8080/v2/connector-accounts' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'x-merchant-id: cloth_seller_SZpigRAzbQDYfnzh4Pid' \
--header 'x-profile-id: pro_AFjVC7IPd74sIhEy4ZVV' \
--header 'Authorization: admin-api-key=test_admin' \
--header 'api-key: ••••••' \
--data '{
    "connector_type": "billing_processor",
    "connector_name": "stripe_billing_test",
    "connector_account_details": {
        "auth_type": "HeaderKey",
        "api_key": "{{connector_api_key}}"
    },
    "payment_methods_enabled": [
        {
            "payment_method_type": "card",
            "payment_method_subtypes": [
                {
                    "payment_method_subtype": "credit",
                    "payment_experience": null,
                    "card_networks": [
                        "Visa",
                        "Mastercard"
                    ],
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": -1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                },
                {
                    "payment_method_subtype": "debit",
                    "payment_experience": null,
                    "card_networks": [
                        "Visa",
                        "Mastercard"
                    ],
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": -1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                }
            ]
        }
    ],
    "metadata": {
        "status_url": "https://2753-2401-4900-1cb8-2ff9-24dd-1ccf-ed12-b464.in.ngrok.io/webhooks/merchant_1678699058/globalpay",
        "account_name": "transaction_processing",
        "pricing_type": "fixed_price",
        "acquirer_bin": "438309",
        "acquirer_merchant_id": "00002000000"
    },
    "frm_configs": null,
    "connector_webhook_details": {
        "merchant_secret": ""
    },
    "profile_id": "pro_AFjVC7IPd74sIhEy4ZVV"
}'

Response:-

{
    "connector_type": "billing_processor",
    "connector_name": "stripe_billing_test",
    "connector_label": "stripe_billing_test_business",
    "id": "mca_9uYYwrC2gaHI5j15oq10",
    "profile_id": "pro_AFjVC7IPd74sIhEy4ZVV",
    "connector_account_details": {
        "auth_type": "HeaderKey",
        "api_key": "{{*****************}}"
    },
    "payment_methods_enabled": [
        {
            "payment_method_type": "card",
            "payment_method_subtypes": [
                {
                    "payment_method_subtype": "credit",
                    "payment_experience": null,
                    "card_networks": [
                        "Visa",
                        "Mastercard"
                    ],
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": -1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                },
                {
                    "payment_method_subtype": "debit",
                    "payment_experience": null,
                    "card_networks": [
                        "Visa",
                        "Mastercard"
                    ],
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": -1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                }
            ]
        }
    ],
    "connector_webhook_details": {
        "merchant_secret": "",
        "additional_secret": null
    },
    "metadata": {
        "status_url": "https://2753-2401-4900-1cb8-2ff9-24dd-1ccf-ed12-b464.in.ngrok.io/webhooks/merchant_1678699058/globalpay",
        "account_name": "transaction_processing",
        "acquirer_bin": "438309",
        "pricing_type": "fixed_price",
        "acquirer_merchant_id": "00002000000"
    },
    "disabled": false,
    "frm_configs": null,
    "applepay_verified_domains": null,
    "pm_auth_config": null,
    "status": "active",
    "additional_merchant_data": null,
    "connector_wallets_details": null,
    "feature_metadata": null
}

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

## Type of Change
<!-- Put an `x` in the boxes that apply -->

- [ ] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD

## Description
<!-- Describe your changes in detail -->

### Additional Changes

- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables

<!--
Provide links to the files with corresponding changes.

Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->

## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.

If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->

## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->

## Checklist
<!-- Put an `x` in the boxes that apply -->

- [ ] 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
@AdityaKumaar21 AdityaKumaar21 requested review from a team as code owners April 15, 2025 12:55
@semanticdiff-com
Copy link

semanticdiff-com bot commented Apr 15, 2025

Review changes with  SemanticDiff

Changed Files
File Status
  crates/router/src/core/admin.rs  67% smaller
  api-reference-v2/openapi_spec.json  0% smaller
  api-reference/openapi_spec.json  0% smaller
  crates/api_models/src/enums.rs  0% smaller
  crates/common_enums/src/connector_enums.rs  0% smaller
  crates/connector_configs/src/connector.rs  0% smaller
  crates/router/src/types/api.rs  0% smaller
  crates/router/src/types/transformers.rs  0% smaller

@AdityaKumaar21 AdityaKumaar21 self-assigned this Apr 15, 2025
@AdityaKumaar21 AdityaKumaar21 requested a review from a team as a code owner April 15, 2025 13:37
@hyperswitch-bot hyperswitch-bot bot added the M-api-contract-changes Metadata: This PR involves API contract changes label Apr 15, 2025
}
pub fn is_separate_authentication_supported(self) -> bool {
match self {
Self::DummyBillingConnector => false,
Copy link
Contributor

Choose a reason for hiding this comment

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

move it under feature flag

Copy link
Member Author

Choose a reason for hiding this comment

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

i have moved it in under feature flag

pub mod deutschebank;
pub mod digitalvirgo;
pub mod dlocal;
pub mod dummybillingconnector;
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need this in hyperswitch_connectors ? If not we can remove changes in hyperswitch_connectors, connectors, and Connector enums.

Comment on lines +1247 to +1250
api_enums::Connector::DummyBillingConnector => {
dummyconnector::transformers::DummyConnectorAuthType::try_from(self.auth_type)?;
Ok(())
}
Copy link
Contributor

Choose a reason for hiding this comment

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

you can write similar logic which is already existed for DummyConnectors

Comment on lines +3 to +4
pub mod dummybillingconnector;
#[cfg(feature = "dummy_connector")]
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this required, can we not remove just like we have removed it it hyperswitch_connectors ?

@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue Apr 23, 2025
Merged via the queue into main with commit bca8979 Apr 23, 2025
28 of 32 checks passed
@Gnanasundari24 Gnanasundari24 deleted the dummy_connectors_billing branch April 23, 2025 07:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

M-api-contract-changes Metadata: This PR involves API contract changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants