mirror of
https://github.com/RoboSats/robosats.git
synced 2025-01-18 12:11:35 +00:00
fix(coordinator): cannot update_or_create with relate named on django v5 (#1263)
* Fix for django v5 * Fix re-submit invoice
This commit is contained in:
parent
c5380664b0
commit
3143144315
@ -893,7 +893,7 @@ class Logics:
|
||||
if order.status == Order.Status.FAI:
|
||||
if order.payout.status != LNPayment.Status.EXPIRE:
|
||||
return False, {
|
||||
"bad_request": "You can only submit an invoice after expiration or 3 failed attempts"
|
||||
"bad_invoice": "You can only submit an invoice after expiration or 3 failed attempts"
|
||||
}
|
||||
|
||||
# cancel onchain_payout if existing
|
||||
@ -909,25 +909,24 @@ class Logics:
|
||||
if not payout["valid"]:
|
||||
return False, payout["context"]
|
||||
|
||||
order.payout, _ = LNPayment.objects.update_or_create(
|
||||
if order.payout:
|
||||
if order.payout.payment_hash == payout["payment_hash"]:
|
||||
return False, {"bad_invoice": "You must submit a NEW invoice"}
|
||||
|
||||
order.payout = LNPayment.objects.create(
|
||||
concept=LNPayment.Concepts.PAYBUYER,
|
||||
type=LNPayment.Types.NORM,
|
||||
sender=User.objects.get(username=ESCROW_USERNAME),
|
||||
# In case this user has other payouts, update the one related to this order.
|
||||
order_paid_LN=order,
|
||||
receiver=user,
|
||||
routing_budget_ppm=routing_budget_ppm,
|
||||
routing_budget_sats=routing_budget_sats,
|
||||
# if there is a LNPayment matching these above, it updates that one with defaults below.
|
||||
defaults={
|
||||
"invoice": invoice,
|
||||
"status": LNPayment.Status.VALIDI,
|
||||
"num_satoshis": num_satoshis,
|
||||
"description": payout["description"],
|
||||
"payment_hash": payout["payment_hash"],
|
||||
"created_at": payout["created_at"],
|
||||
"expires_at": payout["expires_at"],
|
||||
},
|
||||
invoice=invoice,
|
||||
status=LNPayment.Status.VALIDI,
|
||||
num_satoshis=num_satoshis,
|
||||
description=payout["description"],
|
||||
payment_hash=payout["payment_hash"],
|
||||
created_at=payout["created_at"],
|
||||
expires_at=payout["expires_at"],
|
||||
)
|
||||
|
||||
order.is_swap = False
|
||||
|
@ -1,4 +1,4 @@
|
||||
django==4.2.11
|
||||
django==5.0.4
|
||||
django-admin-relation-links==0.2.5
|
||||
django-celery-beat==2.6.0
|
||||
django-celery-results==2.5.1
|
||||
@ -16,7 +16,7 @@ Pillow==10.1.0
|
||||
python-decouple==3.8
|
||||
requests==2.31.0
|
||||
ring==0.10.1
|
||||
git+https://github.com/RoboSats/Robohash.git
|
||||
git+https://github.com/RoboSats/Robohash.git@master
|
||||
gunicorn==22.0.0
|
||||
psycopg2==2.9.9
|
||||
SQLAlchemy==2.0.16
|
||||
|
@ -1,4 +1,4 @@
|
||||
coverage==7.5.0
|
||||
ruff==0.4.2
|
||||
drf-openapi-tester @ git+https://github.com/Reckless-Satoshi/drf-openapi-tester.git@soften-django-requirements
|
||||
git+https://github.com/Reckless-Satoshi/drf-openapi-tester.git@soften-django-requirements
|
||||
pre-commit==3.7.0
|
Loading…
Reference in New Issue
Block a user