Skip to content

Conversation

deepanshu-iiitu
Copy link
Contributor

@deepanshu-iiitu deepanshu-iiitu commented Jun 7, 2024

Type of Change

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

Description

State and Zip is made optional for BOA and Cybersource transactions for countries other than USA and Canada.

Additional Changes

  • This PR modifies the API contract
  • This PR modifies the database schema
  • This PR modifies application configuration/environment variables

Motivation and Context

#4917

How did you test it?

We need to test apple pay, google pay and cards payments for BOA and Cybersource. For each payment method we need to test using at least 3 countries which should include US, Canada and Israel.
billing.address.state and billing.address.zip have been made optional only for countries other than USA and Canada.

Request:

curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: API_KEY_HERE' \
--data-raw '{
     "amount": 101,
    "currency": "USD",
    "confirm": true,
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "customer_id": "medsarX",
    "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_type": "credit",
    "payment_method_data": {
        "card": {
            "card_number": "4111111111111111",
            "card_exp_month": "05",
            "card_exp_year": "25",
            "card_holder_name": "Bernard Eugine",
            "card_cvc": "123"
        }
    },
    "billing": {
        "address": {
            "line1": "eqnkl",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Francisco",
            "state": "California",
            "zip": "46282",
            "country": "IL",
            "first_name": "Narayan",
            "last_name": "Bhat"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+97"
        }
    }
}'

Response:

{
    "payment_id": "pay_RbvToNueBOWFm2gmwidN",
    "merchant_id": "merchant_1717744951",
    "status": "succeeded",
    "amount": 101,
    "net_amount": 101,
    "amount_capturable": 0,
    "amount_received": 101,
    "connector": "bankofamerica",
    "client_secret": "pay_RbvToNueBOWFm2gmwidN_secret_tdukqruBTEX7MMU2GPVp",
    "created": "2024-06-07T13:23:01.813Z",
    "currency": "USD",
    "customer_id": "medsarX",
    "customer": {
        "id": "medsarX",
        "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": "1111",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "411111",
            "card_extended_bin": null,
            "card_exp_month": "05",
            "card_exp_year": "25",
            "card_holder_name": "Bernard Eugine",
            "payment_checks": {
                "avs_response": {
                    "code": "Y",
                    "codeRaw": "Y"
                },
                "card_verification": {
                    "resultCode": "M",
                    "resultCodeRaw": "M"
                },
                "approval_code": "831000",
                "consumer_authentication_response": {
                    "code": "2",
                    "codeRaw": "2"
                },
                "cavv": null,
                "eci": null,
                "eci_raw": null
            },
            "authentication_data": {
                "retrieval_reference_number": "415913139683",
                "acs_transaction_id": null,
                "system_trace_audit_number": "139683"
            }
        },
        "billing": null
    },
    "payment_token": "token_kGlNcngK5V8XTZFGyygh",
    "shipping": null,
    "billing": {
        "address": {
            "city": "San Francisco",
            "country": "IL",
            "line1": "eqnkl",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "46282",
            "state": "California",
            "first_name": "Narayan",
            "last_name": "Bhat"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+97"
        },
        "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": 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": "medsarX",
        "created_at": 1717766581,
        "expires": 1717770181,
        "secret": "epk_548adba3f8b340068726d30f92ac1bf8"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "7177665837596468804953",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "pay_RbvToNueBOWFm2gmwidN_1",
    "payment_link": null,
    "profile_id": "pro_p65lw9djOoJVaUd5BEwN",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_31kwy8X7BwWrWRLPDYe7",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2024-06-07T13:38:01.812Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2024-06-07T13:23:05.307Z",
    "charges": null,
    "frm_metadata": 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

@deepanshu-iiitu deepanshu-iiitu added A-connector-integration Area: Connector integration C-feature Category: Feature request or enhancement labels Jun 7, 2024
@deepanshu-iiitu deepanshu-iiitu self-assigned this Jun 7, 2024
@deepanshu-iiitu deepanshu-iiitu requested a review from a team as a code owner June 7, 2024 12:32
@bernard-eugine bernard-eugine added this pull request to the merge queue Jun 7, 2024
Merged via the queue into main with commit 2f12cca Jun 7, 2024
@bernard-eugine bernard-eugine deleted the boa-cyb-zip-state-optional branch June 7, 2024 13:54
deepanshu-iiitu added a commit that referenced this pull request Jun 7, 2024
pixincreate added a commit that referenced this pull request Jun 7, 2024
…out-fix

* 'main' of github.com:juspay/hyperswitch:
  feat(connector): [BOA/CYB] Make state,zip optional for Non US CA Txns (#4915)
  refactor(payout): move payout quote call to payout core from execute_pretasks (#4900)
deepanshu-iiitu added a commit that referenced this pull request Jun 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-connector-integration Area: Connector integration C-feature Category: Feature request or enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] [BOA/CYBERSOURCE] Make billing_address state, zip optional for Non US Canada transactions
4 participants