Subversion Repositories SmartDukaan

Rev

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

Rev 2345 Rev 2393
Line 15... Line 15...
15
import java.io.ByteArrayOutputStream;
15
import java.io.ByteArrayOutputStream;
16
import java.io.IOException;
16
import java.io.IOException;
17
import java.text.ParseException;
17
import java.text.ParseException;
18
import java.util.Date;
18
import java.util.Date;
19
import java.util.HashMap;
19
import java.util.HashMap;
-
 
20
import java.util.HashSet;
20
import java.util.LinkedList;
21
import java.util.LinkedList;
21
import java.util.List;
22
import java.util.List;
22
import java.util.Map;
23
import java.util.Map;
-
 
24
import java.util.Set;
23
 
25
 
24
import javax.servlet.ServletOutputStream;
26
import javax.servlet.ServletOutputStream;
25
import javax.servlet.http.HttpServletRequest;
27
import javax.servlet.http.HttpServletRequest;
26
import javax.servlet.http.HttpServletResponse;
28
import javax.servlet.http.HttpServletResponse;
27
 
29
 
Line 76... Line 78...
76
            
78
            
77
            Client userClient = userContextServiceClient.getClient();
79
            Client userClient = userContextServiceClient.getClient();
78
            in.shop2020.payments.PaymentService.Client paymentClient = paymentServiceClient.getClient();
80
            in.shop2020.payments.PaymentService.Client paymentClient = paymentServiceClient.getClient();
79
            in.shop2020.model.v1.order.TransactionService.Client transactionClient = transactionServiceClient.getClient();
81
            in.shop2020.model.v1.order.TransactionService.Client transactionClient = transactionServiceClient.getClient();
80
            
82
            
81
            
83
            Set<Long> Payments = new HashSet<Long>();
82
            List<Map<String, String>> contentRows = new LinkedList<Map<String,String>>(); 
84
            List<Map<String, String>> contentRows = new LinkedList<Map<String,String>>(); 
83
            MasterAffiliate mAffiliate = userClient.getMasterAffiliateById(mAfId);
85
            MasterAffiliate mAffiliate = userClient.getMasterAffiliateById(mAfId);
84
            for (Affiliate aff : userClient.getAffiliatesByMasterAffiliate(mAfId)) {
86
            for (Affiliate aff : userClient.getAffiliatesByMasterAffiliate(mAfId)) {
85
                for (TrackLog tracklog : userClient.getTrackLogsByAffiliate(aff.getId())) {
87
                for (TrackLog tracklog : userClient.getTrackLogsByAffiliate(aff.getId())) {
86
                    Map<String, String> contentRow = new HashMap<String, String>();
88
                    Map<String, String> contentRow = new HashMap<String, String>();
Line 91... Line 93...
91
                    contentRow.put("event", tracklog.getEvent());
93
                    contentRow.put("event", tracklog.getEvent());
92
                    contentRow.put("url", tracklog.getUrl());
94
                    contentRow.put("url", tracklog.getUrl());
93
                    if (tracklog.getEvent().equals("payment success")) {
95
                    if (tracklog.getEvent().equals("payment success")) {
94
                        try {
96
                        try {
95
                            long paymentId = Long.parseLong(tracklog.getData().replaceAll("\\(*\\)", ""));
97
                            long paymentId = Long.parseLong(tracklog.getData().replaceAll("\\(*\\)", ""));
-
 
98
                            if (Payments.contains(paymentId)) {
-
 
99
                                continue;
-
 
100
                            }
-
 
101
                            Payments.add(paymentId);
96
                            Payment payment = paymentClient
102
                            Payment payment = paymentClient
97
                                    .getPayment(paymentId);
103
                                    .getPayment(paymentId);
98
                            List<Order> orders = transactionServiceClient
104
                            List<Order> orders = transactionServiceClient
99
                                    .getClient().getOrdersForTransaction(
105
                                    .getClient().getOrdersForTransaction(
100
                                            payment.getMerchantTxnId(),
106
                                            payment.getMerchantTxnId(),