PageSourceSearch

https://epiclinic.com.au/wp-content/plugins/zipmoney-payments-wooc…ommerce-zipmoney-payment-front.js?ver=2.0.4

js epiclinic.com.au collected 2026-10-01 10:23:58 UTC 6,696 bytes, 261 lines download raw bytes

1(function(window,$,undefined){
2	"use strict";
3
4	var iframeCheckout = function(vUrl, vType,form, vErrorMessage) {
5		this.vUrl          = vUrl;
6		this.vType         = vType;
7		this.vErrorMessage = vErrorMessage;
8		this.form          = form
9	};
10
11	iframeCheckout.prototype = {
12		standardRedirectToCheckout : function(){
13
14			var $form = $( 'form.checkout' );
15			var self  = this;
16
17			if ( $form.is( '.processing' ) ) {
18				return false;
19			}
20			self.submit_error()
21
22			var paymentMethod = $( '#order_review' ).find( 'input[name="payment_method"]:checked' ).val();
23
24			// Trigger a handler to let gateways manipulate the checkout if needed
25			if ( $form.triggerHandler( 'checkout_place_order' ) !== false && $form.triggerHandler( 'checkout_place_order_' + paymentMethod ) !== false ) {
26
27				$form.addClass( 'processing' );
28
29				var formData = $form.data();
30
31				if ( 1 !== formData['blockUI.isBlocked'] ) {
32					$form.block(
33						{
34							message: null,
35							overlayCSS: {
36								background: "#fff",
37								opacity: 0.6
38							}
39						}
40					);
41				}
42
43				// ajaxSetup is global, but we use it to ensure JSON is valid once returned.
44				$.ajaxSetup(
45					{
46						dataFilter: function( rawResponse, dataType ) {
47							// We only want to work with JSON
48							if ( 'json' !== dataType ) {
49								return rawResponse;
50							}
51
52							try {
53								// check for valid JSON
54								var data = $.parseJSON( rawResponse );
55
56								if ( data && 'object' === typeof data ) {
57
58									// Valid - return it so it can be parsed by Ajax handler
59									return rawResponse;
60								}
61
62							} catch ( e ) {
63
64								// attempt to fix the malformed JSON
65								var valid_json = rawResponse.match( /{"result.*"}/ );
66
67								if ( null === valid_json ) {
68									console.log( "Unable to fix malformed JSON" );
69								} else {
70									console.log( "Fixed malformed JSON. Original:" );
71									console.log( rawResponse );
72									rawResponse = valid_json[0];
73								}
74							}
75
76							return rawResponse;
77						}
78					}
79				);
80
81				this.redirectToCheckout();
82			}
83
84		},
85		redirectToCheckout: function () {
86			var vUrl          = this.vUrl;
87			var vType         = this.vType;
88			var vErrorMessage = this.vErrorMessage;
89			var data          = {};
90			var method        = 'GET';
91			var self          = this;
92
93			if (this.form) {
94				method = 'POST';
95				data   = this.form.serialize();
96			}
97
98			this.showRedirectingText();
99
100			$.ajax(
101				{
102					type : method,
103					dataType : "json",
104					data:   data,
105					url: vUrl,
106					success: function(response) {
107						self.resetRedirectButtonText();
108						var vRedirectUrl = "";
109						try {
110							if ( response.result === 'success' ) {
111								if ( -1 === response.redirect.indexOf( 'https://' ) || -1 === response.redirect.indexOf( 'http://' ) ) {
112									vRedirectUrl = response.redirect;        // example: http://app.dev1.zipmoney.com.au/#/cart/10002/91179
113								} else {
114									vRedirectUrl = response.redirect;        // example: http://app.dev1.zipmoney.com.au/#/cart/10002/91179
115								}
116								if (typeof(zipMoney) != 'undefined') {
117
118									zipMoney.checkout( vRedirectUrl );    // call zipMoney iframe library.
119									$( ".zipmoney-overlay img:first" ).on(
120										"click",
121										function(){
122											self.form.removeClass( "processing" );
123										}
124									);
125
126									window.scroll( 0, 0 );
127									self.form.unblock();
128								}
129
130							} else if ( response.result === 'failure' ) {
131								throw 'Result failure';
132							} else {
133								throw 'Invalid response';
134							}
135						} catch ( err ) {
136							// Reload page
137
138							console.log( err );
139							if ( response.reload === 'true' ) {
140								window.location.reload();
141								return;
142							}
143
144							// Trigger update in case we need a fresh nonce
145							if ( response.refresh === 'true' ) {
146								$( document.body ).trigger( 'update_checkout' );
147							}
148
149							// Add new errors
150							if ( response.messages ) {
151								self.submit_error( response.messages );
152							} else {
153								self.submit_error( '<div class="woocommerce-error">Error processing checkout. Please try again.</div>' );
154							}
155						}
156
157					},
158					error:  function( jqXHR, textStatus, errorThrown ) {
159						self.submit_error( '<div class="woocommerce-error">' + errorThrown + '</div>' );
160					}
161				}
162			);
163		},
164		submit_error: function( error_message ) {
165			$( '.woocommerce-error, .woocommerce-message' ).remove();
166			if (this.form) {
167				this.form.prepend( error_message );
168				this.form.removeClass( 'processing' ).unblock();
169				this.form.find( '.input-text, select' ).blur();
170
171				$( 'html, body' ).animate(
172					{
173						scrollTop: ( this.form.offset().top - 100 )
174					},
175					1000
176				);
177			}
178
179			$( document.body ).trigger( 'checkout_error' );
180		},
181		showRedirectingText: function(){
182			this.toggleButton( false );
183		},
184		resetButton: function(vType) {
185			if (vType === 'pdp') {
186				this.toggleExpressButton( true );
187			} else if (vType === 'cart') {
188				this.resetRedirectButtonText();
189			}
190		},
191		toggleExpressButton: function($bShowButton){
192			if ($bShowButton) {
193				$$( '.zip-express-btn' ).each(
194					function (oEle) {
195						if (oEle == undefined) {
196							return true;
197						}
198						oEle.show();
199					}
200				);
201				$$( '.wait-for-redirecting-to-zip' ).each(
202					function (oEle) {
203						if (oEle == undefined) {
204							return true;
205						}
206						oEle.hide();
207					}
208				);
209			} else {
210				$$( '.zip-express-btn' ).each(
211					function (oEle) {
212						if (oEle == undefined) {
213							return true;
214						}
215						oEle.hide();
216					}
217				);
218				$$( '.wait-for-redirecting-to-zip' ).each(
219					function (oEle) {
220						if (oEle == undefined) {
221							return true;
222						}
223						oEle.show();
224					}
225				);
226			}
227		},
228		toggleButton: function($bShowButton) {
229			var cartButton     = $( '#checkout_express_cart' );
230			var checkoutButton = $( '#place_order' );
231			var waitingImg     = $( '.please-wait' );
232			if ($bShowButton) {
233				if (cartButton) {
234					cartButton.show();
235				}
236				if (checkoutButton) {
237					checkoutButton.show();
238				}
239				if (waitingImg) {
240					waitingImg.hide();
241				}
242			} else {
243				if (cartButton) {
244					cartButton.hide();
245				}
246				if (checkoutButton) {
247					checkoutButton.hide();
248				}
249				if (waitingImg) {
250					waitingImg.show();
251				}
252			}
253		},
254		resetRedirectButtonText:function(){
255			this.toggleButton( true );
256		}
257
258	};
259
260	window.iframeCheckout = iframeCheckout;
261})( window,window.jQuery );

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.