Browse Source

Check currency in import validation

Avoid importing transactions in wrong currency
pull/538/head
Thomas 4 years ago
parent
commit
7b42a0ca35
  1. 6
      apps/api/src/app/import/import.service.ts
  2. 2
      test/import/invalid-currency.csv

6
apps/api/src/app/import/import.service.ts

@ -104,6 +104,12 @@ export class ImportService {
`orders.${index}.symbol ("${symbol}") is not valid for the specified data source ("${dataSource}")`
);
}
if (result[symbol].currency !== currency) {
throw new Error(
`orders.${index}.currency ("${currency}") does not match with "${result[symbol].currency}"`
);
}
}
}
}

2
test/import/invalid-currency.csv

@ -0,0 +1,2 @@
Date,Code,Currency,Price,Quantity,Action,Fee
12/12/2021,BTC,EUR,44558.42,1,buy,0
1 Date Code Currency Price Quantity Action Fee
2 12/12/2021 BTC EUR 44558.42 1 buy 0
Loading…
Cancel
Save