This commit is contained in:
Reckless_Satoshi 2022-01-09 07:28:12 -08:00
parent 5dcb249bb3
commit 48862a7677
No known key found for this signature in database
GPG Key ID: 9C4585B561315571
2 changed files with 67 additions and 16 deletions

View File

@ -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=()=>{

View File

@ -105,7 +105,7 @@ export default class TradeBox extends Component {
</Grid>
<Divider/>
<Grid item xs={12} align="center">
<Typography component="body2" variant="body">
<Typography component="body2" variant="body2">
Please wait for the taker to confirm his commitment by locking a bond.
</Typography>
</Grid>
@ -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(
<Grid container spacing={1}>
<Grid item xs={12} align="center">
<Typography component="subtitle1" variant="subtitle1">
<b>Your invoice looks good!</b>
</Typography>
</Grid>
<Grid item xs={12} align="center">
<Typography component="body2" variant="body2" align="left">
<p>We are waiting for the seller to deposit the full trade BTC amount
into the escrow.</p>
<p> Just hang on for a moment. If the seller does not deposit,
you will get your bond back automatically.</p>
</Typography>
</Grid>
</Grid>
)
}
// showWaitingForBuyerInvoice({
// })
showWaitingForBuyerInvoice(){
// showFiatSentButton(){
return(
<Grid container spacing={1}>
<Grid item xs={12} align="center">
<Typography component="subtitle1" variant="subtitle1">
<b>The trade collateral is locked! :D </b>
</Typography>
</Grid>
<Grid item xs={12} align="center">
<Typography component="body2" variant="body2" align="left">
<p> 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. </p>
<p> Just hang on for a moment. If the buyer does not cooperate,
you will get back the trade collateral and your bond automatically.</p>
</Typography>
</Grid>
</Grid>
)
}
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(
<Grid container spacing={1}>
<Grid item xs={12} align="center">
<Button variant='contained' color='primary' onClick={this.handleClickFiatConfirmButton}>Confirm {this.props.data.currencyCode} was sent. </Button>
</Grid>
</Grid>
)
}
// }
// showFiatReceivedButton(){
// }