gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-typescript-core] branch master updated (ef6b025b7 -> 1e15e48de)


From: Admin
Subject: [taler-typescript-core] branch master updated (ef6b025b7 -> 1e15e48de)
Date: Tue, 11 Feb 2025 21:25:34 +0100

This is an automated email from the git hooks/post-receive script.

sebasjm pushed a change to branch master
in repository taler-typescript-core.

    from ef6b025b7 fix #9517
     new 3aea0c779 fix #9522
     new 1e15e48de fix #9518 #9519

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../components/product/NonInventoryProductForm.tsx   | 17 +++++++++++++----
 .../src/components/product/ProductList.tsx           |  4 ++--
 .../src/paths/instance/orders/create/CreatePage.tsx  | 17 ++++++++---------
 .../src/paths/instance/orders/list/index.tsx         | 20 +++++++-------------
 .../src/paths/instance/products/list/Table.tsx       |  4 ++--
 packages/taler-util/src/types-taler-merchant.ts      |  9 +++++++++
 6 files changed, 41 insertions(+), 30 deletions(-)

diff --git 
a/packages/merchant-backoffice-ui/src/components/product/NonInventoryProductForm.tsx
 
b/packages/merchant-backoffice-ui/src/components/product/NonInventoryProductForm.tsx
index 4fd6e62ad..af0fec5bf 100644
--- 
a/packages/merchant-backoffice-ui/src/components/product/NonInventoryProductForm.tsx
+++ 
b/packages/merchant-backoffice-ui/src/components/product/NonInventoryProductForm.tsx
@@ -25,6 +25,7 @@ import { InputCurrency } from "../form/InputCurrency.js";
 import { InputImage } from "../form/InputImage.js";
 import { InputNumber } from "../form/InputNumber.js";
 import { InputTaxes } from "../form/InputTaxes.js";
+import { usePreference } from "../../hooks/preference.js";
 
 type Entity = TalerMerchantApi.Product;
 
