Skip to content

Conversation

Sakilmostak
Copy link
Contributor

@Sakilmostak Sakilmostak commented Apr 23, 2025

Type of Change

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

Description

  • add fields in business profile to collect external vault connector details i.e. is_externa_vault_enabled, external_vault_connector_details
  • is_external_vault_enabled is a boolean value that decide if external vault is enabled for the given profile
  • external_vault_connector_details collects the vault_connector_id for the external vault where the data will be saved
  • these fields are added in both create and update call for business_profile

Additional Changes

  • This PR modifies the API contract
    add a new field in request of /v2/profiles i.e vault_connector_details which is an nullable object that takes 3 fields
    "is_external_vault_enabled": true,
    "vault_connector_details": {
        "vault_connector_id": "connector_id",
    }
  • This PR modifies the database schema
add two new column to business_profile table i.e, vault_connector_details and is_external_vault_enabled
  • This PR modifies application configuration/environment variables

Motivation and Context

How did you test it?

Tested through postman:

  • for a merchant, create a business_profile with external vault enabled:
curl --location '{{base_url}}/v2/profiles' \
--header 'x-merchant-id: {{merchant_id}}' \
--header 'Content-Type: application/json' \
--header 'Authorization: admin-api-key={{api_key}}' \
--data-raw '{
    "profile_name": "business",
    "return_url": "https://google.com/success",
    "enable_payment_response_hash": true,
    "redirect_to_merchant_with_http_post": false,
    "webhook_details": {
        "webhook_version": "1.0.1",
        "webhook_username": "ekart_retail",
        "webhook_password": "password_ekart@123",
        "webhook_url": "https://webhook.site",
        "payment_created_enabled": true,
        "payment_succeeded_enabled": true,
        "payment_failed_enabled": true
    },
    "metadata": null,
    "order_fulfillment_time": 900,
    "order_fulfillment_time_origin": "create",
    "applepay_verified_domains": null,
    "session_expiry": 900,
    "payment_link_config": null,
    "authentication_connector_details": null,
    "use_billing_as_payment_method_billing": true,
    "collect_shipping_details_from_wallet_connector_if_required": false,
    "collect_billing_details_from_wallet_connector_if_required": false,
    "always_collect_shipping_details_from_wallet_connector": false,
    "always_collect_billing_details_from_wallet_connector": false,
    "is_connector_agnostic_mit_enabled": false,
    "payout_link_config": null,
    "outgoing_webhook_custom_http_headers": null,
    "is_network_tokenization_enabled": false
    "is_external_vault_enabled": true,
    "external_vault_connector_details": {
        "vault_connector_id": "connector_id"
    }
}'
  • update the business profile with external_vault data:
curl --location --request PUT '{{base_url}}/v2/profiles/{{profile_id}}' \
--header 'x-merchant-id: {{merchant_id}}' \
--header 'Content-Type: application/json' \
--header 'Authorization: admin-api-key={{api_key}}' \
--data-raw '{
    "is_external_vault_enabled": true,
    "vault_connector_details": {
        "vault_connector_id": "connector_id"
    }
}'

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

@Sakilmostak Sakilmostak added C-feature Category: Feature request or enhancement A-payment-methods Area: Payment Methods labels Apr 23, 2025
@Sakilmostak Sakilmostak self-assigned this Apr 23, 2025
@hyperswitch-bot hyperswitch-bot bot added the M-database-changes Metadata: This PR involves database schema changes label Apr 23, 2025
@hyperswitch-bot hyperswitch-bot bot added the M-api-contract-changes Metadata: This PR involves API contract changes label Apr 23, 2025
@Sakilmostak Sakilmostak changed the title draft: add business_profile config to enable external vault feat(business_profile): add business_profile config to enable external vault Apr 23, 2025
@Sakilmostak Sakilmostak marked this pull request as ready for review April 23, 2025 16:46
@Sakilmostak Sakilmostak requested review from a team as code owners April 23, 2025 16:46
prasunna09
prasunna09 previously approved these changes May 6, 2025
@@ -0,0 +1,6 @@
-- Your SQL goes here
ALTER TABLE business_profile
ADD COLUMN IF NOT EXISTS is_external_vault_enabled BOOLEAN DEFAULT FALSE;
Copy link
Member

Choose a reason for hiding this comment

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

instead adding in default, handle this in code itself, basically null is false

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the subsequent PR #7917 where this field is being used, the logic have been added to handle null cases as well👍

pub fn get_is_external_vault_enabled(&self) -> bool {
        self.is_external_vault_enabled.unwrap_or(false)
    }

Copy link
Contributor

@su-shivanshmathur su-shivanshmathur left a comment

Choose a reason for hiding this comment

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

Lgtm

@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue May 12, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 12, 2025
@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue May 12, 2025
Merged via the queue into main with commit 8cb5bfc May 12, 2025
16 of 20 checks passed
@Gnanasundari24 Gnanasundari24 deleted the external_vault_flow branch May 12, 2025 15:06
pixincreate added a commit that referenced this pull request May 12, 2025
…adyen-ideal

* 'main' of github.com:juspay/hyperswitch: (62 commits)
  fix(core): language consumption from locale in payment and payout links (#7993)
  feat(refunds_v2): Add refunds list flow in v2 apis (#7966)
  refactor(connector): [Noon] auth header (#7977)
  fix(connector): [Novalnet] send decoded token for apple pay payment (#7973)
  feat(business_profile): add business_profile config to enable external vault (#7876)
  feat(vsaas): integrate onboarding flow for vertical saas (#7884)
  feat(connector): Introduce connector template code for WorldpayXML  (#7968)
  feat(connector): [ADYEN, CHECKOUT] Added In Feature Matrix API (#7914)
  feat(core): add psync support for recovery external payments (#7855)
  refactor(open_router): call elimination routing of open router if enabled instead of dynamo (#7961)
  feat(payment_methods): add v2 api for fetching token data (#7629)
  ci(cypress): Fix Bank Redirects for stripe test (#8004)
  chore(version): 2025.05.12.0
  refactor(authentication): moved cavv storing from table to temp locker (#7978)
  chore(version): 2025.05.09.0
  feat(connector): [paypal, trustpay] add in feature matrix (#7911)
  fix(update_metadata): Update Metadata for any connectors other than stripe gives 500 error (#7984)
  fix(router): Fixed stack over flow for session call in authentication connectors (#7983)
  chore(version): 2025.05.08.0
  fix(payment): disable payment update via client config (#7970)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-payment-methods Area: Payment Methods C-feature Category: Feature request or enhancement M-api-contract-changes Metadata: This PR involves API contract changes M-database-changes Metadata: This PR involves database schema changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants