diff --git a/frontend/src/components/OrderPage.js b/frontend/src/components/OrderPage.js index 6bed6553..37f5e04b 100644 --- a/frontend/src/components/OrderPage.js +++ b/frontend/src/components/OrderPage.js @@ -108,7 +108,6 @@ export default class OrderPage extends Component { escrowInvoice: data.escrow_invoice, escrowSatoshis: data.escrow_satoshis, invoiceAmount: data.invoice_amount, - badRequest: data.bad_request, }); }); } @@ -133,12 +132,6 @@ export default class OrderPage extends Component { this.setState({ delay: Number(e.target.value) }); } - // Gets currency code (3 letters) from numeric (e.g., 1 -> USD) - // Improve this function so currencies are read from json - getCurrencyCode(val){ - return (val == 1 ) ? "USD": ((val == 2 ) ? "EUR":"ETH") - } - // Fix to use proper react props handleClickBackButton=()=>{ window.history.back(); @@ -169,9 +162,8 @@ export default class OrderPage extends Component { // Gets currency code (3 letters) from numeric (e.g., 1 -> USD) // Improve this function so currencies are read from json getCurrencyCode(val){ - console.log("---------------------------------") - console.log(val) - return this.state.currencies_dict[val.toString()] + let code = val ? this.state.currencies_dict[val.toString()] : "" + return code } handleClickCancelOrderButton=()=>{ diff --git a/frontend/src/components/TradeBox.js b/frontend/src/components/TradeBox.js index 7691d8ee..397c5aa4 100644 --- a/frontend/src/components/TradeBox.js +++ b/frontend/src/components/TradeBox.js @@ -105,7 +105,7 @@ export default class TradeBox extends Component { - + Please wait for the taker to confirm his commitment by locking a bond. @@ -162,8 +162,9 @@ export default class TradeBox extends Component { }); } + // Fix this, clunky because it takes time. this.props.data does not refresh until next refresh of OrderPage. + handleClickSubmitInvoiceButton=()=>{ - console.log(this.state) const requestOptions = { method: 'POST', headers: {'Content-Type':'application/json', 'X-CSRFToken': getCookie('csrftoken'),}, @@ -215,14 +216,72 @@ export default class TradeBox extends Component { showWaitingForEscrow(){ + return( + + + + Your invoice looks good! + + + + +

We are waiting for the seller to deposit the full trade BTC amount + into the escrow.

+

Just hang on for a moment. If the seller does not deposit, + you will get your bond back automatically.

+
+
+
+ ) } - // showWaitingForBuyerInvoice({ - // }) + showWaitingForBuyerInvoice(){ - // showFiatSentButton(){ + return( + + + + The trade collateral is locked! :D + + + + +

We are waiting for the buyer to post a lightning invoice. Once + he does, you will be able to directly communicate the fiat payment + details.

+

Just hang on for a moment. If the buyer does not cooperate, + you will get back the trade collateral and your bond automatically.

+
+
+
+ ) + } + + handleClickFiatConfirmButton=()=>{ + const requestOptions = { + method: 'POST', + headers: {'Content-Type':'application/json', 'X-CSRFToken': getCookie('csrftoken'),}, + body: JSON.stringify({ + 'action':'confirm', + 'invoice': this.state.invoice, + }), + }; + fetch('/api/order/' + '?order_id=' + this.props.data.id, requestOptions) + .then((response) => response.json()) + .then((data) => (this.props.data = data)); +} + + + showFiatSentButton(){ + return( + + + + + + ) + } - // } // showFiatReceivedButton(){ // }