Exemplo n.º 1
0
 /**
  * Test getPrecision
  *
  * @throws Exception
  *
  * @return void
  */
 public function testGetPrecision()
 {
     $this->assertEquals(RHelperCurrency::getPrecision('EUR'), 2);
     try {
         RHelperCurrency::getPrecision('A');
         throw new Exception('there should have been another exception');
     } catch (OutOfRangeException $e) {
         // It was expected
     }
 }
Exemplo n.º 2
0
 /**
  * Get the payment amount as an float.
  *
  * @param   int     $amount    Amount
  * @param   string  $currency  Iso 4217 3 letters currency code
  *
  * @return float
  */
 public function getAmountToFloat($amount, $currency)
 {
     return (double) round($amount / pow(10, RHelperCurrency::getPrecision($currency)));
 }