Cleaned up api

This commit is contained in:
Ben Arc 2021-04-09 00:22:52 +01:00
parent 64bb1b5444
commit 4219513a8a
3 changed files with 6 additions and 15 deletions

View File

@ -19,9 +19,10 @@ async def create_charge(user: str, description: str = None, onchainwallet: Optio
charge_id = urlsafe_short_hash()
if onchainwallet:
wallet = await get_watch_wallet(onchainwallet)
onchainaddress = await get_fresh_address(onchainwallet)
onchain = await get_fresh_address(onchainwallet)
onchainaddress = onchain.address
else:
onchainaddress.address = None
onchainaddress = None
if lnbitswallet:
payment_hash, payment_request = await create_invoice(
wallet_id=lnbitswallet,
@ -50,7 +51,7 @@ async def create_charge(user: str, description: str = None, onchainwallet: Optio
)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
""",
(charge_id, user, description, onchainwallet, onchainaddress.address, lnbitswallet,
(charge_id, user, description, onchainwallet, onchainaddress, lnbitswallet,
payment_request, payment_hash, webhook, completelink, completelinktext, time, amount, 0),
)
return await get_charge(charge_id)

View File

@ -9,7 +9,6 @@
>
</p>
</q-card-section>
<q-expansion-item
group="extras"
icon="swap_vertical_circle"
@ -80,7 +79,7 @@
/satspay/api/v1/charge/&lt;charge_id&gt;</code
>
<h5 class="text-caption q-mt-sm q-mb-none">Headers</h5>
<code>{"X-Api-Key": &lt;admin_key&gt;}</code><br />
<code>{"X-Api-Key": &lt;invoice_key&gt;}</code><br />
<h5 class="text-caption q-mt-sm q-mb-none">
Body (application/json)
</h5>
@ -103,7 +102,7 @@
><span class="text-blue">GET</span> /satspay/api/v1/charges</code
>
<h5 class="text-caption q-mt-sm q-mb-none">Headers</h5>
<code>{"X-Api-Key": &lt;admin_key&gt;}</code><br />
<code>{"X-Api-Key": &lt;invoice_key&gt;}</code><br />
<h5 class="text-caption q-mt-sm q-mb-none">
Body (application/json)
</h5>
@ -152,8 +151,6 @@
><span class="text-blue">GET</span>
/satspay/api/v1/charges/balance/&lt;charge_id&gt;</code
>
<h5 class="text-caption q-mt-sm q-mb-none">Headers</h5>
<code>{"X-Api-Key": &lt;admin_key&gt;}</code><br />
<h5 class="text-caption q-mt-sm q-mb-none">
Body (application/json)
</h5>

View File

@ -3,7 +3,6 @@
<q-card class="my-card">
<div class="column">
<center> <div class="col theHeading">{{ charge.description }}</div></center>
<div class="col">
<div class="col" color="white" style="background-color:grey; height: 30px; padding: 5px" v-if="charge_time_elapsed == 'True'">
<center>Time elapsed</center>
@ -24,8 +23,6 @@
</q-linear-progress>
</div>
</div>
<div class="col" style="margin: 2px 15px; max-height:100px" >
<center>
<q-btn flat dense outline @click="copyText('{{ charge.id }}')"
@ -69,9 +66,7 @@
</div>
<q-separator></q-separator>
</div>
</div>
<q-card class="q-pa-lg" v-if="lnbtc">
<q-card-section class="q-pa-none">
<div class="text-center q-pt-md">
@ -104,8 +99,6 @@
</div></div>
</q-card-section>
</q-card>
<q-card class="q-pa-lg" v-if="onbtc">
<q-card-section class="q-pa-none">