Skip to content

fix(connector): [Cybersource] send type selection indicator for co-batch cards#7828

Merged
likhinbopanna merged 1 commit intomainfrom
cybersource-type-selection-indicator
Apr 17, 2025
Merged

fix(connector): [Cybersource] send type selection indicator for co-batch cards#7828
likhinbopanna merged 1 commit intomainfrom
cybersource-type-selection-indicator

Conversation

@mrudulvajpayee4935
Copy link
Contributor

@mrudulvajpayee4935 mrudulvajpayee4935 commented Apr 16, 2025

Type of Change

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

Description

Authentication with Netcetera was successful, but authorization with Cybersource failed with the below error:
Declined - The request is missing one or more fields, detailed_error_information: paymentInformation.card.typeSelectionIndicator : MISSING_FIELD

Need to send card.typeSelectionIndicator as 1, for all co-badged cards txns with Cybersource (authorization).

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?

This can be tested with below payments create call:

curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_mXJTgJCTejZ008jnb3EAXyinnyiMyLmFt2PMVRkc8W6vYXQX2g5VXPNoH5Mr6Kae' \
--data-raw '{
    "amount": 499,
    "currency": "USD",
    "confirm": true,
    "capture_method": "automatic",
    "customer_id": "test_rec7",
    "email": "guest@example.com",
    
    "customer_acceptance": {
        "acceptance_type": "online"
    },
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_data": {
        "card": {
            "card_number": "5512459816707531",
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "Sakil Mostak",
            "card_cvc": "737"
        }
    },
    "billing": {
        "address": {
            "city": "test",
            "country": "US",
            "line1": "here is some \n there is some \n none is some? \n ",
            "line2": "there",
            "line3": "anywhere",
            "zip": "560095",
            "state": "CA",
            "first_name": "Sakil",
            "last_name": "Mostak"
        },
        "phone": {
            "number": "1234567890",
            "country_code": "+1"
        },
        "email": "guest@example.com"
    },
    "browser_info": {
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "language": "nl-NL",
        "color_depth": 24,
        "screen_height": 723,
        "screen_width": 1536,
        "time_zone": 0,
        "java_enabled": true,
        "java_script_enabled": true,
        "ip_address": "127.0.0.1"
    },
    "authentication_type": "three_ds"
}'

Response:

{
    "payment_id": "pay_d1USlFlsD0nGFIrt5V5m",
    "merchant_id": "merchant_1744872465",
    "status": "succeeded",
    "amount": 499,
    "net_amount": 499,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 499,
    "connector": "cybersource",
    "client_secret": "pay_d1USlFlsD0nGFIrt5V5m_secret_FTgdv5fx3nuvVctWmAWI",
    "created": "2025-04-17T11:37:35.337Z",
    "currency": "EUR",
    "customer_id": "test_rec7",
    "customer": {
        "id": "test_rec7",
        "name": null,
        "email": "guest@example.com",
        "phone": null,
        "phone_country_code": null
    },
    "description": null,
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "0021",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "401006",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "payment_checks": {
                "avs_response": {
                    "code": "1",
                    "codeRaw": null
                },
                "card_verification": null
            },
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": "token_MWKCZLuTE3damNeB9hcU",
    "shipping": null,
    "billing": {
        "address": {
            "city": "test",
            "country": "NL",
            "line1": "here is some \n there is some \n none is some? \n ",
            "line2": "there",
            "line3": "anywhere",
            "zip": "560095",
            "state": "CA",
            "first_name": "Sakil",
            "last_name": "Mostak"
        },
        "phone": {
            "number": "1234567890",
            "country_code": "+1"
        },
        "email": "guest@example.com"
    },
    "order_details": null,
    "email": "guest@example.com",
    "name": null,
    "phone": null,
    "return_url": "https://google.com/",
    "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": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "test_rec7",
        "created_at": 1744889855,
        "expires": 1744893455,
        "secret": "epk_b60cc9768ad548a18c657655eb0df03b"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "7448898561876807704807",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "pay_d1USlFlsD0nGFIrt5V5m_1",
    "payment_link": null,
    "profile_id": "pro_l9RjpBHrXPJh0rd22HR3",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_24seS16YfPySDk29q02E",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-04-17T11:52:35.337Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "127.0.0.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2025-04-17T11:37:36.608Z",
    "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": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null
}

