#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * class ItemDetail(object): def __init__(self): self._item_id = None self._item_name = None self._price = None self._quantity = None @property def item_id(self): return self._item_id @item_id.setter def item_id(self, value): self._item_id = value @property def item_name(self): return self._item_name @item_name.setter def item_name(self, value): self._item_name = 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 def to_alipay_dict(self): params = dict() if self.item_id: if hasattr(self.item_id, 'to_alipay_dict'): params['item_id'] = self.item_id.to_alipay_dict() else: params['item_id'] = self.item_id if self.item_name: if hasattr(self.item_name, 'to_alipay_dict'): params['item_name'] = self.item_name.to_alipay_dict() else: params['item_name'] = self.item_name 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 return params @staticmethod def from_alipay_dict(d): if not d: return None o = ItemDetail() if 'item_id' in d: o.item_id = d['item_id'] if 'item_name' in d: o.item_name = d['item_name'] if 'price' in d: o.price = d['price'] if 'quantity' in d: o.quantity = d['quantity'] return o