taply - Version 1.1.4

Version Notes

change domain
change design

Download this release

Release Info

Developer taply
Extension taply
Version 1.1.4
Comparing to
See all releases


Code changes from version 1.1.3 to 1.1.4

app/code/local/Taply/Paybutton/controllers/.GetshippingController.php.swp DELETED
Binary file
app/design/frontend/base/default/layout/taply.xml CHANGED
@@ -6,7 +6,7 @@
6
  </block>
7
  </reference>
8
  <reference name="head">
9
- <action method="addItem"><type>js</type><name>taply/taply.1.1.js</name></action>
10
  </reference>
11
  </checkout_cart_index>
12
- </layout>
6
  </block>
7
  </reference>
8
  <reference name="head">
9
+ <action method="addItem"><type>js</type><name>taply/taply.1.2.js</name></action>
10
  </reference>
11
  </checkout_cart_index>
12
+ </layout>
app/design/frontend/base/default/template/taply/button.phtml CHANGED
@@ -6,7 +6,7 @@ $arrCart = $this->getCartArray();
6
 
7
  <?php if(isset($this->config['view_type']) && $this->config['view_type'] == 'block'): ?>
8
  <div class="module pay-module taply-block" data-type="cart" data-view-type="block" data-cart="<?php echo htmlspecialchars(json_encode($arrCart), ENT_QUOTES, 'UTF-8'); ?>">
9
- <h4>Have Apply Pay?</h4>
10
  <div class="field opt note"></div>
11
  <div class="field text">
12
  <label class="scr-only" for="phone">Phone number</label>
@@ -21,8 +21,8 @@ $arrCart = $this->getCartArray();
21
  </div>
22
  <?php else : ?>
23
  <div class="module pay-module taply-block" data-type="cart" data-cart="<?php echo htmlspecialchars(json_encode($arrCart), ENT_QUOTES, 'UTF-8'); ?>">
24
- <h4>Have Apply Pay?</h4>
25
  <a class="taply-apply-pay taply-btn" href="/">Pay by taply using Apple Pay</a>
26
  <p>Use the <a href="https://www.paybytaply.com/app">mobile app</a> to pay</p>
27
  </div>
28
- <?php endif; ?>
6
 
7
  <?php if(isset($this->config['view_type']) && $this->config['view_type'] == 'block'): ?>
8
  <div class="module pay-module taply-block" data-type="cart" data-view-type="block" data-cart="<?php echo htmlspecialchars(json_encode($arrCart), ENT_QUOTES, 'UTF-8'); ?>">
9
+ <h4>Have Apple Pay?</h4>
10
  <div class="field opt note"></div>
11
  <div class="field text">
12
  <label class="scr-only" for="phone">Phone number</label>
21
  </div>
22
  <?php else : ?>
23
  <div class="module pay-module taply-block" data-type="cart" data-cart="<?php echo htmlspecialchars(json_encode($arrCart), ENT_QUOTES, 'UTF-8'); ?>">
24
+ <h4>Have Apple Pay?</h4>
25
  <a class="taply-apply-pay taply-btn" href="/">Pay by taply using Apple Pay</a>
26
  <p>Use the <a href="https://www.paybytaply.com/app">mobile app</a> to pay</p>
27
  </div>
