Skip to content

Conversation

@aritro2002
Copy link
Contributor

@aritro2002 aritro2002 commented Oct 31, 2025

Type of Change

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

Description

Fixed incorrect billing first name and last name population, along with related UI issues.
Issues ->

  1. first_name and last_name are set different values, but while making confirm calls both are getting same values.
  2. if first_name is set and other required fields too, and last_name is null then no billing field rendered. But still billing details header is appearing.

How did you test it?

assume except first_name and last_name all fields are set.

case 1: first_name: Doest, last_name: John
image
image
image

case 2: 'first_nameandlast_nameboth arenull`
image
image
image
image
image
image
image

case 3a: first_name: Doest is last_name is null, interac (first_name and last_name is required)
image
image
image
image

case 3b: first_name: Doest is last_name is null, sepa (first_name is required)
image

case 4a: first_name: null is last_name : John, interac (first_name and last_name is required)
image
image
image
image
image

case 4b: first_name: null is last_name : John, sepa (first_name is required)
image

Checklist

  • I ran npm run re:build
  • I reviewed submitted code
  • I added unit tests for my changes where possible

@aritro2002 aritro2002 self-assigned this Oct 31, 2025
@aritro2002 aritro2002 added the Ready for Review PR with label Ready for Review should only be reviewed. label Oct 31, 2025
@semanticdiff-com
Copy link

Review changes with  SemanticDiff

@github-actions
Copy link
Contributor

🚫 Missing Linked Issue

Hi 👋 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

  • Add a keyword like Fixes #123 or Closes #456 to your PR description or a commit message.
  • Or link it manually using the "Linked issues" panel in the PR sidebar.

Tip: You can link multiple issues.
🚫 Note: If only one issue is linked, it must be open for this check to pass.

Once linked, this check will pass automatically on your next push or when you re-run the workflow.

Thanks for helping maintainers! 🙌

@github-actions
Copy link
Contributor

github-actions bot commented Nov 3, 2025

🚫 Missing Linked Issue

Hi 👋 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

  • Add a keyword like Fixes #123 or Closes #456 to your PR description or a commit message.
  • Or link it manually using the "Linked issues" panel in the PR sidebar.

Tip: You can link multiple issues.
🚫 Note: If only one issue is linked, it must be open for this check to pass.

Once linked, this check will pass automatically on your next push or when you re-run the workflow.

Thanks for helping maintainers! 🙌

{renderHeader(localeString.billingDetailsText, true)}
<div className=contentSubHeaderClasses>
{React.string(localeString.formSubheaderBillingDetailsText)}
{incompleteAddressFieldsCount == 0
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, we can

Copy link
Contributor

@kashif-m kashif-m left a 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

@github-actions
Copy link
Contributor

github-actions bot commented Nov 4, 2025

🚫 Missing Linked Issue

Hi 👋 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

  • Add a keyword like Fixes #123 or Closes #456 to your PR description or a commit message.
  • Or link it manually using the "Linked issues" panel in the PR sidebar.

Tip: You can link multiple issues.
🚫 Note: If only one issue is linked, it must be open for this check to pass.

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
@github-actions
Copy link
Contributor

github-actions bot commented Nov 4, 2025

🚫 Missing Linked Issue

Hi 👋 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

  • Add a keyword like Fixes #123 or Closes #456 to your PR description or a commit message.
  • Or link it manually using the "Linked issues" panel in the PR sidebar.

Tip: You can link multiple issues.
🚫 Note: If only one issue is linked, it must be open for this check to pass.

Once linked, this check will pass automatically on your next push or when you re-run the workflow.

Thanks for helping maintainers! 🙌

@github-actions
Copy link
Contributor

github-actions bot commented Nov 4, 2025

🚫 Missing Linked Issue

Hi 👋 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

  • Add a keyword like Fixes #123 or Closes #456 to your PR description or a commit message.
  • Or link it manually using the "Linked issues" panel in the PR sidebar.

Tip: You can link multiple issues.
🚫 Note: If only one issue is linked, it must be open for this check to pass.

Once linked, this check will pass automatically on your next push or when you re-run the workflow.

Thanks for helping maintainers! 🙌

Comment on lines +932 to +961
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)
}
Copy link
Contributor

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?

Copy link
Contributor Author

@aritro2002 aritro2002 Nov 6, 2025

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.

pattern
/>
}
let checkIfLastNameRequiredAndNone = (addressFields: array<dynamicFieldForAddress>) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
let checkIfLastNameRequiredAndNone = (addressFields: array<dynamicFieldForAddress>) => {
let checkIfNameRequired = (addressFields: array<dynamicFieldForAddress>) => {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

}
}

let getErrorStringAndClasses = (field: dynamicFieldType) => {
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Ready for Review PR with label Ready for Review should only be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: billing dynamic correction payouts

3 participants