| Line 17... |
Line 17... |
| 17 |
|
17 |
|
| 18 |
public HdfcEmiPaymentService() {
|
18 |
public HdfcEmiPaymentService() {
|
| 19 |
|
19 |
|
| 20 |
}
|
20 |
}
|
| 21 |
|
21 |
|
| 22 |
public long createPayment(long userId, long txnId, String paymentOption, int gatewayId){
|
22 |
public long createPayment(long userId, long txnId, String paymentOption, int gatewayId, String paymentType){
|
| 23 |
log.info("Creating payment for the txn#: " + txnId + " for the user: " + userId + " for processing through HDFC EMI");
|
23 |
log.info("Creating payment for the txn#: " + txnId + " for the user: " + userId + " for processing through HDFC EMI");
|
| 24 |
CommonPaymentService cps = new CommonPaymentService();
|
24 |
CommonPaymentService cps = new CommonPaymentService();
|
| 25 |
if(!cps.createPayment(userId, txnId, gatewayId)){
|
25 |
if(!cps.createPayment(userId, txnId, gatewayId)){
|
| 26 |
log.error("Error while creating the basic payment");
|
26 |
log.error("Error while creating the basic payment");
|
| 27 |
return PAYMENT_NOT_CREATED;
|
27 |
return PAYMENT_NOT_CREATED;
|
| 28 |
}else{
|
28 |
}else{
|
| 29 |
return initializePayment(cps.getPaymentId(), paymentOption, cps.getAmount());
|
29 |
return initializePayment(cps.getPaymentId(), paymentOption, cps.getAmount(), paymentType);
|
| 30 |
}
|
30 |
}
|
| 31 |
}
|
31 |
}
|
| 32 |
|
32 |
|
| 33 |
private long initializePayment(long merchantPaymentId, String paymentOption, double amount){
|
33 |
private long initializePayment(long merchantPaymentId, String paymentOption, double amount,String paymentType){
|
| 34 |
List<Attribute> attributes = new ArrayList<Attribute>();
|
34 |
List<Attribute> attributes = new ArrayList<Attribute>();
|
| 35 |
attributes.add(new Attribute(IPaymentService.PAYMENT_METHOD, paymentOption));
|
35 |
attributes.add(new Attribute(IPaymentService.PAYMENT_METHOD, paymentOption));
|
| - |
|
36 |
attributes.add(new Attribute(IPaymentService.PAYMENT_TYPE, paymentType));
|
| 36 |
double emiAmount = CommonPaymentService.calculateEmiAmount(paymentOption, amount);
|
37 |
double emiAmount = CommonPaymentService.calculateEmiAmount(paymentOption, amount);
|
| 37 |
if(emiAmount > 0){
|
38 |
if(emiAmount > 0){
|
| 38 |
attributes.add(new Attribute(IPaymentService.EMI_AMOUNT, ""+emiAmount));
|
39 |
attributes.add(new Attribute(IPaymentService.EMI_AMOUNT, ""+emiAmount));
|
| 39 |
}
|
40 |
}
|
| 40 |
PaymentClient paymentServiceClient = null;
|
41 |
PaymentClient paymentServiceClient = null;
|