added openwa failure notifications
This commit is contained in:
@@ -80,7 +80,7 @@ public class GatewayPaymentHandler implements HandlerInterface {
|
||||
transactionService.save(transaction);
|
||||
}
|
||||
|
||||
if(transaction.getPaymentStatus().equals(Status.FAILED)) {
|
||||
if(Status.FAILED.equals(transaction.getPaymentStatus())) {
|
||||
notificationService.sendWA(waPhone, String.format(
|
||||
"Payment failed: Transaction: %s, Customer message: %s, System message: %s",
|
||||
transaction.getId(), transaction.getErrorMessage(), transaction.getSystemErrorMessage()));
|
||||
|
||||
@@ -91,7 +91,7 @@ public class IntegrationHandler implements HandlerInterface {
|
||||
|
||||
transaction.setIntegrationStatus(transaction.getStatus());
|
||||
|
||||
if(!transaction.getIntegrationStatus().equals(Status.SUCCESS)) {
|
||||
if(!Status.SUCCESS.equals(transaction.getIntegrationStatus())) {
|
||||
notificationService.sendWA(waPhone, String.format(
|
||||
"Integration failed: Transaction %s, Customer message: %s, System message: %s",
|
||||
transaction.getId(), transaction.getErrorMessage(), transaction.getSystemErrorMessage()));
|
||||
|
||||
@@ -49,6 +49,9 @@ class GatewayPaymentHandlerTest {
|
||||
@Mock
|
||||
private TransactionProcessorInterface transactionProcessor;
|
||||
|
||||
@Mock
|
||||
private NotificationService notificationService;
|
||||
|
||||
@InjectMocks
|
||||
private GatewayPaymentHandler handler;
|
||||
|
||||
@@ -63,7 +66,7 @@ class GatewayPaymentHandlerTest {
|
||||
transaction.setType(RequestType.REQUEST);
|
||||
transaction.setAuthType(AuthType.MOBILE);
|
||||
transaction.setPaymentProcessorLabel("ecocash");
|
||||
transaction.setPaymentStatus(null);
|
||||
transaction.setPaymentStatus(Status.PENDING);
|
||||
|
||||
lenient().when(transactionService.getTransactionRepository()).thenReturn(transactionRepository);
|
||||
}
|
||||
|
||||
@@ -48,6 +48,9 @@ class IntegrationHandlerTest {
|
||||
@Mock
|
||||
private TransactionProcessorInterface transactionProcessor;
|
||||
|
||||
@Mock
|
||||
private NotificationService notificationService;
|
||||
|
||||
@InjectMocks
|
||||
private IntegrationHandler handler;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user