Giter Site home page Giter Site logo

laravel-tikkie's People

Contributors

dependabot[bot] avatar jwiegant avatar

Stargazers

 avatar  avatar

Watchers

 avatar

laravel-tikkie's Issues

forcing a float directly to integer creates rounding issues

When creating a payment. for example;

$tikkie->paymentRequest()->create(
                'My payment',
                12345,
                Carbon::now()->addDay(),
                19.90
            );

The method $paymentRequestCreate->setAmountInCents($amount * 100) will create 1990.0 as a value, which then in turn gets forced as an integer resulting in the amount 1989 instead of 1990.

So a payment of € 19,90 will be turned into a payment of € 19,89.

A possible solution is to cast the amount in cents as a string before making it an integer;
$cents = (int) ((string) ($amount * 100));

If the $amount variable is a 19.90 float, the $cents value will then still be 1990 instead of 1989.

Or you could use the bcmul() method but that would require the BC Math php extension.

Thanks for creating this tikkie package! It makes tikkie implementation a breeze.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.