KbpFundTool.py 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import json
  4. from alipay.aop.api.constant.ParamConstants import *
  5. class KbpFundTool(object):
  6. def __init__(self):
  7. self._f_fee = None
  8. self._f_id = None
  9. self._f_type = None
  10. @property
  11. def f_fee(self):
  12. return self._f_fee
  13. @f_fee.setter
  14. def f_fee(self, value):
  15. self._f_fee = value
  16. @property
  17. def f_id(self):
  18. return self._f_id
  19. @f_id.setter
  20. def f_id(self, value):
  21. self._f_id = value
  22. @property
  23. def f_type(self):
  24. return self._f_type
  25. @f_type.setter
  26. def f_type(self, value):
  27. self._f_type = value
  28. def to_alipay_dict(self):
  29. params = dict()
  30. if self.f_fee:
  31. if hasattr(self.f_fee, 'to_alipay_dict'):
  32. params['f_fee'] = self.f_fee.to_alipay_dict()
  33. else:
  34. params['f_fee'] = self.f_fee
  35. if self.f_id:
  36. if hasattr(self.f_id, 'to_alipay_dict'):
  37. params['f_id'] = self.f_id.to_alipay_dict()
  38. else:
  39. params['f_id'] = self.f_id
  40. if self.f_type:
  41. if hasattr(self.f_type, 'to_alipay_dict'):
  42. params['f_type'] = self.f_type.to_alipay_dict()
  43. else:
  44. params['f_type'] = self.f_type
  45. return params
  46. @staticmethod
  47. def from_alipay_dict(d):
  48. if not d:
  49. return None
  50. o = KbpFundTool()
  51. if 'f_fee' in d:
  52. o.f_fee = d['f_fee']
  53. if 'f_id' in d:
  54. o.f_id = d['f_id']
  55. if 'f_type' in d:
  56. o.f_type = d['f_type']
  57. return o