Exemplo n.º 1
0
 /**
  * Test GetIsoCode
  *
  * @return void
  */
 public function testGetIsoCode()
 {
     $this->assertEquals(RHelperCurrency::getIsoCode(978), 'EUR');
     $this->assertEquals(RHelperCurrency::getIsoCode(233445), false);
     $this->assertEquals(RHelperCurrency::getIsoCode('asdasd'), false);
 }
Exemplo n.º 2
0
 /**
  * Generate Payment Log depending on the status
  *
  * @param   array  $paymentLog           Data for payment log storage
  * @param   bool   $updatePaymentStatus  Update Payment Status
  *
  * @return bool
  */
 public static function saveNewPaymentLog($paymentLog, $updatePaymentStatus = true)
 {
     if (empty($paymentLog['payment_id'])) {
         return false;
     }
     // Forcing default set of statuses
     $paymentLog['status'] = RApiPaymentStatus::getStatus($paymentLog['status']);
     // Currency should not be numeric
     if (!empty($paymentLog['currency']) && is_numeric($paymentLog['currency'])) {
         $paymentLog['currency'] = RHelperCurrency::getIsoCode($paymentLog['currency']);
     }
     /** @var RedcoreModelPayment_Log $logModel */
     $logModel = RModelAdmin::getAdminInstance('Payment_Log', array(), 'com_redcore');
     if ($logModel->save($paymentLog)) {
         if ($updatePaymentStatus) {
             self::updatePaymentStatus($paymentLog['payment_id']);
         }
     }
     return true;
 }