KoubeiCateringCommodityOrderBuyModel.py 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import json
  4. from alipay.aop.api.constant.ParamConstants import *
  5. class KoubeiCateringCommodityOrderBuyModel(object):
  6. def __init__(self):
  7. self._agent_id = None
  8. self._agent_type = None
  9. self._consumer_card_no = None
  10. self._merchandise_id = None
  11. self._shop_ids = None
  12. @property
  13. def agent_id(self):
  14. return self._agent_id
  15. @agent_id.setter
  16. def agent_id(self, value):
  17. self._agent_id = value
  18. @property
  19. def agent_type(self):
  20. return self._agent_type
  21. @agent_type.setter
  22. def agent_type(self, value):
  23. self._agent_type = value
  24. @property
  25. def consumer_card_no(self):
  26. return self._consumer_card_no
  27. @consumer_card_no.setter
  28. def consumer_card_no(self, value):
  29. self._consumer_card_no = value
  30. @property
  31. def merchandise_id(self):
  32. return self._merchandise_id
  33. @merchandise_id.setter
  34. def merchandise_id(self, value):
  35. self._merchandise_id = value
  36. @property
  37. def shop_ids(self):
  38. return self._shop_ids
  39. @shop_ids.setter
  40. def shop_ids(self, value):
  41. if isinstance(value, list):
  42. self._shop_ids = list()
  43. for i in value:
  44. self._shop_ids.append(i)
  45. def to_alipay_dict(self):
  46. params = dict()
  47. if self.agent_id:
  48. if hasattr(self.agent_id, 'to_alipay_dict'):
  49. params['agent_id'] = self.agent_id.to_alipay_dict()
  50. else:
  51. params['agent_id'] = self.agent_id
  52. if self.agent_type:
  53. if hasattr(self.agent_type, 'to_alipay_dict'):
  54. params['agent_type'] = self.agent_type.to_alipay_dict()
  55. else:
  56. params['agent_type'] = self.agent_type
  57. if self.consumer_card_no:
  58. if hasattr(self.consumer_card_no, 'to_alipay_dict'):
  59. params['consumer_card_no'] = self.consumer_card_no.to_alipay_dict()
  60. else:
  61. params['consumer_card_no'] = self.consumer_card_no
  62. if self.merchandise_id:
  63. if hasattr(self.merchandise_id, 'to_alipay_dict'):
  64. params['merchandise_id'] = self.merchandise_id.to_alipay_dict()
  65. else:
  66. params['merchandise_id'] = self.merchandise_id
  67. if self.shop_ids:
  68. if isinstance(self.shop_ids, list):
  69. for i in range(0, len(self.shop_ids)):
  70. element = self.shop_ids[i]
  71. if hasattr(element, 'to_alipay_dict'):
  72. self.shop_ids[i] = element.to_alipay_dict()
  73. if hasattr(self.shop_ids, 'to_alipay_dict'):
  74. params['shop_ids'] = self.shop_ids.to_alipay_dict()
  75. else:
  76. params['shop_ids'] = self.shop_ids
  77. return params
  78. @staticmethod
  79. def from_alipay_dict(d):
  80. if not d:
  81. return None
  82. o = KoubeiCateringCommodityOrderBuyModel()
  83. if 'agent_id' in d:
  84. o.agent_id = d['agent_id']
  85. if 'agent_type' in d:
  86. o.agent_type = d['agent_type']
  87. if 'consumer_card_no' in d:
  88. o.consumer_card_no = d['consumer_card_no']
  89. if 'merchandise_id' in d:
  90. o.merchandise_id = d['merchandise_id']
  91. if 'shop_ids' in d:
  92. o.shop_ids = d['shop_ids']
  93. return o