Ejemplo n.º 1
0
 private function processPayment($transactionId)
 {
     $fieldParams = $this->module->getSkrillCredentials();
     $fieldParams['type'] = 'trn_id';
     $fieldParams['id'] = $transactionId;
     $paymentResult = '';
     $isPaymentAccepted = SkrillPaymentCore::isPaymentAccepted($fieldParams, $paymentResult);
     if ($isPaymentAccepted) {
         $this->validatePayment($transactionId, $paymentResult);
     }
     $this->redirectError('ERROR_GENERAL_NORESPONSE');
 }
Ejemplo n.º 2
0
 public function hookdisplayAdminOrder()
 {
     $orderId = Tools::getValue('id_order');
     $sql = "SELECT * FROM skrill_order_ref WHERE id_order ='" . $orderId . "'";
     $row = Db::getInstance()->getRow($sql);
     if ($row) {
         if (Tools::isSubmit('skrillUpdateOrder') && $row['order_status'] != $this->refundedStatus) {
             $fieldParams = $this->getSkrillCredentials();
             $fieldParams['type'] = 'mb_trn_id';
             $fieldParams['id'] = $row['ref_id'];
             $paymentResult = '';
             $isPaymentAccepted = SkrillPaymentCore::isPaymentAccepted($fieldParams, $paymentResult);
             if ($isPaymentAccepted) {
                 $responseUpdateOrder = SkrillPaymentCore::getResponseArray($paymentResult);
                 $this->updateTransLogStatus($row['ref_id'], $responseUpdateOrder['status']);
                 $sql = "SELECT * FROM skrill_order_ref WHERE id_order ='" . $orderId . "'";
                 $row = Db::getInstance()->getRow($sql);
             }
         }
         $paymentInfo = array();
         $paymentInfo['name'] = $this->getFrontendPaymentLocale($row['payment_method']);
         $isSkrill = strpos($paymentInfo['name'], 'Skrill');
         if ($isSkrill === false) {
             $paymentInfo['name'] = 'Skrill ' . $paymentInfo['name'];
         }
         $trnStatus = SkrillPaymentCore::getTrnStatus($row['order_status']);
         $paymentInfo['status'] = $this->getTrnStatusLocale($trnStatus);
         $paymentInfo['method'] = $this->getFrontendPaymentLocale('SKRILL_FRONTEND_PM_' . $row['payment_code']);
         $paymentInfo['currency'] = $row['currency'];
         $additionalInformation = $this->getAdditionalInformation($row['add_information']);
         $langId = Context::getContext()->language->id;
         $orderOriginId = $this->getCountryIdByIso($additionalInformation['SKRILL_BACKEND_ORDER_ORIGIN']);
         $paymentInfo['order_origin'] = Country::getNameById($langId, $orderOriginId);
         $getCountryIso2 = SkrillPaymentCore::getCountryIso2($additionalInformation['SKRILL_BACKEND_ORDER_COUNTRY']);
         $orderCountryId = $this->getCountryIdByIso($getCountryIso2);
         $paymentInfo['order_country'] = Country::getNameById($langId, $orderCountryId);
         $buttonUpdateOrder = $row['order_status'] == $this->refundedStatus ? false : true;
         $this->context->smarty->assign(array('orderId' => $orderId, 'paymentInfo' => $paymentInfo, 'buttonUpdateOrder' => $buttonUpdateOrder));
         return $this->display(__FILE__, 'views/templates/hook/displayAdminOrder.tpl');
     }
     return '';
 }