hyperswitch icon indicating copy to clipboard operation
hyperswitch copied to clipboard

fix(core): [CARD TESTING GUARD] Added Card Testing Guard Config response in case of NULL

Open Debarshi-Gupta opened this issue 9 months ago • 1 comments

Type of Change

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

Description

In our current implementation of Card Testing Guard, the card_testing_guard_config can be NULL for existing profiles. That has been fixed in this PR to return the default values for card_testing_guard_config in case the underlying data is NULL

Additional Changes

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

Motivation and Context

Issue Link: https://github.com/juspay/hyperswitch/issues/7598

How did you test it?

Postman Tests

Business Profile Retrieve

-Request

curl --location 'http://localhost:8080/account/postman_merchant_GHAction_28c1525e-4f97-4f53-82a2-7ea63214a26a/business_profile/pro_N8dPPL3N4soUk236Rbq2' \
--header 'api-key: test_admin'

-Response

{
    "merchant_id": "postman_merchant_GHAction_28c1525e-4f97-4f53-82a2-7ea63214a26a",
    "profile_id": "pro_N8dPPL3N4soUk236Rbq2",
    "profile_name": "US_default",
    "return_url": "https://duck.com/success",
    "enable_payment_response_hash": true,
    "payment_response_hash_key": "M59W9wzwjThfjmSUuTqagO3k9SaN74rA8BFa4NMGBTRCgzwl7Y9gBNgAAKl0FqHe",
    "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": null,
        "payment_created_enabled": true,
        "payment_succeeded_enabled": true,
        "payment_failed_enabled": true
    },
    "metadata": null,
    "routing_algorithm": null,
    "intent_fulfillment_time": 900,
    "frm_routing_algorithm": null,
    "payout_routing_algorithm": null,
    "applepay_verified_domains": null,
    "session_expiry": 900,
    "payment_link_config": null,
    "authentication_connector_details": null,
    "use_billing_as_payment_method_billing": true,
    "extended_card_info_config": null,
    "collect_shipping_details_from_wallet_connector": false,
    "collect_billing_details_from_wallet_connector": 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,
    "tax_connector_id": null,
    "is_tax_connector_enabled": false,
    "is_network_tokenization_enabled": false,
    "is_auto_retries_enabled": false,
    "max_auto_retries_enabled": null,
    "always_request_extended_authorization": null,
    "is_click_to_pay_enabled": false,
    "authentication_product_ids": null,
    "card_testing_guard_config": {
        "card_ip_blocking_status": "disabled",
        "card_ip_blocking_threshold": 3,
        "guest_user_card_blocking_status": "disabled",
        "guest_user_card_blocking_threshold": 10,
        "customer_id_blocking_status": "disabled",
        "customer_id_blocking_threshold": 5,
        "card_testing_guard_expiry": 3600
    },
    "is_clear_pan_retries_enabled": false,
    "force_3ds_challenge": false
}

Checklist

  • [x] I formatted the code cargo +nightly fmt --all
  • [x] I addressed lints thrown by cargo clippy
  • [x] I reviewed the submitted code
  • [ ] I added unit tests for my changes where possible

Debarshi-Gupta avatar Mar 11 '25 11:03 Debarshi-Gupta

Review changes with  SemanticDiff

Changed Files
File Status
  crates/router/src/types/api/admin.rs  35% smaller
  crates/router/src/core/admin.rs  22% smaller
  crates/diesel_models/src/business_profile.rs  0% smaller

semanticdiff-com[bot] avatar Mar 11 '25 11:03 semanticdiff-com[bot]