示例#1
0
 public function finishTransaction($newStatus) {      
     $transaction = new Pap_Db_Transaction();
     $transaction->setOrderId($_POST['LMI_PAYMENT_NO']);
     $transaction->setData5($_POST['LMI_SYS_TRANS_NO']);
     try {
         $transaction->loadFromData(array(Pap_Db_Table_Transactions::ORDER_ID, Pap_Db_Table_Transactions::DATA5));
     } catch (Gpf_DbEngine_NoRowException $e) {
         $this->debug('No such transaction with order id: ' . $transaction->getOrderId() . ' and data5: ' . $transaction->getData5() . '. Changing status ended.');
         return;
     }
     $transaction->setStatus($newStatus);
     $transaction->update();
 }
示例#2
0
    /**
     * @param Pap_Db_Transaction $transaction
     * @param Gpf_DbEngine_Row_Collection $affectedTransactions
     * @return Pap_Db_Transaction
     */
    protected function getChildTransaction(Pap_Db_Transaction $transaction, Gpf_DbEngine_Row_Collection $affectedTransactions) {
        foreach ($affectedTransactions as $affectedTransaction) {
            if ($affectedTransaction->getParentTransactionId() == $transaction->getId() &&
            $affectedTransaction->getType() == $transaction->getType()) {
                return $affectedTransaction;
            }
        }

        $childTransaction = new Pap_Db_Transaction();
        $childTransaction->setType($transaction->getType());
        $childTransaction->setParentTransactionId($transaction->getId());
        try {
            $childTransaction->loadFromData(array(Pap_Db_Table_Transactions::R_TYPE, Pap_Db_Table_Transactions::PARRENT_TRANSACTION_ID));
        } catch (Gpf_Exception $e) {
            return null;
        }
        return  $childTransaction;
    }