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