diff options
Diffstat (limited to 'packages/merchant-backoffice-ui/src/hooks/urls.ts')
-rw-r--r-- | packages/merchant-backoffice-ui/src/hooks/urls.ts | 122 |
1 files changed, 27 insertions, 95 deletions
diff --git a/packages/merchant-backoffice-ui/src/hooks/urls.ts b/packages/merchant-backoffice-ui/src/hooks/urls.ts index b6485259f..95e1c04f3 100644 --- a/packages/merchant-backoffice-ui/src/hooks/urls.ts +++ b/packages/merchant-backoffice-ui/src/hooks/urls.ts @@ -1,6 +1,6 @@ /* This file is part of GNU Taler - (C) 2021-2023 Taler Systems S.A. + (C) 2021-2024 Taler Systems S.A. GNU Taler is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -18,16 +18,16 @@ * * @author Sebastian Javier Marchano (sebasjm) */ +import { TalerMerchantApi } from "@gnu-taler/taler-util"; import { Query } from "@gnu-taler/web-util/testing"; -import { MerchantBackend } from "../declaration.js"; //////////////////// // ORDER //////////////////// export const API_CREATE_ORDER: Query< - MerchantBackend.Orders.PostOrderRequest, - MerchantBackend.Orders.PostOrderResponse + TalerMerchantApi.PostOrderRequest, + TalerMerchantApi.PostOrderResponse > = { method: "POST", url: "http://backend/instances/default/private/orders", @@ -35,14 +35,14 @@ export const API_CREATE_ORDER: Query< export const API_GET_ORDER_BY_ID = ( id: string, -): Query<unknown, MerchantBackend.Orders.MerchantOrderStatusResponse> => ({ +): Query<unknown, TalerMerchantApi.MerchantOrderStatusResponse> => ({ method: "GET", url: `http://backend/instances/default/private/orders/${id}`, }); export const API_LIST_ORDERS: Query< unknown, - MerchantBackend.Orders.OrderHistory + TalerMerchantApi.OrderHistory > = { method: "GET", url: "http://backend/instances/default/private/orders", @@ -51,8 +51,8 @@ export const API_LIST_ORDERS: Query< export const API_REFUND_ORDER_BY_ID = ( id: string, ): Query< - MerchantBackend.Orders.RefundRequest, - MerchantBackend.Orders.MerchantRefundResponse + TalerMerchantApi.RefundRequest, + TalerMerchantApi.MerchantRefundResponse > => ({ method: "POST", url: `http://backend/instances/default/private/orders/${id}/refund`, @@ -60,14 +60,14 @@ export const API_REFUND_ORDER_BY_ID = ( export const API_FORGET_ORDER_BY_ID = ( id: string, -): Query<MerchantBackend.Orders.ForgetRequest, unknown> => ({ +): Query<TalerMerchantApi.ForgetRequest, unknown> => ({ method: "PATCH", url: `http://backend/instances/default/private/orders/${id}/forget`, }); export const API_DELETE_ORDER = ( id: string, -): Query<MerchantBackend.Orders.ForgetRequest, unknown> => ({ +): Query<TalerMerchantApi.ForgetRequest, unknown> => ({ method: "DELETE", url: `http://backend/instances/default/private/orders/${id}`, }); @@ -78,14 +78,14 @@ export const API_DELETE_ORDER = ( export const API_LIST_TRANSFERS: Query< unknown, - MerchantBackend.Transfers.TransferList + TalerMerchantApi.TransferList > = { method: "GET", url: "http://backend/instances/default/private/transfers", }; export const API_INFORM_TRANSFERS: Query< - MerchantBackend.Transfers.TransferInformation, + TalerMerchantApi.TransferInformation, {} > = { method: "POST", @@ -97,7 +97,7 @@ export const API_INFORM_TRANSFERS: Query< //////////////////// export const API_CREATE_PRODUCT: Query< - MerchantBackend.Products.ProductAddDetail, + TalerMerchantApi.ProductAddDetail, unknown > = { method: "POST", @@ -106,7 +106,7 @@ export const API_CREATE_PRODUCT: Query< export const API_LIST_PRODUCTS: Query< unknown, - MerchantBackend.Products.InventorySummaryResponse + TalerMerchantApi.InventorySummaryResponse > = { method: "GET", url: "http://backend/instances/default/private/products", @@ -114,7 +114,7 @@ export const API_LIST_PRODUCTS: Query< export const API_GET_PRODUCT_BY_ID = ( id: string, -): Query<unknown, MerchantBackend.Products.ProductDetail> => ({ +): Query<unknown, TalerMerchantApi.ProductDetail> => ({ method: "GET", url: `http://backend/instances/default/private/products/${id}`, }); @@ -122,8 +122,8 @@ export const API_GET_PRODUCT_BY_ID = ( export const API_UPDATE_PRODUCT_BY_ID = ( id: string, ): Query< - MerchantBackend.Products.ProductPatchDetail, - MerchantBackend.Products.InventorySummaryResponse + TalerMerchantApi.ProductPatchDetail, + TalerMerchantApi.InventorySummaryResponse > => ({ method: "PATCH", url: `http://backend/instances/default/private/products/${id}`, @@ -135,67 +135,11 @@ export const API_DELETE_PRODUCT = (id: string): Query<unknown, unknown> => ({ }); //////////////////// -// RESERVES -//////////////////// - -export const API_CREATE_RESERVE: Query< - MerchantBackend.Rewards.ReserveCreateRequest, - MerchantBackend.Rewards.ReserveCreateConfirmation -> = { - method: "POST", - url: "http://backend/instances/default/private/reserves", -}; -export const API_LIST_RESERVES: Query< - unknown, - MerchantBackend.Rewards.RewardReserveStatus -> = { - method: "GET", - url: "http://backend/instances/default/private/reserves", -}; - -export const API_GET_RESERVE_BY_ID = ( - pub: string, -): Query<unknown, MerchantBackend.Rewards.ReserveDetail> => ({ - method: "GET", - url: `http://backend/instances/default/private/reserves/${pub}`, -}); - -export const API_GET_REWARD_BY_ID = ( - pub: string, -): Query<unknown, MerchantBackend.Rewards.RewardDetails> => ({ - method: "GET", - url: `http://backend/instances/default/private/rewards/${pub}`, -}); - -export const API_AUTHORIZE_REWARD_FOR_RESERVE = ( - pub: string, -): Query< - MerchantBackend.Rewards.RewardCreateRequest, - MerchantBackend.Rewards.RewardCreateConfirmation -> => ({ - method: "POST", - url: `http://backend/instances/default/private/reserves/${pub}/authorize-reward`, -}); - -export const API_AUTHORIZE_REWARD: Query< - MerchantBackend.Rewards.RewardCreateRequest, - MerchantBackend.Rewards.RewardCreateConfirmation -> = { - method: "POST", - url: `http://backend/instances/default/private/rewards`, -}; - -export const API_DELETE_RESERVE = (id: string): Query<unknown, unknown> => ({ - method: "DELETE", - url: `http://backend/instances/default/private/reserves/${id}`, -}); - -//////////////////// // INSTANCE ADMIN //////////////////// export const API_CREATE_INSTANCE: Query< - MerchantBackend.Instances.InstanceConfigurationMessage, + TalerMerchantApi.InstanceConfigurationMessage, unknown > = { method: "POST", @@ -204,21 +148,21 @@ export const API_CREATE_INSTANCE: Query< export const API_GET_INSTANCE_BY_ID = ( id: string, -): Query<unknown, MerchantBackend.Instances.QueryInstancesResponse> => ({ +): Query<unknown, TalerMerchantApi.QueryInstancesResponse> => ({ method: "GET", url: `http://backend/management/instances/${id}`, }); export const API_GET_INSTANCE_KYC_BY_ID = ( id: string, -): Query<unknown, MerchantBackend.KYC.AccountKycRedirects> => ({ +): Query<unknown, TalerMerchantApi.AccountKycRedirects> => ({ method: "GET", url: `http://backend/management/instances/${id}/kyc`, }); export const API_LIST_INSTANCES: Query< unknown, - MerchantBackend.Instances.InstancesResponse + TalerMerchantApi.InstancesResponse > = { method: "GET", url: "http://backend/management/instances", @@ -227,7 +171,7 @@ export const API_LIST_INSTANCES: Query< export const API_UPDATE_INSTANCE_BY_ID = ( id: string, ): Query< - MerchantBackend.Instances.InstanceReconfigurationMessage, + TalerMerchantApi.InstanceReconfigurationMessage, unknown > => ({ method: "PATCH", @@ -237,7 +181,7 @@ export const API_UPDATE_INSTANCE_BY_ID = ( export const API_UPDATE_INSTANCE_AUTH_BY_ID = ( id: string, ): Query< - MerchantBackend.Instances.InstanceAuthConfigurationMessage, + TalerMerchantApi.InstanceAuthConfigurationMessage, unknown > => ({ method: "POST", @@ -250,24 +194,12 @@ export const API_DELETE_INSTANCE = (id: string): Query<unknown, unknown> => ({ }); //////////////////// -// AUTH -//////////////////// - -export const API_NEW_LOGIN: Query< - MerchantBackend.Instances.LoginTokenRequest, - unknown -> = ({ - method: "POST", - url: `http://backend/private/token`, -}); - -//////////////////// // INSTANCE //////////////////// export const API_GET_CURRENT_INSTANCE: Query< unknown, - MerchantBackend.Instances.QueryInstancesResponse + TalerMerchantApi.QueryInstancesResponse > = { method: "GET", url: `http://backend/instances/default/private/`, @@ -275,14 +207,14 @@ export const API_GET_CURRENT_INSTANCE: Query< export const API_GET_CURRENT_INSTANCE_KYC: Query< unknown, - MerchantBackend.KYC.AccountKycRedirects + TalerMerchantApi.AccountKycRedirects > = { method: "GET", url: `http://backend/instances/default/private/kyc`, }; export const API_UPDATE_CURRENT_INSTANCE: Query< - MerchantBackend.Instances.InstanceReconfigurationMessage, + TalerMerchantApi.InstanceReconfigurationMessage, unknown > = { method: "PATCH", @@ -290,7 +222,7 @@ export const API_UPDATE_CURRENT_INSTANCE: Query< }; export const API_UPDATE_CURRENT_INSTANCE_AUTH: Query< - MerchantBackend.Instances.InstanceAuthConfigurationMessage, + TalerMerchantApi.InstanceAuthConfigurationMessage, unknown > = { method: "POST", |