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

Fix invalid JSON error when deleting Card from Customer #992

Merged
merged 3 commits into from
Jul 13, 2018

Commits on Jul 11, 2018

  1. Fix completion block type in STPCustomerContextTest

    This did not have a functional impact on the testing, but it sure was misleading
    while reading through the code.
    danj-stripe committed Jul 11, 2018
    Configuration menu
    Copy the full SHA
    a522953 View commit details
    Browse the repository at this point in the history

Commits on Jul 12, 2018

  1. Add STPGenericStripeObject to represent a minimal, generic object.

    Some of the Stripe APIs, notably https://stripe.com/docs/api#delete_card return an
    almost empty object. The parsing code needs to be able to parse an object out of the
    response, otherwise it considers it failed.
    
    This is an object that should be parseable from any successful response. It's pretty
    useless otherwise.
    danj-stripe committed Jul 12, 2018
    Configuration menu
    Copy the full SHA
    02ef56f View commit details
    Browse the repository at this point in the history
  2. Change completion block type of private API `deleteSource:fromCustome…

    …rUsingKey:completion:`
    
    When deleting a `Card`, the returned JSON does not have all the required fields for a
    `STPCard` - it only has `id` and `deleted`.
    When deleting/detaching a `Source`, the returned JSON *is* a decodable `Source` (and does
    not have a `deleted` field).
    
    Using `STPGenericStripeObject` as the deserializer, because it's the only thing that'll
    work for this method. We cannot use multiple deserializers, because the parsing code relies
    on the `object` field to pick the correct deserializer, and deleted Cards don't have an
    `object`.
    
    Since the `STPGenericStripeObject` is *not* interesting (the caller already has the id, it
    was the first argument to this method), just using `STPErrorBlock` as the completion.
    danj-stripe committed Jul 12, 2018
    Configuration menu
    Copy the full SHA
    155ab8d View commit details
    Browse the repository at this point in the history