-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrequestrespone.py
52 lines (36 loc) · 1.35 KB
/
requestrespone.py
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
from order import *
from voucher import *
class BillRequestObject:
def __init__(self,shipping_fee,vouchers,orders):
self.shipping_fee=shipping_fee
self.vouchers=vouchers
self.orders=orders
class BillRequest:
def __init__(self,json_request:str) -> None:
data=json_request['data']
shipping_fee=data['shipping']
list_vouchers=data['vouchers']
list_orders=data['orders']
self.shipping_fee=shipping_fee
self.orders=[]
self.vouchers=[]
for order_string in list_orders:
order=OrderParser(order_string).getDish()
self.orders.append(order)
for voucher_string in list_vouchers:
voucher=VoucherParser(voucher_string).getVoucer()
self.vouchers.append(voucher)
def getObject(self)->BillRequestObject:
return BillRequestObject(self.shipping_fee,self.vouchers,self.orders)
class BillResponeObject:
def __init__(self,voucher,orders):
self.voucher=voucher
self.orders=orders
class BillRespone(BaseEntity):
def __init__(self,bills,total,discounted,shiping):
self.bills=bills
self.total=total
self.discounted=discounted
self.shiping=shiping
def getJSONString(self):
return super().getJSONString()