FundBill.py 2.3 KB

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