Cobadged card to be used for testing:

"payment_method_data": {
        "card": {
            "card_number": "4010061700000021",
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "card_cvc": "737"
        }
    },

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

@mrudulvajpayee4935 mrudulvajpayee4935 added A-connector-compatibility Area: Connector compatibility C-bug Category: Bug labels Apr 16, 2025
@mrudulvajpayee4935 mrudulvajpayee4935 added this to the April 2025 Release milestone Apr 16, 2025
@mrudulvajpayee4935 mrudulvajpayee4935 self-assigned this Apr 16, 2025
@mrudulvajpayee4935 mrudulvajpayee4935 requested a review from a team as a code owner April 16, 2025 10:22
@semanticdiff-com
Copy link

semanticdiff-com bot commented Apr 16, 2025

Review changes with  SemanticDiff

Changed Files
File Status
  crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs  0% smaller

@mrudulvajpayee4935 mrudulvajpayee4935 force-pushed the cybersource-type-selection-indicator branch from 24eb12e to c922278 Compare April 16, 2025 12:11
.change_context(errors::ConnectorError::RequestEncodingFailed)
.attach_printable("error while checking is_cobadged_card")?;

let type_selection_indicator = if is_cobadged_card {
Copy link
Contributor

@sai-harsha-vardhan sai-harsha-vardhan Apr 17, 2025

Choose a reason for hiding this comment

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

nit: we can use then_some here

@likhinbopanna likhinbopanna added this pull request to the merge queue Apr 17, 2025
Merged via the queue into main with commit ec147d5 Apr 17, 2025
24 of 28 checks passed
@likhinbopanna likhinbopanna deleted the cybersource-type-selection-indicator branch April 17, 2025 12:11
pixincreate added a commit that referenced this pull request Apr 21, 2025
…acilitapay-pix-pmt

* 'main' of github.com:juspay/hyperswitch: (21 commits)
  refactor(required_fields): move pm required fields to pm crate (#7539)
  fix(connector): [noon] address `next_action_url` being `null` for cards in 3ds payment (#7832)
  refactor(middleware): add middleware to record metrics for request count and duration (#7803)
  chore(version): 2025.04.18.0
  chore(postman): update Postman collection files
  fix(connector): [globalpay] handle edge case where currency comes as empty upon payment decline (#7812)
  refactor(cypress-v2): change `Authorization` and `payment_methods_enabled` for v2 cypress tests (#7805)
  fix(connector): [Cybersource] send type selection indicator for co-batch cards (#7828)
  feat(payment_method): add logic for setup_future_usage downgrade and add filter based on zero mandate config (#7775)
  refactor(accounts): move dashboard_metadata table to accounts_schema and point v2 to v1 dashboard_metadata (#7793)
  chore(analytics): opensearch client creation based on config (#7810)
  ci(postman): update assertion error message for nmi collection (#7765)
  feat: add primary key not null query to generic filter function (#7785)
  chore(version): 2025.04.17.0
  chore: change payment method files ownership to `hyperswitch-payment-methods` (#7808)
  feat(vsaas): modify api key auth to support vsaas cases (#7593)
  ci(cypress): verify mandate id to be `null` if payment id not `succeeded` (#7749)
  feat(connector): [chargebee] consumes required fields to support transaction monitoring (#7774)
  ci(configs): remove vault private key from configs (#7825)
  chore(version): 2025.04.16.0
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-connector-compatibility Area: Connector compatibility C-bug Category: Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Cybersource]: Send type selection indicator in cybersource authorize calls

5 participants