| Line 173... |
Line 173... |
| 173 |
VelocityContext context = new VelocityContext();
|
173 |
VelocityContext context = new VelocityContext();
|
| 174 |
String templateFile = "templates/orderdetails.vm";
|
174 |
String templateFile = "templates/orderdetails.vm";
|
| 175 |
Order order = null;
|
175 |
Order order = null;
|
| 176 |
Date orderedOn = null, deliveryEstimate = null;
|
176 |
Date orderedOn = null, deliveryEstimate = null;
|
| 177 |
Provider provider = null;
|
177 |
Provider provider = null;
|
| - |
|
178 |
List<Address> addresses = null;
|
| - |
|
179 |
Long defaultAddressId = null;
|
| - |
|
180 |
|
| 178 |
try{
|
181 |
try{
|
| 179 |
TransactionClient transactionServiceClient = new TransactionClient();
|
182 |
TransactionClient transactionServiceClient = new TransactionClient();
|
| 180 |
in.shop2020.model.v1.order.TransactionService.Client orderClient = transactionServiceClient.getClient();
|
183 |
in.shop2020.model.v1.order.TransactionService.Client orderClient = transactionServiceClient.getClient();
|
| 181 |
order = orderClient.getOrderForCustomer(orderId, userId);
|
184 |
order = orderClient.getOrderForCustomer(orderId, userId);
|
| 182 |
orderedOn = new Date(order.getCreated_timestamp());
|
185 |
orderedOn = new Date(order.getCreated_timestamp());
|
| 183 |
deliveryEstimate = new Date(order.getExpected_delivery_time());
|
186 |
deliveryEstimate = new Date(order.getExpected_delivery_time());
|
| 184 |
|
187 |
|
| - |
|
188 |
in.shop2020.model.v1.user.UserContextService.Client userClient = new UserClient().getClient();
|
| - |
|
189 |
addresses = userClient.getAllAddressesForUser(userId);
|
| - |
|
190 |
defaultAddressId = userClient.getDefaultAddressId(userId);
|
| - |
|
191 |
logger.info("Found addresses: " + addresses + " for userId: " + userId);
|
| - |
|
192 |
|
| 185 |
if(order.getLogistics_provider_id() != 0){
|
193 |
if(order.getLogistics_provider_id() != 0){
|
| 186 |
LogisticsClient logisticsServiceClient = new LogisticsClient();
|
194 |
LogisticsClient logisticsServiceClient = new LogisticsClient();
|
| 187 |
in.shop2020.logistics.LogisticsService.Client logisticsClient = logisticsServiceClient.getClient();
|
195 |
in.shop2020.logistics.LogisticsService.Client logisticsClient = logisticsServiceClient.getClient();
|
| 188 |
provider = logisticsClient.getProvider(order.getLogistics_provider_id());
|
196 |
provider = logisticsClient.getProvider(order.getLogistics_provider_id());
|
| 189 |
}
|
197 |
}
|
| Line 191... |
Line 199... |
| 191 |
|
199 |
|
| 192 |
}
|
200 |
}
|
| 193 |
|
201 |
|
| 194 |
SimpleDateFormat dateformat = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss aa");
|
202 |
SimpleDateFormat dateformat = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss aa");
|
| 195 |
SimpleDateFormat dateformat1 = new SimpleDateFormat("dd/MM/yyyy");
|
203 |
SimpleDateFormat dateformat1 = new SimpleDateFormat("dd/MM/yyyy");
|
| - |
|
204 |
|
| 196 |
context.put("order", order);
|
205 |
context.put("order", order);
|
| 197 |
context.put("orderedOn", dateformat.format(orderedOn));
|
206 |
context.put("orderedOn", dateformat.format(orderedOn));
|
| 198 |
context.put("deliveryEstimate", dateformat1.format(deliveryEstimate));
|
207 |
context.put("deliveryEstimate", dateformat1.format(deliveryEstimate));
|
| - |
|
208 |
context.put("addresses", addresses);
|
| - |
|
209 |
context.put("defaultAddressId", defaultAddressId);
|
| - |
|
210 |
|
| 199 |
if(provider!=null){
|
211 |
if(provider!=null){
|
| 200 |
context.put("providerName", provider.getName());
|
212 |
context.put("providerName", provider.getName());
|
| 201 |
}
|
213 |
}
|
| 202 |
|
214 |
|
| 203 |
htmlString = getHtmlFromVelocity(templateFile, context);
|
215 |
htmlString = getHtmlFromVelocity(templateFile, context);
|