示例#1
0
 /**
  * @param Mage_Sales_Model_Order $order
  * @param Payone_Api_Response_Interface $response
  * @param Payone_Api_Request_Interface $request
  * @throws Payone_Core_Exception_TransactionAlreadyExists
  * @return null|Payone_Core_Model_Domain_Transaction
  */
 public function createByApiResponse(Mage_Sales_Model_Order $order, Payone_Api_Response_Interface $response, Payone_Api_Request_Interface $request)
 {
     $transaction = $this->getFactory()->getModelTransaction();
     $transaction->load($response->getTxid(), 'txid');
     // should not exist but to be sure load by txid
     if ($transaction->hasData()) {
         throw new Payone_Core_Exception_TransactionAlreadyExists($response->getTxid());
     }
     $transaction->setTxid($response->getTxid());
     $transaction->setLastTxaction($response->getStatus());
     $transaction->setUserid($response->getUserid());
     $transaction->setStoreId($order->getStoreId());
     $transaction->setOrderId($order->getId());
     $transaction->setReference($order->getIncrementId());
     $transaction->setCurrency($order->getOrderCurrencyCode());
     $transaction->setCustomerId($order->getCustomerId());
     $transaction->setClearingtype($request->getClearingtype());
     $transaction->setMode($request->getMode());
     $transaction->setMid($request->getMid());
     $transaction->setAid($request->getAid());
     $transaction->setPortalid($request->getPortalid());
     $transaction->setLastSequencenumber(0);
     $data = $response->toArray();
     $transaction->addData($data);
     $transaction->save();
     return $transaction;
 }
 /**
  * @param Payone_Api_Response_Interface $response
  * @return Payone_Core_Model_Domain_Transaction
  */
 public function updateByApiResponse(Payone_Api_Response_Interface $response)
 {
     $transaction = $this->getFactory()->getModelTransaction();
     $transaction->load($response->getTxid(), 'txid');
     // should not exist but to be sure load by txid
     $transaction->setLastTxaction($response->getStatus());
     $transaction->save();
     return $transaction;
 }
示例#3
0
 /**
  * @param Payone_Api_Response_Interface $response
  * @return Payone_Core_Model_Handler_Payment_Abstract|Payone_Core_Model_Handler_Payment_Debit
  */
 public function handle(Payone_Api_Response_Interface $response)
 {
     $order = $this->getOrder();
     $paymentMethod = $this->getPaymentMethod();
     if ($response->isApproved()) {
         $this->getPayment()->setLastTransId($response->getTxid());
     } elseif ($response->isError()) {
         return $this;
     }
     // Update Order Status
     $this->getServiceOrderStatus()->setConfigStore($this->getConfigStore());
     $this->getServiceOrderStatus()->updateByApiResponse($order, $response);
     // Add Order Comment
     $this->getServiceOrderComment()->addByApiResponse($order, $response);
     return $this;
 }
示例#4
0
 /**
  * @param Payone_Api_Response_Interface $response
  */
 protected function updatePaymentByResponse(Payone_Api_Response_Interface $response)
 {
     $payment = $this->getPayment();
     $paymentMethod = $this->getPaymentMethod();
     $payment->setLastTransId($response->getTxid());
     if ($paymentMethod instanceof Payone_Core_Model_Payment_Method_AdvancePayment or $paymentMethod instanceof Payone_Core_Model_Payment_Method_Invoice or $paymentMethod instanceof Payone_Core_Model_Payment_Method_CashOnDelivery or $paymentMethod instanceof Payone_Core_Model_Payment_Method_SafeInvoice and $response instanceof Payone_Api_Response_Capture_Approved) {
         /** @var $response Payone_Api_Response_Authorization_Approved */
         $payment->setPayoneClearingBankAccountholder($response->getClearingBankaccountholder());
         $payment->setPayoneClearingBankCountry($response->getClearingBankcountry());
         $payment->setPayoneClearingBankAccount($response->getClearingBankaccount());
         $payment->setPayoneClearingBankCode($response->getClearingBankcode());
         $payment->setPayoneClearingBankIban($response->getClearingBankiban());
         $payment->setPayoneClearingBankBic($response->getClearingBankbic());
         $payment->setPayoneClearingBankCity($response->getClearingBankcity());
         $payment->setPayoneClearingBankName($response->getClearingBankname());
         if ($response instanceof Payone_Api_Response_Capture_Approved) {
             $payment->setPayoneClearingReference($response->getClearingReference());
             $payment->setPayoneClearingInstructionnote($response->getClearingInstructionnote());
             $payment->setPayoneClearingLegalnote($response->getClearingLegalnote());
             $payment->setPayoneClearingDuedate($response->getClearingDuedate());
         }
     }
 }
示例#5
0
 /**
  * @param Payone_Api_Response_Interface $response
  */
 protected function updatePaymentByResponse(Payone_Api_Response_Interface $response)
 {
     $payment = $this->getPayment();
     $paymentMethod = $this->getPaymentMethod();
     $payment->setLastTransId($response->getTxid());
     if ($paymentMethod instanceof Payone_Core_Model_Payment_Method_AdvancePayment or $paymentMethod instanceof Payone_Core_Model_Payment_Method_Invoice or $paymentMethod instanceof Payone_Core_Model_Payment_Method_CashOnDelivery or $paymentMethod instanceof Payone_Core_Model_Payment_Method_SafeInvoice and $response instanceof Payone_Api_Response_Capture_Approved) {
         /** @var $response Payone_Api_Response_Authorization_Approved */
         $payment->setPayoneClearingBankAccountholder($response->getClearingBankaccountholder());
         $payment->setPayoneClearingBankCountry($response->getClearingBankcountry());
         $payment->setPayoneClearingBankAccount($response->getClearingBankaccount());
         $payment->setPayoneClearingBankCode($response->getClearingBankcode());
         $payment->setPayoneClearingBankIban($response->getClearingBankiban());
         $payment->setPayoneClearingBankBic($response->getClearingBankbic());
         $payment->setPayoneClearingBankCity($response->getClearingBankcity());
         $payment->setPayoneClearingBankName($response->getClearingBankname());
         if ($response instanceof Payone_Api_Response_Capture_Approved) {
             $payment->setPayoneClearingReference($response->getClearingReference());
             $payment->setPayoneClearingInstructionnote($response->getClearingInstructionnote());
             $payment->setPayoneClearingLegalnote($response->getClearingLegalnote());
             $payment->setPayoneClearingDuedate($response->getClearingDuedate());
         }
     } elseif ($paymentMethod instanceof Payone_Core_Model_Payment_Method_Ratepay) {
         $oSession = Mage::getSingleton('checkout/session');
         $oSession->unsRatePayFingerprint();
     }
     if ($response instanceof Payone_Api_Response_Authorization_Abstract) {
         if ($response->getAddPaydataClearingReference()) {
             $payment->setPayoneClearingReference($response->getAddPaydataClearingReference());
         } elseif ($response->getClearingReference()) {
             $payment->setPayoneClearingReference($response->getClearingReference());
         }
     }
 }