From ae177549a5818e2698253ef17a11b1effbd66fdb Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Mon, 22 Jan 2018 01:12:08 +0100 Subject: implement flicker-free refunds --- src/webex/pages/refund.tsx | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) (limited to 'src/webex/pages/refund.tsx') diff --git a/src/webex/pages/refund.tsx b/src/webex/pages/refund.tsx index 3e82f3667..8164eb664 100644 --- a/src/webex/pages/refund.tsx +++ b/src/webex/pages/refund.tsx @@ -35,10 +35,12 @@ import { AmountDisplay } from "../renderHtml"; import * as wxApi from "../wxApi"; interface RefundStatusViewProps { - contractTermsHash: string; + contractTermsHash?: string; + refundUrl?: string; } interface RefundStatusViewState { + contractTermsHash?: string; purchase?: dbTypes.PurchaseRecord; refundFees?: AmountJson; gotResult: boolean; @@ -102,13 +104,22 @@ class RefundStatusView extends React.Component + Error: Neither contract terms hash nor refund url given. + + ); + } const purchase = this.state.purchase; if (!purchase) { + let message; if (this.state.gotResult) { - return No purchase with contract terms hash {this.props.contractTermsHash} found; + message = No purchase with contract terms hash {this.props.contractTermsHash} found; } else { - return ...; + message = ...; } + return
{message}
; } const merchantName = purchase.contractTerms.merchant.name || "(unknown)"; const summary = purchase.contractTerms.summary || purchase.contractTerms.order_id; @@ -128,7 +139,16 @@ class RefundStatusView extends React.Component purchase.refundsDone[x]); const refundFees = await wxApi.getFullRefundFees( {refundPermissions: refundsDone }); @@ -147,8 +167,9 @@ async function main() { return; } - const contractTermsHash = query.contractTermsHash || "(none)"; - ReactDOM.render(, container); + const contractTermsHash = query.contractTermsHash; + const refundUrl = query.refundUrl; + ReactDOM.render(, container); } document.addEventListener("DOMContentLoaded", () => main()); -- cgit v1.2.3