28
+ <?php endif; ?>
js/taply/taply.1.2.js ADDED
@@ -0,0 +1,475 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function(w,d) {
2
+ function transitionSelect() {
3
+ var el = d.createElement("div");
4
+ if (el.style.WebkitTransition) return "webkitTransitionEnd";
5
+ if (el.style.OTransition) return "oTransitionEnd";
6
+ return 'transitionend';
7
+ };
8
+
9
+ w.TaplyDlg = {
10
+ options: {
11
+ dialogContent: '<form action="javascript:void(0)"><div class="dialog-header"><div><h4 class="modal-title taply-title">taply</h4></div></div><div class="dialog-body"><div><p>You\'ll need an iPhone 6 or above to use Apple Pay. If you have one, enter your mobile number below.</p><div class="input-field text-field "><input class="phone" name="phone" type="tel" value=""/></div><div class="input-field checkbox-field"><label for="save-mobile-number"><input class="save-phone" type="checkbox" id="save-mobile-number" value="save-mobile-number"/>&nbsp;Save mobile phone number</label></div></div></div><div class="dialog-footer"><div><button class="taply-btn-pay">Pay</button></div></div></form>',
12
+ autoOpen: false,
13
+ className: 'taply-dialog',
14
+ closeBtn: true,
15
+ content: "",
16
+ maxWidth: 380,
17
+ minWidth: 290,
18
+ overlay: true
19
+ },
20
+ savedPhone: '',
21
+ initialized: false,
22
+ modal: null,
23
+ overlay: null,
24
+ closeBtn: null,
25
+ transitionEnd: transitionSelect(),
26
+ init: function(){
27
+ if(w.TaplyDlg.phone) return;
28
+ var t = w.TaplyDlg,dF = d.createDocumentFragment(),cH;
29
+ if(t.overlay && t.overlay.parentNode) t.overlay.parentNode.removeChild(t.overlay);
30
+ if(t.modal && t.modal.parentNode) t.modal.parentNode.removeChild(t.modal);
31
+
32
+ if (t.options.overlay === true) {
33
+ t.overlay = d.createElement("div");
34
+ t.overlay.className = "taply-modal-overlay " + t.options.className;
35
+ dF.appendChild(this.overlay);
36
+ }
37
+ t.modal = d.createElement("div");
38
+ t.modal.className = "taply-modal " + t.options.className;
39
+ t.modal.style.minWidth = t.options.minWidth + "px";
40
+ t.modal.style.maxWidth = t.options.maxWidth + "px";
41
+
42
+ cH = d.createElement("div");
43
+ cH.className = "taply-modal-window";
44
+ cH.innerHTML = t.options.dialogContent;
45
+ t.content = cH;
46
+ if (t.options.closeBtn === true) {
47
+ t.closeBtn = d.createElement("button");
48
+ t.closeBtn.className = "taply-modal-close close-modal";
49
+ t.closeBtn.innerHTML = "&times;";
50
+
51
+ t.modal.appendChild(cH).appendChild(t.closeBtn);
52
+
53
+ } else {
54
+ this.modal.appendChild(cH);
55
+
56
+ }
57
+
58
+ dF.appendChild(t.modal);
59
+
60
+ d.body.appendChild(dF);
61
+ var ps = t.modal.getElementsByTagName("input");
62
+ for ( var p=0;p<ps.length;p++ ){
63
+ if(ps[p].type == 'tel' || ps[p].type == 'text'){
64
+ ps[p].addEventListener('keydown', w.Taply.check.bind(t.current), false);
65
+ ps[p].module = t.current;
66
+ }
67
+ }
68
+ t.initializeEvents();
69
+
70
+ w.TaplyDlg.initialized = true;
71
+ },
72
+ send: function(){
73
+ w.Taply.send(w.TaplyDlg.current);
74
+ },
75
+ payLater: function(){
76
+ w.Taply.payLater(w.TaplyDlg.current);
77
+ w.TaplyDlg.close();
78
+ },
79
+
80
+ cancel: function(){
81
+ w.Taply.cancel(w.TaplyDlg.current);
82
+ w.TaplyDlg.close();
83
+ },
84
+ tryagain: function(){
85
+ w.TaplyDlg.open(w.TaplyDlg.current);
86
+ },
87
+ close: function() {
88
+ var t = w.TaplyDlg;
89
+ t.modal.className = t.modal.className.replace(" taply-modal-open", "");
90
+ t.overlay.className = t.overlay.className.replace(" taply-modal-overlay-open","");
91
+ },
92
+ open: function(block) {
93
+
94
+ var t = w.TaplyDlg;
95
+ t.current = block;
96
+ t.init();
97
+ t.current.phone = t.content.getElementsByClassName('phone')[0];
98
+ t.current.phone.module = block;
99
+ t.current.save_phone = t.content.getElementsByClassName('save-phone')[0];
100
+ if(w.Taply.savedPhone !== undefined && t.current.phone.value==''){
101
+ t.current.phone.value=w.Taply.format(w.Taply.savedPhone);
102
+
103
+ t.current.save_phone.checked = 1;
104
+ }
105
+ w.getComputedStyle(t.modal).height;
106
+ t.modal.className = t.modal.className + " taply-modal-open";
107
+ t.overlay.className = t.overlay.className + " taply-modal-overlay-open";
108
+ setTimeout(function(){t.current.phone.focus()}, 300);
109
+ },
110
+ initializeEvents: function(){
111
+ var t = w.TaplyDlg;
112
+ var closeBtns = d.getElementsByClassName("close-modal");
113
+ if (closeBtns) {
114
+ for(var i=0;i<closeBtns.length;i++){
115
+ closeBtns[i].addEventListener('click', t.cancel.bind(t), false);
116
+ }
117
+
118
+ }
119
+
120
+ if (this.overlay) {
121
+ this.overlay.addEventListener('click', t.close.bind(t));
122
+ }
123
+
124
+ var payBtns = t.content.getElementsByClassName("taply-btn-pay");
125
+ if(payBtns.length){
126
+ payBtns[0].addEventListener('click', t.send.bind(t), false);
127
+ }
128
+
129
+ var payLaterBtns = t.modal.getElementsByClassName("taply-btn-pay-later");
130
+ if(payLaterBtns.length){
131
+ payLaterBtns[0].addEventListener('click', t.payLater.bind(t), false);
132
+ }
133
+
134
+ var tryAgainBtns = t.content.getElementsByClassName("taply-btn-try-again");
135
+ if(tryAgainBtns.length){
136
+ tryAgainBtns[0].addEventListener('click', t.tryagain.bind(t), false);
137
+ }
138
+ },
139
+ changeContent: function(c){
140
+ var b = w.TaplyDlg.content.getElementsByClassName('dialog-body')[0],n='Unknown error', f= '';
141
+ switch(c){
142
+ case 0:
143
+ n= '<div><p>' + (w.Taply.notifyMessages[c] ? w.Taply.notifyMessages[c] : n) + '</p></div>';
144
+ f='<div><button class="taply-btn-try-again">Try again</button></div>';
145
+ break;
146
+ case 1:
147
+ n='<div><div class="loader"><svg xmlns="http://www.w3.org/2000/svg" width="75px" height="75px" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid" class="uil-ring"><rect x="0" y="0" width="100" height="100" fill="none" class="bk"/><defs><filter id="uil-ring-shadow" x="-100%" y="-100%" width="300%" height="300%"><feOffset result="offOut" in="SourceGraphic" dx="0" dy="0"/><feGaussianBlur result="blurOut" in="offOut" stdDeviation="0"/><feBlend in="SourceGraphic" in2="blurOut" mode="normal"/></filter></defs><path d="M10,50c0,0,0,0.5,0.1,1.4c0,0.5,0.1,1,0.2,1.7c0,0.3,0.1,0.7,0.1,1.1c0.1,0.4,0.1,0.8,0.2,1.2c0.2,0.8,0.3,1.8,0.5,2.8 c0.3,1,0.6,2.1,0.9,3.2c0.3,1.1,0.9,2.3,1.4,3.5c0.5,1.2,1.2,2.4,1.8,3.7c0.3,0.6,0.8,1.2,1.2,1.9c0.4,0.6,0.8,1.3,1.3,1.9 c1,1.2,1.9,2.6,3.1,3.7c2.2,2.5,5,4.7,7.9,6.7c3,2,6.5,3.4,10.1,4.6c3.6,1.1,7.5,1.5,11.2,1.6c4-0.1,7.7-0.6,11.3-1.6 c3.6-1.2,7-2.6,10-4.6c3-2,5.8-4.2,7.9-6.7c1.2-1.2,2.1-2.5,3.1-3.7c0.5-0.6,0.9-1.3,1.3-1.9c0.4-0.6,0.8-1.3,1.2-1.9 c0.6-1.3,1.3-2.5,1.8-3.7c0.5-1.2,1-2.4,1.4-3.5c0.3-1.1,0.6-2.2,0.9-3.2c0.2-1,0.4-1.9,0.5-2.8c0.1-0.4,0.1-0.8,0.2-1.2 c0-0.4,0.1-0.7,0.1-1.1c0.1-0.7,0.1-1.2,0.2-1.7C90,50.5,90,50,90,50s0,0.5,0,1.4c0,0.5,0,1,0,1.7c0,0.3,0,0.7,0,1.1 c0,0.4-0.1,0.8-0.1,1.2c-0.1,0.9-0.2,1.8-0.4,2.8c-0.2,1-0.5,2.1-0.7,3.3c-0.3,1.2-0.8,2.4-1.2,3.7c-0.2,0.7-0.5,1.3-0.8,1.9 c-0.3,0.7-0.6,1.3-0.9,2c-0.3,0.7-0.7,1.3-1.1,2c-0.4,0.7-0.7,1.4-1.2,2c-1,1.3-1.9,2.7-3.1,4c-2.2,2.7-5,5-8.1,7.1 c-0.8,0.5-1.6,1-2.4,1.5c-0.8,0.5-1.7,0.9-2.6,1.3L66,87.7l-1.4,0.5c-0.9,0.3-1.8,0.7-2.8,1c-3.8,1.1-7.9,1.7-11.8,1.8L47,90.8 c-1,0-2-0.2-3-0.3l-1.5-0.2l-0.7-0.1L41.1,90c-1-0.3-1.9-0.5-2.9-0.7c-0.9-0.3-1.9-0.7-2.8-1L34,87.7l-1.3-0.6 c-0.9-0.4-1.8-0.8-2.6-1.3c-0.8-0.5-1.6-1-2.4-1.5c-3.1-2.1-5.9-4.5-8.1-7.1c-1.2-1.2-2.1-2.7-3.1-4c-0.5-0.6-0.8-1.4-1.2-2 c-0.4-0.7-0.8-1.3-1.1-2c-0.3-0.7-0.6-1.3-0.9-2c-0.3-0.7-0.6-1.3-0.8-1.9c-0.4-1.3-0.9-2.5-1.2-3.7c-0.3-1.2-0.5-2.3-0.7-3.3 c-0.2-1-0.3-2-0.4-2.8c-0.1-0.4-0.1-0.8-0.1-1.2c0-0.4,0-0.7,0-1.1c0-0.7,0-1.2,0-1.7C10,50.5,10,50,10,50z" fill="#8045b8" filter="url(#uil-ring-shadow)" transform="rotate(112.363 50 50)"><animateTransform attributeName="transform" type="rotate" from="0 50 50" to="360 50 50" repeatCount="indefinite" dur="1s"/></path></svg></div><p>' + w.Taply.notifyMessages[c] + '</p></div>';
148
+ f='<div>' + (w.Taply.showPayLater? '<button class="taply-btn-pay-later">Pay later</button>' : '') + '<button class="close-modal">Cancel</button></div>'
149
+ break;
150
+ default :
151
+ n= '<div><p>' + (w.Taply.notifyMessages[c] ? w.Taply.notifyMessages[c] : n) + '</p></div>';
152
+ }
153
+ w.TaplyDlg.content.getElementsByClassName('dialog-footer')[0].innerHTML = f;
154
+ b.innerHTML = n;
155
+ w.TaplyDlg.initializeEvents();
156
+ }
157
+ };
158
+ w.TaplyModule = function(el,id){
159
+ var t=this;
160
+ t.id=id;
161
+ t.el = el;
162
+ t.type = el.attributes['data-type'] ? el.attributes['data-type'].value : 'item';
163
+
164
+ t.phone = null;
165
+ t.save_phone = null;
166
+ t.view_type = el.attributes['data-view-type'] ? el.attributes['data-view-type'].value : 'popup';
167
+
168
+ switch(t.view_type){
169
+ case 'block':
170
+ var ps = el.getElementsByTagName('input');
171
+ if(ps.length){
172
+ for(var p=0;p<ps.length;p++){
173
+ if(ps[p].name == 'phone'){
174
+ t.phone = t.phone === null? ps[p] : t.phone;
175
+ ps[p].addEventListener('keydown', w.Taply.check.bind(t), false);
176
+ ps[p].module = t;
177
+ }
178
+ if(ps[p].name == 'save-phone'){
179
+ t.save_phone = ps[p];
180
+ }
181
+ }
182
+ }
183
+
184
+ break;
185
+ case 'popup':
186
+ if(w.Taply.dlg_css === undefined){
187
+ w.Taply.dlg_css=document.createElement("link");
188
+ w.Taply.dlg_css.setAttribute("rel", "stylesheet");
189
+ w.Taply.dlg_css.setAttribute("type", "text/css");
190
+ w.Taply.dlg_css.setAttribute("href", "https://www.taplycheckout.com/css/taply-dialog.1.2.css?v=1.2");
191
+ d.getElementsByTagName("head")[0].appendChild(w.Taply.dlg_css);
192
+ }
193
+ break;
194
+ }
195
+ t.btn = el.getElementsByClassName('taply-btn');
196
+ if(t.btn.length){
197
+ t.btn[0].onclick = function(e){
198
+ switch(t.view_type){
199
+ case 'block':
200
+ w.Taply.send(t);
201
+ break;
202
+ case 'popup':
203
+ w.TaplyDlg.open(t);
204
+ break;
205
+ }
206
+ return false;
207
+ }
208
+ }
209
+ t.notify = function(n){
210
+ var txt = w.Taply.notifyMessages[n];
211
+ switch(t.view_type){
212
+ case 'block':
213
+ var ps = t.el.getElementsByClassName('note');
214
+ if(ps.length){
215
+ ps[0].innerHTML = '<p>' + txt + '</p>';
216
+ }
217
+ break;
218
+ case 'popup':
219
+ w.TaplyDlg.changeContent(n);
220
+ break;
221
+ }
222
+ }
223
+ };
224
+ w.Taply = {
225
+ apiurl: "https://api.taplycheckout.com/payment",
226
+ btnClass: 'taply-block',
227
+ modules: [],
228
+ mask: '(___) ___-____',
229
+ notifies:{
230
+ invalidPhone:0,
231
+ complete:1,
232
+ firstTime:2,
233
+ notInstall:3,
234
+ serverError:4,
235
+ notActivate:5
236
+ },
237
+ notifyMessages:{
238
+ '-3': "Your transaction has been refunded.",
239
+ '-2': "Your transaction has been deleted.",
240
+ '-1': "Your transaction has been canceled.",
241
+ '0' :'Please enter a valid phone number.',
242
+ '1' :'Please complete your payment on your taply mobile app.',
243
+ '2' :'Good news! Save $10 off your first taply transaction. Please download the taply app using the link texted to your mobile phone.',
244
+ '3' :'Please download the taply app using the link texted to your mobile phone.',
245
+ '4' :'Unknown error.',
246
+ '5': 'Please activate the taply app.',
247
+ '10': "Your transaction has been pending.",
248
+ '11': "Your transaction has been approved.",
249
+ '12': "Your order has been sent to your taply mobile app for checkout at a later time."
250
+ },
251
+ ls: function (url,f){
252
+ var h = d.getElementsByTagName("head")[0] || d.documentElement;
253
+ var s = d.createElement("script");
254
+ s.src = url;
255
+ s.onload = s.onreadystatechange = function(){
256
+ h.removeChild(s);
257
+ };
258
+ h.insertBefore( s, h.firstChild );
259
+
260
+ },
261
+ format: function(p){
262
+ var s='',k=0,m=w.Taply.mask;
263
+ p= p.replace(/[^\d]/g,'');
264
+ if(p.length){
265
+ for(var i=0;i<m.length;i++){
266
+ if(m[i] != '_'){
267
+ s+=m[i];
268
+ }else{
269
+ if(p[k]){
270
+ s+= p[k++];
271
+ }else{
272
+ break;
273
+ }
274
+ }
275
+ }
276
+ }
277
+ return s;
278
+ },
279
+ check: function(e){
280
+ var k = e.keyCode || e.charCode;
281
+
282
+ if(!e.ctrlKey && !(k > 47 && k < 58) && k != 8 && k != 9){
283
+ e.preventDefault();
284
+ }
285
+
286
+ var v=this.phone.value,p=parseInt( v.replace(/[^\d]/g,'') ,10);
287
+ p=isNaN(p)? '' : p.toString();
288
+ switch(e.keyCode){
289
+ case 9:
290
+ return;
291
+ case 13:
292
+ w.Taply.send(this);
293
+ case 8:
294
+ return true;
295
+ case 46:
296
+ p = p.substr(0,p.length-1);
297
+ break;
298
+ default :
299
+ var c = String.fromCharCode(e.keyCode);
300
+ if(e.keyCode > 47 && e.keyCode < 58){
301
+ p = p + c;
302
+ }else if(e.keyCode > 95 && e.keyCode < 106){
303
+ p = p + (e.keyCode-96);
304
+ }else{
305
+ return false;
306
+ }
307
+ }
308
+ this.phone.value = w.Taply.format(p);
309
+ e.preventDefault();
310
+ return false;
311
+ },
312
+ init: function(){
313
+ w.Taply.initValues();
314
+ var tbs = d.getElementsByClassName(w.Taply.btnClass);
315
+ for(var i=0; i<tbs.length; i++){
316
+ w.Taply.modules.push(new w.TaplyModule(tbs[i],w.Taply.modules.length) );
317
+ }
318
+ },
319
+ initValues: function(){
320
+ var phone = w.localStorage.getItem('taply_phone');
321
+ if(phone){
322
+ w.Taply.savedPhone = phone;
323
+ var tbs = d.getElementsByClassName(w.Taply.btnClass);
324
+ for(var i=0; i<tbs.length; i++){
325
+ var ps = tbs[i].getElementsByTagName('input');
326
+ for(var p=0;p<ps.length;p++){
327
+ if(ps[p].name == 'phone'){
328
+ ps[p].value = phone;
329
+ }
330
+ if(ps[p].name == 'save-phone'){
331
+ ps[p].checked = 1;
332
+ }
333
+ }
334
+ }
335
+ }
336
+ },
337
+ getCookie: function (name) {
338
+ var matches = document.cookie.match(new RegExp(
339
+ "(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)"
340
+ ));
341
+ return matches ? decodeURIComponent(matches[1]) : undefined;
342
+ },
343
+ getParamStr: function(block,er){
344
+ var p='';
345
+ switch(block.type){
346
+ case 'item':
347
+ p = "&iuid=" + block.el.attributes['data-iuid'].value;
348
+ break;
349
+ case 'cart':
350
+ if(block.el.attributes['data-shop'] && block.el.attributes['data-shop'].value === 'shopify'){
351
+ var cart = JSON.parse(block.el.attributes['data-cart'].value);
352
+ cart.shopify_cart = w.Taply.getCookie('cart');
353
+ cart.shopify_digest = w.Taply.getCookie('storefront_digest');
354
+ block.el.attributes['data-cart'].value = JSON.stringify(cart);
355
+ }
356
+ p = "&cart=" + encodeURIComponent(block.el.attributes['data-cart'].value);
357
+ break;
358
+ case 'auto':
359
+ break;
360
+ }
361
+
362
+ p += '&phone=' + block.phone.value.replace(/[\W_]/g,'')+ "&save_phone=" + (block.save_phone.checked? 1:0) + "&block_id=" + block.id;
363
+ return p;
364
+ },
365
+ verify: function(block){
366
+ var pattern = new RegExp(/\(?([0-9]{3})\)?[\s]{0,1}[0-9]{3}[-]?[0-9]{4}/);
367
+ if(!pattern.test(block.phone.value)){
368
+ block.notify(w.Taply.notifies.invalidPhone);
369
+ return false;
370
+ }
371
+ return true;
372
+ },
373
+ send: function(block){
374
+ clearInterval(w.Taply.ch);
375
+ if(block.save_phone.checked){
376
+ w.Taply.savedPhone = block.phone.value;
377
+ w.localStorage.setItem('taply_phone',w.Taply.savedPhone);
378
+ }
379
+ if(w.Taply.verify(block)){
380
+ w.Taply.ls(w.Taply.apiurl + '/add?callback=Taply.checkResponse' + w.Taply.getParamStr(block));
381
+ }
382
+ },
383
+ cancel: function(block){
384
+ clearInterval(w.Taply.ch);
385
+ if(block.pid){
386
+ w.Taply.ls(w.Taply.apiurl + "/cancel?callback=n&payment=" + block.pid);
387
+ block.initialized = false;
388
+ }
389
+ },
390
+ payLater: function(block){
391
+ clearInterval(w.Taply.ch);
392
+ if(block.pid){
393
+ w.Taply.ls(w.Taply.apiurl + (w.Taply.showPayLater? '/paylater' : '/cancel' ) + "?callback=n&payment=" + block.pid);
394
+ block.initialized = false;
395
+ }
396
+ },
397
+ checkResponse: function(data){
398
+ var el, n='';
399
+ if(data.result !== undefined){
400
+ el = w.Taply.modules[data.result.block_id];
401
+ }
402
+ if(data.status == "success"){
403
+ if(el === undefined){
404
+ return;
405
+ }
406
+ w.Taply.showPayLater = data.result.pay_later_button;
407
+ if (data.result.payment_result){
408
+ n = w.Taply.notifies.complete;
409
+ w.Taply.ch = setInterval(w.Taply.checkPayment,1000,data.result.payment);
410
+ }else{
411
+ n = w.Taply.notifies.notActivate;
412
+ if(data.result.firsttime){
413
+ n = w.Taply.notifies.firstTime;
414
+ }
415
+ if(data.result.sms_status){
416
+ n = w.Taply.notifies.notInstall;
417
+ }
418
+ }
419
+
420
+ }else{
421
+ n=w.Taply.notifies.serverError;
422
+ w.Taply.notifyMessages[n]='';
423
+ for(var i=0;i<data.errors.length;i++){
424
+ if(data.errors[i].error_code === 'E00901'){
425
+ n = w.Taply.notifies.invalidPhone;
426
+ break;
427
+ }else{
428
+ w.Taply.notifyMessages[n]+=data.errors[i].error_message;
429
+ }
430
+ }
431
+ }
432
+ if(el !== undefined){
433
+ el.pid = data.result.payment;
434
+ el.notify(n);
435
+ }else{
436
+ w.TaplyDlg.changeContent(n);
437
+ }
438
+ if(n == w.Taply.notifies.notInstall || n == w.Taply.notifies.notActivate){
439
+ w.setTimeout(function(){
440
+ el.notify(1);
441
+ w.Taply.ch = setInterval(w.Taply.checkPayment,1000,data.result.payment);
442
+ }, 5000);
443
+
444
+ }
445
+ },
446
+ checkPayment: function(pid){
447
+ w.Taply.ls(w.Taply.apiurl + "/get-payment-status?callback=Taply.checkPaymentResponse&payment=" + pid);
448
+ },
449
+ checkPaymentResponse: function(data){
450
+ var n = 'Unknown Error, try later';
451
+ if(data.status == "success"){
452
+ if (data.result.payment_status == 0){
453
+ return;
454
+ }
455
+ if(w.TaplyDlg.current){
456
+ w.TaplyDlg.current.pid=null;
457
+ }
458
+ clearInterval(w.Taply.ch);
459
+ n = data.result.payment_status<0? data.result.payment_status : data.result.payment_status + 10;
460
+ if(data.result.redirect !== undefined){
461
+ setTimeout(function(){w.location = data.result.redirect;},3000);
462
+ }
463
+ }
464
+ if(w.TaplyDlg.current){
465
+ w.TaplyDlg.current.notify(n);
466
+ };
467
+ },
468
+ };
469
+
470
+ if(document.readyState === "complete"){
471
+ w.Taply.init();
472
+ }else{
473
+ w.addEventListener('load', w.Taply.init.bind(w), false);
474
+ }
475
+ })(window,document);
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>taply</name>
4
- <version>1.1.3</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
7
  <channel>community</channel>
@@ -9,11 +9,12 @@
9
  <summary>Securely checkout using Apple Pay</summary>
10
  <description>Securely checkout using Apple Pay with only a tap of your finger and never enter your billing or shipping information again.&#xD;
11
  taply allows you to use Apple Pay for an incredibly fast, secure, and seamless online checkout. Go anywhere online that has the taply button, enter your mobile number, then use the taply app to complete the purchase using Touch ID.</description>
12
- <notes>bug fix </notes>
13
- <authors><author><name>taply</name><user>taply</user><email>admin@paybytaply.com</email></author></authors>
14
- <date>2016-01-28</date>
15
- <time>10:17:34</time>
16
- <contents><target name="magelocal"><dir><dir name="Taply"><dir name="Order"><dir name="controllers"><dir name="Taply"><file name="OrderController.php" hash="00eedb8b49cfe8ae1aecba1c40e3f17a"/></dir></dir><dir name="etc"><file name="config.xml" hash="80129765898cac5c81f83739352317e1"/><file name="system_.xml" hash="520313dbaf29da8a44325f1a2880d30a"/></dir></dir><dir name="Paybutton"><dir name="Block"><dir name="Adminhtml"><dir name="Sales"><dir name="Order"><file name="View.php" hash="31dc5ad3ff90929a5adff81f6286d6cf"/></dir></dir></dir><dir name="Button"><file name="Pay.php" hash="7c751e6a0aa7e1e015e5dd58e4c8f7da"/></dir></dir><dir name="Helper"><file name="Data.php" hash="c8404ec959ddf4bf9fbee31fc2314d34"/></dir><dir name="Model"><file name="Payment.php" hash="f630057cc99ec86c542592a904055002"/><file name="Viewtype.php" hash="c39cf7f525e11ab1de3f10a939caf494"/></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Taply"><file name="OrderController.php" hash="5593f8a36002649d34f0c8e6b07ab4b6"/></dir></dir><file name="GetshippingController.php" hash="b9e020fe0cde148b6bf88a4d7f52c71d"/><file name="OrderController.php" hash="be686c5550ed8bc92340f3e9e5d7017b"/><file name="SuccessController.php" hash="db0ce352d1d7bce814b4024eeba88357"/><file name=".GetshippingController.php.swp" hash="cdbd76ebdda15141750aa078d25cd826"/></dir><dir name="etc"><file name="adminhtml.xml" hash="7001550ad892cd8ca7a0917a0f9bd0bd"/><file name="config.xml" hash="f5880f339e17e42056f842ce1c42e876"/><file name="system.xml" hash="520313dbaf29da8a44325f1a2880d30a"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Taply_Paybutton.xml" hash="2c4c33fa727a3fe1d863353583e1dfa0"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="taply.xml" hash="bc7a785448a0e2b2754e46fa786a5b3d"/></dir><dir name="template"><dir name="taply"><file name="button.phtml" hash="b6541c278d428eea006a782e11abe2e3"/></dir></dir></dir></dir></dir></target><target name="mage"><dir name="js"><dir name="taply"><file name="taply.1.1.js" hash="84cbe3c8924bb5d3e0dfa947894a75e1"/></dir></dir></target></contents>
 
