| Line 24... |
Line 24... |
| 24 |
|
24 |
|
| 25 |
private static int gatewayId=2;
|
25 |
private static int gatewayId=2;
|
| 26 |
private long paymentId;
|
26 |
private long paymentId;
|
| 27 |
|
27 |
|
| 28 |
@Override
|
28 |
@Override
|
| 29 |
public long createPayment(long userId, long txnId, String paymentOption, int gatewayId){
|
29 |
public long createPayment(long userId, long txnId, String paymentOption, int gatewayId, String paymentType){
|
| 30 |
log.info("Creating payment for the txn#: " + txnId + " for the user: " + userId + " for processing through EBS");
|
30 |
log.info("Creating payment for the txn#: " + txnId + " for the user: " + userId + " for processing through EBS");
|
| 31 |
CommonPaymentService cps = new CommonPaymentService();
|
31 |
CommonPaymentService cps = new CommonPaymentService();
|
| 32 |
if(!cps.createPayment(userId, txnId, gatewayId)){
|
32 |
if(!cps.createPayment(userId, txnId, gatewayId)){
|
| 33 |
log.error("Error while creating the basic payment");
|
33 |
log.error("Error while creating the basic payment");
|
| 34 |
return PAYMENT_NOT_CREATED;
|
34 |
return PAYMENT_NOT_CREATED;
|
| Line 36... |
Line 36... |
| 36 |
paymentId = cps.getPaymentId();
|
36 |
paymentId = cps.getPaymentId();
|
| 37 |
|
37 |
|
| 38 |
if(paymentOption != null){
|
38 |
if(paymentOption != null){
|
| 39 |
List<Attribute> attributes = new ArrayList<Attribute>();
|
39 |
List<Attribute> attributes = new ArrayList<Attribute>();
|
| 40 |
attributes.add(new Attribute(IPaymentService.PAYMENT_METHOD, paymentOption));
|
40 |
attributes.add(new Attribute(IPaymentService.PAYMENT_METHOD, paymentOption));
|
| - |
|
41 |
attributes.add(new Attribute(IPaymentService.PAYMENT_TYPE, paymentType));
|
| 41 |
double emiAmount = CommonPaymentService.calculateEmiAmount(paymentOption, cps.getAmount());
|
42 |
double emiAmount = CommonPaymentService.calculateEmiAmount(paymentOption, cps.getAmount());
|
| 42 |
if(emiAmount > 0){
|
43 |
if(emiAmount > 0){
|
| 43 |
attributes.add(new Attribute(IPaymentService.EMI_AMOUNT, ""+emiAmount));
|
44 |
attributes.add(new Attribute(IPaymentService.EMI_AMOUNT, ""+emiAmount));
|
| 44 |
}
|
45 |
}
|
| 45 |
try {
|
46 |
try {
|
| Line 56... |
Line 57... |
| 56 |
}
|
57 |
}
|
| 57 |
|
58 |
|
| 58 |
return paymentId;
|
59 |
return paymentId;
|
| 59 |
}
|
60 |
}
|
| 60 |
|
61 |
|
| 61 |
public long createPayment(RechargeOrder rechargeOrder, String paymentOption) {
|
62 |
public long createPayment(RechargeOrder rechargeOrder, String paymentOption, String paymentType) {
|
| 62 |
log.info("Creating payment for the txn#: " + rechargeOrder.getId() + " for the user: " + rechargeOrder.getUserId() + " for processing through EBS");
|
63 |
log.info("Creating payment for the txn#: " + rechargeOrder.getId() + " for the user: " + rechargeOrder.getUserId() + " for processing through EBS");
|
| 63 |
CommonPaymentService cps = new CommonPaymentService();
|
64 |
CommonPaymentService cps = new CommonPaymentService();
|
| 64 |
if(!cps.createPayment(rechargeOrder, gatewayId)){
|
65 |
if(!cps.createPayment(rechargeOrder, gatewayId)){
|
| 65 |
log.error("Error while creating the basic payment");
|
66 |
log.error("Error while creating the basic payment");
|
| 66 |
return PAYMENT_NOT_CREATED;
|
67 |
return PAYMENT_NOT_CREATED;
|
| Line 68... |
Line 69... |
| 68 |
paymentId = cps.getPaymentId();
|
69 |
paymentId = cps.getPaymentId();
|
| 69 |
|
70 |
|
| 70 |
if(paymentOption != null){
|
71 |
if(paymentOption != null){
|
| 71 |
List<Attribute> attributes = new ArrayList<Attribute>();
|
72 |
List<Attribute> attributes = new ArrayList<Attribute>();
|
| 72 |
attributes.add(new Attribute(IPaymentService.PAYMENT_METHOD, paymentOption));
|
73 |
attributes.add(new Attribute(IPaymentService.PAYMENT_METHOD, paymentOption));
|
| - |
|
74 |
attributes.add(new Attribute(IPaymentService.PAYMENT_TYPE, paymentType));
|
| 73 |
|
75 |
|
| 74 |
try {
|
76 |
try {
|
| 75 |
PaymentClient paymentServiceClient = new PaymentClient();
|
77 |
PaymentClient paymentServiceClient = new PaymentClient();
|
| 76 |
paymentServiceClient.getClient().updatePaymentDetails(paymentId, null, null, null, null, null, null, null, null, PaymentStatus.INIT, null, attributes);
|
78 |
paymentServiceClient.getClient().updatePaymentDetails(paymentId, null, null, null, null, null, null, null, null, PaymentStatus.INIT, null, attributes);
|
| 77 |
} catch (Exception e) {
|
79 |
} catch (Exception e) {
|