updating error handling

This commit is contained in:
2026-05-20 17:32:35 +02:00
parent 3059987143
commit 437f04dbc1
4 changed files with 10 additions and 321 deletions

View File

@@ -94,6 +94,8 @@ public class Transaction extends BaseEntity {
@Column(columnDefinition = "TEXT")
private String errorMessage;
@Column(columnDefinition = "TEXT")
private String systemErrorMessage;
private String responseCode;
@Enumerated(EnumType.STRING)
private Status status;

View File

@@ -107,14 +107,16 @@ public class HotRechargeIntegrationProcessor implements TransactionProcessorInte
} else {
transaction.setStatus(Status.FAILED);
transaction.setResponseCode((String) rechargeResponse.getOrDefault("responseCode", "99"));
transaction.setErrorMessage((String) rechargeResponse.getOrDefault("message", "Recharge failed"));
transaction.setSystemErrorMessage((String) rechargeResponse.getOrDefault("message", "Recharge failed"));
transaction.setErrorMessage("Funding billing account failed. Please try again.");
}
} catch (Exception e) {
logger.error("Error processing HotRecharge integration: " + e.getMessage(), e);
transaction.setStatus(Status.FAILED);
transaction.setResponseCode("99");
transaction.setErrorMessage("Processing error: " + e.getMessage());
transaction.setSystemErrorMessage("Processing error: " + e.getMessage());
transaction.setErrorMessage("Funding billing account failed. Please try again.");
}
return transaction;

View File

@@ -126,7 +126,8 @@ public class EcocashRemotePaymentProcessor implements TransactionProcessorInterf
logger.error("Network error during payment processing: {}", e.getMessage(), e);
transaction.setStatus(Status.FAILED);
transaction.setResponseCode("99");
transaction.setErrorMessage("Network error: " + e.getMessage());
transaction.setSystemErrorMessage("Network error: " + e.getMessage());
transaction.setErrorMessage("Payment failed. Please try again.");
}
return transactionService.save(transaction);
@@ -187,7 +188,8 @@ public class EcocashRemotePaymentProcessor implements TransactionProcessorInterf
logger.error("Network error during payment processing: {}", e.getMessage(), e);
transaction.setStatus(Status.FAILED);
transaction.setResponseCode("99");
transaction.setErrorMessage("Network error: " + e.getMessage());
transaction.setSystemErrorMessage("Network error: " + e.getMessage());
transaction.setErrorMessage("Payment failed. Please try again.");
}
return transaction;