updating error handling
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user