diff options
| author | Adam Soltys <[email protected]> | 2023-01-13 23:49:59 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2023-01-13 23:49:59 -0800 |
| commit | b1ad12734eeafc36a07bd76f649a98ae9ade5723 (patch) | |
| tree | c8721da657a75160c55aaf6bc7cc573669cb52dd /src/routes/(app)/invoice | |
| parent | 277b921ab2a97ac170f980c3c916ab1488318f2f (diff) | |
| download | coinos-ui-b1ad12734eeafc36a07bd76f649a98ae9ade5723.tar.gz coinos-ui-b1ad12734eeafc36a07bd76f649a98ae9ade5723.zip | |
payments migration
Diffstat (limited to 'src/routes/(app)/invoice')
| -rw-r--r-- | src/routes/(app)/invoice/[id]/+layout.server.js | 5 | ||||
| -rw-r--r-- | src/routes/(app)/invoice/[id]/+page.svelte | 3 | ||||
| -rw-r--r-- | src/routes/(app)/invoice/[id]/paid/+page.svelte | 3 | ||||
| -rw-r--r-- | src/routes/(app)/invoice/[id]/tip/+page.svelte | 10 |
4 files changed, 5 insertions, 16 deletions
diff --git a/src/routes/(app)/invoice/[id]/+layout.server.js b/src/routes/(app)/invoice/[id]/+layout.server.js index adcea6df..78d8481e 100644 --- a/src/routes/(app)/invoice/[id]/+layout.server.js +++ b/src/routes/(app)/invoice/[id]/+layout.server.js @@ -7,14 +7,13 @@ export async function load({ depends, params, url }) { let { id } = params; let invoice = await get(`/invoice?id=${id}`); - let { amount, received, pending } = invoice; + let { amount, received } = invoice; amount = parseInt(amount); - let paid = (!amount && (received || pending)) || (amount > 0 && received + pending >= amount); + let paid = (!amount && received) || (amount > 0 && received >= amount); if (paid && !url.pathname.endsWith('paid')) throw redirect(307, `/invoice/${id}/paid`); let sm = Qr.drawImg(invoice.text, { size: 300 }); - // let lg = Qr.drawImg(invoice.text, { size: 1200 }); return { id, invoice, sm, lg: sm }; } diff --git a/src/routes/(app)/invoice/[id]/+page.svelte b/src/routes/(app)/invoice/[id]/+page.svelte index db491c66..28ff27c0 100644 --- a/src/routes/(app)/invoice/[id]/+page.svelte +++ b/src/routes/(app)/invoice/[id]/+page.svelte @@ -3,9 +3,8 @@ import { back, copy, f, get, sat, reverseFormat, s, sats } from '$lib/utils'; import { tick, onMount, onDestroy } from 'svelte'; import { browser } from '$app/environment'; - import { invoices, last } from '$lib/store'; + import { last } from '$lib/store'; import { Avatar, Icon, Heart, Image, Qr } from '$comp'; - import { goto } from '$app/navigation'; import { t } from '$lib/translations'; import screenfull from 'screenfull'; diff --git a/src/routes/(app)/invoice/[id]/paid/+page.svelte b/src/routes/(app)/invoice/[id]/paid/+page.svelte index 2ce414e2..2ccbc971 100644 --- a/src/routes/(app)/invoice/[id]/paid/+page.svelte +++ b/src/routes/(app)/invoice/[id]/paid/+page.svelte @@ -6,7 +6,6 @@ import { t } from '$lib/translations'; import { f, s, sat, sats } from '$lib/utils'; import { goto } from '$app/navigation'; - import { invoices } from '$lib/store'; export let data; let amount, currency, rate, received, pending, tip, user, id; @@ -60,4 +59,4 @@ <div class="opacity-0 w-screen h-screen fixed top-0 left-0 z-50" /> </a> -<div class="fixed bottom-10 w-full text-center">{$t('transactions.tapAnywhere')}</div> +<div class="fixed bottom-10 w-full text-center">{$t('payments.tapAnywhere')}</div> diff --git a/src/routes/(app)/invoice/[id]/tip/+page.svelte b/src/routes/(app)/invoice/[id]/tip/+page.svelte index 625248a0..308720ab 100644 --- a/src/routes/(app)/invoice/[id]/tip/+page.svelte +++ b/src/routes/(app)/invoice/[id]/tip/+page.svelte @@ -1,7 +1,7 @@ <script> import { onMount } from 'svelte'; import { browser } from '$app/environment'; - import { invoice as inv, invoices, request } from '$lib/store'; + import { invoice as inv, request } from '$lib/store'; import { back, copy, f, sat, get, reverseFormat, s, sats } from '$lib/utils'; import { Icon } from '$comp'; import { goto } from '$app/navigation'; @@ -100,14 +100,6 @@ $: tip = Math.round((amount / 100) * tipPercent); - $invoices[id] = { amount, id, network, rate, received, text, tip, username }; - - $: browser && - ($invoices[id]?.amount > 0 - ? $invoices[id]?.received >= $invoices[id]?.amount - : $invoices[id]?.received) && - goto(($invoices[id].memo === 'launch' && '/launch/purchase') || `/invoice/${id}/paid`); - $: amountFiat = parseFloat(((amount * rate) / sats).toFixed(2)); $: tipAmount = ((tip * rate) / sats).toFixed(2); |
