PaymentAccountInfo.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 PaymentAccountInfo(object):
  6. def __init__(self):
  7. self._account_name = None
  8. self._account_no = None
  9. self._account_type = None
  10. self._amount = None
  11. self._content = None
  12. @property
  13. def account_name(self):
  14. return self._account_name
  15. @account_name.setter
  16. def account_name(self, value):
  17. self._account_name = value
  18. @property
  19. def account_no(self):
  20. return self._account_no
  21. @account_no.setter
  22. def account_no(self, value):
  23. self._account_no = value
  24. @property
  25. def account_type(self):
  26. return self._account_type
  27. @account_type.setter
  28. def account_type(self, value):
  29. self._account_type = value
  30. @property
  31. def amount(self):
  32. return self._amount
  33. @amount.setter
  34. def amount(self, value):
  35. self._amount = value
  36. @property
  37. def content(self):
  38. return self._content
  39. @content.setter
  40. def content(self, value):
  41. self._content = value
  42. def to_alipay_dict(self):
  43. params = dict()
  44. if self.account_name:
  45. if hasattr(self.account_name, 'to_alipay_dict'):
  46. params['account_name'] = self.account_name.to_alipay_dict()
  47. else:
  48. params['account_name'] = self.account_name
  49. if self.account_no:
  50. if hasattr(self.account_no, 'to_alipay_dict'):
  51. params['account_no'] = self.account_no.to_alipay_dict()
  52. else:
  53. params['account_no'] = self.account_no
  54. if self.account_type:
  55. if hasattr(self.account_type, 'to_alipay_dict'):
  56. params['account_type'] = self.account_type.to_alipay_dict()
  57. else:
  58. params['account_type'] = self.account_type
  59. if self.amount:
  60. if hasattr(self.amount, 'to_alipay_dict'):
  61. params['amount'] = self.amount.to_alipay_dict()
  62. else:
  63. params['amount'] = self.amount
  64. if self.content:
  65. if hasattr(self.content, 'to_alipay_dict'):
  66. params['content'] = self.content.to_alipay_dict()
  67. else:
  68. params['content'] = self.content
  69. return params
  70. @staticmethod
  71. def from_alipay_dict(d):
  72. if not d:
  73. return None
  74. o = PaymentAccountInfo()
  75. if 'account_name' in d:
  76. o.account_name = d['account_name']
  77. if 'account_no' in d:
  78. o.account_no = d['account_no']
  79. if 'account_type' in d:
  80. o.account_type = d['account_type']
  81. if 'amount' in d:
  82. o.amount = d['amount']
  83. if 'content' in d:
  84. o.content = d['content']
  85. return o