KoubeiMallScanpurchaseTradeConsultModel.py 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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.MallGoodsDetail import MallGoodsDetail
  6. class KoubeiMallScanpurchaseTradeConsultModel(object):
  7. def __init__(self):
  8. self._goods_detail = None
  9. self._partner_id = None
  10. self._request_id = None
  11. self._shop_id = None
  12. self._total_amount = None
  13. self._undiscountable_amount = None
  14. self._user_id = None
  15. @property
  16. def goods_detail(self):
  17. return self._goods_detail
  18. @goods_detail.setter
  19. def goods_detail(self, value):
  20. if isinstance(value, list):
  21. self._goods_detail = list()
  22. for i in value:
  23. if isinstance(i, MallGoodsDetail):
  24. self._goods_detail.append(i)
  25. else:
  26. self._goods_detail.append(MallGoodsDetail.from_alipay_dict(i))
  27. @property
  28. def partner_id(self):
  29. return self._partner_id
  30. @partner_id.setter
  31. def partner_id(self, value):
  32. self._partner_id = value
  33. @property
  34. def request_id(self):
  35. return self._request_id
  36. @request_id.setter
  37. def request_id(self, value):
  38. self._request_id = value
  39. @property
  40. def shop_id(self):
  41. return self._shop_id
  42. @shop_id.setter
  43. def shop_id(self, value):
  44. self._shop_id = value
  45. @property
  46. def total_amount(self):
  47. return self._total_amount
  48. @total_amount.setter
  49. def total_amount(self, value):
  50. self._total_amount = value
  51. @property
  52. def undiscountable_amount(self):
  53. return self._undiscountable_amount
  54. @undiscountable_amount.setter
  55. def undiscountable_amount(self, value):
  56. self._undiscountable_amount = value
  57. @property
  58. def user_id(self):
  59. return self._user_id
  60. @user_id.setter
  61. def user_id(self, value):
  62. self._user_id = value
  63. def to_alipay_dict(self):
  64. params = dict()
  65. if self.goods_detail:
  66. if isinstance(self.goods_detail, list):
  67. for i in range(0, len(self.goods_detail)):
  68. element = self.goods_detail[i]
  69. if hasattr(element, 'to_alipay_dict'):
  70. self.goods_detail[i] = element.to_alipay_dict()
  71. if hasattr(self.goods_detail, 'to_alipay_dict'):
  72. params['goods_detail'] = self.goods_detail.to_alipay_dict()
  73. else:
  74. params['goods_detail'] = self.goods_detail
  75. if self.partner_id:
  76. if hasattr(self.partner_id, 'to_alipay_dict'):
  77. params['partner_id'] = self.partner_id.to_alipay_dict()
  78. else:
  79. params['partner_id'] = self.partner_id
  80. if self.request_id:
  81. if hasattr(self.request_id, 'to_alipay_dict'):
  82. params['request_id'] = self.request_id.to_alipay_dict()
  83. else:
  84. params['request_id'] = self.request_id
  85. if self.shop_id:
  86. if hasattr(self.shop_id, 'to_alipay_dict'):
  87. params['shop_id'] = self.shop_id.to_alipay_dict()
  88. else:
  89. params['shop_id'] = self.shop_id
  90. if self.total_amount:
  91. if hasattr(self.total_amount, 'to_alipay_dict'):
  92. params['total_amount'] = self.total_amount.to_alipay_dict()
  93. else:
  94. params['total_amount'] = self.total_amount
  95. if self.undiscountable_amount:
  96. if hasattr(self.undiscountable_amount, 'to_alipay_dict'):
  97. params['undiscountable_amount'] = self.undiscountable_amount.to_alipay_dict()
  98. else:
  99. params['undiscountable_amount'] = self.undiscountable_amount
  100. if self.user_id:
  101. if hasattr(self.user_id, 'to_alipay_dict'):
  102. params['user_id'] = self.user_id.to_alipay_dict()
  103. else:
  104. params['user_id'] = self.user_id
  105. return params
  106. @staticmethod
  107. def from_alipay_dict(d):
  108. if not d:
  109. return None
  110. o = KoubeiMallScanpurchaseTradeConsultModel()
  111. if 'goods_detail' in d:
  112. o.goods_detail = d['goods_detail']
  113. if 'partner_id' in d:
  114. o.partner_id = d['partner_id']
  115. if 'request_id' in d:
  116. o.request_id = d['request_id']
  117. if 'shop_id' in d:
  118. o.shop_id = d['shop_id']
  119. if 'total_amount' in d:
  120. o.total_amount = d['total_amount']
  121. if 'undiscountable_amount' in d:
  122. o.undiscountable_amount = d['undiscountable_amount']
  123. if 'user_id' in d:
  124. o.user_id = d['user_id']
  125. return o