diff options
author | Florian Dold <florian.dold@gmail.com> | 2018-01-18 01:37:30 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2018-01-18 01:37:30 +0100 |
commit | 82d9c2a7cd2e343866997438d44aa5422190a028 (patch) | |
tree | 3feef2e8b7db1680e42818419195c95946751783 /src/webex/pages/confirm-contract.tsx | |
parent | d4c2f6f6f992c36609c4a029afcb378a7f839ddf (diff) | |
download | wallet-core-82d9c2a7cd2e343866997438d44aa5422190a028.tar.xz |
access refunds correctly
Diffstat (limited to 'src/webex/pages/confirm-contract.tsx')
-rw-r--r-- | src/webex/pages/confirm-contract.tsx | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/webex/pages/confirm-contract.tsx b/src/webex/pages/confirm-contract.tsx index 090737475..c302239c6 100644 --- a/src/webex/pages/confirm-contract.tsx +++ b/src/webex/pages/confirm-contract.tsx @@ -105,6 +105,7 @@ interface ContractPromptProps { proposalId?: number; contractUrl?: string; sessionId?: string; + resourceUrl?: string; } interface ContractPromptState { @@ -146,6 +147,18 @@ class ContractPrompt extends React.Component<ContractPromptProps, ContractPrompt } async update() { + if (this.props.resourceUrl) { + const p = await wxApi.queryPaymentByFulfillmentUrl(this.props.resourceUrl); + console.log("query for resource url", this.props.resourceUrl, "result", p); + if (p.found) { + const nextUrl = new URI(p.contractTerms.fulfillment_url); + nextUrl.addSearch("order_id", p.contractTerms.order_id); + if (p.lastSessionSig) { + nextUrl.addSearch("session_sig", p.lastSessionSig); + } + location.href = nextUrl.href(); + } + } let proposalId = this.props.proposalId; if (proposalId === undefined) { if (this.props.contractUrl === undefined) { @@ -285,7 +298,9 @@ document.addEventListener("DOMContentLoaded", () => { const sessionId = query.sessionId; const contractUrl = query.contractUrl; + const resourceUrl = query.resourceUrl; + ReactDOM.render( - <ContractPrompt {...{ proposalId, contractUrl, sessionId }}/>, + <ContractPrompt {...{ proposalId, contractUrl, sessionId, resourceUrl }}/>, document.getElementById("contract")!); }); |