Skip to content

fix(router): fix Click to Pay cavv None error#8019

Merged
likhinbopanna merged 5 commits intomainfrom
9499-bug-fix-ctp-failing-due-to-cavv-hardcoded-to-none-in-authentication-flow
May 20, 2025
Merged

fix(router): fix Click to Pay cavv None error#8019
likhinbopanna merged 5 commits intomainfrom
9499-bug-fix-ctp-failing-due-to-cavv-hardcoded-to-none-in-authentication-flow

Conversation

@sahkal
Copy link
Contributor

@sahkal sahkal commented May 13, 2025

Type of Change

  • Bugfix

Description

Currently Click to pay is breaking due to CAVV being populated as null in the flow this PR fixes it.

How did you test it?

Add config to make the merchant eligible for authentication service

curl --location 'http://localhost:8080/configs/' \
--header 'Content-Type: application/json' \
--header 'api-key: test_admin' \
--data '{
    "key": "merchants_eligible_for_authentication_service",
    "value": "[\"sahkal\", \"cewqcewc\", \"dqwdwljildwduoqwhduwqcqwjd\"]"
}'

Create merchant connector account for Ctp_mastercard

curl --location 'http://localhost:8080/account/dqwdwljildwduoqwhduwqcqwjd/connectors' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: test_admin' \
--data '
{
    "connector_type": "authentication_processor",
    "connector_name": "ctp_mastercard",
    "connector_account_details": {
        "auth_type": "HeaderKey",
        "api_key": "API-KEY"
    },
    "test_mode": true,
    "disabled": false,
    "payment_methods_enabled": [
        {
            "payment_method": "card",
            "payment_method_types": [
                {
                    "payment_method_type": "credit",
                    "card_networks": [
                        "Visa",
                        "Mastercard"
                    ],
                    "minimum_amount": 1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                },
                {
                    "payment_method_type": "debit",
                    "card_networks": [
                        "Visa",
                        "Mastercard"
                    ],
                    "minimum_amount": 1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                }
            ]
        }
    ],
    "business_country": "US",
    "business_label": "default",
     "metadata": {
    "dpa_id": "b6e06cc6-3018-4c4c-bbf5-9fb232615090",
    "dpa_name": "TestMerchant",
    "locale": "en_AU",
    "card_brands": ["mastercard", "visa"],
    "acquirer_bin": "545301",
    "acquirer_merchant_id": "SRC3DS",
    "merchant_category_code": "0001",
    "merchant_country_code": "US"
  }
}
'

Adyen

curl --location 'http://localhost:8080/account/dqwdwljildwduoqwhduwqcqwjd/connectors' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: test_admin' \
--data '
{
    "connector_type": "payment_processor",
    "connector_name": "cybersource",
    "connector_account_details": {
        "auth_type": "SignatureKey",
        "api_secret": "bypQ0ZszfbHTyNgLEQx+Txvs3qqYc14LVKS+QmwX/88=",
        "api_key": "538e4ded-cef5-4438-a153-5a02566a34fd",
        "key1": "juspay_us_sandbox"
    },
    "test_mode": true,
    "disabled": false,
    "payment_methods_enabled": [
        {
            "payment_method": "card",
            "payment_method_types": [
                {
                    "payment_method_type": "credit",
                    "card_networks": [
                        "AmericanExpress"
                    ],
                    "minimum_amount": 1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                },
                {
                    "payment_method_type": "debit",
                    "card_networks": [
                        "Visa",
                        "Mastercard"
                    ],
                    "minimum_amount": 1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                }
            ]
        }
    ],
    "metadata": {
        "city": "NY",
        "unit": "245",
        "live_endpoint_prefix": "vsfbjh"
    },
    "connector_webhook_details": {
        "merchant_secret": "556B655EBE2F2F0912F6DBC893C23C8A30F5F5293746B80114844AB30549E2AB"
    }
    // "business_country": "US",
    // "business_label": "default"
}
'

update business profile with ctp_mastercard mca_id

curl --location 'http://localhost:8080/account/dqwdwljildwduoqwhduwqcqwjd/business_profile/pro_KCTRv8sFQfC0r65CZxrn' \
--header 'Content-Type: application/json' \
--header 'api-key: test_admin' \
--data '{
    "is_click_to_pay_enabled": true,
    "authentication_product_ids": {"click_to_pay": "mca_XAXUpel8ABbpoGNF8lGz"}
}'

do payments create

curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_fQsdc9JbERQ7CWvmguo84XDROuXOD1oK9sdfCJXOko3SossoI4zdxpJkOIPmojwn' \
--data '{
    "amount": 1130,
    "currency": "USD",
    "confirm": false,
    "return_url": "https://hyperswitch.io"
    }   
'

do payments confirm

