-
Notifications
You must be signed in to change notification settings - Fork 108
fix: billing dynamic correction payouts #1276
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
base: main
Are you sure you want to change the base?
Conversation
🚫 Missing Linked IssueHi 👋 This pull request does not appear to be linked to any open issue yet. Linking your PR to an issue helps keep the project tidy and ensures the issue is closed automatically. ✔️ How to fix this
Once linked, this check will pass automatically on your next push or when you re-run the workflow. Thanks for helping maintainers! 🙌 |
🚫 Missing Linked IssueHi 👋 This pull request does not appear to be linked to any open issue yet. Linking your PR to an issue helps keep the project tidy and ensures the issue is closed automatically. ✔️ How to fix this
Once linked, this check will pass automatically on your next push or when you re-run the workflow. Thanks for helping maintainers! 🙌 |
src/FormViewJourney.res
Outdated
| {renderHeader(localeString.billingDetailsText, true)} | ||
| <div className=contentSubHeaderClasses> | ||
| {React.string(localeString.formSubheaderBillingDetailsText)} | ||
| {incompleteAddressFieldsCount == 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we skip billing address screen in case nothing has to be entered?
For journey view - skip the billing address screen
For tabs view - don't render the billing address section
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we can
kashif-m
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Skip billing address screen / section if all fields are available
🚫 Missing Linked IssueHi 👋 This pull request does not appear to be linked to any open issue yet. Linking your PR to an issue helps keep the project tidy and ensures the issue is closed automatically. ✔️ How to fix this
Once linked, this check will pass automatically on your next push or when you re-run the workflow. Thanks for helping maintainers! 🙌 |
1 similar comment
🚫 Missing Linked IssueHi 👋 This pull request does not appear to be linked to any open issue yet. Linking your PR to an issue helps keep the project tidy and ensures the issue is closed automatically. ✔️ How to fix this
Once linked, this check will pass automatically on your next push or when you re-run the workflow. Thanks for helping maintainers! 🙌 |
🚫 Missing Linked IssueHi 👋 This pull request does not appear to be linked to any open issue yet. Linking your PR to an issue helps keep the project tidy and ensures the issue is closed automatically. ✔️ How to fix this
Once linked, this check will pass automatically on your next push or when you re-run the workflow. Thanks for helping maintainers! 🙌 |
494a61e to
d68a51a
Compare
d68a51a to
3036057
Compare
| let lastNameKey = BillingAddress(FullName(LastName)) | ||
| let info: dynamicFieldInfo = BillingAddress(dynamicFieldInfo) | ||
| let fieldKey = key->getPaymentMethodDataFieldKey | ||
| paymentMethodDataDict | ||
| ->Dict.get(fieldKey) | ||
| ->Option.map(value => { | ||
| let nameSplits = value->String.split(" ") | ||
| let lastName = | ||
| nameSplits | ||
| ->Array.slice(~start=1, ~end=nameSplits->Array.length) | ||
| ->Array.join(" ") | ||
| if lastName->String.length > 0 { | ||
| dataArr->Array.push((info, lastName)) | ||
| // Use first name as last name ? | ||
| } else { | ||
| nameSplits | ||
| ->Array.get(0) | ||
| ->Option.map( | ||
| firstName => { | ||
| dataArr->Array.push((info, firstName)) | ||
| }, | ||
| ) | ||
| let lastNameFieldKey = lastNameKey->getPaymentMethodDataFieldKey | ||
|
|
||
| // First try to get lastName from direct lastName field | ||
| let lastNameValue = paymentMethodDataDict->Dict.get(lastNameFieldKey) | ||
|
|
||
| switch lastNameValue { | ||
| | Some(lastName) if lastName->String.trim->String.length > 0 => { | ||
| dataArr->Array.push((info, lastName->String.trim)) | ||
| keys->Array.push(lastNameFieldKey) | ||
| } | ||
| | _ => { | ||
| // Fallback: split firstName field if lastName is empty | ||
| let firstNameKey = BillingAddress(FullName(FirstName)) | ||
| let firstNameFieldKey = firstNameKey->getPaymentMethodDataFieldKey | ||
| paymentMethodDataDict | ||
| ->Dict.get(firstNameFieldKey) | ||
| ->Option.map(value => { | ||
| let nameSplits = value->String.split(" ") | ||
| let lastName = | ||
| nameSplits | ||
| ->Array.slice(~start=1, ~end=nameSplits->Array.length) | ||
| ->Array.join(" ") | ||
| dataArr->Array.push((info, lastName)) | ||
| }) | ||
| ->ignore | ||
| keys->Array.push(lastNameFieldKey) | ||
| } | ||
| }) | ||
| ->ignore | ||
| keys->Array.push(fieldKey) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we invert this logic and check for FirstName first?
Any specific reason to check for lastName?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't invert the logic because suppose I have set first_name: "alex", last_name: "john", in create call, then it will send wrong names in confirm call. As it will check from the first name and will assign last name same as first name. Therefore, I am first checking with LastName.
src/CollectWidget.res
Outdated
| pattern | ||
| /> | ||
| } | ||
| let checkIfLastNameRequiredAndNone = (addressFields: array<dynamicFieldForAddress>) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| let checkIfLastNameRequiredAndNone = (addressFields: array<dynamicFieldForAddress>) => { | |
| let checkIfNameRequired = (addressFields: array<dynamicFieldForAddress>) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
src/CollectWidget.res
Outdated
| } | ||
| } | ||
|
|
||
| let getErrorStringAndClasses = (field: dynamicFieldType) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we move this to some utility file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Type of Change
Description
Fixed incorrect billing first name and last name population, along with related UI issues.
Issues ->
first_nameandlast_nameare set different values, but while making confirm calls both are getting same values.first_nameis set and other required fields too, andlast_nameisnullthen no billing field rendered. But still billing details header is appearing.How did you test it?
assume except
first_nameandlast_nameall fields are set.case 1:



first_name:Doest,last_name:Johncase 2: 'first_name







andlast_nameboth arenull`case 3a:




first_name:Doestislast_nameis null, interac (first_name and last_name is required)case 3b:

first_name:Doestislast_nameis null, sepa (first_name is required)case 4a:





first_name: null islast_name:John, interac (first_name and last_name is required)case 4b:

first_name: null islast_name:John, sepa (first_name is required)Checklist
npm run re:build