completed initial scaffolding for services
This commit is contained in:
67
src/main/java/zw/qantra/tm/domain/models/Charge.java
Normal file
67
src/main/java/zw/qantra/tm/domain/models/Charge.java
Normal file
@@ -0,0 +1,67 @@
|
||||
package zw.qantra.tm.domain.models;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.*;
|
||||
import zw.qantra.tm.domain.enums.ChargeLabelEnum;
|
||||
import zw.qantra.tm.domain.enums.CurrencyType;
|
||||
import zw.qantra.tm.domain.enums.TargetEvent;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class Charge {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.UUID)
|
||||
private UUID id;
|
||||
|
||||
private String description;
|
||||
|
||||
// % rate to charge
|
||||
private BigDecimal percentageRate;
|
||||
private BigDecimal flat;
|
||||
private boolean composite; // composite is % plus flat
|
||||
private boolean global;
|
||||
|
||||
private BigDecimal min;
|
||||
private BigDecimal max;
|
||||
private BigDecimal minimumAmount;
|
||||
private BigDecimal maximumAmount;
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
private ChargeLabelEnum chargeLabel;
|
||||
@Enumerated(EnumType.STRING)
|
||||
private CurrencyType currency;
|
||||
private String account;
|
||||
private String target;
|
||||
private String targetValue;
|
||||
@Enumerated(EnumType.STRING)
|
||||
private TargetEvent targetEvent; // include / exclude
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
|
||||
@JoinTable(
|
||||
name = "charge_include_products",
|
||||
joinColumns = @JoinColumn(name = "charge_id"),
|
||||
inverseJoinColumns = @JoinColumn(name = "charge_condition_id")
|
||||
)
|
||||
private Set<ChargeCondition> includes = new HashSet<>();
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
|
||||
@JoinTable(
|
||||
name = "charge_exclude_products",
|
||||
joinColumns = @JoinColumn(name = "charge_id"),
|
||||
inverseJoinColumns = @JoinColumn(name = "charge_condition_id")
|
||||
)
|
||||
private Set<ChargeCondition> excludes = new HashSet<>();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package zw.qantra.tm.domain.models;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import lombok.*;
|
||||
import zw.qantra.tm.domain.enums.ChargeConditionType;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ChargeCondition {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.UUID)
|
||||
private UUID id;
|
||||
|
||||
private String name;
|
||||
@Enumerated(EnumType.STRING)
|
||||
private ChargeConditionType type;
|
||||
@Column(columnDefinition = "longtext")
|
||||
private String codes;
|
||||
|
||||
@ManyToMany(mappedBy = "includes")
|
||||
List<Charge> includeCharges;
|
||||
@ManyToMany(mappedBy = "excludes")
|
||||
List<Charge> excludeCharges;
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
package zw.qantra.tm.domain.models;
|
||||
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.GenerationType;
|
||||
import jakarta.persistence.Id;
|
||||
import lombok.*;
|
||||
import zw.qantra.tm.domain.enums.RequestType;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.UUID;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ConfirmTransaction {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.UUID)
|
||||
private UUID id;
|
||||
|
||||
private String trace;
|
||||
private BigDecimal amount;
|
||||
private String reference;
|
||||
private String providerUid;
|
||||
private String productUid;
|
||||
private String paymentProcessorLabel;
|
||||
private String integrationProcessorLabel;
|
||||
private String rrn;
|
||||
private String channelName;
|
||||
private String channel;
|
||||
private String debitPhone;
|
||||
private String debitAccount;
|
||||
private String debitCurrency;
|
||||
private String debitName;
|
||||
private String debitCard;
|
||||
private String debitRef;
|
||||
private String creditPhone;
|
||||
private String creditAccount;
|
||||
private String creditCurrency;
|
||||
private String creditName;
|
||||
private String creditCard;
|
||||
private String creditRef;
|
||||
private String billClientId;
|
||||
private String clientSecret;
|
||||
private String aggregatorId;
|
||||
private String billName;
|
||||
private String billProductName;
|
||||
private RequestType type;
|
||||
}
|
||||
@@ -1,10 +1,14 @@
|
||||
package zw.qantra.tm.domain.models;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.*;
|
||||
import zw.qantra.tm.domain.enums.CurrencyType;
|
||||
import zw.qantra.tm.domain.enums.RequestType;
|
||||
import zw.qantra.tm.domain.enums.Status;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@Entity
|
||||
@@ -13,6 +17,7 @@ import java.util.UUID;
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class Transaction {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.UUID)
|
||||
@@ -20,6 +25,10 @@ public class Transaction {
|
||||
|
||||
private String trace;
|
||||
private BigDecimal amount;
|
||||
private BigDecimal charge;
|
||||
private BigDecimal gatewayCharge;
|
||||
private BigDecimal tax;
|
||||
private BigDecimal totalAmount;
|
||||
private String reference;
|
||||
private String providerUid;
|
||||
private String productUid;
|
||||
@@ -30,13 +39,13 @@ public class Transaction {
|
||||
private String channel;
|
||||
private String debitPhone;
|
||||
private String debitAccount;
|
||||
private String debitCurrency;
|
||||
private CurrencyType debitCurrency;
|
||||
private String debitName;
|
||||
private String debitCard;
|
||||
private String debitRef;
|
||||
private String creditPhone;
|
||||
private String creditAccount;
|
||||
private String creditCurrency;
|
||||
private CurrencyType creditCurrency;
|
||||
private String creditName;
|
||||
private String creditCard;
|
||||
private String creditRef;
|
||||
@@ -46,4 +55,11 @@ public class Transaction {
|
||||
private String billName;
|
||||
private String billProductName;
|
||||
private RequestType type;
|
||||
|
||||
private String errorMessage;
|
||||
private String responseCode;
|
||||
private Status status;
|
||||
@Transient
|
||||
private List<Object> additionalData;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user