private function setTransactionLog($transactionId, $currency, $orderTotal, $responseCheckout) { $transactionLog = array(); $transactionLog['transaction_id'] = $transactionId; $transactionLog['payment_type'] = $this->getPaymentType($responseCheckout); $transactionLog['payment_method'] = 'SKRILL_FRONTEND_PM_' . Tools::getValue('payment_method'); $transactionLog['payment_name'] = $this->getPaymentName($transactionLog['payment_type']); $transactionLog['status'] = SkrillPaymentCore::getTrnStatus($responseCheckout['status']); $transactionLog['currency'] = $this->getPaymentCurrency($currency, $responseCheckout); $transactionLog['amount'] = $this->getPaymentAmount($orderTotal, $responseCheckout); return $transactionLog; }
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 ''; }