refactor: drop the SatsPay/watchonly on-chain surface
v1.6.8 sells tickets on-chain through SatsPay charges — a per-purchase watchonly address, a hosted charge page, and a webhook back into the extension. We are not adopting that: on-chain goes through the fork's native LndRestWallet support once core can mint purpose-bound receiving addresses (aiolabs/lnbits#53). This is the parity note on #41, applied as its own commit so the merge it follows stays a faithful diff of what upstream shipped. Removed: - services: the five SatsPay/watchonly HTTP clients (and with them the only uses of httpx and typing.Any in that module) - views_api: _get_watchonly_status, GET /events/onchain/status, the SatsPay charge branch of api_ticket_create, POST /tickets/{id}/satspay-webhook, PUT /tickets/{hash}/onchain-confirm - models: EventExtra.onchain_{enabled,wallet_id,zeroconf,fasttrack}, TicketExtra.satspay_charge_id, TicketPaymentRequest.satspay_charge_url - frontend: the organiser's "Onchain payments" panel and its watchonly wallet picker, the per-ticket confirm-onchain button, the SatsPay charge-page redirect, and the wallet-status fetch behind them `onchain` is no longer an accepted payment_method — there is no rail to fulfil it until #41 lands, so accepting it could only fail later. Kept as vocabulary for #41, in upstream's field names so it needs no migration: TicketExtra.onchain / onchain_address and TicketPaymentRequest.onchain_amount_sat. 35 routes register with no duplicates; ruff, black, prettier clean; 97 tests pass; mypy error set still identical to HEAD's baseline.
This commit is contained in:
parent
ae5affa44f
commit
d90a0f8322
6 changed files with 10 additions and 377 deletions
|
|
@ -83,19 +83,13 @@ window.PageEventsDisplay = {
|
|||
},
|
||||
paymentMethodOptions() {
|
||||
// Options come from `paymentMethods` — the same list the backend
|
||||
// validates against in `effective_payment_methods` — rather than being
|
||||
// re-derived from per-method booleans. v1.6.8 added a second copy of
|
||||
// this computed that built the list from `allow_fiat`/`onchain_enabled`
|
||||
// instead; because it was defined later in the object it silently won
|
||||
// the merge, and it offers a "Bitcoin" option for any event with
|
||||
// `extra.onchain_enabled` even though the backend rejects `onchain`
|
||||
// unless it is in `extra.payment_methods` (views_api: "not in
|
||||
// effective_payment_methods"). Labels below are upstream's; the source
|
||||
// of the list is ours.
|
||||
// validates against in `effective_payment_methods` — rather than
|
||||
// being re-derived from per-method booleans, so a rail the server
|
||||
// would reject can never be offered. The `|| method` fallback covers
|
||||
// a method with no label yet (on-chain, once #41 lands).
|
||||
const labels = {
|
||||
lightning: 'Lightning',
|
||||
fiat: this.fiatCheckoutLabel,
|
||||
onchain: 'Bitcoin'
|
||||
fiat: this.fiatCheckoutLabel
|
||||
}
|
||||
return this.paymentMethods.map(method => ({
|
||||
value: method,
|
||||
|
|
@ -243,11 +237,6 @@ window.PageEventsDisplay = {
|
|||
: this.paymentMethods[0] || 'lightning'
|
||||
}
|
||||
)
|
||||
if (data.satspay_charge_url) {
|
||||
window.location.href = data.satspay_charge_url
|
||||
return
|
||||
}
|
||||
|
||||
const isFiat = Boolean(data.is_fiat)
|
||||
this.paymentReq = isFiat
|
||||
? data.fiat_payment_request || null
|
||||
|
|
|
|||
|
|
@ -272,8 +272,7 @@ window.PageEvents = {
|
|||
promo_codes: []
|
||||
}
|
||||
}
|
||||
},
|
||||
onchainWallets: []
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
|
@ -302,42 +301,6 @@ window.PageEvents = {
|
|||
if (!value) return ''
|
||||
return value.length > 4 ? `${value.slice(0, 4)}...` : value
|
||||
},
|
||||
async loadOnchainWallets() {
|
||||
const wallet = _.findWhere(this.g.user.wallets, {
|
||||
id: this.formDialog.data.wallet
|
||||
})
|
||||
if (!wallet) return
|
||||
try {
|
||||
const {data} = await LNbits.api.request(
|
||||
'GET',
|
||||
'/events/api/v1/events/onchain/status',
|
||||
wallet.adminkey
|
||||
)
|
||||
this.onchainWallets = data.available ? data.wallets || [] : []
|
||||
} catch {
|
||||
this.onchainWallets = []
|
||||
}
|
||||
},
|
||||
async confirmOnchainTicket(ticket) {
|
||||
const wallet = _.findWhere(this.g.user.wallets, {id: ticket.wallet})
|
||||
if (!wallet) return
|
||||
try {
|
||||
await LNbits.api.request(
|
||||
'PUT',
|
||||
`/events/api/v1/tickets/${ticket.id}/onchain-confirm`,
|
||||
wallet.adminkey
|
||||
)
|
||||
Quasar.Notify.create({
|
||||
type: 'positive',
|
||||
message: 'Onchain payment confirmed.',
|
||||
icon: null
|
||||
})
|
||||
await this.getTickets()
|
||||
await this.getAllTickets()
|
||||
} catch (error) {
|
||||
LNbits.utils.notifyApiError(error)
|
||||
}
|
||||
},
|
||||
primaryTicketWave(data = this.formDialog.data) {
|
||||
if (!data.extra) data.extra = {}
|
||||
if (!data.extra.ticket_waves || data.extra.ticket_waves.length === 0) {
|
||||
|
|
@ -841,10 +804,6 @@ window.PageEvents = {
|
|||
min_tickets: 1,
|
||||
email_notifications: false,
|
||||
nostr_notifications: false,
|
||||
onchain_enabled: false,
|
||||
onchain_wallet_id: null,
|
||||
onchain_zeroconf: false,
|
||||
onchain_fasttrack: false,
|
||||
ticket_waves: [
|
||||
{
|
||||
id: 'primary',
|
||||
|
|
@ -867,12 +826,6 @@ window.PageEvents = {
|
|||
}
|
||||
}
|
||||
this.formDialog.show = true
|
||||
if (
|
||||
this.formDialog.data.wallet &&
|
||||
this.formDialog.data.extra?.onchain_enabled
|
||||
) {
|
||||
this.loadOnchainWallets()
|
||||
}
|
||||
},
|
||||
resetEventDialog() {
|
||||
this.formDialog.show = false
|
||||
|
|
@ -888,8 +841,6 @@ window.PageEvents = {
|
|||
min_tickets: 1,
|
||||
email_notifications: false,
|
||||
nostr_notifications: false,
|
||||
onchain_enabled: false,
|
||||
onchain_wallet_id: null,
|
||||
ticket_waves: [
|
||||
{
|
||||
id: 'primary',
|
||||
|
|
|
|||
|
|
@ -408,18 +408,6 @@
|
|||
>
|
||||
<q-tooltip>Resend ticket email</q-tooltip>
|
||||
</q-btn>
|
||||
<q-btn
|
||||
v-if="props.row.extra?.onchain && !props.row.paid"
|
||||
flat
|
||||
dense
|
||||
size="xs"
|
||||
@click="confirmOnchainTicket(props.row)"
|
||||
icon="currency_bitcoin"
|
||||
color="orange"
|
||||
class="q-ml-xs"
|
||||
>
|
||||
<q-tooltip>Confirm onchain payment</q-tooltip>
|
||||
</q-btn>
|
||||
</q-td>
|
||||
|
||||
<q-td v-for="col in props.cols" :key="col.name" :props="props">
|
||||
|
|
@ -909,55 +897,6 @@
|
|||
</div>
|
||||
</q-expansion-item>
|
||||
|
||||
<q-expansion-item
|
||||
group="advanced"
|
||||
icon="view_in_ar"
|
||||
label="Onchain payments"
|
||||
>
|
||||
<div class="q-mt-lg">
|
||||
<div class="text-caption q-mb-md">
|
||||
Accept Bitcoin onchain payments. Requires the
|
||||
<strong>SatsPay</strong> and <strong>Watchonly</strong>
|
||||
extensions to be installed and enabled.
|
||||
</div>
|
||||
<q-toggle
|
||||
v-model="formDialog.data.extra.onchain_enabled"
|
||||
label="Accept onchain payments"
|
||||
left-label
|
||||
@update:model-value="val => val && loadOnchainWallets()"
|
||||
></q-toggle>
|
||||
<q-select
|
||||
v-if="formDialog.data.extra.onchain_enabled"
|
||||
filled
|
||||
dense
|
||||
class="q-mt-md"
|
||||
v-model="formDialog.data.extra.onchain_wallet_id"
|
||||
label="Watchonly wallet"
|
||||
:options="
|
||||
onchainWallets.map(w => ({
|
||||
label: w.title || w.id,
|
||||
value: w.id
|
||||
}))
|
||||
"
|
||||
emit-value
|
||||
map-options
|
||||
hint="Bitcoin watchonly wallet for receiving onchain payments"
|
||||
></q-select>
|
||||
<div v-if="formDialog.data.extra.onchain_enabled" class="q-mt-md">
|
||||
<q-toggle
|
||||
v-model="formDialog.data.extra.onchain_zeroconf"
|
||||
label="Zero-conf (accept unconfirmed transactions)"
|
||||
left-label
|
||||
></q-toggle>
|
||||
<q-toggle
|
||||
v-model="formDialog.data.extra.onchain_fasttrack"
|
||||
label="Fasttrack (treat pending as paid)"
|
||||
left-label
|
||||
></q-toggle>
|
||||
</div>
|
||||
</div>
|
||||
</q-expansion-item>
|
||||
|
||||
<div class="row q-mt-lg">
|
||||
<q-btn
|
||||
v-if="formDialog.data.id"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue