1jQuery(($)=>{'use strict';window.MWCPaymentsPoyntPaymentFormHandler=class MWCPaymentsPoyntPaymentFormHandler{constructor(args){this.appId=args.appId;this.businessId=args.businessId;this.customerAddress=args.customerAddress;this.shippingAddress=args.shippingAddress;this.isLoggingEnabled=args.isLoggingEnabled;this.options=args.options;this.formInitialized=!1;if(!$('#mwc-payments-poynt-hosted-form').length){return} 2if($('form.checkout').length){this.form=$('form.checkout');this.handleCheckout()}else if($('form#order_review').length){this.form=$('form#order_review');this.handlePayPage()}else if($('form#add_payment_method').length){this.form=$('form#add_payment_method');this.handleMyAccount()}else{this.debugLog('No payment form available');return} 3$(document.body).on('checkout_error',()=>{this.clearNonce()})} 4getNonceField(){return $('#mwc-payments-poynt-payment-nonce')} 5clearNonce(){this.getNonceField().val('')} 6createNonce(){let nonceData={businessId:this.businessId};if(this.customerAddress.firstName){nonceData.firstName=this.customerAddress.firstName} 7if(this.customerAddress.lastName){nonceData.lastName=this.customerAddress.lastName} 8if(this.customerAddress.line1){nonceData.line1=this.customerAddress.line1} 9if(this.customerAddress.line2){nonceData.line2=this.customerAddress.line2} 10if(this.customerAddress.city){nonceData.city=this.customerAddress.city} 11if(this.customerAddress.state){nonceData.territory=this.customerAddress.state} 12if(this.customerAddress.country){nonceData.countryCode=this.customerAddress.country} 13if(this.customerAddress.postcode){nonceData.zip=this.customerAddress.postcode} 14if(this.customerAddress.phone){nonceData.phone=this.customerAddress.phone} 15if(this.customerAddress.email){nonceData.emailAddress=this.customerAddress.email} 16if(this.shippingAddress.line1){nonceData.shippingLine1=this.shippingAddress.line1} 17if(this.shippingAddress.line2){nonceData.shippingLine2=this.shippingAddress.line2} 18if(this.shippingAddress.city){nonceData.shippingCity=this.shippingAddress.city} 19if(this.shippingAddress.state){nonceData.shippingTerritory=this.shippingAddress.state} 20if(this.shippingAddress.postcode){nonceData.shippingZip=this.shippingAddress.postcode} 21this.debugLog(nonceData);this.collect.getNonce(nonceData)} 22handleCheckout(){$(document.body).on('updated_checkout',()=>this.setFields());$(document.body).on('updated_checkout',()=>this.handleSavedPaymentMethods());this.form.on('checkout_place_order_poynt',()=>this.validatePaymentData())} 23hasNonce(){return this.getNonceField().val().length>0} 24handleMyAccount(){this.setFields();this.form.submit(()=>{if($('#add_payment_method input[name=payment_method]:checked').val()==='poynt'){return this.validatePaymentData()}})} 25handleError(event){this.debugLog(event);if('error'!==event?.type){return} 26let errorMessage=poyntPaymentFormI18n.errorMessages.genericError;if(event.data?.error){if('submit'!==event.data.error?.source){return} 27if(event.data.error.message&&['invalid_details','missing_fields'].includes(event.data.error.type)){errorMessage=event.data.error.message}} 28this.renderErrors([errorMessage])} 29handlePayPage(){this.setFields();this.handleSavedPaymentMethods();this.form.submit(()=>{if($('#order_review input[name=payment_method]:checked').val()==='poynt'){return this.validatePaymentData()}})} 30handlePaymentFormReady(event){if(!event.type||'ready'!==event.type){this.debugLog(event)}else{this.debugLog('Payment form ready')} 31this.form.unblock()} 32handleNonceReady(payload){if(payload.data&&payload.data.nonce){this.getNonceField().val(payload.data.nonce);this.debugLog('Nonce set')}else{this.clearNonce();this.debugLog('Nonce value is empty')} 33this.form.submit()} 34handleSavedPaymentMethods(){let $newMethodForm=$('.mwc-payments-poynt-new-payment-method-form');$('input.mwc-payments-poynt-payment-method').change(()=>{if($("input.mwc-payments-poynt-payment-method:checked").val()){$newMethodForm.slideUp(200)}else{$newMethodForm.slideDown(200)}}).change();$('input#createaccount').change(function(){let $parentRow=$('input.mwc-payments-tokenize-payment-method').closest('p.form-row');if($(this).is(':checked')){$parentRow.slideDown();$parentRow.next().show()}else{$parentRow.hide();$parentRow.next().hide()}});if(!$('input#createaccount').is(':checked')){$('input#createaccount').change()}} 35initForm(){if(this.initializingForm){return} 36this.initializingForm=!0;this.collect=new TokenizeJs(this.businessId,this.appId);this.collect.mount('mwc-payments-poynt-hosted-form',document,this.options);this.collect.on('nonce',payload=>{this.handleNonceReady(payload)});this.collect.on('ready',event=>{this.initializingForm=!1;this.formInitialized=!0;this.handlePaymentFormReady(event)});this.collect.on('error',error=>{this.handleError(error)})} 37setFields(){this.fields=$('.payment_method_poynt');
37if(this.formInitialized){this.collect.unmount('mwc-payments-poynt-hosted-form',document);this.formInitialized=!1} 38if(this.businessId&&this.appId&&!this.initializingForm){this.initForm()}} 39validatePaymentData(){if(this.form.is('.processing')){return!1} 40if(this.fields.find('input.mwc-payments-poynt-payment-method:checked').val()||this.hasNonce()){return!0} 41if($('#billing_first_name').val()){this.customerAddress.firstName=$('#billing_first_name').val()} 42if($('#billing_last_name').val()){this.customerAddress.lastName=$('#billing_last_name').val()} 43if($('#billing_phone').val()){this.customerAddress.phone=$('#billing_phone').val()} 44if($('#billing_email').val()){this.customerAddress.email=$('#billing_email').val()} 45if($('#billing_address_1').val()){this.customerAddress.line1=$('#billing_address_1').val()} 46if($('#billing_address_2').val()){this.customerAddress.line2=$('#billing_address_2').val()} 47if($('#billing_city').val()){this.customerAddress.city=$('#billing_city').val()} 48if($('#billing_state').val()){this.customerAddress.state=$('#billing_state').val()} 49if($('#billing_country').val()){this.customerAddress.country=$('#billing_country').val()} 50if($('#billing_postcode').val()){this.customerAddress.postcode=$('#billing_postcode').val()} 51let shipToDifferentAddress=$('#ship-to-different-address-checkbox').is(':checked');let shippingLine1=this.shippingAddress.needsShipping?(shipToDifferentAddress?$('#shipping_address_1').val():this.customerAddress.line1):'';let shippingLine2=this.shippingAddress.needsShipping?(shipToDifferentAddress?$('#shipping_address_2').val():this.customerAddress.line2):'';let shippingCity=this.shippingAddress.needsShipping?(shipToDifferentAddress?$('#shipping_city').val():this.customerAddress.city):'';let shippingState=this.shippingAddress.needsShipping?(shipToDifferentAddress?$('#shipping_state').val():this.customerAddress.state):'';let shippingPostcode=this.shippingAddress.needsShipping?(shipToDifferentAddress?$('#shipping_postcode').val():this.customerAddress.postcode):'';if(shippingLine1&&shippingLine1.length>0){this.shippingAddress.line1=shippingLine1} 52if(shippingLine2&&shippingLine2.length>0){this.shippingAddress.line2=shippingLine2} 53if(shippingCity&&shippingCity.length>0){this.shippingAddress.city=shippingCity} 54if(shippingState&&shippingState.length>0){this.shippingAddress.state=shippingState} 55if(shippingPostcode&&shippingPostcode.length>0){this.shippingAddress.postcode=shippingPostcode} 56this.form.block({message:null,overlayCSS:{background:'#fff',opacity:0.6}});this.createNonce();return!1} 57debugLog(logData){if(this.isLoggingEnabled){console.log(logData)}} 58renderErrors(errors){$('.woocommerce-error, .woocommerce-message').remove();this.form.prepend('<ul class="woocommerce-error"><li>'+errors.join('</li><li>')+'</li></ul>');this.form.removeClass('processing').unblock();this.form.find('.input-text, select').blur();$('html, body').animate({scrollTop:this.form.offset().top-100},1000)}} 59$(document.body).trigger('mwc_payments_poynt_payment_form_handler_loaded')})
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.