public function persistTransactionObject(Customweb_Payment_Authorization_ITransaction $transactionObject) { $transaction = $this->getManager()->fetch($this->getTransactionClassName(), $transactionObject->getTransactionId(), false); if (!$transaction instanceof Customweb_Payment_Entity_AbstractTransaction) { throw new Exception("Unabel to find transaction with id " . $transactionObject->getTransactionId() . "."); } if ($transaction->getAuthorizationStatus() == Customweb_Payment_Entity_AbstractTransaction::AUTHORIZATION_STATUS_AUTHORIZING) { throw new Customweb_Payment_Exception_OptimisticLockingException($transaction->getTransactionId()); } if ($transaction->isAuthorizationRequired($transactionObject)) { $transaction->setAuthorizationStatus(Customweb_Payment_Entity_AbstractTransaction::AUTHORIZATION_STATUS_AUTHORIZING); $transaction->setSkipOnSaveMethods(true); try { $this->getManager()->persist($transaction); } catch (Customweb_Database_Entity_Exception_OptimisticLockingException $e) { throw new Customweb_Payment_Exception_OptimisticLockingException($transaction->getTransactionId()); } $transaction = $this->getManager()->fetch($this->getTransactionClassName(), $transactionObject->getTransactionId(), false); if (!method_exists($transactionObject, 'setVersionNumber')) { throw new Exception('setVersionNumber function is required on the transactionObject.'); } $transactionObject->setVersionNumber($transaction->getVersionNumber()); } $transaction->setTransactionObject($transactionObject); try { $this->getManager()->persist($transaction); } catch (Customweb_Database_Entity_Exception_OptimisticLockingException $e) { throw new Customweb_Payment_Exception_OptimisticLockingException($transaction->getTransactionId()); } }
public function persistTransactionObject(Customweb_Payment_Authorization_ITransaction $transactionObject) { $transaction = $this->getManager()->fetch($this->getTransactionClassName(), $transactionObject->getTransactionId()); if (!$transaction instanceof Customweb_Payment_Entity_AbstractTransaction) { throw new Exception("Unabel to find transaction with id " . $transactionObject->getTransactionId() . "."); } $transaction->setTransactionObject($transactionObject); $this->getManager()->persist($transaction); }