17
  <compatible/>
18
  <dependencies><required><php><min>5.4.0</min><max>5.6.999</max></php></required></dependencies>
19
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>taply</name>
4
+ <version>1.1.4</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
7
  <channel>community</channel>
9
  <summary>Securely checkout using Apple Pay</summary>
10
  <description>Securely checkout using Apple Pay with only a tap of your finger and never enter your billing or shipping information again.&#xD;
11
  taply allows you to use Apple Pay for an incredibly fast, secure, and seamless online checkout. Go anywhere online that has the taply button, enter your mobile number, then use the taply app to complete the purchase using Touch ID.</description>
12
+ <notes>change domain&#xD;
13
+ change design</notes>
14
+ <authors><author><name>taply</name><user>taply</user><email>admin@taplycheckout.com</email></author></authors>
15
+ <date>2016-02-17</date>
16
+ <time>09:48:36</time>
17
+ <contents><target name="magelocal"><dir><dir name="Taply"><dir name="Order"><dir name="controllers"><dir name="Taply"><file name="OrderController.php" hash="00eedb8b49cfe8ae1aecba1c40e3f17a"/></dir></dir><dir name="etc"><file name="config.xml" hash="80129765898cac5c81f83739352317e1"/><file name="system_.xml" hash="520313dbaf29da8a44325f1a2880d30a"/></dir></dir><dir name="Paybutton"><dir name="Block"><dir name="Adminhtml"><dir name="Sales"><dir name="Order"><file name="View.php" hash="31dc5ad3ff90929a5adff81f6286d6cf"/></dir></dir></dir><dir name="Button"><file name="Pay.php" hash="7c751e6a0aa7e1e015e5dd58e4c8f7da"/></dir></dir><dir name="Helper"><file name="Data.php" hash="c8404ec959ddf4bf9fbee31fc2314d34"/></dir><dir name="Model"><file name="Payment.php" hash="f630057cc99ec86c542592a904055002"/><file name="Viewtype.php" hash="c39cf7f525e11ab1de3f10a939caf494"/></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Taply"><file name="OrderController.php" hash="5593f8a36002649d34f0c8e6b07ab4b6"/></dir></dir><file name="GetshippingController.php" hash="b9e020fe0cde148b6bf88a4d7f52c71d"/><file name="OrderController.php" hash="be686c5550ed8bc92340f3e9e5d7017b"/><file name="SuccessController.php" hash="db0ce352d1d7bce814b4024eeba88357"/></dir><dir name="etc"><file name="adminhtml.xml" hash="7001550ad892cd8ca7a0917a0f9bd0bd"/><file name="config.xml" hash="f5880f339e17e42056f842ce1c42e876"/><file name="system.xml" hash="520313dbaf29da8a44325f1a2880d30a"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Taply_Paybutton.xml" hash="2c4c33fa727a3fe1d863353583e1dfa0"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="taply.xml" hash="9e1f83fd9986d9f92a9c1d903bd1b22a"/></dir><dir name="template"><dir name="taply"><file name="button.phtml" hash="eca6523dc0528f5dc199604bfef064b3"/></dir></dir></dir></dir></dir></target><target name="mage"><dir name="js"><dir name="taply"><file name="taply.1.1.js" hash="84cbe3c8924bb5d3e0dfa947894a75e1"/><file name="taply.1.2.js" hash="6e51a9133ef535474cf54a6a5e9fc045"/></dir></dir></target></contents>
18
  <compatible/>
19
  <dependencies><required><php><min>5.4.0</min><max>5.6.999</max></php></required></dependencies>
20
  </package>