Beispiel #1
0
 /**
  * Get array of payment transaction sums (how much is authorized, captured and refunded)
  *
  * @return array
  */
 public function getPaymentTransactionSums()
 {
     static $paymentTransactionSums = null;
     if (!isset($paymentTransactionSums)) {
         list($authorized, $captured, $voided, $refunded, $xpcFound) = $this->getXpcTransactionSums();
         if (!$xpcFound) {
             $paymentTransactionSums = parent::getPaymentTransactionSums();
         } else {
             if ($captured > self::ORDER_ZERO) {
                 // Substract the captured amount from the authorized.
                 // This makes only actual authorized amount being displayed.
                 $authorized = max($authorized - $captured, 0);
             }
             if ($voided > self::ORDER_ZERO) {
                 // Substract the declined amount from the authorized.
                 // This makes only actual authorized amount being displayed,
                 // and we hide the declined amount.
                 $authorized = max($authorized - $voided, 0);
                 $voided = 0;
             }
             $paymentTransactionSums = array(static::t('Authorized amount') => $authorized, static::t('Charged amount') => $captured, static::t('Refunded amount') => $refunded, static::t('Declined amount') => $voided);
         }
         if ($xpcFound || $this->hasSavedCardsInProfile()) {
             $paymentTransactionSums[static::t('Difference')] = $this->getAomTotalDifference();
             // Remove from array all zero sums
             foreach ($paymentTransactionSums as $k => $v) {
                 if ($v <= self::ORDER_ZERO) {
                     unset($paymentTransactionSums[$k]);
                 }
             }
         }
     }
     return $paymentTransactionSums;
 }
 /**
  * {@inheritDoc}
  */
 public function getPaymentTransactionSums()
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'getPaymentTransactionSums', array());
     return parent::getPaymentTransactionSums();
 }