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;

View File

@@ -1,317 +0,0 @@
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:pro="http://www.liquibase.org/xml/ns/pro" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/pro http://www.liquibase.org/xml/ns/pro/liquibase-pro-latest.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd">
<changeSet author="vkhoza (generated)" id="1760560268483-1">
<createTable tableName="additional_data">
<column name="id" type="UUID">
<constraints nullable="false" primaryKey="true" primaryKeyName="additional_dataPK"/>
</column>
<column name="created_at" type="TIMESTAMP(6) WITHOUT TIME ZONE"/>
<column name="updated_at" type="TIMESTAMP(6) WITHOUT TIME ZONE"/>
<column name="json_string" type="TEXT"/>
<column name="request_type" type="VARCHAR(255)"/>
<column name="transaction_id" type="VARCHAR(255)"/>
</createTable>
</changeSet>
<changeSet author="vkhoza (generated)" id="1760560268483-2">
<createTable tableName="category">
<column name="id" type="UUID">
<constraints nullable="false" primaryKey="true" primaryKeyName="categoryPK"/>
</column>
<column name="created_at" type="TIMESTAMP(6) WITHOUT TIME ZONE"/>
<column name="updated_at" type="TIMESTAMP(6) WITHOUT TIME ZONE"/>
<column name="description" type="VARCHAR(255)"/>
<column name="image" type="VARCHAR(255)"/>
<column name="label" type="VARCHAR(255)"/>
<column name="name" type="VARCHAR(255)"/>
</createTable>
</changeSet>
<changeSet author="vkhoza (generated)" id="1760560268483-3">
<createTable tableName="charge">
<column name="id" type="UUID">
<constraints nullable="false" primaryKey="true" primaryKeyName="chargePK"/>
</column>
<column name="created_at" type="TIMESTAMP(6) WITHOUT TIME ZONE"/>
<column name="updated_at" type="TIMESTAMP(6) WITHOUT TIME ZONE"/>
<column name="account" type="VARCHAR(255)"/>
<column name="charge_label" type="VARCHAR(255)"/>
<column name="composite" type="BOOLEAN">
<constraints nullable="false"/>
</column>
<column name="currency" type="VARCHAR(255)"/>
<column name="description" type="VARCHAR(255)"/>
<column name="flat" type="numeric(38, 2)"/>
<column name="global" type="BOOLEAN">
<constraints nullable="false"/>
</column>
<column name="max" type="numeric(38, 2)"/>
<column name="maximum_amount" type="numeric(38, 2)"/>
<column name="min" type="numeric(38, 2)"/>
<column name="minimum_amount" type="numeric(38, 2)"/>
<column name="percentage_rate" type="numeric(38, 2)"/>
<column name="target" type="VARCHAR(255)"/>
<column name="target_event" type="VARCHAR(255)"/>
<column name="target_value" type="VARCHAR(255)"/>
</createTable>
</changeSet>
<changeSet author="vkhoza (generated)" id="1760560268483-4">
<createTable tableName="charge_condition">
<column name="id" type="UUID">
<constraints nullable="false" primaryKey="true" primaryKeyName="charge_conditionPK"/>
</column>
<column name="created_at" type="TIMESTAMP(6) WITHOUT TIME ZONE"/>
<column name="updated_at" type="TIMESTAMP(6) WITHOUT TIME ZONE"/>
<column name="codes" type="TEXT"/>
<column name="name" type="VARCHAR(255)"/>
<column name="type" type="VARCHAR(255)"/>
</createTable>
</changeSet>
<changeSet author="vkhoza (generated)" id="1760560268483-5">
<createTable tableName="charge_exclude_products">
<column name="charge_id" type="UUID">
<constraints nullable="false" primaryKey="true" primaryKeyName="charge_exclude_productsPK"/>
</column>
<column name="charge_condition_id" type="UUID">
<constraints nullable="false" primaryKey="true" primaryKeyName="charge_exclude_productsPK"/>
</column>
</createTable>
</changeSet>
<changeSet author="vkhoza (generated)" id="1760560268483-6">
<createTable tableName="charge_include_products">
<column name="charge_id" type="UUID">
<constraints nullable="false" primaryKey="true" primaryKeyName="charge_include_productsPK"/>
</column>
<column name="charge_condition_id" type="UUID">
<constraints nullable="false" primaryKey="true" primaryKeyName="charge_include_productsPK"/>
</column>
</createTable>
</changeSet>
<changeSet author="vkhoza (generated)" id="1760560268483-7">
<createTable tableName="currency">
<column name="id" type="UUID">
<constraints nullable="false" primaryKey="true" primaryKeyName="currencyPK"/>
</column>
<column name="created_at" type="TIMESTAMP(6) WITHOUT TIME ZONE"/>
<column name="updated_at" type="TIMESTAMP(6) WITHOUT TIME ZONE"/>
<column name="display_name" type="VARCHAR(255)"/>
<column name="iso_code" type="VARCHAR(255)"/>
<column name="name" type="VARCHAR(255)"/>
</createTable>
</changeSet>
<changeSet author="vkhoza (generated)" id="1760560268483-8">
<createTable tableName="integration_processor">
<column name="id" type="UUID">
<constraints nullable="false" primaryKey="true" primaryKeyName="integration_processorPK"/>
</column>
<column name="created_at" type="TIMESTAMP(6) WITHOUT TIME ZONE"/>
<column name="updated_at" type="TIMESTAMP(6) WITHOUT TIME ZONE"/>
<column name="description" type="VARCHAR(255)"/>
<column name="label" type="VARCHAR(255)"/>
<column name="name" type="VARCHAR(255)"/>
</createTable>
</changeSet>
<changeSet author="vkhoza (generated)" id="1760560268483-9">
<createTable tableName="otp">
<column name="id" type="UUID">
<constraints nullable="false" primaryKey="true" primaryKeyName="otpPK"/>
</column>
<column name="created_at" type="TIMESTAMP(6) WITHOUT TIME ZONE"/>
<column name="updated_at" type="TIMESTAMP(6) WITHOUT TIME ZONE"/>
<column name="otp" type="VARCHAR(255)"/>
<column name="otp_status" type="VARCHAR(255)"/>
<column name="otp_type" type="VARCHAR(255)"/>
<column name="username" type="VARCHAR(255)"/>
</createTable>
</changeSet>
<changeSet author="vkhoza (generated)" id="1760560268483-10">
<createTable tableName="payment_processor">
<column name="id" type="UUID">
<constraints nullable="false" primaryKey="true" primaryKeyName="payment_processorPK"/>
</column>
<column name="created_at" type="TIMESTAMP(6) WITHOUT TIME ZONE"/>
<column name="updated_at" type="TIMESTAMP(6) WITHOUT TIME ZONE"/>
<column name="account_field_label" type="VARCHAR(255)"/>
<column name="account_field_name" type="VARCHAR(255)"/>
<column name="auth_type" type="VARCHAR(255)"/>
<column name="description" type="VARCHAR(255)"/>
<column name="image" type="TEXT"/>
<column name="label" type="VARCHAR(255)"/>
<column name="name" type="VARCHAR(255)"/>
<column name="type" type="VARCHAR(255)"/>
</createTable>
</changeSet>
<changeSet author="vkhoza (generated)" id="1760560268483-11">
<createTable tableName="provider">
<column name="id" type="UUID">
<constraints nullable="false" primaryKey="true" primaryKeyName="providerPK"/>
</column>
<column name="created_at" type="TIMESTAMP(6) WITHOUT TIME ZONE"/>
<column name="updated_at" type="TIMESTAMP(6) WITHOUT TIME ZONE"/>
<column name="account_field_name" type="VARCHAR(255)"/>
<column name="category" type="VARCHAR(255)"/>
<column name="client_id" type="VARCHAR(255)"/>
<column name="description" type="VARCHAR(255)"/>
<column name="external_id" type="VARCHAR(255)"/>
<column name="image" type="VARCHAR(255)"/>
<column name="integration_processor_label" type="VARCHAR(255)"/>
<column name="label" type="VARCHAR(255)"/>
<column name="percentage_commission" type="FLOAT(53)">
<constraints nullable="false"/>
</column>
</createTable>
</changeSet>
<changeSet author="vkhoza (generated)" id="1760560268483-12">
<createTable tableName="recipient">
<column name="id" type="UUID">
<constraints nullable="false" primaryKey="true" primaryKeyName="recipientPK"/>
</column>
<column name="created_at" type="TIMESTAMP(6) WITHOUT TIME ZONE"/>
<column name="updated_at" type="TIMESTAMP(6) WITHOUT TIME ZONE"/>
<column name="account" type="VARCHAR(255)"/>
<column name="address" type="VARCHAR(255)"/>
<column name="email" type="VARCHAR(255)"/>
<column name="initials" type="VARCHAR(255)"/>
<column name="latest_provider_label" type="VARCHAR(255)"/>
<column name="name" type="VARCHAR(255)"/>
<column name="phone_number" type="VARCHAR(255)"/>
<column name="user_id" type="VARCHAR(255)"/>
</createTable>
</changeSet>
<changeSet author="vkhoza (generated)" id="1760560268483-13">
<createTable tableName="setting">
<column name="id" type="UUID">
<constraints nullable="false" primaryKey="true" primaryKeyName="settingPK"/>
</column>
<column name="created_at" type="TIMESTAMP(6) WITHOUT TIME ZONE"/>
<column name="updated_at" type="TIMESTAMP(6) WITHOUT TIME ZONE"/>
<column name="setting_name" type="VARCHAR(255)"/>
<column name="setting_value" type="VARCHAR(255)"/>
</createTable>
</changeSet>
<changeSet author="vkhoza (generated)" id="1760560268483-14">
<createTable tableName="transaction">
<column name="id" type="UUID">
<constraints nullable="false" primaryKey="true" primaryKeyName="transactionPK"/>
</column>
<column name="created_at" type="TIMESTAMP(6) WITHOUT TIME ZONE"/>
<column name="updated_at" type="TIMESTAMP(6) WITHOUT TIME ZONE"/>
<column name="aggregator_id" type="VARCHAR(255)"/>
<column name="amount" type="numeric(38, 2)"/>
<column name="auth_type" type="VARCHAR(255)"/>
<column name="authorization_status" type="VARCHAR(255)"/>
<column name="bill_client_id" type="VARCHAR(255)"/>
<column name="bill_name" type="VARCHAR(255)"/>
<column name="bill_product_name" type="VARCHAR(255)"/>
<column name="channel" type="VARCHAR(255)"/>
<column name="channel_name" type="VARCHAR(255)"/>
<column name="charge" type="numeric(38, 2)"/>
<column name="client_secret" type="VARCHAR(255)"/>
<column name="confirmation_processor_label" type="VARCHAR(255)"/>
<column name="confirmation_status" type="VARCHAR(255)"/>
<column name="credit_account" type="VARCHAR(255)"/>
<column name="credit_card" type="VARCHAR(255)"/>
<column name="credit_currency" type="VARCHAR(255)"/>
<column name="credit_email" type="VARCHAR(255)"/>
<column name="credit_name" type="VARCHAR(255)"/>
<column name="credit_phone" type="VARCHAR(255)"/>
<column name="credit_ref" type="VARCHAR(255)"/>
<column name="debit_account" type="VARCHAR(255)"/>
<column name="debit_card" type="VARCHAR(255)"/>
<column name="debit_currency" type="VARCHAR(255)"/>
<column name="debit_email" type="VARCHAR(255)"/>
<column name="debit_name" type="VARCHAR(255)"/>
<column name="debit_phone" type="VARCHAR(255)"/>
<column name="debit_ref" type="VARCHAR(255)"/>
<column name="erp_commission_journal_ref" type="VARCHAR(255)"/>
<column name="erp_journal_ref" type="VARCHAR(255)"/>
<column name="erp_purchase_payment_ref" type="VARCHAR(255)"/>
<column name="erp_purchase_ref" type="VARCHAR(255)"/>
<column name="erp_sales_payment_ref" type="VARCHAR(255)"/>
<column name="erp_sales_ref" type="VARCHAR(255)"/>
<column name="error_message" type="TEXT"/>
<column name="gateway_charge" type="numeric(38, 2)"/>
<column name="integration_processor_label" type="VARCHAR(255)"/>
<column name="integration_status" type="VARCHAR(255)"/>
<column name="payment_processor_image" type="VARCHAR(255)"/>
<column name="payment_processor_label" type="VARCHAR(255)"/>
<column name="payment_processor_name" type="VARCHAR(255)"/>
<column name="payment_status" type="VARCHAR(255)"/>
<column name="polling_status" type="VARCHAR(255)"/>
<column name="product_uid" type="VARCHAR(255)"/>
<column name="provider_image" type="VARCHAR(255)"/>
<column name="provider_label" type="VARCHAR(255)"/>
<column name="provider_uid" type="VARCHAR(255)"/>
<column name="reference" type="VARCHAR(255)"/>
<column name="response_code" type="VARCHAR(255)"/>
<column name="reversal_status" type="VARCHAR(255)"/>
<column name="rrn" type="VARCHAR(255)"/>
<column name="sdk_action_id" type="VARCHAR(255)"/>
<column name="status" type="VARCHAR(255)"/>
<column name="target_url" type="TEXT"/>
<column name="tax" type="numeric(38, 2)"/>
<column name="total_amount" type="numeric(38, 2)"/>
<column name="trace" type="VARCHAR(255)"/>
<column name="type" type="VARCHAR(255)"/>
<column name="user_id" type="VARCHAR(255)"/>
</createTable>
</changeSet>
<changeSet author="vkhoza (generated)" id="1760560268483-15">
<createTable tableName="transaction_event">
<column name="id" type="UUID">
<constraints nullable="false" primaryKey="true" primaryKeyName="transaction_eventPK"/>
</column>
<column name="created_at" type="TIMESTAMP(6) WITHOUT TIME ZONE"/>
<column name="updated_at" type="TIMESTAMP(6) WITHOUT TIME ZONE"/>
<column name="data" type="VARCHAR(255)"/>
<column name="event" type="VARCHAR(255)"/>
<column name="message" type="TEXT"/>
<column name="status" type="VARCHAR(255)"/>
<column name="transaction_id" type="VARCHAR(255)"/>
</createTable>
</changeSet>
<changeSet author="vkhoza (generated)" id="1760560268483-16">
<createTable tableName="users">
<column name="id" type="UUID">
<constraints nullable="false" primaryKey="true" primaryKeyName="usersPK"/>
</column>
<column name="created_at" type="TIMESTAMP(6) WITHOUT TIME ZONE"/>
<column name="updated_at" type="TIMESTAMP(6) WITHOUT TIME ZONE"/>
<column name="is_account_non_expired" type="BOOLEAN"/>
<column name="is_account_non_locked" type="BOOLEAN"/>
<column name="is_credentials_non_expired" type="BOOLEAN"/>
<column name="email" type="VARCHAR(255)">
<constraints nullable="false"/>
</column>
<column name="is_enabled" type="BOOLEAN"/>
<column name="erp_customer_ref" type="VARCHAR(255)"/>
<column name="first_name" type="VARCHAR(255)"/>
<column name="last_name" type="VARCHAR(255)"/>
<column name="password" type="VARCHAR(255)">
<constraints nullable="false"/>
</column>
<column name="phone" type="VARCHAR(255)"/>
<column name="photo_url" type="VARCHAR(255)"/>
<column name="username" type="VARCHAR(255)">
<constraints nullable="false"/>
</column>
<column name="workflow_id" type="BIGINT"/>
</createTable>
</changeSet>
<changeSet author="vkhoza (generated)" id="1760560268483-17">
<addUniqueConstraint columnNames="email" constraintName="UC_USERSEMAIL_COL" tableName="users"/>
</changeSet>
<changeSet author="vkhoza (generated)" id="1760560268483-18">
<addUniqueConstraint columnNames="username" constraintName="UC_USERSUSERNAME_COL" tableName="users"/>
</changeSet>
<changeSet author="vkhoza (generated)" id="1760560268483-19">
<addForeignKeyConstraint baseColumnNames="charge_id" baseTableName="charge_include_products" constraintName="FK21nfv5h1q207r03oggp5hxhx4" deferrable="false" initiallyDeferred="false" referencedColumnNames="id" referencedTableName="charge" validate="true"/>
</changeSet>
<changeSet author="vkhoza (generated)" id="1760560268483-20">
<addForeignKeyConstraint baseColumnNames="charge_condition_id" baseTableName="charge_include_products" constraintName="FK2i46rkib8xs0eis59hi17jvys" deferrable="false" initiallyDeferred="false" referencedColumnNames="id" referencedTableName="charge_condition" validate="true"/>
</changeSet>
<changeSet author="vkhoza (generated)" id="1760560268483-21">
<addForeignKeyConstraint baseColumnNames="charge_id" baseTableName="charge_exclude_products" constraintName="FK5ig672i6f601yto3g7hb657wl" deferrable="false" initiallyDeferred="false" referencedColumnNames="id" referencedTableName="charge" validate="true"/>
</changeSet>
<changeSet author="vkhoza (generated)" id="1760560268483-22">
<addForeignKeyConstraint baseColumnNames="charge_condition_id" baseTableName="charge_exclude_products" constraintName="FKccymyicm7knr8v0d5tsv6uflj" deferrable="false" initiallyDeferred="false" referencedColumnNames="id" referencedTableName="charge_condition" validate="true"/>
</changeSet>
</databaseChangeLog>