mirror of
https://github.com/RoboSats/robosats.git
synced 2025-02-21 12:49:02 +00:00
Add TG messages for dispute open and collaborative cancellation
This commit is contained in:
parent
7623d30670
commit
8663fb3423
@ -458,6 +458,7 @@ class Logics:
|
|||||||
profile.orders_disputes_started).append(str(order.id))
|
profile.orders_disputes_started).append(str(order.id))
|
||||||
profile.save()
|
profile.save()
|
||||||
|
|
||||||
|
send_message.delay(order.id,'dispute_opened')
|
||||||
return True, None
|
return True, None
|
||||||
|
|
||||||
def dispute_statement(order, user, statement):
|
def dispute_statement(order, user, statement):
|
||||||
@ -790,6 +791,7 @@ class Logics:
|
|||||||
cls.return_escrow(order)
|
cls.return_escrow(order)
|
||||||
order.status = Order.Status.CCA
|
order.status = Order.Status.CCA
|
||||||
order.save()
|
order.save()
|
||||||
|
send_message.delay(order.id,'collaborative_cancelled')
|
||||||
return
|
return
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -177,6 +177,34 @@ class Telegram():
|
|||||||
self.send_message(user, text)
|
self.send_message(user, text)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
def collaborative_cancelled(self, order):
|
||||||
|
user = order.maker
|
||||||
|
if not user.profile.telegram_enabled:
|
||||||
|
return
|
||||||
|
|
||||||
|
lang = user.profile.telegram_lang_code
|
||||||
|
if lang == 'es':
|
||||||
|
text = f'La orden con ID {str(order.id)} fue cancelada colaborativamente.'
|
||||||
|
else:
|
||||||
|
text = f'Your order with ID {str(order.id)} has been collaboratively cancelled.'
|
||||||
|
|
||||||
|
self.send_message(user, text)
|
||||||
|
return
|
||||||
|
|
||||||
|
def dispute_opened(self, order):
|
||||||
|
user = order.maker
|
||||||
|
if not user.profile.telegram_enabled:
|
||||||
|
return
|
||||||
|
|
||||||
|
lang = user.profile.telegram_lang_code
|
||||||
|
if lang == 'es':
|
||||||
|
text = f'La orden con ID {str(order.id)} ha entrado en disputa.'
|
||||||
|
else:
|
||||||
|
text = f'A dispute has been opened on your order with ID {str(order.id)}.'
|
||||||
|
|
||||||
|
self.send_message(user, text)
|
||||||
|
return
|
||||||
|
|
||||||
def order_published(self, order):
|
def order_published(self, order):
|
||||||
|
|
||||||
time.sleep(1) # Just so this message always arrives after the previous two
|
time.sleep(1) # Just so this message always arrives after the previous two
|
||||||
|
@ -276,4 +276,10 @@ def send_message(order_id, message):
|
|||||||
elif message == 'fiat_exchange_starts':
|
elif message == 'fiat_exchange_starts':
|
||||||
telegram.fiat_exchange_starts(order)
|
telegram.fiat_exchange_starts(order)
|
||||||
|
|
||||||
|
elif message == 'dispute_opened':
|
||||||
|
telegram.dispute_opened(order)
|
||||||
|
|
||||||
|
elif message == 'collaborative_cancelled':
|
||||||
|
telegram.collaborative_cancelled(order)
|
||||||
|
|
||||||
return
|
return
|
@ -1,15 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
rm db.sqlite3
|
|
||||||
|
|
||||||
rm -R api/migrations
|
|
||||||
rm -R frontend/migrations
|
|
||||||
rm -R frontend/static/assets/avatars
|
|
||||||
|
|
||||||
python3 manage.py makemigrations
|
|
||||||
python3 manage.py makemigrations api
|
|
||||||
|
|
||||||
python3 manage.py migrate
|
|
||||||
|
|
||||||
python3 manage.py createsuperuser
|
|
||||||
|
|
||||||
python3 manage.py runserver
|
|
@ -72,5 +72,5 @@ The hodl invoice shows as a grey icon while waiting. Need to tap the back obviou
|
|||||||
|
|
||||||
|
|
||||||
## <i class="fa-solid fa-code-pull-request"></i> Help keep this page updated
|
## <i class="fa-solid fa-code-pull-request"></i> Help keep this page updated
|
||||||
There are many wallets and all of them keep improving at lightning speed. You can contribute to the RoboSats Open Source Project by testing wallets, editing [the content of this page](https://github.com/Reckless-Satoshi/robosats/tree/main/docs/{page.src}}) and opening a [Pull Request](https://github.com/Reckless-Satoshi/robosats/pulls)
|
There are many wallets and all of them keep improving at lightning speed. You can contribute to the RoboSats Open Source Project by testing wallets, editing [the content of this page](https://github.com/Reckless-Satoshi/robosats/tree/main/docs/{{page.src}}) and opening a [Pull Request](https://github.com/Reckless-Satoshi/robosats/pulls)
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ class BottomBar extends Component {
|
|||||||
this.setState(null)
|
this.setState(null)
|
||||||
fetch('/api/info/')
|
fetch('/api/info/')
|
||||||
.then((response) => response.json())
|
.then((response) => response.json())
|
||||||
.then((data) => this.setState(data) & console.log(data)
|
.then((data) => this.setState(data)
|
||||||
& this.setState({active_order_id: data.active_order_id ? data.active_order_id : null,
|
& this.setState({active_order_id: data.active_order_id ? data.active_order_id : null,
|
||||||
last_order_id: data.last_order_id ? data.last_order_id : null})
|
last_order_id: data.last_order_id ? data.last_order_id : null})
|
||||||
& this.props.setAppState({nickname:data.nickname, loading:false}));
|
& this.props.setAppState({nickname:data.nickname, loading:false}));
|
||||||
@ -105,7 +105,7 @@ class BottomBar extends Component {
|
|||||||
};
|
};
|
||||||
fetch('/api/reward/', requestOptions)
|
fetch('/api/reward/', requestOptions)
|
||||||
.then((response) => response.json())
|
.then((response) => response.json())
|
||||||
.then((data) => console.log(data) & this.setState({
|
.then((data) => this.setState({
|
||||||
badInvoice:data.bad_invoice,
|
badInvoice:data.bad_invoice,
|
||||||
openClaimRewards: data.successful_withdrawal ? false : true,
|
openClaimRewards: data.successful_withdrawal ? false : true,
|
||||||
earned_rewards: data.successful_withdrawal ? 0 : this.state.earned_rewards,
|
earned_rewards: data.successful_withdrawal ? 0 : this.state.earned_rewards,
|
||||||
|
Loading…
Reference in New Issue
Block a user