KoubeiCateringOrderSyncModel.py 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import json
  4. from alipay.aop.api.constant.ParamConstants import *
  5. from alipay.aop.api.domain.DiscountInfos import DiscountInfos
  6. from alipay.aop.api.domain.DishList import DishList
  7. from alipay.aop.api.domain.OtherAmountInfos import OtherAmountInfos
  8. from alipay.aop.api.domain.PaymentList import PaymentList
  9. from alipay.aop.api.domain.RefundList import RefundList
  10. class KoubeiCateringOrderSyncModel(object):
  11. def __init__(self):
  12. self._adjust_amount = None
  13. self._amount = None
  14. self._biz_product = None
  15. self._business_type = None
  16. self._dinner_type = None
  17. self._discount_amount = None
  18. self._discount_infos = None
  19. self._dish_amount = None
  20. self._dish_list = None
  21. self._ext_infos = None
  22. self._koubei_payment_amount = None
  23. self._offline_payment_amount = None
  24. self._order_id = None
  25. self._order_style = None
  26. self._order_time = None
  27. self._other_amount_discountable = None
  28. self._other_amount_infos = None
  29. self._other_amount_undiscountable = None
  30. self._out_biz_no = None
  31. self._partner_id = None
  32. self._pay_style = None
  33. self._payment_list = None
  34. self._people_num = None
  35. self._pos_version = None
  36. self._receivable_amount = None
  37. self._refund_list = None
  38. self._shop_id = None
  39. self._status = None
  40. self._table_no = None
  41. self._total_paymented_amount = None
  42. self._use_online_promotion_flag = None
  43. @property
  44. def adjust_amount(self):
  45. return self._adjust_amount
  46. @adjust_amount.setter
  47. def adjust_amount(self, value):
  48. self._adjust_amount = value
  49. @property
  50. def amount(self):
  51. return self._amount
  52. @amount.setter
  53. def amount(self, value):
  54. self._amount = value
  55. @property
  56. def biz_product(self):
  57. return self._biz_product
  58. @biz_product.setter
  59. def biz_product(self, value):
  60. self._biz_product = value
  61. @property
  62. def business_type(self):
  63. return self._business_type
  64. @business_type.setter
  65. def business_type(self, value):
  66. self._business_type = value
  67. @property
  68. def dinner_type(self):
  69. return self._dinner_type
  70. @dinner_type.setter
  71. def dinner_type(self, value):
  72. self._dinner_type = value
  73. @property
  74. def discount_amount(self):
  75. return self._discount_amount
  76. @discount_amount.setter
  77. def discount_amount(self, value):
  78. self._discount_amount = value
  79. @property
  80. def discount_infos(self):
  81. return self._discount_infos
  82. @discount_infos.setter
  83. def discount_infos(self, value):
  84. if isinstance(value, list):
  85. self._discount_infos = list()
  86. for i in value:
  87. if isinstance(i, DiscountInfos):
  88. self._discount_infos.append(i)
  89. else:
  90. self._discount_infos.append(DiscountInfos.from_alipay_dict(i))
  91. @property
  92. def dish_amount(self):
  93. return self._dish_amount
  94. @dish_amount.setter
  95. def dish_amount(self, value):
  96. self._dish_amount = value
  97. @property
  98. def dish_list(self):
  99. return self._dish_list
  100. @dish_list.setter
  101. def dish_list(self, value):
  102. if isinstance(value, list):
  103. self._dish_list = list()
  104. for i in value:
  105. if isinstance(i, DishList):
  106. self._dish_list.append(i)
  107. else:
  108. self._dish_list.append(DishList.from_alipay_dict(i))
  109. @property
  110. def ext_infos(self):
  111. return self._ext_infos
  112. @ext_infos.setter
  113. def ext_infos(self, value):
  114. self._ext_infos = value
  115. @property
  116. def koubei_payment_amount(self):
  117. return self._koubei_payment_amount
  118. @koubei_payment_amount.setter
  119. def koubei_payment_amount(self, value):
  120. self._koubei_payment_amount = value
  121. @property
  122. def offline_payment_amount(self):
  123. return self._offline_payment_amount
  124. @offline_payment_amount.setter
  125. def offline_payment_amount(self, value):
  126. self._offline_payment_amount = value
  127. @property
  128. def order_id(self):
  129. return self._order_id
  130. @order_id.setter
  131. def order_id(self, value):
  132. self._order_id = value
  133. @property
  134. def order_style(self):
  135. return self._order_style
  136. @order_style.setter
  137. def order_style(self, value):
  138. self._order_style = value
  139. @property
  140. def order_time(self):
  141. return self._order_time
  142. @order_time.setter
  143. def order_time(self, value):
  144. self._order_time = value
  145. @property
  146. def other_amount_discountable(self):
  147. return self._other_amount_discountable
  148. @other_amount_discountable.setter
  149. def other_amount_discountable(self, value):
  150. self._other_amount_discountable = value
  151. @property
  152. def other_amount_infos(self):
  153. return self._other_amount_infos
  154. @other_amount_infos.setter
  155. def other_amount_infos(self, value):
  156. if isinstance(value, list):
  157. self._other_amount_infos = list()
  158. for i in value:
  159. if isinstance(i, OtherAmountInfos):
  160. self._other_amount_infos.append(i)
  161. else:
  162. self._other_amount_infos.append(OtherAmountInfos.from_alipay_dict(i))
  163. @property
  164. def other_amount_undiscountable(self):
  165. return self._other_amount_undiscountable
  166. @other_amount_undiscountable.setter
  167. def other_amount_undiscountable(self, value):
  168. self._other_amount_undiscountable = value
  169. @property
  170. def out_biz_no(self):
  171. return self._out_biz_no
  172. @out_biz_no.setter
  173. def out_biz_no(self, value):
  174. self._out_biz_no = value
  175. @property
  176. def partner_id(self):
  177. return self._partner_id
  178. @partner_id.setter
  179. def partner_id(self, value):
  180. self._partner_id = value
  181. @property
  182. def pay_style(self):
  183. return self._pay_style
  184. @pay_style.setter
  185. def pay_style(self, value):
  186. self._pay_style = value
  187. @property
  188. def payment_list(self):
  189. return self._payment_list
  190. @payment_list.setter
  191. def payment_list(self, value):
  192. if isinstance(value, list):
  193. self._payment_list = list()
  194. for i in value:
  195. if isinstance(i, PaymentList):
  196. self._payment_list.append(i)
  197. else:
  198. self._payment_list.append(PaymentList.from_alipay_dict(i))
  199. @property
  200. def people_num(self):
  201. return self._people_num
  202. @people_num.setter
  203. def people_num(self, value):
  204. self._people_num = value
  205. @property
  206. def pos_version(self):
  207. return self._pos_version
  208. @pos_version.setter
  209. def pos_version(self, value):
  210. self._pos_version = value
  211. @property
  212. def receivable_amount(self):
  213. return self._receivable_amount
  214. @receivable_amount.setter
  215. def receivable_amount(self, value):
  216. self._receivable_amount = value
  217. @property
  218. def refund_list(self):
  219. return self._refund_list
  220. @refund_list.setter
  221. def refund_list(self, value):
  222. if isinstance(value, list):
  223. self._refund_list = list()
  224. for i in value:
  225. if isinstance(i, RefundList):
  226. self._refund_list.append(i)
  227. else:
  228. self._refund_list.append(RefundList.from_alipay_dict(i))
  229. @property
  230. def shop_id(self):
  231. return self._shop_id
  232. @shop_id.setter
  233. def shop_id(self, value):
  234. self._shop_id = value
  235. @property
  236. def status(self):
  237. return self._status
  238. @status.setter
  239. def status(self, value):
  240. self._status = value
  241. @property
  242. def table_no(self):
  243. return self._table_no
  244. @table_no.setter
  245. def table_no(self, value):
  246. self._table_no = value
  247. @property
  248. def total_paymented_amount(self):
  249. return self._total_paymented_amount
  250. @total_paymented_amount.setter
  251. def total_paymented_amount(self, value):
  252. self._total_paymented_amount = value
  253. @property
  254. def use_online_promotion_flag(self):
  255. return self._use_online_promotion_flag
  256. @use_online_promotion_flag.setter
  257. def use_online_promotion_flag(self, value):
  258. self._use_online_promotion_flag = value
  259. def to_alipay_dict(self):
  260. params = dict()
  261. if self.adjust_amount:
  262. if hasattr(self.adjust_amount, 'to_alipay_dict'):
  263. params['adjust_amount'] = self.adjust_amount.to_alipay_dict()
  264. else:
  265. params['adjust_amount'] = self.adjust_amount
  266. if self.amount:
  267. if hasattr(self.amount, 'to_alipay_dict'):
  268. params['amount'] = self.amount.to_alipay_dict()
  269. else:
  270. params['amount'] = self.amount
  271. if self.biz_product:
  272. if hasattr(self.biz_product, 'to_alipay_dict'):
  273. params['biz_product'] = self.biz_product.to_alipay_dict()
  274. else:
  275. params['biz_product'] = self.biz_product
  276. if self.business_type:
  277. if hasattr(self.business_type, 'to_alipay_dict'):
  278. params['business_type'] = self.business_type.to_alipay_dict()
  279. else:
  280. params['business_type'] = self.business_type
  281. if self.dinner_type:
  282. if hasattr(self.dinner_type, 'to_alipay_dict'):
  283. params['dinner_type'] = self.dinner_type.to_alipay_dict()
  284. else:
  285. params['dinner_type'] = self.dinner_type
  286. if self.discount_amount:
  287. if hasattr(self.discount_amount, 'to_alipay_dict'):
  288. params['discount_amount'] = self.discount_amount.to_alipay_dict()
  289. else:
  290. params['discount_amount'] = self.discount_amount
  291. if self.discount_infos:
  292. if isinstance(self.discount_infos, list):
  293. for i in range(0, len(self.discount_infos)):
  294. element = self.discount_infos[i]
  295. if hasattr(element, 'to_alipay_dict'):
  296. self.discount_infos[i] = element.to_alipay_dict()
  297. if hasattr(self.discount_infos, 'to_alipay_dict'):
  298. params['discount_infos'] = self.discount_infos.to_alipay_dict()
  299. else:
  300. params['discount_infos'] = self.discount_infos
  301. if self.dish_amount:
  302. if hasattr(self.dish_amount, 'to_alipay_dict'):
  303. params['dish_amount'] = self.dish_amount.to_alipay_dict()
  304. else:
  305. params['dish_amount'] = self.dish_amount
  306. if self.dish_list:
  307. if isinstance(self.dish_list, list):
  308. for i in range(0, len(self.dish_list)):
  309. element = self.dish_list[i]
  310. if hasattr(element, 'to_alipay_dict'):
  311. self.dish_list[i] = element.to_alipay_dict()
  312. if hasattr(self.dish_list, 'to_alipay_dict'):
  313. params['dish_list'] = self.dish_list.to_alipay_dict()
  314. else:
  315. params['dish_list'] = self.dish_list
  316. if self.ext_infos:
  317. if hasattr(self.ext_infos, 'to_alipay_dict'):
  318. params['ext_infos'] = self.ext_infos.to_alipay_dict()
  319. else:
  320. params['ext_infos'] = self.ext_infos
  321. if self.koubei_payment_amount:
  322. if hasattr(self.koubei_payment_amount, 'to_alipay_dict'):
  323. params['koubei_payment_amount'] = self.koubei_payment_amount.to_alipay_dict()
  324. else:
  325. params['koubei_payment_amount'] = self.koubei_payment_amount
  326. if self.offline_payment_amount:
  327. if hasattr(self.offline_payment_amount, 'to_alipay_dict'):
  328. params['offline_payment_amount'] = self.offline_payment_amount.to_alipay_dict()
  329. else:
  330. params['offline_payment_amount'] = self.offline_payment_amount
  331. if self.order_id:
  332. if hasattr(self.order_id, 'to_alipay_dict'):
  333. params['order_id'] = self.order_id.to_alipay_dict()
  334. else:
  335. params['order_id'] = self.order_id
  336. if self.order_style:
  337. if hasattr(self.order_style, 'to_alipay_dict'):
  338. params['order_style'] = self.order_style.to_alipay_dict()
  339. else:
  340. params['order_style'] = self.order_style
  341. if self.order_time:
  342. if hasattr(self.order_time, 'to_alipay_dict'):
  343. params['order_time'] = self.order_time.to_alipay_dict()
  344. else:
  345. params['order_time'] = self.order_time
  346. if self.other_amount_discountable:
  347. if hasattr(self.other_amount_discountable, 'to_alipay_dict'):
  348. params['other_amount_discountable'] = self.other_amount_discountable.to_alipay_dict()
  349. else:
  350. params['other_amount_discountable'] = self.other_amount_discountable
  351. if self.other_amount_infos:
  352. if isinstance(self.other_amount_infos, list):
  353. for i in range(0, len(self.other_amount_infos)):
  354. element = self.other_amount_infos[i]
  355. if hasattr(element, 'to_alipay_dict'):
  356. self.other_amount_infos[i] = element.to_alipay_dict()
  357. if hasattr(self.other_amount_infos, 'to_alipay_dict'):
  358. params['other_amount_infos'] = self.other_amount_infos.to_alipay_dict()
  359. else:
  360. params['other_amount_infos'] = self.other_amount_infos
  361. if self.other_amount_undiscountable:
  362. if hasattr(self.other_amount_undiscountable, 'to_alipay_dict'):
  363. params['other_amount_undiscountable'] = self.other_amount_undiscountable.to_alipay_dict()
  364. else:
  365. params['other_amount_undiscountable'] = self.other_amount_undiscountable
  366. if self.out_biz_no:
  367. if hasattr(self.out_biz_no, 'to_alipay_dict'):
  368. params['out_biz_no'] = self.out_biz_no.to_alipay_dict()
  369. else:
  370. params['out_biz_no'] = self.out_biz_no
  371. if self.partner_id:
  372. if hasattr(self.partner_id, 'to_alipay_dict'):
  373. params['partner_id'] = self.partner_id.to_alipay_dict()
  374. else:
  375. params['partner_id'] = self.partner_id
  376. if self.pay_style:
  377. if hasattr(self.pay_style, 'to_alipay_dict'):
  378. params['pay_style'] = self.pay_style.to_alipay_dict()
  379. else:
  380. params['pay_style'] = self.pay_style
  381. if self.payment_list:
  382. if isinstance(self.payment_list, list):
  383. for i in range(0, len(self.payment_list)):
  384. element = self.payment_list[i]
  385. if hasattr(element, 'to_alipay_dict'):
  386. self.payment_list[i] = element.to_alipay_dict()
  387. if hasattr(self.payment_list, 'to_alipay_dict'):
  388. params['payment_list'] = self.payment_list.to_alipay_dict()
  389. else:
  390. params['payment_list'] = self.payment_list
  391. if self.people_num:
  392. if hasattr(self.people_num, 'to_alipay_dict'):
  393. params['people_num'] = self.people_num.to_alipay_dict()
  394. else:
  395. params['people_num'] = self.people_num
  396. if self.pos_version:
  397. if hasattr(self.pos_version, 'to_alipay_dict'):
  398. params['pos_version'] = self.pos_version.to_alipay_dict()
  399. else:
  400. params['pos_version'] = self.pos_version
  401. if self.receivable_amount:
  402. if hasattr(self.receivable_amount, 'to_alipay_dict'):
  403. params['receivable_amount'] = self.receivable_amount.to_alipay_dict()
  404. else:
  405. params['receivable_amount'] = self.receivable_amount
  406. if self.refund_list:
  407. if isinstance(self.refund_list, list):
  408. for i in range(0, len(self.refund_list)):
  409. element = self.refund_list[i]
  410. if hasattr(element, 'to_alipay_dict'):
  411. self.refund_list[i] = element.to_alipay_dict()
  412. if hasattr(self.refund_list, 'to_alipay_dict'):
  413. params['refund_list'] = self.refund_list.to_alipay_dict()
  414. else:
  415. params['refund_list'] = self.refund_list
  416. if self.shop_id:
  417. if hasattr(self.shop_id, 'to_alipay_dict'):
  418. params['shop_id'] = self.shop_id.to_alipay_dict()
  419. else:
  420. params['shop_id'] = self.shop_id
  421. if self.status:
  422. if hasattr(self.status, 'to_alipay_dict'):
  423. params['status'] = self.status.to_alipay_dict()
  424. else:
  425. params['status'] = self.status
  426. if self.table_no:
  427. if hasattr(self.table_no, 'to_alipay_dict'):
  428. params['table_no'] = self.table_no.to_alipay_dict()
  429. else:
  430. params['table_no'] = self.table_no
  431. if self.total_paymented_amount:
  432. if hasattr(self.total_paymented_amount, 'to_alipay_dict'):
  433. params['total_paymented_amount'] = self.total_paymented_amount.to_alipay_dict()
  434. else:
  435. params['total_paymented_amount'] = self.total_paymented_amount
  436. if self.use_online_promotion_flag:
  437. if hasattr(self.use_online_promotion_flag, 'to_alipay_dict'):
  438. params['use_online_promotion_flag'] = self.use_online_promotion_flag.to_alipay_dict()
  439. else:
  440. params['use_online_promotion_flag'] = self.use_online_promotion_flag
  441. return params
  442. @staticmethod
  443. def from_alipay_dict(d):
  444. if not d:
  445. return None
  446. o = KoubeiCateringOrderSyncModel()
  447. if 'adjust_amount' in d:
  448. o.adjust_amount = d['adjust_amount']
  449. if 'amount' in d:
  450. o.amount = d['amount']
  451. if 'biz_product' in d:
  452. o.biz_product = d['biz_product']
  453. if 'business_type' in d:
  454. o.business_type = d['business_type']
  455. if 'dinner_type' in d:
  456. o.dinner_type = d['dinner_type']
  457. if 'discount_amount' in d:
  458. o.discount_amount = d['discount_amount']
  459. if 'discount_infos' in d:
  460. o.discount_infos = d['discount_infos']
  461. if 'dish_amount' in d:
  462. o.dish_amount = d['dish_amount']
  463. if 'dish_list' in d:
  464. o.dish_list = d['dish_list']
  465. if 'ext_infos' in d:
  466. o.ext_infos = d['ext_infos']
  467. if 'koubei_payment_amount' in d:
  468. o.koubei_payment_amount = d['koubei_payment_amount']
  469. if 'offline_payment_amount' in d:
  470. o.offline_payment_amount = d['offline_payment_amount']
  471. if 'order_id' in d:
  472. o.order_id = d['order_id']
  473. if 'order_style' in d:
  474. o.order_style = d['order_style']
  475. if 'order_time' in d:
  476. o.order_time = d['order_time']
  477. if 'other_amount_discountable' in d:
  478. o.other_amount_discountable = d['other_amount_discountable']
  479. if 'other_amount_infos' in d:
  480. o.other_amount_infos = d['other_amount_infos']
  481. if 'other_amount_undiscountable' in d:
  482. o.other_amount_undiscountable = d['other_amount_undiscountable']
  483. if 'out_biz_no' in d:
  484. o.out_biz_no = d['out_biz_no']
  485. if 'partner_id' in d:
  486. o.partner_id = d['partner_id']
  487. if 'pay_style' in d:
  488. o.pay_style = d['pay_style']
  489. if 'payment_list' in d:
  490. o.payment_list = d['payment_list']
  491. if 'people_num' in d:
  492. o.people_num = d['people_num']
  493. if 'pos_version' in d:
  494. o.pos_version = d['pos_version']
  495. if 'receivable_amount' in d:
  496. o.receivable_amount = d['receivable_amount']
  497. if 'refund_list' in d:
  498. o.refund_list = d['refund_list']
  499. if 'shop_id' in d:
  500. o.shop_id = d['shop_id']
  501. if 'status' in d:
  502. o.status = d['status']
  503. if 'table_no' in d:
  504. o.table_no = d['table_no']
  505. if 'total_paymented_amount' in d:
  506. o.total_paymented_amount = d['total_paymented_amount']
  507. if 'use_online_promotion_flag' in d:
  508. o.use_online_promotion_flag = d['use_online_promotion_flag']
  509. return o