diff options
author | Sebastian <sebasjm@gmail.com> | 2023-04-04 10:04:28 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2023-04-04 10:04:28 -0300 |
commit | 860cd81f35eb87932916eba1f23fa6ae9cde1eae (patch) | |
tree | 0c52c8eccc4d6e20aa6e22be5b759a11683d4e0f | |
parent | 2ef40efe53f064520db29f07a20302a5b9ebf276 (diff) |
add fullfilment url and message if the are present
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) && ( + <section> + <InfoBox> + <b>{contract_terms?.fulfillment_message || `{{ contract_terms.fulfillment_message }}`}</b>. + </InfoBox> + </section> + )} + {btr && `{{/contract_terms.fulfillment_message}}`} + <section> <TableExpanded> <dt>Order summary:</dt> <dd>{contract_terms?.summary || `{{ contract_terms.summary }}`}</dd> + {btr && `{{#contract_terms.fulfillment_url}}`} + <dt>Fulfillment URL:</dt> + <dd><a href={contract_terms?.fulfillment_url || `{{ contract_terms.fulfillment_url }}`}>{contract_terms?.fulfillment_url || `{{ contract_terms.fulfillment_url }}`}</a></dd> + {btr && `{{/contract_terms.fulfillment_url}}`} <dt>Amount paid:</dt> <dd>{contract_terms?.amount || `{{ contract_terms.amount }}`}</dd> <dt>Order date:</dt> @@ -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); |