adyen-skinbuilder 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +21 -0
- data/README.markdown +7 -3
- data/Rakefile +0 -5
- data/adyen/main_content.html +597 -1
- data/adyen/skeleton.html +13 -3
- data/lib/adyen-skinbuilder/server.rb +6 -1
- data/lib/adyen-skinbuilder/version.rb +1 -1
- metadata +5 -5
- data/TODO.markdown +0 -16
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
Copyright (c) 2011
|
2
|
+
Priit Haamer
|
3
|
+
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
5
|
+
a copy of this software and associated documentation files (the
|
6
|
+
"Software"), to deal in the Software without restriction, including
|
7
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
8
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
+
permit persons to whom the Software is furnished to do so, subject to
|
10
|
+
the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be
|
13
|
+
included in all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.markdown
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Simple Rack server to make Adyen skin authoring easier. Also includes rake tasks to bundle skin directories into deployable bundles (not yet implemented)
|
1
|
+
Simple Rack server to make Adyen skin authoring easier. Also includes rake tasks to bundle skin directories into deployable bundles (not yet implemented).
|
2
2
|
|
3
3
|
## Install
|
4
4
|
|
@@ -19,8 +19,12 @@ Make sure you have directory with basic Adyen skin structure, that looks somethi
|
|
19
19
|
|
20
20
|
To view something that is very much similar to the end result generated in Adyen, fire up adyen-skinbuilder rack server, that does the template rendering on your local machine:
|
21
21
|
|
22
|
-
adyen-skinbuilder ~/Documents/DV3tf95f
|
22
|
+
$ adyen-skinbuilder ~/Documents/DV3tf95f
|
23
23
|
|
24
24
|
And go to http://localhost:8888 to see the generated page.
|
25
25
|
|
26
|
-
See `adyen-skinbuilder --help` for options
|
26
|
+
See `adyen-skinbuilder --help` for more options to run server on different port or with logging etc.
|
27
|
+
|
28
|
+
## Order Data
|
29
|
+
|
30
|
+
Adyen let's you post order data that will be shown in shopping cart view as part of html. You can put `order_data.txt` file into `inc/` folder in the skin directory. This file will be included automatically in the same place, where adyen would put it.
|
data/Rakefile
CHANGED
data/adyen/main_content.html
CHANGED
@@ -1 +1,597 @@
|
|
1
|
-
|
1
|
+
<script type="text/javascript">
|
2
|
+
//<![CDATA[
|
3
|
+
/* Form validation */
|
4
|
+
var requiredFields = new Array();
|
5
|
+
var fieldLinks = new Array();
|
6
|
+
var errorMessages = new Array();
|
7
|
+
var errorAreas = new Array();
|
8
|
+
var validationFunctions = new Array();
|
9
|
+
var details = new Array();
|
10
|
+
|
11
|
+
errorMessages["default"] = new Array();
|
12
|
+
requiredFields["default"] = new Array();
|
13
|
+
|
14
|
+
var maySubmitOnlyOnce=true;
|
15
|
+
|
16
|
+
requiredFields["default"].push("brandCode");
|
17
|
+
errorMessages["default"]["brandCode"] = "Please enter your payment details";
|
18
|
+
errorMessages["default"]["submitonce"] = "Your request is being processed, please wait....";
|
19
|
+
|
20
|
+
var locked = false;
|
21
|
+
var _valFunc = new function() {};
|
22
|
+
|
23
|
+
var displayAmountExtras = new Object();
|
24
|
+
|
25
|
+
function show(detail, actionURL, group, brandCode) {
|
26
|
+
|
27
|
+
if(config["pmmanimation"] != 1) {
|
28
|
+
if(locked) { return false; }
|
29
|
+
locked = true;
|
30
|
+
setTimeout('locked=false',1000);
|
31
|
+
}
|
32
|
+
|
33
|
+
document.forms["pageform"].action=actionURL;
|
34
|
+
document.forms["pageform"].onsubmit=null;
|
35
|
+
|
36
|
+
if(document.forms["pageform"].addEventListener) {
|
37
|
+
document.forms["pageform"].removeEventListener('submit',_valFunc ,false);
|
38
|
+
document.forms["pageform"].addEventListener('submit',_valFunc = function(e) {
|
39
|
+
result = formValidate(document.forms["pageform"] ,group);
|
40
|
+
if(result == false) {
|
41
|
+
e=e||event;
|
42
|
+
e.preventDefault? e.preventDefault() : e.returnValue = false;
|
43
|
+
}
|
44
|
+
},false);
|
45
|
+
} else {
|
46
|
+
document.forms["pageform"].detachEvent('onsubmit',_valFunc);
|
47
|
+
document.forms["pageform"].attachEvent('onsubmit',_valFunc = function(e) {
|
48
|
+
result = formValidate(document.forms["pageform"] ,group);
|
49
|
+
if(result == false) {
|
50
|
+
e=e||event;
|
51
|
+
e.preventDefault? e.preventDefault() : e.returnValue = false;
|
52
|
+
}
|
53
|
+
});
|
54
|
+
}
|
55
|
+
|
56
|
+
document.forms["pageform"]["brandCode"].value=brandCode;
|
57
|
+
document.getElementById('extraCostAmount').innerHTML = displayAmountExtras[group];
|
58
|
+
|
59
|
+
if(detail != "") {
|
60
|
+
detail.slideit();
|
61
|
+
for (i = 0; i < details.length; i++) {
|
62
|
+
if (details[i].divId != detail.divId) {
|
63
|
+
details[i].slideup();
|
64
|
+
}
|
65
|
+
}
|
66
|
+
}
|
67
|
+
return false;
|
68
|
+
}
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
addOnLoad(preventEnterSubmit);
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
//]]>
|
78
|
+
</script>
|
79
|
+
<script type="text/javascript" src="https://test.adyen.com/hpp/js/animatedcollapse.js"></script>
|
80
|
+
<script type="text/javascript" src="https://test.adyen.com/hpp/js/cc.js"></script>
|
81
|
+
<input type="hidden" id="brandCode" name="brandCode" value="" />
|
82
|
+
|
83
|
+
<h2 id="stageheader">Please Enter your Payment Details</h2>
|
84
|
+
|
85
|
+
<div id="orderDataWrapper">
|
86
|
+
<div id="orderDataHeader">Order Details</div>
|
87
|
+
<div id="orderData">
|
88
|
+
<!-- Adyen Order Data -->
|
89
|
+
</div>
|
90
|
+
</div>
|
91
|
+
<div id="displayAmount">
|
92
|
+
Total payment amount EUR 43.20 <span id="extraCostAmount"></span>
|
93
|
+
</div>
|
94
|
+
|
95
|
+
<ul id="paymentMethods">
|
96
|
+
<li style="list-style-type: none;">
|
97
|
+
<button type="submit" name="brandName" value="VISA" class="imgB pmB pmBvisa" onclick="return show(collapsevisa, 'completeCard.shtml', 'card', 'visa');">VISA</button>
|
98
|
+
<span id="pmmextracosts-visa" class="pmmextracosts"></span><span id="pmvisadescription" class="pmmdescription"></span>
|
99
|
+
<div id="pmmdetails-visa" class="pmmdetails">
|
100
|
+
<script type="text/javascript">
|
101
|
+
//<![CDATA[
|
102
|
+
/* Form validation */
|
103
|
+
requiredFields["card"] = new Array();
|
104
|
+
requiredFields["card"].push("cardHolderName");
|
105
|
+
requiredFields["card"].push("cardNumber");
|
106
|
+
requiredFields["card"].push("expiryMonth");
|
107
|
+
requiredFields["card"].push("expiryYear");
|
108
|
+
errorMessages["card"] = new Array();
|
109
|
+
errorMessages["card"]["cardHolderName"] = "Card Holder Name missing";
|
110
|
+
errorMessages["card"]["cardNumber"] = "Card Number invalid or missing";
|
111
|
+
errorMessages["card"]["expiryMonth"] = "Expiry Month missing";
|
112
|
+
errorMessages["card"]["expiryYear"] = "Expiry Year missing";
|
113
|
+
errorMessages["card"]["cvcCode"] = "CVC/CVV/CID missing";
|
114
|
+
errorMessages["card"]["generic"] = "Please enter your card details";
|
115
|
+
|
116
|
+
|
117
|
+
var cvcinfo = new Array();
|
118
|
+
cvcinfo["mc"] = "<h3>What is CVC?</h3>" +
|
119
|
+
"<p><img style=\"margin-right: 5px\" class=\"fl\" src=\"/hpp/img/CVC_mini.jpg\" alt=\"CVC location\" />" +
|
120
|
+
"The Card Validation Code (CVC) is an <i>additional</i> " +
|
121
|
+
"three-digit security code that is printed (not embossed) on the back " +
|
122
|
+
"of your card.</p>" +
|
123
|
+
"<p>The CVC is an extra security measure to ensure that you are in possession of the card.</p><br style=\"clear: both\" />";
|
124
|
+
cvcinfo["visa"] = "<h3>What is CVV?</h3>" +
|
125
|
+
"<p><img style=\"margin-right: 5px\" class=\"fl\" src=\"/hpp/img/CVV_mini.jpg\" alt=\"CVV location\" />" +
|
126
|
+
"The Card Verification Value (CVV) is an <i>additional</i> " +
|
127
|
+
"three-digit security code that is printed (not embossed) on the back " +
|
128
|
+
"of your card.</p>" +
|
129
|
+
"<p>The CVV is an extra security measure to ensure that you are in possession of the card.</p><br style=\"clear: both\" />";
|
130
|
+
cvcinfo["amex"] = "<h3>What is CID?</h3>" +
|
131
|
+
"<p><img style=\"margin-right: 5px\" class=\"fl\" src=\"/hpp/img/CID_mini.jpg\" alt=\"CID location\" />" +
|
132
|
+
"The Card IDentification (CID) is an <i>additional</i> " +
|
133
|
+
"four-digit security code that is printed (not embossed) on the front " +
|
134
|
+
"of your card.</p>" +
|
135
|
+
"<p>The CID is an extra security measure to ensure that you are in possession of the card.</p><br style=\"clear: both\" />";
|
136
|
+
cvcinfo["card"] = "<h3>What is CVC/CVV/CID?</h3>" +
|
137
|
+
"<p>The Card Security Code (CVC/CVV/CID) is an <i>additional</i> " +
|
138
|
+
"three or four digit security code that is printed (not embossed) on the front or the back " +
|
139
|
+
"of your card.</p>" +
|
140
|
+
"<p>The CVC/CVV/CID is an extra security measure to ensure that you are in possession of the card.</p><br style=\"clear: both\" />";
|
141
|
+
|
142
|
+
var card_types = new Array();
|
143
|
+
var card_logos = new Array();
|
144
|
+
var card_displayAmountExtras = new Array();
|
145
|
+
var card_extras = new Array();
|
146
|
+
var previousCardNumber ="";
|
147
|
+
var card_subVariantExtras = new Object();
|
148
|
+
var card_subVariantExtrasPhrase = new Object();
|
149
|
+
var originalExtraCostPhrase = document.getElementById('pmmextracosts-visa').innerHTML;
|
150
|
+
|
151
|
+
card_types.push("visa");
|
152
|
+
card_logos.push("/img/pm/visa");
|
153
|
+
card_displayAmountExtras.push("");
|
154
|
+
card_extras.push("");
|
155
|
+
|
156
|
+
card_subVariantExtras['visacorporate'] = "";
|
157
|
+
card_subVariantExtrasPhrase['visacorporate'] = "";
|
158
|
+
card_subVariantExtras['travelmoney'] = "";
|
159
|
+
card_subVariantExtrasPhrase['travelmoney'] = "";
|
160
|
+
card_subVariantExtras['visabusiness'] = "";
|
161
|
+
card_subVariantExtrasPhrase['visabusiness'] = "";
|
162
|
+
card_subVariantExtras['visacredit'] = "";
|
163
|
+
card_subVariantExtrasPhrase['visacredit'] = "";
|
164
|
+
card_subVariantExtras['visahipotecario'] = "";
|
165
|
+
card_subVariantExtrasPhrase['visahipotecario'] = "";
|
166
|
+
card_subVariantExtras['visapurchasing'] = "";
|
167
|
+
card_subVariantExtrasPhrase['visapurchasing'] = "";
|
168
|
+
card_subVariantExtras['visaclassic'] = "";
|
169
|
+
card_subVariantExtrasPhrase['visaclassic'] = "";
|
170
|
+
card_subVariantExtras['visaplatinum'] = "";
|
171
|
+
card_subVariantExtrasPhrase['visaplatinum'] = "";
|
172
|
+
card_subVariantExtras['visasignature'] = "";
|
173
|
+
card_subVariantExtrasPhrase['visasignature'] = "";
|
174
|
+
card_subVariantExtras['electron'] = "";
|
175
|
+
card_subVariantExtrasPhrase['electron'] = "";
|
176
|
+
card_subVariantExtras['visacommercialcredit'] = "";
|
177
|
+
card_subVariantExtrasPhrase['visacommercialcredit'] = "";
|
178
|
+
card_subVariantExtras['visagold'] = "";
|
179
|
+
card_subVariantExtrasPhrase['visagold'] = "";
|
180
|
+
card_subVariantExtras['visa'] = "";
|
181
|
+
card_subVariantExtrasPhrase['visa'] = "";
|
182
|
+
card_subVariantExtras['visadebit'] = "";
|
183
|
+
card_subVariantExtrasPhrase['visadebit'] = "";
|
184
|
+
|
185
|
+
|
186
|
+
var baseURL = "/hpp/";
|
187
|
+
if(baseURL.indexOf(";jsession") != -1) {
|
188
|
+
baseURL = baseURL.substr(0,baseURL.indexOf(";jsession"));
|
189
|
+
}
|
190
|
+
|
191
|
+
function validateCcNumber(e, dontHideErrorFrame) {
|
192
|
+
cardNumber = (document.getElementById('cardNumber').value);
|
193
|
+
|
194
|
+
if(cardNumber.length <= previousCardNumber.length) {
|
195
|
+
previousCardNumber = cardNumber;
|
196
|
+
if (cardNumber.length == 0) {
|
197
|
+
resetExtraCost();
|
198
|
+
}
|
199
|
+
return;
|
200
|
+
}
|
201
|
+
var l=0;
|
202
|
+
while(l < previousCardNumber.length) {
|
203
|
+
if(cardNumber[l] != previousCardNumber[l]) {
|
204
|
+
previousCardNumber = cardNumber;
|
205
|
+
return;
|
206
|
+
}
|
207
|
+
l++;
|
208
|
+
}
|
209
|
+
|
210
|
+
reg = /\s+/g;
|
211
|
+
cardNumber = cardNumber.replace(reg,'');
|
212
|
+
|
213
|
+
nrOfDigits = cardNumber.length;
|
214
|
+
|
215
|
+
if(nrOfDigits > 19){
|
216
|
+
ccNumberPresentation(false);
|
217
|
+
return;
|
218
|
+
}
|
219
|
+
|
220
|
+
ccNumberPresentation(true,dontHideErrorFrame);
|
221
|
+
|
222
|
+
baseCard = getBaseCard(cardNumber,card_types);
|
223
|
+
if(baseCard != null) {
|
224
|
+
setCardBrand(baseCard, true);
|
225
|
+
} else if(nrOfDigits > 4) {
|
226
|
+
setCardBrand(null, true);
|
227
|
+
ccNumberPresentation(false);
|
228
|
+
} else {
|
229
|
+
setCardBrand(null, false);
|
230
|
+
}
|
231
|
+
|
232
|
+
if (cardNumber.length < 6) {
|
233
|
+
setExtraCost(baseCard, null);
|
234
|
+
} else if (cardNumber.length == 6 || cardNumber.length == 9 || cardNumber.length == 12){
|
235
|
+
_.X("/hpp/binLookup.shtml",function(d,r){
|
236
|
+
if(r.status != 200 || d.indexOf('"result"') == -1) return false;
|
237
|
+
var response=eval("("+d+")");
|
238
|
+
|
239
|
+
if(typeof(response.result)=='undefined') return false;
|
240
|
+
|
241
|
+
if (response.result == 0) {
|
242
|
+
lookedUpCardType = response.cardType;
|
243
|
+
} else {
|
244
|
+
lookedUpCardType = null;
|
245
|
+
}
|
246
|
+
setExtraCost(baseCard, lookedUpCardType);
|
247
|
+
|
248
|
+
return true;
|
249
|
+
}, 'bin='+cardNumber+'&'+_.Q(_.G("pageform")));
|
250
|
+
}
|
251
|
+
|
252
|
+
//show value with white space after four numbers
|
253
|
+
result = cardNumber.replace(/(\d{4})/g, '$1 ');
|
254
|
+
result = result.replace(/\s+$/, ''); //remove trailing spaces
|
255
|
+
|
256
|
+
previousCardNumber = result;
|
257
|
+
document.getElementById('cardNumber').value = result;
|
258
|
+
}
|
259
|
+
|
260
|
+
function setExtraCost(selectedCard, lookedUpCard) {
|
261
|
+
var extraCostDisplayed = false;
|
262
|
+
if (lookedUpCard != null && card_subVariantExtras[lookedUpCard] != null) {
|
263
|
+
document.getElementById('extraCostAmount').innerHTML = card_subVariantExtras[lookedUpCard];
|
264
|
+
displayAmountExtras['card'] = card_subVariantExtras[lookedUpCard];
|
265
|
+
document.getElementById('pmmextracosts-visa').innerHTML = card_subVariantExtrasPhrase[lookedUpCard];
|
266
|
+
extraCostDisplayed = true;
|
267
|
+
} else {
|
268
|
+
for(var i = 0; i < card_types.length; ++i) {
|
269
|
+
if(selectedCard != null && card_types[i] == selectedCard.cardtype && card_subVariantExtras[selectedCard.cardtype] != null) {
|
270
|
+
document.getElementById('extraCostAmount').innerHTML = card_subVariantExtras[selectedCard.cardtype];
|
271
|
+
displayAmountExtras['card'] = card_subVariantExtras[selectedCard.cardtype];
|
272
|
+
document.getElementById('pmmextracosts-visa').innerHTML = card_subVariantExtrasPhrase[selectedCard.cardtype];
|
273
|
+
extraCostDisplayed = true;
|
274
|
+
}
|
275
|
+
}
|
276
|
+
}
|
277
|
+
|
278
|
+
if (!extraCostDisplayed) {
|
279
|
+
resetExtraCost();
|
280
|
+
}
|
281
|
+
}
|
282
|
+
|
283
|
+
function resetExtraCost() {
|
284
|
+
displayAmountExtras['card'] = "";
|
285
|
+
document.getElementById('extraCostAmount').innerHTML = "";
|
286
|
+
document.getElementById('pmmextracosts-visa').innerHTML = originalExtraCostPhrase;
|
287
|
+
}
|
288
|
+
|
289
|
+
function setCardBrand(selectedCard, greyInactive) {
|
290
|
+
|
291
|
+
for(var i = 0; i < card_types.length; ++i) {
|
292
|
+
var imageId = "cclogo" + i;
|
293
|
+
if(selectedCard != null && card_types[i] == selectedCard.cardtype) {
|
294
|
+
document.getElementById(imageId).src=baseURL + card_logos[i] + "_small.png";
|
295
|
+
} else {
|
296
|
+
if(greyInactive) {
|
297
|
+
document.getElementById(imageId).src=baseURL + card_logos[i] + "_small_grey.png";
|
298
|
+
} else {
|
299
|
+
document.getElementById(imageId).src=baseURL + card_logos[i] + "_small.png";
|
300
|
+
}
|
301
|
+
}
|
302
|
+
document.getElementById(imageId).style.display="inline";
|
303
|
+
}
|
304
|
+
if(selectedCard != null) {
|
305
|
+
if(selectedCard.cardtype == "amex") {
|
306
|
+
document.getElementById("cvcCode").maxLength = 4;
|
307
|
+
document.getElementById('cvcName').innerHTML = "CID";
|
308
|
+
document.getElementById('cvcWhatIs').innerHTML = "What is CID?";
|
309
|
+
document.getElementById('cvcFrame').innerHTML = cvcinfo["amex"];
|
310
|
+
showDebitCardFields("none");
|
311
|
+
} else if (selectedCard.cardtype == "visa" || selectedCard.cardtype == "electron") {
|
312
|
+
document.getElementById("cvcCode").maxLength = 3;
|
313
|
+
document.getElementById('cvcName').innerHTML = "CVV";
|
314
|
+
document.getElementById('cvcWhatIs').innerHTML = "What is CVV?";
|
315
|
+
document.getElementById('cvcFrame').innerHTML = cvcinfo["visa"];
|
316
|
+
showDebitCardFields("none");
|
317
|
+
} else if (selectedCard.cardtype == "mc" || selectedCard.cardtype == "maestro" || selectedCard.cardtype == "maestrouk" || selectedCard.cardtype == "solo" ) {
|
318
|
+
document.getElementById("cvcCode").maxLength = 3;
|
319
|
+
document.getElementById('cvcName').innerHTML = "CVC";
|
320
|
+
document.getElementById('cvcWhatIs').innerHTML = "What is CVC?";
|
321
|
+
document.getElementById('cvcFrame').innerHTML = cvcinfo["mc"];
|
322
|
+
if(selectedCard.cardtype == "maestrouk" || selectedCard.cardtype == "solo") {
|
323
|
+
showDebitCardFields(cssTr);
|
324
|
+
} else {
|
325
|
+
showDebitCardFields("none");
|
326
|
+
}
|
327
|
+
} else {
|
328
|
+
document.getElementById("cvcCode").maxLength = 3;
|
329
|
+
document.getElementById('cvcName').innerHTML = "CVC";
|
330
|
+
document.getElementById('cvcWhatIs').innerHTML = "What is CVC?";
|
331
|
+
document.getElementById('cvcFrame').innerHTML = cvcinfo["card"];
|
332
|
+
showDebitCardFields("none");
|
333
|
+
}
|
334
|
+
}
|
335
|
+
}
|
336
|
+
|
337
|
+
function showDebitCardFields(show) {
|
338
|
+
document.getElementById('cardIssueNumber').style.display = show;
|
339
|
+
document.getElementById('cardStartDate').style.display = show;
|
340
|
+
document.getElementById('pmmdetails-visa').style.height = document.getElementById('pmmdetails-visa').scrollHeight + "px";
|
341
|
+
collapsevisa._getheight(true);
|
342
|
+
}
|
343
|
+
|
344
|
+
function ccNumberPresentation(valid, dontHideErrorFrame){
|
345
|
+
var errors = new Array();
|
346
|
+
errors.push("cardNumber");
|
347
|
+
if(valid){
|
348
|
+
clearErrors(errors, dontHideErrorFrame);
|
349
|
+
}
|
350
|
+
else{
|
351
|
+
markErrorFields(errors);
|
352
|
+
}
|
353
|
+
}
|
354
|
+
|
355
|
+
function blockNonNumbers(e) {
|
356
|
+
var key;
|
357
|
+
var isCtrl = false;
|
358
|
+
var keychar;
|
359
|
+
var reg;
|
360
|
+
|
361
|
+
if(window.event) {
|
362
|
+
key = e.keyCode;
|
363
|
+
isCtrl = window.event.ctrlKey
|
364
|
+
}
|
365
|
+
else if(e.which) {
|
366
|
+
key = e.which;
|
367
|
+
isCtrl = e.ctrlKey;
|
368
|
+
}
|
369
|
+
|
370
|
+
if (isNaN(key)) return true;
|
371
|
+
|
372
|
+
keychar = String.fromCharCode(key);
|
373
|
+
|
374
|
+
// check for backspace or delete, or if Ctrl was pressed
|
375
|
+
if (key == 8 || isCtrl) {
|
376
|
+
return true;
|
377
|
+
}
|
378
|
+
|
379
|
+
reg = /[\d ]/;
|
380
|
+
|
381
|
+
return reg.test(keychar);
|
382
|
+
}
|
383
|
+
|
384
|
+
validationFunctions
|
385
|
+
function doCCCheck(){
|
386
|
+
cardNumber = (document.getElementById('cardNumber').value);
|
387
|
+
reg = /\s+/g;
|
388
|
+
cardNumber = cardNumber.replace(reg,'');
|
389
|
+
if(!luhnCheck(cardNumber))
|
390
|
+
ccNumberPresentation(false);
|
391
|
+
else
|
392
|
+
ccNumberPresentation(true);
|
393
|
+
}
|
394
|
+
|
395
|
+
validationFunctions["card"] = new Array();
|
396
|
+
validationFunctions["card"]["cardNumber"] = function (cardNumberField) {
|
397
|
+
cardNumber = cardNumberField.value;
|
398
|
+
reg = /\s+/g;
|
399
|
+
cardNumber = cardNumber.replace(reg,'');
|
400
|
+
if(cardNumber == "" || luhnCheck(cardNumber)){
|
401
|
+
return true;
|
402
|
+
}
|
403
|
+
return false;
|
404
|
+
}
|
405
|
+
|
406
|
+
|
407
|
+
|
408
|
+
//]]>
|
409
|
+
</script>
|
410
|
+
|
411
|
+
<table class="basetable">
|
412
|
+
<tr>
|
413
|
+
<td class="mid"><div id="cclogoheader" style="display: none">Card Type</div></td>
|
414
|
+
<td class="mid">
|
415
|
+
<div style="height: 25px" id="cclogo">
|
416
|
+
<img alt="" id="cclogo0" style="display: none" class="mid" src="/hpp/img/pm/unknown_small.png" />
|
417
|
+
<img alt="" id="cclogo1" style="display: none" class="mid" src="/hpp/img/pm/unknown_small.png" />
|
418
|
+
<img alt="" id="cclogo2" style="display: none" class="mid" src="/hpp/img/pm/unknown_small.png" />
|
419
|
+
<img alt="" id="cclogo3" style="display: none" class="mid" src="/hpp/img/pm/unknown_small.png" />
|
420
|
+
<img alt="" id="cclogo4" style="display: none" class="mid" src="/hpp/img/pm/unknown_small.png" />
|
421
|
+
<img alt="" id="cclogo5" style="display: none" class="mid" src="/hpp/img/pm/unknown_small.png" />
|
422
|
+
<img alt="" id="cclogo6" style="display: none" class="mid" src="/hpp/img/pm/unknown_small.png" />
|
423
|
+
<img alt="" id="cclogo7" style="display: none" class="mid" src="/hpp/img/pm/unknown_small.png" />
|
424
|
+
<img alt="" id="cclogo8" style="display: none" class="mid" src="/hpp/img/pm/unknown_small.png" />
|
425
|
+
<script type="text/javascript">
|
426
|
+
setCardBrand(null, false);
|
427
|
+
</script>
|
428
|
+
</div>
|
429
|
+
</td>
|
430
|
+
</tr>
|
431
|
+
<tr id="cardNumberTr">
|
432
|
+
<td><div>Card number</div></td>
|
433
|
+
<td><div class="fieldDiv"><input type="text" class="inputField" id="cardNumber" onkeypress="return blockNonNumbers(event)" onkeyup="validateCcNumber(event)" onblur="validateCcNumber(event)" onchange="doCCCheck()" name="cardNumber" value="" size="24" maxlength="23" /></div></td>
|
434
|
+
</tr>
|
435
|
+
<tr>
|
436
|
+
<td><div>Card holder name</div></td>
|
437
|
+
<td><div class="fieldDiv"><input type="text" class="inputField" id="cardHolderName" name="cardHolderName" value="" size="19" maxlength="30" /></div></td>
|
438
|
+
</tr>
|
439
|
+
<tr id="cardIssueNumber" style="display: none">
|
440
|
+
<td><div>Issue Number</div></td>
|
441
|
+
<td><div class="fieldDiv"><input type="text" class="inputField" name="issueNumber" id="issueNumber" size="4" maxlength="2" /></div></td>
|
442
|
+
</tr>
|
443
|
+
<tr id="cardStartDate" style="display: none">
|
444
|
+
<td><div>Start Date</div></td>
|
445
|
+
<td><div class="fieldDiv">
|
446
|
+
<select class="inputField" name="startMonth" id="startMonth" size="1">
|
447
|
+
<option value="*"></option>
|
448
|
+
<option value="01">01</option>
|
449
|
+
<option value="02">02</option>
|
450
|
+
<option value="03">03</option>
|
451
|
+
<option value="04">04</option>
|
452
|
+
<option value="05">05</option>
|
453
|
+
<option value="06">06</option>
|
454
|
+
<option value="07">07</option>
|
455
|
+
<option value="08">08</option>
|
456
|
+
<option value="09">09</option>
|
457
|
+
<option value="10">10</option>
|
458
|
+
<option value="11">11</option>
|
459
|
+
<option value="12">12</option>
|
460
|
+
</select>
|
461
|
+
/
|
462
|
+
<select class="inputField" name="startYear" id="startYear" size="1">
|
463
|
+
<option value="*"></option>
|
464
|
+
<option value="2011">2011</option>
|
465
|
+
<option value="2010">2010</option>
|
466
|
+
<option value="2009">2009</option>
|
467
|
+
<option value="2008">2008</option>
|
468
|
+
<option value="2007">2007</option>
|
469
|
+
<option value="2006">2006</option>
|
470
|
+
<option value="2005">2005</option>
|
471
|
+
<option value="2004">2004</option>
|
472
|
+
<option value="2003">2003</option>
|
473
|
+
<option value="2002">2002</option>
|
474
|
+
</select>
|
475
|
+
</div>
|
476
|
+
</td>
|
477
|
+
</tr>
|
478
|
+
<tr>
|
479
|
+
<td><div>Card expiry date</div></td><td>
|
480
|
+
<div class="fieldDiv">
|
481
|
+
<select class="inputField" name="expiryMonth" id="expiryMonth" size="1">
|
482
|
+
<option value="*"></option>
|
483
|
+
<option value="01">01</option>
|
484
|
+
<option value="02">02</option>
|
485
|
+
<option value="03">03</option>
|
486
|
+
<option value="04">04</option>
|
487
|
+
<option value="05">05</option>
|
488
|
+
<option value="06">06</option>
|
489
|
+
<option value="07">07</option>
|
490
|
+
<option value="08">08</option>
|
491
|
+
<option value="09">09</option>
|
492
|
+
<option value="10">10</option>
|
493
|
+
<option value="11">11</option>
|
494
|
+
<option value="12">12</option>
|
495
|
+
</select>
|
496
|
+
/
|
497
|
+
<select class="inputField" name="expiryYear" id="expiryYear" size="1">
|
498
|
+
<option value="*"></option>
|
499
|
+
<option value="2011">2011</option>
|
500
|
+
<option value="2012">2012</option>
|
501
|
+
<option value="2013">2013</option>
|
502
|
+
<option value="2014">2014</option>
|
503
|
+
<option value="2015">2015</option>
|
504
|
+
<option value="2016">2016</option>
|
505
|
+
<option value="2017">2017</option>
|
506
|
+
<option value="2018">2018</option>
|
507
|
+
<option value="2019">2019</option>
|
508
|
+
<option value="2020">2020</option>
|
509
|
+
<option value="2021">2021</option>
|
510
|
+
<option value="2022">2022</option>
|
511
|
+
<option value="2023">2023</option>
|
512
|
+
<option value="2024">2024</option>
|
513
|
+
<option value="2025">2025</option>
|
514
|
+
<option value="2026">2026</option>
|
515
|
+
<option value="2027">2027</option>
|
516
|
+
</select>
|
517
|
+
</div>
|
518
|
+
</td>
|
519
|
+
</tr>
|
520
|
+
<tr>
|
521
|
+
<td><div id="cvcName">CVC/CVV/CID</div></td>
|
522
|
+
<td><div class="fieldDiv"><input class="inputField" type="text" name="cvcCode" value="" id="cvcCode" size="7" maxlength="3" /> <a href="#" onclick="return toggleElement('cvcFrame');"><span id="cvcWhatIs">What is CVC/CVV/CID?</span></a></div></td>
|
523
|
+
</tr>
|
524
|
+
<tr>
|
525
|
+
<td colspan="2"><div class="r">
|
526
|
+
<input class="paySubmit paySubmitvisa" type="submit" name="pay" value="Confirm payment" />
|
527
|
+
</div></td>
|
528
|
+
</tr>
|
529
|
+
</table>
|
530
|
+
|
531
|
+
<div class="popupMsg popupMsgOPP " style="display: none;" onclick="return hideElement('cvcFrame');" id="cvcFrame">
|
532
|
+
<h3>What is CVC/CVV/CID?</h3>
|
533
|
+
<p>The Card Security Code (CVC/CVV/CID) is an <i>additional</i>
|
534
|
+
three or four digit security code that is printed (not embossed) on the front or the back
|
535
|
+
of your card.</p>
|
536
|
+
<p>The CVC/CVV/CID is an extra security measure to ensure that you are in possession of the card.</p>
|
537
|
+
</div>
|
538
|
+
|
539
|
+
|
540
|
+
<script type="text/javascript">
|
541
|
+
//<![CDATA[
|
542
|
+
|
543
|
+
// find out what the CSS implementation calls the tr "display" value
|
544
|
+
var cssTr = document.getElementById('cardNumberTr').style.display;
|
545
|
+
|
546
|
+
if(document.getElementById('cardNumber').value.length > 0) {
|
547
|
+
var validateCcNumberTimer = setTimeout('validateCcNumber(null,true)', 2500);
|
548
|
+
}
|
549
|
+
|
550
|
+
//]]>
|
551
|
+
</script>
|
552
|
+
|
553
|
+
<script type="text/javascript">
|
554
|
+
var collapsevisa = new animatedcollapse("pmmdetails-visa", 1000, false, false, config["pmmanimation"]==1?false:true);
|
555
|
+
details.push(collapsevisa);
|
556
|
+
|
557
|
+
displayAmountExtras['card'] = "";
|
558
|
+
|
559
|
+
|
560
|
+
|
561
|
+
addOnLoad(function () {
|
562
|
+
setTimeout("show(collapsevisa, 'completeCard.shtml', 'card', 'visa')",100);
|
563
|
+
});
|
564
|
+
|
565
|
+
if (notNull(document.getElementById('pmmform-visa'))) {
|
566
|
+
document.getElementById('pmmform-visa').setAttribute("autocomplete","off");
|
567
|
+
}
|
568
|
+
</script>
|
569
|
+
</div>
|
570
|
+
</li>
|
571
|
+
</ul>
|
572
|
+
|
573
|
+
<div id="errorFrame" style="display: none;" class="popupMsg errorFrame">
|
574
|
+
<div id="errorFrameValidationErrors"></div>
|
575
|
+
</div>
|
576
|
+
<div id="okFrame" style="display: none;" class="popupMsg okFrame">
|
577
|
+
<div id="okFrameMessages"></div>
|
578
|
+
</div>
|
579
|
+
|
580
|
+
<input type="text" style="display: none" />
|
581
|
+
<input type="hidden" name="sig" value="" />
|
582
|
+
<input type="hidden" name="merchantReference" value="" />
|
583
|
+
<input type="hidden" name="paymentAmount" value="4320" />
|
584
|
+
<input type="hidden" name="currencyCode" value="EUR" />
|
585
|
+
<input type="hidden" name="shipBeforeDate" value="2011-06-03" />
|
586
|
+
<input type="hidden" name="skinCode" value="Zij12nYa" />
|
587
|
+
<input type="hidden" name="merchantAccount" value="Test" />
|
588
|
+
<input type="hidden" name="shopperLocale" value="en" />
|
589
|
+
<input type="hidden" name="stage" value="pay" />
|
590
|
+
<input type="hidden" name="sessionId" value="" />
|
591
|
+
<input type="hidden" name="orderData" value="" />
|
592
|
+
<input type="hidden" name="sessionValidity" value="" />
|
593
|
+
<input type="hidden" name="countryCode" value="" />
|
594
|
+
<input type="hidden" name="shopperEmail" value="test@test.com" />
|
595
|
+
<input type="hidden" name="allowedMethods" value="visa" />
|
596
|
+
<input type="hidden" name="originalSession" value="" />
|
597
|
+
<input type="hidden" name="referrerURL" value="" />
|
data/adyen/skeleton.html
CHANGED
@@ -3,12 +3,12 @@
|
|
3
3
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
4
|
<head>
|
5
5
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
-
<title>
|
6
|
+
<title>Please enter your payment details</title>
|
7
7
|
|
8
|
-
<link rel="stylesheet" media="screen" type="text/css" href="/hpp/css/reset.css" />
|
8
|
+
<link rel="stylesheet" media="screen" type="text/css" href="https://test.adyen.com/hpp/css/reset.css" />
|
9
9
|
<link rel="stylesheet" media="screen" type="text/css" href="/sf/$skinCode/css/screen.css" />
|
10
10
|
<link rel="stylesheet" media="print" type="text/css" href="/sf/$skinCode/css/print.css" />
|
11
|
-
<script type="text/javascript" src="/hpp/js/default.js"></script>
|
11
|
+
<script type="text/javascript" src="https://test.adyen.com/hpp/js/default.js"></script>
|
12
12
|
|
13
13
|
<script type="text/javascript" src="/sf/$skinCode/js/custom.js"></script>
|
14
14
|
<!--[if lt IE 7]>
|
@@ -16,6 +16,16 @@
|
|
16
16
|
<![endif]-->
|
17
17
|
</head>
|
18
18
|
<body>
|
19
|
+
<script type="text/javascript">
|
20
|
+
//<![CDATA[
|
21
|
+
var clientIPAddress = "127.0.0.1";
|
22
|
+
|
23
|
+
var config = new Array();
|
24
|
+
config["pmmanimation"] = 2;
|
25
|
+
|
26
|
+
//]]>
|
27
|
+
</script>
|
28
|
+
|
19
29
|
<!-- ### inc/cheader_[locale].txt or inc/cheader.txt (fallback) ### -->
|
20
30
|
<form id="pageform" action="" method="post" onsubmit="return formValidate(this);">
|
21
31
|
<script type="text/javascript">
|
@@ -6,6 +6,7 @@ module Adyen
|
|
6
6
|
|
7
7
|
def initialize(skins_directory)
|
8
8
|
@skins_directory = File.dirname(skins_directory)
|
9
|
+
@order_data_file =
|
9
10
|
@skin = File.basename(skins_directory)
|
10
11
|
end
|
11
12
|
|
@@ -15,13 +16,17 @@ module Adyen
|
|
15
16
|
%w(cheader pmheader pmfooter customfields cfooter).each do |inc|
|
16
17
|
body = body.gsub(%r{\<!-- ### inc\/#{inc}_\[locale\].txt or inc\/#{inc}.txt \(fallback\) ### --\>}, get_inc(inc))
|
17
18
|
end
|
18
|
-
body = body.gsub(%r{\<!-- Adyen Main Content --\>},
|
19
|
+
body = body.gsub(%r{\<!-- Adyen Main Content --\>}, main_content)
|
19
20
|
|
20
21
|
[200, {'Content-Type' => 'text/html'}, [body]]
|
21
22
|
end
|
22
23
|
|
23
24
|
private
|
24
25
|
|
26
|
+
def main_content
|
27
|
+
File.read(File.join(File.dirname(__FILE__), '../../adyen/main_content.html')).gsub(%r{\<!-- Adyen Order Data --\>}, get_inc('order_data'))
|
28
|
+
end
|
29
|
+
|
25
30
|
# TODO: add locale support so files like inc/cheader_[locale].txt will be included correctly
|
26
31
|
def get_inc(filename)
|
27
32
|
if File.exists?(File.join(@skins_directory, @skin, 'inc', "#{filename}.txt"))
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: adyen-skinbuilder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Priit Haamer
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-06-02 00:00:00 +03:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -91,9 +91,9 @@ files:
|
|
91
91
|
- Gemfile
|
92
92
|
- Gemfile.lock
|
93
93
|
- Guardfile
|
94
|
+
- LICENSE
|
94
95
|
- README.markdown
|
95
96
|
- Rakefile
|
96
|
-
- TODO.markdown
|
97
97
|
- adyen-skinbuilder.gemspec
|
98
98
|
- adyen/main_content.html
|
99
99
|
- adyen/skeleton.html
|
data/TODO.markdown
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
TODO list
|
2
|
-
=========
|
3
|
-
|
4
|
-
TODO
|
5
|
-
----
|
6
|
-
|
7
|
-
### file://lib/adyen-skinbuilder.rb
|
8
|
-
|
9
|
-
* TODO: skin bundle generator (7)
|
10
|
-
* TODO: Init task to build adyen skins directory structure (8)
|
11
|
-
|
12
|
-
### file://lib/adyen-skinbuilder/server.rb
|
13
|
-
|
14
|
-
* TODO: add locale support so files like inc/cheader_[locale].txt will be included correctly (25)
|
15
|
-
* TODO: process Adyen default files at "/hpp" (51)
|
16
|
-
|