Page MenuHomePhorge

Wallet magic
ClosedPublic

Authored by vanmeeuwen on Apr 8 2020, 5:17 PM.
Tags
None
Referenced Files
F11596344: D1150.id3445.diff
Fri, Mar 29, 12:48 PM
F11593914: D1150.id3448.diff
Fri, Mar 29, 8:17 AM
F11591499: D1150.id3451.diff
Fri, Mar 29, 5:34 AM
F11588670: D1150.id3424.diff
Thu, Mar 28, 8:49 PM
F11587725: D1150.id3541.diff
Thu, Mar 28, 6:23 PM
Unknown Object (File)
Thu, Mar 28, 1:20 PM
Unknown Object (File)
Thu, Mar 28, 11:24 AM
Unknown Object (File)
Sat, Mar 23, 3:09 AM
Subscribers
Restricted Project

Details

Reviewers
machniak
vanmeeuwen
Group Reviewers
Restricted Project
Commits
rKda13578ce560: Wallet magic
Summary

Show-case implementation of how to calculate until when a wallet's balance lasts.

Test Plan
$ ./artisan user:wallets john@kolab.org
5337dced-7227-4cac-8c66-4b4720cca873
$ ./artisan wallet:expected
expect charging wallet 5337dced-7227-4cac-8c66-4b4720cca873 for user john@kolab.org with 999
$ ./artisan wallet:until $(./artisan user:wallets john@kolab.org)
0 lasts until 2020-04-08 15:10:21 (a month costs 3541)
$ ./artisan wallet:set-balance $(./artisan user:wallets john@kolab.org) $(( 999 + 3541 ))
$ ./artisan wallet:until $(./artisan user:wallets john@kolab.org)
4540 lasts until 2020-05-08 15:10:21 (a month costs 3541)

Diff Detail

Repository
rK kolab
Branch
arcpatch-D1150
Lint
No Lint Coverage
Unit
No Test Coverage
Build Status
Buildable 29617
Build 10894: arc lint + arc unit

Event Timeline

vanmeeuwen created this revision.
  • Remove superfluous commands already a part of different differentials
vanmeeuwen added a subscriber: Restricted Project.
machniak subscribed.

I think we'll need this code as a method on the Wallet object, as it will be needed also for UI. And we need a test. I don't understand the code, so I might get back to it later.

src/app/Console/Commands/WalletUntil.php
70

This is the same query but different order as above. I guess, we could do a single select.

This revision now requires changes to proceed.May 28 2020, 12:44 PM
  • Remove superfluous commands already a part of different differentials
  • Single query
  • Some initial extras
  • A simpler version of the same thing
  • Remove superfluous commands already a part of different differentials
  • Single query
  • Some initial extras
  • Same test for wallet function
src/app/Utils.php
27

Note that this is fixed in a different differential.

  • Fix error due to missing use statements
  • Create Wallet::balanceLastsUntil()
machniak requested changes to this revision.EditedJun 5 2020, 1:47 PM

@vanmeeuwen, I rebased, fixed obvious bugs and refactored the code so now we have Wallet::balanceLastsUntil() that we need tests for in tests/Feature/WalletTest::testBalanceLastsUntil().

This revision now requires changes to proceed.Jun 5 2020, 1:47 PM
This revision was not accepted when it landed; it landed in state Needs Revision.Jun 10 2020, 11:41 AM
Closed by commit rKda13578ce560: Wallet magic (authored by machniak). · Explain Why
This revision was automatically updated to reflect the committed changes.