SingleFundDetailItemAOPModel.py 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import json
  4. from alipay.aop.api.constant.ParamConstants import *
  5. from alipay.aop.api.domain.BatchFundItemAOPModel import BatchFundItemAOPModel
  6. from alipay.aop.api.domain.ConsumeRecordAOPModel import ConsumeRecordAOPModel
  7. class SingleFundDetailItemAOPModel(object):
  8. def __init__(self):
  9. self._batch_fund_item_model_list = None
  10. self._consume_record = None
  11. @property
  12. def batch_fund_item_model_list(self):
  13. return self._batch_fund_item_model_list
  14. @batch_fund_item_model_list.setter
  15. def batch_fund_item_model_list(self, value):
  16. if isinstance(value, list):
  17. self._batch_fund_item_model_list = list()
  18. for i in value:
  19. if isinstance(i, BatchFundItemAOPModel):
  20. self._batch_fund_item_model_list.append(i)
  21. else:
  22. self._batch_fund_item_model_list.append(BatchFundItemAOPModel.from_alipay_dict(i))
  23. @property
  24. def consume_record(self):
  25. return self._consume_record
  26. @consume_record.setter
  27. def consume_record(self, value):
  28. if isinstance(value, ConsumeRecordAOPModel):
  29. self._consume_record = value
  30. else:
  31. self._consume_record = ConsumeRecordAOPModel.from_alipay_dict(value)
  32. def to_alipay_dict(self):
  33. params = dict()
  34. if self.batch_fund_item_model_list:
  35. if isinstance(self.batch_fund_item_model_list, list):
  36. for i in range(0, len(self.batch_fund_item_model_list)):
  37. element = self.batch_fund_item_model_list[i]
  38. if hasattr(element, 'to_alipay_dict'):
  39. self.batch_fund_item_model_list[i] = element.to_alipay_dict()
  40. if hasattr(self.batch_fund_item_model_list, 'to_alipay_dict'):
  41. params['batch_fund_item_model_list'] = self.batch_fund_item_model_list.to_alipay_dict()
  42. else:
  43. params['batch_fund_item_model_list'] = self.batch_fund_item_model_list
  44. if self.consume_record:
  45. if hasattr(self.consume_record, 'to_alipay_dict'):
  46. params['consume_record'] = self.consume_record.to_alipay_dict()
  47. else:
  48. params['consume_record'] = self.consume_record
  49. return params
  50. @staticmethod
  51. def from_alipay_dict(d):
  52. if not d:
  53. return None
  54. o = SingleFundDetailItemAOPModel()
  55. if 'batch_fund_item_model_list' in d:
  56. o.batch_fund_item_model_list = d['batch_fund_item_model_list']
  57. if 'consume_record' in d:
  58. o.consume_record = d['consume_record']
  59. return o