diff --git a/alipay/aop/api/domain/AlipayTradeWapPayModel.py b/alipay/aop/api/domain/AlipayTradeWapPayModel.py index 3eba0d509..4de827d33 100644 --- a/alipay/aop/api/domain/AlipayTradeWapPayModel.py +++ b/alipay/aop/api/domain/AlipayTradeWapPayModel.py @@ -1,8 +1,5 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -import json - -from alipay.aop.api.constant.ParamConstants import * from alipay.aop.api.domain.ExtUserInfo import ExtUserInfo from alipay.aop.api.domain.ExtendParams import ExtendParams from alipay.aop.api.domain.GoodsDetail import GoodsDetail @@ -13,6 +10,34 @@ class AlipayTradeWapPayModel(object): + openapi_types = { + "auth_token": "str", + "body": "str", + "business_params": "str", + "disable_pay_channels": "str", + "enable_pay_channels": "str", + "ext_user_info": "str", + "extend_params": "str", + "goods_type": "str", + "invoice_info": "str", + "merchant_order_no": "str", + "out_trade_no": "str", + "passback_params": "str", + "product_code": "str", + "promo_params": "str", + "quit_url": "str", + "royalty_info": "str", + "seller_id": "str", + "settle_info": "str", + "specified_channel": "str", + "store_id": "str", + "sub_merchant": "str", + "subject": "str", + "time_expire": "str", + "timeout_express": "str", + "total_amount": "float", + "goods_detail": "list" + } def __init__(self): self._auth_token = None @@ -49,6 +74,7 @@ def auth_token(self): @auth_token.setter def auth_token(self, value): self._auth_token = value + @property def body(self): return self._body @@ -56,6 +82,7 @@ def body(self): @body.setter def body(self, value): self._body = value + @property def business_params(self): return self._business_params @@ -63,6 +90,7 @@ def business_params(self): @business_params.setter def business_params(self, value): self._business_params = value + @property def disable_pay_channels(self): return self._disable_pay_channels @@ -70,6 +98,7 @@ def disable_pay_channels(self): @disable_pay_channels.setter def disable_pay_channels(self, value): self._disable_pay_channels = value + @property def enable_pay_channels(self): return self._enable_pay_channels @@ -77,6 +106,7 @@ def enable_pay_channels(self): @enable_pay_channels.setter def enable_pay_channels(self, value): self._enable_pay_channels = value + @property def ext_user_info(self): return self._ext_user_info @@ -87,6 +117,7 @@ def ext_user_info(self, value): self._ext_user_info = value else: self._ext_user_info = ExtUserInfo.from_alipay_dict(value) + @property def extend_params(self): return self._extend_params @@ -97,6 +128,7 @@ def extend_params(self, value): self._extend_params = value else: self._extend_params = ExtendParams.from_alipay_dict(value) + @property def goods_detail(self): return self._goods_detail @@ -110,6 +142,7 @@ def goods_detail(self, value): self._goods_detail.append(i) else: self._goods_detail.append(GoodsDetail.from_alipay_dict(i)) + @property def goods_type(self): return self._goods_type @@ -117,6 +150,7 @@ def goods_type(self): @goods_type.setter def goods_type(self, value): self._goods_type = value + @property def invoice_info(self): return self._invoice_info @@ -127,6 +161,7 @@ def invoice_info(self, value): self._invoice_info = value else: self._invoice_info = InvoiceInfo.from_alipay_dict(value) + @property def merchant_order_no(self): return self._merchant_order_no @@ -134,6 +169,7 @@ def merchant_order_no(self): @merchant_order_no.setter def merchant_order_no(self, value): self._merchant_order_no = value + @property def out_trade_no(self): return self._out_trade_no @@ -141,6 +177,7 @@ def out_trade_no(self): @out_trade_no.setter def out_trade_no(self, value): self._out_trade_no = value + @property def passback_params(self): return self._passback_params @@ -148,6 +185,7 @@ def passback_params(self): @passback_params.setter def passback_params(self, value): self._passback_params = value + @property def product_code(self): return self._product_code @@ -155,6 +193,7 @@ def product_code(self): @product_code.setter def product_code(self, value): self._product_code = value + @property def promo_params(self): return self._promo_params @@ -162,6 +201,7 @@ def promo_params(self): @promo_params.setter def promo_params(self, value): self._promo_params = value + @property def quit_url(self): return self._quit_url @@ -169,6 +209,7 @@ def quit_url(self): @quit_url.setter def quit_url(self, value): self._quit_url = value + @property def royalty_info(self): return self._royalty_info @@ -179,6 +220,7 @@ def royalty_info(self, value): self._royalty_info = value else: self._royalty_info = RoyaltyInfo.from_alipay_dict(value) + @property def seller_id(self): return self._seller_id @@ -186,6 +228,7 @@ def seller_id(self): @seller_id.setter def seller_id(self, value): self._seller_id = value + @property def settle_info(self): return self._settle_info @@ -196,6 +239,7 @@ def settle_info(self, value): self._settle_info = value else: self._settle_info = SettleInfo.from_alipay_dict(value) + @property def specified_channel(self): return self._specified_channel @@ -203,6 +247,7 @@ def specified_channel(self): @specified_channel.setter def specified_channel(self, value): self._specified_channel = value + @property def store_id(self): return self._store_id @@ -210,6 +255,7 @@ def store_id(self): @store_id.setter def store_id(self, value): self._store_id = value + @property def sub_merchant(self): return self._sub_merchant @@ -220,6 +266,7 @@ def sub_merchant(self, value): self._sub_merchant = value else: self._sub_merchant = SubMerchant.from_alipay_dict(value) + @property def subject(self): return self._subject @@ -227,6 +274,7 @@ def subject(self): @subject.setter def subject(self, value): self._subject = value + @property def time_expire(self): return self._time_expire @@ -234,6 +282,7 @@ def time_expire(self): @time_expire.setter def time_expire(self, value): self._time_expire = value + @property def timeout_express(self): return self._timeout_express @@ -241,6 +290,7 @@ def timeout_express(self): @timeout_express.setter def timeout_express(self, value): self._timeout_express = value + @property def total_amount(self): return self._total_amount @@ -249,144 +299,28 @@ def total_amount(self): def total_amount(self, value): self._total_amount = value - def to_alipay_dict(self): + # support PY2 and PY3 + try: + def iteritems(d, **kw): + return iter(d.items(**kw)) + except Exception as _: + def iteritems(d, **kw): + return d.iteritems(**kw) + params = dict() - if self.auth_token: - if hasattr(self.auth_token, 'to_alipay_dict'): - params['auth_token'] = self.auth_token.to_alipay_dict() - else: - params['auth_token'] = self.auth_token - if self.body: - if hasattr(self.body, 'to_alipay_dict'): - params['body'] = self.body.to_alipay_dict() - else: - params['body'] = self.body - if self.business_params: - if hasattr(self.business_params, 'to_alipay_dict'): - params['business_params'] = self.business_params.to_alipay_dict() - else: - params['business_params'] = self.business_params - if self.disable_pay_channels: - if hasattr(self.disable_pay_channels, 'to_alipay_dict'): - params['disable_pay_channels'] = self.disable_pay_channels.to_alipay_dict() - else: - params['disable_pay_channels'] = self.disable_pay_channels - if self.enable_pay_channels: - if hasattr(self.enable_pay_channels, 'to_alipay_dict'): - params['enable_pay_channels'] = self.enable_pay_channels.to_alipay_dict() - else: - params['enable_pay_channels'] = self.enable_pay_channels - if self.ext_user_info: - if hasattr(self.ext_user_info, 'to_alipay_dict'): - params['ext_user_info'] = self.ext_user_info.to_alipay_dict() - else: - params['ext_user_info'] = self.ext_user_info - if self.extend_params: - if hasattr(self.extend_params, 'to_alipay_dict'): - params['extend_params'] = self.extend_params.to_alipay_dict() - else: - params['extend_params'] = self.extend_params - if self.goods_detail: - if isinstance(self.goods_detail, list): - for i in range(0, len(self.goods_detail)): - element = self.goods_detail[i] - if hasattr(element, 'to_alipay_dict'): - self.goods_detail[i] = element.to_alipay_dict() - if hasattr(self.goods_detail, 'to_alipay_dict'): - params['goods_detail'] = self.goods_detail.to_alipay_dict() - else: - params['goods_detail'] = self.goods_detail - if self.goods_type: - if hasattr(self.goods_type, 'to_alipay_dict'): - params['goods_type'] = self.goods_type.to_alipay_dict() - else: - params['goods_type'] = self.goods_type - if self.invoice_info: - if hasattr(self.invoice_info, 'to_alipay_dict'): - params['invoice_info'] = self.invoice_info.to_alipay_dict() - else: - params['invoice_info'] = self.invoice_info - if self.merchant_order_no: - if hasattr(self.merchant_order_no, 'to_alipay_dict'): - params['merchant_order_no'] = self.merchant_order_no.to_alipay_dict() - else: - params['merchant_order_no'] = self.merchant_order_no - if self.out_trade_no: - if hasattr(self.out_trade_no, 'to_alipay_dict'): - params['out_trade_no'] = self.out_trade_no.to_alipay_dict() - else: - params['out_trade_no'] = self.out_trade_no - if self.passback_params: - if hasattr(self.passback_params, 'to_alipay_dict'): - params['passback_params'] = self.passback_params.to_alipay_dict() - else: - params['passback_params'] = self.passback_params - if self.product_code: - if hasattr(self.product_code, 'to_alipay_dict'): - params['product_code'] = self.product_code.to_alipay_dict() - else: - params['product_code'] = self.product_code - if self.promo_params: - if hasattr(self.promo_params, 'to_alipay_dict'): - params['promo_params'] = self.promo_params.to_alipay_dict() - else: - params['promo_params'] = self.promo_params - if self.quit_url: - if hasattr(self.quit_url, 'to_alipay_dict'): - params['quit_url'] = self.quit_url.to_alipay_dict() - else: - params['quit_url'] = self.quit_url - if self.royalty_info: - if hasattr(self.royalty_info, 'to_alipay_dict'): - params['royalty_info'] = self.royalty_info.to_alipay_dict() - else: - params['royalty_info'] = self.royalty_info - 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.settle_info: - if hasattr(self.settle_info, 'to_alipay_dict'): - params['settle_info'] = self.settle_info.to_alipay_dict() - else: - params['settle_info'] = self.settle_info - if self.specified_channel: - if hasattr(self.specified_channel, 'to_alipay_dict'): - params['specified_channel'] = self.specified_channel.to_alipay_dict() - else: - params['specified_channel'] = self.specified_channel - if self.store_id: - if hasattr(self.store_id, 'to_alipay_dict'): - params['store_id'] = self.store_id.to_alipay_dict() - else: - params['store_id'] = self.store_id - if self.sub_merchant: - if hasattr(self.sub_merchant, 'to_alipay_dict'): - params['sub_merchant'] = self.sub_merchant.to_alipay_dict() - else: - params['sub_merchant'] = self.sub_merchant - if self.subject: - if hasattr(self.subject, 'to_alipay_dict'): - params['subject'] = self.subject.to_alipay_dict() - else: - params['subject'] = self.subject - if self.time_expire: - if hasattr(self.time_expire, 'to_alipay_dict'): - params['time_expire'] = self.time_expire.to_alipay_dict() - else: - params['time_expire'] = self.time_expire - if self.timeout_express: - if hasattr(self.timeout_express, 'to_alipay_dict'): - params['timeout_express'] = self.timeout_express.to_alipay_dict() - else: - params['timeout_express'] = self.timeout_express - if self.total_amount: - if hasattr(self.total_amount, 'to_alipay_dict'): - params['total_amount'] = self.total_amount.to_alipay_dict() - else: - params['total_amount'] = self.total_amount + for attr in iteritems(self.openapi_types): + value = getattr(self, attr) + if isinstance(value, list): + params[attr] = list( + map(lambda x: x.to_alipay_dict() if hasattr( + x, "to_alipay_dict") else x, value) + ) + elif hasattr(value, 'to_alipay_dict'): + params[attr] = value.to_alipay_dict() + elif value: + params[attr] = value + return params @staticmethod @@ -447,5 +381,3 @@ def from_alipay_dict(d): if 'total_amount' in d: o.total_amount = d['total_amount'] return o - -