TransOrderResult.py 2.7 KB

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