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

Correctly parse JSON when creating or deleting customer card source #857

Merged
merged 1 commit into from Apr 9, 2019

Conversation

mshafrir-stripe
Copy link
Collaborator

Summary

Both POST /v1/customers/:customer_id/sources and
DELETE /v1/customers/:customer_id/sources/:source_id return
a different shape depending on whether the object referenced by
:source_id is a Source or a Card. The current implementation
was not handling the Card case. The impact of this is that the
listener passed to either CustomerSession#addCustomerSource or
CustomerSession#deleteCustomerSource was not being called when
the source was a Card.

The short-term fix is to create a Source object and only populate
its id field. This is not ideal because we are creating a Source
with a card id, but it resolves the issue of the listener not being
called.

The long-term fix is to pass a StripePaymentSource to the
listener.

Motivation

ANDROID-344

Testing

Unit tests

Both `POST /v1/customers/:customer_id/sources` and
`DELETE /v1/customers/:customer_id/sources/:source_id` return
a different shape depending on whether the object referenced by
`:source_id` is a `Source` or a `Card`. The current implementation
was not handling the `Card` case. The impact of this is that the
listener passed to either `CustomerSession#addCustomerSource` or
`CustomerSession#deleteCustomerSource` was not being called when
the source was a `Card`.

The short-term fix is to create a `Source` object and only populate
its `id` field. This is not ideal because we are creating a `Source`
with a card id, but it resolves the issue of the listener not being
called.

The long-term fix is to pass a `StripePaymentSource` to the
listener.

ANDROID-344
@mshafrir-stripe mshafrir-stripe merged commit f3e65da into master Apr 9, 2019
@mshafrir-stripe mshafrir-stripe deleted the customer-card-json branch April 9, 2019 15:44
@jemerick-stripe jemerick-stripe mentioned this pull request Apr 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants