-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathform.phtml
More file actions
58 lines (48 loc) · 2.22 KB
/
form.phtml
File metadata and controls
58 lines (48 loc) · 2.22 KB
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
57
58
<input type="hidden" id="paystack_transaction_id" name="paystack_plugincustomfields[paystack_transaction_id]" value="">
<script src="https://js.paystack.co/v1/inline.js"></script>
<?php if ($this->from == 'signup') { ?>
<a style="margin-left:0px;cursor:pointer;" class="center-on-mobile app-btns primary customButton paystackButton" id="customButton"></a>
<?php } else if ($this->from == 'invoice') { ?>
<button class="app-btns primary customButton paystackButton"><?php echo $this->user->lang('Pay Invoice'); ?></button>
<?php } ?>
<script>
function paystackOpenHandler(){
<?php if ($this->from == 'signup') { ?>
var email = '';
<?php if (!$this->loggedIn) { ?>
var CT_4 = document.getElementById('CT_4');
if(typeof CT_4 !== null && CT_4 !== 'undefined' ) {
email = CT_4.value;
}
<?php } ?>
<?php } ?>
var handler = PaystackPop.setup({
key: '<?php echo $this->publicKey; ?>',
<?php if ($this->from == 'invoice') { ?>
email: '<?php echo $this->user->getEmail(); ?>',
amount: '<?php echo $this->amount; ?>',
currency: '<?php echo $this->currency;?>',
<?php } else if ($this->from == 'signup') { ?>
email: email+'<?php echo @$this->user->getEmail(); ?>',
amount: Math.round(document.getElementById("totalPay_raw").value * 100),
currency: '<?php echo $this->Currency;?>',
<?php } ?>
callback: function(response) {
document.getElementById('paystack_transaction_id').value = response.trxref;
<?php if ($this->from == 'invoice' || $this->from == 'signup') { ?>
$('#submitButton').click();
<?php } ?>
}
});
handler.openIframe();
}
$('.paystackButton').on('click', function(e) {
e.preventDefault();
<?php if ($this->from == 'signup') { ?>
if ($('.paystackButton').hasClass('disabled')) {
return;
}
<?php } ?>
paystackOpenHandler();
});
</script>