Skip to content

Conversation

bsayak03
Copy link
Contributor

@bsayak03 bsayak03 commented Jun 13, 2025

Type of Change

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

Description

The OrderId field in Nexixpay request is limited to 18 characters in size.
Along with that added validation checks for fields inside shipping and billing addresses.

Additional Changes

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

Motivation and Context

https://developer.nexi.it/en/api/post-orders-3steps-payment

Screenshot 2025-06-13 at 5 01 28 PM

How did you test it?

Nexixpay Payments - Create

  1. When payment_id is not passed in req (doesn't throw any error but creates a new string to map it with orderId because when HS creates payment_id it is always > 18 characters) :

cURL:

curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_1j0NkPcENkwRgoYqQzrOiEsU38uMF5Q9ckG2grssx6Rz3gZy7Boqo4u5wP4usVkZ' \
--header 'Cookie: PHPSESSID=0b47db9d7de94c37b6b272087a9f2fa7' \
--data-raw '{
    "amount": 3545,
    "currency": "EUR",
    "connector": ["nexixpay"],
    "amount_to_capture": 3545,
    "confirm": true,
    "profile_id": null,
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "authentication_type": "three_ds",
    "phone_country_code": "+1",
    "description": "Its my first payment request",
    "return_url": "https://google.com",
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_data": {
        "card": {
            "card_number": "4349940199004549",
            "card_exp_month": "12",
            "card_exp_year": "30",
            
            "card_cvc": "396"
        }
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "12222",
            "country": "US",
            "first_name": "joseph",
            "last_name": "jj"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "[email protected]"
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "11111",
            "country": "US",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "[email protected]"
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "order_details": [
        {
            "product_name": "Apple iphone 15",
            "quantity": 1,
            "amount": 3545,
            "account_name": "transaction_processing"
        }
    ],
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    },
    "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": "128.0.0.1"
    },
    "customer_acceptance": {
        "acceptance_type": "offline",
        "accepted_at": "1963-05-03T04:07:52.723Z",
        "online": {
            "ip_address": "125.0.0.1",
            "user_agent": "amet irure esse"
        }
    },
    "connector_metadata": {
        "noon": {
            "order_category": "pay"
        }
    },
    "payment_link": false,
    "payment_link_config": {
        "theme": "",
        "logo": "",
        "seller_name": "",
        "sdk_layout": "",
        "display_sdk_only": false,
        "enabled_saved_payment_method": false
    },
    "payment_type": "normal",
    "request_incremental_authorization": false,
    "merchant_order_reference_id": "test_ord",
    "session_expiry": 900
}'

Upon confirming the payment and doing a PSync, we get this
Response:

