Skip to content
This repository has been archived by the owner on Oct 30, 2018. It is now read-only.

Changes for buffering stripe invoice items to nearest, min cent #55

Merged
merged 11 commits into from
Feb 14, 2017

Conversation

bryanchriswhite
Copy link
Contributor

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.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 89.194% when pulling a6f2ac7 on bryanchriswhite:master into 101607e on Storj:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 89.194% when pulling 7704bcd on bryanchriswhite:master into 101607e on Storj:master.

…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
@coveralls
Copy link

Coverage Status

Coverage remained the same at 89.194% when pulling 1ef6ab0 on bryanchriswhite:master into 101607e on Storj:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 89.194% when pulling abdd63f on bryanchriswhite:master into 101607e on Storj:master.

@bryanchriswhite 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
@coveralls
Copy link

Coverage Status

Coverage remained the same at 89.194% when pulling 09456da on bryanchriswhite:master into 101607e on Storj:master.

@braydonf
Copy link
Contributor

Are the console.log and console.error left over from debugging, or expected to stay in?

@coveralls
Copy link

Coverage Status

Coverage remained the same at 89.194% when pulling 30f9fcb on bryanchriswhite:master into 101607e on Storj:master.

.travis.yml Outdated
@@ -1,8 +1,12 @@
language: node_js
node_js:
- "6.9.1"

sudo: required
Copy link
Contributor

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?

@coveralls
Copy link

Coverage Status

Coverage increased (+0.1%) to 89.341% when pulling 16f6c33 on bryanchriswhite:master into 101607e on Storj:master.

@braydonf
Copy link
Contributor

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.

@braydonf braydonf merged commit bc9253d into storj-archived:master Feb 14, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants