This commit is contained in:
boufni95 2023-11-20 19:03:33 +01:00
parent 111f869bb5
commit 969cd31775
2 changed files with 5 additions and 5 deletions

View file

@ -77,7 +77,7 @@ export default class {
// This call will fail if the transaction is already registered // 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) 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) 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 }) 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 { } catch {
@ -110,7 +110,7 @@ export default class {
} }
await this.triggerPaidCallback(log, userInvoice.callbackUrl) 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 }) 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") log("paid invoice processed successfully")
} catch (err: any) { } catch (err: any) {

View file

@ -170,7 +170,7 @@ export default class {
return { return {
preimage: payment ? payment.paymentPreimage : "", preimage: payment ? payment.paymentPreimage : "",
amount_paid: payment ? Number(payment.valueSat) : payAmount, 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, network_fee: routingFees,
service_fee: serviceFee 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) const newTx = await this.storage.paymentStorage.AddUserTransactionPayment(ctx.user_id, req.address, txId, 0, req.amoutSats, chainFees, serviceFee, !!internalAddress)
return { return {
txId: txId, txId: txId,
operation_id: `${+Types.UserOperationType.OUTGOING_TX}-${newTx.serial_id}`, operation_id: `${Types.UserOperationType.OUTGOING_TX}-${newTx.serial_id}`,
network_fee: chainFees, network_fee: chainFees,
service_fee: serviceFee service_fee: serviceFee
} }
@ -348,7 +348,7 @@ export default class {
amount: o.paid_amount, amount: o.paid_amount,
paidAtUnix: o.paid_at_unix, paidAtUnix: o.paid_at_unix,
identifier, identifier,
operationId: `${+type}-${o.serial_id}`, operationId: `${type}-${o.serial_id}`,
network_fee: o.chain_fees || o.routing_fees || 0, network_fee: o.chain_fees || o.routing_fees || 0,
service_fee: o.service_fee || o.service_fees || 0 service_fee: o.service_fee || o.service_fees || 0
} }