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

Renaming all properties, structs and methods to match the API naming #459

Closed
wants to merge 2 commits into from

Conversation

remi-stripe
Copy link
Contributor

@remi-stripe remi-stripe commented Sep 19, 2017

This PR ensures that all properties in the library matches the official API. Names are not shortened anymore making it easier to associated a given parameter to its API counterpart.

We can't list all the changes one by one as those are extensive but here are the ones likely to impact most integrations:

  • All properties with the word url in it now have the same case such as BusinessURL.
  • All properties with the word four in it now use a digit such as DynamicLast4 or SSNLast4.
  • Renamed confusing properties such as Account on BankAccount becoming AccountNumber to avoid confusing with its Connect counterpart which is now named Account instead of AccountID.
  • Properties such as MonthAnchor or constants such as Month are now renamed to match the corresponding parameter/value in the API MonthlyAnchor and Monthly.
  • Meta and Live have been renamed to Metadata and Livemode on all classes
  • Values on List objects has been renamed to Data
  • Some classes have been renamed.
    • Owner is now AdditionalOwner,
    • Transaction is now BalanceTransaction with all constants and corresponding classes renamed to match this
    • references to Tx were also replaced by BalanceTransaction in classes, properties and constants
    • Fee and FeeRefund have been renamed to ApplicationFee and ApplicationFeeRefund along with all related classes, properties and constants.
    • Sub has been renamed to Subscription along with all related classes, properties and constants.
  • Card parameters have been renamed such as City becoming AddressCity and Month becoming `ExpMonth.
  • Errors codes have been prefixed with ErrorCode such as ErrorCodeCardDeclined or ErrorCodeIncorrectZip.
  • Event properties are now named Object and PreviousAttributes and methods GetObjectValue() and GetPreviousValue().
  • Pagination properties have been renamed to StartingAfter, EndingBefore and HasMore.
  • AddMeta() has been renamed to AddMetadata(), Expand() to AddExpand()

@remi-stripe remi-stripe force-pushed the remi-rename-all-fields branch from 14eb36f to 264b7ec Compare September 19, 2017 23:47
@ob-stripe
Copy link
Contributor

We can see it touches a lot of fields and makes the PR hard to review because of identation.

Protip: you can add ?w=1 at the end of the URL to ignore whitespace changes.

https://github.com/stripe/stripe-go/pull/459/files?w=1

@remi-stripe remi-stripe force-pushed the remi-rename-all-fields branch from 1dc074e to eeaaa19 Compare October 7, 2017 13:56
@remi-stripe remi-stripe force-pushed the remi-rename-all-fields branch 2 times, most recently from 13f9942 to ca7110b Compare October 16, 2017 14:36
@brandur-stripe
Copy link
Contributor

Just to double-check: this one is all set for review right Remi?

@remi-stripe
Copy link
Contributor Author

@brandur-stripe Not quite yet. You wanted to fix the bool representation in the library first. There are also a few pending question I've shared with you internally.

@remi-stripe remi-stripe force-pushed the remi-rename-all-fields branch from 6d9985b to 88a3345 Compare October 17, 2017 20:15
@remi-stripe remi-stripe changed the title [WIP] Trying to rename fields to match their API names Renaming all properties, structs and methods to match the API naming Oct 19, 2017
@remi-stripe
Copy link
Contributor Author

@brandur-stripe I think this is ready to review. I will update the description to list all changes that we had in that library.

As discussed internally, I will separately open a PR that lets us move all bool in params structs to pointers.

@remi-stripe remi-stripe force-pushed the remi-rename-all-fields branch from 88a3345 to 5328d5d Compare October 19, 2017 19:08
@remi-stripe
Copy link
Contributor Author

Okay rebased on the latest master as a few things had changed.

dispute.go Outdated
URL string `json:"url"`
Created int64 `json:"created"`
ID string `json:"id"`
MimeType string `json:"mime_type"`
Copy link
Contributor

@brandur-stripe brandur-stripe Oct 20, 2017

Choose a reason for hiding this comment

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

Should we do MIMEType? (Multipurpose Internet Mail Extensions)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed!

invoiceitem.go Outdated
Period *Period `json:"period"`
Plan *Plan `json:"plan"`
Proration bool `json:"proration"`
Quantity int64 `json:"quantity"`
Sub string `json:"subscription"`
Subscription string `json:"subscription"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Since we're about to break it anyway, should we make Subscription expandable here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed!

Paid int64 `json:"paid"`
Returned int64 `json:"returned"`
Canceled int64 `json:"canceled"`
Fulfiled int64 `json:"fulfiled"`
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 we should leave this as Fulfilled and fix it server side at some point instead.

No point in cargo culting too hard.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmmm I have seen confusion in other libraries such as stripe/stripe-dotnet#1085 so I think it's worth matching the API instead of trying to write words differently in code than we do in the API. wdyt?

payout.go Outdated
Amount int64 `json:"amount"`
ArrivalDate int64 `json:"arrival_date"`
BalanceTransaction *BalanceTransaction `json:"balance_transaction"`
BankAccoun *BankAccount `json:"bank_account"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Typo here. Missing a "t" on the end.

subscription.go Outdated
@@ -0,0 +1,133 @@
package stripe
Copy link
Contributor

Choose a reason for hiding this comment

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

I see the rational here, but I wonder if we should leave this as sub.go so that you can always match the name of a Go file with the name of the corresponding package? (sub/)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed, I just renamed those back.

@brandur-stripe
Copy link
Contributor

Great work Remi. Can't wait for this to come in!

This is definitely going to be a little painful, but even so, probably time to rip the bandaid off. I left a few comments above, but otherwise LGTM.

@remi-stripe
Copy link
Contributor Author

@brandur-stripe Okay, I addressed all remaining comments I think. Can you let me know if you have any other feedback?

This one will have to be merged after we merge #507 into it but I think we can get this done this week!

payout.go Outdated
ArrivalDate int64 `json:"arrival_date"`
Automatic bool `json:"automatic"`
BalanceTransaction *BalanceTransaction `json:"balance_transaction"`
BankAccoun *BankAccount `json:"bank_account"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Misspelling: BankAccount.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ugh, nice catch, fixed.

Recipient *Recipient `json:"recipient"`
Reversals *ReversalList `json:"reversals"`
Reversed bool `json:"reversed"`
SourceTransation *BalanceTransactionSource `json:"source_transaction"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Misspelling: SourceTransaction.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ugh, nice catch, fixed.

@brandur-stripe
Copy link
Contributor

@remi-stripe Nice! I took one more pass; I can't guarantee I got everything, but only found some minor stuff. Otherwise, this LGTM.

@remi-stripe remi-stripe force-pushed the remi-rename-all-fields branch from e6af552 to b16e137 Compare February 10, 2018 20:22
@remi-stripe
Copy link
Contributor Author

Rebased on the latest master. I had to squash all commits into one readable long one because there were too many merge conflicts on small ones and it was easy to miss something and introduce a regression

@brandur-stripe
Copy link
Contributor

Rebased on the latest master. I had to squash all commits into one readable long one because there were too many merge conflicts on small ones and it was easy to miss something and introduce a regression

Nice Remi! What do you say that we try to do the work to get this merged ASAP early next week ... before you get too tired to continue this project ;)

I'm not sure if you had a particular timeline in mind, but it seems like we're going to have to pull the trigger on this at some point. We're also sitting at v29.* right now, and v30.* would be a nice round number of a big breaking change like this one :)

@remi-stripe
Copy link
Contributor Author

@brandur-stripe I'd love to do that. This can't be merged as is, there's the other PR waiting where I'm blocked for now though. It's unlikely to be cleaned up by early next week though and then I'm OOO for a bit.

@brandur-stripe
Copy link
Contributor

This can't be merged as is, there's the other PR waiting where I'm blocked for now though. It's unlikely to be cleaned up by early next week though and then I'm OOO for a bit.

Ah k :/ Well in that case let's just try to get it on the board as soon as we can.

@remi-stripe
Copy link
Contributor Author

I've had my eyes on version 30.0.0 for a while though so I'll try to get this done!

@remi-stripe remi-stripe force-pushed the remi-rename-all-fields branch from b16e137 to 324b82c Compare February 17, 2018 13:45
@kerak19
Copy link

kerak19 commented Mar 28, 2018

Hello. Any updates on this PR? Is there any approximate date when it will be merged?

@brandur-stripe
Copy link
Contributor

@kerak19 Sorry about the delayed response here. We're not exactly sure when this will come in, but Remi and I are meeting a little later today, and I'm hopeful that we can get this in within the next couple weeks.

@remi-stripe
Copy link
Contributor Author

Moved to #544 as the bigger PR

@remi-stripe remi-stripe deleted the remi-rename-all-fields branch February 3, 2019 00:14
nadaismail-stripe pushed a commit that referenced this pull request Oct 18, 2024
* Slight custom field description improvement

* Wording and organization improvement on sync preferences page
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.

4 participants