Subversion Repositories SmartDukaan

Rev

Rev 2340 | Rev 2393 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2340 Rev 2345
Line 88... Line 88...
88
                    contentRow.put("affiliate", aff.getName());
88
                    contentRow.put("affiliate", aff.getName());
89
                    contentRow.put("affiliateUrl", aff.getUrl());
89
                    contentRow.put("affiliateUrl", aff.getUrl());
90
                    contentRow.put("date",String.valueOf(tracklog.getAddedOn()));
90
                    contentRow.put("date",String.valueOf(tracklog.getAddedOn()));
91
                    contentRow.put("event", tracklog.getEvent());
91
                    contentRow.put("event", tracklog.getEvent());
92
                    contentRow.put("url", tracklog.getUrl());
92
                    contentRow.put("url", tracklog.getUrl());
93
                    if (tracklog.getEvent() == "payment success") {
93
                    if (tracklog.getEvent().equals("payment success")) {
94
                        try {
94
                        try {
95
                            long paymentId = Long.parseLong(tracklog.getData()
95
                            long paymentId = Long.parseLong(tracklog.getData().replaceAll("\\(*\\)", ""));
96
                                    .substring(0,
-
 
97
                                            tracklog.getData().indexOf('(')));
-
 
98
                            Payment payment = paymentClient
96
                            Payment payment = paymentClient
99
                                    .getPayment(paymentId);
97
                                    .getPayment(paymentId);
100
                            List<Order> orders = transactionServiceClient
98
                            List<Order> orders = transactionServiceClient
101
                                    .getClient().getOrdersForTransaction(
99
                                    .getClient().getOrdersForTransaction(
102
                                            payment.getMerchantTxnId(),
100
                                            payment.getMerchantTxnId(),
103
                                            payment.getUserId());
101
                                            payment.getUserId());
104
                            contentRow.put("amount",
102
                            contentRow.put("amount",
105
                                    Double.toString(payment.getAmount()));
103
                                    Double.toString(payment.getAmount()));
-
 
104
                            String itemString = "";
106
                            for (Order order : orders) {
105
                            for (Order order : orders) {
107
                                List<LineItem> items = order.getLineitems();
106
                                List<LineItem> items = order.getLineitems();
108
                                String itemString = "";
-
 
109
                                for (LineItem item : items) {
107
                                for (LineItem item : items) {
110
                                    itemString += item.getBrand() + " "
108
                                    itemString += item.getBrand() + " "
111
                                            + item.getModel_name() + " "
109
                                            + item.getModel_name() + " "
112
                                            + item.getModel_number() + "("
110
                                            + item.getModel_number() + "("
113
                                            + item.getQuantity() + ", "
111
                                            + item.getQuantity() + ", "
114
                                            + item.getTotal_price() + "), ";
112
                                            + item.getTotal_price() + "), ";
115
                                }
113
                                }
116
                                contentRow.put("items", itemString);
114
                                contentRow.put("items", itemString.replaceAll("null", ""));
117
                            }
115
                            }
118
                        } catch (Exception e) {
116
                        } catch (Exception e) {
119
                            e.printStackTrace();
117
                            e.printStackTrace();
120
                        }
118
                        }
121
                    }
119
                    }