lnurlpay comment.
This commit is contained in:
parent
bcdc065cc0
commit
1529ebb689
|
@ -129,7 +129,8 @@ new Vue({
|
|||
lnurlpay: null,
|
||||
data: {
|
||||
request: '',
|
||||
amount: 0
|
||||
amount: 0,
|
||||
comment: ''
|
||||
},
|
||||
paymentChecker: null,
|
||||
camera: {
|
||||
|
@ -235,6 +236,7 @@ new Vue({
|
|||
this.parse.invoice = null
|
||||
this.parse.lnurlpay = null
|
||||
this.parse.data.request = ''
|
||||
this.parse.data.comment = ''
|
||||
this.parse.data.paymentChecker = null
|
||||
this.parse.camera.show = false
|
||||
},
|
||||
|
@ -449,7 +451,8 @@ new Vue({
|
|||
this.parse.lnurlpay.callback,
|
||||
this.parse.lnurlpay.description_hash,
|
||||
this.parse.data.amount * 1000,
|
||||
this.parse.lnurlpay.description.slice(0, 120)
|
||||
this.parse.lnurlpay.description.slice(0, 120),
|
||||
this.parse.data.comment
|
||||
)
|
||||
.then(response => {
|
||||
this.parse.show = false
|
||||
|
|
|
@ -349,27 +349,53 @@
|
|||
<p v-if="parse.lnurlpay.fixed" class="q-my-none text-h6">
|
||||
<b>{{ parse.lnurlpay.domain }}</b> is requesting {{
|
||||
parse.lnurlpay.maxSendable | msatoshiFormat }} sat
|
||||
<span v-if="parse.lnurlpay.commentAllowed > 0">
|
||||
<br />
|
||||
and a {{parse.lnurlpay.commentAllowed}}-char comment
|
||||
</span>
|
||||
</p>
|
||||
<p v-else class="q-my-none text-h6 text-center">
|
||||
<b>{{ parse.lnurlpay.domain }}</b> is requesting <br />
|
||||
between <b>{{ parse.lnurlpay.minSendable | msatoshiFormat }}</b> and
|
||||
<b>{{ parse.lnurlpay.maxSendable | msatoshiFormat }}</b> sat
|
||||
<span v-if="parse.lnurlpay.commentAllowed > 0">
|
||||
<br />
|
||||
and a {{parse.lnurlpay.commentAllowed}}-char comment
|
||||
</span>
|
||||
</p>
|
||||
<q-separator class="q-my-sm"></q-separator>
|
||||
<p class="text-justify text-italic">{{ parse.lnurlpay.description }}</p>
|
||||
<p v-if="parse.lnurlpay.image">
|
||||
<q-img :src="parse.lnurlpay.image" width="50%" />
|
||||
<div class="row">
|
||||
<p class="col text-justify text-italic">
|
||||
{{ parse.lnurlpay.description }}
|
||||
</p>
|
||||
<p class="col-4 q-pl-md" v-if="parse.lnurlpay.image">
|
||||
<q-img :src="parse.lnurlpay.image" />
|
||||
</p>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<q-input
|
||||
filled
|
||||
dense
|
||||
v-model.number="parse.data.amount"
|
||||
type="number"
|
||||
label="Amount (sat) *"
|
||||
min="parse.lnurlpay.minSendable / 1000"
|
||||
max="parse.lnurlpay.maxSendable / 1000"
|
||||
:min="parse.lnurlpay.minSendable / 1000"
|
||||
:max="parse.lnurlpay.maxSendable / 1000"
|
||||
:readonly="parse.lnurlpay.fixed"
|
||||
></q-input>
|
||||
</div>
|
||||
<div class="col-8 q-pl-md" v-if="parse.lnurlpay.commentAllowed > 0">
|
||||
<q-input
|
||||
filled
|
||||
dense
|
||||
v-model.number="parse.data.comment"
|
||||
:type="parse.lnurlpay.commentAllowed > 64 ? 'textarea' : 'text'"
|
||||
label="Comment (optional)"
|
||||
:maxlength="parse.lnurlpay.commentAllowed"
|
||||
></q-input>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row q-mt-lg">
|
||||
<q-btn unelevated color="deep-purple" type="submit"
|
||||
>Send satoshis</q-btn
|
||||
|
|
|
@ -142,12 +142,17 @@ async def api_payments_create():
|
|||
"description_hash": {"type": "string", "empty": False, "required": True},
|
||||
"callback": {"type": "string", "empty": False, "required": True},
|
||||
"amount": {"type": "number", "empty": False, "required": True},
|
||||
"description": {"type": "string", "empty": True, "required": False},
|
||||
"comment": {"type": "string", "nullable": True, "empty": True, "required": False},
|
||||
"description": {"type": "string", "nullable": True, "empty": True, "required": False},
|
||||
}
|
||||
)
|
||||
async def api_payments_pay_lnurl():
|
||||
try:
|
||||
r = httpx.get(g.data["callback"], params={"amount": g.data["amount"]}, timeout=20)
|
||||
r = httpx.get(
|
||||
g.data["callback"],
|
||||
params={"amount": g.data["amount"], "comment": g.data["comment"]},
|
||||
timeout=40,
|
||||
)
|
||||
if r.is_error:
|
||||
return jsonify({"message": "failed to connect"}), HTTPStatus.BAD_REQUEST
|
||||
except (httpx.ConnectError, httpx.RequestError):
|
||||
|
@ -321,6 +326,7 @@ async def api_lnurlscan(code: str):
|
|||
image = min(data.metadata.images, key=lambda image: len(image[1]))
|
||||
data_uri = "data:" + image[0] + "," + image[1]
|
||||
params.update(image=data_uri)
|
||||
params.update(commentAllowed=jdata.get("commentAllowed", 0))
|
||||
|
||||
params.update(domain=domain)
|
||||
return jsonify(params)
|
||||
|
|
|
@ -33,12 +33,14 @@ window.LNbits = {
|
|||
callback,
|
||||
description_hash,
|
||||
amount,
|
||||
description = ''
|
||||
description = '',
|
||||
comment = ''
|
||||
) {
|
||||
return this.request('post', '/api/v1/payments/lnurl', wallet.adminkey, {
|
||||
callback,
|
||||
description_hash,
|
||||
amount,
|
||||
comment,
|
||||
description
|
||||
})
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue
Block a user