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 signatures in InvoiceService and RefundService #1287

Merged
merged 3 commits into from
Sep 19, 2018

Conversation

ob-stripe
Copy link
Contributor

r? @remi-stripe
cc @stripe/api-libraries

Fixes signatures in InvoiceService and RefundService so that required parameters are passed in options classes rather than as their own arguments.

Also a bunch of cleanup:

  • organize fields / methods alphabetically
  • updated fields in UpcomingInvoiceOptions
  • added XML comments

Copy link
Contributor

@remi-stripe remi-stripe left a comment

Choose a reason for hiding this comment

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

A lot of comments that you will likely disgree with. Feel free to merge as is!

Really not a fan of the comments in the code. I think we should punt for now and revisit later once we figure out a way to automate that part maybe.

@@ -7,17 +7,33 @@

public class InvoiceCreateOptions : BaseOptions, ISupportMetadata
{
/// <summary>
/// A fee in cents that will be applied to the invoice and transferred to the application
/// owner’s Stripe account. The request must be made with an OAuth key or the Stripe-Account
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't like this comment at all. It mentions the OAuth key that we really don't want anyone to use in general. I know it's copied from the docs verbatim but I usually only take the first sentence if it has enough meaning.

@@ -23,38 +23,38 @@ public InvoiceService(string apiKey)

public bool ExpandSubscription { get; set; }

public virtual Invoice Get(string invoiceId, RequestOptions requestOptions = null)
public virtual Invoice Create(InvoiceCreateOptions createOptions = null, RequestOptions requestOptions = null)
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't understand why the options are optional. I guess it makes it easier for the service later but since the vast majority of create methods have required parameters it "feels" wrong.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, it's fixed.

/// </summary>
[JsonProperty("billing")]
public Billing? Billing { get; set; }

/// <summary>
/// The number of days from which the invoice is created until it is due. Only valid for invoices where billing=send_invoice.
/// REQUIRED
Copy link
Contributor

Choose a reason for hiding this comment

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

Not a fan of the REQUIRED part either

Requestor.GetString(
this.ApplyAllParameters(null, $"{Urls.Invoices}/{invoiceId}", false),
Requestor.PostString(
this.ApplyAllParameters(createOptions, Urls.Invoices, false),
Copy link
Contributor

Choose a reason for hiding this comment

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

Flagging for later, can we find a way to have the URL be an a class method/instance instead while we do that work of porting to the new services logic?

Copy link
Contributor

Choose a reason for hiding this comment

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

well noticing you did it for refund below

@ob-stripe
Copy link
Contributor Author

I think we should punt for now and revisit later once we figure out a way to automate that part maybe.

That's not going to happen anytime soon though, and in the meantime I think that having some comments is strictly better than having no comments at all.

@ob-stripe ob-stripe merged commit 4dac039 into remi-stripe-dotnet-major-version Sep 19, 2018
@ob-stripe ob-stripe deleted the ob-fix-signatures branch September 19, 2018 09:26
@ob-stripe ob-stripe mentioned this pull request Sep 21, 2018
32 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants