Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
https://github.com/abantecart/abantecart-src/issues/1172
- Loading branch information
Showing
4 changed files
with
155 additions
and
11 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,49 @@ | ||
<?php | ||
/*------------------------------------------------------------------------------ | ||
$Id$ | ||
AbanteCart, Ideal OpenSource Ecommerce Solution | ||
http://www.AbanteCart.com | ||
Copyright © 2011-2018 Belavier Commerce LLC | ||
This source file is subject to Open Software License (OSL 3.0) | ||
Licence details is bundled with this package in the file LICENSE.txt. | ||
It is also available at this URL: | ||
<http://www.opensource.org/licenses/OSL-3.0> | ||
UPGRADE NOTE: | ||
Do not edit or add to this file if you wish to upgrade AbanteCart to newer | ||
versions in the future. If you wish to customize AbanteCart for your | ||
needs please refer to http://www.AbanteCart.com for more information. | ||
------------------------------------------------------------------------------*/ | ||
|
||
|
||
class Extension2Checkout extends Extension | ||
{ | ||
//payment confirmation pending page | ||
public function onControllerPagesCheckoutSuccess_InitData() | ||
{ | ||
$that = $this->baseObject; | ||
$order_id = (int)$that->session->data['order_id']; | ||
if (!$order_id || $that->session->data['2checkout_pending_ipn_skip']) { | ||
return null; | ||
} | ||
$that->loadModel('checkout/order'); | ||
$order_info = $that->model_checkout_order->getOrder($order_id); | ||
//do nothing if order confirmed or it's not created with paypal standart | ||
if ((int)$order_info['order_status_id'] != 0 || $order_info['payment_method_key'] != '2checkout') { | ||
return null; | ||
} | ||
//set sign to prevent double redirect (see above) | ||
$that->session->data['2checkout_pending_ipn_skip'] = true; | ||
redirect($that->html->getSecureURL('extension/2checkout/pending_payment')); | ||
} | ||
|
||
//delete sign after success | ||
public function onControllerPagesCheckoutSuccess_UpdateData() | ||
{ | ||
unset($this->baseObject->session->data['2checkout_pending_ipn_skip']); | ||
} | ||
|
||
} |
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
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
37 changes: 37 additions & 0 deletions
37
public_html/extensions/2checkout/storefront/view/default/template/responses/pending_ipn.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,37 @@ | ||
<!DOCTYPE html> | ||
<html xmlns="http://www.w3.org/1999/xhtml" dir="<?php echo $direction; ?>" lang="<?php echo $lang; ?>" xml:lang="<?php echo $lang; ?>" <?php echo $this->getHookVar('hk_html_attribute'); ?>> | ||
<head><?php echo $head; ?></head> | ||
<body> | ||
<div class="container-fixed"> | ||
<div class="contentpanel" style="margin-top: 5%"> | ||
<h3 class=" col-sm-5 col-sm-offset-4"><i class="fa fa-spinner fa-pulse"></i> <?php echo $text_message; ?></h3> | ||
</div> | ||
</div> | ||
<script type="text/javascript" src="<?php echo $this->templateResource('/javascript/bootstrap.min.js'); ?>" defer></script> | ||
<script language="JavaScript" type="application/javascript"> | ||
var timeout = 30; | ||
(function worker() { | ||
if(timeout <=0){ | ||
location = '<?php echo $success_url;?>'; | ||
return; | ||
} | ||
timeout -=5; | ||
$.ajax({ | ||
url: '<?php echo $test_url;?>', | ||
success: function (data) { | ||
console.log(data); | ||
if(data['result'] == true) { | ||
$('h3').html('..redirecting'); | ||
location = '<?php echo $success_url;?>'; | ||
return false; | ||
} | ||
}, | ||
complete: function () { | ||
// Schedule the next request when the current one's complete | ||
setTimeout(worker, 5000); | ||
} | ||
}); | ||
})(); | ||
</script> | ||
</body></html> |