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: Update cash balance methods to no longer require nested ID. #1063

Merged
merged 4 commits into from
Jun 8, 2022

Conversation

dcr-stripe
Copy link
Contributor

@dcr-stripe dcr-stripe commented May 31, 2022

Summary

Updates Customer.retrieve_cash_balance and Customer.update_cash_balance methods to no longer require a nested ID.

Previously you always had to call with nil as the second parameter (eg. retrieve_cash_balance('cus_123', nil)).
With this PR, the second parameter is nil by default.

Changes to retrieve_cash_balance

You can now use retrieve_cash_balance with the following call patterns:

  1. Original pattern: retrieve_cash_balance(customer_id, nil[, opts])
  2. New pattern: retrieve_cash_balance(customer_id[, opts])

Changes to update_cash_balance

You can now use update_cash_balance with the following call patterns:

  1. Original pattern: update_cash_balance(customer_id, nil[, params[, opts]])
  2. New pattern: update_cash_balance(customer_id) (admittedly this isn't very useful in isolation)

We raise an error if trying to do update_cash_balance(customer_id, some hash) since we don't want users to accidentally use this thinking the signature is update_cash_balance(customer_id, params). We unfortunately can't gracefully support both the legacy pattern and update_cash_balance(customer_id, params, opts) since we wouldn't be able to differentiate update_cash_balance(customer_id, nil, hash) (is has here a params or opts?).

Future major

In a future major, we could remove the nested_id nil parameter entirely and bring this back to a consistent syntax with our other APIs.

@dcr-stripe dcr-stripe force-pushed the dcr-cash-balance-tests branch 3 times, most recently from 2d52132 to 6765bed Compare May 31, 2022 21:23
@dcr-stripe dcr-stripe changed the title Add test for cash balance methods. fix: Update cash balance methods to no longer require nested ID. May 31, 2022
@dcr-stripe dcr-stripe force-pushed the dcr-cash-balance-tests branch from 6765bed to 846bbb9 Compare May 31, 2022 22:27
@dcr-stripe dcr-stripe force-pushed the dcr-cash-balance-tests branch from 846bbb9 to 2c9709d Compare May 31, 2022 22:30
@dcr-stripe dcr-stripe force-pushed the dcr-cash-balance-tests branch from 3a0e5de to 234af19 Compare June 2, 2022 16:22
@dcr-stripe dcr-stripe force-pushed the dcr-cash-balance-tests branch from 234af19 to 925caa0 Compare June 2, 2022 16:24
Copy link
Contributor

@richardm-stripe richardm-stripe left a comment

Choose a reason for hiding this comment

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

Thanks for the tests

@dcr-stripe dcr-stripe merged commit 6ffacea into master Jun 8, 2022
@dcr-stripe dcr-stripe deleted the dcr-cash-balance-tests branch June 8, 2022 15:55
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.

2 participants