/** * Apply transformation: Convert to Minor currency unit * * @param string $amount * @param string $currency * * @return string */ protected function transformAmount($amount = '', $currency = '') { if (!empty($amount) && !empty($currency)) { return \Genesis\Utils\Currency::amountToExponent($amount, $currency); } return false; }
/** * Get formatted amount (instead of ISO4217, return in float) * * @param \stdClass|\ArrayObject $transaction * * @return String | null (if amount/currency are unavailable) */ public static function transformFilterAmount($transaction) { // Process a single transaction if (isset($transaction->currency) && isset($transaction->amount)) { $transaction->amount = \Genesis\Utils\Currency::exponentToAmount($transaction->amount, $transaction->currency); } return $transaction; }