{
    "payment_id": "pay_5rAXYi0YnHbwqmEUAPnU",
    "merchant_id": "merchant_1750312579",
    "status": "succeeded",
    "amount": 3545,
    "net_amount": 3545,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 3545,
    "connector": "nexixpay",
    "client_secret": "pay_5rAXYi0YnHbwqmEUAPnU_secret_YG2cKfDeVWnQTmuS37iq",
    "created": "2025-06-19T12:37:09.192Z",
    "currency": "EUR",
    "customer_id": null,
    "customer": {
        "id": null,
        "name": null,
        "email": null,
        "phone": null,
        "phone_country_code": "+1"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "attempts": [
        {
            "attempt_id": "pay_5rAXYi0YnHbwqmEUAPnU_1",
            "status": "charged",
            "amount": 3545,
            "order_tax_amount": null,
            "currency": "EUR",
            "connector": "nexixpay",
            "error_message": null,
            "payment_method": "card",
            "connector_transaction_id": "OsJjcWfpZx42t4RSAQ",
            "capture_method": "automatic",
            "authentication_type": "three_ds",
            "created_at": "2025-06-19T12:37:09.193Z",
            "modified_at": "2025-06-19T12:39:00.328Z",
            "cancellation_reason": null,
            "mandate_id": null,
            "error_code": null,
            "payment_token": "token_ZZGaUsS5keturYQU7bZw",
            "connector_metadata": {
                "psyncFlow": "Authorize",
                "cancelOperationId": null,
                "threeDSAuthResult": {
                    "authenticationValue": "AAcABWCEUQAAAA3Zl4FwdQAAAAA="
                },
                "captureOperationId": "634632012033451709",
                "threeDSAuthResponse": "notneeded",
                "authorizationOperationId": "634632012033451709"
            },
            "payment_experience": null,
            "payment_method_type": "credit",
            "reference_id": "OsJjcWfpZx42t4RSAQ",
            "unified_code": null,
            "unified_message": null,
            "client_source": null,
            "client_version": 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": "4549",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "434994",
            "card_extended_bin": null,
            "card_exp_month": "12",
            "card_exp_year": "30",
            "card_holder_name": null,
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": "token_ZZGaUsS5keturYQU7bZw",
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "11111",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "[email protected]"
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "12222",
            "state": "California",
            "first_name": "joseph",
            "last_name": "jj"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "[email protected]"
    },
    "order_details": [
        {
            "brand": null,
            "amount": 3545,
            "category": null,
            "quantity": 1,
            "tax_rate": null,
            "product_id": null,
            "product_name": "Apple iphone 15",
            "product_type": null,
            "sub_category": null,
            "product_img_link": null,
            "product_tax_code": null,
            "total_tax_amount": null,
            "requires_shipping": null
        }
    ],
    "email": null,
    "name": null,
    "phone": null,
    "return_url": "https://google.com/",
    "authentication_type": "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": "credit",
    "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": "OsJjcWfpZx42t4RSAQ",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2019-09-10T10:11:12Z",
        "new_customer": "true"
    },
    "connector_metadata": {
        "apple_pay": null,
        "airwallex": null,
        "noon": {
            "order_category": "pay"
        },
        "braintree": null,
        "adyen": null
    },
    "feature_metadata": null,
    "reference_id": "OsJjcWfpZx42t4RSAQ",
    "payment_link": null,
    "profile_id": "pro_5ISBXpW5YSlAJEOrV1ZB",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_cd2dkyRmkFqrGVTgwuB8",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-06-19T12:52:09.192Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "128.0.0.1",
        "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": null,
    "payment_method_status": null,
    "updated": "2025-06-19T12:39:00.329Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": "test_ord",
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null
}
  1. When payment_id is passed in req but more than 18 characters long

cURL:

curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_1j0NkPcENkwRgoYqQzrOiEsU38uMF5Q9ckG2grssx6Rz3gZy7Boqo4u5wP4usVkZ' \
--header 'Cookie: PHPSESSID=0b47db9d7de94c37b6b272087a9f2fa7' \
--data-raw '{
    "amount": 3545,
    "currency": "EUR",
    "payment_id": "vfehfbjhbejfbjhrbfjhbgubh",
    "connector": ["nexixpay"],
    "amount_to_capture": 3545,
    "confirm": true,
    "profile_id": null,
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "authentication_type": "three_ds",
    "phone_country_code": "+1",
    "description": "Its my first payment request",
    "return_url": "https://google.com",
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_data": {
        "card": {
            "card_number": "4349940199004549",
            "card_exp_month": "12",
            "card_exp_year": "30",
            
            "card_cvc": "396"
        }
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "12222",
            "country": "US",
            "first_name": "joseph",
            "last_name": "jj"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "[email protected]"
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "11111",
            "country": "US",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "[email protected]"
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "order_details": [
        {
            "product_name": "Apple iphone 15",
            "quantity": 1,
            "amount": 3545,
            "account_name": "transaction_processing"
        }
    ],
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    },
    "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": "128.0.0.1"
    },
    "customer_acceptance": {
        "acceptance_type": "offline",
        "accepted_at": "1963-05-03T04:07:52.723Z",
        "online": {
            "ip_address": "125.0.0.1",
            "user_agent": "amet irure esse"
        }
    },
    "connector_metadata": {
        "noon": {
            "order_category": "pay"
        }
    },
    "payment_link": false,
    "payment_link_config": {
        "theme": "",
        "logo": "",
        "seller_name": "",
        "sdk_layout": "",
        "display_sdk_only": false,
        "enabled_saved_payment_method": false
    },
    "payment_type": "normal",
    "request_incremental_authorization": false,
    "merchant_order_reference_id": "test_ord",
    "session_expiry": 900
}'

