forked from PingPlusPlus/pingpp-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNotify.java
More file actions
31 lines (24 loc) · 823 Bytes
/
Copy pathNotify.java
File metadata and controls
31 lines (24 loc) · 823 Bytes
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
package com.pingplusplus.model;
import com.google.gson.Gson;
public class Notify {
class InnerObject {
String object;
}
public static Object parseNotify(String notifyJson) {
InnerObject innerObject;
try {
innerObject = new Gson().fromJson(notifyJson, InnerObject.class);
} catch (Exception e) {
e.printStackTrace();
return null;
}
if(innerObject == null || innerObject.object == null || innerObject.object.isEmpty())
return null;
if(innerObject.object.equals("charge")) {
return new Gson().fromJson(notifyJson, Charge.class);
} else if(innerObject.object.equals("refund")) {
return new Gson().fromJson(notifyJson, Refund.class);
}
return null;
}
}