-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathBank.html
181 lines (168 loc) · 6.32 KB
/
Bank.html
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="./public/bower_components/jquery/dist/jquery.min.js"></script>
<script src="./public/bower_components/jquery-ui/jquery-ui.min.js"></script>
<script src="public/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
<script src="public/bower_components/web3/dist/web3.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="accounts.js"></script>
<title>Bank</title>
<!-- Bootstrap core CSS -->
<link href="public/bower_components/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
<style>
body {
padding-left: 50px;
padding-right: 50px;
}
table {
// Other values...
overflow-x: hidden;
overflow-y: hidden;
// Other values...
}
</style>
</head>
<script>
$(document).ready(function(){
var mandateID;
var mandateDetails;
web3.eth.defaultAccount = web3.eth.accounts[4];
console.log("Bank Address: "+web3.eth.defaultAccount);
$("#fetchResult").click(function(){
mandateID = $("#mandateID").val();
mandateDetails = contract.getMandatesDetailsForBank.call(mandateID);
$("#InvestorName").val(mandateDetails[0]);
$("#InvestorAddress").val(mandateDetails[2]);
$("#InvestorSignature").val(mandateDetails[1]);
$("#CAMSApproval").val(mandateDetails[5]);
$("#BankApproval").val(mandateDetails[4]);
var camsApproval = mandateDetails[5];
var bankApproval = mandateDetails[4];
if(camsApproval == true & bankApproval==false ){
enable();
$('#genHash').prop('disabled', false);
}else{
disable();
$('#genHash').prop('disabled', true);
}
$('#approveMandate').prop('disabled', true);
$("#verificationStatus").val("");
});
$("#genHash").click(function(){
var uniqueCode = $("#UniqueCode").val();
var doB = $("#DoB").val();
var accountNumber = $("#BankAccountNumber").val();
var secret = uniqueCode+doB+accountNumber;
var signature = mandateDetails[1];
var r = signature.slice(0, 66);
var s = '0x' + signature.slice(66, 130);
var v = '0x' + signature.slice(130, 132);
v = web3.toDecimal(v);
if(contract.bankApproval.call(mandateID,secret,v,r,s) == true){
$("#verificationStatus").val("Sucess");
$('#approveMandate').prop('disabled', false);
disable();
}else{
$("#verificationStatus").val("Failed");
$('#approveMandate').prop('disabled', true);
enable();
}
});
$("#approveMandate").click(function(){
var uniqueCode = $("#UniqueCode").val();
var doB = $("#DoB").val();
var accountNumber = $("#BankAccountNumber").val();
var secret = uniqueCode+doB+accountNumber;
var signature = mandateDetails[1];
var r = signature.slice(0, 66);
var s = '0x' + signature.slice(66, 130);
var v = '0x' + signature.slice(130, 132);
v = web3.toDecimal(v);
if(contract.bankApproval.call(mandateID,secret,v,r,s) == true){
contract.bankApproval(mandateID,secret,v,r,s);
}
});
});
function disable(){
$('#BankAccountNumber').prop('disabled', true);
$('#UniqueCode').prop('disabled', true);
$('#DoB').prop('disabled', true);
}
function enable(){
$('#BankAccountNumber').prop('disabled', false);
$('#UniqueCode').prop('disabled', false);
$('#DoB').prop('disabled', false);
}
</script>
<body>
<div class="container-fluid">
<h2 class="sub-header">Bank Approval</h2>
<div class="row">
<div class="col-sm-6">
<h3 class="sub-header">Mandate</h3>
<form class="form-inline"><center>
<div class="form-group row">
<label for="sell">Mandate ID</label>
<input type="text" class="form-control" id="mandateID" placeholder="Enter Mandate ID" value="">
<button class="btn btn-primary" id="fetchResult" type="button">Get Record</button>
</div><br><br>
</center></form>
</div>
<div class="col-sm-6">
<h3 class="sub-header">Details</h3>
<form class="form-inline" role="form"><center>
<div class="form-group row">
<label for="sell">Investor Name</label>
<input type="text" class="form-control" id="InvestorName" placeholder="" value="" disabled>
</div><br><br>
<div class="form-group row">
<label for="buy">Investor Address</label>
<input type="text" class="form-control" id="InvestorAddress" placeholder="" value="" disabled>
</div><br><br>
<div class="form-group row">
<label for="buy">Investor Signature</label>
<input type="text" class="form-control" id="InvestorSignature" placeholder="" value="" disabled>
</div><br><br>
<div class="form-group row">
<label for="buy">CAMS Approval</label>
<input type="text" class="form-control" id="CAMSApproval" placeholder="" value="" disabled>
</div><br><br>
<div class="form-group row">
<label for="buy">Bank Approval</label>
<input type="text" class="form-control" id="BankApproval" placeholder="" value="" disabled>
</div><br><br>
</center></form>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<form class="form-inline" role="form"><center>
<div class="form-group row">
<label>Unique Code</label>
<input type="text" class="form-control" id="UniqueCode" value="" disabled>
</div><br><br>
<div class="form-group row">
<label>Date of Birth</label>
<input type="text" class="form-control" id="DoB" value="" disabled>
</div><br><br>
<div class="form-group row">
<label>Bank Account Number</label>
<input type="text" class="form-control" id="BankAccountNumber" value="" disabled><br>
</div><br><br>
<div class="form-group row">
<label>Verification Status</label>
<input type="text" class="form-control" id="verificationStatus" value="" disabled><br>
</div><br><br>
<div class="form-group row">
<button class="btn btn-primary" id="genHash" type="button" disabled>Verify Mandate</button>
<button class="btn btn-primary" id="approveMandate" type="button" disabled>Approve Mandate</button>
</div>
</center></form>
</div>
</div>
</body>
</html>