Example #1
0
 /**
  * Fetches a list of transaction which can be used as alias transactions for the given order context.
  * 
  * @param Customweb_Payment_Authorization_IOrderContext $orderContext
  * @return Customweb_Payment_Entity_AbstractTransaction[]
  */
 public function getAliasTransactions(Customweb_Payment_Authorization_IOrderContext $orderContext)
 {
     $customerId = $orderContext->getCustomerId();
     if ($customerId === null) {
         return array();
     }
     $transactions = $this->manager->search($this->transactionClassName, 'customerId = >customerId AND paymentMachineName = >paymentMethodName AND aliasActive = "y" AND aliasForDisplay IS NOT NULL AND aliasForDisplay != ""', 'createdOn DESC', array('>customerId' => $customerId, '>paymentMethodName' => $orderContext->getPaymentMethod()->getPaymentMethodName()));
     $result = array();
     foreach ($transactions as $transaction) {
         /* @var $transaction Customweb_Payment_Entity_AbstractTransaction */
         if (!isset($result[$transaction->getAliasForDisplay()])) {
             $result[$transaction->getAliasForDisplay()] = $transaction;
         }
     }
     return $result;
 }