def order(self): """Create the order object.""" from pizzapi import Order order = Order(self.dominos.closest_store, self.dominos.customer, self.dominos.address, self.dominos.country) for code in self._product_codes: order.add_item(code) return order
def order(self): """Create the order object.""" if self.dominos.closest_store is None: raise StoreException order = Order( self.dominos.closest_store, self.dominos.customer, self.dominos.address, self.dominos.country, ) for code in self._product_codes: order.add_item(code) return order
def order(self): """Create the order object.""" from pizzapi import Order from pizzapi.address import StoreException if self.dominos.closest_store is None: raise StoreException order = Order( self.dominos.closest_store, self.dominos.customer, self.dominos.address, self.dominos.country) for code in self._product_codes: order.add_item(code) return order
def orderPizza(): print "starting to order the pizza" file = open("info.json").read() values = json.loads(file) customer = Customer(values["first_name"], values["last_name"], values["email"], values["phone_number"], values["address"]) address = Address(*customer.address.split(',')) store = address.closest_store() print "ordering from store" + str(store.get_details()) order = Order(store, customer, address) order.add_item(values["pizza_code"]) card = PaymentObject(values["cc_number"], values["cc_expiration"], values["cc_security"], values["cc_zip"]) order.pay_with() print "congrats! order was succesful"
def getOrder(store, customer, address): inp = '' order = Order(store, customer, address) menu = order.menu while inp != 'checkout': inp = input(': ') tokens = inp.split(' ') inp = tokens[0].lower() command = tokens[0] if (command == 'add'): if (len(tokens) < 2): print("Please specify item code.") continue added = addItem(order, tokens, menu) if not added: print("Failed to add item to order.") else: print("Item added to order.") elif (command == 'remove'): if (len(tokens) < 2): print("Please specify item code.") continue removed = removeItem(order, tokens) if not removed: print("Failed to remove item from basket.") else: print("Item successfully removed") elif (command == 'basket'): getBasket(order) elif (command == 'menu'): varis = menu.variants.values() for v in varis: c = v['Code'] n = v['Name'] p = v['Price'] print(c + "\t\t\t" + n + "\t\t\t$" + p) elif (command == 'cancel'): return False elif (command == 'search'): search_menu(order, tokens, menu) else: print("Invalid command.") return order