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