1
|
|
|
/** |
2
|
|
|
* |
3
|
|
|
* NOTICE OF LICENSE |
4
|
|
|
* |
5
|
|
|
* This source file is subject to the GNU General Public License (GPL 3) |
6
|
|
|
* that is bundled with this package in the file LICENSE.txt |
7
|
|
|
* |
8
|
|
|
* DISCLAIMER |
9
|
|
|
* |
10
|
|
|
* Do not edit or add to this file if you wish to upgrade Payone_Core to newer |
11
|
|
|
* versions in the future. If you wish to customize Payone_Core for your |
12
|
|
|
* needs please refer to http://www.payone.de for more information. |
13
|
|
|
* |
14
|
|
|
* @category Payone |
15
|
|
|
* @package js |
16
|
|
|
* @subpackage payone |
17
|
|
|
* @copyright Copyright (c) 2016 <[email protected]> - www.fatchip.com |
18
|
|
|
* @author Robert Müller <[email protected]> |
19
|
|
|
* @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3) |
20
|
|
|
* @link http://www.fatchip.com |
21
|
|
|
* |
22
|
|
|
* |
23
|
|
|
* @category Payone |
24
|
|
|
* @package js |
25
|
|
|
* @subpackage payone |
26
|
|
|
* @copyright Copyright (c) 2016 <[email protected]> - www.e3n.de |
27
|
|
|
* @author Tim Rein <[email protected]> |
28
|
|
|
* @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3) |
29
|
|
|
* @link http://www.e3n.de |
30
|
|
|
*/ |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* |
34
|
|
|
* @param mode |
35
|
|
|
* @param paymentMethod |
36
|
|
|
* @param url |
37
|
|
|
*/ |
38
|
|
|
function payoneSwitchRateOrRuntime(mode, paymentMethod, url) |
|
|
|
|
39
|
|
|
{ |
40
|
|
|
if (mode == 'rate') { |
41
|
|
|
document.getElementById(paymentMethod + '_SwitchToTerm').className = 'ratepay-Active'; |
42
|
|
|
document.getElementById(paymentMethod + '_SwitchToRuntime').className = ''; |
43
|
|
|
document.getElementById(paymentMethod + '_ContentTerm').style.display = 'block'; |
44
|
|
|
document.getElementById(paymentMethod + '_ContentRuntime').style.display = 'none'; |
45
|
|
|
} else if (mode == 'runtime') { |
46
|
|
|
document.getElementById(paymentMethod + '_SwitchToRuntime').className = 'ratepay-Active'; |
47
|
|
|
document.getElementById(paymentMethod + '_SwitchToTerm').className = ''; |
48
|
|
|
document.getElementById(paymentMethod + '_ContentRuntime').style.display = 'block'; |
49
|
|
|
document.getElementById(paymentMethod + '_ContentTerm').style.display = 'none'; |
50
|
|
|
} |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* |
55
|
|
|
* @param mode |
56
|
|
|
* @param paymentMethod |
57
|
|
|
* @param url |
58
|
|
|
*/ |
59
|
|
|
function payoneRatepayRateCalculatorAction(mode, paymentMethod, url) |
60
|
|
|
{ |
61
|
|
|
var calcValue, |
62
|
|
|
calcMethod, |
63
|
|
|
notification, |
64
|
|
|
html, |
65
|
|
|
ratePayshopId, |
66
|
|
|
amount, |
67
|
|
|
ratePayCurrency, |
68
|
|
|
ajaxLoader = $("ajaxLoaderId"), |
69
|
|
|
cover = $("cover"); |
70
|
|
|
|
71
|
|
|
ajaxLoader.setStyle( |
72
|
|
|
{ |
73
|
|
|
display: 'block' |
74
|
|
|
} |
75
|
|
|
); |
76
|
|
|
cover.setStyle( |
77
|
|
|
{ |
78
|
|
|
display: 'block' |
79
|
|
|
} |
80
|
|
|
); |
81
|
|
|
|
82
|
|
|
|
83
|
|
|
if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari |
84
|
|
|
xmlhttp = new XMLHttpRequest(); |
|
|
|
|
85
|
|
|
} else {// code for IE6, IE5 |
86
|
|
|
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); |
|
|
|
|
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
amount = document.getElementById('amount').value; |
90
|
|
|
ratePayshopId = document.getElementById('ratePayShopId').value; |
91
|
|
|
ratePayCurrency = document.getElementById('ratePayCurrency').value; |
92
|
|
|
if (mode == 'rate') { |
93
|
|
|
calcValue = document.getElementById(paymentMethod + '-rate').value; |
94
|
|
|
|
95
|
|
|
|
96
|
|
|
calcMethod = 'calculation-by-rate'; |
97
|
|
|
if (document.getElementById('debitSelect')) { |
98
|
|
|
dueDate = document.getElementById('debitSelect').value; |
|
|
|
|
99
|
|
|
} else { |
100
|
|
|
dueDate= ''; |
101
|
|
|
} |
102
|
|
|
} else if (mode == 'runtime') { |
103
|
|
|
calcValue = document.getElementById(paymentMethod + '-runtime').value; |
104
|
|
|
calcMethod = 'calculation-by-time'; |
105
|
|
|
notification = (document.getElementById(paymentMethod + '_Notification') == null) ? 0 : 1; |
106
|
|
|
if(document.getElementById('debitSelectRuntime')){ |
107
|
|
|
dueDate = document.getElementById('debitSelectRuntime').value; |
108
|
|
|
} else { |
109
|
|
|
dueDate= ''; |
110
|
|
|
} |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
xmlhttp.open("POST", url, false); |
114
|
|
|
|
115
|
|
|
xmlhttp.setRequestHeader( |
116
|
|
|
"Content-Type", |
117
|
|
|
"application/x-www-form-urlencoded" |
118
|
|
|
); |
119
|
|
|
|
120
|
|
|
xmlhttp.send( |
121
|
|
|
"paymentMethod=" + paymentMethod + "&calcValue=" + calcValue + "&calcMethod=" + calcMethod + "&dueDate=" + dueDate |
|
|
|
|
122
|
|
|
+ "¬ification=" + notification |
|
|
|
|
123
|
|
|
+ "&ratePayshopId=" + ratePayshopId + "&ratePayCurrency=" + ratePayCurrency + "&amount=" + amount |
124
|
|
|
); |
125
|
|
|
|
126
|
|
|
if (xmlhttp.responseText != null) { |
127
|
|
|
html = xmlhttp.responseText; |
128
|
|
|
document.getElementById(paymentMethod + '_ResultContainer').innerHTML = html; |
129
|
|
|
document.getElementById(paymentMethod + '_ResultContainer').style.display = 'block'; |
130
|
|
|
document.getElementById(paymentMethod + '_ResultContainer').style.padding = '3px 0 0 0'; |
131
|
|
|
document.getElementById(paymentMethod + '_SwitchToTerm').style.display = 'none'; |
132
|
|
|
|
133
|
|
|
ajaxLoader.setStyle( |
134
|
|
|
{ |
135
|
|
|
display: 'none' |
136
|
|
|
} |
137
|
|
|
); |
138
|
|
|
cover.setStyle( |
139
|
|
|
{ |
140
|
|
|
display: 'none' |
141
|
|
|
} |
142
|
|
|
); |
143
|
|
|
} |
144
|
|
|
|
145
|
|
|
} |
146
|
|
|
/** |
147
|
|
|
* @param element |
148
|
|
|
*/ |
149
|
|
|
function payoneSwitchPayRate(element) |
150
|
|
|
{ |
151
|
|
|
if(element.value === 'RPS'){ |
152
|
|
|
$("ratepay-main-cont").setStyle( |
153
|
|
|
{ |
154
|
|
|
display: 'block' |
155
|
|
|
} |
156
|
|
|
); |
157
|
|
|
} else { |
158
|
|
|
$("ratepay-main-cont").setStyle( |
159
|
|
|
{ |
160
|
|
|
display: 'none' |
161
|
|
|
} |
162
|
|
|
); |
163
|
|
|
} |
164
|
|
|
} |
165
|
|
|
|
166
|
|
|
/** |
167
|
|
|
* |
168
|
|
|
* @param payment_code |
169
|
|
|
*/ |
170
|
|
|
function payoneRatepayCustomerDobInput(payment_code) |
171
|
|
|
{ |
172
|
|
|
var daySelect = $(payment_code + '_additional_fields_customer_dob_day'); |
173
|
|
|
var monthSelect = $(payment_code + '_additional_fields_customer_dob_month'); |
174
|
|
|
var yearSelect = $(payment_code + '_additional_fields_customer_dob_year'); |
175
|
|
|
var hiddenDobFull = $(payment_code + '_additional_fields_customer_dob_full'); |
176
|
|
|
|
177
|
|
|
if (daySelect == undefined || monthSelect == undefined || yearSelect == undefined |
178
|
|
|
|| hiddenDobFull == undefined) { |
179
|
|
|
return; |
180
|
|
|
} |
181
|
|
|
|
182
|
|
|
hiddenDobFull.value = yearSelect.value + "-" + monthSelect.value + "-" + daySelect.value; |
183
|
|
|
} |
184
|
|
|
|
185
|
|
|
var Translator = new Translate([]); |
|
|
|
|
186
|
|
|
|
187
|
|
|
Validation.add( |
|
|
|
|
188
|
|
|
'validate-18-years', Translator.translate('You have to be at least 18 years old to use this payment type!'), function (value) { |
189
|
|
|
var oBirthDate = new Date(value); |
190
|
|
|
var oMinDate = new Date(new Date().setYear(new Date().getFullYear() - 18)); |
191
|
|
|
if(oBirthDate > oMinDate) { |
192
|
|
|
return false; |
193
|
|
|
} |
194
|
|
|
|
195
|
|
|
return true; |
196
|
|
|
} |
197
|
|
|
); |
This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.