| Line 381... |
Line 381... |
| 381 |
if (fofoPayment.getStatus().equals(PaymentStatus.INIT) && historyList.size() == 0) {
|
381 |
if (fofoPayment.getStatus().equals(PaymentStatus.INIT) && historyList.size() == 0) {
|
| 382 |
String jsonString = mandiiService.getOrderStatus(gatewayReference);
|
382 |
String jsonString = mandiiService.getOrderStatus(gatewayReference);
|
| 383 |
JSONObject jsonOrder = new JSONObject(jsonString);
|
383 |
JSONObject jsonOrder = new JSONObject(jsonString);
|
| 384 |
double orderAmount = jsonOrder.getDouble("order_amount");
|
384 |
double orderAmount = jsonOrder.getDouble("order_amount");
|
| 385 |
int merchantOrderId = jsonOrder.getInt("merchant_order_number");
|
385 |
int merchantOrderId = jsonOrder.getInt("merchant_order_number");
|
| - |
|
386 |
String status = jsonOrder.getString("status");
|
| 386 |
if(orderAmount != fofoPayment.getAmount() || merchantOrderId != fofoPayment.getId()) {
|
387 |
if(orderAmount == fofoPayment.getAmount() && merchantOrderId == fofoPayment.getId() && status.equals("SUCCESS")) {
|
| - |
|
388 |
fofoPayment.setStatus(PaymentStatus.SUCCESS);
|
| - |
|
389 |
walletService.addAmountToWallet(uc.getUserId(), paymentId, WalletReferenceType.PAYMENT_GATEWAY, "Amount added to wallet via SD Credit via Mandii", (float)fofoPayment.getAmount(), LocalDateTime.now());
|
| 387 |
responseSender.ok(false);
|
390 |
return responseSender.ok(true);
|
| 388 |
}
|
391 |
}
|
| 389 |
fofoPayment.setStatus(PaymentStatus.SUCCESS);
|
- |
|
| 390 |
walletService.addAmountToWallet(uc.getUserId(), paymentId, WalletReferenceType.PAYMENT_GATEWAY, "Amount added to wallet via SD Credit via Mandii", (float)fofoPayment.getAmount(), LocalDateTime.now());
|
- |
|
| 391 |
|
- |
|
| 392 |
return responseSender.ok(true);
|
- |
|
| 393 |
}
|
392 |
}
|
| 394 |
return responseSender.ok(false);
|
393 |
return responseSender.ok(false);
|
| 395 |
}
|
394 |
}
|
| 396 |
}
|
395 |
}
|
| 397 |
|
396 |
|