added openwa failure notifications

This commit is contained in:
2026-07-09 22:35:49 +02:00
parent fbc3967215
commit 1de89364be
4 changed files with 9 additions and 3 deletions

View File

@@ -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()));

View File

@@ -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()));

View File

@@ -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);
}

View File

@@ -48,6 +48,9 @@ class IntegrationHandlerTest {
@Mock
private TransactionProcessorInterface transactionProcessor;
@Mock
private NotificationService notificationService;
@InjectMocks
private IntegrationHandler handler;