From 8b2f53e3ed810a0539f76feb993f0044bc8c0f38 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Sun, 15 Oct 2017 19:28:35 +0200 Subject: fix tslint warnings --- src/webex/pages/refund.tsx | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) (limited to 'src/webex/pages/refund.tsx') diff --git a/src/webex/pages/refund.tsx b/src/webex/pages/refund.tsx index 73bed30ee..e76fdfff3 100644 --- a/src/webex/pages/refund.tsx +++ b/src/webex/pages/refund.tsx @@ -26,10 +26,10 @@ import * as React from "react"; import * as ReactDOM from "react-dom"; import URI = require("urijs"); -import * as wxApi from "../wxApi"; import * as types from "../../types"; import { AmountDisplay } from "../renderHtml"; +import * as wxApi from "../wxApi"; interface RefundStatusViewProps { contractTermsHash: string; @@ -41,25 +41,30 @@ interface RefundStatusViewState { gotResult: boolean; } +interface RefundDetailProps { + purchase: types.PurchaseRecord; + fullRefundFees: types.AmountJson; +} -const RefundDetail = ({purchase, fullRefundFees}: {purchase: types.PurchaseRecord, fullRefundFees: types.AmountJson}) => { +const RefundDetail = ({purchase, fullRefundFees}: RefundDetailProps) => { const pendingKeys = Object.keys(purchase.refundsPending); const doneKeys = Object.keys(purchase.refundsDone); - if (pendingKeys.length == 0 && doneKeys.length == 0) { + if (pendingKeys.length === 0 && doneKeys.length === 0) { return

No refunds

; } - const currency = { ...purchase.refundsDone, ...purchase.refundsPending }[([...pendingKeys, ...doneKeys][0])].refund_amount.currency; + const firstRefundKey = [...pendingKeys, ...doneKeys][0]; + const currency = { ...purchase.refundsDone, ...purchase.refundsPending }[firstRefundKey].refund_amount.currency; if (!currency) { throw Error("invariant"); } let amountPending = types.Amounts.getZero(currency); - for (let k of pendingKeys) { + for (const k of pendingKeys) { amountPending = types.Amounts.add(amountPending, purchase.refundsPending[k].refund_amount).amount; } let amountDone = types.Amounts.getZero(currency); - for (let k of doneKeys) { + for (const k of doneKeys) { amountDone = types.Amounts.add(amountDone, purchase.refundsDone[k].refund_amount).amount; } @@ -68,7 +73,9 @@ const RefundDetail = ({purchase, fullRefundFees}: {purchase: types.PurchaseRecor return (
{hasPending ?

Refund pending:

: null} -

Refund received: (refund fees: )

+

+ Refund received: (refund fees: ) +

); }; @@ -105,9 +112,14 @@ class RefundStatusView extends React.Component

Refund Status

-

Status of purchase {summary} from merchant {merchantName} (order id {purchase.contractTerms.order_id}).

+

+ Status of purchase {summary} from merchant {merchantName}{" "} + (order id {purchase.contractTerms.order_id}). +

Total amount:

- {purchase.finished ? :

Purchase not completed.

} + {purchase.finished + ? + :

Purchase not completed.

} ); } -- cgit v1.2.3