summaryrefslogtreecommitdiff
path: root/packages/merchant-backoffice-ui/src/paths/instance/orders
diff options
context:
space:
mode:
Diffstat (limited to 'packages/merchant-backoffice-ui/src/paths/instance/orders')
-rw-r--r--packages/merchant-backoffice-ui/src/paths/instance/orders/create/CreatePage.tsx75
-rw-r--r--packages/merchant-backoffice-ui/src/paths/instance/orders/create/index.tsx13
-rw-r--r--packages/merchant-backoffice-ui/src/paths/instance/orders/details/Detail.stories.tsx33
-rw-r--r--packages/merchant-backoffice-ui/src/paths/instance/orders/details/DetailPage.tsx75
-rw-r--r--packages/merchant-backoffice-ui/src/paths/instance/orders/details/index.tsx11
-rw-r--r--packages/merchant-backoffice-ui/src/paths/instance/orders/list/List.stories.tsx11
-rw-r--r--packages/merchant-backoffice-ui/src/paths/instance/orders/list/ListPage.tsx12
-rw-r--r--packages/merchant-backoffice-ui/src/paths/instance/orders/list/Table.tsx13
-rw-r--r--packages/merchant-backoffice-ui/src/paths/instance/orders/list/index.tsx15
9 files changed, 131 insertions, 127 deletions
diff --git a/packages/merchant-backoffice-ui/src/paths/instance/orders/create/CreatePage.tsx b/packages/merchant-backoffice-ui/src/paths/instance/orders/create/CreatePage.tsx
index fca123773..041ec73e7 100644
--- a/packages/merchant-backoffice-ui/src/paths/instance/orders/create/CreatePage.tsx
+++ b/packages/merchant-backoffice-ui/src/paths/instance/orders/create/CreatePage.tsx
@@ -21,8 +21,10 @@
import {
AbsoluteTime,
+ AmountString,
Amounts,
Duration,
+ TalerMerchantApi,
TalerProtocolDuration,
} from "@gnu-taler/taler-util";
import {
@@ -47,16 +49,15 @@ import { InputToggle } from "../../../../components/form/InputToggle.js";
import { InventoryProductForm } from "../../../../components/product/InventoryProductForm.js";
import { NonInventoryProductFrom } from "../../../../components/product/NonInventoryProductForm.js";
import { ProductList } from "../../../../components/product/ProductList.js";
-import { MerchantBackend, WithId } from "../../../../declaration.js";
import { usePreference } from "../../../../hooks/preference.js";
import { rate } from "../../../../utils/amount.js";
import { undefinedIfEmpty } from "../../../../utils/table.js";
interface Props {
- onCreate: (d: MerchantBackend.Orders.PostOrderRequest) => void;
+ onCreate: (d: TalerMerchantApi.PostOrderRequest) => void;
onBack?: () => void;
instanceConfig: InstanceConfig;
- instanceInventory: (MerchantBackend.Products.ProductDetail & WithId)[];
+ instanceInventory: (TalerMerchantApi.ProductDetail & WithId)[];
}
interface InstanceConfig {
use_stefan: boolean;
@@ -92,7 +93,7 @@ function with_defaults(
}
interface ProductAndQuantity {
- product: MerchantBackend.Products.ProductDetail & WithId;
+ product: TalerMerchantApi.ProductDetail & WithId;
quantity: number;
}
export interface ProductMap {
@@ -106,7 +107,7 @@ interface Pricing {
}
interface Shipping {
delivery_date?: Date;
- delivery_location?: MerchantBackend.Location;
+ delivery_location?: TalerMerchantApi.Location;
fullfilment_url?: string;
}
interface Payments {
@@ -120,7 +121,7 @@ interface Payments {
}
interface Entity {
inventoryProducts: ProductMap;
- products: MerchantBackend.Product[];
+ products: TalerMerchantApi.Product[];
pricing: Partial<Pricing>;
payments: Partial<Payments>;
shipping: Partial<Shipping>;
@@ -214,43 +215,36 @@ export function CreatePage({
if (!value.payments) return;
if (!value.shipping) return;
- const request: MerchantBackend.Orders.PostOrderRequest = {
+ const request: TalerMerchantApi.PostOrderRequest = {
order: {
amount: order.pricing.order_price,
summary: order.pricing.summary,
products: productList,
extra: undefinedIfEmpty(value.extra),
- pay_deadline: !value.payments.pay_deadline
- ? i18n.str`required`
- : AbsoluteTime.toProtocolTimestamp(
- AbsoluteTime.addDuration(
- AbsoluteTime.now(),
- value.payments.pay_deadline,
- ),
- ), // : undefined,
- wire_transfer_deadline: value.payments.wire_transfer_deadline
- ? AbsoluteTime.toProtocolTimestamp(
- AbsoluteTime.addDuration(
- AbsoluteTime.now(),
- value.payments.wire_transfer_deadline,
- ),
- )
- : undefined,
- refund_deadline: value.payments.refund_deadline
- ? AbsoluteTime.toProtocolTimestamp(
- AbsoluteTime.addDuration(
- AbsoluteTime.now(),
- value.payments.refund_deadline,
- ),
- )
- : undefined,
+ pay_deadline: AbsoluteTime.toProtocolTimestamp(
+ AbsoluteTime.addDuration(
+ AbsoluteTime.now(),
+ value.payments.pay_deadline!,
+ ),
+ ),
+ wire_transfer_deadline: AbsoluteTime.toProtocolTimestamp(
+ AbsoluteTime.addDuration(
+ AbsoluteTime.now(),
+ value.payments.wire_transfer_deadline!,
+ ),
+ ),
+ refund_deadline: AbsoluteTime.toProtocolTimestamp(
+ AbsoluteTime.addDuration(
+ AbsoluteTime.now(),
+ value.payments.refund_deadline!,
+ ),
+ ),
auto_refund: value.payments.auto_refund_deadline
? Duration.toTalerProtocolDuration(
value.payments.auto_refund_deadline,
)
: undefined,
- max_fee: value.payments.max_fee as string,
-
+ max_fee: value.payments.max_fee as AmountString,
delivery_date: value.shipping.delivery_date
? { t_s: value.shipping.delivery_date.getTime() / 1000 }
: undefined,
@@ -269,7 +263,7 @@ export function CreatePage({
};
const addProductToTheInventoryList = (
- product: MerchantBackend.Products.ProductDetail & WithId,
+ product: TalerMerchantApi.ProductDetail & WithId,
quantity: number,
) => {
valueHandler((v) => {
@@ -287,7 +281,7 @@ export function CreatePage({
});
};
- const addNewProduct = async (product: MerchantBackend.Product) => {
+ const addNewProduct = async (product: TalerMerchantApi.Product) => {
return valueHandler((v) => {
const products = v.products ? [...v.products, product] : [];
return { ...v, products };
@@ -303,7 +297,7 @@ export function CreatePage({
};
const [editingProduct, setEditingProduct] = useState<
- MerchantBackend.Product | undefined
+ TalerMerchantApi.Product | undefined
>(undefined);
const totalPriceInventory = inventoryList.reduce((prev, cur) => {
@@ -314,7 +308,7 @@ export function CreatePage({
const totalPriceProducts = productList.reduce((prev, cur) => {
if (!cur.price) return zero;
const p = Amounts.parseOrThrow(cur.price);
- return Amounts.add(prev, Amounts.mult(p, cur.quantity).amount).amount;
+ return Amounts.add(prev, Amounts.mult(p, cur.quantity ?? 0).amount).amount;
}, zero);
const hasProducts = inventoryList.length > 0 || productList.length > 0;
@@ -343,9 +337,9 @@ export function CreatePage({
totalPrice.amount,
);
- const minAgeByProducts = allProducts.reduce(
+ const minAgeByProducts = inventoryList.reduce(
(cur, prev) =>
- !prev.minimum_age || cur > prev.minimum_age ? cur : prev.minimum_age,
+ !prev.product.minimum_age || cur > prev.product.minimum_age ? cur : prev.product.minimum_age,
0,
);
@@ -766,7 +760,7 @@ export function CreatePage({
);
}
-function asProduct(p: ProductAndQuantity): MerchantBackend.Product {
+function asProduct(p: ProductAndQuantity): TalerMerchantApi.Product {
return {
product_id: p.product.id,
image: p.product.image,
@@ -775,7 +769,6 @@ function asProduct(p: ProductAndQuantity): MerchantBackend.Product {
quantity: p.quantity,
description: p.product.description,
taxes: p.product.taxes,
- minimum_age: p.product.minimum_age,
};
}
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 d2a8619ce..0f8618435 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
@@ -19,29 +19,28 @@
* @author Sebastian Javier Marchano (sebasjm)
*/
+import { HttpStatusCode, TalerErrorDetail, TalerMerchantApi } from "@gnu-taler/taler-util";
import { ErrorType, HttpError } from "@gnu-taler/web-util/browser";
-import { Fragment, h, VNode } from "preact";
+import { Fragment, VNode, h } from "preact";
import { useState } from "preact/hooks";
import { Loading } from "../../../../components/exception/loading.js";
import { NotificationCard } from "../../../../components/menu/index.js";
-import { MerchantBackend } from "../../../../declaration.js";
import { useInstanceDetails } from "../../../../hooks/instance.js";
import { useOrderAPI } from "../../../../hooks/order.js";
import { useInstanceProducts } from "../../../../hooks/product.js";
import { Notification } from "../../../../utils/types.js";
import { CreatePage } from "./CreatePage.js";
-import { HttpStatusCode } from "@gnu-taler/taler-util";
export type Entity = {
- request: MerchantBackend.Orders.PostOrderRequest;
- response: MerchantBackend.Orders.PostOrderResponse;
+ request: TalerMerchantApi.PostOrderRequest;
+ response: TalerMerchantApi.PostOrderResponse;
};
interface Props {
onBack?: () => void;
onConfirm: (id: string) => void;
onUnauthorized: () => VNode;
onNotFound: () => VNode;
- onLoadError: (error: HttpError<MerchantBackend.ErrorDetail>) => VNode;
+ onLoadError: (error: HttpError<TalerErrorDetail>) => VNode;
}
export default function OrderCreate({
onConfirm,
@@ -93,7 +92,7 @@ export default function OrderCreate({
<CreatePage
onBack={onBack}
- onCreate={(request: MerchantBackend.Orders.PostOrderRequest) => {
+ onCreate={(request: TalerMerchantApi.PostOrderRequest) => {
createOrder(request)
.then((r) => {
return onConfirm(r.data.order_id)
diff --git a/packages/merchant-backoffice-ui/src/paths/instance/orders/details/Detail.stories.tsx b/packages/merchant-backoffice-ui/src/paths/instance/orders/details/Detail.stories.tsx
index 63f0d5dc4..7d4877db9 100644
--- a/packages/merchant-backoffice-ui/src/paths/instance/orders/details/Detail.stories.tsx
+++ b/packages/merchant-backoffice-ui/src/paths/instance/orders/details/Detail.stories.tsx
@@ -19,9 +19,9 @@
* @author Sebastian Javier Marchano (sebasjm)
*/
+import { AmountString, TalerMerchantApi } from "@gnu-taler/taler-util";
import { addDays } from "date-fns";
-import { h, VNode, FunctionalComponent } from "preact";
-import { MerchantBackend } from "../../../../declaration.js";
+import { FunctionalComponent, h } from "preact";
import { DetailPage as TestedComponent } from "./DetailPage.js";
export default {
@@ -42,14 +42,13 @@ function createExample<Props>(
return r;
}
-const defaultContractTerm = {
- amount: "TESTKUDOS:10",
+const defaultContractTerm: TalerMerchantApi.ContractTerms = {
+ amount: "TESTKUDOS:10" as AmountString,
timestamp: {
t_s: new Date().getTime() / 1000,
},
- auditors: [],
exchanges: [],
- max_fee: "TESTKUDOS:1",
+ max_fee: "TESTKUDOS:1" as AmountString,
merchant: {} as any,
merchant_base_url: "http://merchant.url/",
order_id: "2021.165-03GDFC26Y1NNG",
@@ -66,7 +65,7 @@ const defaultContractTerm = {
},
wire_method: "x-taler-bank",
h_wire: "asd",
-} as MerchantBackend.ContractTerms;
+};
// contract_terms: defaultContracTerm,
export const Claimed = createExample(TestedComponent, {
@@ -83,15 +82,16 @@ export const PaidNotRefundable = createExample(TestedComponent, {
order_status: "paid",
contract_terms: defaultContractTerm,
refunded: false,
- deposit_total: "TESTKUDOS:10",
- exchange_ec: 0,
+ deposit_total: "TESTKUDOS:10" as AmountString,
+ exchange_code: 0,
order_status_url: "http://merchant.backend/status",
- exchange_hc: 0,
- refund_amount: "TESTKUDOS:0",
+ exchange_http_status: 0,
+ refund_amount: "TESTKUDOS:0" as AmountString,
refund_details: [],
refund_pending: false,
wire_details: [],
wired: false,
+ wire_reports: [],
},
});
@@ -106,12 +106,13 @@ export const PaidRefundable = createExample(TestedComponent, {
},
},
refunded: false,
- deposit_total: "TESTKUDOS:10",
- exchange_ec: 0,
+ deposit_total: "TESTKUDOS:10" as AmountString,
+ exchange_code: 0,
order_status_url: "http://merchant.backend/status",
- exchange_hc: 0,
- refund_amount: "TESTKUDOS:0",
+ exchange_http_status: 0,
+ refund_amount: "TESTKUDOS:0" as AmountString,
refund_details: [],
+ wire_reports: [],
refund_pending: false,
wire_details: [],
wired: false,
@@ -128,6 +129,6 @@ export const Unpaid = createExample(TestedComponent, {
},
summary: "text summary",
taler_pay_uri: "pay uri",
- total_amount: "TESTKUDOS:10",
+ total_amount: "TESTKUDOS:10" as AmountString,
},
});
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 69e9df52e..4ed78b002 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
@@ -19,7 +19,12 @@
* @author Sebastian Javier Marchano (sebasjm)
*/
-import { AmountJson, Amounts, stringifyRefundUri } from "@gnu-taler/taler-util";
+import {
+ AmountJson,
+ Amounts,
+ TalerMerchantApi,
+ stringifyRefundUri,
+} from "@gnu-taler/taler-util";
import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { format, formatDistance } from "date-fns";
import { Fragment, VNode, h } from "preact";
@@ -34,27 +39,29 @@ 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 { MerchantBackend } from "../../../../declaration.js";
-import { datetimeFormatForSettings, usePreference } from "../../../../hooks/preference.js";
+import {
+ datetimeFormatForSettings,
+ usePreference,
+} from "../../../../hooks/preference.js";
import { mergeRefunds } from "../../../../utils/amount.js";
import { RefundModal } from "../list/Table.js";
import { Event, Timeline } from "./Timeline.js";
-type Entity = MerchantBackend.Orders.MerchantOrderStatusResponse;
-type CT = MerchantBackend.ContractTerms;
+type Entity = TalerMerchantApi.MerchantOrderStatusResponse;
+type CT = TalerMerchantApi.ContractTerms;
interface Props {
onBack: () => void;
selected: Entity;
id: string;
- onRefund: (id: string, value: MerchantBackend.Orders.RefundRequest) => void;
+ onRefund: (id: string, value: TalerMerchantApi.RefundRequest) => void;
}
-type Paid = MerchantBackend.Orders.CheckPaymentPaidResponse & {
+type Paid = TalerMerchantApi.CheckPaymentPaidResponse & {
refund_taken: string;
};
-type Unpaid = MerchantBackend.Orders.CheckPaymentUnpaidResponse;
-type Claimed = MerchantBackend.Orders.CheckPaymentClaimedResponse;
+type Unpaid = TalerMerchantApi.CheckPaymentUnpaidResponse;
+type Claimed = TalerMerchantApi.CheckPaymentClaimedResponse;
function ContractTerms({ value }: { value: CT }) {
const { i18n } = useTranslationContext();
@@ -149,7 +156,7 @@ function ClaimedPage({
order,
}: {
id: string;
- order: MerchantBackend.Orders.CheckPaymentClaimedResponse;
+ order: TalerMerchantApi.CheckPaymentClaimedResponse;
}) {
const events: Event[] = [];
if (order.contract_terms.timestamp.t_s !== "never") {
@@ -193,7 +200,7 @@ function ClaimedPage({
const [value, valueHandler] = useState<Partial<Claimed>>(order);
const { i18n } = useTranslationContext();
- const [settings] = usePreference()
+ const [settings] = usePreference();
return (
<div>
@@ -237,10 +244,14 @@ function ClaimedPage({
<b>
<i18n.Translate>claimed at</i18n.Translate>:
</b>{" "}
- {format(
- new Date(order.contract_terms.timestamp.t_s * 1000),
- datetimeFormatForSettings(settings)
- )}
+ {order.contract_terms.timestamp.t_s === "never"
+ ? "never"
+ : format(
+ new Date(
+ order.contract_terms.timestamp.t_s * 1000,
+ ),
+ datetimeFormatForSettings(settings),
+ )}
</p>
</div>
</div>
@@ -311,7 +322,7 @@ function PaidPage({
onRefund,
}: {
id: string;
- order: MerchantBackend.Orders.CheckPaymentPaidResponse;
+ order: TalerMerchantApi.CheckPaymentPaidResponse;
onRefund: (id: string) => void;
}) {
const events: Event[] = [];
@@ -365,8 +376,8 @@ function PaidPage({
});
if (order.wire_details && order.wire_details.length) {
if (order.wire_details.length > 1) {
- let last: MerchantBackend.Orders.TransactionWireTransfer | null = null;
- let first: MerchantBackend.Orders.TransactionWireTransfer | null = null;
+ let last: TalerMerchantApi.TransactionWireTransfer | null = null;
+ let first: TalerMerchantApi.TransactionWireTransfer | null = null;
let total: AmountJson | null = null;
order.wire_details.forEach((w) => {
@@ -410,10 +421,10 @@ function PaidPage({
}
}
- const now = new Date()
+ const now = new Date();
const nextEvent = events.find((e) => {
- return e.when.getTime() > now.getTime()
- })
+ return e.when.getTime() > now.getTime();
+ });
const [value, valueHandler] = useState<Partial<Paid>>(order);
const {
@@ -422,9 +433,10 @@ function PaidPage({
const refundurl = stringifyRefundUri({
merchantBaseUrl: backendUrl,
- orderId: order.contract_terms.order_id
- })
+ orderId: order.contract_terms.order_id,
+ });
const refundable =
+ order.contract_terms.refund_deadline.t_s !== "never" &&
new Date().getTime() < order.contract_terms.refund_deadline.t_s * 1000;
const { i18n } = useTranslationContext();
@@ -506,15 +518,16 @@ function PaidPage({
textOverflow: "ellipsis",
}}
>
- {nextEvent &&
+ {nextEvent && (
<p>
- <i18n.Translate>Next event in </i18n.Translate> {formatDistance(
+ <i18n.Translate>Next event in </i18n.Translate>{" "}
+ {formatDistance(
nextEvent.when,
new Date(),
// "yyyy/MM/dd HH:mm:ss",
)}
</p>
- }
+ )}
</div>
</div>
</div>
@@ -610,11 +623,11 @@ function UnpaidPage({
order,
}: {
id: string;
- order: MerchantBackend.Orders.CheckPaymentUnpaidResponse;
+ order: TalerMerchantApi.CheckPaymentUnpaidResponse;
}) {
const [value, valueHandler] = useState<Partial<Unpaid>>(order);
const { i18n } = useTranslationContext();
- const [settings] = usePreference()
+ const [settings] = usePreference();
return (
<div>
<section class="hero is-hero-bar">
@@ -662,9 +675,9 @@ function UnpaidPage({
{order.creation_time.t_s === "never"
? "never"
: format(
- new Date(order.creation_time.t_s * 1000),
- datetimeFormatForSettings(settings)
- )}
+ new Date(order.creation_time.t_s * 1000),
+ datetimeFormatForSettings(settings),
+ )}
</p>
</div>
</div>
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 dfeaa4447..a7fe1801b 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
@@ -13,20 +13,19 @@
You should have received a copy of the GNU General Public License along with
GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
+import { HttpStatusCode, TalerErrorDetail } from "@gnu-taler/taler-util";
import {
- useTranslationContext,
- HttpError,
ErrorType,
+ HttpError,
+ useTranslationContext,
} from "@gnu-taler/web-util/browser";
-import { Fragment, h, VNode } from "preact";
+import { Fragment, VNode, h } from "preact";
import { useState } from "preact/hooks";
import { Loading } from "../../../../components/exception/loading.js";
import { NotificationCard } from "../../../../components/menu/index.js";
-import { MerchantBackend } from "../../../../declaration.js";
import { useOrderAPI, useOrderDetails } from "../../../../hooks/order.js";
import { Notification } from "../../../../utils/types.js";
import { DetailPage } from "./DetailPage.js";
-import { HttpStatusCode } from "@gnu-taler/taler-util";
export interface Props {
oid: string;
@@ -34,7 +33,7 @@ export interface Props {
onBack: () => void;
onUnauthorized: () => VNode;
onNotFound: () => VNode;
- onLoadError: (error: HttpError<MerchantBackend.ErrorDetail>) => VNode;
+ onLoadError: (error: HttpError<TalerErrorDetail>) => VNode;
}
export default function Update({
diff --git a/packages/merchant-backoffice-ui/src/paths/instance/orders/list/List.stories.tsx b/packages/merchant-backoffice-ui/src/paths/instance/orders/list/List.stories.tsx
index 9df006083..5c9969689 100644
--- a/packages/merchant-backoffice-ui/src/paths/instance/orders/list/List.stories.tsx
+++ b/packages/merchant-backoffice-ui/src/paths/instance/orders/list/List.stories.tsx
@@ -19,8 +19,9 @@
* @author Sebastian Javier Marchano (sebasjm)
*/
-import { h, VNode, FunctionalComponent } from "preact";
+import { FunctionalComponent, h } from "preact";
import { ListPage as TestedComponent } from "./ListPage.js";
+import { AmountString } from "@gnu-taler/taler-util";
export default {
title: "Pages/Order/List",
@@ -54,7 +55,7 @@ export const Example = createExample(TestedComponent, {
orders: [
{
id: "123",
- amount: "TESTKUDOS:10",
+ amount: "TESTKUDOS:10" as AmountString,
paid: false,
refundable: true,
row_id: 1,
@@ -66,7 +67,7 @@ export const Example = createExample(TestedComponent, {
},
{
id: "234",
- amount: "TESTKUDOS:12",
+ amount: "TESTKUDOS:12" as AmountString,
paid: true,
refundable: true,
row_id: 2,
@@ -79,7 +80,7 @@ export const Example = createExample(TestedComponent, {
},
{
id: "456",
- amount: "TESTKUDOS:1",
+ amount: "TESTKUDOS:1" as AmountString,
paid: false,
refundable: false,
row_id: 3,
@@ -92,7 +93,7 @@ export const Example = createExample(TestedComponent, {
},
{
id: "234",
- amount: "TESTKUDOS:12",
+ amount: "TESTKUDOS:12" as AmountString,
paid: false,
refundable: false,
row_id: 4,
diff --git a/packages/merchant-backoffice-ui/src/paths/instance/orders/list/ListPage.tsx b/packages/merchant-backoffice-ui/src/paths/instance/orders/list/ListPage.tsx
index b45d468cb..7b88985dc 100644
--- a/packages/merchant-backoffice-ui/src/paths/instance/orders/list/ListPage.tsx
+++ b/packages/merchant-backoffice-ui/src/paths/instance/orders/list/ListPage.tsx
@@ -19,14 +19,14 @@
* @author Sebastian Javier Marchano (sebasjm)
*/
+import { TalerMerchantApi } from "@gnu-taler/taler-util";
import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { format } from "date-fns";
-import { h, VNode, Fragment } from "preact";
+import { Fragment, VNode, h } from "preact";
import { useState } from "preact/hooks";
import { DatePicker } from "../../../../components/picker/DatePicker.js";
-import { MerchantBackend, WithId } from "../../../../declaration.js";
-import { CardTable } from "./Table.js";
import { dateFormatForSettings, usePreference } from "../../../../hooks/preference.js";
+import { CardTable } from "./Table.js";
export interface ListPageProps {
onShowAll: () => void;
@@ -46,14 +46,14 @@ export interface ListPageProps {
jumpToDate?: Date;
onSelectDate: (date?: Date) => void;
- orders: (MerchantBackend.Orders.OrderHistoryEntry & WithId)[];
+ orders: (TalerMerchantApi.OrderHistoryEntry & WithId)[];
onLoadMoreBefore?: () => void;
hasMoreBefore?: boolean;
hasMoreAfter?: boolean;
onLoadMoreAfter?: () => void;
- onSelectOrder: (o: MerchantBackend.Orders.OrderHistoryEntry & WithId) => void;
- onRefundOrder: (o: MerchantBackend.Orders.OrderHistoryEntry & WithId) => void;
+ onSelectOrder: (o: TalerMerchantApi.OrderHistoryEntry & WithId) => void;
+ onRefundOrder: (o: TalerMerchantApi.OrderHistoryEntry & WithId) => void;
onCreate: () => void;
}
diff --git a/packages/merchant-backoffice-ui/src/paths/instance/orders/list/Table.tsx b/packages/merchant-backoffice-ui/src/paths/instance/orders/list/Table.tsx
index cebc4afe6..c3df81b87 100644
--- a/packages/merchant-backoffice-ui/src/paths/instance/orders/list/Table.tsx
+++ b/packages/merchant-backoffice-ui/src/paths/instance/orders/list/Table.tsx
@@ -19,13 +19,13 @@
* @author Sebastian Javier Marchano (sebasjm)
*/
-import { Amounts } from "@gnu-taler/taler-util";
+import { Amounts, TalerMerchantApi } from "@gnu-taler/taler-util";
import {
useMerchantApiContext,
useTranslationContext,
} from "@gnu-taler/web-util/browser";
import { format } from "date-fns";
-import { h, VNode } from "preact";
+import { VNode, h } from "preact";
import { StateUpdater, useState } from "preact/hooks";
import {
FormErrors,
@@ -36,14 +36,13 @@ import { InputCurrency } from "../../../../components/form/InputCurrency.js";
import { InputGroup } from "../../../../components/form/InputGroup.js";
import { InputSelector } from "../../../../components/form/InputSelector.js";
import { ConfirmModal } from "../../../../components/modal/index.js";
-import { MerchantBackend, WithId } from "../../../../declaration.js";
-import { mergeRefunds } from "../../../../utils/amount.js";
import {
datetimeFormatForSettings,
usePreference,
} from "../../../../hooks/preference.js";
+import { mergeRefunds } from "../../../../utils/amount.js";
-type Entity = MerchantBackend.Orders.OrderHistoryEntry & WithId;
+type Entity = TalerMerchantApi.OrderHistoryEntry & WithId;
interface Props {
orders: Entity[];
onRefund: (value: Entity) => void;
@@ -248,8 +247,8 @@ function EmptyTable(): VNode {
interface RefundModalProps {
onCancel: () => void;
- onConfirm: (value: MerchantBackend.Orders.RefundRequest) => void;
- order: MerchantBackend.Orders.MerchantOrderStatusResponse;
+ onConfirm: (value: TalerMerchantApi.RefundRequest) => void;
+ order: TalerMerchantApi.MerchantOrderStatusResponse;
}
export function RefundModal({
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 369ef8c8b..cd62685ca 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
@@ -19,16 +19,17 @@
* @author Sebastian Javier Marchano (sebasjm)
*/
+import { HttpStatusCode, TalerErrorDetail, TalerMerchantApi } from "@gnu-taler/taler-util";
import {
ErrorType,
HttpError,
useTranslationContext,
} from "@gnu-taler/web-util/browser";
-import { Fragment, h, VNode } from "preact";
+import { Fragment, VNode, h } from "preact";
import { useState } from "preact/hooks";
import { Loading } from "../../../../components/exception/loading.js";
+import { JumpToElementById } from "../../../../components/form/JumpToElementById.js";
import { NotificationCard } from "../../../../components/menu/index.js";
-import { MerchantBackend } from "../../../../declaration.js";
import {
InstanceOrderFilter,
useInstanceOrders,
@@ -38,12 +39,10 @@ import {
import { Notification } from "../../../../utils/types.js";
import { ListPage } from "./ListPage.js";
import { RefundModal } from "./Table.js";
-import { HttpStatusCode } from "@gnu-taler/taler-util";
-import { JumpToElementById } from "../../../../components/form/JumpToElementById.js";
interface Props {
onUnauthorized: () => VNode;
- onLoadError: (error: HttpError<MerchantBackend.ErrorDetail>) => VNode;
+ onLoadError: (error: HttpError<TalerErrorDetail>) => VNode;
onNotFound: () => VNode;
onSelect: (id: string) => void;
onCreate: () => void;
@@ -58,7 +57,7 @@ export default function OrderList({
}: Props): VNode {
const [filter, setFilter] = useState<InstanceOrderFilter>({ paid: "no" });
const [orderToBeRefunded, setOrderToBeRefunded] = useState<
- MerchantBackend.Orders.OrderHistoryEntry | undefined
+ TalerMerchantApi.OrderHistoryEntry | undefined
>(undefined);
const setNewDate = (date?: Date): void =>
@@ -186,10 +185,10 @@ export default function OrderList({
interface RefundProps {
id: string;
onUnauthorized: () => VNode;
- onLoadError: (error: HttpError<MerchantBackend.ErrorDetail>) => VNode;
+ onLoadError: (error: HttpError<TalerErrorDetail>) => VNode;
onNotFound: () => VNode;
onCancel: () => void;
- onConfirm: (m: MerchantBackend.Orders.RefundRequest) => void;
+ onConfirm: (m: TalerMerchantApi.RefundRequest) => void;
}
function RefundModalForTable({