| Line 31... |
Line 31... |
| 31 |
}else{
|
31 |
}else{
|
| 32 |
return initializePayment(cps.getPaymentId(), paymentOption);
|
32 |
return initializePayment(cps.getPaymentId(), paymentOption);
|
| 33 |
}
|
33 |
}
|
| 34 |
}
|
34 |
}
|
| 35 |
|
35 |
|
| 36 |
public long createPayment(RechargeOrder rechargeOrder, String paymentOption) {
|
36 |
public long createPayment(RechargeOrder rechargeOrder, String paymentOption, String phone) {
|
| 37 |
log.info("Creating payment for the txn#: " + rechargeOrder.getId() + " for the user: " + rechargeOrder.getUserId() + " for processing through HDFC");
|
37 |
log.info("Creating payment for the txn#: " + rechargeOrder.getId() + " for the user: " + rechargeOrder.getUserId() + " for processing through HDFC");
|
| 38 |
CommonPaymentService cps = new CommonPaymentService();
|
38 |
CommonPaymentService cps = new CommonPaymentService();
|
| 39 |
if(!cps.createPayment(rechargeOrder, gatewayId)){
|
39 |
if(!cps.createPayment(rechargeOrder, gatewayId)){
|
| 40 |
log.error("Error while creating the basic payment");
|
40 |
log.error("Error while creating the basic payment");
|
| 41 |
return PAYMENT_NOT_CREATED;
|
41 |
return PAYMENT_NOT_CREATED;
|
| 42 |
}else{
|
42 |
}else{
|
| 43 |
return initializePayment(rechargeOrder, cps.getPaymentId(), paymentOption);
|
43 |
return initializePayment(rechargeOrder, cps.getPaymentId(), paymentOption, phone);
|
| 44 |
}
|
44 |
}
|
| 45 |
}
|
45 |
}
|
| 46 |
|
46 |
|
| 47 |
private long initializePayment(RechargeOrder rechargeOrder, long merchantPaymentId,
|
47 |
private long initializePayment(RechargeOrder rechargeOrder, long merchantPaymentId,
|
| 48 |
String paymentOption) {
|
48 |
String paymentOption, String phone) {
|
| 49 |
List<Attribute> attributes = new ArrayList<Attribute>();
|
49 |
List<Attribute> attributes = new ArrayList<Attribute>();
|
| 50 |
attributes.add(new Attribute(IPaymentService.PAYMENT_METHOD, paymentOption));
|
50 |
attributes.add(new Attribute(IPaymentService.PAYMENT_METHOD, paymentOption));
|
| 51 |
PaymentClient paymentServiceClient = null;
|
51 |
PaymentClient paymentServiceClient = null;
|
| 52 |
try {
|
52 |
try {
|
| 53 |
paymentServiceClient = new PaymentClient();
|
53 |
paymentServiceClient = new PaymentClient();
|
| Line 56... |
Line 56... |
| 56 |
return PAYMENT_NOT_CREATED;
|
56 |
return PAYMENT_NOT_CREATED;
|
| 57 |
}
|
57 |
}
|
| 58 |
|
58 |
|
| 59 |
try {
|
59 |
try {
|
| 60 |
paymentServiceClient.getClient().updatePaymentDetails(merchantPaymentId, null, null, null, null, null, null, null, null, PaymentStatus.INIT, null, attributes);
|
60 |
paymentServiceClient.getClient().updatePaymentDetails(merchantPaymentId, null, null, null, null, null, null, null, null, PaymentStatus.INIT, null, attributes);
|
| 61 |
this.redirectURL = paymentServiceClient.getClient().doHdfcPaymentForDigitalOrder(merchantPaymentId, rechargeOrder.getId());
|
61 |
this.redirectURL = paymentServiceClient.getClient().doHdfcPaymentForDigitalOrder(merchantPaymentId, rechargeOrder.getId(), phone);
|
| 62 |
return merchantPaymentId;
|
62 |
return merchantPaymentId;
|
| 63 |
}catch (Exception e) {
|
63 |
}catch (Exception e) {
|
| 64 |
log.error("Error while initializing payment.", e);
|
64 |
log.error("Error while initializing payment.", e);
|
| 65 |
return PAYMENT_NOT_CREATED;
|
65 |
return PAYMENT_NOT_CREATED;
|
| 66 |
}
|
66 |
}
|