Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot set name on Card #1106

Closed
Flo354 opened this issue Jun 13, 2019 · 7 comments · Fixed by #1108
Closed

Cannot set name on Card #1106

Flo354 opened this issue Jun 13, 2019 · 7 comments · Fixed by #1108
Assignees
Labels
triaged Issue has been reviewed by Stripe and is being tracked internally

Comments

@Flo354
Copy link

Flo354 commented Jun 13, 2019

Hi there,

Since I updated my SDK version from 8.X to 9.3.2, the method setName() on Card class does not exists anymore. Since the card is built with CardMultilineWidget, I can't set the name anymore.

How can I set the cardholder name without having to create an other instance of Card and set name in the builder?

Before:

CardMultilineWidget cardInputWidget = v.findViewById(R.id.card_input_widget);
//....

Card card = cardInputWidget.getCard()));
card.setName(cardHolderName);

Now:

CardMultilineWidget cardInputWidget = v.findViewById(R.id.card_input_widget);
//....

Card card = cardInputWidget.getCard()));
card = new Card.Builder(card.getNumber(), card.getExpMonth(), card.getExpYear(), card.getCVC())
                .name(name.getText().toString())
                .build();

Thanks,

@mshafrir-stripe mshafrir-stripe self-assigned this Jun 13, 2019
@mshafrir-stripe mshafrir-stripe added the triaged Issue has been reviewed by Stripe and is being tracked internally label Jun 13, 2019
mshafrir-stripe added a commit that referenced this issue Jun 13, 2019
@mshafrir-stripe
Copy link
Collaborator

@Flo354 sorry for the inconvenience caused by removing the setter. I put up a PR (#1108) that adds a Card#toBuilder() convenience method which you can use to add the name field.

@mshafrir
Copy link
Contributor

@Flo354 this is now available in 9.3.5

@Flo354
Copy link
Author

Flo354 commented Jul 11, 2019

Thanks for the update.

But one question, why don't you allow us to add the name instead of creating another object?
I am using the multiline widget and it gives a card (method getCard()). Why don't you give us a builder instead? It would avoid the creation of an object.

@mshafrir-stripe
Copy link
Collaborator

@Flo354 we're using immutable models where possible, but an alternative option would be to add a getCardBuilder() method to the widget so you can start with a Builder.

@Flo354
Copy link
Author

Flo354 commented Jul 11, 2019 via email

@mshafrir-stripe
Copy link
Collaborator

@Flo354 I added a getCardBuilder() method to the widgets in #1174

@Flo354
Copy link
Author

Flo354 commented Jul 12, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triaged Issue has been reviewed by Stripe and is being tracked internally
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants