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

Add metadata field to Card #786

Merged
merged 1 commit into from
Jan 30, 2019
Merged

Add metadata field to Card #786

merged 1 commit into from
Jan 30, 2019

Conversation

mshafrir-stripe
Copy link
Collaborator

Summary
metadata is a field that exists on several Stripe objects. For this
patch, it will only be enabled for Card-based Source objects.

Setting metadata on a Card will ultimately populate the metadata
field in SourceParams via SourceParams#createCardParams, which is
passed along with the request to create a Card-based Source.

See https://stripe.com/docs/api/metadata

This patch also does cleanup on some of the related classes (e.g.
make variables final, add nullity annotations)

Motivation
Being able to set metadata is a user-requested feature. Most of
the wiring was in place to support it, the user just needed a way
to set it on a Card.

Testing

  • Added automated tests.
  • In the example app, added metadata to the Card used in
    PaymentMultilineActivity#saveCard. Confirmed using the
    Dashboard's Logs feature that the metadata was included
    in the request and returned in the response.

Fixes #472

**Summary**
`metadata` is a field that exists on several Stripe objects. For this
patch, it will only be enabled for Card-based `Source` objects.

Setting `metadata` on a `Card` will ultimately populate the `metadata`
field in `SourceParams` via `SourceParams#createCardParams`, which is
passed along with the request to create a card-based `Source`.

See https://stripe.com/docs/api/metadata

This patch also does cleanup on some of the related classes (e.g.
make variables final, add nullity annotations)

**Motivation**
Being able to set `metadata` is a user-requested feature. Most of
the wiring was in place to support it, the user just needed a way
to set it on a `Card`.

**Testing**
- Added automated tests.
- In the example app, added metadata to the `Card` used in
  `PaymentMultilineActivity#saveCard`. Confirmed using the
  Dashboard's Logs feature that the metadata was included
  in the request and returned in the response.

Fixes #472
Copy link
Contributor

@csabol-stripe csabol-stripe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mshafrir-stripe mshafrir-stripe merged commit 7110e53 into master Jan 30, 2019
@mshafrir-stripe mshafrir-stripe deleted the metadata branch January 30, 2019 01:36
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.

3 participants