-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add the managed form to checkout page * Add the managed form option to admin panel Handle display the managed form in checkout * Process ManagedForm payment request * Add Client key to the admin panel * Dynamic JS file based on the region * Handle Managed form with Tokenization option * SDK Core update with the correct iFrame groups * Run Tokenization routine only for logged-in users
- Loading branch information
Showing
4 changed files
with
142 additions
and
28 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,67 @@ | ||
<?php | ||
|
||
$_client_key = $this->client_key; | ||
|
||
$_js_path = 'payment/js/paylib.js'; | ||
$_js_url = $this->get_endpoint_url() . $_js_path; | ||
?> | ||
|
||
<script src="<?= $_js_url ?>"></script> | ||
|
||
<div id="pt_managed_form" class="form-row woocommerce-SavedPaymentMethods-saveNew"> | ||
|
||
<div> | ||
<span style="color: red;" id="paymentErrors"></span> | ||
<div class="row"> | ||
<label>Card Number</label> | ||
<input type="text" data-paylib="number" size="20"> | ||
</div> | ||
<div class="row"> | ||
<label>Expiry Date (MM/YYYY)</label> | ||
<input type="text" data-paylib="expmonth" size="2"> | ||
<input type="text" data-paylib="expyear" size="4"> | ||
</div> | ||
<div class="row"> | ||
<label>Security Code</label> | ||
<input type="text" data-paylib="cvv" size="4"> | ||
<input type="hidden" name="token" id="pt_token"> | ||
</div> | ||
|
||
</div> | ||
</div> | ||
|
||
|
||
<script type="text/javascript"> | ||
var myform = document.getElementsByName('checkout')[0]; | ||
|
||
var checkout_form = jQuery('form.checkout'); | ||
|
||
var mf_confirmed = false; | ||
|
||
paylib.inlineForm({ | ||
'key': '<?= $_client_key ?>', | ||
'form': myform, | ||
'autoSubmit': false, | ||
'callback': function(response) { | ||
console.log(response); | ||
document.getElementById('paymentErrors').innerHTML = ''; | ||
if (response.error) { | ||
paylib.handleError(document.getElementById('paymentErrors'), response); | ||
} else { | ||
if (!mf_confirmed) { | ||
jQuery('#pt_token').val(response.token); | ||
mf_confirmed = true; | ||
|
||
checkout_form.submit(); | ||
} | ||
} | ||
} | ||
}); | ||
|
||
checkout_form.on('checkout_place_order', function(event, params) { | ||
// console.log('on_place_order', event); | ||
var isFormHidden = jQuery('#pt_managed_form').is(':hidden'); | ||
|
||
return mf_confirmed || isFormHidden; | ||
}); | ||
</script> |
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
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 |
---|---|---|
|
@@ -9,11 +9,11 @@ | |
* Plugin URI: https://paytabs.com/ | ||
* Description: PayTabs is a <strong>3rd party payment gateway</strong>. Ideal payment solutions for your internet business. | ||
* Version: 4.10.0 | ||
* Version: 4.11.0 | ||
* Requires PHP: 7.0 | ||
* Author: PayTabs | ||
* Author URI: [email protected] | ||
* Revision Date: 17/February/2022 | ||
* Revision Date: 03/April/2022 | ||
*/ | ||
|
||
if (!function_exists('add_action')) { | ||
|
@@ -22,7 +22,7 @@ | |
|
||
|
||
|
||
define('PAYTABS_PAYPAGE_VERSION', '4.10.0'); | ||
define('PAYTABS_PAYPAGE_VERSION', '4.11.0'); | ||
define('PAYTABS_PAYPAGE_DIR', plugin_dir_path(__FILE__)); | ||
define('PAYTABS_PAYPAGE_ICONS_URL', plugins_url("icons/", __FILE__)); | ||
define('PAYTABS_PAYPAGE_IMAGES_URL', plugins_url("images/", __FILE__)); | ||
|