@@ -140,6 +141,7 @@ interface NonInventoryProduct {
 
 export function ProductForm({ onSubscribe, initial }: ProductProps): VNode {
   const { i18n } = useTranslationContext();
+  const [preference] = usePreference();
   const [value, valueHandler] = useState<Partial<NonInventoryProduct>>({
     taxes: [],
     ...initial,
@@ -154,7 +156,7 @@ export function ProductForm({ onSubscribe, initial }: 
ProductProps): VNode {
             ? i18n.str`Must be grater than 0`
             : undefined,
     description: !value.description ? i18n.str`Required` : undefined,
-    unit: !value.description ? i18n.str`Required` : undefined,
+    unit: !value.unit ? i18n.str`Required` : undefined,
     price: !value.price
       ? i18n.str`Required`
       : Amounts.parse(value.price) === undefined
@@ -193,12 +195,12 @@ export function ProductForm({ onSubscribe, initial }: 
ProductProps): VNode {
         />
         <Input<NonInventoryProduct>
           name="unit"
-          label={i18n.str`Unit`}
+          label={i18n.str`Unit name`}
           tooltip={i18n.str`Name of the product unit.`}
         />
         <InputCurrency<NonInventoryProduct>
           name="price"
-          label={i18n.str`Price`}
+          label={i18n.str`Price per unit`}
           tooltip={i18n.str`Amount in the current currency.`}
         />
 
@@ -208,7 +210,14 @@ export function ProductForm({ onSubscribe, initial }: 
ProductProps): VNode {
           tooltip={i18n.str`How many products will be added.`}
         />
 
-        <InputTaxes<NonInventoryProduct> name="taxes" label={i18n.str`Taxes`} 
/>
+        {preference.developerMode ? (
+          <InputTaxes<NonInventoryProduct>
+            name="taxes"
+            label={i18n.str`Taxes`}
+          />
+        ) : (
+          <Fragment />
+        )}
       </FormProvider>
     </div>
   );
diff --git 
a/packages/merchant-backoffice-ui/src/components/product/ProductList.tsx 
b/packages/merchant-backoffice-ui/src/components/product/ProductList.tsx
index 401013782..ca18d71ac 100644
--- a/packages/merchant-backoffice-ui/src/components/product/ProductList.tsx
+++ b/packages/merchant-backoffice-ui/src/components/product/ProductList.tsx
@@ -43,7 +43,7 @@ export function ProductList({ list, actions = [] }: Props): 
VNode {
               <i18n.Translate>Quantity</i18n.Translate>
             </th>
             <th>
-              <i18n.Translate>Unit price</i18n.Translate>
+              <i18n.Translate>Price per unit</i18n.Translate>
             </th>
             <th>
               <i18n.Translate>Total price</i18n.Translate>
@@ -59,7 +59,7 @@ export function ProductList({ list, actions = [] }: Props): 
VNode {
               : Amounts.stringify(
                   Amounts.mult(
                     Amounts.parseOrThrow(entry.price),
-                    entry.quantity ?? 0
+                    entry.quantity ?? 0,
                   ).amount,
                 );
 
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 3f237eb2b..d549544d7 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
@@ -368,6 +368,7 @@ export function CreatePage({
     parsedPrice ?? Amounts.zeroOfCurrency(config.currency),
     totalPrice.amount,
   );
+  const discountOrRiseRounded = Math.round((discountOrRise - 1) * 100);
 
   const minAgeByProducts = inventoryList.reduce(
     (cur, prev) =>
@@ -484,20 +485,18 @@ export function CreatePage({
                 <Fragment>
                   <InputCurrency
                     name="pricing.products_price"
-                    label={i18n.str`Total price`}
+                    label={i18n.str`Products price sum`}
                     readonly
                     tooltip={i18n.str`Total product price added up`}
                   />
                   <InputCurrency
                     name="pricing.order_price"
-                    label={i18n.str`Total price`}
+                    label={i18n.str`Order price`}
                     addonAfter={
-                      discountOrRise > 0 &&
-                      (discountOrRise < 1
-                        ? `discount of %${Math.round(
-                            (1 - discountOrRise) * 100,
-                          )}`
-                        : `rise of %${Math.round((discountOrRise - 1) * 100)}`)
+                      discountOrRiseRounded > 0 &&
+                      (discountOrRiseRounded < 1
+                        ? `discount of ${discountOrRiseRounded}%`
+                        : `rise of ${discountOrRiseRounded}%`)
                     }
                     tooltip={i18n.str`Amount to be paid by the customer`}
                   />
@@ -701,7 +700,7 @@ export function CreatePage({
                       tooltip={i18n.str`Any value greater than 0 will limit 
the coins able be used to pay this contract. If empty the age restriction will 
be defined by the products`}
                       help={
                         minAgeByProducts > 0
-                          ? i18n.str`Min age defined by the producs is 
${minAgeByProducts}`
+                          ? i18n.str`Min age defined by the products is 
${minAgeByProducts}`
                           : i18n.str`No product with age restriction in this 
order`
                       }
                     />
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 787512e2a..d8695547f 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
@@ -25,6 +25,7 @@ import {
   TalerError,
   TalerMerchantApi,
   assertUnreachable,
+  stringifyPayUri,
 } from "@gnu-taler/taler-util";
 import { useTranslationContext } from "@gnu-taler/web-util/browser";
 import { VNode, h } from "preact";
@@ -131,14 +132,7 @@ export default function OrderList({ onCreate, onSelect }: 
Props): VNode {
         onCopyURL={async (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);
-            } else {
-              if (resp.body.contract_terms.fulfillment_url) {
-                copyToClipboard(resp.body.contract_terms.fulfillment_url);
-              }
-            }
-            copyToClipboard(resp.body.order_status);
+            copyToClipboard(resp.body.order_status_url);
           }
         }}
         onCreate={onCreate}
@@ -169,7 +163,7 @@ export default function OrderList({ onCreate, onSelect }: 
Props): VNode {
                       setNotif({
                         message: i18n.str`Could not create the refund`,
                         type: "ERROR",
-                        description: i18n.str`There are pending KYC 
requirements.`
+                        description: i18n.str`There are pending KYC 
requirements.`,
                       });
                       return;
                     }
@@ -186,18 +180,17 @@ export default function OrderList({ onCreate, onSelect }: 
Props): VNode {
                       return;
                     }
                     default: {
-                      assertUnreachable(resp)
+                      assertUnreachable(resp);
                     }
-  
                   }
-
                 }
               })
               .catch((error) =>
                 setNotif({
                   message: i18n.str`Could not create the refund`,
                   type: "ERROR",
-                  description: error instanceof Error ? error.message : 
String(error),
+                  description:
+                    error instanceof Error ? error.message : String(error),
                 }),
               )
               .then(() => setOrderToBeRefunded(undefined));
@@ -253,5 +246,6 @@ function RefundModalForTable({ id, onConfirm, onCancel }: 
RefundProps): VNode {
 }
 
 async function copyToClipboard(text: string): Promise<void> {
+  console.log("copied", text);
   return navigator.clipboard.writeText(text);
 }
diff --git 
a/packages/merchant-backoffice-ui/src/paths/instance/products/list/Table.tsx 
b/packages/merchant-backoffice-ui/src/paths/instance/products/list/Table.tsx
index 90ff64459..185bc82ce 100644
--- a/packages/merchant-backoffice-ui/src/paths/instance/products/list/Table.tsx
+++ b/packages/merchant-backoffice-ui/src/paths/instance/products/list/Table.tsx
@@ -374,7 +374,7 @@ function FastProductWithInfiniteStockUpdateForm({
       >
         <InputCurrency<FastProductUpdate>
           name="price"
-          label={i18n.str`Price`}
+          label={i18n.str`Price per unit`}
           tooltip={i18n.str`Update the product with new price`}
         />
       </FormProvider>
@@ -454,7 +454,7 @@ function FastProductWithManagedStockUpdateForm({
         />
         <InputCurrency<FastProductUpdate>
           name="price"
-          label={i18n.str`Price`}
+          label={i18n.str`Price per unit`}
           tooltip={i18n.str`New price for the product`}
         />
       </FormProvider>
diff --git a/packages/taler-util/src/types-taler-merchant.ts 
b/packages/taler-util/src/types-taler-merchant.ts
index 9fec76c46..38dbe25d6 100644
--- a/packages/taler-util/src/types-taler-merchant.ts
+++ b/packages/taler-util/src/types-taler-merchant.ts
@@ -2341,6 +2341,13 @@ export interface CheckPaymentClaimedResponse {
 
   // Contract terms.
   contract_terms: ContractTerms;
+
+  // URI that the wallet must process to complete the payment.
+  taler_pay_uri: string;
+
+  // Status URL, can be used as a redirect target for the browser
+  // to show the order QR code / trigger the wallet.
+  order_status_url: string;
 }
 
 export interface CheckPaymentUnpaidResponse {
@@ -3673,6 +3680,8 @@ export const codecForCheckPaymentClaimedResponse =
     buildCodecForObject<CheckPaymentClaimedResponse>()
       .property("order_status", codecForConstString("claimed"))
       .property("contract_terms", codecForContractTerms())
+      .property("taler_pay_uri", codecForTalerUriString())
+      .property("order_status_url", codecForString())
       .build("TalerMerchantApi.CheckPaymentClaimedResponse");
 
 export const codecForMerchantOrderPrivateStatusResponse =

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]