-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
59b4f52
commit e023ff1
Showing
33 changed files
with
1,500 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# 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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?php | ||
/** | ||
* 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 [email protected] 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 Hennes Hervé <[email protected]> | ||
* @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'); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
<?php | ||
/** | ||
* 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 [email protected] 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 Hennes Hervé <[email protected]> | ||
* @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'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
/** | ||
* 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 [email protected] 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 <[email protected]> | ||
* @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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
/** | ||
* 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 [email protected] 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 <[email protected]> | ||
* @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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
/** | ||
* 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 [email protected] 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 <[email protected]> | ||
* @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; |
Oops, something went wrong.