View Issue Details

IDProjectCategoryView StatusLast Update
0005022Talerbank (demonstrator)public2018-04-15 20:34
ReporterChristian GrothoffAssigned ToMarcello Stanisci 
PriorityhighSeveritytweakReproducibilityN/A
Status closedResolutionfixed 
Platformi7OSDebian GNU/LinuxOS Versionsqueeze
Product VersionSVN HEAD 
Target Version0.5Fixed in Version0.5 
Summary0005022: amounts.py should define a class
DescriptionRight now, amounts in Python are simply represented as a 'dict'. It would seem cleaner to have a proper class "taler.amount" with three fields and methods to add/subtract/cmp/stringify/floatify, and constructors to parse (zero, CUR:val.frac).

Also, the existing functions lack type annotations.

Finally, the use of "settings.TALER_CURRENCY" should be avoided (get_zero) and instead the currency should be passed as an argument, as there may be multiple currencies used in the same application eventually, and the fundamental 'amount' abstraction should not depend on one currency being given in settings.
TagsNo tags attached.

Activities

Marcello Stanisci

2017-10-26 17:54

manager   ~0012515

such a class should never floatify any amount object: this operation does round numbers up, therefore making money disappear!

Marcello Stanisci

2017-10-26 18:41

manager   ~0012516

This class needs tests.

Marcello Stanisci

2017-10-30 16:33

manager   ~0012527

this feature was implemented at d0409b47b9fa from the 'copylib' repository. Manually copy the sources into any project where they are needed.

Issue History

Date Modified Username Field Change
2017-05-22 14:45 Christian Grothoff New Issue
2017-05-22 14:45 Christian Grothoff Status new => assigned
2017-05-22 14:45 Christian Grothoff Assigned To => Marcello Stanisci
2017-05-22 14:45 Christian Grothoff Summary amounts.py should probably define a class => amounts.py should define a class
2017-10-23 10:25 Christian Grothoff Priority normal => high
2017-10-23 10:25 Christian Grothoff Target Version => 0.5
2017-10-26 17:54 Marcello Stanisci Note Added: 0012515
2017-10-26 18:41 Marcello Stanisci Note Added: 0012516
2017-10-30 16:33 Marcello Stanisci Status assigned => resolved
2017-10-30 16:33 Marcello Stanisci Resolution open => fixed
2017-10-30 16:33 Marcello Stanisci Note Added: 0012527
2017-10-31 09:10 Christian Grothoff Fixed in Version => 0.5
2018-04-15 20:34 Christian Grothoff Status resolved => closed