Skip to content

Commit

Permalink
Record original amount on mirrored transaction
Browse files Browse the repository at this point in the history
  • Loading branch information
victordrumond committed Nov 13, 2023
1 parent 5c20bb4 commit 5c35088
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions gcf/src/EventHandlerTransactionEvent.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Account, AccountType, Book, Transaction } from "bkper";
import { getBaseCode } from "./BotService";
import { EXC_CODE_PROP, EXC_RATE_PROP, EXC_LOG_PROP } from "./constants";
import { EXC_CODE_PROP, EXC_RATE_PROP, EXC_LOG_PROP, EXC_AMOUNT_PROP } from "./constants";
import { EventHandlerTransaction } from "./EventHandlerTransaction";

export abstract class EventHandlerTransactionEvent extends EventHandlerTransaction {
Expand Down Expand Up @@ -58,11 +58,17 @@ export abstract class EventHandlerTransactionEvent extends EventHandlerTransacti
;

if (amountDescription.excBaseCode) {
// Exchange code prop
newTransaction.setProperty(EXC_CODE_PROP, amountDescription.excBaseCode);
}

if (amountDescription.excBaseRate) {
newTransaction.setProperty(EXC_RATE_PROP, amountDescription.excBaseRate.toString())
// Exchange rate prop
newTransaction.setProperty(EXC_RATE_PROP, amountDescription.excBaseRate.toString());
// Exchange amount prop
if (transaction.amount) {
newTransaction.setProperty(EXC_AMOUNT_PROP, transaction.amount);
}
}

if (amountDescription.rates) {
Expand Down

0 comments on commit 5c35088

Please sign in to comment.