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

feat: store payment check codes and authentication data from processors #3958

Conversation

Narayanbhat166
Copy link
Member

@Narayanbhat166 Narayanbhat166 commented Mar 5, 2024

Type of Change

  • New feature

Description

This PR adds the capability to store payment_checks and authentication_data ( threeds data ) sent from processors

Additional Changes

  • This PR modifies the API contract

The payments response for card now looks like ( for stripe connector only ). authentication_data is present for cards only. payment_checks is present for all stripe card payments.

{
        "card": {
            "last4": "4242",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "424242",
            "card_extended_bin": "42424242",
            "card_exp_month": "10",
            "card_exp_year": "25",
            "card_holder_name": "joseph Doe",
            "payment_checks": {
                "cvc_check": "pass",
                "address_line1_check": null,
                "address_postal_code_check": null
            },
            "authentication_data": {
                "result": "attempt_acknowledged",
                "version": "2.1.0",
                "result_reason": null,
                "transaction_id": "91ada9bf-7e30-45ed-9250-35ed40bb9935",
                "authentication_flow": null,
                "exemption_indicator": null,
                "electronic_commerce_indicator": "06"
            }
        }
}

Motivation and Context

These data are required to do fraud check analysis when a dispute is raised

How did you test it?

  • Create a no_three_ds payment with stripe connector.
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'api-key: dev_Qh3geeUMKaIWSojyasQbnkCEWOHwR0QBeKbm0xtVIOiF0nshEyUY9xevwNAOnmp8' \
--data-raw '{
    "amount": 6969,
    "currency": "USD",
    "confirm": true,
    "name": "John Dough",
    "capture_method": "automatic",
    "phone": "999999999",
    "phone_country_code": "+65",
    "customer_id": "cus_PAxm0MeCGM5TowgDKPc9",
    "email": "[email protected]",
    "setup_future_usage": "on_session",
    "description": "Its my fourth payment request",
    "authentication_type": "no_three_ds",
    "payment_method": "card",
     "routing":{
         "type": "single",
         "data": {
             "connector":"stripe"
         }
     },
    "payment_method_type": "credit",
    "payment_method_data": {
        "card": {
            "card_number": "4242424242424242",
            "card_exp_month": "10",
            "card_exp_year": "25",
            "card_holder_name": "joseph Doe",
            "card_cvc": "123"
        },
        "billing": {
            "address":{}
        }
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "joseph",
            "last_name": "Doe"
        }
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrisoff Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "Narayan",
            "last_name": "Doe"
        },
        "email": "[email protected]"
    },
    "statement_descriptor_name": "hola",
    "statement_descriptor_suffix": "JS"
}'
  • Check whether payment_method_data.card.payment_checks is present
"payment_checks": {
                "address_line1_check": null,
                "address_postal_code_check": null,
                "cvc_check": "pass"
            }
  • Create a three_ds payment and complete the redirection
  • Do a payments retrieve and check whether payment_method_data.card.authentication_data is present and is in the below format.
"authentication_data": {
                "result": "attempt_acknowledged",
                "version": "2.1.0",
                "result_reason": null,
                "transaction_id": "ad6e2c42-49be-4a21-8b9b-acc18eef56e7",
                "authentication_flow": null,
                "exemption_indicator": null,
                "electronic_commerce_indicator": "06"
            }

Impact

  • Stripe connector payments and mandates, only card payment method.

Checklist

  • I formatted the code cargo +nightly fmt --all
  • I addressed lints thrown by cargo clippy
  • I reviewed the submitted code

@Narayanbhat166 Narayanbhat166 added A-connector-compatibility Area: Connector compatibility A-core Area: Core flows labels Mar 5, 2024
@Narayanbhat166 Narayanbhat166 self-assigned this Mar 5, 2024
@Narayanbhat166 Narayanbhat166 requested review from a team as code owners March 5, 2024 06:24
Base automatically changed from 4320-refactor-pass-payment_method_billing-to-connector-module to main March 12, 2024 10:38
@Narayanbhat166 Narayanbhat166 requested a review from a team as a code owner March 12, 2024 10:38
hrithikesh026
hrithikesh026 previously approved these changes Mar 18, 2024
sahkal
sahkal previously approved these changes Mar 18, 2024
ThisIsMani
ThisIsMani previously approved these changes Mar 18, 2024
Copy link
Contributor

@ThisIsMani ThisIsMani left a comment

Choose a reason for hiding this comment

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

Dashboard specific changes looks fine.

hrithikesh026
hrithikesh026 previously approved these changes Mar 19, 2024
@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue Mar 20, 2024
Merged via the queue into main with commit 7afc44e Mar 20, 2024
13 of 15 checks passed
@Gnanasundari24 Gnanasundari24 deleted the 4229-feature-store-payment-check-codes-and-authentication-data-from-processors branch March 20, 2024 08:11
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 A-core Area: Core flows
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants