Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: ability to approve multiple transactions, approve dispatch for multiple transactions as well as rejection of multiple transactions #11

Merged
merged 9 commits into from
Aug 12, 2024
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
@Builder(toBuilder = true)
@EqualsAndHashCode
@ToString
@NoArgsConstructor
public class Account {

@LOB_ERPSourceVersionRelevant
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
@Builder(toBuilder = true)
@EqualsAndHashCode
@ToString
@NoArgsConstructor
public class AccountEvent {

private @Size(min = 1, max = 255) String code;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
@Builder
@EqualsAndHashCode
@ToString
@NoArgsConstructor
public class CoreCurrency {

private IsoStandard currencyISOStandard;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
@Builder(toBuilder = true)
@EqualsAndHashCode
@ToString
@NoArgsConstructor
public class CostCenter {

@LOB_ERPSourceVersionRelevant
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
@Builder(toBuilder = true)
@EqualsAndHashCode
@ToString
@NoArgsConstructor
public class Counterparty {

@LOB_ERPSourceVersionRelevant
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
@Builder(toBuilder = true)
@EqualsAndHashCode
@ToString
@NoArgsConstructor
public class Currency {

@NotBlank
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@

import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.*;
import org.cardanofoundation.lob.app.accounting_reporting_core.domain.core.annotations.LOB_ERPSourceVersionRelevant;

import java.util.Optional;
Expand All @@ -14,6 +11,7 @@
@Getter
@AllArgsConstructor
@EqualsAndHashCode
@NoArgsConstructor
public class Organisation {

@LOB_ERPSourceVersionRelevant
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
@Builder(toBuilder = true)
@EqualsAndHashCode
@ToString
@NoArgsConstructor
public class Vat {

@LOB_ERPSourceVersionRelevant
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
@Embeddable
@AllArgsConstructor
@NoArgsConstructor
@Getter
@EqualsAndHashCode
@Builder(toBuilder = true)
public class Account {

@NotBlank
@LOB_ERPSourceVersionRelevant
@Getter
private String code;

@Nullable
Expand All @@ -34,4 +34,12 @@ public Optional<String> getName() {
return Optional.ofNullable(name);
}

public void setRefCode(Optional<String> refCode) {
this.refCode = refCode.orElse(null);
}

public void setName(Optional<String> name) {
this.name = name.orElse(null);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
import java.math.BigDecimal;
import java.util.Optional;

@Getter
@Setter
@Entity(name = "accounting_reporting_core.TransactionItemEntity")
@Table(name = "accounting_core_transaction_item")
@NoArgsConstructor
Expand All @@ -26,6 +24,7 @@ public class TransactionItemEntity extends AuditEntity implements Persistable<St
@Id
@Column(name = "transaction_item_id", nullable = false)
@LOB_ERPSourceVersionRelevant
@Setter
private String id;

@Override
Expand Down Expand Up @@ -60,10 +59,14 @@ public String getId() {

@Column(name = "amount_fcy", nullable = false)
@LOB_ERPSourceVersionRelevant
@Getter
@Setter
private BigDecimal amountFcy;

@Column(name = "amount_lcy", nullable = false)
@LOB_ERPSourceVersionRelevant
@Getter
@Setter
private BigDecimal amountLcy;

@Embedded
Expand All @@ -75,10 +78,14 @@ public String getId() {

@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "transaction_id")
@Getter
@Setter
private TransactionEntity transaction;

@Column(name = "fx_rate", nullable = false)
@LOB_ERPSourceVersionRelevant
@Getter
@Setter
private BigDecimal fxRate;

@Embedded
Expand Down Expand Up @@ -155,6 +162,35 @@ public Optional<Rejection> getRejection() {
return Optional.ofNullable(rejection);
}

// setters
public void setAccountDebit(Optional<Account> account) {
this.accountDebit = account.orElse(null);
}

public void setAccountCredit(Optional<Account> account) {
this.accountCredit = account.orElse(null);
}

public void setAccountEvent(Optional<AccountEvent> accountEvent) {
this.accountEvent = accountEvent.orElse(null);
}

public void setProject(Optional<Project> project) {
this.project = project.orElse(null);
}

public void setCostCenter(Optional<CostCenter> costCenter) {
this.costCenter = costCenter.orElse(null);
}

public void setDocument(Optional<Document> document) {
this.document = document.orElse(null);
}

public void setRejection(Optional<Rejection> rejection) {
this.rejection = rejection.orElse(null);
}

public Optional<OperationType> getOperationType() {
val amountLcy = this.amountLcy.intValue();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"notification_gateway", "notification_gateway::domain_core", "notification_gateway::domain_event",
"organisation", "organisation::domain_core", "organisation::domain_entity",
"support::audit",
"support::problem_support",
"support::crypto",
"support::collections",
"support::reactive"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,8 @@ public Optional<TransactionBatchEntity> findById(String batchId) {
return transactionBatchRepository.findById(batchId);
}

// TODO: Pagination need to be implemented
public List<TransactionBatchEntity> findByOrganisationId(String organisationId) {
/**
* Todo: Pagination need to be implemented.
*/
return transactionBatchRepository.findAllByFilteringParametersOrganisationId(organisationId);
}

Expand All @@ -36,4 +34,5 @@ public List<TransactionBatchEntity> findByFilter(BatchSearchRequest body) {
public Long findByFilterCount(BatchSearchRequest body) {
return transactionBatchRepository.findByFilterCount(body);
}

}
Loading
Loading