Response:

{
    "error": {
        "type": "invalid_request",
        "message": "Connector 'Nexixpay' rejected field 'payment_id': length 25 exceeds maximum of 18",
        "code": "IR_47",
        "connector": "Nexixpay"
    }
}
  1. When payment_id is passed in req but <=18 characters

cURL:

curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_1j0NkPcENkwRgoYqQzrOiEsU38uMF5Q9ckG2grssx6Rz3gZy7Boqo4u5wP4usVkZ' \
--header 'Cookie: PHPSESSID=0b47db9d7de94c37b6b272087a9f2fa7' \
--data-raw '{
    "amount": 3545,
    "currency": "EUR",
    "payment_id": "bfjfbjbfb",
    "connector": ["nexixpay"],
    "amount_to_capture": 3545,
    "confirm": true,
    "profile_id": null,
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "authentication_type": "three_ds",
    "phone_country_code": "+1",
    "description": "Its my first payment request",
    "return_url": "https://google.com",
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_data": {
        "card": {
            "card_number": "4349940199004549",
            "card_exp_month": "12",
            "card_exp_year": "30",
            
            "card_cvc": "396"
        }
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "12222",
            "country": "US",
            "first_name": "joseph",
            "last_name": "jj"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "[email protected]"
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "11111",
            "country": "US",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "[email protected]"
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "order_details": [
        {
            "product_name": "Apple iphone 15",
            "quantity": 1,
            "amount": 3545,
            "account_name": "transaction_processing"
        }
    ],
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    },
    "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": "128.0.0.1"
    },
    "customer_acceptance": {
        "acceptance_type": "offline",
        "accepted_at": "1963-05-03T04:07:52.723Z",
        "online": {
            "ip_address": "125.0.0.1",
            "user_agent": "amet irure esse"
        }
    },
    "connector_metadata": {
        "noon": {
            "order_category": "pay"
        }
    },
    "payment_link": false,
    "payment_link_config": {
        "theme": "",
        "logo": "",
        "seller_name": "",
        "sdk_layout": "",
        "display_sdk_only": false,
        "enabled_saved_payment_method": false
    },
    "payment_type": "normal",
    "request_incremental_authorization": false,
    "merchant_order_reference_id": "test_ord",
    "session_expiry": 900
}'

Response:

