diff --git a/Readme.md b/Readme.md deleted file mode 100644 index d6ad396..0000000 --- a/Readme.md +++ /dev/null @@ -1,21 +0,0 @@ -# KKIAPAY - -KkiaPay allows businesses to safely receive payments by mobile money, credit card and bank account. - -Kkiapay is developer friendly solution that allows you to accept mobile money and credit card, and direct bank payments in your application or website. Before using this plugin, make sure you have a right Merchant Account on Kkiapay, otherwise go and create your account. It is free and without pain. - -KKIAPAY is available in: - -* Benin -* Senegal [WIP] -* [More details at ](https://kkiapay.me/features/supported-countries) - -### Prerequisites - -Prestashop greater than or equal 1.6 - - -## Usage - -* Install and configure API public key on dashboard -* [More details at ](https://docs.kkiapay.me/v1/plugin-et-sdk/prestashop) diff --git a/config_fr.xml b/config_fr.xml new file mode 100755 index 0000000..f2d3dc1 --- /dev/null +++ b/config_fr.xml @@ -0,0 +1,13 @@ + + + kkiapay + + + + + + + 1 + 1 + + \ No newline at end of file diff --git a/controllers/front/api.php b/controllers/front/api.php deleted file mode 100644 index 5b96b9f..0000000 --- a/controllers/front/api.php +++ /dev/null @@ -1,61 +0,0 @@ - - * @copyright 2013-2016 Hennes Hervé - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - * http://www.h-hennes.fr/blog/ - */ - -class kkiapayapiModuleFrontController extends ModuleFrontController { - - - /** - * Retours de l'api de paiement - */ - public function postProcess() - { - //Vérification générales - $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'); - } - - $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); - - - //Traitement de la réponse OK - if ( Tools::getValue('success') and Tools::getValue('success')=='kkiapayojhsbbbes12345' ) { - $this->module->validateOrder((int)$cart->id, Configuration::get('PS_OS_PAYMENT'), $total, $this->module->displayName, null, array(), (int)$currency->id, false, $customer->secure_key); - Tools::redirect('index.php?controller=order-confirmation&id_cart='.(int)$cart->id.'&id_module='.(int)$this->module->id.'&id_order='.$this->module->currentOrder.'&key='.$customer->secure_key); - } else { - //Erreur - $this->module->validateOrder((int)$cart->id, Configuration::get('PS_OS_ERROR'),0, $this->module->displayName, null, array(), (int)$currency->id, false, $customer->secure_key); - Tools::redirect('index.php?controller=order&step=1'); - } - } -} diff --git a/controllers/front/confirmation.php b/controllers/front/confirmation.php deleted file mode 100644 index 7818155..0000000 --- a/controllers/front/confirmation.php +++ /dev/null @@ -1,91 +0,0 @@ - - * @copyright 2013-2016 Hennes Hervé - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - * http://www.h-hennes.fr/blog/ - */ - -class kkiapayconfirmationModuleFrontController extends ModuleFrontController -{ - - - /** - * Retours de l'api de paiement - */ - - /** - * @see FrontController::initContent() - */ - public function initContent() - { - - parent::initContent(); - - //Vérification générales - $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'); - } - - $customer = new Customer($cart->id_customer); - if (!Validate::isLoadedObject($customer)) { - Tools::redirect('index.php?controller=order&step=1'); - } - - $key = Configuration::get('KKIAPAY_PUBLIC'); - $color = Configuration::get('KKIAPAY_COLOR'); - $test = Configuration::get('KKIAPAY_CHECKBOX'); - $position= Configuration::get('KKIAPAY_POSITION'); - $private_key= Configuration::get('KKIAPAY_PRIVATE'); - $secret = Configuration::get('KKIAPAY_SECRET'); - $price= (float)$cart->getOrderTotal(true, Cart::BOTH); - $firstname_customer=$customer->firstname; - $lastname_customer=$customer->lastname; - $mylink = $this->context->link->getModuleLink('kkiapay','api'); - $mylink = $mylink.'?success=kkiapayojhsbbbes12345'; - - $this->context->smarty->assign(array( - 'back_url' => $this->context->link->getPageLink('order', true, NULL, "step=3"), - 'confirm_url' => $this->context->link->getModuleLink('kkiapay', 'api', [], true), - 'num_cart' => $cart->id, - 'moyen_payment' => $this->module->displayName, - 'date' => $cart->date_add - - )); - - $this->context->smarty->assign('firstname',$firstname_customer); - $this->context->smarty->assign('lastname',$lastname_customer); - $this->context->smarty->assign('api',$key); - $this->context->smarty->assign('price',$price); - $this->context->smarty->assign('color',$color); - $this->context->smarty->assign('position',$position); - $this->context->smarty->assign('url',$mylink); - $this->context->smarty->assign('secret',$secret); - $this->context->smarty->assign('test',$test); - $this->context->smarty->assign('private',$private_key); - - //var_dump($cart); - - $this->setTemplate('module:kkiapay/views/templates/admin/hook/front/api/payment_execution.tpl'); - } -} diff --git a/controllers/front/index.php b/controllers/front/index.php old mode 100644 new mode 100755 index ccf80de..7b50157 --- a/controllers/front/index.php +++ b/controllers/front/index.php @@ -1,34 +1,35 @@ - -* @copyright 2007-2019 PrestaShop SA -* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -* International Registered Trademark & Property of PrestaShop SA -*/ -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; + +* @copyright 2007-2016 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +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/payment.php b/controllers/front/payment.php new file mode 100755 index 0000000..79febd5 --- /dev/null +++ b/controllers/front/payment.php @@ -0,0 +1,69 @@ + +* @copyright 2007-2016 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +/** + * @since 1.5.0 + */ +class KkiapayPaymentModuleFrontController extends ModuleFrontController +{ + public $ssl = true; + public $display_column_left = false; + + /** + * @see FrontController::initContent() + */ + public function initContent() + { + parent::initContent(); + + + $cart = $this->context->cart; + $customer = new Customer($cart->id_customer); + //var_dump($cart); + if (!$this->module->checkCurrency($cart)) + Tools::redirect('index.php?controller=order'); + + $this->context->smarty->assign(array( + 'api' => Configuration::get('KKIAPAY_PUBLIC'), + 'color' => Configuration::get('KKIAPAY_COLOR'), + 'position' => Configuration::get('KKIAPAY_POSITION'), + 'test' => Configuration::get('KKIAPAY_CHECKBOX'), + 'lastname' => $customer->lastname, + 'firstname' => $customer->firstname, + 'nbProducts' => $cart->nbProducts(), + 'cust_currency' => $cart->id_currency, + 'num_cart' => $cart->id, + 'currencies' => $this->module->getCurrency((int)$cart->id_currency), + 'date' => $cart->date_upd, + 'price' => $cart->getOrderTotal(true, Cart::BOTH), + 'this_path' => $this->module->getPathUri(), + 'this_path_bw' => $this->module->getPathUri(), + 'this_path_ssl' => Tools::getShopDomainSsl(true, true).__PS_BASE_URI__.'modules/'.$this->module->name.'/' + )); + + $this->setTemplate('payment_execution.tpl'); + } +} diff --git a/controllers/front/validation.php b/controllers/front/validation.php new file mode 100755 index 0000000..c2c230a --- /dev/null +++ b/controllers/front/validation.php @@ -0,0 +1,79 @@ + +* @copyright 2007-2016 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +/** + * @since 1.5.0 + */ +class KkiapayValidationModuleFrontController extends ModuleFrontController +{ + /** + * @see FrontController::postProcess() + */ + public function postProcess() + { + //var_dump($this->context); + $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'); + + // Check that this payment option is still available in case the customer changed his address just before the end of the checkout process + $authorized = false; + foreach (Module::getPaymentModules() as $module) + if ($module['name'] == 'kkiapay') + { + $authorized = true; + break; + } + if (!$authorized) + die($this->module->l('Cette méthode de paiement n\'est pas authorisée.', '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); + $mailVars = array( + '{private_key}' => Configuration::get('KKIAPAY_PUBLIC'), + '{public_key}' => Configuration::get('KKIAPAY_PRIVATE'), + '{secret}' => Configuration::get('KKIAPAY_SECRET'), + '{color}' => Configuration::get('KKIAPAY_COLOR'), + '{checkbox}' => Configuration::get('KKIAPAY_CHECKBOX'), + '{position}' => Configuration::get('KKIAPAY_POSITION') + ); + + //Traitement de la réponse OK + if ( Tools::getValue('transaction_id') and Tools::getValue('success') and Tools::getValue('success')=='kkiapayojhsbbbes12345' ) { + $this->module->validateOrder((int)$cart->id, Configuration::get('PS_OS_PAYMENT'), $total, $this->module->displayName, null, mailVars, (int)$currency->id, false, $customer->secure_key); + Tools::redirect('index.php?controller=order-confirmation&id_cart='.$cart->id.'&id_module='.$this->module->id.'&id_order='.$this->module->currentOrder.'&key='.$customer->secure_key); + } else { + //Erreur + $this->module->validateOrder((int)$cart->id, Configuration::get('PS_OS_ERROR'),0, $this->module->displayName, null, array(), (int)$currency->id, false, $customer->secure_key); + Tools::redirect('index.php?controller=order&step=1'); + } + + } +} diff --git a/controllers/index.php b/controllers/index.php old mode 100644 new mode 100755 index ccf80de..19a328b --- a/controllers/index.php +++ b/controllers/index.php @@ -1,34 +1,35 @@ - -* @copyright 2007-2019 PrestaShop SA -* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -* International Registered Trademark & Property of PrestaShop SA -*/ -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; + +* @copyright 2007-2016 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +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/index.php b/index.php old mode 100644 new mode 100755 index ccf80de..e5064df --- a/index.php +++ b/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2019 PrestaShop SA -* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* @author PrestaShop SA +* @copyright 2007-2016 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA */ -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; + +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/kkiapay.php b/kkiapay.php old mode 100644 new mode 100755 index bd09768..07f0f52 --- a/kkiapay.php +++ b/kkiapay.php @@ -1,6 +1,6 @@ -* @copyright 2007-2019 PrestaShop SA -* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* @author PrestaShop SA +* @copyright 2007-2016 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA */ -use PrestaShop\PrestaShop\Core\Payment\PaymentOption; +if (!defined('_PS_VERSION_')) + exit; -if (!defined('_PS_VERSION_')) { - exit; -} - -class Kkiapay extends PaymentModule +class kkiapay extends PaymentModule { - protected $config_form = false; - - public function __construct() - { - $this->name = 'kkiapay'; - $this->tab = 'payments_gateways'; - $this->version = '1.0.0'; - $this->author = 'kkiapay'; - $this->need_instance = 0; - $this->module_key = 'eea9595b905b3279e130609bea3c0c9e'; - - /** - * Set $this->bootstrap to true if your module is compliant with bootstrap (PrestaShop 1.6) - */ - $this->bootstrap = true; - - parent::__construct(); - - $this->displayName = $this->l('kkiapay'); - $this->description = $this->l('kkiaPay permet aux entreprises de recevoir des paiements en toute sécurité via de l\'argent mobile, une carte de crédit ou un compte bancaire.'); - - $this->ps_versions_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_); - $this->limited_currencies = array('XOF'); - } - - /** - * Don't forget to create update methods if needed: - * http://doc.prestashop.com/display/PS16/Enabling+the+Auto-Update - */ - public function install() - { - - Configuration::updateValue('KKIAPAY_LIVE_MODE', false); - - return parent::install() && - $this->registerHook('header') && - $this->registerHook('paymentOptions'); - } - - public function uninstall() - { - Configuration::deleteByName('KKIAPAY_LIVE_MODE'); - - return parent::uninstall(); - } - - public function hookPaymentOptions($params) - { - - $currency_id = $params['cart']->id_currency; - $currency = new Currency((int)$currency_id); - - if (in_array($currency->iso_code, $this->limited_currencies ) == false ){ - return false; - } - - $key = Configuration::get('KKIAPAY_PUBLIC'); - $color = Configuration::get('KKIAPAY_COLOR'); - $test = Configuration::get('KKIAPAY_CHECKBOX'); - $position= Configuration::get('KKIAPAY_POSITION'); - $private_key= Configuration::get('KKIAPAY_PRIVATE'); - $secret = Configuration::get('KKIAPAY_SECRET'); - $firstname_customer=($params['cookie']->customer_firstname); - $lastname_customer=($params['cookie']->customer_lastname); - $price= $params['cart']->getOrderTotal(); - //var_dump($this->module->currentOrder); - - $mylink = $this->context->link->getModuleLink('kkiapay', 'api'); - $mylink = $mylink.'?success=kkiapayojhsbbbes12345'; - //var_dump($mylink); - - $this->context->smarty->assign('firstname', $firstname_customer); - $this->context->smarty->assign('lastname', $lastname_customer); - $this->context->smarty->assign('api', $key); - $this->context->smarty->assign('price', $price); - $this->context->smarty->assign('color', $color); - $this->context->smarty->assign('position', $position); - $this->context->smarty->assign('url', $mylink); - $this->context->smarty->assign('secret', $secret); - $this->context->smarty->assign('test', $test); - $this->context->smarty->assign('private', $private_key); - - $paymentForm = $this->fetch('module:kkiapay/views/templates/admin/hook/front/api/payment.tpl'); - - $cardPaymentOption = new PaymentOption(); - - $options= $cardPaymentOption->setCallToActionText('kkiapay') - ->setAdditionalInformation($paymentForm) - ->setAction($this->context->link->getModuleLink($this->name, 'confirmation', array(), true)) - ->setLogo("http://162.243.162.212/wp-content/plugins/kkiapay-woocommerce/assets/img/kkiapay.svg"); - - return [$options]; - - } - - - public function getOptions() - - { - $options = array ( - - array ( - - 'id_checkbox_options' => 1, - - 'checkbox_options_name' => '', - - 'checked' => 'checked' ) - ); - - return $options; - - } - - public function hookPaymentReturn($params) - { - - // die(); - - if (!$this->active) { - return; - } - if (!isset($params['order']) || ($params['order']->module != $this->name)) { - return false; - } - if (isset($params['order']) && Validate::isLoadedObject($params['order']) && isset($params['order']->valid)) { - $this->smarty->assign(array( - 'id_order' => $params['order']->id, - 'valid' => $params['order']->valid, - )); - } - if (isset($params['order']->reference) && !empty($params['order']->reference)) { - $this->smarty->assign('reference', $params['order']->reference); - } - $this->smarty->assign(array( - 'shop_name' => $this->context->shop->name, - 'reference' => $params['order']->reference, - 'contact_url' => $this->context->link->getPageLink('contact', true) - )); - return $this->fetch('kkiapay/views/templates/admin/hook/front/api/payment_return.tpl'); - } - - public function hookActionValidateOrder($params){ - - var_dump($params); - die(''); - - } - - - public function getContent() - { - $output = null; - // $myModuleName = strval(Tools::getValue('password')); - // die($myModuleName); - if (Tools::isSubmit('submit'.$this->name)) { - $myModuleName = (string)Tools::getValue('KKIAPAY_PUBLIC'); - $myModulePrivate = (string)Tools::getValue('KKIAPAY_PRIVATE'); - $myModuleSecret = (string)Tools::getValue('KKIAPAY_SECRET'); - $myModuleColor = (string)Tools::getValue('KKIAPAY_COLOR'); - $myModuleCheckbox = (string)Tools::getValue('KKIAPAY_CHECKBOX'); - $myModulePosition = (string)Tools::getValue('KKIAPAY_POSITION'); - - - $v = (string)Tools::getValue('api'); - // var_dump($myModuleCheckbox);die(); - - if ( - !$myModuleName || - empty($myModuleName) || - !Validate::isGenericName($myModuleName) - ) { - - $output .= $this->displayError($this->l('Valeurs de configurations invalides')); - } else { - Configuration::updateValue('KKIAPAY_PUBLIC', $myModuleName); - Configuration::updateValue('KKIAPAY_PRIVATE', $myModulePrivate); - Configuration::updateValue('KKIAPAY_SECRET', $myModuleSecret); - Configuration::updateValue('KKIAPAY_COLOR', $myModuleColor); - Configuration::updateValue('KKIAPAY_CHECKBOX',$myModuleCheckbox ); - Configuration::updateValue('KKIAPAY_POSITION',$myModulePosition ); - $output .= $this->displayConfirmation($this->l('Paramètres mis à jour')); - } - } - - return $output.$this->displayForm(); - } - - - public function displayForm() - { - $password = (string)Tools::getValue('password'); - // var_dump($password);die(); - // if($password) { - // // only save if a value was entered - // Configuration::updateValue('passwordKey', $password); - // } - $options_test = array( - array( - 'id_option' => '1', - 'name' => $this->l('Oui') - ), - array( - 'id_option' => '0', - 'name' => $this->l('Non') - ) - ); - - $options = array( + protected $_html = ''; + protected $_postErrors = array(); + + public $details; + public $owner; + public $address; + public $extra_mail_vars; + public function __construct() + { + $this->name = 'kkiapay'; + $this->tab = 'payments_gateways'; + $this->version = '1.0.0'; + $this->author = 'kkiapay'; + $this->controllers = array('payment', 'validation'); + $this->is_eu_compatible = 1; + + $this->currencies = true; + $this->currencies_mode = 'checkbox'; + + $config = Configuration::getMultiple(array('KKIAPAY_PUBLIC', 'KKIAPAY_PRIVATE', 'KKIAPAY_SECRET', 'KKIAPAY_COLOR', 'KKIAPAY_CHECKBOX', 'KKIAPAY_POSITION')); + if (!empty($config['KKIAPAY_PUBLIC'])) + $this->public = $config['KKIAPAY_PUBLIC']; + if (!empty($config['KKIAPAY_PRIVATE'])) + $this->private = $config['KKIAPAY_PRIVATE']; + if (!empty($config['KKIAPAY_SECRET'])) + $this->secret = $config['KKIAPAY_SECRET']; + if (!empty($config['KKIAPAY_COLOR'])) + $this->color = $config['KKIAPAY_COLOR']; + if (!empty($config['KKIAPAY_CHECKBOX'])) + $this->checkbox = $config['KKIAPAY_CHECKBOX']; + if (!empty($config['KKIAPAY_POSITION'])) + $this->position = $config['KKIAPAY_POSITION']; + + $this->bootstrap = true; + parent::__construct(); + + $this->displayName = $this->l('kkiapay'); + $this->description = $this->l('kkiaPay permet aux entreprises de recevoir des paiements en toute sécurité via de l\'argent mobile, une carte de crédit ou un compte bancaire.'); + $this->confirmUninstall = $this->l('Voulez-vous désinstaller kkiapay'); + $this->ps_versions_compliancy = array('min' => '1.6', 'max' => '1.6.99.99'); + $this->limited_currencies = array('XOF'); + + if (!isset($this->public)) + $this->warning = $this->l('La clé publique doit être configurée pour utiliser ce module'); + if (!count(Currency::checkPaymentCurrencies($this->id))) + $this->warning = $this->l('La monnaie XOF (FCFA) doit être configurée pour utiliser ce module'); + + $this->extra_mail_vars = array( + '{private_key}' => Configuration::get('KKIAPAY_PUBLIC'), + '{public_key}' => Configuration::get('KKIAPAY_PRIVATE'), + '{secret}' => Configuration::get('KKIAPAY_SECRET'), + '{color}' => Configuration::get('KKIAPAY_COLOR'), + '{checkbox}' => Configuration::get('KKIAPAY_CHECKBOX'), + '{position}' => Configuration::get('KKIAPAY_POSITION') + ); + } + + public function install() + { + if (!parent::install() || !$this->registerHook('payment') || ! $this->registerHook('displayPaymentEU') || !$this->registerHook('paymentReturn')) + return false; + return true; + } + + public function uninstall() + { + if (!Configuration::deleteByName('KKIAPAY_PUBLIC') + || !Configuration::deleteByName('KKIAPAY_PRIVATE') + || !Configuration::deleteByName('KKIAPAY_SECRET') + || !Configuration::deleteByName('KKIAPAY_COLOR') + || !Configuration::deleteByName('KKIAPAY_CHECKBOX') + || !Configuration::deleteByName('KKIAPAY_POSITION') + || !parent::uninstall()) + return false; + return true; + } + + protected function _postValidation() + { + if (Tools::isSubmit('btnSubmit')) + { + if (!Tools::getValue('KKIAPAY_PUBLIC')) + $this->_postErrors[] = $this->l('La clée publique est recquise.'); + } + } + + protected function _postProcess() + { + if (Tools::isSubmit('btnSubmit')) + { + Configuration::updateValue('KKIAPAY_PUBLIC', Tools::getValue('KKIAPAY_PUBLIC')); + Configuration::updateValue('KKIAPAY_PRIVATE', Tools::getValue('KKIAPAY_PRIVATE')); + Configuration::updateValue('KKIAPAY_SECRET', Tools::getValue('KKIAPAY_SECRET')); + Configuration::updateValue('KKIAPAY_COLOR', Tools::getValue('KKIAPAY_COLOR')); + Configuration::updateValue('KKIAPAY_CHECKBOX', Tools::getValue('KKIAPAY_CHECKBOX')); + Configuration::updateValue('KKIAPAY_POSITION', Tools::getValue('KKIAPAY_POSITION')); + } + $this->_html .= $this->displayConfirmation($this->l('Paramètres mis à jour')); + } + + protected function _displaykkiapay() + { + return $this->display(__FILE__, 'infos.tpl'); + } + + public function getContent() + { + if (Tools::isSubmit('btnSubmit')) + { + $this->_postValidation(); + if (!count($this->_postErrors)) + $this->_postProcess(); + else + foreach ($this->_postErrors as $err) + $this->_html .= $this->displayError($err); + } + else + $this->_html .= '
'; + + $this->_html .= $this->_displaykkiapay(); + $this->_html .= $this->renderForm(); + + return $this->_html; + } + + public function hookPayment($params) + { + if (!$this->active) + return; + if (!$this->checkCurrency($params['cart'])) + return; + + $this->smarty->assign(array( + 'this_path' => $this->_path, + 'this_path_bw' => $this->_path, + 'this_path_ssl' => Tools::getShopDomainSsl(true, true).__PS_BASE_URI__.'modules/'.$this->name.'/' + )); + return $this->display(__FILE__, 'payment.tpl'); + } + + public function hookDisplayPaymentEU($params) + { + if (!$this->active) + return; + + if (!$this->checkCurrency($params['cart'])) + return; + + $payment_options = array( + 'cta_text' => $this->l('Payez avec kkiapay'), + 'action' => $this->context->link->getModuleLink($this->name, 'validation', array(), true) + ); + + return $payment_options; + } + + public function hookPaymentReturn($params) + { + if (!$this->active) + return; + + $state = $params['objOrder']->getCurrentState(); + if (in_array($state, array(Configuration::get('PS_OS_PAYMENT')))) + { + $this->smarty->assign(array( + 'total_to_pay' => Tools::displayPrice($params['total_to_pay'], $params['currencyObj'], false), + 'status' => 'ok', + 'id_order' => $params['objOrder']->id + )); + + if (isset($params['objOrder']->reference) && !empty($params['objOrder']->reference)) + $this->smarty->assign('reference', $params['objOrder']->reference); + } + else + $this->smarty->assign('status', 'failed'); + return $this->display(__FILE__, 'payment_return.tpl'); + } + + 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; + } + + public function renderForm() + { + + $options = array( array( 'id_option' => 'right', 'name' => $this->l('A droite de la page') @@ -255,151 +237,130 @@ public function displayForm() ) ); - // Get default language - $this->hookDisplayHeader(); - $defaultLang = (int)Configuration::get('PS_LANG_DEFAULT'); - - $fieldsForm=array(); - // Init Fields form array - $fieldsForm[0]['form'] = [ - 'legend' => [ - 'title' => $this->l('Paramètres'), - ], - 'input' => [ - array( - 'type' => 'switch', - 'label' => $this->l('Activez le mode test'), - 'desc'=> $this->l('Configurez sur oui pour mettre en environnement sandbox'), - 'name' => 'KKIAPAY_CHECKBOX', - 'is_bool' => true, - 'values' => array( - array( - 'id' => 'active_on', - 'value' => "1", - 'label' => $this->trans('Enabled', array(), 'Admin.Global'), - ), - array( - 'id' => 'active_off', - 'value' => "0", - 'label' => $this->trans('Disabled', array(), 'Admin.Global'), - ) - ), - ) - - , - - [ - 'col' => '6', - 'type' => 'text', - 'label' => $this->l('Clé publique'), - 'name' => 'KKIAPAY_PUBLIC', - 'class'=>'form-control', - 'desc'=> $this->l('Obtenez vos clés d\'API sur le dashboard kkiapay dans la section Développeurs'), - 'required' => true - ], - [ - 'col' => '6', - 'type' => 'text', - 'label' => $this->l('Clé privé'), - 'name' => 'KKIAPAY_PRIVATE', - 'class'=>'form-control', - 'desc'=> $this->l('Obtenez vos clés d\'API sur le dashboard kkiapay dans la section Développeurs'), - ], - - [ - 'col' => '6', - 'type' => 'text', - 'label' => $this->l('Secret'), - 'name' => 'KKIAPAY_SECRET', - 'size' => 20, - 'class'=>'form-control', - 'desc'=> $this->l('Obtenez vos clés d\'API sur le dashboard kkiapay dans la section Développeurs'), - ] - , - - [ - 'col' => '6', - 'type' => 'text', - 'label' => $this->l('Couleur du widget kkiapay'), - 'name' => 'KKIAPAY_COLOR', - 'class'=>'form-control', - 'desc'=> $this->l('Paramétrez la couleur de la fenêtre kkiapay. Pour une meilleure harmonisation, utilisez la couleur dominante de votre site ou laissez vide.'), - ] - , - - array( - 'type' => 'select', - 'lang' => true, - 'label' => $this->l('Disposition du widget kkiapay'), - 'name' => 'KKIAPAY_POSITION', - 'class'=>'form-control', - 'desc'=> $this->l('Utilisez cette option pour contrôler l\'endroit où la fenêtre kkiapay devrait s\'afficher sur votre site'), - 'options' => array( - 'query' => $options, - 'id' => 'id_option', - 'name' => 'name' - ), - ), - - ], - 'submit' => [ - 'title' => $this->l('Sauvegarder'), - 'class' => 'btn btn-default pull-right' - ] - ]; - - $helper = new HelperForm(); - // $helper->fields_value["KKIAPAY_CHECKBOX_1"] = true; - // Module, token and currentIndex - $helper->module = $this->module; + $fields_form = array( + 'form' => array( + 'legend' => array( + 'title' => $this->l('Paramètres'), + ), + 'input' => array( + array( + 'type' => 'switch', + 'label' => $this->l('Activez le mode test'), + 'desc'=> $this->l('Configurez sur oui pour mettre en environnement sandbox'), + 'name' => 'KKIAPAY_CHECKBOX', + 'is_bool' => true, + 'values' => array( + array( + 'id' => 'active_on', + 'value' => "1", + ), + array( + 'id' => 'active_off', + 'value' => "0", + ) + ), + ), + array( + 'col' => '6', + 'type' => 'text', + 'label' => $this->l('Clé publique'), + 'name' => 'KKIAPAY_PUBLIC', + 'class'=>'form-control', + 'desc'=> $this->l('Obtenez vos clés d\'API sur le dashboard kkiapay dans la section Développeurs'), + 'required' => true + ), + array( + 'col' => '6', + 'type' => 'text', + 'label' => $this->l('Clé privé'), + 'name' => 'KKIAPAY_PRIVATE', + 'class'=>'form-control', + 'desc'=> $this->l('Obtenez vos clés d\'API sur le dashboard kkiapay dans la section Développeurs'), + ), + array( + 'col' => '6', + 'type' => 'text', + 'label' => $this->l('Secret'), + 'name' => 'KKIAPAY_SECRET', + 'class'=>'form-control', + 'desc'=> $this->l('Obtenez vos clés d\'API sur le dashboard kkiapay dans la section Développeurs'), + ), + array( + 'col' => '6', + 'type' => 'text', + 'label' => $this->l('Couleur du widget kkiapay'), + 'name' => 'KKIAPAY_COLOR', + 'class'=>'form-control', + 'desc'=> $this->l('Paramétrez la couleur de la fenêtre kkiapay. Pour une meilleure harmonisation, utilisez la couleur dominante de votre site ou laissez vide.'), + ), + array( + 'type' => 'select', + 'lang' => true, + 'label' => $this->l('Disposition du widget kkiapay'), + 'name' => 'KKIAPAY_POSITION', + 'class'=>'form-control', + 'desc'=> $this->l('Utilisez cette option pour contrôler l\'endroit où la fenêtre kkiapay devrait s\'afficher sur votre site'), + 'options' => array( + 'query' => $options, + 'id' => 'id_option', + 'name' => 'name' + ), + ), + ), + 'submit' => array( + 'title' => $this->l('Sauvegarder'), + ) + ), + ); + + $helper = new HelperForm(); + $helper->show_toolbar = false; + $helper->table = $this->table; + $helper->module = $this->module; $helper->name_controller = $this->name; $helper->token = Tools::getAdminTokenLite('AdminModules'); - $helper->currentIndex = AdminController::$currentIndex.'&configure='.$this->name; - - // Language - $helper->default_form_language = $defaultLang; - $helper->allow_employee_form_lang = $defaultLang; - - // Title and toolbar - $helper->title = $this->displayName; - $helper->show_toolbar = true; // false -> remove toolbar - $helper->toolbar_scroll = true; // yes - > Toolbar is always visible on the top of the screen. - $helper->submit_action = 'submit'.$this->name; - $helper->toolbar_btn = [ - 'save' => [ - 'desc' => $this->l('Sauvegarder'), - 'href' => AdminController::$currentIndex.'&configure='.$this->name.'&save'.$this->name. - '&token='.Tools::getAdminTokenLite('AdminModules'), - ], - 'back' => [ - 'href' => AdminController::$currentIndex.'&token='.Tools::getAdminTokenLite('AdminModules'), - 'desc' => $this->l('Retour à la liste') - ] - ]; - - // Load current value - // die(Configuration::get('KKIAPAY_NAME')); - // var_dump(Configuration::get('KKIAPAY_CHECKBOX_1')); - // die(); - $myModulePosition=Configuration::get('KKIAPAY_POSITION'); - // var_dump($myModulePosition); - // die(); + $helper->currentIndex = AdminController::$currentIndex.'&configure='.$this->name; + + $lang = new Language((int)Configuration::get('PS_LANG_DEFAULT')); + $helper->default_form_language = $lang->id; + $helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0; + $this->fields_form = array(); + + + + + $helper->id = (int)Tools::getValue('id_carrier'); + $helper->identifier = $this->identifier; + $helper->submit_action = 'btnSubmit'; + $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->getConfigFieldsValues(), + 'languages' => $this->context->controller->getLanguages(), + 'id_language' => $this->context->language->id + ); + + $myModulePosition=Configuration::get('KKIAPAY_POSITION'); + $helper->fields_value['KKIAPAY_PUBLIC'] = Configuration::get('KKIAPAY_PUBLIC'); $helper->fields_value['KKIAPAY_SECRET'] = Configuration::get('KKIAPAY_SECRET'); $helper->fields_value['KKIAPAY_PRIVATE'] = Configuration::get('KKIAPAY_PRIVATE'); $helper->fields_value['KKIAPAY_COLOR'] = Configuration::get('KKIAPAY_COLOR'); $helper->fields_value['KKIAPAY_CHECKBOX'] = Configuration::get('KKIAPAY_CHECKBOX'); $helper->fields_value['KKIAPAY_POSITION'] = Configuration::get('KKIAPAY_POSITION'); - return $helper->generateForm($fieldsForm); - } - - - public function hookDisplayHeader() - { - // die(); - $this->context->controller->addCSS($this->_path.'views/css/button.css', 'all'); - $this->context->controller->addJS($this->_path.'views/css/app.js', 'all'); - } - + return $helper->generateForm(array($fields_form)); + } + + public function getConfigFieldsValues() + { + return array( + 'KKIAPAY_PUBLIC' => Tools::getValue('KKIAPAY_PUBLIC', Configuration::get('KKIAPAY_PUBLIC')), + 'KKIAPAY_SECRET' => Tools::getValue('KKIAPAY_SECRET', Configuration::get('KKIAPAY_SECRET')), + 'KKIAPAY_PRIVATE' => Tools::getValue('KKIAPAY_PRIVATE', Configuration::get('KKIAPAY_PRIVATE')), + 'KKIAPAY_COLOR' => Tools::getValue('KKIAPAY_COLOR', Configuration::get('KKIAPAY_COLOR')), + 'KKIAPAY_CHECKBOX' => Tools::getValue('KKIAPAY_CHECKBOX', Configuration::get('KKIAPAY_CHECKBOX')), + 'KKIAPAY_POSITION' => Tools::getValue('KKIAPAY_POSITION', Configuration::get('KKIAPAY_POSITION')), + ); + } } diff --git a/logo.png b/logo.png old mode 100644 new mode 100755 diff --git a/sql/index.php b/sql/index.php deleted file mode 100644 index ccf80de..0000000 --- a/sql/index.php +++ /dev/null @@ -1,34 +0,0 @@ - -* @copyright 2007-2019 PrestaShop SA -* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -* International Registered Trademark & Property of PrestaShop SA -*/ -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 deleted file mode 100644 index b63f777..0000000 --- a/sql/install.php +++ /dev/null @@ -1,38 +0,0 @@ - -* @copyright 2007-2019 PrestaShop SA -* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -* International Registered Trademark & Property of PrestaShop SA -*/ - -$sql = array(); - -$sql[] = 'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'kkiapay` ( - `id_kkiapay` int(11) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (`id_kkiapay`) -) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8;'; - -foreach ($sql as $query) { - if (Db::getInstance()->execute($query) == false) { - return false; - } -} diff --git a/sql/uninstall.php b/sql/uninstall.php deleted file mode 100644 index e86fe50..0000000 --- a/sql/uninstall.php +++ /dev/null @@ -1,38 +0,0 @@ - -* @copyright 2007-2019 PrestaShop SA -* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -* International Registered Trademark & Property of PrestaShop SA -*/ - -/** - * In some cases you should not drop the tables. - * Maybe the merchant will just try to reset the module - * but does not want to loose all of the data associated to the module. - */ -$sql = array(); - -foreach ($sql as $query) { - if (Db::getInstance()->execute($query) == false) { - return false; - } -} diff --git a/translations/en.php b/translations/en.php old mode 100644 new mode 100755 index fd4abba..c058e0a --- a/translations/en.php +++ b/translations/en.php @@ -4,10 +4,12 @@ $_MODULE = array(); $_MODULE['<{kkiapay}prestashop>kkiapay_abb331b8f264ffbdd5dd3e7f14a0e9fa'] = 'kkiapay'; $_MODULE['<{kkiapay}prestashop>kkiapay_b1d246a4251de29c6654c1b7d4418dc6'] = 'kkiaPay allows businesses to receive payments securely via mobile money, a credit card or a bank account.'; -$_MODULE['<{kkiapay}prestashop>kkiapay_40ec99718d6b5bd38b142cf80d1f34a5'] = 'Invalid configurations values'; -$_MODULE['<{kkiapay}prestashop>kkiapay_537812948d8811d9f00110af5cc967ce'] = 'Updated settings'; -$_MODULE['<{kkiapay}prestashop>kkiapay_24ace383b70d09954259c15cfeb9b2fd'] = 'Yes'; -$_MODULE['<{kkiapay}prestashop>kkiapay_6679e65c932b2c5ad98080ee21a4f0d4'] = 'No'; +$_MODULE['<{kkiapay}prestashop>kkiapay_30050aae7627c5eada43754b987aa6c6'] = 'Do you want to uninstall kkiapay'; +$_MODULE['<{kkiapay}prestashop>kkiapay_6ada973d54a7714a4e0154825e4e0150'] = 'Public key must be configured to use this module'; +$_MODULE['<{kkiapay}prestashop>kkiapay_ff462f2e4df7cdd37dac50b46c16b50e'] = 'XOF currency (FCFA) must be configured to use this module'; +$_MODULE['<{kkiapay}prestashop>kkiapay_4dc7445a56fe3122e41017741bc5922f'] = 'Public key is required.'; +$_MODULE['<{kkiapay}prestashop>kkiapay_537812948d8811d9f00110af5cc967ce'] = 'Settings updated'; +$_MODULE['<{kkiapay}prestashop>kkiapay_41115a63d12b5be00dde5f59def8e495'] = 'Pay with kkiapay'; $_MODULE['<{kkiapay}prestashop>kkiapay_e8f6406befb0c99943dd6c6dc1e7f5fb'] = 'On the right of the page'; $_MODULE['<{kkiapay}prestashop>kkiapay_adaa23193abc905575c621c3550db2a0'] = 'In the center of the page'; $_MODULE['<{kkiapay}prestashop>kkiapay_2beae5c84f5cf2d5a47eff9cfd05bbb6'] = 'On the left of the page'; @@ -23,11 +25,24 @@ $_MODULE['<{kkiapay}prestashop>kkiapay_511969171614941d4c86444562e15a74'] = 'Disposition of the kkiapay widget'; $_MODULE['<{kkiapay}prestashop>kkiapay_05f49559098a44a034419a1600d98f4e'] = 'Use this option to control where the kkiapay window should appear on your site'; $_MODULE['<{kkiapay}prestashop>kkiapay_76b56638af22c17c4b07b74ada232fdb'] = 'Save'; -$_MODULE['<{kkiapay}prestashop>kkiapay_4dfff35d2990d6283c7f031d7a51e64c'] = 'back to the list'; -$_MODULE['<{kkiapay}prestashop>payment_fa04501841996a31b49934ab53f6e0bb'] = ' Use kkiapay to pay with your mobile money account, a credit card or a bank account'; -$_MODULE['<{kkiapay}prestashop>payment_execution_46ace3ac2b3dcd6a9556a746120f3bb7'] = 'Payment receipt'; +$_MODULE['<{kkiapay}prestashop>payment_execution_db1e1a3ec94f7cdc35be7bcc8a2e3733'] = 'Return to checkout'; +$_MODULE['<{kkiapay}prestashop>payment_execution_66fbb7b1435db0aca8d0446c3749c7f6'] = 'checkout'; +$_MODULE['<{kkiapay}prestashop>payment_execution_41115a63d12b5be00dde5f59def8e495'] = 'Pay with kkiapay'; +$_MODULE['<{kkiapay}prestashop>payment_execution_e68e1dc65a6098024e51bffd96888032'] = 'Order Summary'; +$_MODULE['<{kkiapay}prestashop>payment_execution_2fb6870e703438b87861914f4199c1d2'] = 'Payment with KKIAPAY'; $_MODULE['<{kkiapay}prestashop>payment_execution_040ad9fc0b965415332b17e12ed6226d'] = 'Order number'; $_MODULE['<{kkiapay}prestashop>payment_execution_a04db41511fbf5df5a55e14f4c53a349'] = 'Amount to be paid'; $_MODULE['<{kkiapay}prestashop>payment_execution_6f212869bb4b093a382cf584df7c8c55'] = 'Payment method'; $_MODULE['<{kkiapay}prestashop>payment_execution_44749712dbec183e983dcd78a7736c41'] = 'Date'; -$_MODULE['<{kkiapay}prestashop>payment_execution_303a74098e356909ffcf68b9bd4ca1b0'] = 'Confirm'; +$_MODULE['<{kkiapay}prestashop>payment_execution_2b2d3c8121a65d608612dab30d952bd5'] = 'I confirm my order'; +$_MODULE['<{kkiapay}prestashop>payment_execution_10b973a57d5d53926d92b73402e18450'] = 'Back'; +$_MODULE['<{kkiapay}prestashop>infos_b1d246a4251de29c6654c1b7d4418dc6'] = 'kkiaPay allows businesses to receive payments securely via mobile money, a credit card or a bank account.'; +$_MODULE['<{kkiapay}prestashop>payment_abd853a9c1f62ed4ca81117a5765b348'] = 'Pay with kkiapay'; +$_MODULE['<{kkiapay}prestashop>payment_2d19f9926e7b37d56042bbf8e59e5315'] = '(You pay directly on the site)'; +$_MODULE['<{kkiapay}prestashop>payment_return_7e2134b9feac7aee0324535e2fdb7e3f'] = 'Your order was successful.'; +$_MODULE['<{kkiapay}prestashop>payment_return_88a43b9d1a37720fa9a931c77d6768be'] = 'Order Summary'; +$_MODULE['<{kkiapay}prestashop>payment_return_ccaca1c008a83b9afa4d14adce92e2ab'] = 'Order reference'; +$_MODULE['<{kkiapay}prestashop>payment_return_96b0141273eabab320119c467cdcaf17'] = 'Total'; +$_MODULE['<{kkiapay}prestashop>payment_return_a6628e00fa0ea94a40f01df08a7e3869'] = 'We had notified an error on your order'; +$_MODULE['<{kkiapay}prestashop>payment_return_0b7a3f9723edd1b6122fa64c343cf802'] = 'Support team'; +$_MODULE['<{kkiapay}prestashop>validation_24245a8d0cd9f126bab21cc67d670031'] = 'This payment method is not authorized.'; diff --git a/translations/index.php b/translations/index.php old mode 100644 new mode 100755 index ccf80de..e5064df --- a/translations/index.php +++ b/translations/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2019 PrestaShop SA -* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* @author PrestaShop SA +* @copyright 2007-2016 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA */ -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; + +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/upgrade/index.php b/upgrade/index.php deleted file mode 100644 index ccf80de..0000000 --- a/upgrade/index.php +++ /dev/null @@ -1,34 +0,0 @@ - -* @copyright 2007-2019 PrestaShop SA -* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -* International Registered Trademark & Property of PrestaShop SA -*/ -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/upgrade/upgrade-1.1.0.php b/upgrade/upgrade-1.1.0.php deleted file mode 100644 index bb21ba7..0000000 --- a/upgrade/upgrade-1.1.0.php +++ /dev/null @@ -1,44 +0,0 @@ - -* @copyright 2007-2019 PrestaShop SA -* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -* International Registered Trademark & Property of PrestaShop SA -*/ - -if (!defined('_PS_VERSION_')) { - exit; -} - -/** - * This function updates your module from previous versions to the version 1.1, - * usefull when you modify your database, or register a new hook ... - * Don't forget to create one file per version. - */ -function upgrade_module_1_1_0($module) -{ - /* - * Do everything you want right there, - * You could add a column in one of your module's tables - */ - - return true; -} diff --git a/views/css/front.css b/views/css/front.css deleted file mode 100644 index edd3969..0000000 --- a/views/css/front.css +++ /dev/null @@ -1,27 +0,0 @@ -/** -* 2007-2019 PrestaShop -* -* NOTICE OF LICENSE -* -* This source file is subject to the Academic Free License (AFL 3.0) -* that is bundled with this package in the file LICENSE.txt. -* It is also available through the world-wide-web at this URL: -* http://opensource.org/licenses/afl-3.0.php -* If you did not receive a copy of the license and are unable to -* obtain it through the world-wide-web, please send an email -* to license@prestashop.com so we can send you a copy immediately. -* -* DISCLAIMER -* -* Do not edit or add to this file if you wish to upgrade PrestaShop to newer -* versions in the future. If you wish to customize PrestaShop for your -* needs please refer to http://www.prestashop.com for more information. -* -* @author PrestaShop SA -* @copyright 2007-2019 PrestaShop SA -* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -* International Registered Trademark & Property of PrestaShop SA -* -* Don't forget to prefix your containers with your own identifier -* to avoid any conflicts with others containers. -*/ diff --git a/views/img/index.php b/views/img/index.php deleted file mode 100644 index ccf80de..0000000 --- a/views/img/index.php +++ /dev/null @@ -1,34 +0,0 @@ - -* @copyright 2007-2019 PrestaShop SA -* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -* International Registered Trademark & Property of PrestaShop SA -*/ -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/index.php b/views/index.php old mode 100644 new mode 100755 index ccf80de..19a328b --- a/views/index.php +++ b/views/index.php @@ -1,34 +1,35 @@ - -* @copyright 2007-2019 PrestaShop SA -* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -* International Registered Trademark & Property of PrestaShop SA -*/ -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; + +* @copyright 2007-2016 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +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/js/front.js b/views/js/front.js deleted file mode 100644 index edd3969..0000000 --- a/views/js/front.js +++ /dev/null @@ -1,27 +0,0 @@ -/** -* 2007-2019 PrestaShop -* -* NOTICE OF LICENSE -* -* This source file is subject to the Academic Free License (AFL 3.0) -* that is bundled with this package in the file LICENSE.txt. -* It is also available through the world-wide-web at this URL: -* http://opensource.org/licenses/afl-3.0.php -* If you did not receive a copy of the license and are unable to -* obtain it through the world-wide-web, please send an email -* to license@prestashop.com so we can send you a copy immediately. -* -* DISCLAIMER -* -* Do not edit or add to this file if you wish to upgrade PrestaShop to newer -* versions in the future. If you wish to customize PrestaShop for your -* needs please refer to http://www.prestashop.com for more information. -* -* @author PrestaShop SA -* @copyright 2007-2019 PrestaShop SA -* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -* International Registered Trademark & Property of PrestaShop SA -* -* Don't forget to prefix your containers with your own identifier -* to avoid any conflicts with others containers. -*/ diff --git a/views/js/index.php b/views/js/index.php deleted file mode 100644 index ccf80de..0000000 --- a/views/js/index.php +++ /dev/null @@ -1,34 +0,0 @@ - -* @copyright 2007-2019 PrestaShop SA -* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -* International Registered Trademark & Property of PrestaShop SA -*/ -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/configure.tpl b/views/templates/admin/configure.tpl deleted file mode 100644 index 0cdb9e3..0000000 --- a/views/templates/admin/configure.tpl +++ /dev/null @@ -1,48 +0,0 @@ -{* -* 2007-2019 PrestaShop -* -* NOTICE OF LICENSE -* -* This source file is subject to the Academic Free License (AFL 3.0) -* that is bundled with this package in the file LICENSE.txt. -* It is also available through the world-wide-web at this URL: -* http://opensource.org/licenses/afl-3.0.php -* If you did not receive a copy of the license and are unable to -* obtain it through the world-wide-web, please send an email -* to license@prestashop.com so we can send you a copy immediately. -* -* DISCLAIMER -* -* Do not edit or add to this file if you wish to upgrade PrestaShop to newer -* versions in the future. If you wish to customize PrestaShop for your -* needs please refer to http://www.prestashop.com for more information. -* -* @author PrestaShop SA -* @copyright 2007-2019 PrestaShop SA -* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -* International Registered Trademark & Property of PrestaShop SA -*} - -
-

