-
Notifications
You must be signed in to change notification settings - Fork 0
/
js-paymentgateway.tpl
56 lines (56 loc) · 1.55 KB
/
js-paymentgateway.tpl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
{*
* JS for Payment Gateway Pages
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* Copyright 2017-2018 Jacques Marneweck. All rights strictly reserved.
*}
<script>
{if isset($cardunload) && true == $cardunload}
{literal}
jQuery(document).ready(function() {
$('#payment_method').change(function() {
console.log($(this).find('option:selected').val());
var selected = $(this).find('option:selected').val();
if (selected == 'wallet') {
console.log('here');
$('#wallet').show();
$('#debitcard').hide();
$('#card').hide();
} else if (selected == 'debitcard') {
$('#wallet').hide();
$('#debitcard').show();
$('#card').hide();
} else if (selected == 'card') {
$('#wallet').hide();
$('#debitcard').hide();
$('#card').show();
} else {
alert('Invalid payment method selected.');
}
}).change();
});
{/literal}
{else}
{literal}
jQuery(document).ready(function() {
$('#payment_method').change(function() {
console.log($(this).find('option:selected').val());
var selected = $(this).find('option:selected').val();
if (selected == 'wallet') {
$('#wallet').show();
$('#card').hide();
} else if (selected == 'card') {
$('#wallet').hide();
$('#debitcard').hide();
$('#card').show();
} else {
alert('Invalid payment method selected.');
}
}).change();
});
{/literal}
{/if}
</script>