TradeFundBill.py 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import json
  4. from alipay.aop.api.constant.ParamConstants import *
  5. class TradeFundBill(object):
  6. def __init__(self):
  7. self._amount = None
  8. self._bank_code = None
  9. self._fund_channel = None
  10. self._fund_type = None
  11. self._real_amount = None
  12. @property
  13. def amount(self):
  14. return self._amount
  15. @amount.setter
  16. def amount(self, value):
  17. self._amount = value
  18. @property
  19. def bank_code(self):
  20. return self._bank_code
  21. @bank_code.setter
  22. def bank_code(self, value):
  23. self._bank_code = value
  24. @property
  25. def fund_channel(self):
  26. return self._fund_channel
  27. @fund_channel.setter
  28. def fund_channel(self, value):
  29. self._fund_channel = value
  30. @property
  31. def fund_type(self):
  32. return self._fund_type
  33. @fund_type.setter
  34. def fund_type(self, value):
  35. self._fund_type = value
  36. @property
  37. def real_amount(self):
  38. return self._real_amount
  39. @real_amount.setter
  40. def real_amount(self, value):
  41. self._real_amount = value
  42. def to_alipay_dict(self):
  43. params = dict()
  44. if self.amount:
  45. if hasattr(self.amount, 'to_alipay_dict'):
  46. params['amount'] = self.amount.to_alipay_dict()
  47. else:
  48. params['amount'] = self.amount
  49. if self.bank_code:
  50. if hasattr(self.bank_code, 'to_alipay_dict'):
  51. params['bank_code'] = self.bank_code.to_alipay_dict()
  52. else:
  53. params['bank_code'] = self.bank_code
  54. if self.fund_channel:
  55. if hasattr(self.fund_channel, 'to_alipay_dict'):
  56. params['fund_channel'] = self.fund_channel.to_alipay_dict()
  57. else:
  58. params['fund_channel'] = self.fund_channel
  59. if self.fund_type:
  60. if hasattr(self.fund_type, 'to_alipay_dict'):
  61. params['fund_type'] = self.fund_type.to_alipay_dict()
  62. else:
  63. params['fund_type'] = self.fund_type
  64. if self.real_amount:
  65. if hasattr(self.real_amount, 'to_alipay_dict'):
  66. params['real_amount'] = self.real_amount.to_alipay_dict()
  67. else:
  68. params['real_amount'] = self.real_amount
  69. return params
  70. @staticmethod
  71. def from_alipay_dict(d):
  72. if not d:
  73. return None
  74. o = TradeFundBill()
  75. if 'amount' in d:
  76. o.amount = d['amount']
  77. if 'bank_code' in d:
  78. o.bank_code = d['bank_code']
  79. if 'fund_channel' in d:
  80. o.fund_channel = d['fund_channel']
  81. if 'fund_type' in d:
  82. o.fund_type = d['fund_type']
  83. if 'real_amount' in d:
  84. o.real_amount = d['real_amount']
  85. return o