{l s='kkiapay' mod='kkiapay'}

-

- {l s='Here is my new generic module!' mod='kkiapay'}
- {l s='Thanks to PrestaShop, now I have a great module.' mod='kkiapay'}
- {l s='I can configure it using the following configuration form.' mod='kkiapay'} -

-
-

- {l s='This module will boost your sales!' mod='kkiapay'} -

-
- -
-

{l s='Documentation' mod='kkiapay'}

-

- » {l s='You can get a PDF documentation to configure this module' mod='kkiapay'} : -

-

-
diff --git a/views/templates/admin/hook/front/api/index.php b/views/templates/admin/hook/front/api/index.php deleted file mode 100644 index ccf80de..0000000 --- a/views/templates/admin/hook/front/api/index.php +++ /dev/null @@ -1,34 +0,0 @@ - -* @copyright 2007-2019 PrestaShop SA -* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -* International Registered Trademark & Property of PrestaShop SA -*/ -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/hook/front/api/payment.tpl b/views/templates/admin/hook/front/api/payment.tpl deleted file mode 100644 index 67abc7a..0000000 --- a/views/templates/admin/hook/front/api/payment.tpl +++ /dev/null @@ -1,9 +0,0 @@ -{block name="content"} - -
-

{l s='Utilisez kkiapay pour payer avec votre compte mobile money, une carte de credit ou un compte bancaire' mod='kkiapay'} -

-
- -{/block} - diff --git a/views/templates/admin/hook/front/api/payment_execution.tpl b/views/templates/admin/hook/front/api/payment_execution.tpl deleted file mode 100644 index 911b2b1..0000000 --- a/views/templates/admin/hook/front/api/payment_execution.tpl +++ /dev/null @@ -1,60 +0,0 @@ -{extends "$layout"} -{block name="content"} -
-
-
-
-

{l s='Reçu de paiement' mod='kkiapay'}

-
- {l s='Numéro de commande' mod='kkiapay'} : {$num_cart|escape:'htmlall':'UTF-8'} -

- {l s='Montant à payer' mod='kkiapay'} : CFA{$price|escape:'htmlall':'UTF-8'} -

- {l s='Moyen de paiement' mod='kkiapay'} : {$moyen_payment|escape:'htmlall':'UTF-8'} -

- {l s='Date' mod='kkiapay'} : {$date|escape:'htmlall':'UTF-8'} -

- -
-
- -
-
-
-
- -
-
-
-
- - - - - -{/block} diff --git a/views/templates/admin/hook/front/index.php b/views/templates/admin/hook/front/index.php deleted file mode 100644 index ccf80de..0000000 --- a/views/templates/admin/hook/front/index.php +++ /dev/null @@ -1,34 +0,0 @@ - -* @copyright 2007-2019 PrestaShop SA -* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -* International Registered Trademark & Property of PrestaShop SA -*/ -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/hook/index.php b/views/templates/admin/hook/index.php deleted file mode 100644 index ccf80de..0000000 --- a/views/templates/admin/hook/index.php +++ /dev/null @@ -1,34 +0,0 @@ - -* @copyright 2007-2019 PrestaShop SA -* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -* International Registered Trademark & Property of PrestaShop SA -*/ -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/index.php b/views/templates/admin/index.php deleted file mode 100644 index ccf80de..0000000 --- a/views/templates/admin/index.php +++ /dev/null @@ -1,34 +0,0 @@ - -* @copyright 2007-2019 PrestaShop SA -* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -* International Registered Trademark & Property of PrestaShop SA -*/ -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/front/index.php b/views/templates/front/index.php old mode 100644 new mode 100755 index ccf80de..cdda165 --- a/views/templates/front/index.php +++ b/views/templates/front/index.php @@ -1,34 +1,35 @@ - -* @copyright 2007-2019 PrestaShop SA -* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -* International Registered Trademark & Property of PrestaShop SA -*/ -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; + +* @copyright 2007-2016 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +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_execution.tpl b/views/templates/front/payment_execution.tpl new file mode 100755 index 0000000..e515ea4 --- /dev/null +++ b/views/templates/front/payment_execution.tpl @@ -0,0 +1,99 @@ +{* +* 2007-2016 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2016 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} + +{capture name=path} + {l s='Vérification' mod='kkiapay'}{$navigationPipe}{l s='Payez avec kkiapay' mod='kkiapay'} +{/capture} + +{include file="$tpl_dir./breadcrumb.tpl"} + +

{l s='Récapitulatif de la commande' mod='kkiapay'}

+ +{assign var='current_step' value='payment'} +{include file="$tpl_dir./order-steps.tpl"} + +{if isset($nbProducts) && $nbProducts <= 0} +

{l s='Your shopping cart is empty.' mod='cheque'}

+{else} + +

{l s='Paiement par KKIAPAY' mod='kkiapay'}

+
+ +

+
- {l s='Numéro de commande' mod='kkiapay'} : {$num_cart|escape:'htmlall':'UTF-8'} +

- {l s='Montant à payer' mod='kkiapay'} : {$price|escape:'htmlall':'UTF-8'} CFA +

- {l s='Moyen de paiement' mod='kkiapay'} : kkiapay +

- {l s='Date' mod='kkiapay'} : {$date|escape:'htmlall':'UTF-8'} +

+ +

+ + {l s='Je confirme ma commande' mod='kkiapay'} + + {l s='Retournez en arrière' mod='kkiapay'} +

+
+ + + + + +{/if} diff --git a/views/css/index.php b/views/templates/hook/index.php old mode 100644 new mode 100755 similarity index 73% rename from views/css/index.php rename to views/templates/hook/index.php index ccf80de..cdda165 --- a/views/css/index.php +++ b/views/templates/hook/index.php @@ -1,34 +1,35 @@ - -* @copyright 2007-2019 PrestaShop SA -* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -* International Registered Trademark & Property of PrestaShop SA -*/ -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; + +* @copyright 2007-2016 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +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/js/back.js b/views/templates/hook/infos.tpl old mode 100644 new mode 100755 similarity index 63% rename from views/js/back.js rename to views/templates/hook/infos.tpl index edd3969..713f276 --- a/views/js/back.js +++ b/views/templates/hook/infos.tpl @@ -1,5 +1,5 @@ -/** -* 2007-2019 PrestaShop +{* +* 2007-2016 PrestaShop * * NOTICE OF LICENSE * @@ -17,11 +17,12 @@ * versions in the future. If you wish to customize PrestaShop for your * needs please refer to http://www.prestashop.com for more information. * -* @author PrestaShop SA -* @copyright 2007-2019 PrestaShop SA -* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* @author PrestaShop SA +* @copyright 2007-2016 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA -* -* Don't forget to prefix your containers with your own identifier -* to avoid any conflicts with others containers. -*/ +*} + +
+

{l s="kkiaPay permet aux entreprises de recevoir des paiements en toute sécurité via de l'argent mobile, une carte de crédit ou un compte bancaire." mod='kkiapay'}

+
diff --git a/views/css/back.css b/views/templates/hook/payment.tpl old mode 100644 new mode 100755 similarity index 60% rename from views/css/back.css rename to views/templates/hook/payment.tpl index edd3969..e3de9be --- a/views/css/back.css +++ b/views/templates/hook/payment.tpl @@ -1,5 +1,5 @@ -/** -* 2007-2019 PrestaShop +{* +* 2007-2016 PrestaShop * * NOTICE OF LICENSE * @@ -17,11 +17,14 @@ * versions in the future. If you wish to customize PrestaShop for your * needs please refer to http://www.prestashop.com for more information. * -* @author PrestaShop SA -* @copyright 2007-2019 PrestaShop SA -* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* @author PrestaShop SA +* @copyright 2007-2016 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA -* -* Don't forget to prefix your containers with your own identifier -* to avoid any conflicts with others containers. -*/ +*} + +

+ + {l s='Payez par kkiapay' mod='kkiapay'} {l s='(Vous payez directement sur le site)' mod='kkiapay'} + +

\ No newline at end of file diff --git a/views/templates/hook/payment_return.tpl b/views/templates/hook/payment_return.tpl new file mode 100755 index 0000000..afdb2ae --- /dev/null +++ b/views/templates/hook/payment_return.tpl @@ -0,0 +1,42 @@ +{* +* 2007-2016 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2016 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} + +{if $status == 'ok'} +

{l s='Votre commande a réussi.' mod='kkiapay'}

+
+

{l s='Résumé de la commande' mod='kkiapay'}

+ {if !isset($reference)} + - {l s='Référence de la commande' mod='kkiapay'} : {$id_order|escape:'html'} + {else} + - {l s='Référence de la commande' mod='kkiapay'} : {$reference|escape:'html'} +
- {l s='Total' mod='kkiapay'} : {$total_to_pay} + {/if} +
+{else} +

+ {l s='Nous avions notifié une erreur sur votre commande' mod='kkiapay'} + {l s='L\'équipe de support' mod='kkiapay'}. +

+{/if} diff --git a/views/templates/index.php b/views/templates/index.php old mode 100644 new mode 100755 index ccf80de..7b50157 --- a/views/templates/index.php +++ b/views/templates/index.php @@ -1,34 +1,35 @@ - -* @copyright 2007-2019 PrestaShop SA -* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -* International Registered Trademark & Property of PrestaShop SA -*/ -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; + +* @copyright 2007-2016 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +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