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

Number precision / formatting in templates #3

Closed
adamlc opened this issue Jan 19, 2016 · 4 comments
Closed

Number precision / formatting in templates #3

adamlc opened this issue Jan 19, 2016 · 4 comments
Assignees

Comments

@adamlc
Copy link

adamlc commented Jan 19, 2016

I've been having a play with this plugin but it I've come across an issue, floats seem to be formatted with far too much precision, for example a refund:

We have processed a refund in the amount of GBP 937.070000000.

I can't seem to figure out a way of doing this in the template, might be worth making sure these are rounded up to 2 decimal places?

@pierre pierre self-assigned this Jan 19, 2016
@pierre pierre closed this as completed in 5711b2d Jan 19, 2016
@pierre
Copy link
Member

pierre commented Jan 19, 2016

Could you give 5711b2d a try?

Displaying amounts is always tricky as it depends on the currency and the locale. Switching to formatted* variables in your template (e.g. payment.formattedAmount) should help (make sure to set the locale of your accounts to en_GB, see 5711b2d#diff-c6d30976a188a6f92ee0e9d8f50a8652R146).

http://docs.killbill.io/0.16/internationalization.html might be relevant.

@pierre
Copy link
Member

pierre commented Mar 3, 2016

Released in 0.2.1.

A new OSGI export is required though. It will be set by default in Kill Bill 0.16.3.

For previous versions, you need to override the property org.killbill.osgi.system.bundle.export.packages.api manually and add the missing export org.killbill.billing.invoice.api.formatters.

@husam-otri
Copy link

Thanks for reply @pierre

in order to override the property, i just cloned git@github.com:killbill/killbill-platform.git

then update release.sh (just i commented out some commands which related to git)
then run ./release.sh in order to create new jar files which will include OSGI, but unfortunately i'm getting this compilation error message:

[INFO] Compiling 5 source files to /home/hussam/qordoba/killbill-platform/platform-api/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /home/hussam/qordoba/killbill-platform/platform-api/src/main/java/org/killbill/billing/platform/api/KillbillService.java:[45,12] class, interface, or enum expected
[ERROR] /home/hussam/qordoba/killbill-platform/platform-api/src/main/java/org/killbill/billing/platform/api/KillbillService.java:[47,1] class, interface, or enum expected
[INFO] 2 errors 
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] killbill-platform .................................. SUCCESS [  6.794 s]
[INFO] killbill-platform-api .............................. FAILURE [  0.571 s]

am i doing something wrong, if yes, could you please provide me the steps to override the property?

@pierre
Copy link
Member

pierre commented Mar 5, 2016

@husam-otri This is a Kill Bill property, you don't have to recompile anything.

Depending on how you start Kill Bill, simply add to your killbill.properties file:

org.killbill.osgi.system.bundle.export.packages.api=org.killbill.billing.account.api,org.killbill.billing.analytics.api.sanity,org.killbill.billing.analytics.api.user,org.killbill.billing.beatrix.bus.api,org.killbill.billing.catalog.api,org.killbill.billing.catalog.api.rules,org.killbill.billing.invoice.plugin.api,org.killbill.billing.invoice.api,org.killbill.billing.invoice.api.formatters,org.killbill.billing.entitlement.api,org.killbill.billing,org.killbill.clock,org.killbill.billing.notification.api,org.killbill.billing.notification.plugin.api,org.killbill.billing.notification.plugin,org.killbill.billing.osgi.api,org.killbill.billing.osgi.api.config,org.killbill.billing.overdue,org.killbill.billing.payment.api,org.killbill.billing.payment.plugin.api,org.killbill.billing.control.plugin.api,org.killbill.billing.tenant.api,org.killbill.billing.usage.api,org.killbill.billing.util.api,org.killbill.billing.util.nodes,org.killbill.billing.util.audit,org.killbill.billing.util.callcontext,org.killbill.billing.util.customfield,org.killbill.billing.util.email,org.killbill.billing.util.entity,org.killbill.billing.util.tag,org.killbill.billing.util.template,org.killbill.billing.util.template.translation,org.killbill.billing.currency.plugin.api,org.killbill.billing.catalog.plugin.api,org.killbill.billing.entitlement.plugin.api,org.killbill.billing.currency.api,org.killbill.billing.security.api,org.killbill.killbill.osgi.libs.killbill,org.joda.time;org.joda.time.format;version=2.3,org.slf4j;version=1.7.2,org.osgi.service.log;version=1.3,org.osgi.service.http;version=1.2.0,org.osgi.service.deploymentadmin;version=1.1.0,org.osgi.service.event;version=1.2.0

or set it on the command line (-Dorg.killbill.osgi.system.bundle.export.packages.api=...).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants