12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- import json
- from alipay.aop.api.constant.ParamConstants import *
- class Money(object):
- def __init__(self):
- self._currency = None
- self._value = None
- @property
- def currency(self):
- return self._currency
- @currency.setter
- def currency(self, value):
- self._currency = value
- @property
- def value(self):
- return self._value
- @value.setter
- def value(self, value):
- self._value = value
- def to_alipay_dict(self):
- params = dict()
- if self.currency:
- if hasattr(self.currency, 'to_alipay_dict'):
- params['currency'] = self.currency.to_alipay_dict()
- else:
- params['currency'] = self.currency
- if self.value:
- if hasattr(self.value, 'to_alipay_dict'):
- params['value'] = self.value.to_alipay_dict()
- else:
- params['value'] = self.value
- return params
- @staticmethod
- def from_alipay_dict(d):
- if not d:
- return None
- o = Money()
- if 'currency' in d:
- o.currency = d['currency']
- if 'value' in d:
- o.value = d['value']
- return o
|