class RetroChargeEvent(xm.Schema): ignore_missing = True type = xm.String('.//RetrochargeEventType') amazon_order_id = xm.String('.//AmazonOrderId') posted_date = xm.String('.//PostedDate') base_tax = xm.Float('.//BaseTax/Amount') shipping_tax = xm.Float('.//ShippingTax/Amount') marketplace = xm.String('.//MarketplaceName')
class AdjustmentItem(xm.Schema): ignore_missing = True quantity = xm.Int('.//Quantity') per_unit_amount = xm.Float('.//PerUnitAmount/Amount') total_amount = xm.Float('.//TotalAmount/Amount') msku = xm.String('.//SellerSKU') fnsku = xm.String('.//FnSKU') sku = xm.String('.//ASIN') description = xm.String('.//ProductDescription')
class OrderItemSchema(xm.Schema): ignore_missing = True sku = xm.String('.//ASIN', required=True) msku = xm.String('.//SellerSKU') order_item_id = xm.String('.//OrderItemId') title = xm.String('.//Title') qty_ordered = xm.Int('.//QuantityOrdered') qty_shipped = xm.Int('.//QuantityShipped') price = xm.Float('.//ItemPrice/Amount') currency_code = xm.String('.//ItemPrice/CurrencyCode') shipping_price = xm.Float('.//ShippingPrice/Amount')
class ResponseSchema(MWSResponseSchema): """Response schema for GetCompetitivePricingForASIN.""" success = xm.Attribute('//GetCompetitivePricingForASINResult', attr='status') listing_price = xm.Float('.//ListingPrice/Amount', default=0) shipping = xm.Float('.//Shipping/Amount', default=0) landed_price = xm.Float('.//LandedPrice/Amount', default=0) offers = xm.Int('.//OfferListingCount[@condition="New"]', default=0) def post_load(self, data): data.success = data.success == 'Success' return data
class EventGroupSchema(xm.Schema): ignore_missing = True group_id = xm.String('.//FinancialEventGroupId', required=True) group_status = xm.String('.//FinancialEventGroupStatus') fund_transfer_status = xm.String('.//FundTransferStatus') original_total = xm.Float('.//OriginalTotal/Amount') converted_total = xm.Float('.//ConvertedTotal/Amount') fund_transfer_date = xm.String('.//FundTransferDate') trace_id = xm.String('.//TraceId') account_tail = xm.String('.//AccountTail') beginning_balance = xm.Float('.//BeginningBalance/Amount') start_date = xm.String('.//FinancialEventGroupStartDate') end_date = xm.String('.//FinancialEventGroupEndDate')
class ProductSchema(xm.Schema): ignore_missing = True class RankSchema(xm.Schema): category = xm.String('./ProductCategoryId') rank = xm.Int('./Rank') sku = xm.String('./Identifiers/MarketplaceASIN/ASIN') brand = xm.First(('.//Brand', './/Manufacturer', './/Label', './/Publisher', './/Studio')) model = xm.First(('.//Model', './/PartNumber')) price = xm.Float('.//ListPrice/Amount') NumberOfItems = xm.Int('.//NumberOfItems') PackageQuantity = xm.Int('.//PackageQuantity') image_url = xm.String('.//SmallImage/URL') title = xm.String('.//Title') ranks = xm.Nested('.//SalesRank', RankSchema(), many=True) features = xm.String('.//Feature', many=True) def post_load(self, data): if 'features' in data: data.features = '\n'.join(data.pop('features')) for ranking in data.pop('ranks', []): if not ranking['category'].isdigit(): data['category'] = ranking.category data['rank'] = ranking.rank break return data
class PackageSchema(xm.Schema): ignore_missing = True class Dimensions(xm.Schema): units = xm.String('.//Unit') height = xm.Float('.//Height') length = xm.Float('.//Length') width = xm.Float('.//Width') weight = xm.Float('.//Weight/Value') tracking_number = xm.String('.//TrackingId') carrier = xm.String('.//CarrierName') status = xm.String('.//PackageStatus') dimensions = xm.Field('.//Dimensions', Dimensions())
class AdjustmentEvent(xm.Schema): ignore_missing = True class AdjustmentItem(xm.Schema): ignore_missing = True quantity = xm.Int('.//Quantity') per_unit_amount = xm.Float('.//PerUnitAmount/Amount') total_amount = xm.Float('.//TotalAmount/Amount') msku = xm.String('.//SellerSKU') fnsku = xm.String('.//FnSKU') sku = xm.String('.//ASIN') description = xm.String('.//ProductDescription') type = xm.String('.//AdjustmentType') amount = xm.Float('.//AdjustmentAmount/Amount') posted_date = xm.String('.//PostedDate') items = xm.List('.//AdjustmentItemList/AdjustmentItem', AdjustmentItem())
class ResponseSchema(MWSResponseSchema): class PackageSchema(xm.Schema): ignore_missing = True class Dimensions(xm.Schema): units = xm.String('.//Unit') height = xm.Float('.//Height') length = xm.Float('.//Length') width = xm.Float('.//Width') weight = xm.Float('.//Weight/Value') tracking_number = xm.String('.//TrackingId') carrier = xm.String('.//CarrierName') status = xm.String('.//PackageStatus') dimensions = xm.Field('.//Dimensions', Dimensions()) shipping = xm.Float('.//PartneredEstimate/Amount/Value') transport_status = xm.String('.//TransportStatus', required=True) packages = xm.Field('//member', PackageSchema(), many=True, default=list)
class Promotion(xm.Schema): ignore_missing = True type = xm.String('.//PromotionType') id = xm.String('.//PromotionId') amount = xm.Float('.//PromotionAmount/CurrencyAmount', default=0)
class Dimensions(xm.Schema): units = xm.String('.//Unit') height = xm.Float('.//Height') length = xm.Float('.//Length') width = xm.Float('.//Width')
class ContentsFeeSchema(xm.Schema): units = xm.Int('.//TotalUnits') per_unit = xm.Float('.//FeePerUnit/Amount') total = xm.Float('.//TotalFee/Amount')
class ResponseSchema(MWSResponseSchema): """Response schema for GetMyFeesEstimate.""" status = xm.String('.//Status') selling_fees = xm.Float('.//TotalFeesEstimate/Amount', default=None)