| Line 28... |
Line 28... |
| 28 |
import in.shop2020.model.v1.order.ProductCondition;
|
28 |
import in.shop2020.model.v1.order.ProductCondition;
|
| 29 |
import in.shop2020.model.v1.order.Transaction;
|
29 |
import in.shop2020.model.v1.order.Transaction;
|
| 30 |
import in.shop2020.model.v1.order.TransactionService.Client;
|
30 |
import in.shop2020.model.v1.order.TransactionService.Client;
|
| 31 |
import in.shop2020.model.v1.order.TransactionServiceException;
|
31 |
import in.shop2020.model.v1.order.TransactionServiceException;
|
| 32 |
import in.shop2020.model.v1.order.TransactionStatus;
|
32 |
import in.shop2020.model.v1.order.TransactionStatus;
|
| - |
|
33 |
import in.shop2020.model.v1.user.Address;
|
| 33 |
import in.shop2020.model.v1.user.ItemPriceQuantity;
|
34 |
import in.shop2020.model.v1.user.ItemPriceQuantity;
|
| 34 |
import in.shop2020.model.v1.user.ShoppingCartException;
|
35 |
import in.shop2020.model.v1.user.ShoppingCartException;
|
| 35 |
import in.shop2020.model.v1.user.User;
|
36 |
import in.shop2020.model.v1.user.User;
|
| 36 |
import in.shop2020.payments.Attribute;
|
37 |
import in.shop2020.payments.Attribute;
|
| 37 |
import in.shop2020.payments.Payment;
|
38 |
import in.shop2020.payments.Payment;
|
| Line 73... |
Line 74... |
| 73 |
private int productCondition;
|
74 |
private int productCondition;
|
| 74 |
private Transaction transaction;
|
75 |
private Transaction transaction;
|
| 75 |
private Payment payment;
|
76 |
private Payment payment;
|
| 76 |
private long userWalletAmount;
|
77 |
private long userWalletAmount;
|
| 77 |
private int userId;
|
78 |
private int userId;
|
| - |
|
79 |
private List<Address> userAddresses;
|
| - |
|
80 |
private int addressId;
|
| 78 |
|
81 |
|
| 79 |
private Map<Transaction, Double> transactions;
|
82 |
private Map<Transaction, Double> transactions;
|
| 80 |
private List<LineItem> lineItems;
|
83 |
private List<LineItem> lineItems;
|
| 81 |
|
84 |
|
| 82 |
private Client transactionClient;
|
85 |
private Client transactionClient;
|
| Line 90... |
Line 93... |
| 90 |
|
93 |
|
| 91 |
public String editNew() throws Throwable {
|
94 |
public String editNew() throws Throwable {
|
| 92 |
this.userClient = new UserClient().getClient();
|
95 |
this.userClient = new UserClient().getClient();
|
| 93 |
this.transactionClient = new TransactionClient().getClient();
|
96 |
this.transactionClient = new TransactionClient().getClient();
|
| 94 |
User user = userClient.getUserByEmail(customerEmailId);
|
97 |
User user = userClient.getUserByEmail(customerEmailId);
|
| - |
|
98 |
List<Address> addresses = this.userClient.getAllAddressesForUser(user.getUserId());
|
| - |
|
99 |
this.setUserAddresses(addresses);
|
| 95 |
this.userWalletAmount = this.transactionClient.getUserWallet(user.getUserId()).getAmount();
|
100 |
this.userWalletAmount = this.transactionClient.getUserWallet(user.getUserId()).getAmount();
|
| 96 |
return "editNew";
|
101 |
return "editNew";
|
| 97 |
}
|
102 |
}
|
| 98 |
|
103 |
|
| 99 |
public String show() throws Throwable {
|
104 |
public String show() throws Throwable {
|
| Line 115... |
Line 120... |
| 115 |
log.error("Could not lookup payment for transaction Id: " + transactionId, e);
|
120 |
log.error("Could not lookup payment for transaction Id: " + transactionId, e);
|
| 116 |
}
|
121 |
}
|
| 117 |
|
122 |
|
| 118 |
return "show";
|
123 |
return "show";
|
| 119 |
}
|
124 |
}
|
| - |
|
125 |
|
| - |
|
126 |
|
| - |
|
127 |
|
| 120 |
|
128 |
|
| 121 |
public String create() throws Throwable {
|
129 |
public String create() throws Throwable {
|
| 122 |
this.userClient = new UserClient().getClient();
|
130 |
this.userClient = new UserClient().getClient();
|
| 123 |
this.paymentClient = new PaymentClient().getClient();
|
131 |
this.paymentClient = new PaymentClient().getClient();
|
| 124 |
this.transactionClient = new TransactionClient().getClient();
|
132 |
this.transactionClient = new TransactionClient().getClient();
|
| Line 147... |
Line 155... |
| 147 |
}
|
155 |
}
|
| 148 |
if (totalAmount > walletAmount) {
|
156 |
if (totalAmount > walletAmount) {
|
| 149 |
addActionError("Total Amount not be greater than wallet amount");
|
157 |
addActionError("Total Amount not be greater than wallet amount");
|
| 150 |
} else if (!this.userClient.addItemPricingToCart(user.getActiveCartId(), ipqList)) {
|
158 |
} else if (!this.userClient.addItemPricingToCart(user.getActiveCartId(), ipqList)) {
|
| 151 |
addActionError("Failed to add pricing to cart, please try again");
|
159 |
addActionError("Failed to add pricing to cart, please try again");
|
| 152 |
} else if (user.getDefaultAddressId() == 0) {
|
160 |
} else if (this.addressId == 0 && user.getDefaultAddressId() == 0) {
|
| 153 |
addActionError("Please make sure default address is set");
|
161 |
addActionError("Please make sure default address is set");
|
| 154 |
} else {
|
162 |
} else {
|
| 155 |
log.info("Setting wallet amount in cart");
|
163 |
log.info("Setting wallet amount in cart");
|
| 156 |
this.userClient.addAddressToCart(user.getActiveCartId(), user.getDefaultAddressId());
|
164 |
this.userClient.addAddressToCart(user.getActiveCartId(), user.getDefaultAddressId());
|
| 157 |
this.userClient.setWalletAmountInCart(user.getActiveCartId(), totalAmount);
|
165 |
this.userClient.setWalletAmountInCart(user.getActiveCartId(), totalAmount);
|
| Line 460... |
Line 468... |
| 460 |
|
468 |
|
| 461 |
public double getWalletAmount() {
|
469 |
public double getWalletAmount() {
|
| 462 |
return this.userWalletAmount;
|
470 |
return this.userWalletAmount;
|
| 463 |
}
|
471 |
}
|
| 464 |
|
472 |
|
| - |
|
473 |
public List<Address> getUserAddresses() {
|
| - |
|
474 |
return userAddresses;
|
| - |
|
475 |
}
|
| - |
|
476 |
|
| - |
|
477 |
public void setUserAddresses(List<Address> userAddresses) {
|
| - |
|
478 |
this.userAddresses = userAddresses;
|
| - |
|
479 |
}
|
| - |
|
480 |
|
| 465 |
}
|
481 |
}
|