|
|
|
@ -117,17 +117,22 @@ export class TransactionController { |
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
this.exchangeRateService.convertCurrency(exhangeRateInput).subscribe({ |
|
|
|
|
next: async (exchangeRateResponse) => { |
|
|
|
|
next: (exchangeRateResponse) => |
|
|
|
|
commissionAmount |
|
|
|
|
.then((commission) => |
|
|
|
|
this.transactionService.insertOne({ |
|
|
|
|
date: transactionInput.date, |
|
|
|
|
amount: parseInt(transactionInput.amount), |
|
|
|
|
currency: transactionInput.currency, |
|
|
|
|
client_id: transactionInput.client_id, |
|
|
|
|
commission: await commissionAmount, |
|
|
|
|
commission, |
|
|
|
|
base_currency: Currency.EUR, |
|
|
|
|
base_amount: parseInt(transactionInput.amount) * exchangeRateResponse[transactionInput.currency], |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
base_amount: |
|
|
|
|
parseInt(transactionInput.amount) * |
|
|
|
|
exchangeRateResponse[transactionInput.currency], |
|
|
|
|
}), |
|
|
|
|
) |
|
|
|
|
.catch((error) => console.log(error)), |
|
|
|
|
error: (error) => { |
|
|
|
|
console.log(error); |
|
|
|
|
}, |
|
|
|
@ -145,7 +150,8 @@ export class TransactionController { |
|
|
|
|
transactionInput, |
|
|
|
|
); |
|
|
|
|
try { |
|
|
|
|
this.transactionService.insertOne({ |
|
|
|
|
this.transactionService |
|
|
|
|
.insertOne({ |
|
|
|
|
date: transactionInput.date, |
|
|
|
|
amount: parseInt(transactionInput.amount), |
|
|
|
|
currency: transactionInput.currency, |
|
|
|
@ -153,7 +159,8 @@ export class TransactionController { |
|
|
|
|
commission: commissionAmount, |
|
|
|
|
base_currency: Currency.EUR, |
|
|
|
|
base_amount: parseInt(transactionInput.amount), |
|
|
|
|
}); |
|
|
|
|
}) |
|
|
|
|
.catch((error) => console.log(error)); |
|
|
|
|
} catch (error) { |
|
|
|
|
console.log(error); |
|
|
|
|
throw error; |
|
|
|
|