Skip to content

Commit

Permalink
adds payment lastname length guard
Browse files Browse the repository at this point in the history
  • Loading branch information
seesjays committed Jan 23, 2025
1 parent 1d15c8c commit ed25c94
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/api/routes/payment.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,10 @@ router.post(
paymentDetails = {
...paymentDetails,
firstName: customer.name ? customer.name.split(' ')[0] : null,
lastName: customer.name
? customer.name.split(' ').slice(1).join(' ')
: '',
lastName:
customer.name && customer.name.split(' ').length > 1
? customer.name.split(' ').slice(1).join(' ')
: '',
email: customer.email,
phone: customer.phone,
};
Expand Down

0 comments on commit ed25c94

Please sign in to comment.