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

refactor(connectors): [boa/cybs] add billing address to MIT request #5068

Merged
merged 1 commit into from
Jul 11, 2024

Conversation

AkshayaFoiger
Copy link
Contributor

@AkshayaFoiger AkshayaFoiger commented Jun 21, 2024

Type of Change

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

Description

Pass billing details, in MIT request

How did you test it?

  1. Create a CIT with BOA/CYBS
curl --location 'http:https://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_ABuIePR7mHSsEj9vq0efN00DpFcwUQ7KPkqRLv8luwtgl9jOfBzHNgapj6uNTxZn' \
--data-raw '{
    "amount": 1000,
    "currency": "USD",
    "confirm": true,
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "customer_id": "ffff",
    "email": "[email protected]",
    "phone": "999999999",
    "phone_country_code": "+65",
    "description": "Its my first payment request",
    "authentication_type": "no_three_ds",
    "return_url": "https://google.com",
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "MD",
            "first_name": "John",
            "last_name": "Doe"
        }
    },
    "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": "13.232.74.226"
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "HK",
            "first_name": "John",
            "last_name": "Doe"
        }
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "card_number": "4000003920000003", 
            "card_exp_month": "10",
            "card_exp_year": "25",
            
            "card_cvc": "123"
        }
    }
    , "payment_type": "setup_mandate",
    "setup_future_usage": "off_session",
    "customer_acceptance": {
        "acceptance_type": "offline",
        "accepted_at": "1963-05-03T04:07:52.723Z",
        "online": {
            "ip_address": "13.232.74.226",
            "user_agent": "amet irure esse"
        }
    }
}'

Response

{
    "payment_id": "pay_NKnLKdjuskvR6ykks0HR",
    "merchant_id": "merchant_1719584451",
    "status": "succeeded",
    "amount": 1000,
    "net_amount": 1000,
    "amount_capturable": 1000,
    "amount_received": null,
    "connector": "cybersource",
    "client_secret": "pay_NKnLKdjuskvR6ykks0HR_secret_VuYNMt8NA1tZfwEGsj2Y",
    "created": "2024-07-01T06:42:53.444Z",
    "currency": "USD",
    "customer_id": "ffff",
    "customer": {
        "id": "ffff",
        "name": null,
        "email": "[email protected]",
        "phone": "999999999",
        "phone_country_code": "+65"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": "off_session",
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "0003",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "400000",
            "card_extended_bin": null,
            "card_exp_month": "10",
            "card_exp_year": "25",
            "card_holder_name": null,
            "payment_checks": {
                "avs_response": {
                    "code": "Y",
                    "codeRaw": "Y"
                },
                "card_verification": null
            },
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": "token_9kYdxHvw5Y5qZnp8fldv",
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "HK",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "John",
            "last_name": "Doe"
        },
        "phone": null,
        "email": null
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "MD",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "John",
            "last_name": "Doe"
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "[email protected]",
    "name": null,
    "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": "ffff",
        "created_at": 1719816173,
        "expires": 1719819773,
        "secret": "epk_00ce09b678ba47c7b0496963c4f0d980"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "7198161738946980904953",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": {
        "apple_pay": null,
        "airwallex": null,
        "noon": {
            "order_category": "pay"
        }
    },
    "feature_metadata": null,
    "reference_id": "pay_NKnLKdjuskvR6ykks0HR_1",
    "payment_link": null,
    "profile_id": "pro_KrR0qeTYByxucpYydY8I",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_gtL0l7qh1p3dO07K80HG",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2024-07-01T06:57:53.444Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "13.232.74.226",
        "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",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_method_id": "pm_hYuKIeVfpYi33r9Ao1kV",
    "payment_method_status": null,
    "updated": "2024-07-01T06:42:55.807Z",
    "charges": null,
    "frm_metadata": null
}
  1. Create a MIT without passing a billing address - (check in the dashboard, the address for this transaction should be same as the CIT's billing address)
curl --location 'http:https://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_ABuIePR7mHSsEj9vq0efN00DpFcwUQ7KPkqRLv8luwtgl9jOfBzHNgapj6uNTxZn' \
--data '{
    "amount": 999,
    "currency": "USD",
    "confirm": true,
    "customer_id": "ffff",
    "return_url": "https://google.com",
    "recurring_details": {
        "type": "payment_method_id",
        "data": "pm_hYuKIeVfpYi33r9Ao1kV"
    },
    "off_session": true,
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "HK",
            "first_name": "Akshaya",
            "last_name": "Shankar"
        }
    }

}'

Response

{
    "payment_id": "pay_3N3wOSJH5u57worbKzt6",
    "merchant_id": "merchant_1719584451",
    "status": "succeeded",
    "amount": 999,
    "net_amount": 999,
    "amount_capturable": 0,
    "amount_received": 999,
    "connector": "cybersource",
    "client_secret": "pay_3N3wOSJH5u57worbKzt6_secret_xgN0N3arAA3RzZI9jXWP",
    "created": "2024-07-01T06:48:58.304Z",
    "currency": "USD",
    "customer_id": "ffff",
    "customer": {
        "id": "ffff",
        "name": null,
        "email": "[email protected]",
        "phone": "999999999",
        "phone_country_code": "+65"
    },
    "description": null,
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": null,
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "0003",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "400000",
            "card_extended_bin": null,
            "card_exp_month": "10",
            "card_exp_year": "25",
            "card_holder_name": "John Doe",
            "payment_checks": {
                "avs_response": {
                    "code": "Y",
                    "codeRaw": "Y"
                },
                "card_verification": null
            },
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": null,
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "HK",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "Akshaya",
            "last_name": "Shankar"
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "[email protected]",
    "name": null,
    "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": null,
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "ffff",
        "created_at": 1719816538,
        "expires": 1719820138,
        "secret": "epk_2a60d381318b4474aedeb64174ce66a3"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "7198165394446449804953",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "pay_3N3wOSJH5u57worbKzt6_1",
    "payment_link": null,
    "profile_id": "pro_KrR0qeTYByxucpYydY8I",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_gtL0l7qh1p3dO07K80HG",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2024-07-01T07:03:58.304Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_method_id": "pm_hYuKIeVfpYi33r9Ao1kV",
    "payment_method_status": "active",
    "updated": "2024-07-01T06:49:00.501Z",
    "charges": null,
    "frm_metadata": null
}
  1. Create a MIT and pass a different billing address - (check in the dashboard, the address for this transaction should be same as the CIT's billing address)
curl --location 'http:https://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_ABuIePR7mHSsEj9vq0efN00DpFcwUQ7KPkqRLv8luwtgl9jOfBzHNgapj6uNTxZn' \
--data '{
    "amount": 999,
    "currency": "USD",
    "confirm": true,
    "customer_id": "ffff",
    "return_url": "https://google.com",
    "recurring_details": {
        "type": "payment_method_id",
        "data": "pm_hYuKIeVfpYi33r9Ao1kV"
    },
    "off_session": true
}'

Response

{
    "payment_id": "pay_StOr0vOfzXgDK7MFRDwa",
    "merchant_id": "merchant_1719584451",
    "status": "succeeded",
    "amount": 999,
    "net_amount": 999,
    "amount_capturable": 0,
    "amount_received": 999,
    "connector": "cybersource",
    "client_secret": "pay_StOr0vOfzXgDK7MFRDwa_secret_lScAI6JJdo391S3cHwYg",
    "created": "2024-07-01T06:50:19.727Z",
    "currency": "USD",
    "customer_id": "ffff",
    "customer": {
        "id": "ffff",
        "name": null,
        "email": "[email protected]",
        "phone": "999999999",
        "phone_country_code": "+65"
    },
    "description": null,
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": null,
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "0003",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "400000",
            "card_extended_bin": null,
            "card_exp_month": "10",
            "card_exp_year": "25",
            "card_holder_name": "John Doe",
            "payment_checks": {
                "avs_response": {
                    "code": "Y",
                    "codeRaw": "Y"
                },
                "card_verification": null
            },
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": null,
    "billing": null,
    "order_details": null,
    "email": "[email protected]",
    "name": null,
    "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": null,
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "ffff",
        "created_at": 1719816619,
        "expires": 1719820219,
        "secret": "epk_0b583537e39e4fa489a33ae1e6302494"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "7198166201676465604953",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "pay_StOr0vOfzXgDK7MFRDwa_1",
    "payment_link": null,
    "profile_id": "pro_KrR0qeTYByxucpYydY8I",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_gtL0l7qh1p3dO07K80HG",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2024-07-01T07:05:19.727Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_method_id": "pm_hYuKIeVfpYi33r9Ao1kV",
    "payment_method_status": "active",
    "updated": "2024-07-01T06:50:21.346Z",
    "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

@AkshayaFoiger AkshayaFoiger requested a review from a team as a code owner June 21, 2024 06:25
@AkshayaFoiger AkshayaFoiger self-assigned this Jun 21, 2024
@AkshayaFoiger AkshayaFoiger added A-connector-compatibility Area: Connector compatibility A-connector-integration Area: Connector integration C-feature Category: Feature request or enhancement labels Jun 21, 2024
@AkshayaFoiger AkshayaFoiger changed the title refactor(connectors): [boa/cybersource] add bill_to in MIT request refactor(connectors): [boa/cybs] add billing address to MIT request Jun 21, 2024
@likhinbopanna likhinbopanna added this pull request to the merge queue Jul 11, 2024
Merged via the queue into main with commit 66ac158 Jul 11, 2024
21 of 23 checks passed
@likhinbopanna likhinbopanna deleted the boa/bill-to/mit branch July 11, 2024 07:21
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-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.

None yet

4 participants