| 1946 |
chandransh |
1 |
package in.shop2020.payment.domain;
|
|
|
2 |
|
|
|
3 |
import in.shop2020.payments.Attribute;
|
|
|
4 |
import in.shop2020.payments.PaymentStatus;
|
|
|
5 |
|
|
|
6 |
import java.io.Serializable;
|
| 2593 |
chandransh |
7 |
import java.util.ArrayList;
|
| 1946 |
chandransh |
8 |
import java.util.Date;
|
| 3956 |
chandransh |
9 |
import java.util.HashMap;
|
| 1946 |
chandransh |
10 |
import java.util.List;
|
| 3956 |
chandransh |
11 |
import java.util.Map;
|
| 1946 |
chandransh |
12 |
|
|
|
13 |
public class Payment implements Serializable{
|
|
|
14 |
|
|
|
15 |
private static final long serialVersionUID = -6103855488779807100L;
|
|
|
16 |
|
|
|
17 |
private long id;
|
|
|
18 |
private long gatewayId;
|
|
|
19 |
|
|
|
20 |
private String gatewayPaymentId;
|
|
|
21 |
private long merchantTxnId;
|
|
|
22 |
private String gatewayTxnId;
|
|
|
23 |
private double amount;
|
|
|
24 |
private String gatewayTxnStatus;
|
|
|
25 |
private int status;
|
|
|
26 |
private long userId;
|
|
|
27 |
|
|
|
28 |
private String errorCode;
|
|
|
29 |
private String description;
|
|
|
30 |
private String authCode;
|
|
|
31 |
private String referenceCode;
|
|
|
32 |
private String sessionId;
|
|
|
33 |
private String gatewayTxnDate;
|
| 6503 |
rajveer |
34 |
private double refundAmount;
|
| 1946 |
chandransh |
35 |
private List<PaymentAttribute> attributes;
|
|
|
36 |
|
|
|
37 |
private Date initTimestamp;
|
|
|
38 |
private Date successTimestamp;
|
|
|
39 |
private Date errorTimestamp;
|
| 4421 |
mandeep.dh |
40 |
private Date provisionalCaptureTimestamp;
|
| 6050 |
anupam.sin |
41 |
private boolean isDigital;
|
| 1946 |
chandransh |
42 |
|
|
|
43 |
public String toString(){
|
|
|
44 |
StringBuilder str = new StringBuilder("Id: " + id + ", User Id: " + userId);
|
|
|
45 |
str.append(", Amount: " + amount);
|
|
|
46 |
for(PaymentAttribute attr: attributes){
|
|
|
47 |
str.append(", " + attr.getName() + ":" + attr.getValue());
|
|
|
48 |
}
|
|
|
49 |
return str.toString();
|
|
|
50 |
}
|
|
|
51 |
|
|
|
52 |
public in.shop2020.payments.Payment getThriftPayment(){
|
|
|
53 |
in.shop2020.payments.Payment tPayment = new in.shop2020.payments.Payment();
|
|
|
54 |
tPayment.setPaymentId(this.id);
|
|
|
55 |
tPayment.setGatewayId(this.gatewayId);
|
|
|
56 |
|
|
|
57 |
tPayment.setGatewayPaymentId(this.gatewayPaymentId);
|
|
|
58 |
tPayment.setMerchantTxnId(this.merchantTxnId);
|
|
|
59 |
tPayment.setGatewayTxnId(this.gatewayTxnId);
|
|
|
60 |
tPayment.setAmount(this.amount);
|
|
|
61 |
tPayment.setGatewayTxnStatus(this.gatewayTxnStatus);
|
|
|
62 |
tPayment.setStatus(PaymentStatus.findByValue(this.status));
|
|
|
63 |
tPayment.setUserId(this.userId);
|
|
|
64 |
|
|
|
65 |
tPayment.setDescription(this.description);
|
|
|
66 |
tPayment.setAuthCode(this.authCode);
|
|
|
67 |
tPayment.setReferenceCode(this.referenceCode);
|
|
|
68 |
tPayment.setSessionId(this.sessionId);
|
|
|
69 |
tPayment.setGatewayTxnDate(this.gatewayTxnDate);
|
| 6050 |
anupam.sin |
70 |
tPayment.setIsDigital(isDigital);
|
| 6503 |
rajveer |
71 |
tPayment.setRefundAmount(this.refundAmount);
|
|
|
72 |
|
| 1946 |
chandransh |
73 |
if(initTimestamp != null)
|
|
|
74 |
tPayment.setInitTimestamp(this.initTimestamp.getTime());
|
|
|
75 |
if(successTimestamp != null)
|
|
|
76 |
tPayment.setSuccessTimestamp(this.successTimestamp.getTime());
|
|
|
77 |
if(errorTimestamp != null)
|
|
|
78 |
tPayment.setErrorTimestamp(this.errorTimestamp.getTime());
|
| 4421 |
mandeep.dh |
79 |
if(provisionalCaptureTimestamp != null)
|
|
|
80 |
tPayment.setProvisionalCaptureTimestamp(this.provisionalCaptureTimestamp.getTime());
|
|
|
81 |
|
| 2593 |
chandransh |
82 |
//Ensure that the attributes list is never null
|
|
|
83 |
tPayment.setAttributes(new ArrayList<Attribute>());
|
| 1946 |
chandransh |
84 |
if(!(attributes == null || attributes.isEmpty())){
|
|
|
85 |
for(PaymentAttribute attr : attributes)
|
|
|
86 |
tPayment.addToAttributes(new Attribute(attr.getName(), attr.getValue()));
|
|
|
87 |
}
|
|
|
88 |
return tPayment;
|
|
|
89 |
}
|
|
|
90 |
|
|
|
91 |
public long getId() {
|
|
|
92 |
return id;
|
|
|
93 |
}
|
|
|
94 |
public void setId(long id) {
|
|
|
95 |
this.id = id;
|
|
|
96 |
}
|
|
|
97 |
public long getGatewayId() {
|
|
|
98 |
return gatewayId;
|
|
|
99 |
}
|
|
|
100 |
public void setGatewayId(long gatewayId) {
|
|
|
101 |
this.gatewayId = gatewayId;
|
|
|
102 |
}
|
|
|
103 |
public String getGatewayPaymentId() {
|
|
|
104 |
return gatewayPaymentId;
|
|
|
105 |
}
|
|
|
106 |
public void setGatewayPaymentId(String gatewayPaymentId) {
|
|
|
107 |
this.gatewayPaymentId = gatewayPaymentId;
|
|
|
108 |
}
|
|
|
109 |
public long getMerchantTxnId() {
|
|
|
110 |
return merchantTxnId;
|
|
|
111 |
}
|
|
|
112 |
public void setMerchantTxnId(long merchantTxnId) {
|
|
|
113 |
this.merchantTxnId = merchantTxnId;
|
|
|
114 |
}
|
|
|
115 |
public String getGatewayTxnId() {
|
|
|
116 |
return gatewayTxnId;
|
|
|
117 |
}
|
|
|
118 |
public void setGatewayTxnId(String gatewayTxnId) {
|
|
|
119 |
this.gatewayTxnId = gatewayTxnId;
|
|
|
120 |
}
|
|
|
121 |
public double getAmount() {
|
|
|
122 |
return amount;
|
|
|
123 |
}
|
|
|
124 |
public void setAmount(double amount) {
|
|
|
125 |
this.amount = amount;
|
|
|
126 |
}
|
|
|
127 |
public String getGatewayTxnStatus() {
|
|
|
128 |
return gatewayTxnStatus;
|
|
|
129 |
}
|
|
|
130 |
public void setGatewayTxnStatus(String gatewayTxnStatus) {
|
|
|
131 |
this.gatewayTxnStatus = gatewayTxnStatus;
|
|
|
132 |
}
|
|
|
133 |
public int getStatus() {
|
|
|
134 |
return status;
|
|
|
135 |
}
|
|
|
136 |
public void setStatus(int status) {
|
|
|
137 |
this.status = status;
|
|
|
138 |
}
|
|
|
139 |
public long getUserId() {
|
|
|
140 |
return userId;
|
|
|
141 |
}
|
|
|
142 |
public void setUserId(long userId) {
|
|
|
143 |
this.userId = userId;
|
|
|
144 |
}
|
|
|
145 |
public String getErrorCode() {
|
|
|
146 |
return errorCode;
|
|
|
147 |
}
|
|
|
148 |
public void setErrorCode(String errorCode) {
|
|
|
149 |
this.errorCode = errorCode;
|
|
|
150 |
}
|
|
|
151 |
public String getDescription() {
|
|
|
152 |
return description;
|
|
|
153 |
}
|
|
|
154 |
public void setDescription(String description) {
|
|
|
155 |
this.description = description;
|
|
|
156 |
}
|
|
|
157 |
public String getAuthCode() {
|
|
|
158 |
return authCode;
|
|
|
159 |
}
|
|
|
160 |
public void setAuthCode(String authCode) {
|
|
|
161 |
this.authCode = authCode;
|
|
|
162 |
}
|
|
|
163 |
public String getReferenceCode() {
|
|
|
164 |
return referenceCode;
|
|
|
165 |
}
|
|
|
166 |
public void setReferenceCode(String referenceCode) {
|
|
|
167 |
this.referenceCode = referenceCode;
|
|
|
168 |
}
|
|
|
169 |
public String getSessionId() {
|
|
|
170 |
return sessionId;
|
|
|
171 |
}
|
|
|
172 |
public void setSessionId(String sessionId) {
|
|
|
173 |
this.sessionId = sessionId;
|
|
|
174 |
}
|
|
|
175 |
public String getGatewayTxnDate() {
|
|
|
176 |
return gatewayTxnDate;
|
|
|
177 |
}
|
|
|
178 |
public void setGatewayTxnDate(String gatewayTxnDate) {
|
|
|
179 |
this.gatewayTxnDate = gatewayTxnDate;
|
|
|
180 |
}
|
|
|
181 |
public List<PaymentAttribute> getAttributes() {
|
|
|
182 |
return attributes;
|
|
|
183 |
}
|
|
|
184 |
public void setAttributes(List<PaymentAttribute> attributes) {
|
|
|
185 |
this.attributes = attributes;
|
|
|
186 |
}
|
|
|
187 |
public Date getInitTimestamp() {
|
|
|
188 |
return initTimestamp;
|
|
|
189 |
}
|
|
|
190 |
public void setInitTimestamp(Date initTimestamp) {
|
|
|
191 |
this.initTimestamp = initTimestamp;
|
|
|
192 |
}
|
|
|
193 |
public Date getSuccessTimestamp() {
|
|
|
194 |
return successTimestamp;
|
|
|
195 |
}
|
|
|
196 |
public void setSuccessTimestamp(Date successTimestamp) {
|
|
|
197 |
this.successTimestamp = successTimestamp;
|
|
|
198 |
}
|
|
|
199 |
public Date getErrorTimestamp() {
|
|
|
200 |
return errorTimestamp;
|
|
|
201 |
}
|
|
|
202 |
public void setErrorTimestamp(Date errorTimestamp) {
|
|
|
203 |
this.errorTimestamp = errorTimestamp;
|
|
|
204 |
}
|
| 3956 |
chandransh |
205 |
|
|
|
206 |
public Map<String, String> getAttributeMap(){
|
|
|
207 |
Map<String, String> attrMap = new HashMap<String, String>();
|
|
|
208 |
for(PaymentAttribute attr : this.attributes){
|
|
|
209 |
attrMap.put(attr.getName(), attr.getValue());
|
|
|
210 |
}
|
|
|
211 |
return attrMap;
|
|
|
212 |
}
|
| 4421 |
mandeep.dh |
213 |
|
|
|
214 |
public Date getProvisionalCaptureTimestamp() {
|
|
|
215 |
return provisionalCaptureTimestamp;
|
|
|
216 |
}
|
|
|
217 |
|
|
|
218 |
public void setProvisionalCaptureTimestamp(Date provisionalCaptureTimestamp) {
|
|
|
219 |
this.provisionalCaptureTimestamp = provisionalCaptureTimestamp;
|
|
|
220 |
}
|
| 6050 |
anupam.sin |
221 |
|
|
|
222 |
public boolean isDigital() {
|
|
|
223 |
return isDigital;
|
|
|
224 |
}
|
|
|
225 |
|
|
|
226 |
public void setDigital(boolean isDigital) {
|
|
|
227 |
this.isDigital = isDigital;
|
|
|
228 |
}
|
| 6503 |
rajveer |
229 |
|
|
|
230 |
public void setRefundAmount(double refundAmount) {
|
|
|
231 |
this.refundAmount = refundAmount;
|
|
|
232 |
}
|
|
|
233 |
|
|
|
234 |
public double getRefundAmount() {
|
|
|
235 |
return refundAmount;
|
|
|
236 |
}
|
| 1946 |
chandransh |
237 |
}
|