Changeset 2886423
- Timestamp:
- 03/24/2023 01:04:44 PM (3 years ago)
- Location:
- tabby-checkout/trunk
- Files:
-
- 7 edited
-
includes/class-wc-gateway-tabby-checkout-base.php (modified) (1 diff)
-
includes/class-wc-settings-tab-tabby.php (modified) (1 diff)
-
includes/class-wc-tabby-config.php (modified) (1 diff)
-
includes/class-wc-tabby-promo.php (modified) (3 diffs)
-
js/tabby.js (modified) (9 diffs)
-
readme.txt (modified) (3 diffs)
-
tabby-checkout.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tabby-checkout/trunk/includes/class-wc-gateway-tabby-checkout-base.php
r2828572 r2886423 125 125 if (static::TABBY_METHOD_CODE == 'creditCardInstallments') $jsClass = 'TabbyPaymentMethodSnippetCCI'; 126 126 echo '<div id="'.esc_attr($divId).'"></div>'; 127 echo '<script> new '.esc_js($jsClass).'(' . $this->getTabbyCardJsonConfig($divId) .');</script>';127 echo '<script> if (typeof '.esc_js($jsClass).' !== \'undefined\') new '.esc_js($jsClass).'(' . $this->getTabbyCardJsonConfig($divId) .');</script>'; 128 128 break; 129 129 case 2: -
tabby-checkout/trunk/includes/class-wc-settings-tab-tabby.php
r2828572 r2886423 142 142 ); 143 143 $settings_tabby[] = array( 144 'name' => __( 'Promotion snippets (additional settings)', 'tabby-checkout' ), 145 'id' => 'tabby_checkout_promo_type_price', 146 'type' => 'text', 147 'desc' => __( 'Please use this settings only in case if you have the recommendations from Tabby team.<br /> 148 <br /> 149 Set up -1 for Standard promotion snippets as a default value<br /> 150 Set up 0 for Credit Card installments promotion snippets as a default value<br /> 151 Set up the limit between 0 - 50000 to show Standard promotion snippets for the amount which is lower than the limit and Credit Card installments promotion snippets for the amount which is higher than the limit. ', 'tabby-checkout' ), 152 'type' => 'number', 153 'custom_attributes' => array( 154 'min' => -1, 155 'step' => 1, 156 ), 157 'css' => 'width: 80px;', 158 'default' => '-1', 159 'autoload' => false, 160 ); 161 $settings_tabby[] = array( 144 162 'name' => __( 'Tabby promotions theme', 'tabby-checkout' ), 145 163 'id' => 'tabby_checkout_promo_theme', -
tabby-checkout/trunk/includes/class-wc-tabby-config.php
r2828572 r2886423 2 2 3 3 class WC_Tabby_Config { 4 const ALLOWED_CURRENCIES = ['AED','SAR','BHD','KWD', 'EGP' ];5 const ALLOWED_COUNTRIES = [ 'AE', 'SA', 'BH', 'KW', 'EG' ];4 const ALLOWED_CURRENCIES = ['AED','SAR','BHD','KWD', 'EGP', 'QAR']; 5 const ALLOWED_COUNTRIES = [ 'AE', 'SA', 'BH', 'KW', 'EG', 'QA']; 6 6 7 7 public static function isAvailableForCountry($country_code) { -
tabby-checkout/trunk/includes/class-wc-tabby-promo.php
r2828572 r2886423 7 7 } 8 8 public static function wp_enqueue_scripts() { 9 if (is_checkout()) {9 if (is_checkout()) { 10 10 // css 11 11 wp_enqueue_style('tabby-checkout', plugins_url('css/tabby.css', dirname(__FILE__))); 12 12 // js 13 wp_enqueue_script('tabby-checkout-integration', 'https://'.TABBY_CHECKOUT_DOMAIN.'/integration.js', [], null, true); 14 wp_enqueue_script('tabby-checkout-tabby-js', plugins_url('js/tabby.js', dirname(__FILE__)), [], MODULE_TABBY_CHECKOUT_VERSION, true); 13 wp_enqueue_script('tabby-checkout-integration', 'https://'.TABBY_CHECKOUT_DOMAIN.'/cms-plugins.js', [], null, true); 14 wp_enqueue_script('tabby-checkout-tabby-js', plugins_url('js/tabby.js', dirname(__FILE__)), [], MODULE_TABBY_CHECKOUT_VERSION, true); 15 }; 15 16 16 if ($config = get_option('woocommerce_tabby_installments_settings')) { 17 if (!array_key_exists('description_type', $config) || $config['description_type'] < 2) { 18 wp_enqueue_script('tabby-checkout-tabby-card', 'https://'.TABBY_CHECKOUT_DOMAIN.'/tabby-card.js', [], null, true); 19 } 20 }; 21 22 if ($config = get_option('woocommerce_tabby_credit_card_installments_settings')) { 23 if (!array_key_exists('description_type', $config) || $config['description_type'] < 2) { 24 wp_enqueue_script('tabby-checkout-cci', 'https://'.TABBY_CHECKOUT_DOMAIN.'/tabby-payment-method-snippet-cci.js', [], null, true); 25 } 26 }; 27 28 }; 29 if ((is_product() || is_cart()) && static::is_tabby_promo_enabled()) { 30 wp_enqueue_script('tabby-checkout-promo', 'https://'.TABBY_CHECKOUT_DOMAIN.'/tabby-promo.js', [], null, true); 17 if ((is_product() || is_cart()) && static::is_tabby_promo_enabled()) { 18 wp_enqueue_script('tabby-checkout-promo', 'https://'.TABBY_CHECKOUT_DOMAIN.'/tabby-promo.js', [], null, true); 31 19 static::product_promotion_scripts(); 32 20 }; … … 109 97 } 110 98 public static function getProductType() { 111 return self::isCreditCardInstallmentsActive() && !self::isInstallmentsOrPayLaterActive() ? 'creditCardInstallments' : 'installments';99 return self::isCreditCardInstallmentsActive() && (!self::isInstallmentsOrPayLaterActive() || self::isCreditCardInstallmentsActiveByPrice()) ? 'creditCardInstallments' : 'installments'; 112 100 } 113 101 public static function isInstallmentsOrPayLaterActive() { 114 require_once dirname(__FILE__) . '/class-wc-gateway-tabby-paylater.php';115 102 require_once dirname(__FILE__) . '/class-wc-gateway-tabby-installments.php'; 116 $payLater = new WC_Gateway_Tabby_PayLater();117 $payLater->init_settings();118 103 $installments = new WC_Gateway_Tabby_Installments(); 119 104 $installments->init_settings(); 120 return ($installments->enabled == 'yes') || ($payLater->enabled == 'yes');105 return ($installments->enabled == 'yes'); 121 106 } 122 107 public static function isCreditCardInstallmentsActive() { … … 125 110 $cci->init_settings(); 126 111 return $cci->enabled == 'yes'; 112 } 113 public static function isCreditCardInstallmentsActiveByPrice() { 114 $type_price = get_option('tabby_checkout_promo_type_price', -1); 115 116 return $type_price >= 0 && self::getPrice() >= $type_price; 127 117 } 128 118 public static function getTheme() { -
tabby-checkout/trunk/js/tabby.js
r2828572 r2886423 1 1 jQuery(document).ready(function () { 2 jQuery('form.checkout input').on('change', updateTabbyCheckout);3 jQuery(document.body).on('updated_checkout', updateTabbyCheckout);4 5 function updateTabbyCheckout() {6 if (!window.tabbyRenderer) window.tabbyRenderer = new TabbyRenderer();7 tabbyRenderer.update();8 }2 jQuery('form.checkout input').on('change', updateTabbyCheckout); 3 jQuery(document.body).on('updated_checkout', updateTabbyCheckout); 4 5 function updateTabbyCheckout() { 6 if (!window.tabbyRenderer) window.tabbyRenderer = new TabbyRenderer(); 7 tabbyRenderer.update(); 8 } 9 9 10 10 updateTabbyCheckout(); 11 11 }); 12 12 class TabbyRenderer { 13 constructor () { 14 this.payment = null; 15 this.email = null; 16 this.phone = null; 17 this.lastMethod = null; 18 this.paymentAuthorized = false; 19 this.methods = { 20 creditCardInstallments: 'credit_card_installments', 21 installments: 'installments', 22 payLater: 'pay_later' 23 }; 24 this.products = []; 25 this.product = null; 13 constructor () { 14 this.payment = null; 15 this.email = null; 16 this.phone = null; 17 this.lastMethod = null; 18 this.methods = { 19 creditCardInstallments: 'credit_card_installments', 20 installments: 'installments', 21 payLater: 'pay_later' 22 }; 23 this.products = []; 24 this.product = null; 26 25 this.formFilled = false; 27 26 this.formSubmitted = false; 28 // update payment modules on phone/email change 29 jQuery( 'form.checkout' ).on( 30 'change', 31 '#billing_email, #billing_phone', 32 function () {jQuery( document.body ).trigger('update_checkout')} 33 ); 27 this.actualSession = 0; 28 // update payment modules on phone/email change 29 jQuery( 'form.checkout' ).on( 30 'change', 31 '#billing_email, #billing_phone', 32 function () {jQuery( document.body ).trigger('update_checkout')} 33 ); 34 34 // pay_for_order page 35 35 if (this.isPayForOrderPage() && jQuery('#order_review').length) { 36 36 jQuery('#order_review').submit(function (e) { 37 //e.preventDefault();38 37 tabbyRenderer.updatePaymentIdField(); 39 /*40 jQuery.ajax({41 type: 'POST',42 data: jQuery('#order_review').serialize(),43 success: function () {44 tabbyRenderer.launch();45 }46 });47 */48 38 }); 49 39 } 50 jQuery( document.body ).bind( 'payment_method_selected', this.updatePlaceOrderButton );40 jQuery( document.body ).bind( 'payment_method_selected', this.updatePlaceOrderButton ); 51 41 for (var i in this.methods) { 52 42 jQuery( 'form.checkout' ).bind( 'checkout_place_order_tabby_' + this.methods[i], this.updatePaymentIdField.bind(this)); 53 43 } 54 this.style = document.createElement('style');55 this.style.type = 'text/css';56 this.adjustStyleSheet();44 this.style = document.createElement('style'); 45 this.style.type = 'text/css'; 46 this.adjustStyleSheet(); 57 47 setTimeout(function () { 58 tabbyRenderer.updatePlaceOrderButton();48 tabbyRenderer.updatePlaceOrderButton(); 59 49 }, 300); 60 document.getElementsByTagName('head')[0].appendChild(this.style);50 document.getElementsByTagName('head')[0].appendChild(this.style); 61 51 62 52 // setup ajax to intercept ajaxSuccess callback for checkout url 63 53 this.setupAjax(); 64 54 this.forceRedirect = false; 65 }55 } 66 56 getFieldEmail() { 67 return this.getFieldValue('email');57 return this.getFieldValue('email'); 68 58 } 69 59 getFieldPhone() { 70 return this.getFieldValue('phone');60 return this.getFieldValue('phone'); 71 61 } 72 62 getFieldFirstName() { … … 77 67 } 78 68 getFieldValue(name) { 69 // wp sms support 70 if (name == 'phone' && jQuery('#wp-sms-input-mobile').length) { 71 return jQuery('#wp-sms-input-mobile'); 72 } 73 79 74 var field = jQuery('#billing_' + name); 80 75 … … 84 79 } 85 80 } 81 86 82 return field; 87 83 } … … 90 86 return this.config.localeSource && this.config.localeSource == 'html' ? document.documentElement.lang : this.config.locale; 91 87 } 92 updatePlaceOrderButton() {93 if (typeof tabbyRenderer == 'undefined') return;94 var selected = jQuery('input[name="payment_method"]:checked').val();95 96 jQuery("#place_order").attr('disabled', false);97 for (var i in tabbyRenderer.methods) {98 if (selected == ('tabby_' + tabbyRenderer.methods[i])) tabbyRenderer.product = i;88 updatePlaceOrderButton() { 89 if (typeof tabbyRenderer == 'undefined') return; 90 var selected = jQuery('input[name="payment_method"]:checked').val(); 91 92 jQuery("#place_order").attr('disabled', false); 93 for (var i in tabbyRenderer.methods) { 94 if (selected == ('tabby_' + tabbyRenderer.methods[i])) tabbyRenderer.product = i; 99 95 // remove error 100 96 jQuery(".payment_box.payment_method_tabby_" + tabbyRenderer.methods[i] + ' > .woocommerce-error').remove(); 101 97 jQuery('.payment_box.payment_method_tabby_' + tabbyRenderer.methods[i] + ' > #tabbyCard, .payment_box.payment_method_tabby_' + tabbyRenderer.methods[i] + ' > .tabbyDesc').css('display', 'block'); 102 if ((selected == 'tabby_' + tabbyRenderer.methods[i]) && !tabbyRenderer.products.hasOwnProperty(i)) {98 if ((selected == 'tabby_' + tabbyRenderer.methods[i]) && !tabbyRenderer.products.hasOwnProperty(i)) { 103 99 jQuery("#place_order").attr('disabled', 'disabled'); 104 100 if (tabbyConfig && tabbyRenderer.formFilled) { … … 109 105 } 110 106 } 111 }112 }113 update() {107 } 108 } 109 update() { 114 110 // check payment methods form 115 111 jQuery("input[name=\"payment_method\"]").each (function () { … … 123 119 } 124 120 }); 125 this.config = window.tabbyConfig;121 this.config = window.tabbyConfig; 126 122 this.adjustStyleSheet(); 127 if (!this.canUpdate()) return;128 var payment = this.buildPayment();129 if (tabbyRenderer.config.debug) console.log(payment);130 if ((JSON.stringify(payment) == this.paymentJSON) && (this.oldMerchantCode == this.config.merchantCode)) {123 if (!this.canUpdate()) return; 124 var payment = this.buildPayment(); 125 if (tabbyRenderer.config.debug) console.log(payment); 126 if ((JSON.stringify(payment) == this.paymentJSON) && (this.oldMerchantCode == this.config.merchantCode)) { 131 127 // set form field values (because payment methods can be updated) 132 128 this.setPaymentIdForm(); 133 129 return; 134 130 } 135 this.paymentJSON = JSON.stringify(payment); 131 this.payment = payment; 132 this.paymentJSON = JSON.stringify(payment); 136 133 this.oldMerchantCode = this.config.merchantCode; 137 // do tabby logic 138 var tabbyConfig = { 139 apiKey: this.config.apiKey 140 }; 141 this.payment = payment; 142 tabbyConfig.payment = payment; 143 tabbyConfig.merchantCode = this.config.merchantCode; 144 tabbyConfig.lang = this.getLocale(); 145 tabbyConfig.merchantUrls = this.config.merchantUrls; 146 tabbyRenderer.products = []; 147 tabbyConfig.onChange = data => { 148 if (tabbyRenderer.config.debug) console.log(data); 149 tabbyRenderer.formFilled = true; 150 switch (data.status) { 151 case 'created': 152 tabbyRenderer.products = data.products; 153 // update payment id field 154 tabbyRenderer.setPaymentId(data.payment.id); 155 tabbyRenderer.ddLog('payment created', {payment:{id:data.payment.id}}); 156 this.formSubmitted = false; 157 158 tabbyRenderer.enableButton(); 159 160 if (tabbyRenderer.relaunchTabby) { 161 tabbyRenderer.relaunchTabby = false; 162 tabbyRenderer.launch(); 163 } 164 break; 165 case 'authorized': 166 case 'approved': 167 // update payment id field 168 tabbyRenderer.setPaymentId(data.payment.id); 169 tabbyRenderer.ddLog('payment approved', {payment:{id:data.payment.id}}); 170 171 if (data.payment.status == 'authorized' || data.payment.status == 'AUTHORIZED') { 172 tabbyRenderer.paymentAuthorized = true; 173 tabbyRenderer.placeTabbyOrder(); 174 } 175 176 setTimeout(function () { 177 Tabby.destroy(); // close popup 178 }, 2000); 179 break; 180 case 'rejected': 181 tabbyRenderer.ddLog('payment rejected', {payment:{id:data.payment.id}}); 182 tabbyRenderer.products = []; 183 // update payment id field 184 tabbyRenderer.setPaymentId(null); 185 tabbyRenderer.disableButton(); 186 break; 187 default: 188 break; 189 } 190 }; 191 tabbyConfig.onClose = () => { 192 //tabbyRenderer.relaunchTabby = true; 193 // remove form blocking 194 tabbyRenderer.unblockForm(); 195 jQuery( window ).unbind('beforeunload'); 196 197 tabbyRenderer.products = []; 198 tabbyRenderer.create(); 199 }; 200 201 if (tabbyRenderer.config.debug) console.log(tabbyConfig); 202 Tabby.init(tabbyConfig); 203 this.create(); 204 tabbyRenderer.relaunchTabby = false; 205 } 134 this.create(); 135 tabbyRenderer.relaunchTabby = false; 136 } 206 137 ddLog(msg, data) { 207 138 if (typeof ddLog !== 'undefined') { … … 239 170 return false; 240 171 } 241 create() {172 create() { 242 173 tabbyRenderer.formFilled = false; 243 this.disableButton();174 this.disableButton(); 244 175 this.setPaymentId(null); 245 Tabby.create(); 246 const checkout = document.querySelector('#tabby-checkout'); 247 if (checkout) checkout.style.display = 'none'; 248 } 249 scroll_to_notices() { 250 var scrollElement = jQuery( 'form.checkout' ); 251 jQuery.scroll_to_notices( scrollElement ); 252 } 253 launch() { 176 // create session configuration 177 var tabbyConfig = { 178 apiKey: this.config.apiKey 179 }; 180 tabbyConfig.payment = this.payment; 181 tabbyConfig.merchantCode = this.config.merchantCode; 182 tabbyConfig.lang = this.getLocale(); 183 tabbyConfig.merchantUrls = this.config.merchantUrls; 184 // clean available products 185 tabbyRenderer.products = []; 186 if (tabbyRenderer.config.debug) console.log(tabbyConfig); 187 var sessNum = ++this.actualSession; 188 window.TabbyCmsPlugins.createSession(tabbyConfig).then( (sess) => { 189 tabbyRenderer.formSubmitted = false; 190 tabbyRenderer.formFilled = true; 191 // do nothing 192 if (tabbyRenderer.actualSession > sessNum) { 193 if (tabbyRenderer.config.debug) console.log("ignore old response"); 194 return; 195 } 196 // create session error 197 if (!sess.hasOwnProperty('status') || sess.status != 'created') { 198 if (tabbyRenderer.config.debug) console.log('create session error'); 199 200 tabbyRenderer.disableButton(); 201 return; 202 } 203 // update currently available products 204 tabbyRenderer.products = sess.availableProducts; 205 // update payment id field 206 tabbyRenderer.setPaymentId(sess.payment.id); 207 tabbyRenderer.ddLog('payment created', {payment:{id:sess.payment.id}}); 208 209 tabbyRenderer.enableButton(); 210 211 if (tabbyRenderer.relaunchTabby) { 212 tabbyRenderer.relaunchTabby = false; 213 tabbyRenderer.launch(); 214 } 215 }); 216 } 217 launch() { 254 218 255 219 if (!tabbyRenderer.formSubmitted) { … … 260 224 return false; 261 225 } 262 var product = tabbyRenderer.product;263 if (tabbyRenderer.config.debug) console.log('launch with product', tabbyRenderer.product);264 265 if (tabbyRenderer.relaunchTabby) {266 tabbyRenderer.create();267 } else {226 var product = tabbyRenderer.product; 227 if (tabbyRenderer.config.debug) console.log('launch with product', tabbyRenderer.product); 228 229 if (tabbyRenderer.relaunchTabby) { 230 tabbyRenderer.create(); 231 } else { 268 232 // remove form blocking 269 233 tabbyRenderer.unblockForm(); … … 271 235 272 236 document.location.href = tabbyRenderer.products[product][0].webUrl; 273 }274 275 return false;276 }277 adjustStyleSheet() {237 } 238 239 return false; 240 } 241 adjustStyleSheet() { 278 242 if (this.config && this.config.hideMethods) { 279 this.style.innerHTML = ''; 280 for (var i in this.methods) { 281 if (this.products.hasOwnProperty(i)) { 282 //this.style.innerHTML += '.payment_method_tabby_' + this.methods[i] + '{visibility:visible;}\n'; 283 this.style.innerHTML += '.payment_method_tabby_' + this.methods[i] + '{display:block;}\n'; 284 } else { 243 this.style.innerHTML = ''; 244 for (var i in this.methods) { 245 if (this.products.hasOwnProperty(i)) { 246 this.style.innerHTML += '.payment_method_tabby_' + this.methods[i] + '{display:block;}\n'; 247 } else { 285 248 if (tabbyConfig && tabbyRenderer.formFilled) { 286 this.style.innerHTML += '.payment_method_tabby_' + this.methods[i] + '{display:none;}\n';249 this.style.innerHTML += '.payment_method_tabby_' + this.methods[i] + '{display:none;}\n'; 287 250 } 288 }289 }290 } 291 this.updatePlaceOrderButton();292 }293 enableButton() {294 this.adjustStyleSheet();295 }296 disableButton() {297 this.adjustStyleSheet();298 }299 canUpdate() {251 } 252 } 253 } 254 this.updatePlaceOrderButton(); 255 } 256 enableButton() { 257 this.adjustStyleSheet(); 258 } 259 disableButton() { 260 this.adjustStyleSheet(); 261 } 262 canUpdate() { 300 263 if (!this.isPayForOrderPage()) { 301 if (!this.getFieldFirstName().val()) return false;302 if (!this.getFieldEmail().val() || !this.getFieldPhone().val()) return false;264 if (!this.getFieldFirstName().val()) return false; 265 if (!this.getFieldEmail().val() || !this.getFieldPhone().val()) return false; 303 266 }; 304 if (!window.tabbyConfig) return false;305 // reload order history if needed306 if (!this.loadOrderHistory()) return false;307 return true;308 }309 loadOrderHistory() {310 if (this.getFieldEmail().val() == this.email && this.getFieldPhone().val() == this.phone) {311 return true;312 }313 if ( typeof wc_checkout_params === 'undefined' ) {314 return false;315 }316 317 var data = {318 email: this.getFieldEmail().val(),319 phone: this.getFieldPhone().val(),320 security: wc_checkout_params.get_order_history_nonce321 };322 323 tabbyRenderer.xhr = jQuery.ajax({324 type:'POST',325 url:wc_checkout_params.wc_ajax_url.toString().replace( '%%endpoint%%', 'get_order_history' ),326 data:data,327 success:function( data ) {328 tabbyRenderer.order_history = data.order_history;329 tabbyRenderer.email = data.email;330 tabbyRenderer.phone = data.phone;331 tabbyRenderer.update();332 }333 });334 335 return false;336 }337 buildPayment() {338 var payment = this.config.payment;339 payment.buyer = this.getBuyerObject();267 if (!window.tabbyConfig) return false; 268 // reload order history if needed 269 if (!this.loadOrderHistory()) return false; 270 return true; 271 } 272 loadOrderHistory() { 273 if (this.getFieldEmail().val() == this.email && this.getFieldPhone().val() == this.phone) { 274 return true; 275 } 276 if ( typeof wc_checkout_params === 'undefined' ) { 277 return false; 278 } 279 280 var data = { 281 email: this.getFieldEmail().val(), 282 phone: this.getFieldPhone().val(), 283 security: wc_checkout_params.get_order_history_nonce 284 }; 285 286 tabbyRenderer.xhr = jQuery.ajax({ 287 type: 'POST', 288 url: wc_checkout_params.wc_ajax_url.toString().replace( '%%endpoint%%', 'get_order_history' ), 289 data: data, 290 success: function( data ) { 291 tabbyRenderer.order_history = data.order_history; 292 tabbyRenderer.email = data.email; 293 tabbyRenderer.phone = data.phone; 294 tabbyRenderer.update(); 295 } 296 }); 297 298 return false; 299 } 300 buildPayment() { 301 var payment = this.config.payment; 302 payment.buyer = this.getBuyerObject(); 340 303 if (this.config.buyer_history) { 341 payment.buyer_history = this.config.buyer_history;342 } 343 payment.shipping_address = this.getShippingAddress();344 payment.order_history = this.order_history;345 return payment;346 }347 getBuyerObject() {304 payment.buyer_history = this.config.buyer_history; 305 } 306 payment.shipping_address = this.getShippingAddress(); 307 payment.order_history = this.order_history; 308 return payment; 309 } 310 getBuyerObject() { 348 311 if (this.isPayForOrderPage()) return this.config.buyer; 349 return {350 dob: null,351 email: this.getFieldEmail().val().toString(),352 name: this.getFieldFirstName().val() + (this.getFieldLastName().length ? ' ' + this.getFieldLastName().val() : ''),353 phone: this.getFieldPhone().val().toString()354 }355 }312 return { 313 dob: null, 314 email: this.getFieldEmail().val().toString(), 315 name: this.getFieldFirstName().val() + (this.getFieldLastName().length ? ' ' + this.getFieldLastName().val() : ''), 316 phone: this.getFieldPhone().val().toString() 317 } 318 } 356 319 isPayForOrderPage() { 357 320 return jQuery('input[name=woocommerce_pay]').length && (jQuery('input[name=woocommerce_pay]').val() == 1); 358 321 } 359 getShippingAddress() {322 getShippingAddress() { 360 323 if (this.isPayForOrderPage()) return this.config.shipping_address; 361 const prefix = jQuery('#ship-to-different-address-checkbox:checked').length > 0 ? 'shipping' : 'billing';362 return {363 address: this.getAddressStreet(prefix),364 city: this.getAddressCity(prefix)365 }366 }367 getAddressStreet(prefix) {368 const street1 = jQuery('#' + prefix + '_address_1');369 const street2 = jQuery('#' + prefix + '_address_2');370 371 return (street1 ? street1.val() : '') + (street2 && street2.val() ? ', ' + street2.val() : '');372 }373 getAddressCity(prefix) {374 const city = jQuery('#' + prefix + '_city');375 return city ? city.val() : null;376 }377 placeTabbyOrder() {378 // assign payment id to related input324 const prefix = jQuery('#ship-to-different-address-checkbox:checked').length > 0 ? 'shipping' : 'billing'; 325 return { 326 address: this.getAddressStreet(prefix), 327 city: this.getAddressCity(prefix) 328 } 329 } 330 getAddressStreet(prefix) { 331 const street1 = jQuery('#' + prefix + '_address_1'); 332 const street2 = jQuery('#' + prefix + '_address_2'); 333 334 return (street1 ? street1.val() : '') + (street2 && street2.val() ? ', ' + street2.val() : ''); 335 } 336 getAddressCity(prefix) { 337 const city = jQuery('#' + prefix + '_city'); 338 return city ? city.val() : null; 339 } 340 placeTabbyOrder() { 341 // assign payment id to related input 379 342 this.setPaymentIdForm(); 380 jQuery('#place_order').trigger('click');343 jQuery('#place_order').trigger('click'); 381 344 this.forceRedirect = true; 382 }345 } 383 346 setupAjax() { 384 347 // creates a new callback function -
tabby-checkout/trunk/readme.txt
r2828572 r2886423 3 3 Tags: tabby, tabby plugin, tabby checkout, bnpl, tabby bnpl 4 4 Requires at least: 5.7 5 Tested up to: 6. 16 Stable tag: 4. 1.35 Tested up to: 6.2 6 Stable tag: 4.3.1 7 7 Requires PHP: 7.0 8 8 License: GPLv3 … … 28 28 29 29 == Changelog == 30 31 = 4.3.1 = 32 33 * readme.txt file changes 34 35 = 4.3.0 = 36 37 * Qatar support added 38 39 = 4.2.0 = 40 41 * Checkout script load optimization 42 43 = 4.1.5 = 44 45 * Tabby Promo additional configuration option 46 47 = 4.1.4 = 48 49 * WP SMS Pro support added 30 50 31 51 = 4.1.3 = … … 128 148 129 149 Tabby billing plan for checkout payment methods description: 130 https://checkout.tabby.ai/tabby-card.js 131 https://checkout.tabby.ai/tabby-payment-method-snippet-cci.js 150 https://checkout.tabby.ai/cms-plugins.js 132 151 133 152 -
tabby-checkout/trunk/tabby-checkout.php
r2828572 r2886423 4 4 * Plugin URI: https://tabby.ai/ 5 5 * Description: Tabby Checkout 6 * Version: 4. 1.36 * Version: 4.3.1 7 7 * Author: Tabby 8 8 * Author URI: https://tabby.ai … … 16 16 defined( 'ABSPATH' ) || exit; 17 17 18 define ('MODULE_TABBY_CHECKOUT_VERSION', '4. 1.3');18 define ('MODULE_TABBY_CHECKOUT_VERSION', '4.3.1'); 19 19 define ('TABBY_CHECKOUT_DOMAIN', 'checkout.tabby.ai'); 20 20 define ('TABBY_CHECKOUT_API_DOMAIN', 'api.tabby.ai');
Note: See TracChangeset
for help on using the changeset viewer.