Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ public void on(DebitAccountCommand debitAccountCommand) throws Exception {
applyEvent(TransferWithdrawConcludedEvent.builder()
.id(debitAccountCommand.getId().toHexString())
.balance(newBalance.doubleValue())
.amount(debitAccountCommand.getAmount())
.transactionId(debitAccountCommand.getTransactionId())
.build());
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public void handle(TransferWithdrawConcludedEvent event) {
withdrawCompleted = true;
try {
CreditAccountCommand command
= new CreditAccountCommand(destinationAccountId, event.getBalance(), event.getTransactionId(), true);
= new CreditAccountCommand(destinationAccountId, event.getAmount(), event.getTransactionId(), true);
commandGateway.send(command);
} catch (Exception e) {
commandGateway.send(new FailTransactionCommand(sourceAccountId, destinationAccountId, transactionId, e.getMessage()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@
@Getter
@JsonDeserialize(builder = TransferTransactionStartedEvent.TransferTransactionStartedEventBuilder.class)
public class TransferWithdrawConcludedEvent extends AccountTransactionEvent {
private double amount;
private double balance;

@Builder
protected TransferWithdrawConcludedEvent(String id, double balance, String transactionId) {
protected TransferWithdrawConcludedEvent(String id, double amount, double balance, String transactionId) {
super(id, transactionId);
this.amount = amount;
this.balance = balance;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@
import com.ultimatesoftware.banking.account.events.TransferDepositConcludedEvent;
import com.ultimatesoftware.banking.account.events.TransferTransactionStartedEvent;
import com.ultimatesoftware.banking.account.events.TransferWithdrawConcludedEvent;
import io.micronaut.test.annotation.MicronautTest;
import org.axonframework.test.saga.SagaTestFixture;
import org.bson.types.ObjectId;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;

@MicronautTest
@Disabled
public class TransactionSagaTest {
private static final String accountId = ObjectId.get().toHexString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@
@JsonDeserialize(builder = TransferWithdrawConcludedEvent.TransferWithdrawConcludedEventBuilder.class)
public class TransferWithdrawConcludedEvent extends AccountTransactionEvent {
private double balance;
private double amount;

@Builder
protected TransferWithdrawConcludedEvent(String id, double balance, String transactionId) {
protected TransferWithdrawConcludedEvent(String id, double amount, double balance, String transactionId) {
super(id, transactionId);
this.balance = balance;
this.amount = amount;
}

@JsonPOJOBuilder(withPrefix = "")
Expand Down