Skip to content

Commit

Permalink
Merge branch 'rkrx-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
judgej committed Oct 20, 2022
2 parents 70552f7 + efc4d8c commit 07e9c7e
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/Extend/Item.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

namespace Omnipay\Payone\Extend;

/**
* Extends the Item class to support properties
* required by PAYONE.
*/

use Money\Currency;
use Omnipay\Common\Item as CommonItem;
use Money\Currencies\ISOCurrencies;
use Money\Parser\DecimalMoneyParser;
use Money\Money;

/**
* Extends the Item class to support properties
* required by PAYONE.
*/
class Item extends CommonItem implements ItemInterface
{
/**
Expand Down Expand Up @@ -112,7 +112,10 @@ public static function convertPriceInteger($price, $currency = null)
$currencies = new ISOCurrencies();
$moneyParser = new DecimalMoneyParser($currencies);

$price = $moneyParser->parse($price, $currency);
if(!($currency instanceof Currency)) {
$currency = new Currency((string) $currency);
}
$price = $moneyParser->parse($price, $currency);
}

// A money object supplied. We should use this all the time.
Expand Down

0 comments on commit 07e9c7e

Please sign in to comment.