Adds manual transaction processing feature
Implements functionality to manually process specific Lamassu transactions by ID, bypassing dispense checks. This allows administrators to handle transactions that may have failed due to dispense issues or were settled manually outside of the automated process. The feature includes a new UI dialog for entering the transaction ID and an API endpoint to fetch and process the transaction, crediting wallets and distributing funds according to the DCA configuration.
This commit is contained in:
parent
230beccc37
commit
fe38e08d4e
4 changed files with 272 additions and 17 deletions
|
|
@ -92,8 +92,15 @@ window.app = Vue.createApp({
|
|||
testingConnection: false,
|
||||
runningManualPoll: false,
|
||||
runningTestTransaction: false,
|
||||
processingSpecificTransaction: false,
|
||||
lamassuConfig: null,
|
||||
|
||||
// Manual transaction processing
|
||||
manualTransactionDialog: {
|
||||
show: false,
|
||||
transactionId: ''
|
||||
},
|
||||
|
||||
// Config dialog
|
||||
configDialog: {
|
||||
show: false,
|
||||
|
|
@ -586,6 +593,79 @@ window.app = Vue.createApp({
|
|||
await this.getDeposits()
|
||||
await this.getLamassuTransactions()
|
||||
await this.getLamassuConfig()
|
||||
} catch (error) {
|
||||
LNbits.utils.notifyApiError(error)
|
||||
} finally {
|
||||
this.runningTestTransaction = false
|
||||
}
|
||||
},
|
||||
|
||||
openManualTransactionDialog() {
|
||||
this.manualTransactionDialog.transactionId = ''
|
||||
this.manualTransactionDialog.show = true
|
||||
},
|
||||
|
||||
async processSpecificTransaction() {
|
||||
if (!this.manualTransactionDialog.transactionId) {
|
||||
this.$q.notify({
|
||||
type: 'warning',
|
||||
message: 'Please enter a transaction ID',
|
||||
timeout: 3000
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
this.processingSpecificTransaction = true
|
||||
try {
|
||||
const { data } = await LNbits.api.request(
|
||||
'POST',
|
||||
`/satmachineadmin/api/v1/dca/process-transaction/${this.manualTransactionDialog.transactionId}`,
|
||||
null
|
||||
)
|
||||
|
||||
if (data.already_processed) {
|
||||
this.$q.notify({
|
||||
type: 'warning',
|
||||
message: `Transaction already processed with ${data.payment_count} distributions`,
|
||||
timeout: 5000
|
||||
})
|
||||
this.manualTransactionDialog.show = false
|
||||
return
|
||||
}
|
||||
|
||||
// Show detailed results
|
||||
const details = data.transaction_details
|
||||
let dialogContent = `<strong>Manual Transaction Processing Results</strong><br/><br/>`
|
||||
dialogContent += `<strong>Transaction ID:</strong> ${details.transaction_id}<br/>`
|
||||
dialogContent += `<strong>Status:</strong> ${details.status}<br/>`
|
||||
dialogContent += `<strong>Dispense:</strong> ${details.dispense ? 'Yes' : 'No'}<br/>`
|
||||
dialogContent += `<strong>Dispense Confirmed:</strong> ${details.dispense_confirmed ? 'Yes' : 'No'}<br/>`
|
||||
dialogContent += `<strong>Crypto Amount:</strong> ${details.crypto_amount} sats<br/>`
|
||||
dialogContent += `<strong>Fiat Amount:</strong> ${details.fiat_amount}<br/>`
|
||||
dialogContent += `<br/><strong>Transaction processed successfully!</strong>`
|
||||
|
||||
this.$q.dialog({
|
||||
title: 'Transaction Processed',
|
||||
message: dialogContent,
|
||||
html: true,
|
||||
ok: {
|
||||
color: 'positive',
|
||||
label: 'Great!'
|
||||
}
|
||||
})
|
||||
|
||||
this.$q.notify({
|
||||
type: 'positive',
|
||||
message: `Transaction ${details.transaction_id} processed successfully`,
|
||||
timeout: 5000
|
||||
})
|
||||
|
||||
// Close dialog and refresh data
|
||||
this.manualTransactionDialog.show = false
|
||||
await this.getDcaClients()
|
||||
await this.getDeposits()
|
||||
await this.getLamassuTransactions()
|
||||
await this.getLamassuConfig()
|
||||
|
||||
} catch (error) {
|
||||
LNbits.utils.notifyApiError(error)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue