Completed
Push — main ( cd54d0...3ec8de )
by Jochen
03:28
created

mark_order_as_paid()   A

Complexity

Conditions 1

Size

Total Lines 3
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nop 2
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
"""
2
:Copyright: 2006-2020 Jochen Kupperschmidt
3
:License: Modified BSD, see LICENSE for details.
4
"""
5
6
from byceps.services.shop.cart.models import Cart
7
from byceps.services.shop.order.transfer.models import PaymentMethod
8
from byceps.services.shop.order import service as order_service
9
from byceps.services.ticketing import ticket_service
10
11
12
def get_tickets_for_order(order):
13
    return ticket_service.find_tickets_created_by_order(order.order_number)
14
15
16
def place_order(storefront_id, orderer, articles_with_quantity):
17
    cart = Cart()
18
    for article, quantity in articles_with_quantity:
19
        cart.add_item(article, quantity)
20
21
    order, _ = order_service.place_order(storefront_id, orderer, cart)
22
23
    return order
24
25
26
def mark_order_as_paid(order_id, admin_id):
27
    order_service.mark_order_as_paid(
28
        order_id, PaymentMethod.bank_transfer, admin_id
29
    )
30