Example #1
0
 /**
  *
  */
 function cancelReservation($order, $payments)
 {
     $rno = $this->getReservationNumber($payments);
     if (!$rno) {
         return;
         // error already sent
     }
     $this->initKlarnaParams($this->method);
     $klarna = new Klarna_virtuemart();
     $klarna->config($this->merchantid, $this->sharedsecret, $this->country_code_3, NULL, $this->currency_code_3, $this->mode, VMKLARNA_PC_TYPE, KlarnaHandler::getKlarna_pc_type(), $this->ssl);
     $modelOrder = VmModel::getModel('orders');
     try {
         $result = $klarna->cancelReservation($rno);
         $info = vmText::sprintf('VMPAYMENT_KLARNACHECKOUT_RESERVATION_CANCELED', $rno);
         VmInfo($info);
         $history = array();
         $history['customer_notified'] = 1;
         //$history['order_status'] = $this->method->checkout_complete;
         $history['comments'] = $info;
         // $order['details']['BT']->order_number);
         $modelOrder->updateStatusForOneOrder($order->virtuemart_paymentmethod_id, $history, TRUE);
         $dbValues['order_number'] = $payments[0]->order_number;
         $dbValues['payment_name'] = '';
         $dbValues['virtuemart_paymentmethod_id'] = $payments[0]->virtuemart_paymentmethod_id;
         $dbValues['action'] = 'cancelReservation';
         $dbValues['klarna_status'] = 'cancelReservation';
         $dbValues['data'] = $info;
         $this->debugLog($dbValues, 'storePSPluginInternalData cancelReservation', 'debug');
         $values = $this->storePSPluginInternalData($dbValues, $this->_tablepkey);
     } catch (Exception $e) {
         $error = $e->getMessage();
         VmError($e->getMessage(), vmText::sprintf('VMPAYMENT_KLARNACHECKOUT_ERROR_OCCURRED', $this->method->payment_name));
         $this->debugLog($e->getMessage(), 'cancelReservation', 'error');
         return FALSE;
     }
     //$dbValues['data'] = $vm_invoice_name;
     return true;
 }
Example #2
0
 /**
  *
  */
 function cancelReservation($order, $payments)
 {
     $rno = $this->getReservationNumber($payments);
     if (!$rno) {
         return;
         // error already sent
     }
     $klarna = new Klarna_virtuemart();
     $klarna->config($this->_currentMethod->merchantid, $this->_currentMethod->sharedsecret, $this->country_code_3, NULL, $this->currency_code_3, $this->mode, VMKLARNA_PC_TYPE, KlarnaHandler::getKlarna_pc_type(), $this->ssl);
     $modelOrder = tmsModel::getModel('orders');
     try {
         $result = $klarna->cancelReservation($rno);
         $info = tsmText::sprintf('VMPAYMENT_KLARNACHECKOUT_RESERVATION_CANCELED', $rno);
         VmInfo($info);
         $history = array();
         $history['customer_notified'] = 1;
         //$history['order_status'] = $this->_currentMethod->checkout_complete;
         $history['comments'] = $info;
         // $order['details']['BT']->order_number);
         $modelOrder->updateStatusForOneOrder($order->virtuemart_order_id, $history, TRUE);
     } catch (Exception $e) {
         $error = $e->getMessage();
         $this->KlarnacheckoutError($e->getMessage(), tsmText::sprintf('VMPAYMENT_KLARNACHECKOUT_ERROR_OCCURRED', $this->_currentMethod->payment_name));
         return FALSE;
     }
     //$dbValues['data'] = $vm_invoice_name;
     return $result;
 }