fix(connector): [NEXIXPAY] Add Validation Checks for Request Fields#8345
Merged
Gnanasundari24 merged 9 commits intomainfrom Jun 23, 2025
Merged
fix(connector): [NEXIXPAY] Add Validation Checks for Request Fields#8345Gnanasundari24 merged 9 commits intomainfrom
Gnanasundari24 merged 9 commits intomainfrom
Conversation
Changed Files
|
deepanshu-iiitu
previously approved these changes
Jun 13, 2025
Contributor
deepanshu-iiitu
left a comment
There was a problem hiding this comment.
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
sahkal
previously approved these changes
Jun 16, 2025
kashif-m
reviewed
Jun 16, 2025
Comment on lines
+499
to
+501
| } else { | ||
| get_random_string() | ||
| }; |
Contributor
There was a problem hiding this comment.
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
kashif-m
requested changes
Jun 16, 2025
Comment on lines
+52
to
+54
| fn get_random_string() -> String { | ||
| Alphanumeric.sample_string(&mut rand::thread_rng(), MAX_ORDER_ID_LENGTH) | ||
| } |
| 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(), |
Contributor
There was a problem hiding this comment.
nit - better to add the field path here - which corresponds to Nexi's request
so something like address.billing.name depending on the field
kashif-m
reviewed
Jun 16, 2025
| 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 |
Contributor
There was a problem hiding this comment.
nit: remove comment or address the validation
kashif-m
previously approved these changes
Jun 16, 2025
deepanshu-iiitu
previously approved these changes
Jun 17, 2025
Chethan-rao
previously approved these changes
Jun 17, 2025
sahkal
previously approved these changes
Jun 17, 2025
kashif-m
previously approved these changes
Jun 17, 2025
1c3a43d
kashif-m
previously approved these changes
Jun 19, 2025
sahkal
previously approved these changes
Jun 19, 2025
deepanshu-iiitu
previously approved these changes
Jun 20, 2025
Chethan-rao
previously approved these changes
Jun 20, 2025
295192e
kashif-m
approved these changes
Jun 23, 2025
deepanshu-iiitu
approved these changes
Jun 23, 2025
sahkal
approved these changes
Jun 23, 2025
Chethan-rao
approved these changes
Jun 23, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type of Change
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
Motivation and Context
https://developer.nexi.it/en/api/post-orders-3steps-payment

How did you test it?
Nexixpay Payments - Create
payment_idis not passed in req (doesn't throw any error but creates a new string to map it withorderIdbecause when HS createspayment_idit is always > 18 characters) :cURL:
Upon confirming the payment and doing a PSync, we get this
Response:
payment_idis passed in req but more than 18 characters longcURL:
Response:
payment_idis passed in req but <=18 characterscURL:
Response:
name/description/cardHolderName/addressanythingcURL:
(Made
zipcode more than 16 characters long)Response:
Checklist
cargo +nightly fmt --allcargo clippy