mirror of
https://github.com/pretix/pretix.git
synced 2026-05-08 15:44:02 +00:00
Avoid creation of manual payments with zero amount (#2325)
This commit is contained in:
@@ -577,16 +577,22 @@ class OrderPayChangeMethod(EventViewMixin, OrderDetailMixin, TemplateView):
|
||||
|
||||
@transaction.atomic()
|
||||
def mark_paid_free(self):
|
||||
p = self.order.payments.create(
|
||||
state=OrderPayment.PAYMENT_STATE_CREATED,
|
||||
provider='manual',
|
||||
amount=Decimal('0.00'),
|
||||
fee=None
|
||||
)
|
||||
try:
|
||||
p.confirm()
|
||||
except SendMailException:
|
||||
pass
|
||||
p = self.order.payments.filter(state=OrderPayment.PAYMENT_STATE_CONFIRMED).last()
|
||||
if not p:
|
||||
p = self.order.payments.create(
|
||||
state=OrderPayment.PAYMENT_STATE_CREATED,
|
||||
provider='free',
|
||||
amount=Decimal('0.00'),
|
||||
fee=None
|
||||
)
|
||||
try:
|
||||
p.confirm()
|
||||
except SendMailException:
|
||||
pass
|
||||
else:
|
||||
p._mark_order_paid(
|
||||
payment_refund_sum=self.order.payment_refund_sum
|
||||
)
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
if self.order.pending_sum <= Decimal('0.00'):
|
||||
|
||||
Reference in New Issue
Block a user