mirror of
https://github.com/lnbits/lnbits-legend.git
synced 2025-02-22 14:22:55 +01:00
satspay done
This commit is contained in:
parent
e939666107
commit
ec4117a5f4
7 changed files with 18 additions and 22 deletions
|
@ -17,15 +17,6 @@ from ..watchonly.crud import get_watch_wallet, get_fresh_address, get_mempool
|
|||
async def create_charge(
|
||||
user: str,
|
||||
data: CreateCharge
|
||||
# user: str,
|
||||
# description: str = None,
|
||||
# onchainwallet: Optional[str] = None,
|
||||
# lnbitswallet: Optional[str] = None,
|
||||
# webhook: Optional[str] = None,
|
||||
# completelink: Optional[str] = None,
|
||||
# completelinktext: Optional[str] = "Back to Merchant",
|
||||
# time: Optional[int] = None,
|
||||
# amount: Optional[int] = None,
|
||||
) -> Charges:
|
||||
charge_id = urlsafe_short_hash()
|
||||
if data.onchainwallet:
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
from sqlite3 import Row
|
||||
from typing import Optional
|
||||
from fastapi.param_functions import Query
|
||||
from pydantic import BaseModel
|
||||
import time
|
||||
|
@ -16,15 +17,15 @@ class CreateCharge(BaseModel):
|
|||
class Charges(BaseModel):
|
||||
id: str
|
||||
user: str
|
||||
description: str
|
||||
onchainwallet: str
|
||||
onchainaddress: str
|
||||
lnbitswallet: str
|
||||
description: Optional[str]
|
||||
onchainwallet: Optional[str]
|
||||
onchainaddress: Optional[str]
|
||||
lnbitswallet: Optional[str]
|
||||
payment_request: str
|
||||
payment_hash: str
|
||||
webhook: str
|
||||
completelink: str
|
||||
completelinktext: str
|
||||
webhook: Optional[str]
|
||||
completelink: Optional[str]
|
||||
completelinktext: Optional[str] = "Back to Merchant"
|
||||
time: int
|
||||
amount: int
|
||||
balance: int
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
"description": <string>, "webhook":<string>, "time":
|
||||
<integer>, "amount": <integer>, "lnbitswallet":
|
||||
<string, lnbits_wallet_id>}' -H "Content-type:
|
||||
application/json" -H "X-Api-Key: {{g.user.wallets[0].adminkey }}"
|
||||
application/json" -H "X-Api-Key: {{user.wallets[0].adminkey }}"
|
||||
</code>
|
||||
</q-card-section>
|
||||
</q-card>
|
||||
|
@ -65,7 +65,7 @@
|
|||
"description": <string>, "webhook":<string>, "time":
|
||||
<integer>, "amount": <integer>, "lnbitswallet":
|
||||
<string, lnbits_wallet_id>}' -H "Content-type:
|
||||
application/json" -H "X-Api-Key: {{g.user.wallets[0].adminkey }}"
|
||||
application/json" -H "X-Api-Key: {{user.wallets[0].adminkey }}"
|
||||
</code>
|
||||
</q-card-section>
|
||||
</q-card>
|
||||
|
|
|
@ -207,7 +207,7 @@
|
|||
</div>
|
||||
|
||||
{% endblock %} {% block scripts %}
|
||||
<script src="{{ url_for('static', filename='vendor/vue-qrcode@1.0.2/vue-qrcode.min.js') }}"></script>
|
||||
|
||||
<style>
|
||||
.theCard {
|
||||
width: 360px;
|
||||
|
@ -302,6 +302,7 @@
|
|||
}
|
||||
},
|
||||
created: function () {
|
||||
console.log('{{ charge.onchainaddress }}' == 'None')
|
||||
if ('{{ charge.lnbitswallet }}' == 'None') {
|
||||
this.lnbtc = false
|
||||
this.onbtc = true
|
||||
|
|
|
@ -280,7 +280,8 @@
|
|||
</q-dialog>
|
||||
</div>
|
||||
{% endblock %} {% block scripts %} {{ window_vars(user) }}
|
||||
<script src="{{ url_for('static', filename='vendor/vue-qrcode@1.0.2/vue-qrcode.min.js') }}"></script>
|
||||
<!-- lnbits/static/vendor
|
||||
<script src="/vendor/vue-qrcode@1.0.2/vue-qrcode.min.js"></script> -->
|
||||
<style></style>
|
||||
<script>
|
||||
Vue.component(VueQrcode.name, VueQrcode)
|
||||
|
@ -542,6 +543,7 @@
|
|||
}
|
||||
},
|
||||
created: function () {
|
||||
console.log(this.g.user)
|
||||
var self = this
|
||||
var getCharges = this.getCharges
|
||||
getCharges()
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
from fastapi.param_functions import Depends
|
||||
from starlette.exceptions import HTTPException
|
||||
from starlette.responses import HTMLResponse
|
||||
from starlette.requests import Request
|
||||
from lnbits.core.models import User
|
||||
from lnbits.core.crud import get_wallet
|
||||
from lnbits.decorators import check_user_exists
|
||||
|
|
|
@ -33,10 +33,10 @@ from .crud import (
|
|||
|
||||
async def api_charge_create_or_update(data: CreateCharge, wallet: WalletTypeInfo = Depends(get_key_type), charge_id=None):
|
||||
if not charge_id:
|
||||
charge = await create_charge(user=wallet.wallet.user, **data)
|
||||
charge = await create_charge(user=wallet.wallet.user, data=data)
|
||||
return charge.dict()
|
||||
else:
|
||||
charge = await update_charge(charge_id=charge_id, **data)
|
||||
charge = await update_charge(charge_id=charge_id, data=data)
|
||||
return charge.dict()
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue