Adds lightning payment option for settling receivables
Implements the ability for users to settle their outstanding balance using a Lightning Network invoice. Generates an invoice on the Castle wallet and polls for payment, automatically recording the transaction once payment is detected. The UI is updated to display the invoice and handle the payment process.
This commit is contained in:
parent
1412359172
commit
a2a58d323b
2 changed files with 189 additions and 4 deletions
|
|
@ -1161,6 +1161,7 @@
|
|||
dense
|
||||
v-model="settleReceivableDialog.payment_method"
|
||||
:options="[
|
||||
{label: 'Lightning Invoice', value: 'lightning'},
|
||||
{label: 'Cash', value: 'cash'},
|
||||
{label: 'Bank Transfer', value: 'bank_transfer'},
|
||||
{label: 'Check', value: 'check'},
|
||||
|
|
@ -1174,7 +1175,46 @@
|
|||
:rules="[val => !!val || 'Payment method is required']"
|
||||
></q-select>
|
||||
|
||||
<!-- Show invoice if lightning method selected and generated -->
|
||||
<div v-if="settleReceivableDialog.payment_method === 'lightning' && settleReceivableDialog.invoice">
|
||||
<q-separator class="q-my-md"></q-separator>
|
||||
|
||||
<div class="text-center q-mb-md">
|
||||
<div class="text-subtitle2 q-mb-sm">Lightning Invoice Generated</div>
|
||||
<qrcode-vue
|
||||
:value="settleReceivableDialog.invoice"
|
||||
:size="280"
|
||||
level="M"
|
||||
class="q-mb-md"
|
||||
></qrcode-vue>
|
||||
|
||||
<q-input
|
||||
filled
|
||||
dense
|
||||
readonly
|
||||
v-model="settleReceivableDialog.invoice"
|
||||
label="Invoice"
|
||||
>
|
||||
<template v-slot:append>
|
||||
<q-btn
|
||||
flat
|
||||
dense
|
||||
icon="content_copy"
|
||||
@click="copyToClipboard(settleReceivableDialog.invoice)"
|
||||
>
|
||||
<q-tooltip>Copy invoice</q-tooltip>
|
||||
</q-btn>
|
||||
</template>
|
||||
</q-input>
|
||||
|
||||
<div class="text-caption text-grey q-mt-sm">
|
||||
Waiting for payment...
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<q-input
|
||||
v-if="settleReceivableDialog.payment_method !== 'lightning'"
|
||||
filled
|
||||
dense
|
||||
v-model="settleReceivableDialog.description"
|
||||
|
|
@ -1185,6 +1225,7 @@
|
|||
></q-input>
|
||||
|
||||
<q-input
|
||||
v-if="settleReceivableDialog.payment_method !== 'lightning'"
|
||||
filled
|
||||
dense
|
||||
v-model="settleReceivableDialog.reference"
|
||||
|
|
@ -1194,9 +1235,28 @@
|
|||
></q-input>
|
||||
|
||||
<div class="row q-mt-md q-gutter-sm">
|
||||
<q-btn unelevated color="primary" type="submit" :loading="settleReceivableDialog.loading">
|
||||
<!-- For lightning: generate invoice button, then it auto-settles on payment -->
|
||||
<q-btn
|
||||
v-if="settleReceivableDialog.payment_method === 'lightning' && !settleReceivableDialog.invoice"
|
||||
unelevated
|
||||
color="primary"
|
||||
@click="generateSettlementInvoice"
|
||||
:loading="settleReceivableDialog.loading"
|
||||
>
|
||||
Generate Invoice
|
||||
</q-btn>
|
||||
|
||||
<!-- For non-lightning: manual settle button -->
|
||||
<q-btn
|
||||
v-if="settleReceivableDialog.payment_method !== 'lightning'"
|
||||
unelevated
|
||||
color="primary"
|
||||
type="submit"
|
||||
:loading="settleReceivableDialog.loading"
|
||||
>
|
||||
Settle Receivable
|
||||
</q-btn>
|
||||
|
||||
<q-btn v-close-popup flat color="grey">Cancel</q-btn>
|
||||
</div>
|
||||
</q-form>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue