minor fixes

This commit is contained in:
2026-06-23 00:22:47 +02:00
parent 299cdf6e35
commit a84a1000a8
5 changed files with 67 additions and 5 deletions

View File

@@ -10,7 +10,9 @@ import io.nflow.engine.workflow.instance.WorkflowInstanceAction;
import io.nflow.engine.workflow.instance.WorkflowInstanceFactory; import io.nflow.engine.workflow.instance.WorkflowInstanceFactory;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import net.kaczmarzyk.spring.data.jpa.domain.Equal; import net.kaczmarzyk.spring.data.jpa.domain.Equal;
import net.kaczmarzyk.spring.data.jpa.domain.EqualIgnoreCase;
import net.kaczmarzyk.spring.data.jpa.domain.In; import net.kaczmarzyk.spring.data.jpa.domain.In;
import net.kaczmarzyk.spring.data.jpa.domain.LikeIgnoreCase;
import net.kaczmarzyk.spring.data.jpa.web.annotation.Or; import net.kaczmarzyk.spring.data.jpa.web.annotation.Or;
import net.kaczmarzyk.spring.data.jpa.web.annotation.Spec; import net.kaczmarzyk.spring.data.jpa.web.annotation.Spec;
import net.kaczmarzyk.spring.data.jpa.web.annotation.Conjunction; import net.kaczmarzyk.spring.data.jpa.web.annotation.Conjunction;
@@ -57,7 +59,8 @@ public class TransactonController {
@Conjunction(value = { @Conjunction(value = {
@Or({ @Or({
@Spec(path = "status", spec = Equal.class), @Spec(path = "status", spec = Equal.class),
@Spec(path = "createdAt", spec = Equal.class), @Spec(path = "createdAt", spec = Equal.class),
@Spec(path = "billName", spec = LikeIgnoreCase.class),
@Spec(path = "providerLabel", spec = Equal.class), @Spec(path = "providerLabel", spec = Equal.class),
@Spec(path = "billClientId", spec = Equal.class), @Spec(path = "billClientId", spec = Equal.class),
@Spec(path = "productUid", spec = Equal.class), @Spec(path = "productUid", spec = Equal.class),

View File

@@ -39,6 +39,7 @@ public class Transaction extends BaseEntity {
private String userId; private String userId;
private String trace; private String trace;
private String region; private String region;
@Enumerated(EnumType.STRING)
private PartyType partyType; private PartyType partyType;
private BigDecimal amount; private BigDecimal amount;
private BigDecimal charge; private BigDecimal charge;

View File

@@ -119,6 +119,7 @@ public class GroupBatchWorkflowService {
transaction.setPaymentProcessorName(batch.getPaymentProcessorName()); transaction.setPaymentProcessorName(batch.getPaymentProcessorName());
transaction.setPaymentProcessorImage(batch.getPaymentProcessorImage()); transaction.setPaymentProcessorImage(batch.getPaymentProcessorImage());
transaction.setBatchId(batch.getId()); transaction.setBatchId(batch.getId());
transaction.setBillName("Batch - " + batch.getDescription());
transaction = calculateChargesHandler.process(transaction); transaction = calculateChargesHandler.process(transaction);
transaction = (Transaction) cleanUpHandler.process(transaction); transaction = (Transaction) cleanUpHandler.process(transaction);
@@ -194,6 +195,9 @@ public class GroupBatchWorkflowService {
batch.setStatus(GroupBatchStatus.PARTIAL); batch.setStatus(GroupBatchStatus.PARTIAL);
} else { } else {
batch.setStatus(GroupBatchStatus.COMPLETED); batch.setStatus(GroupBatchStatus.COMPLETED);
Transaction paymentTransaction = transactionService.findById(batch.getPaymentTransactionId());
paymentTransaction.setIntegrationStatus(Status.SUCCESS);
transactionService.save(paymentTransaction);
} }
batch.setCompletedAt(LocalDateTime.now()); batch.setCompletedAt(LocalDateTime.now());

View File

@@ -7,7 +7,7 @@ server.port=6950
server.servlet.context-path=/api server.servlet.context-path=/api
spring.jpa.hibernate.ddl-auto=validate spring.jpa.hibernate.ddl-auto=update
spring.datasource.driver-class-name=org.postgresql.Driver spring.datasource.driver-class-name=org.postgresql.Driver
spring.datasource.url=jdbc:postgresql://localhost:5432/qpay?useLegacyDatetimeCode=false spring.datasource.url=jdbc:postgresql://localhost:5432/qpay?useLegacyDatetimeCode=false

View File

@@ -1,8 +1,62 @@
<?xml version="1.1" encoding="UTF-8" standalone="no"?> <?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"> <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="khoza (generated)" id="1781993557092-7"> <changeSet author="khoza (generated)" id="1782161994502-9">
<addColumn tableName="group_batch_item"> <createIndex indexName="IX_charge_exclude_productsPK" tableName="charge_exclude_products" unique="true">
<column name="recipient_account" type="varchar(255)"/> <column name="charge_id"/>
<column name="charge_condition_id"/>
</createIndex>
</changeSet>
<changeSet author="khoza (generated)" id="1782161994502-10">
<createIndex indexName="IX_charge_include_productsPK" tableName="charge_include_products" unique="true">
<column name="charge_id"/>
<column name="charge_condition_id"/>
</createIndex>
</changeSet>
<changeSet author="khoza (generated)" id="1782161994502-11">
<createIndex indexName="IX_workspace_usersPK" tableName="workspace_users" unique="true">
<column name="workspace_id"/>
<column name="user_id"/>
</createIndex>
</changeSet>
<changeSet author="khoza (generated)" id="1782161994502-1">
<dropPrimaryKey tableName="charge_exclude_products"/>
</changeSet>
<changeSet author="khoza (generated)" id="1782161994502-2">
<addPrimaryKey columnNames="charge_id, charge_condition_id" constraintName="charge_exclude_productsPK" tableName="charge_exclude_products"/>
</changeSet>
<changeSet author="khoza (generated)" id="1782161994502-3">
<dropPrimaryKey tableName="charge_include_products"/>
</changeSet>
<changeSet author="khoza (generated)" id="1782161994502-4">
<addPrimaryKey columnNames="charge_id, charge_condition_id" constraintName="charge_include_productsPK" tableName="charge_include_products"/>
</changeSet>
<changeSet author="khoza (generated)" id="1782161994502-5">
<dropPrimaryKey tableName="workspace_users"/>
</changeSet>
<changeSet author="khoza (generated)" id="1782161994502-6">
<addPrimaryKey columnNames="workspace_id, user_id" constraintName="workspace_usersPK" tableName="workspace_users"/>
</changeSet>
<changeSet author="khoza" id="convert-party-type-to-string">
<comment>Convert party_type column from integer ordinal to string enum values to match @Enumerated(EnumType.STRING) in Transaction.java</comment>
<!-- Add a temporary VARCHAR column -->
<addColumn tableName="transaction">
<column name="party_type_str" type="VARCHAR(20)">
<constraints nullable="true"/>
</column>
</addColumn> </addColumn>
<!-- Convert existing ordinal integer values (0=INDIVIDUAL, 1=GROUP, 2=BATCH) to strings -->
<sql>
UPDATE transaction SET party_type_str = 'INDIVIDUAL' WHERE party_type = 0 OR party_type = '0';
UPDATE transaction SET party_type_str = 'GROUP' WHERE party_type = 1 OR party_type = '1';
UPDATE transaction SET party_type_str = 'BATCH' WHERE party_type = 2 OR party_type = '2';
</sql>
<!-- Drop old integer column -->
<dropColumn tableName="transaction" columnName="party_type"/>
<!-- Rename temp column to original name -->
<renameColumn tableName="transaction" oldColumnName="party_type_str" newColumnName="party_type"/>
</changeSet> </changeSet>
</databaseChangeLog> </databaseChangeLog>