curl --location 'http://localhost:8080/payments/pay_Ft9Ke5Lun924OCJa7yll/confirm' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: pk_dev_1f712ac5fd7f4d8c91da6a627862a4f0' \
--data '
{
    
      "payment_method": "card",
    "payment_method_type": "debit",
    "client_secret": "pay_Ft9Ke5Lun924OCJa7yll_secret_po1FVW5adQWFolWJUhMb",
    "ctp_service_details" : {
        "merchant_transaction_id": "0a4e0d3.34f4a04b.803eb38b0a56f082296538d4a70c064a6b320639",
        "correlation_id": "34f4a04b.bcd1ac39-e0f3-479e-b3ee-703ade0c66dc",
        "x_src_flow_id" : "34f4a04b.bcd1ac39-e0f3-479e-b3ee-703ade0c66dc.1727438793"
    },
    "browser_info": {
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "color_depth": 24,
        "java_enabled":true,
        "java_script_enabled": true,
        "language": "en-GB",
        "screen_height":  1440,
        "screen_width": 2560,
        "time_zone": -330,
        "user_agent": "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Mobile Safari/537.36"
    }
}'

Expected Response

{
    "payment_id": "pay_uExtVlV6ueNkLeUPiXZg",
    "merchant_id": "sahkal",
    "status": "succeeded",
    "amount": 100,
    "net_amount": 100,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 100,
    "connector": "cybersource",
    "client_secret": "pay_uExtVlV6ueNkLeUPiXZg_secret_mU8Au3Lupz6KXgHzW5z4",
    "created": "2025-05-13T15:50:46.759Z",
    "currency": "USD",
    "customer_id": null,
    "customer": {
        "id": null,
        "name": "John Doe",
        "email": "sahkalplanet@gmail.com",
        "phone": "999999999",
        "phone_country_code": "+65"
    },
    "description": null,
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": null,
    "payment_method": "card",
    "payment_method_data": null,
    "payment_token": null,
    "shipping": null,
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "sahkal",
            "last_name": "poddar"
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": null,
    "name": null,
    "phone": null,
    "return_url": null,
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "debit",
    "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": "7471514619636683503812",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "pay_uExtVlV6ueNkLeUPiXZg_1",
    "payment_link": null,
    "profile_id": "pro_Img0GLzvnKEFzGRdsqdF",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_3TGQxhtgz4WtNjlj17fn",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": {
        "authentication_flow": null,
        "electronic_commerce_indicator": "06",
        "status": "success",
        "ds_transaction_id": null,
        "version": null,
        "error_code": null,
        "error_message": null
    },
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-05-13T16:05:46.759Z",
    "fingerprint": null,
    "browser_info": {
        "os_type": null,
        "language": "en-GB",
        "time_zone": -330,
        "ip_address": "::1",
        "os_version": null,
        "user_agent": "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Mobile Safari/537.36",
        "color_depth": 24,
        "device_model": null,
        "java_enabled": true,
        "screen_width": 2560,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 1440,
        "accept_language": "en",
        "java_script_enabled": true
    },
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2025-05-13T15:51:03.564Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "click_to_pay",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": 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

@sahkal sahkal added this to the May 2025 Release milestone May 13, 2025
@sahkal sahkal self-assigned this May 13, 2025
@sahkal sahkal requested review from a team as code owners May 13, 2025 16:08
@sahkal sahkal added A-core Area: Core flows C-bug Category: Bug labels May 13, 2025
@hyperswitch-bot hyperswitch-bot bot requested a review from a team as a code owner May 16, 2025 09:00
pixincreate
pixincreate previously approved these changes May 19, 2025
Copy link
Member

@pixincreate pixincreate left a comment

Choose a reason for hiding this comment

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

cypress changes, lgtm.

@likhinbopanna likhinbopanna added this pull request to the merge queue May 19, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 19, 2025
Copy link
Contributor

@deepanshu-iiitu deepanshu-iiitu left a comment

Choose a reason for hiding this comment

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

Connector changes look good

@likhinbopanna likhinbopanna added this pull request to the merge queue May 20, 2025
Merged via the queue into main with commit 344dcd6 May 20, 2025
14 of 20 checks passed
@likhinbopanna likhinbopanna deleted the 9499-bug-fix-ctp-failing-due-to-cavv-hardcoded-to-none-in-authentication-flow branch May 20, 2025 10:46
pixincreate added a commit that referenced this pull request May 20, 2025
…ordea-template

* 'main' of github.com:juspay/hyperswitch:
  feat(reveue_recovery): Add support for multiple retry algorithms in revenue recovery workflow (#7915)
  feat(connector): add barclaycard template code (#8017)
  fix(router): fix Click to Pay cavv None error (#8019)
  fix(connector): Supported capture methods fix for feature matrix (#8057)
iemyashasvi pushed a commit that referenced this pull request May 22, 2025
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-core Area: Core flows C-bug Category: Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants