SettleClause.py 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import json
  4. from alipay.aop.api.constant.ParamConstants import *
  5. class SettleClause(object):
  6. def __init__(self):
  7. self._amount = None
  8. self._currency = None
  9. self._settle_account_id = None
  10. self._settle_account_id_type = None
  11. self._settle_account_type = None
  12. self._settle_entity_id = None
  13. self._settle_entity_type = None
  14. @property
  15. def amount(self):
  16. return self._amount
  17. @amount.setter
  18. def amount(self, value):
  19. self._amount = value
  20. @property
  21. def currency(self):
  22. return self._currency
  23. @currency.setter
  24. def currency(self, value):
  25. self._currency = value
  26. @property
  27. def settle_account_id(self):
  28. return self._settle_account_id
  29. @settle_account_id.setter
  30. def settle_account_id(self, value):
  31. self._settle_account_id = value
  32. @property
  33. def settle_account_id_type(self):
  34. return self._settle_account_id_type
  35. @settle_account_id_type.setter
  36. def settle_account_id_type(self, value):
  37. self._settle_account_id_type = value
  38. @property
  39. def settle_account_type(self):
  40. return self._settle_account_type
  41. @settle_account_type.setter
  42. def settle_account_type(self, value):
  43. self._settle_account_type = value
  44. @property
  45. def settle_entity_id(self):
  46. return self._settle_entity_id
  47. @settle_entity_id.setter
  48. def settle_entity_id(self, value):
  49. self._settle_entity_id = value
  50. @property
  51. def settle_entity_type(self):
  52. return self._settle_entity_type
  53. @settle_entity_type.setter
  54. def settle_entity_type(self, value):
  55. self._settle_entity_type = value
  56. def to_alipay_dict(self):
  57. params = dict()
  58. if self.amount:
  59. if hasattr(self.amount, 'to_alipay_dict'):
  60. params['amount'] = self.amount.to_alipay_dict()
  61. else:
  62. params['amount'] = self.amount
  63. if self.currency:
  64. if hasattr(self.currency, 'to_alipay_dict'):
  65. params['currency'] = self.currency.to_alipay_dict()
  66. else:
  67. params['currency'] = self.currency
  68. if self.settle_account_id:
  69. if hasattr(self.settle_account_id, 'to_alipay_dict'):
  70. params['settle_account_id'] = self.settle_account_id.to_alipay_dict()
  71. else:
  72. params['settle_account_id'] = self.settle_account_id
  73. if self.settle_account_id_type:
  74. if hasattr(self.settle_account_id_type, 'to_alipay_dict'):
  75. params['settle_account_id_type'] = self.settle_account_id_type.to_alipay_dict()
  76. else:
  77. params['settle_account_id_type'] = self.settle_account_id_type
  78. if self.settle_account_type:
  79. if hasattr(self.settle_account_type, 'to_alipay_dict'):
  80. params['settle_account_type'] = self.settle_account_type.to_alipay_dict()
  81. else:
  82. params['settle_account_type'] = self.settle_account_type
  83. if self.settle_entity_id:
  84. if hasattr(self.settle_entity_id, 'to_alipay_dict'):
  85. params['settle_entity_id'] = self.settle_entity_id.to_alipay_dict()
  86. else:
  87. params['settle_entity_id'] = self.settle_entity_id
  88. if self.settle_entity_type:
  89. if hasattr(self.settle_entity_type, 'to_alipay_dict'):
  90. params['settle_entity_type'] = self.settle_entity_type.to_alipay_dict()
  91. else:
  92. params['settle_entity_type'] = self.settle_entity_type
  93. return params
  94. @staticmethod
  95. def from_alipay_dict(d):
  96. if not d:
  97. return None
  98. o = SettleClause()
  99. if 'amount' in d:
  100. o.amount = d['amount']
  101. if 'currency' in d:
  102. o.currency = d['currency']
  103. if 'settle_account_id' in d:
  104. o.settle_account_id = d['settle_account_id']
  105. if 'settle_account_id_type' in d:
  106. o.settle_account_id_type = d['settle_account_id_type']
  107. if 'settle_account_type' in d:
  108. o.settle_account_type = d['settle_account_type']
  109. if 'settle_entity_id' in d:
  110. o.settle_entity_id = d['settle_entity_id']
  111. if 'settle_entity_type' in d:
  112. o.settle_entity_type = d['settle_entity_type']
  113. return o