| 7862 |
anupam.sin |
1 |
package in.shop2020.serving.services;
|
|
|
2 |
|
|
|
3 |
import in.shop2020.payments.Attribute;
|
|
|
4 |
import in.shop2020.payments.PaymentStatus;
|
|
|
5 |
import in.shop2020.thrift.clients.PaymentClient;
|
|
|
6 |
|
|
|
7 |
import java.util.ArrayList;
|
|
|
8 |
import java.util.List;
|
|
|
9 |
|
|
|
10 |
import org.apache.log4j.Logger;
|
|
|
11 |
|
|
|
12 |
public class CouponPaymentService implements IPaymentService {
|
|
|
13 |
|
|
|
14 |
private static Logger log = Logger.getLogger(Class.class);
|
|
|
15 |
|
|
|
16 |
private long paymentId;
|
|
|
17 |
|
|
|
18 |
@Override
|
|
|
19 |
public long createPayment(long userId, long txnId, String paymentOption, int gatewayId) {
|
|
|
20 |
log.info("Creating payment for the txn#: " + txnId + " for the user: " + userId + " for processing through COUPON");
|
|
|
21 |
CommonPaymentService cps = new CommonPaymentService();
|
|
|
22 |
if(!cps.createPayment(userId, txnId, gatewayId)){
|
|
|
23 |
log.error("Error while creating the basic payment");
|
|
|
24 |
return PAYMENT_NOT_CREATED;
|
|
|
25 |
}
|
|
|
26 |
paymentId = cps.getPaymentId();
|
|
|
27 |
|
|
|
28 |
if(paymentOption != null){
|
|
|
29 |
List<Attribute> attributes = new ArrayList<Attribute>();
|
|
|
30 |
attributes.add(new Attribute(IPaymentService.PAYMENT_METHOD, paymentOption));
|
|
|
31 |
}
|
|
|
32 |
|
|
|
33 |
return paymentId;
|
|
|
34 |
}
|
|
|
35 |
}
|