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(payment_methods): set requires_cvv to false when either connector_mandate_details or network_transaction_id is present during MITs #5331

Merged
merged 3 commits into from
Jul 16, 2024

Conversation

ShankarSinghC
Copy link
Contributor

@ShankarSinghC ShankarSinghC commented Jul 16, 2024

Type of Change

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

Description

requires_cvv should be false the recurring_enabled should be true in the list customer payment method if the is_connector_agnostic_mit_enabled is enabled and network_transaction_id is present for that payment method.

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 a merchant connector account for cybersource
-> Create a payment with setup_future_usage: "off_session"

{
    "amount": 100,
    "payment_type": "setup_mandate",
    "currency": "USD",
    "confirm": true,
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "customer_id": "cu_{{$timestamp}}",
    "email": "[email protected]",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+65",
    "description": "Its my first payment request",
    "authentication_type": "no_three_ds",
    "return_url": "https://google.com",
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_data": {
        "card": {
            "card_number": "4111111111111111",
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "name name",
            "card_cvc": "737"
        }
    },
    "setup_future_usage": "off_session",
    "customer_acceptance": {
        "acceptance_type": "offline",
        "accepted_at": "1963-05-03T04:07:52.723Z",
        "online": {
            "ip_address": "in sit",
            "user_agent": "amet irure esse"
        }
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "PiX",
            "last_name": "ss"
        }
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "John",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    },
    "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": "125.0.0.1"
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "metadata": {},
    "order_details": [
        {
            "product_name": "Apple iphone 15",
            "quantity": 1,
            "amount": 0,
            "account_name": "transaction_processing"
        }
    ]
}

image
image

-> List payment methods for the customer

curl --location 'http://localhost:8080/payments' \
--header 'Accept: application/json' \
--header 'api-key: dev_YpbM0gAEHbx1Uv958uygtKRken4LZJL9bMFOZlgv7Obp7D4902gbF5eA5LdtGcLc' \
--header 'Content-Type: application/json' \
--data '{
    "amount": 10000,
    "currency": "USD",
    "capture_method": "automatic",
    "authentication_type": "no_three_ds",
    "confirm": false,
    "setup_future_usage": "off_session",
    "customer_id": "cu_1721110963"
}'
curl --location 'http://localhost:8080/customers/payment_methods?client_secret=pay_dubtnVf7IHNAA3NWLZsV_secret_GfGNmNO6SeHAu1h9TqxQ' \
--header 'Accept: application/json' \
--header 'api-key: pk_dev_d982e9105d8f415b99f0b30654afac74'

image

-> Migrate a customer using the below endpoint

curl --location 'http://localhost:8080/payment_methods/migrate' \
--header 'api-key: test_admin' \
--header 'Content-Type: application/json' \
--data '{
    "payment_method": "card",
    "merchant_id": "merchant_1721063272",
    "card": {
        "card_number": "4242424242424242",
        "card_exp_month": "10",
        "card_exp_year": "27",
        "nick_name": "Joh"
    },
    "customer_id": "cu_1721111588",
    "network_transaction_id": "016153570198200"
}
'

image
image

-> List payment method for the above customer

curl --location 'http://localhost:8080/payments' \
--header 'Accept: application/json' \
--header 'api-key: dev_YpbM0gAEHbx1Uv958uygtKRken4LZJL9bMFOZlgv7Obp7D4902gbF5eA5LdtGcLc' \
--header 'Content-Type: application/json' \
--data '{
    "amount": 10000,
    "currency": "USD",
    "capture_method": "automatic",
    "authentication_type": "no_three_ds",
    "confirm": false,
    "setup_future_usage": "off_session",
    "customer_id": "cu_1721111588"
}'
curl --location 'http://localhost:8080/customers/payment_methods?client_secret=pay_EqZ9ohNIlrvelLKSA34d_secret_5kqWdqrNqexFGP8NYO2c' \
--header 'Accept: application/json' \
--header 'api-key: pk_dev_d982e9105d8f415b99f0b30654afac74'

image

-> Payment method entry where the connector_mandate_details is null and network transaction is present
image

curl --location 'http://localhost:8080/payments' \
--header 'Accept: application/json' \
--header 'api-key: dev_YpbM0gAEHbx1Uv958uygtKRken4LZJL9bMFOZlgv7Obp7D4902gbF5eA5LdtGcLc' \
--header 'Content-Type: application/json' \
--data '{
    "amount": 10000,
    "currency": "USD",
    "capture_method": "automatic",
    "authentication_type": "no_three_ds",
    "confirm": false,
    "setup_future_usage": "off_session",
    "customer_id": "cu_1721111588"
}'
image

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

…_mandate_details or network_transaction_id is present during MITs
@ShankarSinghC ShankarSinghC added C-bug Category: Bug A-payment-methods Area: Payment Methods labels Jul 16, 2024
@ShankarSinghC ShankarSinghC self-assigned this Jul 16, 2024
@ShankarSinghC ShankarSinghC requested a review from a team as a code owner July 16, 2024 06:07
…nt and the is_connector_agnostic_mit_enabled is enabled.
@likhinbopanna likhinbopanna added this pull request to the merge queue Jul 16, 2024
Merged via the queue into main with commit 29f8732 Jul 16, 2024
13 checks passed
@likhinbopanna likhinbopanna deleted the recurring/requires_cvv-for-ntid branch July 16, 2024 15:27
pixincreate added a commit that referenced this pull request Jul 16, 2024
* 'main' of github.com:juspay/hyperswitch: (25 commits)
  fix(logs): ignore request headers while logging (#5273)
  feat(webhooks): add support for custom outgoing webhook http headers (#5275)
  fix(payment_methods): set `requires_cvv` to false when either `connector_mandate_details` or `network_transaction_id` is present during MITs (#5331)
  chore: create justfile for running commands for v1 and v2 migrations (#5325)
  fix(routing): do not update `perform_session_flow_routing` output if the `SessionRoutingChoice` is none (#5336)
  fix(database): modified_at updated for every state change for Payment Attempts (#5312)
  feat(mca): Added recipient connector call for open banking connectors (#3758)
  chore(version): 2024.07.16.0
  refactor(connector): [Mifinity] add a field language_preference in payment request for mifinity payment method data (#5326)
  fix(router): store `customer_acceptance` in payment_attempt, use it in confirm flow for delayed authorizations like external 3ds flow (#5308)
  feat(proxy): add support to pass proxy bypass urls from configs (#5322)
  Docs: Updating Error codes in API-ref (#5296)
  feat(core): [Payouts] Add retrieve flow for payouts (#4936)
  fix(connector): [AUTHORIZEDOTNET] Populate error reason for failure transactions (#5319)
  chore(version): 2024.07.15.0
  feat(logging): Emit a setup error when a restricted keys are used for logging default keys (#5185)
  feat(payment_methods): add support to migrate existing customer PMs from processor to hyperswitch (#5306)
  feat(connector): [DATATRANS] Implement card payments (#5028)
  chore: making of function create_encrypted_data (#5251)
  fix(payments): populate merchant order ref id in list (#5310)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-payment-methods Area: Payment Methods C-bug Category: Bug
Projects
None yet
4 participants