{this.props.data.is_maker ? t("Your maker bond was unlocked") : t("Your taker bond was unlocked")}
);
}
showEscrowQRInvoice=()=>{
const { t } = this.props;
return (
{/* Make confirmation sound for HTLC received. */}
{this.Sound("locked-invoice")}
{t("Lock {{amountSats}} Sats as collateral", {amountSats:pn(this.props.data.escrow_satoshis)})}
{" " + this.stepXofY()}
{t("You risk losing your bond if you do not lock the collateral. Total time available is {{deposit_timer_hours}}h {{deposit_timer_minutes}}m.", this.depositHoursMinutes() )}
{this.showBondIsLocked()}
);
}
showTakerFound=()=>{
const { t } = this.props;
return (
{/* Make bell sound when taker is found */}
{this.Sound("taker-found")}
{t("A taker has been found!")} {" " + this.stepXofY()}
{t("Please wait for the taker to lock a bond. If the taker does not lock a bond in time, the order will be made public again.")}
{this.showBondIsLocked()}
);
}
handleClickOpenTelegramDialog = () => {
this.setState({openEnableTelegram: true});
};
handleClickCloseEnableTelegramDialog = () => {
this.setState({openEnableTelegram: false});
};
handleClickEnableTelegram = () =>{
window.open("https://t.me/"+this.props.data.tg_bot_name+'?start='+this.props.data.tg_token, '_blank').focus()
this.handleClickCloseEnableTelegramDialog();
};
EnableTelegramDialog =() =>{
const { t } = this.props;
return(
)
}
depositHoursMinutes=()=>{
var hours = parseInt(this.props.data.escrow_duration/3600);
var minutes = parseInt((this.props.data.escrow_duration-hours*3600)/60);
var dict = {deposit_timer_hours:hours, deposit_timer_minutes:minutes}
return dict
}
handleClickPauseOrder=()=>{
this.props.completeSetState({pauseLoading:true})
const requestOptions = {
method: 'POST',
headers: {'Content-Type':'application/json', 'X-CSRFToken': getCookie('csrftoken'),},
body: JSON.stringify({
'action': "pause",
}),
};
fetch('/api/order/' + '?order_id=' + this.props.data.id, requestOptions)
.then((response) => response.json())
.then((data) => (this.props.getOrderDetails(data.id)));
}
showMakerWait=()=>{
const { t } = this.props;
return (
{/* Make confirmation sound for HTLC received. */}
{this.Sound("locked-invoice")}
{this.EnableTelegramDialog()}
{t("Your order is public")} {" " + this.stepXofY()}
{t("Be patient while robots check the book. This box will ring 🔊 once a robot takes your order, then you will have {{deposit_timer_hours}}h {{deposit_timer_minutes}}m to reply. If you do not reply, you risk losing your bond.", this.depositHoursMinutes() )}
{t("If the order expires untaken, your bond will return to you (no action needed).")}
{this.props.data.tg_enabled ?
{t("Telegram enabled")}
:
}
{this.props.pauseLoading ?
:
}
{this.showBondIsLocked()}
)
}
showPausedOrder=()=>{
const { t } = this.props;
return (
{t("Your order is paused")} {" " + this.stepXofY()}
{t("Your public order has been paused. At the moment it cannot be seen or taken by other robots. You can choose to unpause it at any time.")}
{this.props.pauseLoading ?
:
}
{this.showBondIsLocked()}
)
}
handleInputInvoiceChanged=(e)=>{
this.setState({
invoice: e.target.value,
badInvoice: false,
});
}
handleClickSubmitInvoiceButton=()=>{
this.setState({badInvoice:false});
const requestOptions = {
method: 'POST',
headers: {'Content-Type':'application/json', 'X-CSRFToken': getCookie('csrftoken'),},
body: JSON.stringify({
'action':'update_invoice',
'invoice': this.state.invoice,
}),
};
fetch('/api/order/' + '?order_id=' + this.props.data.id, requestOptions)
.then((response) => response.json())
.then((data) => this.setState({badInvoice:data.bad_invoice})
& this.props.completeSetState(data));
}
handleInputDisputeChanged=(e)=>{
this.setState({
statement: e.target.value,
badStatement: false,
});
}
handleClickSubmitStatementButton=()=>{
this.setState({badInvoice:false});
const requestOptions = {
method: 'POST',
headers: {'Content-Type':'application/json', 'X-CSRFToken': getCookie('csrftoken'),},
body: JSON.stringify({
'action':'submit_statement',
'statement': this.state.statement,
}),
};
fetch('/api/order/' + '?order_id=' + this.props.data.id, requestOptions)
.then((response) => response.json())
.then((data) => this.setState({badStatement:data.bad_statement})
& this.props.completeSetState(data));
}
handleScan = data => {
if (data) {
this.setState({
invoice: data
})
}
}
handleError = err => {
console.error(err)
}
handleQRbutton = () => {
this.setState({qrscanner: !this.state.qrscanner});
}
compatibleWalletsButton = () =>{
const { t } = this.props;
return(
)
}
showInputInvoice(){
const { t } = this.props;
return (
{/* Make confirmation sound for HTLC received. */}
{this.Sound("locked-invoice")}
{t("Submit an invoice for {{amountSats}} Sats",{amountSats: pn(this.props.data.invoice_amount)})}
{" " + this.stepXofY()}
{t("The taker is committed! Before letting you send {{amountFiat}} {{currencyCode}}, we want to make sure you are able to receive the BTC. Please provide a valid invoice for {{amountSats}} Satoshis.",
{amountFiat: parseFloat(parseFloat(this.props.data.amount).toFixed(4)),
currencyCode: this.props.data.currencyCode,
amountSats: pn(this.props.data.invoice_amount)}
)
}
{this.compatibleWalletsButton()}
{this.state.qrscanner ?
: null }
{this.showBondIsLocked()}
)
}
// Asks the user for a dispute statement.
showInDisputeStatement=()=>{
const { t } = this.props;
if(this.props.data.statement_submitted){
return (
{t("We have received your statement")}
{t("We are waiting for your trade counterpart statement. If you are hesitant about the state of the dispute or want to add more information, contact robosats@protonmail.com.")}
{t("Please, save the information needed to identify your order and your payments: order ID; payment hashes of the bonds or escrow (check on your lightning wallet); exact amount of satoshis; and robot nickname. You will have to identify yourself as the user involved in this trade via email (or other contact methods).")}
{this.showBondIsSettled()}
)
}else{
return (
// TODO Option to upload files
{t("A dispute has been opened")}
{t("Please, submit your statement. Be clear and specific about what happened and provide the necessary evidence. You MUST provide a contact method: burner email, XMPP or telegram username to follow up with the staff. Disputes are solved at the discretion of real robots (aka humans), so be as helpful as possible to ensure a fair outcome. Max 5000 chars.")}
{this.showBondIsSettled()}
)}
}
showWaitForDisputeResolution=()=>{
const { t } = this.props;
return (
{t("We have the statements")}
{t("Both statements have been received, wait for the staff to resolve the dispute. If you are hesitant about the state of the dispute or want to add more information, contact robosats@protonmail.com. If you did not provide a contact method, or are unsure whether you wrote it right, write us immediately.")}
{t("Please, save the information needed to identify your order and your payments: order ID; payment hashes of the bonds or escrow (check on your lightning wallet); exact amount of satoshis; and robot nickname. You will have to identify yourself as the user involved in this trade via email (or other contact methods).")}
{this.showBondIsSettled()}
)
}
showDisputeWinner=()=>{
const { t } = this.props;
return (
{t("You have won the dispute")}
{t("You can claim the dispute resolution amount (escrow and fidelity bond) from your profile rewards. If there is anything the staff can help with, do not hesitate to contact to robosats@protonmail.com (or via your provided burner contact method).")}
{this.showBondIsSettled()}
)
}
showDisputeLoser=()=>{
const { t } = this.props;
return (
{t("You have lost the dispute")}
{t("Unfortunately you have lost the dispute. If you think this is a mistake you can ask to re-open the case via email to robosats@protonmail.com. However, chances of it being investigated again are low.")}
{this.showBondIsSettled()}
)
}
showWaitingForEscrow(){
const { t } = this.props;
return(
{t("Your invoice looks good!")} {" " + this.stepXofY()}
{t("We are waiting for the seller to lock the trade amount.")}
{t("Just hang on for a moment. If the seller does not deposit, you will get your bond back automatically. In addition, you will receive a compensation (check the rewards in your profile).")}
{this.showBondIsLocked()}
)
}
showWaitingForBuyerInvoice(){
const { t } = this.props;
return(
{/* Make confirmation sound for HTLC received. */}
{this.Sound("locked-invoice")}
{t("The trade collateral is locked!")} {" " + this.stepXofY()}
{t("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.")}
{t("Just hang on for a moment. If the buyer does not cooperate, you will get back the trade collateral and your bond automatically. In addition, you will receive a compensation (check the rewards in your profile).")}
{this.showBondIsLocked()}
)
}
handleClickConfirmButton=()=>{
const requestOptions = {
method: 'POST',
headers: {'Content-Type':'application/json', 'X-CSRFToken': getCookie('csrftoken'),},
body: JSON.stringify({
'action': "confirm",
}),
};
fetch('/api/order/' + '?order_id=' + this.props.data.id, requestOptions)
.then((response) => response.json())
.then((data) => this.props.completeSetState(data));
}
handleRatingUserChange=(e)=>{
const requestOptions = {
method: 'POST',
headers: {'Content-Type':'application/json', 'X-CSRFToken': getCookie('csrftoken'),},
body: JSON.stringify({
'action': "rate_user",
'rating': e.target.value,
}),
};
fetch('/api/order/' + '?order_id=' + this.props.data.id, requestOptions)
.then((response) => response.json())
.then((data) => this.props.completeSetState(data));
}
handleRatingRobosatsChange=(e)=>{
if (this.state.rating_platform != null){
return null
}
this.setState({rating_platform:e.target.value});
const requestOptions = {
method: 'POST',
headers: {'Content-Type':'application/json', 'X-CSRFToken': getCookie('csrftoken'),},
body: JSON.stringify({
'action': "rate_platform",
'rating': e.target.value,
}),
};
fetch('/api/order/' + '?order_id=' + this.props.data.id, requestOptions)
.then((response) => response.json())
.then((data) => this.props.completeSetState(data));
}
showFiatSentButton(){
const { t } = this.props;
return(
)
}
showFiatReceivedButton(){
const { t } = this.props;
return(
)
}
showOpenDisputeButton(){
const { t } = this.props;
return(
)
}
handleRenewOrderButtonPressed=()=>{
this.setState({renewLoading:true})
const requestOptions = {
method: 'POST',
headers: {'Content-Type':'application/json', 'X-CSRFToken': getCookie('csrftoken')},
body: JSON.stringify({
type: this.props.data.type,
currency: this.props.data.currency,
amount: this.props.data.has_range ? null : this.props.data.amount,
has_range: this.props.data.has_range,
min_amount: this.props.data.min_amount,
max_amount: this.props.data.max_amount,
payment_method: this.props.data.payment_method,
is_explicit: this.props.data.is_explicit,
premium: this.props.data.is_explicit ? null: this.props.data.premium,
satoshis: this.props.data.is_explicit ? this.props.data.satoshis: null,
public_duration: this.props.data.public_duration,
escrow_duration: this.props.data.escrow_duration,
bond_size: this.props.data.bond_size,
bondless_taker: this.props.data.bondless_taker,
}),
};
fetch("/api/make/",requestOptions)
.then((response) => response.json())
.then((data) => (this.setState({badRequest:data.bad_request})
& (data.id ? this.props.push('/order/' + data.id)
& this.props.getOrderDetails(data.id)
:"")
));
}
showOrderExpired=()=>{
const { t } = this.props;
var show_renew = this.props.data.is_maker;
return(
{t("The order has expired")}
{t(this.props.data.expiry_message)}
{show_renew ?
{this.state.renewLoading ?
:
}
: null}
)
}
showChat=()=>{
const { t } = this.props;
//In Chatroom - No fiat sent - showChat(showSendButton, showReveiceButton, showDisputeButton)
if(this.props.data.is_buyer & this.props.data.status == 9){
var showSendButton=true;
var showReveiceButton=false;
var showDisputeButton=true;
}
if(this.props.data.is_seller & this.props.data.status == 9){
var showSendButton=false;
var showReveiceButton=false;
var showDisputeButton=true;
}
//In Chatroom - Fiat sent - showChat(showSendButton, showReveiceButton, showDisputeButton)
if(this.props.data.is_buyer & this.props.data.status == 10){
var showSendButton=false;
var showReveiceButton=false;
var showDisputeButton=true;
}
if(this.props.data.is_seller & this.props.data.status == 10){
var showSendButton=false;
var showReveiceButton=true;
var showDisputeButton=true;
}
return(
{/* Make confirmation sound for Chat Open. */}
{this.Sound("chat-open")}
{this.props.data.is_seller ? t("Chat with the buyer"): t("Chat with the seller")} {" " + this.stepXofY()}
{this.props.data.is_seller ?
{this.props.data.status == 9?
t("Say hi! Be helpful and concise. Let them know how to send you {{currencyCode}}.",{currencyCode: this.props.data.currencyCode})
:
t("The buyer has sent the fiat. Click 'Confirm Received' once you receive it.")
}
:
{this.props.data.status == 9?
t("Say hi! Ask for payment details and click 'Confirm Sent' as soon as the payment is sent.")
:
t("Wait for the seller to confirm he has received the payment.")
}
}
{showDisputeButton ? this.showOpenDisputeButton() : ""}
{showSendButton ? this.showFiatSentButton() : ""}
{showReveiceButton ? this.showFiatReceivedButton() : ""}
{this.showBondIsLocked()}
)
}
showRateSelect(){
const { t } = this.props;
var show_renew = this.props.data.is_maker;
return(
{/* Make confirmation sound for Chat Open. */}
{this.Sound("successful")}
{t("🎉Trade finished!🥳")}
{/*
What do you think of ⚡{this.props.data.is_maker ? this.props.data.taker_nick : this.props.data.maker_nick}⚡?
*/}
What do you think of 🤖RoboSats⚡?
{this.state.rating_platform==5 ?
{t("Thank you! RoboSats loves you too ❤️")}
{t("RoboSats gets better with more liquidity and users. Tell a bitcoiner friend about Robosats!")}