diff --git a/lnbits/core/crud.py b/lnbits/core/crud.py index 2c0c5c3d5..2c91bc22a 100644 --- a/lnbits/core/crud.py +++ b/lnbits/core/crud.py @@ -286,7 +286,11 @@ async def create_payment( async def update_payment_status(checking_id: str, pending: bool) -> None: await db.execute( - "UPDATE apipayments SET pending = ? WHERE checking_id = ?", (int(pending), checking_id,), + "UPDATE apipayments SET pending = ? WHERE checking_id = ?", + ( + int(pending), + checking_id, + ), ) diff --git a/lnbits/extensions/offlineshop/crud.py b/lnbits/extensions/offlineshop/crud.py index 2d9376dd0..5da350a5e 100644 --- a/lnbits/extensions/offlineshop/crud.py +++ b/lnbits/extensions/offlineshop/crud.py @@ -34,12 +34,20 @@ async def get_or_create_shop_by_wallet(wallet: str) -> Optional[Shop]: async def set_wordlist(shop: int, wordlist: str) -> Optional[Shop]: await db.execute( - "UPDATE shops SET wordlist = ? WHERE id = ?", (wordlist, shop), + "UPDATE shops SET wordlist = ? WHERE id = ?", + (wordlist, shop), ) return await get_shop(shop) -async def add_item(shop: int, name: str, description: str, image: Optional[str], price: int, unit: str,) -> int: +async def add_item( + shop: int, + name: str, + description: str, + image: Optional[str], + price: int, + unit: str, +) -> int: result = await db.execute( """ INSERT INTO items (shop, name, description, image, price, unit) @@ -51,7 +59,13 @@ async def add_item(shop: int, name: str, description: str, image: Optional[str], async def update_item( - shop: int, item_id: int, name: str, description: str, image: Optional[str], price: int, unit: str, + shop: int, + item_id: int, + name: str, + description: str, + image: Optional[str], + price: int, + unit: str, ) -> int: await db.execute( """ diff --git a/lnbits/extensions/offlineshop/templates/offlineshop/_api_docs.html b/lnbits/extensions/offlineshop/templates/offlineshop/_api_docs.html index f0d4a151a..1e3bf0519 100644 --- a/lnbits/extensions/offlineshop/templates/offlineshop/_api_docs.html +++ b/lnbits/extensions/offlineshop/templates/offlineshop/_api_docs.html @@ -8,20 +8,35 @@
  1. Register items.
  2. -
  3. Print QR codes and paste them on your store, your menu, somewhere, somehow.
  4. -
  5. Clients scan the QR codes and get information about the items plus the price on their phones directly (they must have internet)
  6. -
  7. Once they decide to pay, they'll get an invoice on their phones automatically
  8. -
  9. When the payment is confirmed, a confirmation code will be issued for them.
  10. +
  11. + Print QR codes and paste them on your store, your menu, somewhere, + somehow. +
  12. +
  13. + Clients scan the QR codes and get information about the items plus the + price on their phones directly (they must have internet) +
  14. +
  15. + Once they decide to pay, they'll get an invoice on their phones + automatically +
  16. +
  17. + When the payment is confirmed, a confirmation code will be issued for + them. +

- The confirmation codes are words from a predefined sequential word list. Each new payment bumps the words sequence by 1. So you can check the confirmation codes manually by just looking at them. + The confirmation codes are words from a predefined sequential word list. + Each new payment bumps the words sequence by 1. So you can check the + confirmation codes manually by just looking at them.

- For example, if your wordlist is [apple, banana, coconut] the first purchase will be apple, the second banana and so on. When it gets to the end it starts from the beginning again. -

-

- Powered by LNURL-pay. + For example, if your wordlist is + [apple, banana, coconut] the first purchase will be + apple, the second banana and so on. When it + gets to the end it starts from the beginning again.

+

Powered by LNURL-pay.

@@ -51,8 +66,8 @@ }}/offlineshop/api/v1/offlineshop/items -H "Content-Type: application/json" -H "X-Api-Key: {{ g.user.wallets[0].inkey }}" -d '{"name": <string>, "description": <string>, "image": - <data-uri string>, "price": <integer>, "unit": <"sat" or - "USD">}' + <data-uri string>, "price": <integer>, "unit": <"sat" + or "USD">}' @@ -74,7 +89,10 @@ {"id": <integer>, "wallet": <string>, "wordlist": - <string>, "items": [{"id": <integer>, "name": <string>, "description": <string>, "image": <string>, "enabled": <boolean>, "price": <integer>, "unit": <string>, "lnurl": <string>}, ...]}</code + <string>, "items": [{"id": <integer>, "name": + <string>, "description": <string>, "image": + <string>, "enabled": <boolean>, "price": <integer>, + "unit": <string>, "lnurl": <string>}, ...]}<
Curl example