{
    "payment_id": "bfjfbjbfb",
    "merchant_id": "merchant_1750312579",
    "status": "succeeded",
    "amount": 3545,
    "net_amount": 3545,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 3545,
    "connector": "nexixpay",
    "client_secret": "bfjfbjbfb_secret_PcQel6k4KypGVCWRV5yI",
    "created": "2025-06-19T12:41:07.955Z",
    "currency": "EUR",
    "customer_id": null,
    "customer": {
        "id": null,
        "name": null,
        "email": null,
        "phone": null,
        "phone_country_code": "+1"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "attempts": [
        {
            "attempt_id": "bfjfbjbfb_1",
            "status": "charged",
            "amount": 3545,
            "order_tax_amount": null,
            "currency": "EUR",
            "connector": "nexixpay",
            "error_message": null,
            "payment_method": "card",
            "connector_transaction_id": "bfjfbjbfb",
            "capture_method": "automatic",
            "authentication_type": "three_ds",
            "created_at": "2025-06-19T12:41:07.955Z",
            "modified_at": "2025-06-19T12:42:05.311Z",
            "cancellation_reason": null,
            "mandate_id": null,
            "error_code": null,
            "payment_token": "token_Uxmz4D5Ic6wgrem8RA3o",
            "connector_metadata": {
                "psyncFlow": "Authorize",
                "cancelOperationId": null,
                "threeDSAuthResult": {
                    "authenticationValue": "AAcACYdiRwAAAA3Zl4FwdQAAAAA="
                },
                "captureOperationId": "394270169463351709",
                "threeDSAuthResponse": "notneeded",
                "authorizationOperationId": "394270169463351709"
            },
            "payment_experience": null,
            "payment_method_type": "credit",
            "reference_id": "bfjfbjbfb",
            "unified_code": null,
            "unified_message": null,
            "client_source": null,
            "client_version": 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": "4549",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "434994",
            "card_extended_bin": null,
            "card_exp_month": "12",
            "card_exp_year": "30",
            "card_holder_name": null,
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": "token_Uxmz4D5Ic6wgrem8RA3o",
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "11111",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "[email protected]"
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "12222",
            "state": "California",
            "first_name": "joseph",
            "last_name": "jj"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "[email protected]"
    },
    "order_details": [
        {
            "brand": null,
            "amount": 3545,
            "category": null,
            "quantity": 1,
            "tax_rate": null,
            "product_id": null,
            "product_name": "Apple iphone 15",
            "product_type": null,
            "sub_category": null,
            "product_img_link": null,
            "product_tax_code": null,
            "total_tax_amount": null,
            "requires_shipping": null
        }
    ],
    "email": null,
    "name": null,
    "phone": null,
    "return_url": "https://google.com/",
    "authentication_type": "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": "credit",
    "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": "bfjfbjbfb",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2019-09-10T10:11:12Z",
        "new_customer": "true"
    },
    "connector_metadata": {
        "apple_pay": null,
        "airwallex": null,
        "noon": {
            "order_category": "pay"
        },
        "braintree": null,
        "adyen": null
    },
    "feature_metadata": null,
    "reference_id": "bfjfbjbfb",
    "payment_link": null,
    "profile_id": "pro_5ISBXpW5YSlAJEOrV1ZB",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_cd2dkyRmkFqrGVTgwuB8",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-06-19T12:56:07.955Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "128.0.0.1",
        "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": null,
    "payment_method_status": null,
    "updated": "2025-06-19T12:42:05.311Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": "test_ord",
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null
}
  1. If any of these fields cross the max character count in NexiXpay - name/description/cardHolderName/address anything

cURL:

(Made zip code more than 16 characters long)

curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_mvLFyyA12S0xyM9HuE5yadwP4wiDas1Upq1C39wZXXHEqhiq538nbRA3O6OVbokW' \
--header 'Cookie: PHPSESSID=0b47db9d7de94c37b6b272087a9f2fa7' \
--data-raw '{
    "amount": 3545,
    "payment_id": "jfjessjjfbjkbf",
    "currency": "EUR",
    "connector": ["nexixpay"],
    "amount_to_capture": 3545,
    "confirm": true,
    "profile_id": null,
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "authentication_type": "three_ds",
    "phone_country_code": "+1",
    "description": "Its my first payment request",
    "return_url": "https://google.com",
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_data": {
        "card": {
            "card_number": "4349940199004549",
            "card_exp_month": "12",
            "card_exp_year": "30",
            
            "card_cvc": "396"
        }
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "12222",
            "country": "US",
            "first_name": "joseph",
            "last_name": "jj"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "[email protected]"
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "777788888888888888888888888888",
            "country": "US",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "[email protected]"
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "order_details": [
        {
            "product_name": "Apple iphone 15",
            "quantity": 1,
            "amount": 3545,
            "account_name": "transaction_processing"
        }
    ],
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    },
    "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": "128.0.0.1"
    },
    "customer_acceptance": {
        "acceptance_type": "offline",
        "accepted_at": "1963-05-03T04:07:52.723Z",
        "online": {
            "ip_address": "125.0.0.1",
            "user_agent": "amet irure esse"
        }
    },
    "connector_metadata": {
        "noon": {
            "order_category": "pay"
        }
    },
    "payment_link": false,
    "payment_link_config": {
        "theme": "",
        "logo": "",
        "seller_name": "",
        "sdk_layout": "",
        "display_sdk_only": false,
        "enabled_saved_payment_method": false
    },
    "payment_type": "normal",
    "request_incremental_authorization": false,
    "merchant_order_reference_id": "test_ord",
    "session_expiry": 900
}'

