From bb19774e1231b955d5dbe443f7c803fd0edc2c6d Mon Sep 17 00:00:00 2001 From: Thomas Tong Date: Fri, 18 Dec 2020 17:16:29 +0800 Subject: [PATCH] initial commit --- .gitignore | 1 + LICENSE | 14 + README.md | 18 + classes/cryptopayhelper.php | 197 +++++ classes/cryptopaytransaction.php | 240 ++++++ classes/index.php | 32 + .../admin/AdminCryptoPayLogController.php | 160 ++++ .../admin/AdminCryptoPayPaymentController.php | 168 +++++ .../admin/AdminCryptoPaySettingController.php | 34 + controllers/admin/index.php | 32 + controllers/front/index.php | 32 + controllers/front/validation.php | 281 +++++++ controllers/front/webhook.php | 122 +++ controllers/index.php | 32 + cryptopay.php | 693 ++++++++++++++++++ index.php | 32 + logo.png | Bin 0 -> 5674 bytes publish.sh | 5 + sql/index.php | 32 + sql/install.php | 82 +++ views/img/icon.png | Bin 0 -> 1019 bytes views/img/icon.svg | 149 ++++ views/img/index.php | 32 + views/img/logo.png | Bin 0 -> 5674 bytes views/img/logo_2.png | Bin 0 -> 3705 bytes views/img/payment.png | Bin 0 -> 3470 bytes views/index.php | 32 + views/templates/admin/admin-order.tpl | 194 +++++ views/templates/admin/cancel_order.tpl | 25 + views/templates/admin/configure.tpl | 61 ++ views/templates/admin/help_link.tpl | 22 + views/templates/admin/index.php | 32 + views/templates/admin/log.tpl | 63 ++ views/templates/admin/view_store_order.tpl | 23 + views/templates/admin/webhook.tpl | 55 ++ views/templates/front/index.php | 32 + views/templates/front/payment_description.tpl | 24 + views/templates/front/payment_error.tpl | 31 + views/templates/front/payment_return.tpl | 125 ++++ views/templates/hook/index.php | 32 + views/templates/hook/payment_error.tpl | 32 + views/templates/hook/payment_return.tpl | 43 ++ views/templates/index.php | 32 + 43 files changed, 3246 insertions(+) create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 README.md create mode 100644 classes/cryptopayhelper.php create mode 100644 classes/cryptopaytransaction.php create mode 100644 classes/index.php create mode 100644 controllers/admin/AdminCryptoPayLogController.php create mode 100644 controllers/admin/AdminCryptoPayPaymentController.php create mode 100644 controllers/admin/AdminCryptoPaySettingController.php create mode 100644 controllers/admin/index.php create mode 100644 controllers/front/index.php create mode 100644 controllers/front/validation.php create mode 100644 controllers/front/webhook.php create mode 100644 controllers/index.php create mode 100644 cryptopay.php create mode 100644 index.php create mode 100644 logo.png create mode 100755 publish.sh create mode 100644 sql/index.php create mode 100644 sql/install.php create mode 100644 views/img/icon.png create mode 100644 views/img/icon.svg create mode 100644 views/img/index.php create mode 100644 views/img/logo.png create mode 100644 views/img/logo_2.png create mode 100644 views/img/payment.png create mode 100644 views/index.php create mode 100644 views/templates/admin/admin-order.tpl create mode 100644 views/templates/admin/cancel_order.tpl create mode 100644 views/templates/admin/configure.tpl create mode 100644 views/templates/admin/help_link.tpl create mode 100644 views/templates/admin/index.php create mode 100644 views/templates/admin/log.tpl create mode 100644 views/templates/admin/view_store_order.tpl create mode 100644 views/templates/admin/webhook.tpl create mode 100644 views/templates/front/index.php create mode 100644 views/templates/front/payment_description.tpl create mode 100644 views/templates/front/payment_error.tpl create mode 100644 views/templates/front/payment_return.tpl create mode 100644 views/templates/hook/index.php create mode 100644 views/templates/hook/payment_error.tpl create mode 100644 views/templates/hook/payment_return.tpl create mode 100644 views/templates/index.php diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6f66c74 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.zip \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..6bcad01 --- /dev/null +++ b/LICENSE @@ -0,0 +1,14 @@ + + Copyright 2018 - 2020, Foris Limited ("Crypto.com"). + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..bcb7b0f --- /dev/null +++ b/README.md @@ -0,0 +1,18 @@ +# Crypto.com Pay Checkout for PrestaShop + +## Requirements + +This module requires the following: +* [PrestaShop](https://www.prestashop.com/) +* [Crypto.com Pay for Business](https://merchant.crypto.com/) account + +## Setup + +* Download the module zip package in [Releases](https://github.com/crypto-com/crypto-pay-prestashop/releases) page. +* Upload the module in Module Manager of your PrestaShop BackOffice. +* Refer to our [Setup Instructions](https://help.crypto.com/en/articles/4190858-what-e-commerce-platforms-does-crypto-com-pay-support) in our Merchant FAQ. + +## Support + +* Visit our [Merchant FAQ](https://help.crypto.com/en/collections/1512001-crypto-com-pay-merchant-faq) and [API Documentation](https://pay-docs.crypto.com/). +* Open an issue if you are having troubles with this module. \ No newline at end of file diff --git a/classes/cryptopayhelper.php b/classes/cryptopayhelper.php new file mode 100644 index 0000000..b12d8be --- /dev/null +++ b/classes/cryptopayhelper.php @@ -0,0 +1,197 @@ + +* @copyright 2018-2020 Foris Limited ("Crypto.com") +* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0 +*/ + +class CryptoPayHelper +{ + const PAYMENT_ENDPOINT = 'payments'; + const REFUND_ENDPOINT = 'refunds'; + + protected $base_url = 'https://pay.crypto.com/api/'; + protected $secret_key = ''; + protected $mode = 'test'; + protected $publishable_key = ''; + protected $signature_secret = ''; + + public function __construct() + { + $mode = $this->getPaymentMode(); + if ($mode =='live') { + $this->setSecretKey(Configuration::get('CRYPTO_PAY_LIVE_SECRET_KEY')); + $this->setPublishableKey(Configuration::get('CRYPTO_PAY_LIVE_PUBLISHABLE_KEY')); + $this->setSignatureSecret(Configuration::get('CRYPTO_PAY_LIVE_SIGNATURE_SECRET')); + } else { + $this->setSecretKey(Configuration::get('CRYPTO_PAY_TEST_SECRET_KEY')); + $this->setPublishableKey(Configuration::get('CRYPTO_PAY_TEST_PUBLISHABLE_KEY')); + $this->setSignatureSecret(Configuration::get('CRYPTO_PAY_TEST_SIGNATURE_SECRET')); + } + $this->setMode($mode); + } + + /** + * @param string $signature_secret + */ + public function setSignatureSecret($signature_secret) + { + $this->signature_secret = $signature_secret; + } + + /** + * @return string + */ + public function getSignatureSecret() + { + return $this->signature_secret; + } + /** + * @return string + */ + public function getPublishableKey() + { + return $this->publishable_key; + } + + /** + * @param string $publishable_key + */ + public function setPublishableKey($publishable_key) + { + $this->publishable_key = $publishable_key; + } + /** + * @param string $secret_key + */ + public function setSecretKey($secret_key) + { + $this->secret_key = $secret_key; + } + /** + * @return string + */ + public function getBaseUrl() + { + return $this->base_url; + } + + /** + * @return string + */ + public function getMode() + { + return $this->mode; + } + + /** + * @param string $mode + */ + public function setMode($mode) + { + $this->mode = $mode; + } + /** + * @return string + */ + public function getSecretKey() + { + return $this->secret_key; + } + + public function getPayments($crypto_payment_id = 0) + { + $endpoint = self::PAYMENT_ENDPOINT; + if ($crypto_payment_id) { + $endpoint .= '/'.$crypto_payment_id; + } + return $this->makeRequest($endpoint); + } + + public function createPayment($payment_data) + { + $response = $this->makeRequest(self::PAYMENT_ENDPOINT, $payment_data); + return $response; + } + + public function cancelPayment($crypto_payment_id) + { + $endpoint = self::PAYMENT_ENDPOINT; + if ($crypto_payment_id) { + $endpoint .= '/'.$crypto_payment_id.'/cancel'; + } + return $this->makeRequest($endpoint); + } + + public function makeRefund($refund_data) + { + return $this->makeRequest(self::REFUND_ENDPOINT, $refund_data); + } + + protected function makeRequest($endpoint = self::PAYMENT_ENDPOINT, $params = array()) + { + $url = $this->getBaseUrl(); + $curl = curl_init(); + if ($endpoint) { + $url = $this->getBaseUrl().$endpoint; + } else { + $url = $this->getBaseUrl().self::PAYMENT_ENDPOINT; + } + curl_setopt($curl, CURLOPT_HEADER, false); + curl_setopt($curl, CURLINFO_HEADER_OUT, true); + curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); + curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); + curl_setopt($curl, CURLOPT_FORBID_REUSE, false); + curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); + curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 10); + curl_setopt($curl, CURLOPT_TIMEOUT, 10); + curl_setopt($curl, CURLOPT_URL, $url); + // add colon as per instructions in api doc + curl_setopt($curl, CURLOPT_USERPWD, $this->getSecretKey() . ':'); + if (!empty($params)) { + curl_setopt($curl, CURLOPT_POST, true); + curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($params)); + } + $response = curl_exec($curl); + self::log('Crypto Pay Response'."\n".$endpoint, $response, 'info', 'makeRequest'); + return json_decode($response, true); + } + + public function getPaymentMode() + { + return Configuration::get('CRYPTO_PAY_API_MODE'); + } + + public static function log($message = '', $response = '', $type = '', $method = '') + { + if (Configuration::get('CRYPTO_PAY_API_DEBUG_MODE')) { + $db = Db::getInstance(); + $db->insert( + 'crypto_pay_logs', + array( + 'method' => pSQL($method), + 'type' => pSQL($type), + 'message' => pSQL($message), + 'data' => pSQL($response, true), + 'created_at' => pSQL(date("Y-m-d H:i:s")) + ) + ); + } + } +} diff --git a/classes/cryptopaytransaction.php b/classes/cryptopaytransaction.php new file mode 100644 index 0000000..984fed7 --- /dev/null +++ b/classes/cryptopaytransaction.php @@ -0,0 +1,240 @@ + +* @copyright 2018-2020 Foris Limited ("Crypto.com") +* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0 +*/ + +class CryptoPayTransactions extends ObjectModel +{ + protected $refund_fields = array( + 'id_crypto_refund', + 'id', + 'currency', + 'amount', + 'debit_currency', + 'debit_amount', + 'created', + 'reason', + 'description', + 'payment_id', + 'status', + 'id_order' + ); + public static $definition = array( + 'table' => 'crypto_pay_transactions', + 'primary' => 'id_crypto_pay', + 'multilang' => false, + 'fields' => array( + 'id_crypto_pay' => array('type' => self::TYPE_INT, 'validate' => 'isInt'), + 'id' => array('type' => self::TYPE_STRING, 'db_type' => 'text'), + 'amount' => array('type' => self::TYPE_FLOAT, 'db_type' => 'float'), + 'amount_refunded' => array('type' => self::TYPE_FLOAT, 'db_type' => 'float'), + 'created' => array('type' => self::TYPE_STRING, 'db_type' => 'text'), + 'crypto_currency' => array('type' => self::TYPE_STRING, 'db_type' => 'text'), + 'crypto_amount' => array('type' => self::TYPE_FLOAT, 'db_type' => 'float'), + 'currency' => array('type' => self::TYPE_STRING, 'db_type' => 'text'), + 'customer_id' => array('type' => self::TYPE_STRING, 'db_type' => 'text'), + 'data_url' => array('type' => self::TYPE_STRING, 'db_type' => 'text'), + 'description' => array('type' => self::TYPE_STRING, 'db_type' => 'text'), + 'live_mode' => array('type' => self::TYPE_STRING, 'db_type' => 'text'), + 'metadata' => array('type' => self::TYPE_STRING, 'db_type' => 'text'), + 'order_id' => array('type' => self::TYPE_STRING, 'db_type' => 'text'), + 'recipient' => array('type' => self::TYPE_STRING, 'db_type' => 'text'), + 'status' => array('type' => self::TYPE_STRING, 'db_type' => 'text'), + 'refunded' => array('type' => self::TYPE_STRING, 'db_type' => 'text'), + 'time_window' => array('type' => self::TYPE_INT, 'db_type' => 'int'), + 'id_cart' => array('type' => self::TYPE_INT, 'db_type' => 'int'), + 'id_shop' => array('type' => self::TYPE_INT, 'db_type' => 'int'), + 'id_order' => array('type' => self::TYPE_INT, 'db_type' => 'int'), + ), + ); + + public $id_crypto_pay; + public $id; + public $amount; + public $amount_refunded; + public $created; + public $crypto_currency; + public $crypto_amount; + public $currency; + public $customer_id; + public $data_url; + public $description; + public $live_mode; + public $metadata; + public $order_id; + public $recipient; + public $status; + public $refunded; + public $time_window; + public $id_cart; + public $id_shop; + public $id_order; + + public function addTransaction($payment_data) + { + if (!isset($payment_data['id_cart'])) { + $payment_data['id_cart'] = 0; + } + $payment = self::getTransactionByCartId($payment_data['id_cart']); + if ($payment && isset($payment['id']) && $payment['id']) { + $payment_data['id_crypto_pay'] = $payment['id_crypto_pay']; + $this->updateTransaction($payment_data); + } else { + foreach ($payment_data as $key => $resp) { + if (is_array($resp)) { + $resp = json_encode($resp); + } + if (in_array($key, array_keys(self::$definition['fields']))) { + if ($key=='created') { + $resp = pSQL(date("Y-m-d H:i:s", $resp)); + } + $this->{$key} = pSQL($resp); + } + } + $this->force_id = true; + $this->add(); + } + } + public function getRefunds($payment_id) + { + $sql = 'SELECT * FROM `' ._DB_PREFIX_ . 'crypto_pay_refund` WHERE payment_id LIKE "'.pSQL($payment_id).'"'; + try { + $result = Db::getInstance()->executeS($sql); + if (!empty($result) && !$result['0']) { + $result = array(); + } + return $result; + } catch (PrestaShopDatabaseException $e) { + return array(); + } + } + public function addRefund($refund_data) + { + $refund = $this->getRefunds($refund_data['id']); + if ($refund && $refund['id']) { + $this->updateRefund($refund); + } else { + $sql = 'INSERT INTO `' ._DB_PREFIX_ . 'crypto_pay_refund` SET '; + foreach ($this->refund_fields as $value) { + if (isset($refund_data[$value]) && is_array($refund_data[$value])) { + $refund_data[$value] = json_encode($refund_data[$value]); + } + if (isset($refund_data[$value])) { + if ($value=='created') { + $refund_data[$value] = pSQL(date("Y-m-d H:i:s", $refund_data[$value])); + } + $sql .= '`' . bqSQL($value) . "` = '".pSQL($refund_data[$value])."',"; + } + } + $sql = rtrim($sql, ', '); + Db::getInstance()->execute($sql); + } + } + + public function updateRefund($refund_data) + { + $sql = 'UPDATE `' ._DB_PREFIX_ . 'crypto_pay_refund` SET '; + foreach ($this->refund_fields as $value) { + if (isset($refund_data[$value]) && is_array($refund_data[$value])) { + unset($refund_data[$value]); + continue; + } + if (isset($refund_data[$value])) { + if ($value=='created') { + $refund_data[$value] = pSQL(date("Y-m-d H:i:s", $refund_data[$value])); + } + $sql .= '`' . bqSQL($value) . '` = "'.pSQL($refund_data[$value]).'", '; + } + } + $sql = rtrim($sql, ', '); + if (isset($refund_data['id_crypto_refund']) && $refund_data['id_crypto_refund']) { + $sql .= " WHERE id_crypto_refund = '".(int)$refund_data['id_crypto_refund']."'"; + } + Db::getInstance()->execute($sql); + } + + public function updateTransaction($payment_data) + { + foreach ($payment_data as $key => $payment) { + if (is_array($payment)) { + $payment_data[$key] = json_encode($payment_data[$key]); + } + if (in_array($key, array_keys(self::$definition['fields']))) { + if ($key=='created') { + if (is_string($key) && $payment) { + $payment_data[$key] = pSQL(date("Y-m-d H:i:s", $payment)); + } + } + } else { + unset($payment_data[$key]); + } + } + if (!empty($payment_data)) { + foreach (self::$definition['fields'] as $field => $field_info) { + if (!empty($field_info) && !isset($payment_data[$field])) { + $payment_data[$field] = ''; + } + } + } + + if (isset($payment_data['id_crypto_pay']) && $payment_data['id_crypto_pay']) { + Db::getInstance()->update( + 'crypto_pay_transactions', + $payment_data, + ' id_crypto_pay = "'.(int)$payment_data['id_crypto_pay'].'"' + ); + } elseif (isset($payment_data['id']) && $payment_data['id']) { + Db::getInstance()->update( + 'crypto_pay_transactions', + $payment_data, + ' id LIKE "'.pSQL(trim($payment_data['id'])).'"' + ); + } + } + + + public static function getTransaction($cryptoPaymentId) + { + $sql = new DbQuery(); + $sql->select('*'); + $sql->from('crypto_pay_transactions'); + $sql->where('id LIKE "'.pSQL(trim($cryptoPaymentId)).'"'); + return Db::getInstance()->getRow($sql); + } + + public static function getTransactionByOrderId($id_order) + { + $sql = new DbQuery(); + $sql->select('*'); + $sql->from('crypto_pay_transactions'); + $sql->where('id_order = "'.(int)$id_order.'"'); + return Db::getInstance()->getRow($sql); + } + + public static function getTransactionByCartId($id_cart) + { + $sql = new DbQuery(); + $sql->select('*'); + $sql->from('crypto_pay_transactions'); + $sql->where('id_cart = "'.(int)$id_cart.'"'); + return Db::getInstance()->getRow($sql); + } +} diff --git a/classes/index.php b/classes/index.php new file mode 100644 index 0000000..4e3c22b --- /dev/null +++ b/classes/index.php @@ -0,0 +1,32 @@ + +* @copyright 2018-2020 Foris Limited ("Crypto.com") +* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0 +*/ + +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../../../'); +exit; \ No newline at end of file diff --git a/controllers/admin/AdminCryptoPayLogController.php b/controllers/admin/AdminCryptoPayLogController.php new file mode 100644 index 0000000..045c079 --- /dev/null +++ b/controllers/admin/AdminCryptoPayLogController.php @@ -0,0 +1,160 @@ + +* @copyright 2018-2020 Foris Limited ("Crypto.com") +* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0 +*/ + +class AdminCryptoPayLogController extends ModuleAdminController +{ + public function __construct() + { + $this->bootstrap = true; + $this->table = 'crypto_pay_logs'; + $this->identifier = 'id'; + $this->list_no_link = true; + $this->_orderBy = 'id'; + $this->_orderWay = 'DESC'; + $this->addRowAction('deletelog'); + parent::__construct(); + $this->fields_list = array( + 'id' => array( + 'title' => $this->l('ID'), + 'type' => 'text', + 'align' => 'center', + 'class' => 'fixed-width-xs', + ), + 'method' => array( + 'title' => $this->l('ACTION'), + 'type' => 'text', + 'align' => 'center', + ), + 'type' => array( + 'title' => $this->l('TYPE'), + 'type' => 'text', + 'align' => 'center', + ), + 'message' => array( + 'title' => $this->l('MESSAGE'), + 'type' => 'text', + 'align' => 'center', + ), + 'data' => array( + 'title' => $this->l('RESPONSE'), + 'type' => 'text', + 'align' => 'center', + 'search' => false, + 'class' => 'fixed-width-xs', + 'callback' => 'viewLogButton' + ), + 'created_at' => array( + 'title' => $this->l('CREATED AT'), + 'type' => 'datetime', + 'align' => 'center', + + ), + ); + } + + public function initToolbar() + { + $this->toolbar_btn['export'] = array( + 'href' => self::$currentIndex.'&export'.$this->table.'&token='.$this->token, + 'desc' => $this->l('Export') + ); + } + public function initPageHeaderToolbar() + { + if (empty($this->display)) { + $this->page_header_toolbar_btn['delete_logs'] = array( + 'href' => $this->context->link->getAdminLink('AdminCryptoPayLog').'&delete_logs', + 'desc' => $this->l('Delete All Logs'), + 'icon' => 'process-icon-eraser' + ); + } + parent::initPageHeaderToolbar(); + } + public function renderList() + { + return parent::renderList(); + } + + public function viewLogButton($product_error, $data) + { + $data['data'] = $product_error; + $data['token'] = $this->token; + $this->context->smarty->assign( + $data + ); + return $this->context->smarty->fetch( + _PS_MODULE_DIR_ . 'cryptopay/views/templates/admin/log.tpl' + ); + } + + public function postProcess() + { + if (Tools::getIsset('delete_logs')) { + $result = $this->deleteLogs(); + if (isset($result['success']) && $result['success'] == true) { + $this->confirmations[] = $result['message']; + } else { + $this->errors[] = $result['message']; + } + } + if (Tools::getIsset('deletelog')) { + $result = $this->deleteLogs(Tools::getValue('id')); + if (isset($result['success']) && $result['success'] == true) { + $this->confirmations[] = $result['message']; + } else { + $this->errors[] = $result['message']; + } + } + parent::postProcess(); + } + + public function deleteLogs($log_id = '') + { + $db = Db::getInstance(); + try { + if (empty($log_id)) { + $res = $db->delete( + 'crypto_pay_logs' + ); + } else { + $res = $db->delete( + 'crypto_pay_logs', + 'id='.(int)$log_id + ); + } + if ($res) { + return array( + 'success' => true, + 'message' => $this->l("Log(s) deleted successfully") + ); + } else { + return array( + 'success' => false, + 'message' => $this->l("Failed to delete Log(s)") + ); + } + } catch (Exception $e) { + PrestaShopLogger::addLog($e->getMessage()); + } + } +} diff --git a/controllers/admin/AdminCryptoPayPaymentController.php b/controllers/admin/AdminCryptoPayPaymentController.php new file mode 100644 index 0000000..4481cf9 --- /dev/null +++ b/controllers/admin/AdminCryptoPayPaymentController.php @@ -0,0 +1,168 @@ + +* @copyright 2018-2020 Foris Limited ("Crypto.com") +* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0 +*/ + +require_once _PS_MODULE_DIR_.'cryptopay/classes/cryptopaytransaction.php'; +require_once _PS_MODULE_DIR_.'cryptopay/classes/cryptopayhelper.php'; + +class AdminCryptoPayPaymentController extends ModuleAdminController +{ + public function __construct() + { + $this->bootstrap = true; + $this->table = 'crypto_pay_transactions'; + $this->identifier = 'id_crypto_pay'; + $this->_orderBy = 'id_crypto_pay'; + $this->_orderWay = 'DESC'; + $this->lang = false; + $this->list_no_link = true; + $this->addRowAction('delete'); + $this->className = 'CryptoPayTransactions'; + parent::__construct(); + $this->fields_list = array( + 'id_crypto_pay' => array( + 'title' => $this->l('ID'), + 'type' => 'text', + ), + 'id' => array( + 'title' => $this->l('Crypto.com Payment ID'), + 'type' => 'text', + ), + 'id_cart' => array( + 'title' => $this->l('Cart ID'), + 'type' => 'text', + ), + 'id_order' => array( + 'title' => $this->l('Order ID'), + 'type' => 'text', + 'class' => 'text-center', + 'callback' => 'viewStoreOrder' + ), + 'crypto_amount' => array( + 'title' => $this->l('Amount'), + 'type' => 'text', + ), + 'crypto_currency' => array( + 'title' => $this->l('Currency'), + 'type' => 'text', + ), + 'created' => array( + 'title' => $this->l('Created'), + 'type' => 'datetime', + ), + 'status' => array( + 'title' => $this->l('Status'), + 'type' => 'text', + 'class' => 'text-center', + 'callback' => 'viewCancelPaymentButton' + ), + ); + $this->bulk_actions = array( + 'delete' => array( + 'text' => $this->module->l('Delete', 'AdminCedAmazonAccountController'), + 'confirm' => $this->module->l('Delete Selected Account(s) ?', 'AdminCedAmazonAccountController'), + 'icon' => 'icon-trash' + ) + ); + if (Tools::getIsset('cancelpayment') && Tools::getValue('cancelpayment')) { + $cryptopayhelper = new CryptoPayHelper(); + $cryptopaytransaction = new CryptoPayTransactions(); + $response = $cryptopayhelper->cancelPayment(Tools::getValue('cancelpayment')); + if (!empty($response) && !isset($response['error'])) { + $cryptopaytransaction->updateTransaction($response); + } elseif (isset($response['error']['code'])) { + $this->errors[] = $response['error']['code']; + } else { + $this->errors[] = $this->l('Failed to Cancel Payment.'); + } + } + } + public function viewStoreOrder($field_data, $rowdata) + { + if ($rowdata['id_order']!='') { + $link = new LinkCore(); + $order_url = $link->getAdminLink('AdminOrders').'&vieworder=&id_order='.$rowdata['id_order']; + $this->context->smarty->assign( + array( + 'order_url' => $order_url, + 'id_order' => $rowdata['id_order'], + ) + ); + return $this->context->smarty->fetch( + _PS_MODULE_DIR_ . 'cryptopay/views/templates/admin/view_store_order.tpl' + ); + } else { + return $field_data; + } + } + public function viewCancelPaymentButton($field_data, $rowdata) + { + if ($rowdata['status']=='pending') { + $link = new LinkCore(); + $order_url = $link->getAdminLink('AdminCryptoPayPayment').'&cancelpayment='.$rowdata['id']; + $this->context->smarty->assign( + array( + 'order_url' => $order_url, + 'id_crypto_pay' => $rowdata['id_crypto_pay'], + 'status' => $rowdata['status'], + ) + ); + return $this->context->smarty->fetch( + _PS_MODULE_DIR_ . 'cryptopay/views/templates/admin/cancel_order.tpl' + ); + } else { + return $field_data; + } + } + public function ajaxProcessRefundOrder() + { + $params = Tools::getAllValues(); + if (isset($params['crypto_payment_id']) + && $params['crypto_payment_id'] + && isset($params['amount']) && $params['amount'] + ) { + $cryptopayHelper = new CryptoPayHelper(); + $refund_data = array( + 'payment_id' => trim($params['crypto_payment_id']), + 'amount' => $params['amount']*100 + ); + if (isset($params['reason']) && $params['reason']) { + $refund_data['reason'] = trim($params['reason']); + } + if (isset($params['description']) && $params['description']) { + $refund_data['description'] = trim($params['description']); + } + $response = $cryptopayHelper->makeRefund($refund_data); + if (!isset($response['error']) && isset($response['id'])) { + $cryptoPayTransactions = new CryptoPayTransactions(); + $cryptoPayTransactions->addRefund($response); + $response = array('success' => true, 'message' => 'Refund Created With '.$response['id']); + } else { + $response = array('success' => false, 'message' => $response['error']['code']); + } + die(Tools::jsonEncode($response)); + } else { + $response = array('success' => false, 'message' => 'Invalid Amount'); + die(Tools::jsonEncode($response)); + } + } +} diff --git a/controllers/admin/AdminCryptoPaySettingController.php b/controllers/admin/AdminCryptoPaySettingController.php new file mode 100644 index 0000000..4aae353 --- /dev/null +++ b/controllers/admin/AdminCryptoPaySettingController.php @@ -0,0 +1,34 @@ + +* @copyright 2018-2020 Foris Limited ("Crypto.com") +* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0 +*/ + +class AdminCryptoPaySettingController extends ModuleAdminController +{ + public function __construct() + { + $this->bootstrap = true; + $link = new LinkCore(); + $controller_link = $link->getAdminLink('AdminModules'); + Tools::redirectAdmin($controller_link . '&configure=cryptopay'); + parent::__construct(); + } +} diff --git a/controllers/admin/index.php b/controllers/admin/index.php new file mode 100644 index 0000000..4e3c22b --- /dev/null +++ b/controllers/admin/index.php @@ -0,0 +1,32 @@ + +* @copyright 2018-2020 Foris Limited ("Crypto.com") +* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0 +*/ + +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../../../'); +exit; \ No newline at end of file diff --git a/controllers/front/index.php b/controllers/front/index.php new file mode 100644 index 0000000..a5f0d7f --- /dev/null +++ b/controllers/front/index.php @@ -0,0 +1,32 @@ + +* @copyright 2018-2020 Foris Limited ("Crypto.com") +* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0 +*/ + +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../../../../'); +exit; \ No newline at end of file diff --git a/controllers/front/validation.php b/controllers/front/validation.php new file mode 100644 index 0000000..be36edd --- /dev/null +++ b/controllers/front/validation.php @@ -0,0 +1,281 @@ + +* @copyright 2018-2020 Foris Limited ("Crypto.com") +* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0 +*/ + +/** + * @since 1.5.0 + */ + +require_once _PS_MODULE_DIR_ . 'cryptopay/classes/cryptopayhelper.php'; +require_once _PS_MODULE_DIR_ . 'cryptopay/classes/cryptopaytransaction.php'; + +class CryptoPayValidationModuleFrontController extends ModuleFrontController +{ + public $ssl = true; + + /** + * Initialize cart controller. + * + * @see FrontController::init() + */ + public function init() + { + parent::init(); + } + + /** + * @see FrontController::initContent() + */ + public function initContent() + { + $paymentId = Tools::getValue('paymentId'); + if (!$paymentId) { + parent::initContent(); + if (Configuration::isCatalogMode() && Tools::getValue('action') === 'show') { + Tools::redirect('index.php'); + } + $cart = $this->context->cart; + if (($cart->id_customer == 0) + || ($cart->id_address_delivery == 0) + || ($cart->id_address_invoice == 0) + || (!$this->module->active) + ) { + Tools::redirect('index.php?controller=order&step=1'); + } + $authorized = false; + foreach (Module::getPaymentModules() as $module) { + if ($module['name'] == 'cryptopay') { + $authorized = true; + break; + } + } + if (!$authorized) { + die($this->module->l('This payment method is not available.', 'validation')); + } + $customer = new Customer($cart->id_customer); + if (!Validate::isLoadedObject($customer)) { + Tools::redirect('index.php?controller=order&step=1'); + } + $currency = $this->context->currency; + $total = (float)$cart->getOrderTotal(true, Cart::BOTH); + if (!$this->module->active) { + return; + } + $cryptopayhelper = new CryptoPayHelper(); + $publishable_key = $cryptopayhelper->getPublishableKey(); + if ($total) { + $payment = CryptoPayTransactions::getTransactionByCartId((int)$cart->id); + if (!empty($payment) && ($payment['amount'] == (number_format($total, 2) * 100))) { + $response = $payment; + } else { + $currency = new Currency($currency->id); + $zero_currencies = array( + 'BIF', + 'CLP', + 'DJF', + 'GNF', + 'JPY', + 'KMF', + 'KRW', + 'PYG', + 'RWF', + 'UGX', + 'VND', + 'VUV', + 'XAF', + 'XOF', + 'XPF' + ); + if (in_array($currency->iso_code, $zero_currencies)) { + $total = number_format($total, 0, '.', ''); + } else { + $total = number_format($total, 2, '.', '') * 100; + } + $payment_data = [ + 'amount' => $total, + 'currency' => $currency->iso_code, + 'description' => 'Cart ID #' . $cart->id, + 'customer_id' => $customer->id, + 'order_id' => $cart->id, + 'metadata' => [ + 'prestashop_cart_id' => $cart->id, + 'shop_name' => $this->context->shop->name, + 'plugin_name' => 'prestashop', + 'customer_name' => $customer->firstname . ' ' . $customer->lastname, + ], + ]; + + $response = $cryptopayhelper->createPayment($payment_data); + } + + if (!empty($response) && isset($response['id'])) { + $response['id_shop'] = $this->context->shop->id; + $response['id_cart'] = $this->context->cart->id; + $response['id_order'] = 0; + $cryptopaytransactions = new CryptoPayTransactions(); + $cryptopaytransactions->addTransaction($response); + $this->context->smarty->assign(array( + 'crypto_paypemt_status' => 'success', + 'total_to_pay' => Tools::displayPrice( + $total, + new Currency($currency->id), + false + ), + 'shop_name' => $this->context->shop->name, + 'publishable_key' => $publishable_key, + 'payment_id' => $response['id'], + 'prestashop_cart_id' => $cart->id, + 'cart_detailed' => $this->render('checkout/_partials/cart-detailed'), + 'cart_detailed_totals' => $this->render('checkout/_partials/cart-detailed-totals'), + 'cart_summary_items_subtotal' => $this->render( + 'checkout/_partials/cart-summary-items-subtotal' + ), + 'cart_summary_subtotals_container' => $this->render( + 'checkout/_partials/cart-summary-subtotals' + ), + 'cart_summary_totals' => $this->render( + 'checkout/_partials/cart-summary-totals' + ), + 'cart_detailed_actions' => $this->render('checkout/_partials/cart-detailed-actions'), + 'cart_voucher' => $this->render('checkout/_partials/cart-voucher'), + )); + $this->setTemplate('module:cryptopay/views/templates/front/payment_return.tpl'); + } elseif (isset($response['error'])) { + $this->context->smarty->assign( + array( + 'crypto_paypemt_status' => 'failed', + 'error' => $response['error'], + ) + ); + CryptoPayHelper::log( + 'Payment create Error', + json_encode($response), + 'Error', + 'Payment Object' + ); + $this->setTemplate('module:cryptopay/views/templates/front/payment_error.tpl'); + } + } else { + $this->context->smarty->assign(array('crypto_paypemt_status' => 'failed')); + CryptoPayHelper::log( + 'Payment create Error', + json_encode(array('Payment not needed.')), + 'Error', + 'Payment Object' + ); + $this->setTemplate('module:cryptopay/views/templates/front/payment_error.tpl'); + } + } + } + + public function displayAjaxGetPayment() + { + $paymentId = Tools::getValue('paymentId'); + $paymentId = trim($paymentId); + if ($paymentId) { + $type = Tools::getValue('type'); + if ($type == 'verify') { + $cryptoPayHelper = new CryptoPayHelper(); + $payment = $cryptoPayHelper->getPayments($paymentId); + $store_payment = CryptoPayTransactions::getTransaction($paymentId); + $payment['id_crypto_pay'] = (int)$store_payment['id_crypto_pay']; + } else { + $payment = CryptoPayTransactions::getTransaction($paymentId); + } + + if (!empty($payment) && isset($payment['id']) && $payment['id']) { + $payment_status = trim($payment['status']); + if (in_array(trim($payment_status), array('succeeded', 'cancelled'))) { + $total = (float)$this->context->cart->getOrderTotal(true, Cart::BOTH); + $currency = $this->context->currency; + $customer = $this->context->customer; + if ($payment_status == 'succeeded') { + $this->module->validateOrder( + (int)$this->context->cart->id, + (int)Configuration::get('PS_OS_PAYMENT'), + $total, + $this->module->displayName, + null, + array('transaction_id' => $paymentId), + (int)$currency->id, + false, + $customer->secure_key + ); + } elseif ($payment_status == 'pending') { + $this->module->validateOrder( + (int)$this->context->cart->id, + (int)Configuration::get('CRYPTO_PAY_OS_WAITING'), + $total, + $this->module->displayName, + null, + array('transaction_id' => $paymentId), + (int)$currency->id, + false, + $customer->secure_key + ); + } elseif ($payment_status == 'cancelled') { + $this->module->validateOrder( + (int)$this->context->cart->id, + (int)Configuration::get('PS_OS_CANCELLED'), + $total, + $this->module->displayName, + null, + array('transaction_id' => $paymentId), + (int)$currency->id, + false, + $customer->secure_key + ); + } + $payment['id_shop'] = (int)$this->context->shop->id; + $payment['id_cart'] = (int)$this->context->cart->id; + $payment['id_order'] = (int)$this->module->currentOrder; + $payment['id_crypto_pay'] = (int)$payment['id_crypto_pay']; + $cryptopaytransactions = new CryptoPayTransactions(); + $cryptopaytransactions->updateTransaction($payment); + $url = Context::getContext()->shop->getBaseURL(true) . + '/index.php?controller=order-confirmation&id_cart=' . + $this->context->cart->id . '&id_module=' . $this->module->id . + '&id_order=' . $this->module->currentOrder . '&key=' . $customer->secure_key; + + if (Configuration::get('PS_REWRITING_SETTINGS')) { + $url = Context::getContext()->shop->getBaseURL(true) . + 'order-confirmation?id_cart=' . + $this->context->cart->id . '&id_module=' . $this->module->id . + '&id_order=' . $this->module->currentOrder . '&key=' . $customer->secure_key; + } + die( + Tools::jsonEncode( + array( + 'redirect' => $url + ) + ) + ); + } + die(Tools::jsonEncode(array('waiting' => '5'))); + } else { + die(Tools::jsonEncode(array('waiting' => '5'))); + } + } else { + die(Tools::jsonEncode(array('waiting' => '5 '))); + } + } +} diff --git a/controllers/front/webhook.php b/controllers/front/webhook.php new file mode 100644 index 0000000..11e5264 --- /dev/null +++ b/controllers/front/webhook.php @@ -0,0 +1,122 @@ + +* @copyright 2018-2020 Foris Limited ("Crypto.com") +* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0 +*/ + +/** + * @since 1.5.0 + */ + +require_once _PS_MODULE_DIR_.'cryptopay/classes/cryptopayhelper.php'; +require_once _PS_MODULE_DIR_.'cryptopay/classes/cryptopaytransaction.php'; + +class CryptoPayWebhookModuleFrontController extends ModuleFrontController +{ + /** + * @see FrontController::postProcess() + */ + public function postProcess() + { + $cryptopayhelper = new CryptoPayHelper(); + $signature_secret = $cryptopayhelper->getSignatureSecret(); + $signature_secret = trim($signature_secret); + $signature_secret = trim($signature_secret, "\t"); + $response = Tools::file_get_contents('php://input'); + CryptoPayHelper::log('Webhook Fired', $response, 'info', 'postProcess'); + if ($response && isset($_SERVER['HTTP_PAY_SIGNATURE'])) { + $signature = $_SERVER['HTTP_PAY_SIGNATURE']; + $parts = explode(',', $signature); + $time = false; + $signature = false; + CryptoPayHelper::log('Webhook', json_encode($parts), 'info', 'postProcess'); + foreach ($parts as $part) { + $part = explode('=', $part); + CryptoPayHelper::log('Webhook', json_encode($part), 'info', 'postProcess'); + if ($part[0] == 't') { + $time = $part[1]; + } elseif ($part[0] == 'v1') { + $signature = $part[1]; + } + } + $string = $time . '.' . $response; + $hash = hash_hmac('sha256', $string, $signature_secret); + if (!hash_equals($signature, $hash)) { + $error = array( + 'message' => 'Invalid Webhook Request', + 'signature_secret ' => $signature_secret , + 'hash' => $hash, + ); + CryptoPayHelper::log('Webhook', json_encode($error), 'info', 'postProcess'); + exit; + } + $response = json_decode($response, true); + if (!empty($response)) { + if (isset($response['data']['object']['id']) && $response['data']['object']['id']) { + try { + if (($response['type'] == 'payment.captured') || ($response['type'] == 'payment.created')) { + $cryptopaytransactions = new CryptoPayTransactions(); + $cryptopaytransactions->updateTransaction($response['data']['object']); + } + } catch (PrestaShopDatabaseException $e) { + CryptoPayHelper::log($e->getMessage()); + exit; + } catch (PrestaShopException $e) { + CryptoPayHelper::log($e->getMessage()); + exit; + } + if (isset($response['data']['object']) && !empty($response['data']['object']) + && ($response['type'] == 'payment.refund_transferred') + && ($response['data']['object']['status'] == 'succeeded') + ) { + $id_order_state = Configuration::get('PS_OS_REFUND'); + $cryptoPayTransactions = new CryptoPayTransactions(); + $cryptoPayHelper = new CryptoPayHelper(); + $cryptoPayTransactions->addRefund($response['data']['object']); + $payments = $cryptoPayHelper->getpayments($response['data']['object']['payment_id']); + $cryptoPayTransactions->updateTransaction($payments); + + $order = new Order((int)Order::getOrderByCartId((int)$payments['order_id'])); + CryptoPayHelper::log('$order', json_encode($order), 'Order Data', 'refund_transferred'); + if ($order->getCurrentState() + && ($order->getCurrentState() != $id_order_state) + && ($payments['amount_refunded']==$payments['amount']) + ) { + $history = new OrderHistory(); + $history->id_order = $order->id; + $history->changeIdOrderState((int)$id_order_state, $order->id, true); + try { + $history->addWithemail(); + } catch (PrestaShopDatabaseException $e) { + CryptoPayHelper::log($e->getMessage()); + exit; + } catch (PrestaShopException $e) { + CryptoPayHelper::log($e->getMessage()); + exit; + } + exit; + } + } + } + } + } + exit; + } +} diff --git a/controllers/index.php b/controllers/index.php new file mode 100644 index 0000000..4e3c22b --- /dev/null +++ b/controllers/index.php @@ -0,0 +1,32 @@ + +* @copyright 2018-2020 Foris Limited ("Crypto.com") +* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0 +*/ + +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../../../'); +exit; \ No newline at end of file diff --git a/cryptopay.php b/cryptopay.php new file mode 100644 index 0000000..8118f4e --- /dev/null +++ b/cryptopay.php @@ -0,0 +1,693 @@ + +* @copyright 2018-2020 Foris Limited ("Crypto.com") +* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0 +*/ + +require_once _PS_MODULE_DIR_.'cryptopay/classes/cryptopayhelper.php'; +require_once _PS_MODULE_DIR_.'cryptopay/classes/cryptopaytransaction.php'; + +use PrestaShop\PrestaShop\Core\Payment\PaymentOption; + +if (!defined('_PS_VERSION_')) { + exit; +} + +require_once _PS_MODULE_DIR_.'cryptopay/classes/cryptopayhelper.php'; + +class Cryptopay extends PaymentModule +{ + public $details; + public $owner; + public $address; + public $extra_mail_vars; + + public function __construct() + { + $this->name = 'cryptopay'; + $this->tab = 'payments_gateways'; + $this->version = '1.0.0'; + $this->ps_versions_compliancy = array('min' => '1.7', 'max' => _PS_VERSION_); + $this->author = 'Crypto.com'; + $this->controllers = array('validation'); + $this->is_eu_compatible = 1; + $this->currencies = true; + $this->module_key = '7a10b1c0440ed9b43192fd15f8188f31'; + $this->currencies_mode = 'checkbox'; + $this->limited_currencies = array('USD', 'EUR'); + $this->bootstrap = true; + parent::__construct(); + $this->displayName = $this->l('Crypto.com Pay'); + $this->description = $this->l( + 'Crypto.com Pay Payment is a Module of Crypto.com Pay, + which utilises Crypto.com Chain as a high performing native blockchain solution. + This enables the transaction flows between crypto users and merchants seamless, cost-efficient and secure.' + ); + if (!count(Currency::checkPaymentCurrencies($this->id))) { + $this->warning = $this->l('No currency has been set for this module.'); + } + } + + public function install() + { + if (Shop::isFeatureActive()) { + try { + Shop::setContext(Shop::CONTEXT_ALL); + } catch (PrestaShopException $e) { + } + } + if (file_exists(dirname(__FILE__) . '/sql/install.php')) { + include(dirname(__FILE__) . '/sql/install.php'); + } + if (!parent::install() + || !$this->registerHook('paymentOptions') + || !$this->registerHook('hookDisplayPaymentEU') + || !$this->registerHook('paymentReturn') + || !$this->registerHook('orderConfirmation') + || !$this->registerHook('adminOrder') + || !$this->installOrderState() + || !$this->installTab('AdminCryptoPay', 'Crypto.com Pay', 0) + || !$this->installTab( + 'AdminCryptoPayPayment', + 'Payment(s)', + (int)Tab::getIdFromClassName('AdminCryptoPay') + ) + || !$this->installTab( + 'AdminCryptoPayLog', + 'Log(s)', + (int)Tab::getIdFromClassName('AdminCryptoPay') + ) + || !$this->installTab( + 'AdminCryptoPaySetting', + 'Setting(s)', + (int)Tab::getIdFromClassName('AdminCryptoPay') + ) + ) { + return false; + } + if (!Currency::exists('USD', 0) && + !Currency::exists('EUR', 0)) { + $this->_errors[] = $this->l('Crypto.com Payment Method is only available + when one of this (USD, EUR) currency is activated.'); + return false; + } + return true; + } + + public function installTab($class_name, $tab_name, $parent, $active = 1) + { + $tab = new Tab(); + $tab->active = $active; + $tab->class_name = $class_name; + $tab->name = array(); + foreach (Language::getLanguages(true) as $lang) { + $tab->name[$lang['id_lang']] = $tab_name; + } + if ($parent == 0 && _PS_VERSION_ >= '1.7') { + $tab->id_parent = (int)Tab::getIdFromClassName('SELL'); + $tab->icon = 'account_balance_wallet'; + } else { + $tab->id_parent = $parent; + } + $tab->module = $this->name; + return $tab->add(); + } + + /** + * uninstall tabs created by module + * @throws PrestaShopException + */ + public function uninstallTab($class_name) + { + $id_tab = (int)Tab::getIdFromClassName($class_name); + if ($id_tab) { + $tab = new Tab($id_tab); + return $tab->delete(); + } else { + return false; + } + } + + public function uninstall() + { + Configuration::deleteByName('CRYPTO_PAY_API_MODE'); + $this->unregisterHook('paymentOptions'); + $this->unregisterHook('hookDisplayPaymentEU'); + $this->unregisterHook('paymentReturn'); + $this->unregisterHook('orderConfirmation'); + $this->unregisterHook('adminOrder'); + try { + $this->uninstallTab('AdminCryptoPay'); + $this->uninstallTab('AdminCryptoPayPayment'); + $this->uninstallTab('AdminCryptoPayLog'); + $this->uninstallTab('AdminCryptoPaySetting'); + } catch (PrestaShopException $e) { + return false; + } + return parent::uninstall(); + } + + /** + * Load the configuration form + */ + public function getContent() + { + /** + * If values have been submitted in the form, process. + */ + $output = ''; + if (((bool)Tools::isSubmit('submitCryptoPayModule')) == true) { + $this->postProcess(); + $output .= $this->displayConfirmation("Setting Saved Successfully."); + } + + $this->context->smarty->assign('module_dir', $this->_path); + + $output .= $this->context->smarty->fetch($this->local_path.'views/templates/admin/configure.tpl'); + + return $output.$this->renderForm(); + } + + /** + * Create the form that will be displayed in the configuration of your module. + */ + protected function renderForm() + { + $helper = new HelperForm(); + $helper->show_toolbar = false; + $helper->table = $this->table; + $helper->module = $this; + $helper->default_form_language = $this->context->language->id; + $helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG', 0); + + $helper->identifier = $this->identifier; + $helper->submit_action = 'submitCryptoPayModule'; + $helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false) + .'&configure='.$this->name.'&tab_module='.$this->tab.'&module_name='.$this->name; + $helper->token = Tools::getAdminTokenLite('AdminModules'); + + $helper->tpl_vars = array( + 'fields_value' => $this->getConfigFormValues(), /* Add values for your inputs */ + 'languages' => $this->context->controller->getLanguages(), + 'id_language' => $this->context->language->id, + ); + + return $helper->generateForm($this->getConfigForm()); + } + + /** + * Create the structure of your form. + */ + protected function getConfigForm() + { + + $this->context->smarty->assign(array( + 'base_url' => Context::getContext()->shop->getBaseURL(true), + 'is_rewrite_enabled' => Configuration::get('PS_REWRITING_SETTINGS') + )); + $webhook_html = $this->display( + __FILE__, + 'views/templates/admin/webhook.tpl' + ); + $fields_form = array(); + $fields_form[0]['form'] = [ + 'legend' => [ + 'title' => $this->l('Payment Configuration'), + ], + 'description' => $this->l('You must first sign up for an account and get below details ') + . $this->getHelpLink("https://merchant.crypto.com/", $this->l("Crypto Pay")), + 'input' => [ + [ + 'type' => 'select', + 'label' => $this->l('API mode'), + 'desc' => $this->l( + 'Here you can set Environment of module in which you want to use like for test or in live.' + ), + 'name' => 'CRYPTO_PAY_API_MODE', + 'required' => false, + 'default_value' => 'test', + 'options' => [ + 'query' => [ + [ + 'id' => 'test', + 'value' => 'Test', + 'label' => $this->l('Test') + ], + [ + 'id' => 'live', + 'value' => 'Live', + 'label' => $this->l('Live') + ] + ], + 'id' => 'id', + 'name' => 'value', + ] + ], + [ + 'type' => 'password', + 'label' => $this->l('Live Secret Key'), + 'desc' => $this->l( + 'You can manage your API keys within the Crypto Pay Developers tab ' + ) . $this->getHelpLink( + "https://merchant.crypto.com/developers/api_keys", + $this->l("Get Keys") + ) , + 'name' => 'CRYPTO_PAY_LIVE_SECRET_KEY', + 'required' => false + ], + [ + 'type' => 'text', + 'label' => $this->l('Live Publishable Key'), + 'desc' => $this->l( + 'You can manage your API keys within the Crypto Pay Developers tab ' + ) . $this->getHelpLink( + "https://merchant.crypto.com/developers/api_keys", + $this->l("Get Keys") + ) , + 'name' => 'CRYPTO_PAY_LIVE_PUBLISHABLE_KEY', + 'required' => false + ], + [ + 'type' => 'password', + 'label' => $this->l('Live Signature Secret '), + 'desc' => $this->l('This is use to verify the webhooks authenticity.'), + 'name' => 'CRYPTO_PAY_LIVE_SIGNATURE_SECRET', + 'required' => false + ], + [ + 'type' => 'password', + 'label' => $this->l('Test Secret Key'), + 'desc' => $this->l( + 'You can manage your API keys within the Crypto Pay Developers tab ' + ) . $this->getHelpLink( + "https://merchant.crypto.com/developers/api_keys", + $this->l("Get Keys") + ) , + 'name' => 'CRYPTO_PAY_TEST_SECRET_KEY', + 'required' => false + ], + [ + 'type' => 'text', + 'label' => $this->l('Test Publishable Key'), + 'desc' => $this->l( + 'You can manage your API keys within the Crypto Pay Developers tab ' + ) . $this->getHelpLink( + "https://merchant.crypto.com/developers/api_keys", + $this->l("Get Keys") + ) , + 'name' => 'CRYPTO_PAY_TEST_PUBLISHABLE_KEY', + 'required' => false + ], + [ + 'type' => 'password', + 'label' => $this->l('Test Signature Secret '), + 'desc' => $this->l('This is use to verify the webhooks authenticity.'), + 'name' => 'CRYPTO_PAY_TEST_SIGNATURE_SECRET', + 'required' => false + ], + [ + 'type' => 'textarea', + 'label' => $this->l('Payment Description Text'), + 'desc' => $this->l('This text will be shown when payment method selected on checkout.'), + 'name' => 'CRYPTO_PAY_PAYMENT_DESCRIPTION', + 'required' => false + ], + [ + 'type' => 'select', + 'label' => $this->l('Debug Mode'), + 'desc' => $this->l( + 'This is for developers and user to log data and see if any abnormal behaviour.' + ), + 'name' => 'CRYPTO_PAY_API_DEBUG_MODE', + 'required' => false, + 'default_value' => 'test', + 'options' => [ + 'query' => [ + [ + 'id' => '0', + 'value' => 'No', + 'label' => $this->l('No') + ], + [ + 'id' => '1', + 'value' => 'Yes', + 'label' => $this->l('Yes') + ] + ], + 'id' => 'id', + 'name' => 'value', + ] + ], + [ + 'col' => 8, + 'type' => 'html', + 'label' => $this->l('Webhook Url'), + 'name' => $webhook_html, + ], + ], + 'submit' => [ + 'title' => $this->l('Save'), + 'class' => 'btn btn-default pull-right' + ] + ]; + return $fields_form; + } + + /** + * Set values for the inputs. + */ + protected function getConfigFormValues() + { + return array( + 'CRYPTO_PAY_API_MODE' => Configuration::get('CRYPTO_PAY_API_MODE'), + 'CRYPTO_PAY_LIVE_SECRET_KEY' => Configuration::get('CRYPTO_PAY_LIVE_SECRET_KEY'), + 'CRYPTO_PAY_LIVE_PUBLISHABLE_KEY' => Configuration::get('CRYPTO_PAY_LIVE_PUBLISHABLE_KEY'), + 'CRYPTO_PAY_TEST_SECRET_KEY' => Configuration::get('CRYPTO_PAY_TEST_SECRET_KEY'), + 'CRYPTO_PAY_TEST_PUBLISHABLE_KEY' => Configuration::get('CRYPTO_PAY_TEST_PUBLISHABLE_KEY'), + 'CRYPTO_PAY_API_DEBUG_MODE' => Configuration::get('CRYPTO_PAY_API_DEBUG_MODE'), + 'CRYPTO_PAY_PAYMENT_DESCRIPTION' => Configuration::get('CRYPTO_PAY_PAYMENT_DESCRIPTION'), + 'CRYPTO_PAY_LIVE_SIGNATURE_SECRET' => Configuration::get('CRYPTO_PAY_LIVE_SIGNATURE_SECRET'), + 'CRYPTO_PAY_TEST_SIGNATURE_SECRET' => Configuration::get('CRYPTO_PAY_TEST_SIGNATURE_SECRET'), + ); + } + + /** + * Save form data. + */ + protected function postProcess() + { + $password_values = [ + 'CRYPTO_PAY_TEST_SECRET_KEY', + 'CRYPTO_PAY_TEST_SIGNATURE_SECRET', + 'CRYPTO_PAY_LIVE_SECRET_KEY', + 'CRYPTO_PAY_LIVE_SIGNATURE_SECRET' + ]; + $form_values = $this->getConfigFormValues(); + foreach (array_keys($form_values) as $key) { + $current_value = trim(Tools::getValue($key)); + if (in_array($key, $password_values) + && (trim(Tools::getValue($key))=='') + && (isset($form_values[$key]) && $form_values[$key]) + ) { + $current_value = $form_values[$key]; + } + Configuration::updateValue($key, $current_value); + } + } + + public function hookPaymentOptions($params) + { + try { + if (!$this->active) { + return; + } + + if (!$this->checkCurrency($params['cart'])) { + return; + } + + $cryptoPayment = new PaymentOption(); + $cryptoPayment->setCallToActionText($this->l('Crypto.com Pay')) + ->setAction($this->context->link->getModuleLink($this->name, 'validation', array(), true)) + ->setInputs([]) + ->setAdditionalInformation( + $this->context->smarty->fetch( + 'module:cryptopay/views/templates/front/payment_description.tpl' + ) + ) + ->setLogo(Media::getMediaPath(_PS_MODULE_DIR_.$this->name.'/views/img/icon.svg')); + if (Configuration::get('CRYPTO_PAY_PAYMENT_DESCRIPTION')) { + $cryptoPayment->setAdditionalInformation(Configuration::get('CRYPTO_PAY_PAYMENT_DESCRIPTION')); + } + return [ + $cryptoPayment, + ]; + } catch (Exception $exception) { + CryptoPayHelper::log( + "Hook Exception", + $exception->getMessage(), + 'Exception', + 'hookPaymentOptions' + ); + } + } + + public function hookDisplayPaymentEU($params) + { + try { + if (!$this->active || !$this->checkCurrency($params['cart'])) { + return; + } + return array( + 'cta_text' => $this->l('Crypto.com Pay'), + 'action' => $this->context->link->getModuleLink($this->name, 'validation', array(), true) + ); + } catch (Exception $exception) { + CryptoPayHelper::log( + "Hook Exception", + $exception->getMessage(), + 'Exception', + 'hookDisplayPaymentEU' + ); + } + } + + public function hookOrderConfirmation($params) + { + try { + $order = $params['order']; + if ($order) { + if ($order->module === $this->name) { + $payments = $order->getOrderPayments(); + if (count($payments) >= 1) { + $payment = $payments[0]; + $paymentId = $payment->transaction_id; + $response = (array)CryptoPayTransactions::getTransaction($paymentId); + $this->smarty->assign( + array( + 'total_to_pay' => Tools::displayPrice( + $params['order']->getOrdersTotalPaid(), + new Currency($params['order']->id_currency), + false + ), + 'shop_name' => $this->context->shop->name, + 'id_order' => $params['order']->id, + 'reference' => $params['order']->reference, + 'status' => $response['status'], + 'crypto_amount' => $response['crypto_amount'], + 'recipient' => $response['recipient'], + 'crypto_currency' => $response['crypto_currency'], + 'paymentId' => $paymentId + ) + ); + return $this->fetch('module:cryptopay/views/templates/hook/payment_return.tpl'); + } else { + $this->smarty->assign( + array( + 'order_reference' => $order->reference + ) + ); + return $this->fetch('module:cryptopay/views/templates/hook/payment_error.tpl'); + } + return; + } + } + } catch (Exception $exception) { + CryptoPayHelper::log( + "Hook Exception", + $exception->getMessage(), + 'Exception', + 'hookOrderConfirmation' + ); + } + } + + public function hookPaymentReturn($params) + { + try { + if (!$this->active) { + return; + } + $state = $params['order']->getCurrentState(); + if (in_array( + $state, + array( + Configuration::get('CRYPTO_PAY_OS_WAITING'), + Configuration::get('PS_OS_PAYMENT'), + Configuration::get('PS_OS_OUTOFSTOCK'), + Configuration::get('PS_OS_OUTOFSTOCK_UNPAID') + ) + ) + ) { + $order = $params['order']; + if ($order->module === $this->name) { + $payments = $order->getOrderPayments(); + if (count($payments) >= 1) { + $payment = $payments[0]; + $paymentId = $payment->transaction_id; + $response = CryptoPayTransactions::getTransaction($paymentId); + $this->smarty->assign( + array( + 'total_to_pay' => Tools::displayPrice( + $params['order']->getOrdersTotalPaid(), + new Currency($params['order']->id_currency), + false + ), + 'shop_name' => $this->context->shop->name, + 'id_order' => $params['order']->id, + 'reference' => $params['order']->reference, + 'status' => $response['status'], + 'crypto_amount' => $response['crypto_amount'], + 'recipient' => $response['recipient'], + 'crypto_currency' => $response['crypto_currency'] + ) + ); + } + } + } else { + $this->smarty->assign('status', 'failed'); + } + return $this->fetch('module:cryptopay/views/templates/hook/payment_return.tpl'); + } catch (Exception $exception) { + CryptoPayHelper::log( + "Hook Exception", + $exception->getMessage(), + 'Exception', + 'hookOrderConfirmation' + ); + } + } + + /** + * Hook: AdminOrder details + */ + public function hookAdminOrder($params) + { + try { + $order_id = Tools::getValue('id_order', 0); + try { + $order = new Order($order_id); + } catch (PrestaShopDatabaseException $e) { + return ''; + } catch (PrestaShopException $e) { + return ''; + } + /* Check if the order was paid with this Addon and display the Transaction details */ + if ($order->module === $this->name) { + // Retrieve the transaction details + $transaction = (array)CryptoPayTransactions::getTransactionByOrderId($order_id); + if (!empty($transaction) && isset($transaction['id']) && $transaction['id']) { + $cryptoPayTransactions = new CryptoPayTransactions(); + $refunds = (array)$cryptoPayTransactions->getRefunds($transaction['id']); + $refunded_amount =0; + if (!empty($refunds)) { + foreach ($refunds as $refund) { + $refunded_amount += $refund['amount']*.01; + } + } + + $this->context->smarty->assign( + array( + 'id' => $transaction['id'], + 'status' => $transaction['status'], + 'created' => $transaction['created'], + 'order_total' => number_format( + $order->getOrdersTotalPaid(), + 2, + '.', + '' + ), + 'order_currency' => Currency::getCurrencyInstance($order->id_currency)->iso_code, + 'refunded_amount' => $refunded_amount, + 'crypto_amount' => $transaction['crypto_amount'], + 'recipient' => $transaction['recipient'], + 'token' => Tools::getAdminTokenLite('AdminCryptoPayPayment'), + 'crypto_currency' => $transaction['crypto_currency'], + 'refunds' => $refunds + ) + ); + return $this->display(__FILE__, 'views/templates/admin/admin-order.tpl'); + } + } + } catch (Exception $exception) { + CryptoPayHelper::log( + "Hook Exception", + $exception->getMessage(), + 'Exception', + 'hookOrderConfirmation' + ); + } + } + + public function checkCurrency($cart) + { + $currency_order = new Currency($cart->id_currency); + $currencies_module = $this->getCurrency($cart->id_currency); + if (is_array($currencies_module)) { + foreach ($currencies_module as $currency_module) { + if ($currency_order->id == $currency_module['id_currency']) { + return true; + } + } + } + return false; + } + + /** + * Create order state + * @return boolean + */ + public function installOrderState() + { + if (!Configuration::get('CRYPTO_PAY_OS_WAITING') + || !Validate::isLoadedObject(new OrderState(Configuration::get('CRYPTO_PAY_OS_WAITING')))) { + $order_state = new OrderState(); + $order_state->name = array(); + foreach (Language::getLanguages() as $language) { + $order_state->name[$language['id_lang']] = 'Awaiting for Crypto.com payment'; + } + $order_state->send_email = false; + $order_state->color = '#011f42'; + $order_state->hidden = false; + $order_state->delivery = false; + $order_state->logable = false; + $order_state->invoice = false; + if ($order_state->add()) { + $source = _PS_MODULE_DIR_.$this->name.'/views/img/payment.png'; + $destination = _PS_ROOT_DIR_.'/img/os/'.(int) $order_state->id.'.gif'; + copy($source, $destination); + } + + Configuration::updateValue('CRYPTO_PAY_OS_WAITING', (int) $order_state->id); + } + return true; + } + public function getHelpLink($href, $title, $new_tab = true) + { + $this->context->smarty->assign( + array( + 'href' => $href, + 'new_tab' => $new_tab, + 'title' => $title + ) + ); + return $this->display(__FILE__, 'views/templates/admin/help_link.tpl'); + } +} diff --git a/index.php b/index.php new file mode 100644 index 0000000..c0bbd7e --- /dev/null +++ b/index.php @@ -0,0 +1,32 @@ + +* @copyright 2018-2020 Foris Limited ("Crypto.com") +* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0 +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; \ No newline at end of file diff --git a/logo.png b/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..64898e5573c921044cad3676cd995cf5d3a37cea GIT binary patch literal 5674 zcmbVQ2{=@3-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*JtAWq@! zG!gSZm|I)P@aAPMd1EP6P~LMJ2snNB+MfgR$LpVvf+wXhdrJyU(c@GbPjt*OCvBiz zD5dUAxM#35)H^}FoEHDWhBOiZ2#~kReH~vp6jTLCQgBoI;Fc90WMWfSMeQha!pv?6 zF`fpI{j_^C6iOpp7v8@+SJpY<92gafnNZr+6KXf1)Qnf=bEPJHxO(KX?Po3ZgTRh; zyu`RWfEkGDA7UZZ^}~Uh=dN~q9FliBk9QbPV0$yXr-2BU>VZVBdWk@py7mUuMJC;? z_z9>EHSa;V)Es8mP3dnkiu+W(u2);7?})3_e^U)yy1SpWb4 literal 0 HcmV?d00001 diff --git a/publish.sh b/publish.sh new file mode 100755 index 0000000..0ef512d --- /dev/null +++ b/publish.sh @@ -0,0 +1,5 @@ +rm ${PWD##*/}.zip +rm -rf cryptopay +rsync -av --progress . cryptopay --exclude .git --exclude .gitignore --exclude .DS_Store --exclude publish.sh --exclude README.md +zip -r ${PWD##*/}.zip cryptopay +rm -rf cryptopay \ No newline at end of file diff --git a/sql/index.php b/sql/index.php new file mode 100644 index 0000000..951dfe3 --- /dev/null +++ b/sql/index.php @@ -0,0 +1,32 @@ + +* @copyright 2018-2020 Foris Limited ("Crypto.com") +* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0 +*/ + +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../'); +exit; diff --git a/sql/install.php b/sql/install.php new file mode 100644 index 0000000..22089b0 --- /dev/null +++ b/sql/install.php @@ -0,0 +1,82 @@ + +* @copyright 2018-2020 Foris Limited ("Crypto.com") +* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0 +*/ + +$sql = array(); + +$sql[] = 'CREATE TABLE `' . _DB_PREFIX_ . 'crypto_pay_refund` ( + `id_crypto_refund` int(11) NOT NULL AUTO_INCREMENT, + `id` varchar(150) NOT NULL, + `currency` varchar(10) NOT NULL, + `amount` float NOT NULL, + `debit_currency` varchar(10) NOT NULL, + `debit_amount` float NOT NULL, + `created` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `reason` varchar(100) NOT NULL, + `description` text NOT NULL, + `payment_id` varchar(150) NOT NULL, + `status` varchar(50) NOT NULL, + PRIMARY KEY (`id_crypto_refund`) +) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8;'; + +$sql[] = 'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'crypto_pay_logs` ( + `id` int(15) NOT NULL AUTO_INCREMENT, + `method` text NOT NULL, + `type` varchar(150) NOT NULL, + `message` text NULL, + `created_at` datetime NULL, + `data` longtext NULL, + PRIMARY KEY (`id`) +) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8;'; + +$sql[] = 'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'crypto_pay_transactions` ( + `id_crypto_pay` int(15) NOT NULL AUTO_INCREMENT, + `id` varchar(150) DEFAULT NULL, + `amount` float NOT NULL, + `amount_refunded` float NOT NULL, + `created` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `time_window` int(10) DEFAULT NULL, + `refunded` varchar(10) DEFAULT NULL, + `recipient` varchar(250) DEFAULT NULL, + `order_id` varchar(100) DEFAULT NULL, + `metadata` text DEFAULT NULL, + `live_mode` varchar(10) DEFAULT NULL, + `description` varchar(100) DEFAULT NULL, + `data_url` varchar(100) DEFAULT NULL, + `customer_id` varchar(100) DEFAULT NULL, + `currency` varchar(5) DEFAULT NULL, + `crypto_amount` float DEFAULT NULL, + `crypto_currency` varchar(50) NOT NULL, + `status` varchar(50) NOT NULL, + `id_cart` int(11) DEFAULT NULL, + `id_shop` int(11) DEFAULT NULL, + `id_order` int(11) DEFAULT NULL, + `remaining_time` timestamp NULL, + `resource_type` text NOT NULL, + `resource_id` text DEFAULT NULL, + `resource` text DEFAULT NULL, + PRIMARY KEY (`id_crypto_pay`) +) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8;'; + +foreach ($sql as $query) { + Db::getInstance()->execute($query); +} diff --git a/views/img/icon.png b/views/img/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..b3cf1b08bd461c0885a6af358309025da4c63aea GIT binary patch literal 1019 zcmVF7{`y9I*BZ17>!0{Qw&0T6%jBhZXph$WGlW^O-wX~#J9PMrPta5RbiFVG6b9~ z))y3frz(gxMM2!0h72jbpaoxu3I!CjIKY?e!}LX|2uik zJx>lH|A`@7(4UNBM-!oRY_E~8bOa$`eF+)zqbCu{8VJLp*Ga(cC&WK?HSb2cBO+we zc{kBL0GW<=6Q2P1Hqlc6eFNn12vYEG+EoCLAO&Qpg;gF4!<3_#LAlyTxbC)-zk|0y&4L^=?L#qXEzVn*~1N6h^O8@`wv?;gPI`^}(~;(YlXNBQIx zT?M5S4;pPw0h(iE{KAzaFuvg)rZ&hw0B66kV)=*1Emle7F zk6Sz7FVf+w2sP@PTCs6^5xl0UU^sIXK?^fn0{ARIj<`${YVI|oys8d{v)7>3mv8_E zhi=64m;Ye;(k%A?2*aZP#0^-n*?{;=6X#z)FhmJSaz0{G3h;U02In7eBCk*tMt=A6 zTb~UKiNp06UNny&W#_T~t9JUM)F%MGMTBe;? + + + + + image/svg+xml + + Button/Primary/Pay/Standalone/Standard width + + + + + + + + Button/Primary/Pay/Standalone/Standard width + Created with Sketch. + + background + + + + Layer 1 + + + + + + + + + + + + + + + + + + + + + diff --git a/views/img/index.php b/views/img/index.php new file mode 100644 index 0000000..a5f0d7f --- /dev/null +++ b/views/img/index.php @@ -0,0 +1,32 @@ + +* @copyright 2018-2020 Foris Limited ("Crypto.com") +* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0 +*/ + +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../../../../'); +exit; \ No newline at end of file diff --git a/views/img/logo.png b/views/img/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..64898e5573c921044cad3676cd995cf5d3a37cea GIT binary patch literal 5674 zcmbVQ2{=@3-ydX&gvhR@DN>jX!%X%iCXqFhrJ802gPFmMeaTYUC2J%^PZZf@UrJFz zWhZM{p6s&k-{`5{?|HxX{l4pa&vo7B+~+>O|L=eQ*K?f{YG|Ot$u7(e0021Ax?0Bc zD{_CZG1AXWUVQEJ%RwjID^vi0gLi*00FqM#0RUz-qA7-k(Z7hoQAl7co^pc#_8>XY z(Exyws)rL6=RlwVZxC#WWM$BNRUHUO#4Cf$<@KTZPMQQeqOO+Xn8 zrlz3_#fIoee?T?X(Ey^gH4!i*0wDtj!+vZ`Umt}gQ)yT-j)2xu2GOko6Nz|~0shoooS4Ou7@YJ)_=ZGOpXQE;yNq5mb1|9{F~av{RYar*^AcPrM7fCv3tB>u;){EO7xjzFjUAF1?@{P+t-rP$Eiu`UF4Te{nS zH4ejHB?N@Sz;K|XIgyN~xKq#k+8fReOSUD@8x{lv`6v7T+2kKy`fqLE7o6T(_NTv_ z8vW*XTO^R_)GqXYuu3SU1V8xWZds`eO0rk$z{~D<`hg z{t=kHG&R@D04D-1x-HLzDMIer`}>QS{4m+R{!&0EEvVZ({!n^*ZZi|W*-TF+>Zu=} zAD01Rz>*f$$m&5zKzU2f^vRglLLHk&0u&jVf$SHwCE5GVqrNuD`R{V(vS5Y!8`(x+ zaT)b_od~nI9ve?FGxMpS_?5u7_rYHT!&#iC{b|ZT#1nY!ZY+pNPNNLHl3#k{_^&t5i47{_Dtn5}$D zgeJs6AlPgpt3`}tNKT+JYkQzt_zCs;KdxKj3RV;RNIf6KkmJL7WtMNQP-aCGroYOL zySg8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|K~1tkUVEe%Xs{Kdz5+ty;`zp zF1mSp!zrq& zybs&ejXdSi+~jA#?2PVKoxwqWp!zRjw4RI()O@J}foE zuY1H;bk1KO=Hi{OCNuX7bGkwf>r2|6hFIfbH zSTPHMWK$jqOW+P^*_{RJn5?f>ZOUv;GYwWvFknhtro;6VdQxls5e&giXe0FLx1zg+ zdNh8{EBP!y}Xd7c3Ny!GYz_hp@FXVukTbj*&$+&ZOoU;T6wiZ*JtAWq@! zG!gSZm|I)P@aAPMd1EP6P~LMJ2snNB+MfgR$LpVvf+wXhdrJyU(c@GbPjt*OCvBiz zD5dUAxM#35)H^}FoEHDWhBOiZ2#~kReH~vp6jTLCQgBoI;Fc90WMWfSMeQha!pv?6 zF`fpI{j_^C6iOpp7v8@+SJpY<92gafnNZr+6KXf1)Qnf=bEPJHxO(KX?Po3ZgTRh; zyu`RWfEkGDA7UZZ^}~Uh=dN~q9FliBk9QbPV0$yXr-2BU>VZVBdWk@py7mUuMJC;? z_z9>EHSa;V)Es8mP3dnkiu+W(u2);7?})3_e^U)yy1SpWb4 literal 0 HcmV?d00001 diff --git a/views/img/logo_2.png b/views/img/logo_2.png new file mode 100644 index 0000000000000000000000000000000000000000..4a6a17ae4d27a0004a992532fb8eebf902720145 GIT binary patch literal 3705 zcmbuCc{J2*8^=jPiAc7PF#IrC29J<5jG>7!V;TDrGZhbhX!)^zXxUS`1-b-?fT{f1&;)<~PZMRuIBzIarIlVBfL z=|*EmRo*3DJjdIQjhg#+VO@klZ6gL}^AjHytMFfN4K^Fz*|Ul+k@bI3JJ^p)XRz|L zTn7=ZCcK=P9&noZ0oZLo2tffyj{aI76AQI1*g9@V5xsNsKh5Pd69fqsFJJlSOV zGZpU%pEq?^GaVWs9NUujzH#ZB6zgr%m8fVhdC2PET6^D*C%ZtMs@ zsEkt{&p#WMaF9hOv7E^wa02(`dN2MG#<1bcCjc+Rmo+;&Iphf$n6vm9jhcopeP>W> zg0PTB5T2R{W8#D0$=*6xGW09-RGXrPM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)h=9{?FZ)!(Zu^be8a{Q+P zGW~2~SE-npbIb)7{RXvN9*#N25wil-*GbP9w|_VPK9K7AD%FfzN3+_^WKQ| zZPoZ2wRZW(Ui{~w*Pe5}ZSQ~u)x95U<$WnwS!R0Ng&VMAY$XC!UKvU>5Q0Ill^HDH4qng+T~1EYTW3Q(($O0DTyQAOdlJ nOyLsLACn^TAM@XN_Le}=URM-+YzDdi_2al`iiABk_PF~mRVyfI literal 0 HcmV?d00001 diff --git a/views/img/payment.png b/views/img/payment.png new file mode 100644 index 0000000000000000000000000000000000000000..0a1cec8bcc75a1974070963255329b049697cc38 GIT binary patch literal 3470 zcmaJ^dpwi<|6Yo+h$N)2Mh>xKbJ!wb#xSRO9736GSlDJ8)AUH>e9j?s_vi4suIqie{<)*AElos$vOoX;Ac{A|+VWQ& z{;RM{i2uD0+mpm!4seVeIYfpBhf88n0R|L?I~9cYC3#Y9sU*rdzo%4P0ARZ!&CZeI zNU*?=8NN``76uyV%jB~G0A2k+CW-7#<$&C&o;121c&V-t45Cr=zz&)OIDu(I^`e>b zSX3g<(vHmYCZj1}{SzSFKn!2Nm&zf50)2hxY)qgY_-|bdf4_AN1B3pCaJ==v|4GV` zU=1>2u&5v{C>%nD!;v6uG!&tQLTSM@Ku9n#XsqRy*L~u1_tADxlrygD1+q*L!i-U7#s;hA|ZSPgnf?AAq7I{Y{g#+SSp*$ zqA@u%1|77eNOEWRbM(OcO#f4YFY{knI{TkC@f!vUBr#zKD157=UqAxk|A+ee{)=XF zY^ndv_x}`T+nr-lVYXB@!=FXw56(kzD-;uB#G;Zo43-^(;q$AD)?N$_gYCs&f{+L( z5~S)tqf;1Mw%XqW0s(`kvpFO>nTp5if%y_p8jXT6#KN_32yGPH0I7*U7#kYsXltSQ z-O|*?>KNis*k4>MgY551rE`99DgWha{+7Gt1z#pVGM37s1yCtC7Q+|xcg+~u?{h)^ zR_`A!<@dQ9`z;s7PX@L%+5a`^UsrtlY;FJbE&uSZ^Qm;c-C2BJL!K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+-*Zz45f1lubpYMPt|9s`a3`z*f=nf^_R}LjCw2@%@?f za|5nwa<5W`jFT)Yh#iyD)iGhmoZ*GeY9{sV3eCxDQuPB;G7-){wGVT;d7%~;zf6cm vcnv{}zC?r^9gC{iT=5cVH(rST34{ZhRs +* @copyright 2018-2020 Foris Limited ("Crypto.com") +* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0 +*/ + +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../../../'); +exit; \ No newline at end of file diff --git a/views/templates/admin/admin-order.tpl b/views/templates/admin/admin-order.tpl new file mode 100644 index 0000000..2cf02b8 --- /dev/null +++ b/views/templates/admin/admin-order.tpl @@ -0,0 +1,194 @@ +{* +* 2018-2020 Foris Limited ("Crypto.com") +* +* NOTICE OF LICENSE +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* @author Crypto.com +* @copyright 2018-2020 Foris Limited ("Crypto.com") +* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0 +*} + +
+
+
+
+ + Crypto.com Pay Payment +
+
+
+ + + + + + + + + + + + + + + + + + + +
{l s='Payment ID.' mod='cryptopay'}{$id|escape:'htmlall':'UTF-8'}
{l s='Amount in Crypto Currency.' mod='cryptopay'}{$crypto_amount|escape:'htmlall':'UTF-8'} {$crypto_currency|escape:'htmlall':'UTF-8'}  ({$order_currency|escape:'htmlall':'UTF-8'} {$order_total|escape:'htmlall':'UTF-8'})
{l s='Created' mod='cryptopay'}{$created|escape:'htmlall':'UTF-8'}
{l s='Status.' mod='cryptopay'}{if $status=='succeeded'} + {$status|escape:'htmlall':'UTF-8'}

+ {elseif $status=='pending'} + {$status|escape:'htmlall':'UTF-8'}

+ {elseif $status=='cancelled'} + {$status|escape:'htmlall':'UTF-8'}

+ {else} + {$status|escape:'htmlall':'UTF-8'} + {/if} +
+
+
+ + + + + + + + + + + {if !empty($refunds)} + {foreach $refunds as $refund} + + + + + + + {/foreach} + {/if} + +
Refund IDAmountCreatedStatus
{$refund['id']|escape:'htmlall':'UTF-8'}{$refund['amount']*0.01|escape:'htmlall':'UTF-8'} {$refund['currency']|escape:'htmlall':'UTF-8'}{$refund['created']|escape:'htmlall':'UTF-8'}{if $refund['status']=='succeeded'} + {$refund['status']|escape:'htmlall':'UTF-8'}

+ {elseif $refund['status']=='pending'} + {$refund['status']|escape:'htmlall':'UTF-8'}

+ {elseif $refund['status']=='cancelled'} + {$refund['status']|escape:'htmlall':'UTF-8'}

+ {else} + {$refund['status']|escape:'htmlall':'UTF-8'} + {/if} +
+
+
+
+
+
+
+
+ + Crypto.com Pay Refund +
+
+ {if $status == 'succeeded'} +
+ + + + + +
+ +
+ +
+
+
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ + {/if} +
+
+
+
diff --git a/views/templates/admin/cancel_order.tpl b/views/templates/admin/cancel_order.tpl new file mode 100644 index 0000000..aa977cd --- /dev/null +++ b/views/templates/admin/cancel_order.tpl @@ -0,0 +1,25 @@ +{* +* 2018-2020 Foris Limited ("Crypto.com") +* +* NOTICE OF LICENSE +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* @author Crypto.com +* @copyright 2018-2020 Foris Limited ("Crypto.com") +* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0 +*} +{$status|escape:'htmlall':'UTF-8'} + + cancel + \ No newline at end of file diff --git a/views/templates/admin/configure.tpl b/views/templates/admin/configure.tpl new file mode 100644 index 0000000..e2bc6d2 --- /dev/null +++ b/views/templates/admin/configure.tpl @@ -0,0 +1,61 @@ +{* +* 2018-2020 Foris Limited ("Crypto.com") +* +* NOTICE OF LICENSE +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* @author Crypto.com +* @copyright 2018-2020 Foris Limited ("Crypto.com") +* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0 +*} + diff --git a/views/templates/admin/help_link.tpl b/views/templates/admin/help_link.tpl new file mode 100644 index 0000000..8574d1e --- /dev/null +++ b/views/templates/admin/help_link.tpl @@ -0,0 +1,22 @@ +{* +* 2018-2020 Foris Limited ("Crypto.com") +* +* NOTICE OF LICENSE +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* @author Crypto.com +* @copyright 2018-2020 Foris Limited ("Crypto.com") +* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0 +*} +{$title|escape:'html':'UTF-8'} diff --git a/views/templates/admin/index.php b/views/templates/admin/index.php new file mode 100644 index 0000000..951dfe3 --- /dev/null +++ b/views/templates/admin/index.php @@ -0,0 +1,32 @@ + +* @copyright 2018-2020 Foris Limited ("Crypto.com") +* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0 +*/ + +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../'); +exit; diff --git a/views/templates/admin/log.tpl b/views/templates/admin/log.tpl new file mode 100644 index 0000000..4321359 --- /dev/null +++ b/views/templates/admin/log.tpl @@ -0,0 +1,63 @@ +{* +* 2018-2020 Foris Limited ("Crypto.com") +* +* NOTICE OF LICENSE +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* @author Crypto.com +* @copyright 2018-2020 Foris Limited ("Crypto.com") +* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0 +*} + + + + + + + diff --git a/views/templates/admin/view_store_order.tpl b/views/templates/admin/view_store_order.tpl new file mode 100644 index 0000000..eab4604 --- /dev/null +++ b/views/templates/admin/view_store_order.tpl @@ -0,0 +1,23 @@ +{* +* 2018-2020 Foris Limited ("Crypto.com") +* +* NOTICE OF LICENSE +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* @author Crypto.com +* @copyright 2018-2020 Foris Limited ("Crypto.com") +* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0 +*} + +{$id_order|escape:'htmlall':'UTF-8'}
pageview \ No newline at end of file diff --git a/views/templates/admin/webhook.tpl b/views/templates/admin/webhook.tpl new file mode 100644 index 0000000..5092846 --- /dev/null +++ b/views/templates/admin/webhook.tpl @@ -0,0 +1,55 @@ +{* +* 2018-2020 Foris Limited ("Crypto.com") +* +* NOTICE OF LICENSE +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* @author Crypto.com +* @copyright 2018-2020 Foris Limited ("Crypto.com") +* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0 +*} +
+
+ + + + + + + +
+ {if $is_rewrite_enabled && 0} + + {else} + + {/if} + + + +
+ +
+
diff --git a/views/templates/front/index.php b/views/templates/front/index.php new file mode 100644 index 0000000..a83005c --- /dev/null +++ b/views/templates/front/index.php @@ -0,0 +1,32 @@ + +* @copyright 2018-2020 Foris Limited ("Crypto.com") +* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0 +*/ + +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../../../../../'); +exit; \ No newline at end of file diff --git a/views/templates/front/payment_description.tpl b/views/templates/front/payment_description.tpl new file mode 100644 index 0000000..a07e699 --- /dev/null +++ b/views/templates/front/payment_description.tpl @@ -0,0 +1,24 @@ +{* +* 2018-2020 Foris Limited ("Crypto.com") +* +* NOTICE OF LICENSE +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* @author Crypto.com +* @copyright 2018-2020 Foris Limited ("Crypto.com") +* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0 +*} +
+

{l s='Checkout with Crypto.com Coin (CRO) and receive instant cash rebate.' mod='cryptopay'}

+
diff --git a/views/templates/front/payment_error.tpl b/views/templates/front/payment_error.tpl new file mode 100644 index 0000000..496ab15 --- /dev/null +++ b/views/templates/front/payment_error.tpl @@ -0,0 +1,31 @@ +{* +* 2018-2020 Foris Limited ("Crypto.com") +* +* NOTICE OF LICENSE +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* @author Crypto.com +* @copyright 2018-2020 Foris Limited ("Crypto.com") +* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0 +*} +{extends "$layout"} +{block name="content"} +
+
+
+

There is some error while creating payment, please contact admin.

+
+
+
+{/block} diff --git a/views/templates/front/payment_return.tpl b/views/templates/front/payment_return.tpl new file mode 100644 index 0000000..e63f608 --- /dev/null +++ b/views/templates/front/payment_return.tpl @@ -0,0 +1,125 @@ +{* +* 2018-2020 Foris Limited ("Crypto.com") +* +* NOTICE OF LICENSE +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* @author Crypto.com +* @copyright 2018-2020 Foris Limited ("Crypto.com") +* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0 +*} + +{extends "$layout"} +{block name="content"} + +
+
+
+
+ {$crypto_paypemt_status|escape:'htmlall':'UTF-8'} +

{l s='Please do not close or reload this window while payment, It will refresh automatically once payment done .' mod='cryptopay'}

+ {$cart_summary_items_subtotal|cleanHtml nofilter} + {$cart_summary_subtotals_container|cleanHtml nofilter} + {$cart_summary_totals|cleanHtml nofilter} +

{l s='Click on below Button to make payment.' mod='cryptopay'}

+
+
+ + + + +
+
+
+ + +{/block} diff --git a/views/templates/hook/index.php b/views/templates/hook/index.php new file mode 100644 index 0000000..4e3c22b --- /dev/null +++ b/views/templates/hook/index.php @@ -0,0 +1,32 @@ + +* @copyright 2018-2020 Foris Limited ("Crypto.com") +* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0 +*/ + +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../../../'); +exit; \ No newline at end of file diff --git a/views/templates/hook/payment_error.tpl b/views/templates/hook/payment_error.tpl new file mode 100644 index 0000000..25c7b68 --- /dev/null +++ b/views/templates/hook/payment_error.tpl @@ -0,0 +1,32 @@ +{* +* 2018-2020 Foris Limited ("Crypto.com") +* +* NOTICE OF LICENSE +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* @author Crypto.com +* @copyright 2018-2020 Foris Limited ("Crypto.com") +* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0 +*} +{extends "$layout"} +{block name="content"} +
+
+
+

{l s='Your Order Reference is' mod='cryptopay'}{$reference|escape:'htmlall':'UTF-8'}

+

There is some error please contact admin regarding this order.

+
+
+
+{/block} diff --git a/views/templates/hook/payment_return.tpl b/views/templates/hook/payment_return.tpl new file mode 100644 index 0000000..acd95f8 --- /dev/null +++ b/views/templates/hook/payment_return.tpl @@ -0,0 +1,43 @@ +{* +* 2018-2020 Foris Limited ("Crypto.com") +* +* NOTICE OF LICENSE +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* @author Crypto.com +* @copyright 2018-2020 Foris Limited ("Crypto.com") +* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0 +*} +{block name="content"} +
+ {if $status !='failed'} +

{l s='Your Crypo.com Pay Payment Id is' mod='cryptopay'}{$paymentId|escape:'htmlall':'UTF-8'}

+

{l s='Crypto.com Payment Details.' mod='cryptopay'}

+

{l s='Recipient.' mod='cryptopay'} : {$recipient|escape:'htmlall':'UTF-8'}

+

{l s='Total Paid.' mod='cryptopay'} : {$total_to_pay|escape:'htmlall':'UTF-8'}

+

{l s='Amount in Crypto Currency.' mod='cryptopay'} : {$crypto_amount|escape:'htmlall':'UTF-8'} {$crypto_currency|escape:'htmlall':'UTF-8'}

+

{l s='Status.' mod='cryptopay'} : {if $status=='succeeded'} + {$status|escape:'htmlall':'UTF-8'} + {elseif $status=='pending'} + {$status|escape:'htmlall':'UTF-8'} + {elseif $status=='cancelled'} + {$status|escape:'htmlall':'UTF-8'} + {else} + {$status|escape:'htmlall':'UTF-8'} + {/if}

+ {else} +

{l s='There is some issue with payment of your order, please contact .' mod='cryptopay'}

+ {/if} +
+{/block} diff --git a/views/templates/index.php b/views/templates/index.php new file mode 100644 index 0000000..a5f0d7f --- /dev/null +++ b/views/templates/index.php @@ -0,0 +1,32 @@ + +* @copyright 2018-2020 Foris Limited ("Crypto.com") +* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0 +*/ + +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../../../../'); +exit; \ No newline at end of file