Skip to content

Commit ed25c94

Browse files
committed
adds payment lastname length guard
1 parent 1d15c8c commit ed25c94

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/api/routes/payment.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,9 +211,10 @@ router.post(
211211
paymentDetails = {
212212
...paymentDetails,
213213
firstName: customer.name ? customer.name.split(' ')[0] : null,
214-
lastName: customer.name
215-
? customer.name.split(' ').slice(1).join(' ')
216-
: '',
214+
lastName:
215+
customer.name && customer.name.split(' ').length > 1
216+
? customer.name.split(' ').slice(1).join(' ')
217+
: '',
217218
email: customer.email,
218219
phone: customer.phone,
219220
};

0 commit comments

Comments
 (0)