Subversion Repositories SmartDukaan

Rev

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

Rev 3125 Rev 3166
Line 87... Line 87...
87
    public ByteArrayOutputStream generatePaymentDetailsReport(Date startDate, Date endDate, int status) {
87
    public ByteArrayOutputStream generatePaymentDetailsReport(Date startDate, Date endDate, int status) {
88
 
88
 
89
        // Retrieving all the payments between start and end dates with status
89
        // Retrieving all the payments between start and end dates with status
90
        // as FAILED or INIT and for gateway Id = 1 (HDFC)
90
        // as FAILED or INIT and for gateway Id = 1 (HDFC)
91
        List<Payment> payments = null;
91
        List<Payment> payments = null;
-
 
92
        List<Payment> authorizedPayments = null;
92
        List<Payment> pendingPayments = null;
93
        List<Payment> pendingPayments = null;
93
        try {
94
        try {
94
            if(status == 0) {
95
            if(status == 0) {
95
                payments = pClient.getPayments(startDate.getTime(), endDate.getTime(), PaymentStatus.SUCCESS, 0);
96
                payments = pClient.getPayments(startDate.getTime(), endDate.getTime(), PaymentStatus.SUCCESS, 0);
-
 
97
                authorizedPayments = pClient.getPayments(startDate.getTime(), endDate.getTime(), PaymentStatus.AUTHORIZED, 0);
-
 
98
                if(payments != null && authorizedPayments != null) {
-
 
99
                    payments.addAll(authorizedPayments);
-
 
100
                } else if(authorizedPayments != null){
-
 
101
                    payments = authorizedPayments;
-
 
102
                }
96
            } else {
103
            } else {
97
                payments = pClient.getPayments(startDate.getTime(), endDate.getTime(), PaymentStatus.FAILED, 0);
104
                payments = pClient.getPayments(startDate.getTime(), endDate.getTime(), PaymentStatus.FAILED, 0);
98
                pendingPayments = pClient.getPayments(startDate.getTime(), endDate.getTime(), PaymentStatus.INIT, 0);
105
                pendingPayments = pClient.getPayments(startDate.getTime(), endDate.getTime(), PaymentStatus.INIT, 0);
99
                if (payments != null && pendingPayments != null) {
106
                if(payments != null && pendingPayments != null) {
100
                    payments.addAll(pendingPayments);
107
                    payments.addAll(pendingPayments);
101
                } else if (pendingPayments != null){
108
                } else if(pendingPayments != null){
102
                    payments = pendingPayments;
109
                    payments = pendingPayments;
103
                }
110
                }
104
            }
111
            }
105
        } catch (PaymentException e) {
112
        } catch (PaymentException e) {
106
            logger.error("Error in payment service while getting payments", e);
113
            logger.error("Error in payment service while getting payments", e);