This repository has been archived by the owner on Oct 30, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
Changes for buffering stripe invoice items to nearest, min cent #55
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…rage-models * 'bug/fixYarnTravisIssue' of github.com:storj/service-storage-models: more testing test moar moar testing More tesitng Testing manually installing yarn More travis file updates Updates to travis to find yarn issue
bryanchriswhite
changed the title
[WIP] changes for buffering stripe invoice items to nearest, min cent
Changes for buffering stripe invoice items to nearest, min cent
Feb 11, 2017
Are the |
braydonf
reviewed
Feb 13, 2017
.travis.yml
Outdated
@@ -1,8 +1,12 @@ | |||
language: node_js | |||
node_js: | |||
- "6.9.1" | |||
|
|||
sudo: required |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these changes in .travis.yml still necessary?
…vice-storage-models" This reverts commit 1ef6ab0.
Looks like we need a more permanent solution for logging, or to not log here and raise specific errors that can be handled at a higher level and logged. Will create as issue for that and get this moved forward. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is the stripe API side of this "balance buffering" process. In short, stripe only accepts integer amounts of cents whereas we would otherwise be billing with one ten-thousandth of a cent precision (0.0001¢ i.e. $0.000001).
We need to issue invoice items to stripe so they know how much to charge users. This solution buffers the user's balance (owed to storj) until the difference between un-invoiced debits is greater than the minumum whole cents required to generate a stripe invoice item (currently 100¢ but could possibly be lowered to 50¢ - depends on country I think).
Once, daily, billing importer runs. This process generates debits in our system for any un-debited (i.e. new since yesterday). Then we check the "stripe balance", if it's above our minimum, then we generate invoice items in stripe, otherwise we just create the debits and wait for the next debit/invoice item creation event where the "stripe balance" might be over our min again.