InvoiceTradeGoodsItem.py 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import json
  4. from alipay.aop.api.constant.ParamConstants import *
  5. class InvoiceTradeGoodsItem(object):
  6. def __init__(self):
  7. self._category = None
  8. self._goods_name = None
  9. self._goods_no = None
  10. self._goods_sum_amount = None
  11. self._price = None
  12. self._quantity = None
  13. self._specification = None
  14. self._unit = None
  15. @property
  16. def category(self):
  17. return self._category
  18. @category.setter
  19. def category(self, value):
  20. self._category = value
  21. @property
  22. def goods_name(self):
  23. return self._goods_name
  24. @goods_name.setter
  25. def goods_name(self, value):
  26. self._goods_name = value
  27. @property
  28. def goods_no(self):
  29. return self._goods_no
  30. @goods_no.setter
  31. def goods_no(self, value):
  32. self._goods_no = value
  33. @property
  34. def goods_sum_amount(self):
  35. return self._goods_sum_amount
  36. @goods_sum_amount.setter
  37. def goods_sum_amount(self, value):
  38. self._goods_sum_amount = value
  39. @property
  40. def price(self):
  41. return self._price
  42. @price.setter
  43. def price(self, value):
  44. self._price = value
  45. @property
  46. def quantity(self):
  47. return self._quantity
  48. @quantity.setter
  49. def quantity(self, value):
  50. self._quantity = value
  51. @property
  52. def specification(self):
  53. return self._specification
  54. @specification.setter
  55. def specification(self, value):
  56. self._specification = value
  57. @property
  58. def unit(self):
  59. return self._unit
  60. @unit.setter
  61. def unit(self, value):
  62. self._unit = value
  63. def to_alipay_dict(self):
  64. params = dict()
  65. if self.category:
  66. if hasattr(self.category, 'to_alipay_dict'):
  67. params['category'] = self.category.to_alipay_dict()
  68. else:
  69. params['category'] = self.category
  70. if self.goods_name:
  71. if hasattr(self.goods_name, 'to_alipay_dict'):
  72. params['goods_name'] = self.goods_name.to_alipay_dict()
  73. else:
  74. params['goods_name'] = self.goods_name
  75. if self.goods_no:
  76. if hasattr(self.goods_no, 'to_alipay_dict'):
  77. params['goods_no'] = self.goods_no.to_alipay_dict()
  78. else:
  79. params['goods_no'] = self.goods_no
  80. if self.goods_sum_amount:
  81. if hasattr(self.goods_sum_amount, 'to_alipay_dict'):
  82. params['goods_sum_amount'] = self.goods_sum_amount.to_alipay_dict()
  83. else:
  84. params['goods_sum_amount'] = self.goods_sum_amount
  85. if self.price:
  86. if hasattr(self.price, 'to_alipay_dict'):
  87. params['price'] = self.price.to_alipay_dict()
  88. else:
  89. params['price'] = self.price
  90. if self.quantity:
  91. if hasattr(self.quantity, 'to_alipay_dict'):
  92. params['quantity'] = self.quantity.to_alipay_dict()
  93. else:
  94. params['quantity'] = self.quantity
  95. if self.specification:
  96. if hasattr(self.specification, 'to_alipay_dict'):
  97. params['specification'] = self.specification.to_alipay_dict()
  98. else:
  99. params['specification'] = self.specification
  100. if self.unit:
  101. if hasattr(self.unit, 'to_alipay_dict'):
  102. params['unit'] = self.unit.to_alipay_dict()
  103. else:
  104. params['unit'] = self.unit
  105. return params
  106. @staticmethod
  107. def from_alipay_dict(d):
  108. if not d:
  109. return None
  110. o = InvoiceTradeGoodsItem()
  111. if 'category' in d:
  112. o.category = d['category']
  113. if 'goods_name' in d:
  114. o.goods_name = d['goods_name']
  115. if 'goods_no' in d:
  116. o.goods_no = d['goods_no']
  117. if 'goods_sum_amount' in d:
  118. o.goods_sum_amount = d['goods_sum_amount']
  119. if 'price' in d:
  120. o.price = d['price']
  121. if 'quantity' in d:
  122. o.quantity = d['quantity']
  123. if 'specification' in d:
  124. o.specification = d['specification']
  125. if 'unit' in d:
  126. o.unit = d['unit']
  127. return o