1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- import json
- from alipay.aop.api.constant.ParamConstants import *
- from alipay.aop.api.domain.Address import Address
- class Shop(object):
- def __init__(self):
- self._address = None
- self._name = None
- self._seller_id = None
- self._type = None
- @property
- def address(self):
- return self._address
- @address.setter
- def address(self, value):
- if isinstance(value, Address):
- self._address = value
- else:
- self._address = Address.from_alipay_dict(value)
- @property
- def name(self):
- return self._name
- @name.setter
- def name(self, value):
- self._name = value
- @property
- def seller_id(self):
- return self._seller_id
- @seller_id.setter
- def seller_id(self, value):
- self._seller_id = value
- @property
- def type(self):
- return self._type
- @type.setter
- def type(self, value):
- self._type = value
- def to_alipay_dict(self):
- params = dict()
- if self.address:
- if hasattr(self.address, 'to_alipay_dict'):
- params['address'] = self.address.to_alipay_dict()
- else:
- params['address'] = self.address
- if self.name:
- if hasattr(self.name, 'to_alipay_dict'):
- params['name'] = self.name.to_alipay_dict()
- else:
- params['name'] = self.name
- if self.seller_id:
- if hasattr(self.seller_id, 'to_alipay_dict'):
- params['seller_id'] = self.seller_id.to_alipay_dict()
- else:
- params['seller_id'] = self.seller_id
- if self.type:
- if hasattr(self.type, 'to_alipay_dict'):
- params['type'] = self.type.to_alipay_dict()
- else:
- params['type'] = self.type
- return params
- @staticmethod
- def from_alipay_dict(d):
- if not d:
- return None
- o = Shop()
- if 'address' in d:
- o.address = d['address']
- if 'name' in d:
- o.name = d['name']
- if 'seller_id' in d:
- o.seller_id = d['seller_id']
- if 'type' in d:
- o.type = d['type']
- return o
|