Response:

{
    "error": {
        "type": "invalid_request",
        "message": "Connector 'Nexixpay' rejected field 'shipping.address.zip': length 30 exceeds maximum of 16",
        "code": "IR_47",
        "connector": "Nexixpay"
    }
}

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

@bsayak03 bsayak03 requested a review from a team as a code owner June 13, 2025 11:28
Copy link

semanticdiff-com bot commented Jun 13, 2025

@bsayak03 bsayak03 self-assigned this Jun 13, 2025
@bsayak03 bsayak03 changed the title fix(connector): [NEXIXPAY] Limit OrderId length to 18 characters fix(connector): [NEXIXPAY] Limit OrderId Length to 18 Characters Jun 13, 2025
Copy link
Contributor

@deepanshu-iiitu deepanshu-iiitu left a comment

Choose a reason for hiding this comment

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

Please add test case where the payment id is passed explicitly in the payment request and the length of payment id is more than 18

@bsayak03 bsayak03 requested review from a team as code owners June 16, 2025 11:38
@bsayak03 bsayak03 changed the title fix(connector): [NEXIXPAY] Limit OrderId Length to 18 Characters fix(connector): [NEXIXPAY] Add Validation Checks for Request Fields Jun 16, 2025
sahkal
sahkal previously approved these changes Jun 16, 2025
Comment on lines 499 to 501
} else {
get_random_string()
};
Copy link
Contributor

Choose a reason for hiding this comment

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

We need to throw a validation error here, and all other places

We should not send a random orderId which is not stored in HS

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Alright

Comment on lines 52 to 54
fn get_random_string() -> String {
Alphanumeric.sample_string(&mut rand::thread_rng(), MAX_ORDER_ID_LENGTH)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed

if val.clone().expose().len() > MAX_BILLING_ADDRESS_NAME_LENGTH {
return Err(error_stack::Report::from(
errors::ConnectorError::MaxFieldLengthViolated {
field_name: "Billing Name".to_string(),
Copy link
Contributor

Choose a reason for hiding this comment

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

nit - better to add the field path here - which corresponds to Nexi's request

so something like address.billing.name depending on the field

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Alright

@bsayak03 bsayak03 requested a review from a team as a code owner June 16, 2025 14:57
amount: item.amount.clone(),
currency: item.router_data.request.currency,
description: item.router_data.description.clone(),
description: item.router_data.description.clone(), //check for description length already in core
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: remove comment or address the validation

kashif-m
kashif-m previously approved these changes Jun 16, 2025
Chethan-rao
Chethan-rao previously approved these changes Jun 17, 2025
sahkal
sahkal previously approved these changes Jun 17, 2025
kashif-m
kashif-m previously approved these changes Jun 17, 2025
@bsayak03 bsayak03 dismissed stale reviews from kashif-m and sahkal via 1c3a43d June 19, 2025 08:53
@bsayak03 bsayak03 dismissed stale reviews from Chethan-rao and deepanshu-iiitu via 1c3a43d June 19, 2025 08:53
kashif-m
kashif-m previously approved these changes Jun 19, 2025
sahkal
sahkal previously approved these changes Jun 19, 2025
Chethan-rao
Chethan-rao previously approved these changes Jun 20, 2025
@Gnanasundari24 Gnanasundari24 enabled auto-merge June 23, 2025 07:25
@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue Jun 23, 2025
Merged via the queue into main with commit 6fd7626 Jun 23, 2025
16 of 20 checks passed
@Gnanasundari24 Gnanasundari24 deleted the orderId/fix/nexixpay branch June 23, 2025 10:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants