| Line 111... |
Line 111... |
| 111 |
transactionServiceClient = new TransactionClient().getClient();
|
111 |
transactionServiceClient = new TransactionClient().getClient();
|
| 112 |
setOrders(transactionServiceClient.getEligibleOrdersForReturn(
|
112 |
setOrders(transactionServiceClient.getEligibleOrdersForReturn(
|
| 113 |
Long.valueOf(userId), returnType, canOverideWarranty()));
|
113 |
Long.valueOf(userId), returnType, canOverideWarranty()));
|
| 114 |
return VIEW;
|
114 |
return VIEW;
|
| 115 |
}
|
115 |
}
|
| 116 |
|
116 |
|
| 117 |
private boolean canOverideWarranty(){
|
117 |
private boolean canOverideWarranty(){
|
| 118 |
return SecurityUtils.getSubject().hasRole("TeamLead")?true:false;
|
118 |
return SecurityUtils.getSubject().hasRole("TeamLead")?true:false;
|
| 119 |
}
|
119 |
}
|
| 120 |
|
120 |
|
| 121 |
public String getReturnTransactionsForUser() throws TransactionServiceException, NumberFormatException, TException{
|
121 |
public String getReturnTransactionsForUser() throws TransactionServiceException, NumberFormatException, TException{
|
| Line 181... |
Line 181... |
| 181 |
setReturnOrderInfoList(transactionServiceClient.getAllReturnOrdersForReturnPickupRequest(t_retuenPickuprequest.getId()));
|
181 |
setReturnOrderInfoList(transactionServiceClient.getAllReturnOrdersForReturnPickupRequest(t_retuenPickuprequest.getId()));
|
| 182 |
return "pick-up-index";
|
182 |
return "pick-up-index";
|
| 183 |
}
|
183 |
}
|
| 184 |
|
184 |
|
| 185 |
public String refundReceivedOrder() throws NumberFormatException, TransactionServiceException, TException, PaymentException{
|
185 |
public String refundReceivedOrder() throws NumberFormatException, TransactionServiceException, TException, PaymentException{
|
| - |
|
186 |
try{
|
| 186 |
transactionServiceClient = new TransactionClient().getClient();
|
187 |
transactionServiceClient = new TransactionClient().getClient();
|
| 187 |
returnOrderInfo = transactionServiceClient.getReturnOrderInfo(Long.valueOf(returnOrderId));
|
188 |
returnOrderInfo = transactionServiceClient.getReturnOrderInfo(Long.valueOf(returnOrderId));
|
| 188 |
returnOrderInfo.setRefundType(RefundType.findByValue(Integer.valueOf(refundType)));
|
189 |
returnOrderInfo.setRefundType(RefundType.findByValue(Integer.valueOf(refundType)));
|
| 189 |
returnOrderInfo.setRefundedBy(getAgentName());
|
190 |
returnOrderInfo.setRefundedBy(getAgentName());
|
| 190 |
if (returnOrderInfo.getRefundType() == RefundType.INIT){
|
191 |
if (returnOrderInfo.getRefundType() == RefundType.INIT){
|
| 191 |
setResult("Illegal refund type");
|
192 |
setResult("Illegal refund type");
|
| 192 |
return "result";
|
193 |
return "result";
|
| 193 |
}
|
194 |
}
|
| 194 |
in.shop2020.model.v1.order.Order t_order = transactionServiceClient.getOrder(returnOrderInfo.getOrderId());
|
195 |
in.shop2020.model.v1.order.Order t_order = transactionServiceClient.getOrder(returnOrderInfo.getOrderId());
|
| 195 |
PaymentClient paymentServiceClient = new PaymentClient();
|
196 |
PaymentClient paymentServiceClient = new PaymentClient();
|
| 196 |
List<Payment> orderPayments =null;
|
197 |
List<Payment> orderPayments =null;
|
| 197 |
if(!t_order.isCod()){
|
198 |
if(!t_order.isCod()){
|
| 198 |
orderPayments =paymentServiceClient.getClient()
|
199 |
orderPayments =paymentServiceClient.getClient()
|
| 199 |
.getPaymentForTxnId(t_order.getTransactionId());
|
200 |
.getPaymentForTxnId(t_order.getTransactionId());
|
| 200 |
}
|
- |
|
| 201 |
|
- |
|
| 202 |
|
- |
|
| 203 |
List<in.shop2020.model.v1.order.Attribute> attrList = new ArrayList<in.shop2020.model.v1.order.Attribute>();
|
- |
|
| 204 |
in.shop2020.model.v1.order.Attribute attr1 = new in.shop2020.model.v1.order.Attribute();
|
- |
|
| 205 |
attr1.setName("Refund_Option");
|
- |
|
| 206 |
in.shop2020.model.v1.order.Attribute attr2 = new in.shop2020.model.v1.order.Attribute();
|
- |
|
| 207 |
attr2.setName("Refund_Amount");
|
- |
|
| 208 |
in.shop2020.model.v1.order.Attribute attr3 = new in.shop2020.model.v1.order.Attribute();
|
- |
|
| 209 |
attr3.setName("Refund_TimeStamp");
|
- |
|
| 210 |
SimpleDateFormat timestmapFormat = new SimpleDateFormat("dd-MMM-yyyy HH:mm:ss");
|
- |
|
| 211 |
attr2.setValue(refundAmount);
|
- |
|
| 212 |
attr3.setValue(timestmapFormat.format(Calendar.getInstance().getTime()));
|
- |
|
| 213 |
if (RECEIVE_PICKUP_STATE_CHECK.contains(returnOrderInfo.getReturnStatus()) && returnOrderInfo.getReturnTxnResolutionStatus() == ReturnTxnResolutionStatus.QUALITY_CHECK){
|
- |
|
| 214 |
if (returnOrderInfo.getReturnAction() == ReturnAction.REPLACEMENT){
|
- |
|
| 215 |
if (returnOrderInfo.getRefundType() != RefundType.REPLACEMENT){
|
- |
|
| 216 |
setResult("Refund type should be replacement");
|
- |
|
| 217 |
return "result";
|
- |
|
| 218 |
}
|
- |
|
| 219 |
returnOrderInfo.setRefundType(RefundType.REPLACEMENT);
|
- |
|
| 220 |
returnOrderInfo.setShippingType(ReplacementShippingType.findByValue(Integer.valueOf(shippingType)));
|
- |
|
| 221 |
if (returnOrderInfo.getShippingType() != ReplacementShippingType.IMMEDIATE){
|
- |
|
| 222 |
setResult("Shipping type should be immediate");
|
- |
|
| 223 |
return "result";
|
- |
|
| 224 |
}
|
- |
|
| 225 |
}
|
201 |
}
|
| 226 |
else{
|
- |
|
| 227 |
if(!(SecurityUtils.getSubject().hasRole("TeamLead"))){
|
- |
|
| 228 |
setResult("Admin rights are required to process this operation");
|
- |
|
| 229 |
return "result";
|
- |
|
| 230 |
}
|
- |
|
| 231 |
|
202 |
|
| 232 |
if (returnOrderInfo.getRefundType() == null){
|
- |
|
| 233 |
setResult("Illegal refund type");
|
- |
|
| 234 |
return "result";
|
- |
|
| 235 |
}
|
- |
|
| 236 |
|
203 |
|
| - |
|
204 |
List<in.shop2020.model.v1.order.Attribute> attrList = new ArrayList<in.shop2020.model.v1.order.Attribute>();
|
| - |
|
205 |
in.shop2020.model.v1.order.Attribute attr1 = new in.shop2020.model.v1.order.Attribute();
|
| - |
|
206 |
attr1.setName("Refund_Option");
|
| - |
|
207 |
in.shop2020.model.v1.order.Attribute attr2 = new in.shop2020.model.v1.order.Attribute();
|
| - |
|
208 |
attr2.setName("Refund_Amount");
|
| - |
|
209 |
in.shop2020.model.v1.order.Attribute attr3 = new in.shop2020.model.v1.order.Attribute();
|
| - |
|
210 |
attr3.setName("Refund_TimeStamp");
|
| - |
|
211 |
SimpleDateFormat timestmapFormat = new SimpleDateFormat("dd-MMM-yyyy HH:mm:ss");
|
| - |
|
212 |
attr2.setValue(refundAmount);
|
| - |
|
213 |
attr3.setValue(timestmapFormat.format(Calendar.getInstance().getTime()));
|
| - |
|
214 |
if (RECEIVE_PICKUP_STATE_CHECK.contains(returnOrderInfo.getReturnStatus()) && returnOrderInfo.getReturnTxnResolutionStatus() == ReturnTxnResolutionStatus.QUALITY_CHECK){
|
| - |
|
215 |
if (returnOrderInfo.getReturnAction() == ReturnAction.REPLACEMENT){
|
| 237 |
if (returnOrderInfo.getRefundType() == RefundType.CHEQUE){
|
216 |
if (returnOrderInfo.getRefundType() != RefundType.REPLACEMENT){
|
| - |
|
217 |
setResult("Refund type should be replacement");
|
| - |
|
218 |
return "result";
|
| - |
|
219 |
}
|
| - |
|
220 |
returnOrderInfo.setRefundType(RefundType.REPLACEMENT);
|
| - |
|
221 |
returnOrderInfo.setShippingType(ReplacementShippingType.findByValue(Integer.valueOf(shippingType)));
|
| 238 |
if (chequeDetails == null || chequeDetails.trim().isEmpty()){
|
222 |
if (returnOrderInfo.getShippingType() != ReplacementShippingType.IMMEDIATE){
|
| 239 |
setResult("Cheque details should be filled out");
|
223 |
setResult("Shipping type should be immediate");
|
| 240 |
return "result";
|
224 |
return "result";
|
| 241 |
}
|
225 |
}
|
| 242 |
returnOrderInfo.setRefundType(RefundType.CHEQUE);
|
- |
|
| 243 |
attr1.setValue("Refund By Cheque: "+chequeDetails);
|
- |
|
| 244 |
attrList.add(attr1);
|
- |
|
| 245 |
attrList.add(attr2);
|
- |
|
| 246 |
attrList.add(attr3);
|
- |
|
| 247 |
}
|
226 |
}
|
| - |
|
227 |
else{
|
| - |
|
228 |
if(!(SecurityUtils.getSubject().hasRole("TeamLead"))){
|
| - |
|
229 |
setResult("Admin rights are required to process this operation");
|
| - |
|
230 |
return "result";
|
| - |
|
231 |
}
|
| 248 |
|
232 |
|
| 249 |
if (returnOrderInfo.getRefundType() == RefundType.COUPON){
|
233 |
if (returnOrderInfo.getRefundType() == null){
|
| 250 |
if (couponDetails == null || couponDetails.trim().isEmpty()){
|
- |
|
| 251 |
setResult("Coupon details should be filled out");
|
234 |
setResult("Illegal refund type");
|
| 252 |
return "result";
|
235 |
return "result";
|
| 253 |
}
|
236 |
}
|
| 254 |
attr1.setValue("Refund By Coupon: "+couponDetails);
|
- |
|
| 255 |
attrList.add(attr1);
|
- |
|
| 256 |
attrList.add(attr2);
|
- |
|
| 257 |
attrList.add(attr3);
|
- |
|
| 258 |
returnOrderInfo.setRefundType(RefundType.COUPON);
|
- |
|
| 259 |
}
|
- |
|
| 260 |
|
237 |
|
| - |
|
238 |
if (returnOrderInfo.getRefundType() == RefundType.CHEQUE){
|
| - |
|
239 |
if (chequeDetails == null || chequeDetails.trim().isEmpty()){
|
| - |
|
240 |
setResult("Cheque details should be filled out");
|
| - |
|
241 |
return "result";
|
| - |
|
242 |
}
|
| - |
|
243 |
returnOrderInfo.setRefundType(RefundType.CHEQUE);
|
| - |
|
244 |
attr1.setValue("Refund By Cheque: "+chequeDetails);
|
| - |
|
245 |
attrList.add(attr1);
|
| - |
|
246 |
attrList.add(attr2);
|
| - |
|
247 |
attrList.add(attr3);
|
| - |
|
248 |
}
|
| - |
|
249 |
|
| - |
|
250 |
if (returnOrderInfo.getRefundType() == RefundType.COUPON){
|
| - |
|
251 |
if (couponDetails == null || couponDetails.trim().isEmpty()){
|
| - |
|
252 |
setResult("Coupon details should be filled out");
|
| - |
|
253 |
return "result";
|
| - |
|
254 |
}
|
| - |
|
255 |
attr1.setValue("Refund By Coupon: "+couponDetails);
|
| - |
|
256 |
attrList.add(attr1);
|
| - |
|
257 |
attrList.add(attr2);
|
| - |
|
258 |
attrList.add(attr3);
|
| - |
|
259 |
returnOrderInfo.setRefundType(RefundType.COUPON);
|
| - |
|
260 |
}
|
| - |
|
261 |
|
| 261 |
if (returnOrderInfo.getRefundType() == RefundType.GATEWAY){
|
262 |
if (returnOrderInfo.getRefundType() == RefundType.GATEWAY){
|
| 262 |
returnOrderInfo.setRefundType(RefundType.GATEWAY);
|
263 |
returnOrderInfo.setRefundType(RefundType.GATEWAY);
|
| 263 |
attr1.setValue("Refund By Payment Gatway: "+refundDescription);
|
264 |
attr1.setValue("Refund By Payment Gatway: "+refundDescription);
|
| 264 |
attrList.add(attr2);
|
265 |
attrList.add(attr2);
|
| 265 |
attrList.add(attr3);
|
266 |
attrList.add(attr3);
|
| 266 |
attrList.add(attr1);
|
267 |
attrList.add(attr1);
|
| - |
|
268 |
}
|
| - |
|
269 |
|
| - |
|
270 |
if (Double.valueOf(refundAmount) > returnOrderInfo.getLineitem().getTotal_price()){
|
| - |
|
271 |
setResult("Refund amount can;t be greater than order amount");
|
| - |
|
272 |
return "result";
|
| - |
|
273 |
}
|
| 267 |
}
|
274 |
}
|
| 268 |
|
275 |
|
| 269 |
if (Double.valueOf(refundAmount) > returnOrderInfo.getLineitem().getTotal_price()){
|
276 |
if (refundReason == null || refundReason.trim().isEmpty()){
|
| 270 |
setResult("Refund amount can;t be greater than order amount");
|
277 |
setResult("Refund Reason should be filled out");
|
| 271 |
return "result";
|
278 |
return "result";
|
| 272 |
}
|
279 |
}
|
| 273 |
}
|
- |
|
| 274 |
|
- |
|
| 275 |
if (refundReason == null || refundReason.trim().isEmpty()){
|
- |
|
| 276 |
setResult("Refund Reason should be filled out");
|
- |
|
| 277 |
return "result";
|
- |
|
| 278 |
}
|
- |
|
| 279 |
|
280 |
|
| 280 |
if (refundDescription == null || refundDescription.trim().isEmpty()){
|
281 |
if (refundDescription == null || refundDescription.trim().isEmpty()){
|
| 281 |
setResult("Refund Reason should be filled out");
|
282 |
setResult("Refund Reason should be filled out");
|
| 282 |
return "result";
|
283 |
return "result";
|
| 283 |
}
|
284 |
}
|
| 284 |
|
285 |
|
| 285 |
returnOrderInfo.setRefundReason(refundReason);
|
286 |
returnOrderInfo.setRefundReason(refundReason);
|
| 286 |
returnOrderInfo.setRefundDescription(refundDescription);
|
287 |
returnOrderInfo.setRefundDescription(refundDescription);
|
| 287 |
boolean t_result = transactionServiceClient.refundReturnOrder(returnOrderInfo, attrList);
|
288 |
boolean t_result = transactionServiceClient.refundReturnOrder(returnOrderInfo, attrList);
|
| 288 |
if(t_result){
|
289 |
if(t_result){
|
| 289 |
setResult("Refunded successfully");
|
290 |
setResult("Refunded successfully");
|
| - |
|
291 |
return "result";
|
| - |
|
292 |
}
|
| - |
|
293 |
setResult("Unable to refund or replace");
|
| 290 |
return "result";
|
294 |
return "result";
|
| 291 |
}
|
295 |
}
|
| - |
|
296 |
setResult("Illegal operation");
|
| - |
|
297 |
return "result";
|
| - |
|
298 |
}
|
| - |
|
299 |
catch(Exception e){
|
| - |
|
300 |
e.printStackTrace();
|
| 292 |
setResult("Unable to refund or replace");
|
301 |
setResult("Some exception occured");
|
| 293 |
return "result";
|
302 |
return "result";
|
| 294 |
}
|
303 |
}
|
| 295 |
setResult("Illegal operation");
|
- |
|
| 296 |
return "result";
|
- |
|
| 297 |
}
|
304 |
}
|
| 298 |
|
305 |
|
| 299 |
public String markReturnNotPickedUp() throws TransactionServiceException, TException{
|
306 |
public String markReturnNotPickedUp() throws TransactionServiceException, TException{
|
| 300 |
transactionServiceClient = new TransactionClient().getClient();
|
307 |
transactionServiceClient = new TransactionClient().getClient();
|
| 301 |
returnOrderInfo = transactionServiceClient.getReturnOrderInfo(Long.valueOf(returnOrderId));
|
308 |
returnOrderInfo = transactionServiceClient.getReturnOrderInfo(Long.valueOf(returnOrderId));
|
| Line 962... |
Line 969... |
| 962 |
}
|
969 |
}
|
| 963 |
|
970 |
|
| 964 |
public void setChequeDetails(String chequeDetails) {
|
971 |
public void setChequeDetails(String chequeDetails) {
|
| 965 |
this.chequeDetails = chequeDetails;
|
972 |
this.chequeDetails = chequeDetails;
|
| 966 |
}
|
973 |
}
|
| 967 |
|
974 |
|
| 968 |
public String getShippingType() {
|
975 |
public String getShippingType() {
|
| 969 |
return shippingType;
|
976 |
return shippingType;
|
| 970 |
}
|
977 |
}
|
| 971 |
|
978 |
|
| 972 |
public void setShippingType(String shippingType) {
|
979 |
public void setShippingType(String shippingType) {
|