-
Notifications
You must be signed in to change notification settings - Fork 1
/
solanaWebHook.java
40 lines (35 loc) · 1.08 KB
/
solanaWebHook.java
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
String body = null;
StringBuilder stringBuilder = new StringBuilder();
BufferedReader bufferedReader = null;
try {
InputStream inputStream = request.getInputStream();
if (inputStream != null) {
bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
char[] charBuffer = new char[128];
int bytesRead = -1;
while ((bytesRead = bufferedReader.read(charBuffer)) > 0) {
stringBuilder.append(charBuffer, 0, bytesRead);
}
} else {
stringBuilder.append("");
}
} catch (IOException ex) {
// throw ex;
return "";
} finally {
if (bufferedReader != null) {
try {
bufferedReader.close();
} catch (IOException ex) {
}
}
}
body = stringBuilder.toString();
JSONObject jObj = new JSONObject(getBody(request));
String paymentAmount = jObj.get("USD_Amount");
String payerWallet = jObj.get("sourcePayment");
String transactionID = jObj.get("trx");
String myOrderID = jObj.get("myParam");
String secret = jObj.get("secret");
if (secret.equals("[YOUR SECRET]") {
}