diff options
Diffstat (limited to 'packages/merchant-backoffice-ui/src/paths/instance/orders')
4 files changed, 8 insertions, 11 deletions
diff --git a/packages/merchant-backoffice-ui/src/paths/instance/orders/create/index.tsx b/packages/merchant-backoffice-ui/src/paths/instance/orders/create/index.tsx index f612389fe..849711df6 100644 --- a/packages/merchant-backoffice-ui/src/paths/instance/orders/create/index.tsx +++ b/packages/merchant-backoffice-ui/src/paths/instance/orders/create/index.tsx @@ -94,7 +94,7 @@ export default function OrderCreate({ <CreatePage onBack={onBack} onCreate={(request: TalerMerchantApi.PostOrderRequest) => { - lib.management.createOrder(state.token, request) + lib.instance.createOrder(state.token, request) .then((r) => { if (r.type === "ok") { return onConfirm(r.body.order_id) diff --git a/packages/merchant-backoffice-ui/src/paths/instance/orders/details/DetailPage.tsx b/packages/merchant-backoffice-ui/src/paths/instance/orders/details/DetailPage.tsx index 4ed78b002..4afc40285 100644 --- a/packages/merchant-backoffice-ui/src/paths/instance/orders/details/DetailPage.tsx +++ b/packages/merchant-backoffice-ui/src/paths/instance/orders/details/DetailPage.tsx @@ -25,7 +25,7 @@ import { TalerMerchantApi, stringifyRefundUri, } from "@gnu-taler/taler-util"; -import { useTranslationContext } from "@gnu-taler/web-util/browser"; +import { useMerchantApiContext, useTranslationContext } from "@gnu-taler/web-util/browser"; import { format, formatDistance } from "date-fns"; import { Fragment, VNode, h } from "preact"; import { useState } from "preact/hooks"; @@ -38,7 +38,6 @@ import { InputGroup } from "../../../../components/form/InputGroup.js"; import { InputLocation } from "../../../../components/form/InputLocation.js"; import { TextField } from "../../../../components/form/TextField.js"; import { ProductList } from "../../../../components/product/ProductList.js"; -import { useSessionContext } from "../../../../context/session.js"; import { datetimeFormatForSettings, usePreference, @@ -427,12 +426,10 @@ function PaidPage({ }); const [value, valueHandler] = useState<Partial<Paid>>(order); - const { - state: { backendUrl }, - } = useSessionContext(); + const { url: backendUrl } = useMerchantApiContext(); const refundurl = stringifyRefundUri({ - merchantBaseUrl: backendUrl, + merchantBaseUrl: backendUrl.href, orderId: order.contract_terms.order_id, }); const refundable = diff --git a/packages/merchant-backoffice-ui/src/paths/instance/orders/details/index.tsx b/packages/merchant-backoffice-ui/src/paths/instance/orders/details/index.tsx index b232a146b..4785c795d 100644 --- a/packages/merchant-backoffice-ui/src/paths/instance/orders/details/index.tsx +++ b/packages/merchant-backoffice-ui/src/paths/instance/orders/details/index.tsx @@ -84,7 +84,7 @@ export default function Update({ oid, onBack }: Props): VNode { if (state.status !== "loggedIn") { return; } - api.management + api.instance .addRefund(state.token, id, value) .then(() => setNotif({ diff --git a/packages/merchant-backoffice-ui/src/paths/instance/orders/list/index.tsx b/packages/merchant-backoffice-ui/src/paths/instance/orders/list/index.tsx index 165ced3dc..217eb998a 100644 --- a/packages/merchant-backoffice-ui/src/paths/instance/orders/list/index.tsx +++ b/packages/merchant-backoffice-ui/src/paths/instance/orders/list/index.tsx @@ -110,7 +110,7 @@ export default function OrderList({ onCreate, onSelect }: Props): VNode { <JumpToElementById testIfExist={async (order) => { - const resp = await lib.management.getOrderDetails(state.token, order); + const resp = await lib.instance.getOrderDetails(state.token, order); return resp.type === "ok"; }} onSelect={onSelect} @@ -135,7 +135,7 @@ export default function OrderList({ onCreate, onSelect }: Props): VNode { jumpToDate={filter.date} onSelectDate={setNewDate} onCopyURL={async (id) => { - const resp = await lib.management.getOrderDetails(state.token, id); + const resp = await lib.instance.getOrderDetails(state.token, id); if (resp.type === "ok") { if (resp.body.order_status === "unpaid") { copyToClipboard(resp.body.taler_pay_uri); @@ -161,7 +161,7 @@ export default function OrderList({ onCreate, onSelect }: Props): VNode { id={orderToBeRefunded.order_id} onCancel={() => setOrderToBeRefunded(undefined)} onConfirm={(value) => { - lib.management + lib.instance .addRefund(state.token, orderToBeRefunded.order_id, value) .then(() => setNotif({ |