Skip to content

Conversation

Sakilmostak
Copy link
Contributor

Type of Change

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

Description

  • Handle default case where card network is null because in case of co-badged cards, we will always get the card network from frontend

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?

Tested through Postman:

  • Create an MCA (Checkout)
  • Create a payment with co-badged card
{
    "amount": 1043,
    "currency": "USD",
    "confirm": true,
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "customer_id": "StripeCustomer",
    "email": "[email protected]",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+1",
    "description": "Its my first payment request",
    "authentication_type": "no_three_ds",
    "return_url": "https://google.com",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "card_number": "4010061700000021",
            "card_exp_month": "01",
            "card_exp_year": "99",
            "card_holder_name": "joseph Doe",
            "card_cvc": "123",
            "card_network": "CartesBancaires"
        }
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "PiX"
        }
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "PiX"
        }
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    }
}
  • In the response, the card_network should be present i.e. CartesBancaires and should match
  • The response should look like following
{
    "payment_id": "pay_wvcJQRPQKOvHjvzqFJix",
    "merchant_id": "merchant_1733907987",
    "status": "processing",
    "amount": 1043,
    "net_amount": 1043,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": null,
    "connector": "checkout",
    "client_secret": "pay_wvcJQRPQKOvHjvzqFJix_secret_SukmA54t9oep9K1KxSrc",
    "created": "2024-12-11T09:52:28.477Z",
    "currency": "USD",
    "customer_id": "StripeCustomer",
    "customer": {
        "id": "StripeCustomer",
        "name": "John Doe",
        "email": "[email protected]",
        "phone": "999999999",
        "phone_country_code": "+1"
    },
    "description": "Its my first payment request",
    "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": "CartesBancaires",
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "401006",
            "card_extended_bin": null,
            "card_exp_month": "01",
            "card_exp_year": "99",
            "card_holder_name": null,
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "PiX",
            "last_name": null
        },
        "phone": null,
        "email": null
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "PiX",
            "last_name": null
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "[email protected]",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://google.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": null,
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "StripeCustomer",
        "created_at": 1733910748,
        "expires": 1733914348,
        "secret": "epk_49d031a3596d4fadb79e7cdb7c58559d"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "pay_ymjd6m5acujebkctxn4hteaswa",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2019-09-10T10:11:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "pay_wvcJQRPQKOvHjvzqFJix_1",
    "payment_link": null,
    "profile_id": "pro_jkvQLXzyFlM6p3KyuUEY",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_wz0gCKtDv37owvc8fp6L",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2024-12-11T10:07:28.477Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2024-12-11T09:52:29.142Z",
    "charges": null,
    "frm_metadata": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": 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

@Sakilmostak Sakilmostak added A-core Area: Core flows C-bug Category: Bug labels Dec 12, 2024
@Sakilmostak Sakilmostak added this to the December 2024 Release milestone Dec 12, 2024
@Sakilmostak Sakilmostak self-assigned this Dec 12, 2024
@Sakilmostak Sakilmostak requested a review from a team as a code owner December 12, 2024 11:00
Copy link

semanticdiff-com bot commented Dec 12, 2024

Review changes with  SemanticDiff

Changed Files
File Status
  crates/router/src/core/payments/helpers.rs  0% smaller

@likhinbopanna likhinbopanna added this pull request to the merge queue Dec 16, 2024
Merged via the queue into main with commit f95ee51 Dec 16, 2024
19 of 22 checks passed
@likhinbopanna likhinbopanna deleted the add_card_network_to_default_case branch December 16, 2024 12:49
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.

4 participants