def place_order(self, shop_id, user): orderer = create_orderer(user) payment_method = PaymentMethod.bank_transfer cart = Cart() order = order_service.place_order(shop_id, orderer, payment_method, cart) return order.id
def test_get_orders_placed_by_user_for_party(self): orderer1 = create_orderer(self.user1) orderer2 = create_orderer(self.user2) order1 = self.place_order(self.shop1_id, orderer1) order2 = self.place_order(self.shop1_id, orderer2) # different user order3 = self.place_order(self.shop1_id, orderer1) order4 = self.place_order(self.shop1_id, orderer1) order5 = self.place_order(self.shop2_id, orderer1) # different shop orders_orderer1_shop1 = self.get_orders_by_user(orderer1, self.shop1_id) assert orders_orderer1_shop1 == [order4, order3, order1] orders_orderer2_shop1 = self.get_orders_by_user(orderer2, self.shop1_id) assert orders_orderer2_shop1 == [order2] orders_orderer1_shop2 = self.get_orders_by_user(orderer1, self.shop2_id) assert orders_orderer1_shop2 == [order5]
def place_order(self, articles_with_quantity): orderer = create_orderer(self.buyer) cart = Cart() for article, quantity in articles_with_quantity: cart.add_item(article, quantity) return order_service.place_order(self.shop.id, orderer, ANY_PAYMENT_METHOD, cart)
def place_order(self, quantified_articles): orderer = create_orderer(self.orderer) payment_method = PaymentMethod.bank_transfer cart = Cart() for article, quantity_to_order in quantified_articles: cart.add_item(article, quantity_to_order) return order_service.place_order(self.shop.id, orderer, payment_method, cart)
def setUp(self): super().setUp() user = create_user_with_detail() self.orderer = create_orderer(user) create_email_config() self.shop = self.create_shop() self.create_order_number_sequence(self.shop.id, 'LF-01-B') self.article1 = self.create_article(1, Decimal('49.95')) self.article2 = self.create_article(2, Decimal('6.20')) self.article3 = self.create_article(3, Decimal('12.53'))
def setUp(self): super().setUp() user = create_user_with_detail() self.orderer = create_orderer(user) create_email_config() self.shop = self.create_shop() brand = create_brand() party = create_party(brand.id) self.create_order_number_sequence(self.shop.id, 'ABC-01-B') self.article = self.create_article(self.shop.id, quantity=100)
def place_order_with_items(self, shop_id, orderer, created_at, items_with_quantity): orderer = create_orderer(orderer) payment_method = PaymentMethod.bank_transfer cart = Cart() if items_with_quantity is not None: for article, quantity in items_with_quantity: cart.add_item(article, quantity) order, _ = order_service.place_order(self.shop.id, orderer, payment_method, cart) if created_at is not None: db_order = Order.query.get(order.id) db_order.created_at = created_at self.db.session.commit() return order.id