From 860cd81f35eb87932916eba1f23fa6ae9cde1eae Mon Sep 17 00:00:00 2001 From: Sebastian Date: Tue, 4 Apr 2023 10:04:28 -0300 Subject: [PATCH] add fullfilment url and message if the are present --- .../merchant-backend-ui/src/declaration.d.ts | 1 + .../src/pages/ShowOrderDetails.examples.ts | 8 +++++ .../src/pages/ShowOrderDetails.tsx | 30 ++++++++++++++----- 3 files changed, 31 insertions(+), 8 deletions(-) diff --git a/packages/merchant-backend-ui/src/declaration.d.ts b/packages/merchant-backend-ui/src/declaration.d.ts index 74b0a5011..0e7a18eb5 100644 --- a/packages/merchant-backend-ui/src/declaration.d.ts +++ b/packages/merchant-backend-ui/src/declaration.d.ts @@ -1284,6 +1284,7 @@ export namespace MerchantBackend { // will send back to the customer the same proposal. Clearly, this URL // can be bookmarked and shared by users. fulfillment_url?: string; + fulfillment_message?: string; // Maximum total deposit fee accepted by the merchant for this contract max_fee: Amount; diff --git a/packages/merchant-backend-ui/src/pages/ShowOrderDetails.examples.ts b/packages/merchant-backend-ui/src/pages/ShowOrderDetails.examples.ts index ba68397ee..22cfd1e17 100644 --- a/packages/merchant-backend-ui/src/pages/ShowOrderDetails.examples.ts +++ b/packages/merchant-backend-ui/src/pages/ShowOrderDetails.examples.ts @@ -216,4 +216,12 @@ export const exampleData: { [name: string]: Props } = { } }, }, + WithFulfillmentURL: { + order_summary: 'this is the order with fulfillmentURL', + contract_terms: { + ...defaultContractTerms, + fulfillment_url: "https://demo.taler.net", + fulfillment_message: "Congratulations! You just purchased an valuable item!" + }, + }, } diff --git a/packages/merchant-backend-ui/src/pages/ShowOrderDetails.tsx b/packages/merchant-backend-ui/src/pages/ShowOrderDetails.tsx index aa62c2932..ca93c3f7d 100644 --- a/packages/merchant-backend-ui/src/pages/ShowOrderDetails.tsx +++ b/packages/merchant-backend-ui/src/pages/ShowOrderDetails.tsx @@ -171,10 +171,24 @@ export function ShowOrderDetails({ )} {btr && `{{/refund_amount}}`} + {btr && `{{#contract_terms.fulfillment_message}}`} + {(btr || contract_terms?.fulfillment_message) && ( +
+ + {contract_terms?.fulfillment_message || `{{ contract_terms.fulfillment_message }}`}. + +
+ )} + {btr && `{{/contract_terms.fulfillment_message}}`} +
Order summary:
{contract_terms?.summary || `{{ contract_terms.summary }}`}
+ {btr && `{{#contract_terms.fulfillment_url}}`} +
Fulfillment URL:
+
{contract_terms?.fulfillment_url || `{{ contract_terms.fulfillment_url }}`}
+ {btr && `{{/contract_terms.fulfillment_url}}`}
Amount paid:
{contract_terms?.amount || `{{ contract_terms.amount }}`}
Order date:
@@ -183,7 +197,7 @@ export function ShowOrderDetails({ ? contract_terms?.timestamp.t_s != "never" ? format( contract_terms?.timestamp.t_s, - "dd MMM yyyy HH:mm:ss" + "dd MMM yyyy HH:mm:ss", ) : "never" : `{{ contract_terms.timestamp_str }}`}{" "} @@ -243,7 +257,7 @@ export function ShowOrderDetails({ ? p.delivery_date.t_s != "never" ? format( p.delivery_date.t_s, - "dd MMM yyyy HH:mm:ss" + "dd MMM yyyy HH:mm:ss", ) : "never" : `{{ delivery_date_str }}`}{" "} @@ -293,7 +307,7 @@ export function ShowOrderDetails({ ? contract_terms?.delivery_date.t_s != "never" ? format( contract_terms?.delivery_date.t_s, - "dd MMM yyyy HH:mm:ss" + "dd MMM yyyy HH:mm:ss", ) : "never" : `{{ contract_terms.delivery_date_str }}`}{" "} @@ -335,7 +349,7 @@ export function ShowOrderDetails({ ? contract_terms?.pay_deadline.t_s != "never" ? format( contract_terms?.pay_deadline.t_s, - "dd MMM yyyy HH:mm:ss" + "dd MMM yyyy HH:mm:ss", ) : "never" : `{{ contract_terms.pay_deadline_str }}`}{" "} @@ -346,7 +360,7 @@ export function ShowOrderDetails({ ? contract_terms?.wire_transfer_deadline.t_s != "never" ? format( contract_terms?.wire_transfer_deadline.t_s, - "dd MMM yyyy HH:mm:ss" + "dd MMM yyyy HH:mm:ss", ) : "never" : `{{ contract_terms.wire_transfer_deadline_str }}`}{" "} @@ -376,7 +390,7 @@ export function ShowOrderDetails({ ? contract_terms?.refund_deadline.t_s != "never" ? format( contract_terms?.refund_deadline.t_s, - "dd MMM yyyy HH:mm:ss" + "dd MMM yyyy HH:mm:ss", ) : "never" : `{{ contract_terms.refund_deadline_str }}`}{" "} @@ -393,7 +407,7 @@ export function ShowOrderDetails({ intervalToDuration({ start: 0, end: contract_terms?.auto_refund.d_us, - }) + }), ) : "forever" : `{{ contract_terms.auto_refund_str }}`}{" "} @@ -533,7 +547,7 @@ export function mount(): void { order_summary={os} refund_amount={ra} />, - document.body + document.body, ); } catch (e) { console.error("got error", e);