| 1 |
let form = jQuery('<form></form>') |
| 2 |
/** |
| 3 |
* create a HTML from and insert it after order_details class |
| 4 |
* This form must be created to replace it with CopyAndPay form |
| 5 |
*/ |
| 6 |
form.attr('action', dataObj.postbackURL) |
| 7 |
.addClass('paymentWidgets') |
| 8 |
.attr('data-brands', dataObj.payment_brands) |
| 9 |
jQuery('.order_details').after(form) |
| 10 |
|
| 11 |
/** |
| 12 |
* |
| 13 |
* to check if current broswer support ApplePay |
| 14 |
* @param {boolean} |
| 15 |
* if @returns {false} attach error message Your Device Dose Not Support ApplePay |
| 16 |
*/ |
| 17 |
if (!window.ApplePaySession && dataObj.payment_brands.includes('APPLEPAY')) { |
| 18 |
jQuery('.woocommerce-notices-wrapper') |
| 19 |
.append(`<ul class="woocommerce-error" role="alert"><li> ${ dataObj.is_arabic ? 'جهازك او � |
| 20 |
تصفحك لا يدع� |
| 21 |
الدفع عن طريق ابل' : 'Your Device Or Browser Dose Not Support ApplePay' } </li></ul>`) |
| 22 |
} |
| 23 |
|
| 24 |
/** |
| 25 |
* initiate wpwlOptions |
| 26 |
*/ |
| 27 |
var wpwlOptions = { |
| 28 |
|
| 29 |
onReady: function () { |
| 30 |
|
| 31 |
jQuery('.wpwl-form-virtualAccount-STC_PAY .wpwl-wrapper-radio-qrcode').hide(); |
| 32 |
jQuery('.wpwl-form-virtualAccount-STC_PAY .wpwl-wrapper-radio-mobile').hide(); |
| 33 |
jQuery('.wpwl-form-virtualAccount-STC_PAY .wpwl-group-paymentMode').hide(); |
| 34 |
jQuery('.wpwl-form-virtualAccount-STC_PAY .wpwl-group-mobilePhone').show(); |
| 35 |
jQuery('.wpwl-form-virtualAccount-STC_PAY .wpwl-wrapper-radio-mobile .wpwl-control-radio-mobile').attr('checked', true); |
| 36 |
jQuery('.wpwl-form-virtualAccount-STC_PAY .wpwl-wrapper-radio-mobile .wpwl-control-radio-mobile').trigger('click'); |
| 37 |
|
| 38 |
}, |
| 39 |
"style": dataObj.style, // <== this style comes from settings page of gateways |
| 40 |
"paymentTarget": "_top", |
| 41 |
"locale" : dataObj.is_arabic ? 'ar' : 'en', |
| 42 |
"registrations": { |
| 43 |
"hideInitialPaymentForms": "true", |
| 44 |
"requireCvv": "true" |
| 45 |
} |
| 46 |
|
| 47 |
|
| 48 |
} |
| 49 |
|