From 969cd31775d6117b6bd3e4d528b940cf5151e855 Mon Sep 17 00:00:00 2001 From: boufni95 Date: Mon, 20 Nov 2023 19:03:33 +0100 Subject: [PATCH] fix NaN --- src/services/main/index.ts | 4 ++-- src/services/main/paymentManager.ts | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/services/main/index.ts b/src/services/main/index.ts index 68635d6c..d0923c7c 100644 --- a/src/services/main/index.ts +++ b/src/services/main/index.ts @@ -77,7 +77,7 @@ export default class { // This call will fail if the transaction is already registered const addedTx = await this.storage.paymentStorage.AddAddressReceivingTransaction(userAddress, txOutput.hash, txOutput.index, amount, fee, internal, tx) await this.storage.userStorage.IncrementUserBalance(userAddress.user.user_id, addedTx.paid_amount - fee, tx) - const operationId = `${+Types.UserOperationType.INCOMING_TX}-${userAddress.serial_id}` + const operationId = `${Types.UserOperationType.INCOMING_TX}-${userAddress.serial_id}` this.triggerSubs(userAddress.user.user_id, { amount, paidAtUnix: Date.now() / 1000, inbound: true, type: Types.UserOperationType.INCOMING_TX, identifier: userAddress.address, operationId, network_fee: 0, service_fee: fee }) } catch { @@ -110,7 +110,7 @@ export default class { } await this.triggerPaidCallback(log, userInvoice.callbackUrl) - const operationId = `${+Types.UserOperationType.INCOMING_INVOICE}-${userInvoice.serial_id}` + const operationId = `${Types.UserOperationType.INCOMING_INVOICE}-${userInvoice.serial_id}` this.triggerSubs(userInvoice.user.user_id, { amount, paidAtUnix: Date.now() / 1000, inbound: true, type: Types.UserOperationType.INCOMING_INVOICE, identifier: userInvoice.invoice, operationId, network_fee: 0, service_fee: fee }) log("paid invoice processed successfully") } catch (err: any) { diff --git a/src/services/main/paymentManager.ts b/src/services/main/paymentManager.ts index dc3ef97e..8ae065c1 100644 --- a/src/services/main/paymentManager.ts +++ b/src/services/main/paymentManager.ts @@ -170,7 +170,7 @@ export default class { return { preimage: payment ? payment.paymentPreimage : "", amount_paid: payment ? Number(payment.valueSat) : payAmount, - operation_id: `${+Types.UserOperationType.OUTGOING_INVOICE}-${newPayment.serial_id}`, + operation_id: `${Types.UserOperationType.OUTGOING_INVOICE}-${newPayment.serial_id}`, network_fee: routingFees, service_fee: serviceFee } @@ -210,7 +210,7 @@ export default class { const newTx = await this.storage.paymentStorage.AddUserTransactionPayment(ctx.user_id, req.address, txId, 0, req.amoutSats, chainFees, serviceFee, !!internalAddress) return { txId: txId, - operation_id: `${+Types.UserOperationType.OUTGOING_TX}-${newTx.serial_id}`, + operation_id: `${Types.UserOperationType.OUTGOING_TX}-${newTx.serial_id}`, network_fee: chainFees, service_fee: serviceFee } @@ -348,7 +348,7 @@ export default class { amount: o.paid_amount, paidAtUnix: o.paid_at_unix, identifier, - operationId: `${+type}-${o.serial_id}`, + operationId: `${type}-${o.serial_id}`, network_fee: o.chain_fees || o.routing_fees || 0, service_fee: o.service_fee || o.service_fees || 0 }