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 passing level III data when creating a charge #1216

Merged
merged 2 commits into from
Jun 29, 2018

Conversation

remi-stripe
Copy link
Contributor

r? @ob-stripe
cc @stripe/api-libraries
cc @fred-stripe


namespace Stripe.Infrastructure.Middleware
{
internal class ChargeLevel3Plugin : IParserPlugin
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We really should revisit how plugins work. It's all copy/pasta for the sake of adding one list of items. There has to be a better way

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed. I took a stab at this in #1218.


namespace Stripe
{
public class StripeChargeLevel3LineItemOptions : INestedOptions
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I still don't understand when something should be called Options versus Option.

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 it should always be Options.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah that would work. I thought that we started using Option for nested ones to differentiate them from the top-level ones.

{
public class StripeChargeLevel3Options : INestedOptions
{
[JsonProperty("level3[merchant_reference]")]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This works but since the parent has JsonProperty(level3) why isn't it passed to the lower level and you have to repeat it? The same happened to shipping.

/// </summary>
// this will actually send `line_items`. this is to flag it for the middleware
// to process it as a plugin
[JsonProperty("charge_level3_line_items_array")]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This hack makes me sad each time I have to use it (and grep to find it again).

@remi-stripe remi-stripe changed the title Add support for passing level III data when creating a charge [WIP] Add support for passing level III data when creating a charge Jun 24, 2018
@remi-stripe
Copy link
Contributor Author

changed to [WIP] as this requires changes to the Charge ressource too but those are behind a gate

@remi-stripe remi-stripe changed the title [WIP] Add support for passing level III data when creating a charge Add support for passing level III data when creating a charge Jun 24, 2018
@remi-stripe
Copy link
Contributor Author

Okay pushed a new version that can handle the returned level3 hash on the Charge object. This is gated though so I could not push tests for it but I did test locally.

@ob-stripe ob-stripe merged commit 8867e22 into master Jun 29, 2018
@ob-stripe ob-stripe deleted the remi-add-level3 branch June 29, 2018 15:24
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.

2 participants