Subversion Repositories SmartDukaan

Rev

Rev 8488 | Rev 8650 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1946 chandransh 1
package in.shop2020.payment.service.handler;
2
 
6050 anupam.sin 3
import in.shop2020.model.v1.order.RechargeOrder;
3578 mandeep.dh 4
import in.shop2020.payment.domain.Refund;
5
import in.shop2020.payment.handler.PaymentGatewayHandler;
6
import in.shop2020.payment.handler.PaymentHandler;
4008 mandeep.dh 7
import in.shop2020.payment.handler.PaymentRequiringExtraProcessingHandler;
3578 mandeep.dh 8
import in.shop2020.payment.handler.RefundHandler;
9
import in.shop2020.payments.Attribute;
4008 mandeep.dh 10
import in.shop2020.payments.ExtraPaymentProcessingType;
3578 mandeep.dh 11
import in.shop2020.payments.Payment;
12
import in.shop2020.payments.PaymentException;
13
import in.shop2020.payments.PaymentGateway;
14
import in.shop2020.payments.PaymentService.Iface;
15
import in.shop2020.payments.PaymentStatus;
6050 anupam.sin 16
import in.shop2020.thrift.clients.TransactionClient;
3578 mandeep.dh 17
 
3010 chandransh 18
import java.text.SimpleDateFormat;
1946 chandransh 19
import java.util.ArrayList;
6448 rajveer 20
import java.util.Arrays;
1946 chandransh 21
import java.util.Date;
22
import java.util.HashMap;
23
import java.util.List;
24
import java.util.Map;
25
 
8618 rajveer 26
import org.apache.commons.logging.Log;
27
import org.apache.commons.logging.LogFactory;
1946 chandransh 28
import org.apache.thrift.TException;
29
import org.springframework.context.ApplicationContext;
30
import org.springframework.context.support.ClassPathXmlApplicationContext;
31
 
32
public class PaymentServiceHandler implements Iface {
3010 chandransh 33
 
8618 rajveer 34
    private static final Log logger = LogFactory.getLog(PaymentServiceHandler.class);
35
 
3010 chandransh 36
 
37
    /**
38
     * Enum of all statuses that can be returned by the HDFC gateway
39
     * 
40
     * @author Chandranshu
41
     * 
42
     */
43
    private enum HdfcPaymentReturnStatus{
44
        APPROVED("APPROVED"),
45
        NOT_APPROVED("NOT APPROVED"),
46
        CAPTURED("CAPTURED"),
47
        NOT_CAPTURED ("NOT CAPTURED"),
48
        CANCELLED ("CANCELLED"),
49
        DENIED_BY_RISK("DENIED BY RISK"),
50
        HOST_TIMEOUT("HOST TIMEOUT");
51
        private String value;
52
        HdfcPaymentReturnStatus(String value) {
53
            this.value = value;
54
        }
55
        public String value(){
56
            return this.value;
57
        }
58
    }
59
 
2391 chandransh 60
	public static final long PAYMENT_NOT_CREATED = -1;
61
 
3010 chandransh 62
	private static final long HDFC_GATEWAY_ID = 1;
63
	private static final long EBS_GATEWAY_ID = 2;
8208 amar.kumar 64
	private static final long EBAY_GATEWAY_ID = 16;
8488 amar.kumar 65
	private static final long SNAPDEAL_GATEWAY_ID = 18;
7042 amar.kumar 66
	private static final List<Long> HDFC_EMI_GATEWAY_IDS = Arrays.asList(5L,10L,11L,12L,14L);
3010 chandransh 67
 
4651 rajveer 68
	ApplicationContext context = new ClassPathXmlApplicationContext("context.xml");
1946 chandransh 69
	PaymentHandler paymentHandler = (PaymentHandler) context.getBean("paymentHandler");
4008 mandeep.dh 70
    PaymentRequiringExtraProcessingHandler paymentRequiringExtraProcessingHandler =
71
        (PaymentRequiringExtraProcessingHandler) context.getBean("paymentRequiringExtraProcessingHandler");
72
 
73
    PaymentGatewayHandler paymentGatewayHandler = (PaymentGatewayHandler) context.getBean("paymentGatewayHandler");
2747 chandransh 74
	RefundHandler refundHandler = (RefundHandler) context.getBean("refundHandler");
1946 chandransh 75
 
4651 rajveer 76
	public void setDataSourceUrl(String dbHost){
77
		org.apache.commons.dbcp.BasicDataSource ds = (org.apache.commons.dbcp.BasicDataSource)context.getBean("dataSource");
78
		ds.setUrl(dbHost);
79
	}
80
 
81
	public String getDataSourceUrl(){
82
		org.apache.commons.dbcp.BasicDataSource ds = (org.apache.commons.dbcp.BasicDataSource)context.getBean("dataSource");
83
		return ds.getUrl();
84
	}
85
 
1946 chandransh 86
	@Override
6050 anupam.sin 87
	public long createPayment(long userId, double amount, long gatewayId, long txnId, boolean isDigital) throws PaymentException, TException {
3010 chandransh 88
	    logger.info("Creating payment corresponding to our txn id:" + txnId);
1946 chandransh 89
		in.shop2020.payment.domain.Payment payment = new in.shop2020.payment.domain.Payment();
90
		payment.setUserId(userId);
91
		payment.setAmount(amount);
92
		payment.setGatewayId(gatewayId);
93
		payment.setMerchantTxnId(txnId);
94
		payment.setStatus(PaymentStatus.INIT.getValue());
6050 anupam.sin 95
		payment.setDigital(isDigital);
1946 chandransh 96
 
97
		return paymentHandler.insertPayment(payment);
98
	}
99
 
100
	@Override
101
	public List<Payment> getPaymentsForUser(long userId, long fromTime, long toTime, PaymentStatus status, long gatewayId) throws PaymentException, TException {
3010 chandransh 102
	    logger.info("Getting payments from " + fromTime + " to " + toTime + " for user: " + userId);
2291 chandransh 103
		int statusValue = -1;
104
		if(status != null)
105
			statusValue = status.getValue();
106
		else
107
			statusValue = -1;
108
		return getThriftPayments(paymentHandler.getPaymentsForUser(userId, fromTime, toTime, statusValue, gatewayId));
1946 chandransh 109
	}
110
 
111
	@Override
112
	public List<Payment> getPayments(long fromTime, long toTime, PaymentStatus status, long gatewayId) throws PaymentException,	TException {
3010 chandransh 113
	    logger.info("Getting payments from " + fromTime + " to " + toTime);
2291 chandransh 114
		int statusValue = -1;
115
		if(status != null)
116
			statusValue = status.getValue();
117
		else
118
			statusValue = -1;
119
		return getThriftPayments(paymentHandler.getPayments(fromTime, toTime, statusValue, gatewayId));
1946 chandransh 120
	}
4141 chandransh 121
 
122
	@Override
123
	public List<Payment> getPaymentsByCapturedDate(long fromTime, long toTime, long gatewayId) throws PaymentException, TException {
124
		logger.info("Getting payments from " + fromTime + " to " + toTime + " for " + gatewayId);
125
		return getThriftPayments(paymentHandler.getPaymentsByCapturedDate(fromTime, toTime, gatewayId));
126
	}
1946 chandransh 127
 
128
	@Override
129
	public PaymentGateway getPaymentGateway(long id) throws PaymentException, TException {
3010 chandransh 130
	    logger.info("Getting payment gateway with id:" + id);
2291 chandransh 131
		return paymentGatewayHandler.getPaymentGateway(id).getThriftPaymentGateway();
1946 chandransh 132
	}
4600 varun.gupt 133
 
1946 chandransh 134
	@Override
4600 varun.gupt 135
	public List<PaymentGateway> getActivePaymentGateways() throws PaymentException, TException {
136
	    logger.info("Getting all active payment gateways");
137
	    return getThriftPaymentGateways(paymentGatewayHandler.getActivePaymentGateways());
138
	}
139
 
140
	@Override
1946 chandransh 141
	public Payment getPayment(long id) throws PaymentException, TException {
3010 chandransh 142
	    logger.info("Getting payment with id: " + id);
1946 chandransh 143
		return paymentHandler.getPayment(id).getThriftPayment();
144
	}
145
 
146
	@Override
147
	public List<Payment> getPaymentForTxnId(long txnId) throws PaymentException, TException {
3010 chandransh 148
	    logger.info("Getting payment for the txn id: " + txnId);
1946 chandransh 149
		return getThriftPayments(paymentHandler.getPaymentForTxn(txnId));
150
	}
4600 varun.gupt 151
 
152
	@Override
7049 anupam.sin 153
    public List<Payment> getPaymentForRechargeTxnId(long txnId) throws PaymentException, TException {
154
        logger.info("Getting payment for the txn id: " + txnId);
155
        return getThriftPayments(paymentHandler.getPaymentForRechargeTxn(txnId));
156
    }
157
 
158
	@Override
4600 varun.gupt 159
	public Payment getSuccessfulPaymentForTxnId(long txnId) throws PaymentException, TException {
160
 
161
		for (Payment payment: getPaymentForTxnId(txnId))	{
162
			if (payment.getStatus() == PaymentStatus.SUCCESS || payment.getStatus() == PaymentStatus.PARTIALLY_CAPTURED)	{
163
				return payment;
164
			}
165
		}
166
		return null;
167
	}
1946 chandransh 168
 
169
	@Override
170
	public boolean updatePaymentDetails(long id, String gatewayPaymentId,
171
			String sessionId, String gatewayTxnStatus, String description,
172
			String gatewayTxnId, String authCode, String referenceCode,
173
			String errorCode, PaymentStatus status, String gatewayTxnDate,
174
			List<Attribute> attributes) throws PaymentException, TException {
3010 chandransh 175
	    logger.info("Updating details of payment id: " + id);
1946 chandransh 176
		in.shop2020.payment.domain.Payment payment = paymentHandler.getPayment(id);
177
		payment.setGatewayPaymentId(gatewayPaymentId);
178
		payment.setSessionId(sessionId);
179
		payment.setGatewayTxnStatus(gatewayTxnStatus);
180
		payment.setDescription(description);
181
		payment.setGatewayTxnId(gatewayTxnId);
182
		payment.setAuthCode(authCode);
183
		payment.setReferenceCode(referenceCode);
184
		payment.setErrorCode(errorCode);
185
		if(status!=null){
186
			payment.setStatus(status.getValue());
187
			if(status.equals(PaymentStatus.SUCCESS))
188
				payment.setSuccessTimestamp(new Date());
3578 mandeep.dh 189
			else if(status.equals(PaymentStatus.FAILED)) {
190
			    payment.setErrorTimestamp(new Date());
4421 mandeep.dh 191
			    persistPaymentRequiringExtraProcessing(payment, ExtraPaymentProcessingType.FAILED_PAYMENTS);
3578 mandeep.dh 192
			}
4421 mandeep.dh 193
			else if (status.equals(PaymentStatus.PROVISIONALLY_CAPTURED)) {
194
			    // FIXME different column to note provisional capture timestamp
195
			    // FIXME Requires extra processing at Crm end for actual manual capture
196
			    payment.setProvisionalCaptureTimestamp(new Date());
197
			    persistPaymentRequiringExtraProcessing(payment, ExtraPaymentProcessingType.PENDING_CAPTURE);
198
			}
1946 chandransh 199
		}
200
 
201
		payment.setGatewayTxnDate(gatewayTxnDate);
202
 
203
		Map<String, String> attrMap = new HashMap<String, String>();
2272 rajveer 204
		if(attributes != null){
205
			for(Attribute attribute : attributes){
206
				attrMap.put(attribute.getName(), attribute.getValue());
207
			}
1946 chandransh 208
		}
209
 
210
		paymentHandler.updatePayment(payment, attrMap);
211
		return true;
212
	}
213
 
3649 mandeep.dh 214
	/**
4008 mandeep.dh 215
	 * Persists a given payment Id in another table for future processing by CRM etc.
216
	 * Failed payments generally require a follow-up to help customers through our
217
	 * CRM-Outbound team.
3649 mandeep.dh 218
	 *
219
	 * @param payment  the payment object that failed.
4421 mandeep.dh 220
	 * @param type TODO
3649 mandeep.dh 221
	 */
4421 mandeep.dh 222
	private void persistPaymentRequiringExtraProcessing(in.shop2020.payment.domain.Payment payment, ExtraPaymentProcessingType type) {
4008 mandeep.dh 223
	    try {
4421 mandeep.dh 224
            paymentRequiringExtraProcessingHandler.insert(payment.getId(), type);
4008 mandeep.dh 225
        } catch (Exception e) {
226
            logger.error("Could not persist payment: " + payment.getId(), e);
3578 mandeep.dh 227
        }
228
    }
229
 
230
    @Override
1946 chandransh 231
	public List<Double> getSuccessfulPaymentsAmountRange() throws TException {
3010 chandransh 232
	    logger.info("Getting the range of successful payments.");
1946 chandransh 233
		List<Double> minMaxAmounts = new ArrayList<Double>();
234
		Map<String, Float> minMax = paymentHandler.getMinMaxPaymentAmount();
235
		minMaxAmounts.add(Double.parseDouble(Float.toString(minMax.get("MIN"))));
236
		minMaxAmounts.add(Double.parseDouble(Float.toString(minMax.get("MAX"))));
237
		return minMaxAmounts;
238
	}
239
 
6050 anupam.sin 240
    @Override
241
    public String initializeHdfcPayment(long merchantPaymentId) throws PaymentException, TException {
242
        logger.info("Initializing HDFC payment with id: " + merchantPaymentId);
243
        in.shop2020.payment.domain.Payment payment = paymentHandler.getPayment(merchantPaymentId);
244
        String redirectURL;
245
        try {
246
            redirectURL = HdfcPaymentHandler.initializeHdfcPayment(payment, this);
247
        } catch (Exception e) {
248
            throw new PaymentException(102, "Error while initiliazing payment. Check service log for more details.");
249
        }
250
        return redirectURL;
251
    }
252
 
253
    @Override
6228 anupam.sin 254
	public String doHdfcPaymentForDigitalOrder(long merchantPaymentId, long rechargeOrderId, String phone) throws PaymentException, TException {
6050 anupam.sin 255
        logger.info("Initializing HDFC payment with id: " + merchantPaymentId);
256
        in.shop2020.payment.domain.Payment payment = paymentHandler.getPayment(merchantPaymentId);
257
        TransactionClient tc = new TransactionClient();
258
        String redirectURL;
259
        RechargeOrder rechargeOrder;
260
        try {
261
            rechargeOrder = tc.getClient().getRechargeOrder(rechargeOrderId);
6228 anupam.sin 262
            redirectURL = HdfcPaymentHandler.initializeHdfcPayment(payment, rechargeOrder, phone, this);
6050 anupam.sin 263
        } catch (Exception e) {
264
            throw new PaymentException(102, "Error while initiliazing payment. Check service log for more details.");
265
        }
266
 
267
        return redirectURL;
268
    }
2391 chandransh 269
 
270
	@Override
3616 chandransh 271
    public String initializeHdfcEmiPayment(long merchantPaymentId) throws PaymentException, TException {
272
        logger.info("Initializing HDFC payment with id: " + merchantPaymentId);
273
        in.shop2020.payment.domain.Payment payment = paymentHandler.getPayment(merchantPaymentId);
274
        String redirectURL;
275
        try {
276
            redirectURL = HdfcEmiPaymentHandler.initializeHdfcPayment(payment, this);
277
        } catch (Exception e) {
278
            throw new PaymentException(102, "Error while initiliazing payment. Check service log for more details.");
279
        }
280
        return redirectURL;
281
    }
282
 
6486 rajveer 283
	@Override
284
	public synchronized boolean refundPayment(long merchantTxnId, double amount, boolean isDigital) throws PaymentException, TException {
6482 rajveer 285
        logger.info("Attempting to refund payment of amount " + amount + " corresponding to our transaction " + merchantTxnId);
8409 rajveer 286
        List<in.shop2020.payment.domain.Payment> payments;
287
        if(isDigital){
288
        	payments = paymentHandler.getPaymentForRechargeTxn(merchantTxnId);
289
        }else{
290
        	payments = paymentHandler.getPaymentForTxn(merchantTxnId);
291
        }
6482 rajveer 292
        if(payments ==null || payments.isEmpty())
293
            throw new PaymentException(104, "No payments found corresponding to the merchant txn " + merchantTxnId);
294
 
6486 rajveer 295
        if(payments ==null || payments.isEmpty())
296
            throw new PaymentException(104, "No payments found corresponding to the merchant txn " + merchantTxnId);
297
 
6482 rajveer 298
        in.shop2020.payment.domain.Payment payment = payments.get(0);
6486 rajveer 299
 
300
        if(payment.getAmount() < amount){
301
        	logger.warn("Refund amount is more than payment amount.");
302
            return false;
303
        }
304
 
6482 rajveer 305
        switch(PaymentStatus.findByValue(payment.getStatus())){
306
        case PENDING:
307
            logger.error("Attempt to refund a non-authorized payment");
308
            return false;
309
        case INIT:
310
            logger.warn("Attempt to refund a non-authorized payment");
311
            return false;
312
        case AUTHORIZED:
313
        	logger.warn("Attempt to refund a non-captured payment");
314
            return false;
315
        case CAPTURE_IN_PROCESS:
316
        	logger.warn("Attempt to refund a non-captured payment");
317
            return false;
318
        case PROVISIONALLY_CAPTURED:
319
        	logger.warn("Attempt to refund a non-captured payment");
320
            return false;
6486 rajveer 321
        case REFUNDED:
322
        	logger.warn("Attempt to refund a refunded payment");
323
            return false;
6482 rajveer 324
        case SUCCESS:
325
            break;
326
        case FAILED:
327
            logger.error("Attempting to capture a failed payment");
328
            return false;
329
        }
330
 
331
        long gatewayId = payment.getGatewayId();
332
 
333
        if(gatewayId == HDFC_GATEWAY_ID){
6491 rajveer 334
            //Refund the HDFC payment
6482 rajveer 335
            return refundHdfcPayment(payment, amount);
6491 rajveer 336
        }else if (gatewayId == EBS_GATEWAY_ID){
337
            //Refund the EBS payment
338
            return refundEbsPayment(payment, amount);
6482 rajveer 339
        } 
6491 rajveer 340
        else if (HDFC_EMI_GATEWAY_IDS.contains(gatewayId)){
341
             //Capture and update the HDFC EMI payment
342
            return refundHdfcEmiPayment(payment, amount);
343
        }
6482 rajveer 344
 
345
        logger.error("We have an captured payment from unknown gateway: " + gatewayId);
346
        return false;
347
    }
348
 
349
 
3616 chandransh 350
	@Override
2689 chandransh 351
    public long createRefund(long orderId, long merchantTxnId, double amount) throws PaymentException, TException{
6482 rajveer 352
		logger.info("Attempting to create a refund for order: " + orderId);
6488 rajveer 353
//		if(!refundPayment(merchantTxnId, amount, false)){
354
//			logger.warn("Not able to refund corresponding to the merchant txn " + merchantTxnId);
355
//		}
2689 chandransh 356
		List<in.shop2020.payment.domain.Payment> payments = paymentHandler.getPaymentForTxn(merchantTxnId);
357
		if(payments ==null || payments.isEmpty())
358
			throw new PaymentException(104, "No payments found corresponding to the merchant txn " + merchantTxnId);
359
 
3010 chandransh 360
		in.shop2020.payment.domain.Payment payment = payments.get(0);
2689 chandransh 361
		if(payment.getStatus() != PaymentStatus.SUCCESS.getValue())
362
			throw new PaymentException(104, "No successful payments found corresponding to the merchant txn " + merchantTxnId);
363
 
2747 chandransh 364
		Refund refund = new Refund();
365
		refund.setOrderId(orderId);
366
		refund.setPaymentId(payment.getId());
367
		refund.setGatewayId(payment.getGatewayId());
368
		refund.setAmount(amount);
369
		refund.setAttempts(0);
370
		return refundHandler.createRefund(refund);
2689 chandransh 371
    }
372
 
3010 chandransh 373
    @Override
8618 rajveer 374
    public synchronized boolean capturePayment(long merchantTxnId, boolean isDigital) throws PaymentException, TException {
375
        logger.info("Attempting to capture payment corresponding to our transaction " + merchantTxnId + " and Is Digital is:" + isDigital);
376
        List<in.shop2020.payment.domain.Payment> payments;
377
        if(isDigital){
378
        	payments = paymentHandler.getPaymentForRechargeTxn(merchantTxnId);
379
        }else{
380
        	payments = paymentHandler.getPaymentForTxn(merchantTxnId);
381
        }
3010 chandransh 382
        if(payments ==null || payments.isEmpty())
383
            throw new PaymentException(104, "No payments found corresponding to the merchant txn " + merchantTxnId);
384
 
385
        in.shop2020.payment.domain.Payment payment = payments.get(0);
386
        switch(PaymentStatus.findByValue(payment.getStatus())){
387
        case PENDING:
388
            logger.error("Attempt to capture a non-authorized payment");
389
            return false;
390
        case INIT:
391
            logger.warn("Attempt to capture a non-authorized payment");
392
            return false;
393
        case AUTHORIZED:
4421 mandeep.dh 394
        case CAPTURE_IN_PROCESS:
3010 chandransh 395
            //Actual work to be done in this case. Let the call proceed.
396
            break;
4421 mandeep.dh 397
        case PROVISIONALLY_CAPTURED:
398
            logger.info("Attempting to capture a payment that is provisonally captured but we can let the client proceed.");
399
            return true;
3010 chandransh 400
        case SUCCESS:
401
            logger.warn("Attempting to capture an already captured payment but we can let the client proceed.");
402
            return true;
403
        case FAILED:
404
            logger.error("Attempting to capture a failed payment");
405
            return false;
406
        }
407
 
408
        long gatewayId = payment.getGatewayId();
409
 
410
        if(gatewayId == HDFC_GATEWAY_ID){
411
            //Capture and update the HDFC payment
412
            return captureAndUpdateHdfcPayment(payment);
413
        } else if (gatewayId == EBS_GATEWAY_ID){
414
            //Capture and update the EBS payment
415
            return captureAndUpdateEbsPayment(payment);
6449 rajveer 416
        } else if (HDFC_EMI_GATEWAY_IDS.contains(gatewayId)){
3583 chandransh 417
            //Capture and update the HDFC EMI payment
418
            return captureAndUpdateHdfcEmiPayment(payment);
8488 amar.kumar 419
        } else if (gatewayId == EBAY_GATEWAY_ID || gatewayId == SNAPDEAL_GATEWAY_ID) {
8208 amar.kumar 420
        	return true;
3010 chandransh 421
        }
422
 
423
        logger.error("We have an authorized payment from unknown gateway: " + gatewayId);
424
        return false;
425
    }
426
 
3956 chandransh 427
    @Override
428
    public boolean partiallyCapturePayment(long merchantTxnId, double amount, String xferBy, String xferTxnId, long xferDate) throws PaymentException, TException {
429
        logger.info("Attempting to partially capture payment corresponding to our transaction " + merchantTxnId);
430
        List<in.shop2020.payment.domain.Payment> payments = paymentHandler.getPaymentForTxn(merchantTxnId);
431
        if(payments ==null || payments.isEmpty())
432
            throw new PaymentException(104, "No payments found corresponding to the merchant txn " + merchantTxnId);
433
 
434
        in.shop2020.payment.domain.Payment payment = payments.get(0);
435
        switch(PaymentStatus.findByValue(payment.getStatus())){
436
        case PENDING:
437
            // COD payments lie in this state before settlement.
438
        case INIT:
439
        case PARTIALLY_CAPTURED:
440
        case AUTHORIZED:
441
            // COD payments would not be in this state but we are processing
442
            // payments in this state as well for forward compatibility since
443
            // someday we'd want to be able to capture authorized CC payments
444
            // partially.
445
            break;
446
        case SUCCESS:
447
            logger.warn("Attempting to capture an already captured payment but we can let the client proceed.");
448
            return true;
449
        case FAILED:
450
            logger.error("Attempting to capture a failed payment");
451
            return false;
452
        }
453
        SimpleDateFormat mysqlDateFormatter = new SimpleDateFormat("yyyy-MM-dd 00:00:00");
454
        String xferDateStr = mysqlDateFormatter.format(new Date(xferDate));
455
 
456
        return settleAndUpdateCodPayment(payment, amount, xferBy, xferTxnId, xferDateStr);
457
    }
458
 
3010 chandransh 459
    /**
460
     * Capture the HDFC payment represented by the given payment object. If the
461
     * capture attempt is not successful, we mark this payment as failed. We
462
     * don't retry or anything. We'll add the support of multiple attempts later
463
     * on.
464
     * 
465
     * @param payment The payment which has to be captured.
466
     * @return True if the payment attempt is successful, false if not.
4421 mandeep.dh 467
     * @throws PaymentException 
3010 chandransh 468
     */
4421 mandeep.dh 469
    private boolean captureAndUpdateHdfcPayment(in.shop2020.payment.domain.Payment payment) throws PaymentException {
3010 chandransh 470
        long merchantPaymentId = payment.getId();
471
        logger.info("Capturing HDFC payment with id: " + merchantPaymentId);
472
        Map<String, String> captureResult = HdfcPaymentHandler.capturePayment(payment);
473
        String captureStatus = captureResult.get(IPaymentHandler.STATUS);
474
        String gatewayStatus = captureResult.get(IPaymentHandler.GATEWAY_STATUS);
475
 
476
        Map<String, String> attrMap = new HashMap<String, String>();
477
        if (!captureStatus.trim().equals("0") 
478
                || !HdfcPaymentReturnStatus.CAPTURED.value().equals(gatewayStatus)) {
479
            // Failure
3616 chandransh 480
            logger.error("Capture attempt failed for HDFC payment with id: " + merchantPaymentId);
3010 chandransh 481
            String description = captureResult.get(IPaymentHandler.ERROR);
482
            String errorCode = captureResult.get(IPaymentHandler.ERR_CODE);
483
 
484
            payment.setDescription(description);
485
            payment.setErrorCode(errorCode);
486
            payment.setErrorTimestamp(new Date());
4421 mandeep.dh 487
 
488
            if (IPaymentHandler.Errors.CONN_FAILURE.code.equals(errorCode)) {
489
                payment.setStatus(PaymentStatus.CAPTURE_IN_PROCESS.getValue());
490
                paymentHandler.updatePayment(payment, attrMap);
491
                throw new PaymentException(106, "Could not capture due to connection issue");
492
            }
493
            else {
494
                payment.setStatus(PaymentStatus.FAILED.getValue());
495
                paymentHandler.updatePayment(payment, attrMap);
496
                persistPaymentRequiringExtraProcessing(payment, ExtraPaymentProcessingType.FAILED_PAYMENTS);
497
            }
498
 
3010 chandransh 499
            return false;
500
        } else {
501
            // Success
3616 chandransh 502
            logger.info("Capture attempt successful for HDFC payment with id: " + merchantPaymentId);
3010 chandransh 503
            payment.setDescription("Payment Captured");
504
            payment.setGatewayTxnStatus(gatewayStatus);
505
            payment.setStatus(PaymentStatus.SUCCESS.getValue());
506
            payment.setSuccessTimestamp(new Date());           
507
 
508
            attrMap.put(IPaymentHandler.CAPTURE_TXN_ID, captureResult.get(IPaymentHandler.CAPTURE_TXN_ID));
509
            attrMap.put(IPaymentHandler.CAPTURE_REF_ID, captureResult.get(IPaymentHandler.CAPTURE_REF_ID));
510
            attrMap.put(IPaymentHandler.CAPTURE_AUTH_ID, captureResult.get(IPaymentHandler.CAPTURE_AUTH_ID));
511
 
512
            SimpleDateFormat captureTimeDateFormatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
513
            attrMap.put(HdfcPaymentHandler.CAPTURE_TIME, captureTimeDateFormatter.format(new Date()));
514
 
515
            paymentHandler.updatePayment(payment, attrMap);
516
            return true;
517
          }
518
    }
519
 
520
    /**
3583 chandransh 521
     * Capture the HDFC EMI payment represented by the given payment object. If
522
     * the capture attempt is not successful, we mark this payment as failed. We
523
     * don't retry or anything. We'll add the support of multiple attempts later
524
     * on.
525
     * 
526
     * @param payment
527
     *            The payment which has to be captured.
528
     * @return True if the payment attempt is successful, false if not.
4421 mandeep.dh 529
     * @throws PaymentException 
3583 chandransh 530
     */
4421 mandeep.dh 531
    private boolean captureAndUpdateHdfcEmiPayment(in.shop2020.payment.domain.Payment payment) throws PaymentException{
3583 chandransh 532
        long merchantPaymentId = payment.getId();
533
        logger.info("Capturing HDFC payment with id: " + merchantPaymentId);
534
        Map<String, String> captureResult = HdfcEmiPaymentHandler.capturePayment(payment);
535
        String captureStatus = captureResult.get(IPaymentHandler.STATUS);
536
        String gatewayStatus = captureResult.get(IPaymentHandler.GATEWAY_STATUS);
537
 
538
        Map<String, String> attrMap = new HashMap<String, String>();
539
        if (!captureStatus.trim().equals("0") 
540
                || !HdfcPaymentReturnStatus.CAPTURED.value().equals(gatewayStatus)) {
541
            // Failure
3616 chandransh 542
            logger.error("Capture attempt failed for HDFC payment with id: " + merchantPaymentId);
3583 chandransh 543
            String description = captureResult.get(IPaymentHandler.ERROR);
544
            String errorCode = captureResult.get(IPaymentHandler.ERR_CODE);
545
 
546
            payment.setDescription(description);
547
            payment.setErrorCode(errorCode);
4421 mandeep.dh 548
            payment.setErrorTimestamp(new Date());                
549
 
550
            // Not marking payments as failed in case of connection issues
551
            if (IPaymentHandler.Errors.CONN_FAILURE.code.equals(errorCode)) {
552
                payment.setStatus(PaymentStatus.CAPTURE_IN_PROCESS.getValue());
553
                paymentHandler.updatePayment(payment, attrMap);
554
                throw new PaymentException(106, "Could not capture due to connection issue");
555
            }
556
            else {
557
                payment.setStatus(PaymentStatus.FAILED.getValue());
558
                paymentHandler.updatePayment(payment, attrMap);
559
                persistPaymentRequiringExtraProcessing(payment, ExtraPaymentProcessingType.FAILED_PAYMENTS);
560
            }
561
 
3583 chandransh 562
            return false;
563
        } else {
564
            // Success
3616 chandransh 565
            logger.info("Capture attempt successful for HDFC payment with id: " + merchantPaymentId);
3583 chandransh 566
            payment.setDescription("Payment Captured");
567
            payment.setGatewayTxnStatus(gatewayStatus);
568
            payment.setStatus(PaymentStatus.SUCCESS.getValue());
4421 mandeep.dh 569
            payment.setSuccessTimestamp(new Date());
3583 chandransh 570
 
571
            attrMap.put(IPaymentHandler.CAPTURE_TXN_ID, captureResult.get(IPaymentHandler.CAPTURE_TXN_ID));
572
            attrMap.put(IPaymentHandler.CAPTURE_REF_ID, captureResult.get(IPaymentHandler.CAPTURE_REF_ID));
573
            attrMap.put(IPaymentHandler.CAPTURE_AUTH_ID, captureResult.get(IPaymentHandler.CAPTURE_AUTH_ID));
574
 
575
            SimpleDateFormat captureTimeDateFormatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
576
            attrMap.put(HdfcPaymentHandler.CAPTURE_TIME, captureTimeDateFormatter.format(new Date()));
577
 
578
            paymentHandler.updatePayment(payment, attrMap);
579
            return true;
580
          }
581
    }
582
 
583
    /**
3010 chandransh 584
     * Capture the EBS payment represented by the given payment object. If the
585
     * capture attempt is not successful, we mark this payment as failed. We
586
     * don't retry or anything. We'll add the support of multiple attempts later
587
     * on.
588
     * 
589
     * @param payment The payment which has to be captured.
590
     * @return True if the payment attempt is successful, false if not.
4421 mandeep.dh 591
     * @throws PaymentException 
3010 chandransh 592
     */
4421 mandeep.dh 593
    private boolean captureAndUpdateEbsPayment(in.shop2020.payment.domain.Payment payment) throws PaymentException{
3010 chandransh 594
        Map<String, String> captureResult = EbsPaymentHandler.capturePayment(payment);
595
        String captureStatus = captureResult.get(EbsPaymentHandler.STATUS);
596
 
597
        Map<String, String> attrMap = new HashMap<String, String>();
598
        if("".equals(captureStatus)){
599
            //Failure
3616 chandransh 600
            logger.error("Capture attempt failed for EBS payment with id: " + payment.getId());
3010 chandransh 601
            String description = captureResult.get(EbsPaymentHandler.ERROR);
602
            String errorCode = captureResult.get(EbsPaymentHandler.ERR_CODE);
4421 mandeep.dh 603
 
3010 chandransh 604
            payment.setDescription(description);
605
            payment.setErrorCode(errorCode);
606
            payment.setErrorTimestamp(new Date());
4421 mandeep.dh 607
 
608
            if (IPaymentHandler.Errors.CONN_FAILURE.code.equals(errorCode)) {
609
                payment.setStatus(PaymentStatus.CAPTURE_IN_PROCESS.getValue());            
610
                paymentHandler.updatePayment(payment, attrMap);
611
                throw new PaymentException(106, "Could not capture due to connection issue");
612
            }
613
            else {
614
                payment.setStatus(PaymentStatus.FAILED.getValue());            
615
                paymentHandler.updatePayment(payment, attrMap);
616
                persistPaymentRequiringExtraProcessing(payment, ExtraPaymentProcessingType.FAILED_PAYMENTS);
617
            }
618
 
3010 chandransh 619
            return false;
620
        }else{
621
            //Success
3616 chandransh 622
            logger.info("Capture attempt successful for EBS payment with id: " + payment.getId());
3010 chandransh 623
            payment.setGatewayTxnStatus(captureStatus);
624
            payment.setStatus(PaymentStatus.SUCCESS.getValue());
625
            payment.setSuccessTimestamp(new Date());
626
 
627
            attrMap.put(IPaymentHandler.CAPTURE_TXN_ID, captureResult.get(IPaymentHandler.CAPTURE_TXN_ID));
628
            attrMap.put(IPaymentHandler.CAPTURE_TIME, captureResult.get(IPaymentHandler.CAPTURE_TIME));
629
            paymentHandler.updatePayment(payment, attrMap);
630
            return true;
631
        }
632
    }
633
 
6482 rajveer 634
 
3010 chandransh 635
    /**
6482 rajveer 636
     * Refund the HDFC payment represented by the given payment object. If the
637
     * refund attempt is not successful, will not any action.
638
     * 
639
     * @param payment The payment which has to be captured.
640
     * @amount amount to be refunded
641
     * @return True if the payment attempt is successful, false if not.
642
     * @throws PaymentException 
643
     */
644
    private boolean refundHdfcPayment(in.shop2020.payment.domain.Payment payment, double amount) throws PaymentException {
645
        long merchantPaymentId = payment.getId();
646
        logger.info("Refunding HDFC payment with id: " + merchantPaymentId);
647
        Map<String, String> refundResult = HdfcPaymentHandler.refundPayment(payment, amount);
6486 rajveer 648
        String refundStatus = refundResult.get(IPaymentHandler.STATUS);
6482 rajveer 649
        String gatewayStatus = refundResult.get(IPaymentHandler.GATEWAY_STATUS);
650
 
651
        Map<String, String> attrMap = new HashMap<String, String>();
6486 rajveer 652
        if (!refundStatus.trim().equals("0") 
6482 rajveer 653
                || !HdfcPaymentReturnStatus.CAPTURED.value().equals(gatewayStatus)) {
6486 rajveer 654
 
655
        	logger.error("Refund attempt failed for HDFC payment with id: " + merchantPaymentId);
656
            String description = refundResult.get(IPaymentHandler.ERROR);
657
            String errorCode = refundResult.get(IPaymentHandler.ERR_CODE);
658
 
659
            payment.setDescription(description);
660
            payment.setErrorCode(errorCode);
661
            payment.setErrorTimestamp(new Date());
662
 
663
            if (IPaymentHandler.Errors.CONN_FAILURE.code.equals(errorCode)) {
664
                //payment.setStatus(PaymentStatus.CAPTURE_IN_PROCESS.getValue());
665
                //paymentHandler.updatePayment(payment, attrMap);
666
                throw new PaymentException(106, "Could not capture due to connection issue. Try Later");
667
            }
668
            else {
6491 rajveer 669
//                payment.setStatus(PaymentStatus.FAILED.getValue());
670
//                paymentHandler.updatePayment(payment, attrMap);
6486 rajveer 671
                persistPaymentRequiringExtraProcessing(payment, ExtraPaymentProcessingType.FAILED_PAYMENTS);
672
            }
673
 
6482 rajveer 674
            return false;
675
        } else {
676
            // Success
677
            logger.info("Refund attempt successful for HDFC payment with id: " + merchantPaymentId);
678
            payment.setDescription("Payment Refunded");
679
            payment.setGatewayTxnStatus(gatewayStatus);
6503 rajveer 680
            payment.setStatus(PaymentStatus.REFUNDED.getValue());    
681
            payment.setRefundAmount(amount);
6482 rajveer 682
 
6486 rajveer 683
            attrMap.put(IPaymentHandler.REFUND_TXN_ID, refundResult.get(IPaymentHandler.REFUND_TXN_ID));
684
            attrMap.put(IPaymentHandler.REFUND_REF_ID, refundResult.get(IPaymentHandler.REFUND_REF_ID));
685
            attrMap.put(IPaymentHandler.REFUND_AUTH_ID, refundResult.get(IPaymentHandler.REFUND_AUTH_ID));
6503 rajveer 686
            attrMap.put(IPaymentHandler.REFUND_AMNT, refundResult.get(IPaymentHandler.REFUND_AMNT));
687
 
6482 rajveer 688
            SimpleDateFormat captureTimeDateFormatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
6486 rajveer 689
            attrMap.put(HdfcPaymentHandler.REFUND_TIME, captureTimeDateFormatter.format(new Date()));
6482 rajveer 690
 
691
            paymentHandler.updatePayment(payment, attrMap);
692
            return true;
693
          }
694
    }
695
 
696
 
6491 rajveer 697
    /**
698
     * Refund the HDFC EMI payment represented by the given payment object. If
699
     * the capture attempt is not successful, we will not do anything.
700
     * 
701
     * @param payment
702
     *            The payment which has to be captured.
703
     * @return True if the payment attempt is successful, false if not.
704
     * @throws PaymentException 
705
     */
706
    private boolean refundHdfcEmiPayment(in.shop2020.payment.domain.Payment payment, double amount) throws PaymentException{
707
        long merchantPaymentId = payment.getId();
708
        logger.info("Refunding HDFC payment with id: " + merchantPaymentId);
709
        Map<String, String> refundResult = HdfcEmiPaymentHandler.refundPayment(payment, amount);
710
        String refundStatus = refundResult.get(IPaymentHandler.STATUS);
711
        String gatewayStatus = refundResult.get(IPaymentHandler.GATEWAY_STATUS);
712
 
713
        Map<String, String> attrMap = new HashMap<String, String>();
714
        if (!refundStatus.trim().equals("0") 
715
                || !HdfcPaymentReturnStatus.CAPTURED.value().equals(gatewayStatus)) {
716
            // Failure
717
            logger.error("Refund attempt failed for HDFC payment with id: " + merchantPaymentId);
718
            String description = refundResult.get(IPaymentHandler.ERROR);
719
            String errorCode = refundResult.get(IPaymentHandler.ERR_CODE);
720
 
721
            payment.setDescription(description);
722
            payment.setErrorCode(errorCode);
723
            payment.setErrorTimestamp(new Date());                
724
 
725
            // Not marking payments as failed in case of connection issues
726
            if (IPaymentHandler.Errors.CONN_FAILURE.code.equals(errorCode)) {
727
             //   payment.setStatus(PaymentStatus.CAPTURE_IN_PROCESS.getValue());
728
             //   paymentHandler.updatePayment(payment, attrMap);
729
                throw new PaymentException(106, "Could not capture due to connection issue");
730
            }
731
            else {
732
              //  payment.setStatus(PaymentStatus.FAILED.getValue());
733
              //  paymentHandler.updatePayment(payment, attrMap);
734
                persistPaymentRequiringExtraProcessing(payment, ExtraPaymentProcessingType.FAILED_PAYMENTS);
735
            }
736
 
737
            return false;
738
        } else {
739
            // Success
740
            logger.info("Refund attempt successful for HDFC payment with id: " + merchantPaymentId);
741
            payment.setDescription("Payment Refunded");
742
            payment.setGatewayTxnStatus(gatewayStatus);
743
            payment.setStatus(PaymentStatus.REFUNDED.getValue());           
6503 rajveer 744
            payment.setRefundAmount(amount);
6491 rajveer 745
 
746
            attrMap.put(IPaymentHandler.REFUND_TXN_ID, refundResult.get(IPaymentHandler.REFUND_TXN_ID));
747
            attrMap.put(IPaymentHandler.REFUND_REF_ID, refundResult.get(IPaymentHandler.REFUND_REF_ID));
748
            attrMap.put(IPaymentHandler.REFUND_AUTH_ID, refundResult.get(IPaymentHandler.REFUND_AUTH_ID));
6503 rajveer 749
            attrMap.put(IPaymentHandler.REFUND_AMNT, refundResult.get(IPaymentHandler.REFUND_AMNT));
750
 
6491 rajveer 751
            SimpleDateFormat captureTimeDateFormatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
752
            attrMap.put(HdfcPaymentHandler.REFUND_TIME, captureTimeDateFormatter.format(new Date()));
753
 
754
            paymentHandler.updatePayment(payment, attrMap);
755
            return true;
756
          }
757
    }
6482 rajveer 758
 
759
    /**
6491 rajveer 760
     * Refund the EBS payment represented by the given payment object. If the
761
     * capture attempt is not successful, we will ignore. We don't retry or anything. 
762
     * We'll add the support of multiple attempts later on.
763
     * 
764
     * @param payment The payment which has to be captured.
765
     * @amount Amount to be refunded
766
     * @return True if the payment attempt is successful, false if not.
767
     * @throws PaymentException 
768
     */
769
    private boolean refundEbsPayment(in.shop2020.payment.domain.Payment payment, double amount) throws PaymentException{
770
        Map<String, String> refundResult = EbsPaymentHandler.refundPayment(payment, amount);
771
        String refundStatus = refundResult.get(EbsPaymentHandler.STATUS);
772
 
773
        Map<String, String> attrMap = new HashMap<String, String>();
774
        if("".equals(refundStatus)){
775
            //Failure
776
            logger.error("Refund attempt failed for EBS payment with id: " + payment.getId());
777
            String description = refundResult.get(EbsPaymentHandler.ERROR);
778
            String errorCode = refundResult.get(EbsPaymentHandler.ERR_CODE);
779
 
780
            payment.setDescription(description);
781
            payment.setErrorCode(errorCode);
782
            payment.setErrorTimestamp(new Date());
783
 
784
            if (IPaymentHandler.Errors.CONN_FAILURE.code.equals(errorCode)) {
785
//                payment.setStatus(PaymentStatus.CAPTURE_IN_PROCESS.getValue());            
786
//                paymentHandler.updatePayment(payment, attrMap);
787
                throw new PaymentException(106, "Could not capture due to connection issue");
788
            }
789
            else {
790
//                payment.setStatus(PaymentStatus.FAILED.getValue());            
791
//                paymentHandler.updatePayment(payment, attrMap);
792
                persistPaymentRequiringExtraProcessing(payment, ExtraPaymentProcessingType.FAILED_PAYMENTS);
793
            }
794
 
795
            return false;
796
        }else{
797
            //Success
798
            logger.info("Refund attempt successful for EBS payment with id: " + payment.getId());
799
            payment.setGatewayTxnStatus(refundStatus);
800
            payment.setStatus(PaymentStatus.REFUNDED.getValue());
6503 rajveer 801
            payment.setRefundAmount(amount);
6491 rajveer 802
 
803
            attrMap.put(IPaymentHandler.REFUND_TXN_ID, refundResult.get(IPaymentHandler.REFUND_TXN_ID));
804
            attrMap.put(IPaymentHandler.REFUND_TIME, refundResult.get(IPaymentHandler.REFUND_TIME));
805
            paymentHandler.updatePayment(payment, attrMap);
806
            return true;
807
        }
808
    }
809
 
810
 
811
    /**
3956 chandransh 812
     * Updates the settlement details of COD payments. Sets payment status as
813
     * either PARTIALLY CAPTURED or SUCCESS depending on whether the complete
814
     * amount has been captured. Other parameters are set as attributes.
815
     * 
816
     * @param payment
817
     *            The payment which needs to be updated.
818
     * @param amount
819
     *            Amount that has been captured.
820
     * @param xferBy
821
     *            Entity which transferred the money.
822
     * @param xferTxnId
823
     *            Transaction Id of the transfer.
824
     * @param xferDateStr
825
     *            Date on which the transfer took place.
826
     * @return true if the payment details were updated successfully.
827
     * @throws PaymentException
828
     *             if the captured amount will become more than the actual
829
     *             amount after this update.
830
     */
831
    private boolean settleAndUpdateCodPayment(in.shop2020.payment.domain.Payment payment, double amount, String xferBy, String xferTxnId, String xferDateStr) throws PaymentException{
832
        Map<String, String> attrMap = payment.getAttributeMap();
833
 
834
        double captureAmount = 0;
835
        String captureAmntStr = attrMap.get(IPaymentHandler.CAPTURE_AMNT);
836
        if(captureAmntStr != null)
837
            captureAmount = Double.parseDouble(captureAmntStr);
838
        captureAmount += amount;
5051 rajveer 839
        // If capture amount higher than payment amount by more than 50 paisa,
840
        // there is some issue and we should raise exception.
841
        if(captureAmount - payment.getAmount() > 0.5){
842
        	throw new PaymentException(105, "We've got a settlement request for an amount which is more than the transaction value.");
843
        }
3956 chandransh 844
 
5051 rajveer 845
        // If capture amount differs from payment amount by less than 50 paisa, lets mark the payment as successful. 
846
        // Else we can safely assume there will be some more orders for the payment, leading to make the payment as partially captured.
847
        if(Math.abs(captureAmount - payment.getAmount()) < 0.5){
848
        	payment.setStatus(PaymentStatus.SUCCESS.getValue());
849
        }else {
850
        	payment.setStatus(PaymentStatus.PARTIALLY_CAPTURED.getValue());   
3956 chandransh 851
        }
852
        payment.setSuccessTimestamp(new Date());
853
        attrMap.put(IPaymentHandler.CAPTURE_AMNT, captureAmount + "");
854
        attrMap.put(IPaymentHandler.XFER_TXN_ID, xferTxnId);
855
        attrMap.put(IPaymentHandler.XFER_TXN_DATE, xferDateStr);
856
        attrMap.put(IPaymentHandler.XFER_BY, xferBy);
857
        paymentHandler.updatePayment(payment, attrMap);
858
        return true;
859
    }
860
 
861
    /**
3010 chandransh 862
     * Creates a list of thrift payment objects corresponding to a list of
863
     * payment data objects.
864
     * 
865
     * @param daoPayments
866
     *            A list of payment DAO.
867
     * @return A list of Thrift payment objects.
868
     */
869
    private List<Payment> getThriftPayments(List<in.shop2020.payment.domain.Payment> daoPayments){
870
 
871
        List<Payment> payments = new ArrayList<Payment>();
872
        for(in.shop2020.payment.domain.Payment payment : daoPayments){
873
            payments.add(payment.getThriftPayment());
874
        }
875
        return payments;
876
    }
3375 rajveer 877
 
4600 varun.gupt 878
    /**
879
     * Creates a list of thrift payment gateway objects corresponding to a list of
880
     * payment gateway data objects.
881
     * 
882
     * @param daoPaymentGateways
883
     *            A list of payment gateway DAO.
884
     * @return A list of Thrift payment gateway objects.
885
     */
886
    private List<PaymentGateway> getThriftPaymentGateways(List<in.shop2020.payment.domain.PaymentGateway> daoPaymentGateways){
887
 
888
        List<PaymentGateway> paymentGateways = new ArrayList<PaymentGateway>();
889
        for(in.shop2020.payment.domain.PaymentGateway paymentGateway : daoPaymentGateways){
890
            paymentGateways.add(paymentGateway.getThriftPaymentGateway());
891
        }
892
        return paymentGateways;
893
    }
4619 mandeep.dh 894
 
3375 rajveer 895
	@Override
4619 mandeep.dh 896
	public boolean isAlive() {
897
	    try {
898
            return !paymentGatewayHandler.getActivePaymentGateways().isEmpty();
899
        } catch (Exception e) {
900
            logger.error("Could not fetch payment gateways", e);
901
        }
902
 
903
        return false;
3375 rajveer 904
	}
3956 chandransh 905
 
906
 
907
    @Override
908
    public void closeSession() throws TException {
909
        // TODO Auto-generated method stub      
910
    }
4008 mandeep.dh 911
 
912
    @Override
913
    public List<Long> getPaymentsRequiringExtraProcessing (
914
            ExtraPaymentProcessingType category) throws TException {
915
        return paymentRequiringExtraProcessingHandler.getPaymentIds(category);
916
    }
917
 
918
    @Override
919
    public void markPaymentAsProcessed(long paymentId,
920
            ExtraPaymentProcessingType category) throws TException {
921
        paymentRequiringExtraProcessingHandler.delete(paymentId, category);
922
    }
4141 chandransh 923
 
1946 chandransh 924
}