-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlambda.py
More file actions
31 lines (22 loc) · 835 Bytes
/
lambda.py
File metadata and controls
31 lines (22 loc) · 835 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import json
import pizzapi
from pizzapi import Customer, Address, Order, PaymentObject
def lambda_handler(event, context):
order_pizza()
return {
"statusCode": 200,
"body": json.dumps('Success')
}
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"