| Line 13... |
Line 13... |
| 13 |
import in.shop2020.model.v1.catalog.CatalogServiceException;
|
13 |
import in.shop2020.model.v1.catalog.CatalogServiceException;
|
| 14 |
import in.shop2020.model.v1.catalog.Item;
|
14 |
import in.shop2020.model.v1.catalog.Item;
|
| 15 |
import in.shop2020.model.v1.order.LineItem;
|
15 |
import in.shop2020.model.v1.order.LineItem;
|
| 16 |
import in.shop2020.model.v1.order.Order;
|
16 |
import in.shop2020.model.v1.order.Order;
|
| 17 |
import in.shop2020.model.v1.order.OrderStatus;
|
17 |
import in.shop2020.model.v1.order.OrderStatus;
|
| - |
|
18 |
import in.shop2020.model.v1.order.StoreOrderDetail;
|
| 18 |
import in.shop2020.model.v1.order.TransactionServiceException;
|
19 |
import in.shop2020.model.v1.order.TransactionServiceException;
|
| 19 |
import in.shop2020.model.v1.user.Address;
|
20 |
import in.shop2020.model.v1.user.Address;
|
| 20 |
import in.shop2020.model.v1.user.UserContextException;
|
21 |
import in.shop2020.model.v1.user.UserContextException;
|
| 21 |
import in.shop2020.payments.Attribute;
|
22 |
import in.shop2020.payments.Attribute;
|
| 22 |
import in.shop2020.payments.Constants;
|
23 |
import in.shop2020.payments.Constants;
|
| Line 96... |
Line 97... |
| 96 |
private String pin;
|
97 |
private String pin;
|
| 97 |
private String freebieItem;
|
98 |
private String freebieItem;
|
| 98 |
private String dealText;
|
99 |
private String dealText;
|
| 99 |
private String parentOrderIdForFreebieOrder;
|
100 |
private String parentOrderIdForFreebieOrder;
|
| 100 |
private String freebieOrderId;
|
101 |
private String freebieOrderId;
|
| - |
|
102 |
private double cashAmount;
|
| - |
|
103 |
private double cardAmount;
|
| - |
|
104 |
private StoreOrderDetail storeOrderDetail;
|
| 101 |
|
105 |
|
| 102 |
public UserOrderInfoController() {
|
106 |
public UserOrderInfoController() {
|
| 103 |
super();
|
107 |
super();
|
| 104 |
setOfcancellableStates = new HashSet<OrderStatus>();
|
108 |
setOfcancellableStates = new HashSet<OrderStatus>();
|
| 105 |
setOfcancellableStates.add(OrderStatus.SUBMITTED_FOR_PROCESSING);
|
109 |
setOfcancellableStates.add(OrderStatus.SUBMITTED_FOR_PROCESSING);
|
| Line 115... |
Line 119... |
| 115 |
try {
|
119 |
try {
|
| 116 |
PaymentClient paymentServiceClient = new PaymentClient();
|
120 |
PaymentClient paymentServiceClient = new PaymentClient();
|
| 117 |
TransactionClient transactionServiceClient = new TransactionClient();
|
121 |
TransactionClient transactionServiceClient = new TransactionClient();
|
| 118 |
|
122 |
|
| 119 |
order = transactionServiceClient.getClient().getOrder(orderId);
|
123 |
order = transactionServiceClient.getClient().getOrder(orderId);
|
| - |
|
124 |
if(order.getSource() == 2) {
|
| - |
|
125 |
storeOrderDetail = transactionServiceClient.getClient().getStoreOrderDetail(order.getId(),order.getStoreId());
|
| - |
|
126 |
setCashAmount(storeOrderDetail.getCashAmount());
|
| - |
|
127 |
setCardAmount(storeOrderDetail.getCardAmount());
|
| - |
|
128 |
}
|
| 120 |
if(order.getFreebieItemId()>0) {
|
129 |
if(order.getFreebieItemId()>0) {
|
| 121 |
CatalogService.Client catalogClient = new CatalogClient().getClient();
|
130 |
CatalogService.Client catalogClient = new CatalogClient().getClient();
|
| 122 |
Item item = catalogClient.getItem(order.getFreebieItemId());
|
131 |
Item item = catalogClient.getItem(order.getFreebieItemId());
|
| 123 |
freebieItem = item.getBrand() + " " + item.getModelName() + " " + item.getModelNumber() + " " + item.getColor();
|
132 |
freebieItem = item.getBrand() + " " + item.getModelName() + " " + item.getModelNumber() + " " + item.getColor();
|
| 124 |
}
|
133 |
}
|
| Line 220... |
Line 229... |
| 220 |
try{
|
229 |
try{
|
| 221 |
TransactionClient transactionServiceClient = new TransactionClient();
|
230 |
TransactionClient transactionServiceClient = new TransactionClient();
|
| 222 |
log.info("URL = " + request.getRequestURI());
|
231 |
log.info("URL = " + request.getRequestURI());
|
| 223 |
log.info("Initiator = " + request.getParameter("cancellationInitiator"));
|
232 |
log.info("Initiator = " + request.getParameter("cancellationInitiator"));
|
| 224 |
log.info("orderId = " + request.getParameter("orderId"));
|
233 |
log.info("orderId = " + request.getParameter("orderId"));
|
| - |
|
234 |
|
| - |
|
235 |
order = transactionServiceClient.getClient().getOrder(orderId);
|
| - |
|
236 |
|
| - |
|
237 |
if (order.getSource() == 2) {
|
| - |
|
238 |
String plainTextbody = "";
|
| - |
|
239 |
if(body!=null && !body.isEmpty()){
|
| - |
|
240 |
plainTextbody = new Source(body).getTextExtractor().toString();
|
| - |
|
241 |
}
|
| - |
|
242 |
transactionServiceClient.getClient().saveRefundAmountsForStoreOrder(orderId, order.getStoreId(), cashAmount, cardAmount);
|
| - |
|
243 |
transactionServiceClient.getClient().refundOrder(orderId, currentAgentEmailId, cancelReason + " : " + plainTextbody);
|
| - |
|
244 |
}
|
| - |
|
245 |
|
| 225 |
if (cancellationInitiator.equals("CUSTOMER")) {
|
246 |
if (cancellationInitiator.equals("CUSTOMER")) {
|
| 226 |
order = transactionServiceClient.getClient().getOrder(orderId);
|
- |
|
| 227 |
transactionServiceClient.getClient().markOrderCancellationRequestReceived(orderId);
|
247 |
transactionServiceClient.getClient().markOrderCancellationRequestReceived(orderId);
|
| 228 |
long creatorId = CRMAuthorizingRealm.getAgent(currentAgentEmailId).getId();
|
248 |
long creatorId = CRMAuthorizingRealm.getAgent(currentAgentEmailId).getId();
|
| 229 |
Ticket ticket = new Ticket();
|
249 |
Ticket ticket = new Ticket();
|
| 230 |
String plainTextbody = "";
|
250 |
String plainTextbody = "";
|
| 231 |
if(body!=null && !body.isEmpty()){
|
251 |
if(body!=null && !body.isEmpty()){
|
| Line 638... |
Line 658... |
| 638 |
|
658 |
|
| 639 |
public void setFreebieOrderId(String freebieOrderId) {
|
659 |
public void setFreebieOrderId(String freebieOrderId) {
|
| 640 |
this.freebieOrderId = freebieOrderId;
|
660 |
this.freebieOrderId = freebieOrderId;
|
| 641 |
}
|
661 |
}
|
| 642 |
|
662 |
|
| - |
|
663 |
public void setCashAmount(double cashAmount) {
|
| - |
|
664 |
this.cashAmount = cashAmount;
|
| - |
|
665 |
}
|
| - |
|
666 |
|
| - |
|
667 |
public double getCashAmount() {
|
| - |
|
668 |
return cashAmount;
|
| - |
|
669 |
}
|
| - |
|
670 |
|
| - |
|
671 |
public void setCardAmount(double cardAmount) {
|
| - |
|
672 |
this.cardAmount = cardAmount;
|
| - |
|
673 |
}
|
| - |
|
674 |
|
| - |
|
675 |
public double getCardAmount() {
|
| - |
|
676 |
return cardAmount;
|
| - |
|
677 |
}
|
| - |
|
678 |
|
| - |
|
679 |
public long getOrderId() {
|
| - |
|
680 |
return orderId;
|
| - |
|
681 |
}
|
| - |
|
682 |
|
| - |
|
683 |
public void setOrderId(long orderId) {
|
| - |
|
684 |
this.orderId = orderId;
|
| - |
|
685 |
}
|
| - |
|
686 |
|
| - |
|
687 |
public StoreOrderDetail getStoreOrderDetail() {
|
| - |
|
688 |
return storeOrderDetail;
|
| - |
|
689 |
}
|
| - |
|
690 |
|
| - |
|
691 |
public void setStoreOrderDetail(StoreOrderDetail storeOrderDetail) {
|
| - |
|
692 |
this.storeOrderDetail = storeOrderDetail;
|
| - |
|
693 |
}
|
| - |
|
694 |
|
| 643 |
}
|
695 |
}
|
| 644 |
|
696 |
|