Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(router): set the eligible connector in the payment attempt for nti based mit flow #6347

Merged
merged 1 commit into from
Oct 17, 2024

Conversation

ShankarSinghC
Copy link
Contributor

@ShankarSinghC ShankarSinghC commented Oct 17, 2024

Type of Change

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

Description

In the MIT flow when the recurring details is of type "type": "network_transaction_id_and_card_details" the eligible connector needs to be set in the payment attempt.

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?

Create merchant connector account for cybersource
-> Make a MIT payment with "type": "network_transaction_id_and_card_details"

curl --location 'http://localhost:8080/payments' \
--header 'Accept: application/json' \
--header 'api-key: dev_OJYRaFClX8PIIwCNrPWUMttJWZrAXUNbBiyA1GvyYyaxRK5EsqODd2ON8KTOlTMa' \
--header 'Content-Type: application/json' \
--data-raw '{
    "amount": 499,
    "currency": "USD",
    "confirm": true,
    "capture_method": "automatic",
    "email": "guest@example.com",
    "payment_method": "card",
    "payment_method_type": "credit",
    "off_session": true,
    "recurring_details": {
        "type": "network_transaction_id_and_card_details",
        "data": {
            "card_number": "5454545454545454",
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "name name",
            "network_transaction_id": "737"
        }
    },
    "billing": {
        "address": {
            "city": "test",
            "country": "US",
            "line1": "here",
            "line2": "there",
            "line3": "anywhere",
            "zip": "560095",
            "state": "Washington",
            "first_name": "One",
            "last_name": "Two"
        },
        "phone": {
            "number": "1234567890",
            "country_code": "+1"
        },
        "email": "guest@example.com"
    }
}'
{
    "payment_id": "pay_ZEs9n2F6Yp0oy50G8VmN",
    "merchant_id": "merchant_1729157921",
    "status": "succeeded",
    "amount": 499,
    "net_amount": 499,
    "amount_capturable": 0,
    "amount_received": 499,
    "connector": "cybersource",
    "client_secret": "pay_ZEs9n2F6Yp0oy50G8VmN_secret_fC2BsOIUxNEDzAtimD0X",
    "created": "2024-10-17T09:39:04.760Z",
    "currency": "USD",
    "customer_id": null,
    "customer": {
        "id": null,
        "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": true,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "5454",
            "card_type": "CREDIT",
            "card_network": null,
            "card_issuer": "BANKHANDLOWYWWARSZAWIE.S.A.",
            "card_issuing_country": "POLAND",
            "card_isin": "545454",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": null,
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": null,
    "billing": {
        "address": {
            "city": "test",
            "country": "US",
            "line1": "here",
            "line2": "there",
            "line3": "anywhere",
            "zip": "560095",
            "state": "Washington",
            "first_name": "One",
            "last_name": "Two"
        },
        "phone": {
            "number": "1234567890",
            "country_code": "+1"
        },
        "email": "guest@example.com"
    },
    "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": null,
    "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": "7291579463536087703954",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "pay_ZEs9n2F6Yp0oy50G8VmN_1",
    "payment_link": null,
    "profile_id": "pro_F0y6R0BOaHFdIv6wsaT8",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_HMDXW38hX91dX1Z5z1xC",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2024-10-17T09:54:04.760Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2024-10-17T09:39:07.091Z",
    "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

@ShankarSinghC ShankarSinghC added A-core Area: Core flows A-payment-methods Area: Payment Methods labels Oct 17, 2024
@ShankarSinghC ShankarSinghC self-assigned this Oct 17, 2024
@ShankarSinghC ShankarSinghC requested a review from a team as a code owner October 17, 2024 07:50
Copy link

semanticdiff-com bot commented Oct 17, 2024

Review changes with SemanticDiff.

Analyzed 1 of 1 files.

Filename Status
✔️ crates/router/src/core/payments.rs Analyzed

@likhinbopanna likhinbopanna added this pull request to the merge queue Oct 17, 2024
Merged via the queue into main with commit 1a3d0a6 Oct 17, 2024
21 of 25 checks passed
@likhinbopanna likhinbopanna deleted the proxy-api/set-connector-resp branch October 17, 2024 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-core Area: Core flows A-payment-methods Area: Payment Methods
Projects
None yet
Development

Successfully merging this pull request may close these issues.

set the eligible connector in payment attempt for network transaction id based mit flow
4 participants