Skip to content
This repository has been archived by the owner on Apr 14, 2023. It is now read-only.

receiptName gets first and last name fields when user has only first name #302

Open
Azeem838 opened this issue Nov 22, 2021 · 1 comment

Comments

@Azeem838
Copy link

When the user only inputs their first name in the address name field then the user's first and last names will get added to the recipientName here.

The issue is that these firstname and lastname methods always return a string and are not checking if a last_name actually exists.

Example:
The user enters "John" as their name on the address field.
The recipientName will be "John John"

RyanofWoods added a commit to RyanofWoods/solidus-solidus_paypal_braintree that referenced this issue Dec 1, 2021
Fixes issue solidusio#302

In the case that:
- SolidusSupport::combined_first_and_last_name_in_address returns true;
- Spree::Address::Name is not defined; and
- the given name argument to self.split_name is just one word (e.g
  "Bruce")

Then it would return the array of one element such as ['Bruce'].

lastname was assuming that there should be two elements and was calling
.last on the array, resulting in the same word as firstname. This made
the recipientName for example be "Bruce Bruce".
https://github.com/solidusio/solidus_paypal_braintree/blob/819bd3467e6f0c8ead8d855138ba88e10eb80a18/app/models/solidus_paypal_braintree/address.rb#L35

The #fullname method was added to fix the problem that if the given name
was only one word, then recipientName won't attempt to add a space
between the firstname and lastname's returned empty string. Otherwise,
it would cause for example: "Bruce ".
@stale
Copy link

stale bot commented Nov 11, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Nov 11, 2022
@gsmendoza gsmendoza removed the wontfix label Nov 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants