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
0 parents
commit e789666
Showing
57 changed files
with
2,780 additions
and
0 deletions.
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,4 @@ | ||
payabbhi.tar.gz | ||
.DS_Store | ||
dist/* | ||
|
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 @@ | ||
MIT License | ||
|
||
Copyright (c) 2017 Paypermint | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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,29 @@ | ||
VERSION_FILE=VERSION | ||
VER=`cat $(VERSION_FILE)` | ||
|
||
release: init prepare archive cleanup | ||
|
||
init: | ||
mkdir dist | ||
|
||
prepare: | ||
cp VERSION payabbhi | ||
markdown-pdf README.md | ||
zip -r payabbhi.zip payabbhi | ||
|
||
|
||
archive: | ||
zip -r payabbhi-prestashop-$(VER).zip payabbhi.zip README.pdf | ||
tar -cvzf payabbhi-prestashop-$(VER).tar.gz payabbhi.zip README.pdf | ||
|
||
|
||
cleanup: | ||
mv payabbhi-prestashop-$(VER).zip dist | ||
mv payabbhi-prestashop-$(VER).tar.gz dist | ||
rm payabbhi/VERSION | ||
rm README.pdf | ||
rm payabbhi.zip | ||
|
||
|
||
clean: | ||
rm -rf dist |
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,40 @@ | ||
## Payabbhi Payments - Prestashop Integration | ||
|
||
This extension is built on Payabbhi PHP Library to provide seamless integration of [Payabbhi Checkout ](https://payabbhi.com/docs/checkout) with PrestaShop 1.6 | ||
|
||
|
||
### Installation | ||
|
||
Make sure you have signed up for your [Payabbhi Account](https://payabbhi.com/docs/account) and downloaded the [API keys](https://payabbhi.com/docs/account/#api-keys) from the [Portal](https://payabbhi.com/portal). | ||
|
||
1. Unzip [payabbhi-prestashop-VERSION.zip](https://github.com/payabbhi/payabbhi-prestashop/releases). | ||
|
||
2. Navigate to `PrestaShop Back Office` -> `Modules and Services` and click on `Add a new module`. | ||
|
||
3. Browse for `payabbhi.zip` to add Payabbhi Payment Extension to PrestaShop. | ||
|
||
4. On successful upload, `payabbhi` folder should get added to PrestaShop installation directory as follows: | ||
|
||
``` | ||
PrestaShop/ | ||
modules/ | ||
payabbhi/ | ||
config.xml | ||
controllers/ | ||
index.php | ||
logo.png | ||
payabbhi-php/ | ||
payabbhi.php | ||
VERSION | ||
views/ | ||
``` | ||
|
||
4. After successful upload, navigate to `Modules List` ->`Payments and Gateways` and install `Payabbhi Checkout` as per on-screen instructions. If you do not find Payabbhi on the list, please use the search option to find it. | ||
|
||
5. Configure `Payabbhi` and Save the settings: | ||
- [Access ID](https://payabbhi.com/docs/account/#api-keys) | ||
- [Secret Key](https://payabbhi.com/docs/account/#api-keys) | ||
- [payment_auto_capture](https://payabbhi.com/docs/api/#create-an-order) | ||
|
||
|
||
[Payabbhi Checkout](https://payabbhi.com/docs/checkout) is now enabled in 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 @@ | ||
1.0.0 |
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,13 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<module> | ||
<name>payabbhi</name> | ||
<displayName><![CDATA[Payabbhi]]></displayName> | ||
<version><![CDATA[1.0.0]]></version> | ||
<description><![CDATA[Accept payments for your products via Payabbhi.]]></description> | ||
<author><![CDATA[Payabbhi Team]]></author> | ||
<tab><![CDATA[payments_gateways]]></tab> | ||
<confirmUninstall><![CDATA[Are you sure you want to uninstall?]]></confirmUninstall> | ||
<is_configurable>1</is_configurable> | ||
<need_instance>1</need_instance> | ||
<limited_countries></limited_countries> | ||
</module> |
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,10 @@ | ||
<?php | ||
header('Expires: Tue, 01 Apr 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,25 @@ | ||
<?php | ||
class PayabbhiPaymentModuleFrontController extends ModuleFrontController | ||
{ | ||
public $ssl = true; | ||
public $display_column_left = false; | ||
public function initContent() | ||
{ | ||
parent::initContent(); | ||
|
||
$cart = $this->context->cart; | ||
$payabbhi = new payabbhi(); | ||
$payabbhi->execPayment($cart); | ||
|
||
$this->context->smarty->assign(array( | ||
'nbProducts' => $cart->nbProducts(), | ||
'total' => $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'); | ||
} | ||
} |
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,70 @@ | ||
<?php | ||
|
||
|
||
class PayabbhiValidationModuleFrontController extends ModuleFrontController | ||
{ | ||
public function postProcess() | ||
{ | ||
global $cookie; | ||
|
||
$payment_id = $_REQUEST['payment_id']; | ||
$attributes = array( | ||
'payment_id' => $payment_id, | ||
'order_id' => $_REQUEST['order_id'], | ||
'payment_signature' => $_REQUEST['payment_signature'], | ||
); | ||
|
||
$cart = $this->context->cart; | ||
$cart_id = $cart->id; | ||
|
||
$payabbhi = new Payabbhi(); | ||
$success = true; | ||
|
||
$accessID = Configuration::get('PAYABBHI_ACCESS_ID'); //TODO fetch from $this if possible | ||
$secretKey = Configuration::get('PAYABBHI_SECRET_KEY'); | ||
$client = new \Payabbhi\Client($accessID, $secretKey); | ||
|
||
try { | ||
$client->utility->verifyPaymentSignature($attributes); | ||
$payment = $client->payment->retrieve($payment_id); | ||
} catch (\Payabbhi\Error $e) { | ||
$success = false; | ||
$error = 'Prestashop Error: Payment failed because signature verification error'; | ||
} | ||
|
||
if ($success == true) | ||
{ | ||
$customer = new Customer($cart->id_customer); | ||
$total = (float) $cart->getOrderTotal(true, Cart::BOTH); | ||
$payabbhi->validateOrder($cart_id, _PS_OS_PAYMENT_, $total, $payabbhi->displayName . ' (' . $payment->method . ')', '', array(), NULL, false, $customer->secure_key); | ||
|
||
Logger::addLog("Payment Successful for Order#" . $cart_id . ". Payabbhi payment ID: " . $payment_id . ". Payabbhi order ID: " . $_REQUEST['order_id'], 1); | ||
|
||
$order = new Order((int)$payabbhi->currentOrder); | ||
$payments = $order->getOrderPayments(); | ||
|
||
if (!empty($payments)) { | ||
$payments[0]->transaction_id = $payment_id; | ||
$payments[0]->update(); | ||
} | ||
|
||
$query = http_build_query(array( | ||
'controller' => 'order-confirmation', | ||
'id_cart' => (int) $cart->id, | ||
'id_module' => (int) $this->module->id, | ||
'id_order' => $payabbhi->currentOrder | ||
), '', '&'); | ||
|
||
$url = 'index.php?'. $query; | ||
Tools::redirect($url); | ||
} | ||
else | ||
{ | ||
Logger::addLog("Payment Failed for Order# ". $cart_id . "Error: ". $error, 4); | ||
echo 'Error! Please contact the seller directly for assistance.</br>'; | ||
echo 'Order Id: '.$cart_id.'</br>'; | ||
echo 'Error: '.str_replace(' ', ' ', ucwords(str_replace('_', ' ', $response_code))).'</br>'; | ||
} | ||
|
||
} | ||
} |
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,10 @@ | ||
<?php | ||
header('Expires: Tue, 01 Apr 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; |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,14 @@ | ||
# Mac OS X dumps these all over the place. | ||
.DS_Store | ||
|
||
# Ignore the /vendor/ directory for people using composer | ||
/vendor/ | ||
|
||
# If the vendor directory isn't being commited the composer.lock file should also be ignored | ||
composer.lock | ||
|
||
# Ignore PHPUnit coverage file | ||
clover.xml | ||
|
||
# Ignore tests | ||
test.php |
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 @@ | ||
MIT License | ||
|
||
Copyright (c) 2017 Paypermint | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
Oops, something went wrong.