-
-
Notifications
You must be signed in to change notification settings - Fork 76
On PayPal payment user shipping address gets set with uncorrect firstname and lastname values if they contain a space #226
Comments
Closes solidusio#226. When PayPal sends the authorization response to the server, it format the address with a single field the first name and the last name, `recipientName`. We can’t safely infer the first name and the last name from that field (see solidusio#226), so we have to skip the user address updating. The good news is that the user address updating in this case is redundant, since Solidus always requires the address to be set before the payment happens, and such address is sent to PayPal with the `shippingAddressEditable` configuration set to `false`, so the address is necessarily the same as the one stored anyway.
Closes solidusio#226. When PayPal sends the authorization response to the server, it format the address with a single field for the first name and the last name, `recipientName`. We can’t safely infer the first name and the last name from that field (see solidusio#226), so we have to skip the user address updating. The good news is that the user address updating in this case is redundant, since Solidus always requires the address to be set before the payment happens, and such address is sent to PayPal with the `shippingAddressEditable` configuration set to `false`, so the address is necessarily the same as the one stored anyway.
A common issue I am very well aware of personally ;) Solidus removed the presence validation of Until then we should just store the full name as |
@tvdeyen thank you for the information! so you would suggest to save |
Closes solidusio#226. When PayPal sends the authorization response to the server, it format the address with a single field for the first name and the last name, `recipientName`. We can’t safely infer the first name and the last name from that field (see solidusio#226), so we have to skip the user address updating. The good news is that the user address updating in this case is redundant, since Solidus always requires the address to be set before the payment happens, and such address is sent to PayPal with the `shippingAddressEditable` configuration set to `false`, so the address is necessarily the same as the one stored anyway.
Yes
|
What about using https://github.com/basecamp/name_of_person instead? |
From the README
🤷♂️ |
@tvdeyen Yeah, you are right, nevermind... I'm ok with storing everything in the |
When a user pays with Braintree PayPal (vault flow), the authorization callback gets parsed by the JavaScript code, and then submitted to server. The PayPal authorization callback provides the shipping address with a single field for the user lastname and firstname,
recipientName
. The client side code tries to infer the firstname and the lastname splitting thisrecipientName
by space:solidus_paypal_braintree/app/assets/javascripts/solidus_paypal_braintree/paypal_button.js
Lines 125 to 126 in 73e9a69
The problem is that, if your name is for example
Maurizio De Santis
, the lastname will be set toMaurizio
and the lastname toDe
, discarding the rest.What's really wrong to me is that after that this shipping address value is submitted to the server, which updates the shipping address thus setting wrong values. But with the Braintree PayPal vault flow you can't change the shipping address via PayPal, so it's redundant to update it after the authorization call with the values that PayPal provides: the shipping address is the one that is already present on the server.
The text was updated successfully, but these errors were encountered: