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