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 support for the PaymentMethod resource #1541

Merged
merged 1 commit into from
Mar 19, 2019

Conversation

remi-stripe
Copy link
Contributor

cc @stripe/api-libraries

@remi-stripe remi-stripe force-pushed the remi-add-payment-methods branch 4 times, most recently from 841a1c4 to 74d42f9 Compare March 14, 2019 05:16
@@ -23,6 +23,12 @@ public class PaymentIntentLastPaymentError : StripeEntity
[JsonProperty("param")]
public string Param { get; set; }

[JsonProperty("payment_intent")]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should we fix this to be a StripeError instead and release as a major version?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd say yes.

Copy link
Contributor

Choose a reason for hiding this comment

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

(Although maybe just bundle this with the next release for the new API version?)

@remi-stripe remi-stripe force-pushed the remi-add-payment-methods branch 3 times, most recently from b88030d to f29ab65 Compare March 16, 2019 03:57
{ "key", "value" },
},
}
SourceToken = "btok_123",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

openapi is now failing because this can only be a string instead of a hash. It used to work and I think it's related to some recent changes that @mickjermsurawong-stripe did for stripe-java.

Ultimately it's likely okay to just pass a string here, the library is already well-tested in general

Choose a reason for hiding this comment

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

Ah sorry, I didn't foresee it would fail current library tests. Yup, it is my work on typed params to make public spec for these params only taking String as an attempt to limit non-PCI compliant users from accidentally passing in raw PAN data. So as I understand, we want to make this enforcement on in the client lib too, so passing String here would be okay.

Just a side note: on live request OpenAPI validation, we skipped validation on these undocumented polymorphic param so we won't see false rate of validation failure. (Additionally, there's no sever side effect because its' OpenAPI)

Currency = "usd",
RoutingNumber = "110000000",
}
ExternalAccountTokenId = "btok_123",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

same as above, cc @mickjermsurawong-stripe

Choose a reason for hiding this comment

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

Ack, yup it applies to external account to. The only old endpoint that takes full hash is the token creation params that takes full card/bank account

@remi-stripe remi-stripe force-pushed the remi-add-payment-methods branch from f29ab65 to 7d58b4d Compare March 16, 2019 04:11
@remi-stripe remi-stripe force-pushed the remi-add-payment-methods branch 2 times, most recently from 46363aa to 3b9910a Compare March 16, 2019 04:43
@remi-stripe
Copy link
Contributor Author

Okay this is now supposed to be feature complete and ready for review. r? @ob-stripe

@remi-stripe remi-stripe force-pushed the remi-add-payment-methods branch 2 times, most recently from 7a72407 to d93329d Compare March 17, 2019 23:18
Copy link

@mickjermsurawong-stripe mickjermsurawong-stripe left a comment

Choose a reason for hiding this comment

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

Since I reviewed stripe-java against the autogen for schema correctness, it might be easier for me to review stripe-dotnet here too. I reviewed both resource and params here.

public string Fingerprint { get; set; }

[JsonProperty("routing_number")]
public string RoutingNumber { get; set; }

Choose a reason for hiding this comment

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

nit: last4 should come before routing_number alphabetically?

public class ChargePaymentMethodDetailsCardThreeDSecure : StripeEntity
{
[JsonProperty("supported")]
public bool Supported { get; set; }

Choose a reason for hiding this comment

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

I think it should be empty class here. The "supported" field is correctly present in PaymentMethodCardThreeDSecureUsage though.

public string Bic { get; set; }

[JsonProperty("verified_name")]
public string VerifiedName { get; set; }

Choose a reason for hiding this comment

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

I think we got the schema from Giropay above instead. Ideal should have iban_last4 and bank

public class PaymentMethodUpdateOptions : BaseOptions
{
[JsonProperty("metadata")]
public Dictionary<string, string> Metadata { get; set; }

Choose a reason for hiding this comment

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

I compare with autogen params, and we seem to allow updating card and billing details too..
Maybe we don't want this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nice catch, forgot to fix that one. cc @ob-stripe Are we okay having a nested option have names such as PaymentMethodCardCreateOptions and PaymentMethodCardUpdateOptions?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think that's fine. I assume most users rely on Intellisense to discover classes anyway.

@remi-stripe remi-stripe force-pushed the remi-add-payment-methods branch from d93329d to 8936c9a Compare March 18, 2019 17:26
@remi-stripe
Copy link
Contributor Author

@mickjermsurawong-stripe Thanks for the thorough reviews and catching multiple mistakes here!

@mickjermsurawong-stripe

Thanks for the fix remi. The schema looks great to me!
I defer to @ob-stripe for the pending issue on the payment method update options.

Copy link
Contributor

@ob-stripe ob-stripe left a comment

Choose a reason for hiding this comment

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

Left a couple of comments. Also, don't forget to remove the spec and fixtures files and use the latest stripe-mock before merging to master.


[JsonProperty("stripe_account")]
public ChargePaymentMethodDetailsStripeAccount StripeAccount { get; set; }

Copy link
Contributor

Choose a reason for hiding this comment

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

type is missing.

public string Funding { get; set; }

[JsonProperty("generated_card")]
public string GeneratedCard { get; set; }
Copy link
Contributor

Choose a reason for hiding this comment

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

If this is an ID, this should be GeneratedCardId.

@@ -23,6 +23,12 @@ public class PaymentIntentLastPaymentError : StripeEntity
[JsonProperty("param")]
public string Param { get; set; }

[JsonProperty("payment_intent")]
Copy link
Contributor

Choose a reason for hiding this comment

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

(Although maybe just bundle this with the next release for the new API version?)

@remi-stripe remi-stripe force-pushed the remi-add-payment-methods branch 2 times, most recently from ca14631 to 07e4b2b Compare March 19, 2019 01:52
@remi-stripe remi-stripe force-pushed the remi-add-payment-methods branch from 07e4b2b to 1d8ea30 Compare March 19, 2019 02:26
@remi-stripe remi-stripe changed the title [WIP] Add support for the PaymentMethod resource Add support for the PaymentMethod resource Mar 19, 2019
@remi-stripe remi-stripe dismissed ob-stripe’s stale review March 19, 2019 02:31

fixed the issues

@remi-stripe remi-stripe merged commit 87ae809 into master Mar 19, 2019
@remi-stripe remi-stripe deleted the remi-add-payment-methods branch March 19, 2019 02:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants