Amazon-SP-API-CSharp
Amazon-SP-API-CSharp copied to clipboard
Price Update - createDocument.GetXML() - Invalid content was found starting with element 'BusinessPrice'
Error Message: "XML Parsing Error at Line 18, Column 37: cvc-complex-type.2.4.a: Invalid content was found starting with element 'BusinessPrice'. One of '{CompareAt, Previous, Rental_0, Rental_1, Rental_2, Rental_3, Rental_4, Rental_5, Rental_6, Rental_7, Rental_8, Rental_9, CostPerClickBidPrice, PricingAction, MetalStandardPrice, DiamondStandardPrice, GemstoneStandardPrice, MakingChargesStandardPrice, TaxStandardPrice, MetalSalePrice, DiamondSalePrice, GemstoneSalePrice, MakingChargesSalePrice, TaxSalePrice, MaximumRetailPrice, IsSourcingOnDemand, PricingStrategy, MinimumOrderAmount, MaximumOrderAmount, OrderIncrement, MSRPWithTax, StandardPricePointsPercent, SalePricePointsPercent}' is expected."
The order of the XML nodes is incorrect.
WRONG:
<Sale> <BusinessPrice> <MinimumSellerAllowedPrice> <MaximumSellerAllowedPrice>
RIGHT:
<BusinessPrice> <MinimumSellerAllowedPrice> <MaximumSellerAllowedPrice> <Sale>
EXAMPLE:
WRONG:
<Message> <MessageID>1</MessageID> <OperationType>Update</OperationType> <Price> <SKU>SKU</SKU> <StandardPrice currency="EUR">16.90</StandardPrice> <Sale> <StartDate>2024-01-15T00:00:00.000Z</StartDate> <EndDate>2024-02-29T00:00:00.000Z</EndDate> <SalePrice currency="EUR">10.99</SalePrice> </Sale> <BusinessPrice>16.90</BusinessPrice> <MinimumSellerAllowedPrice currency="EUR">10,99</MinimumSellerAllowedPrice> <MaximumSellerAllowedPrice currency="EUR">16,90</MaximumSellerAllowedPrice> </Price> </Message>
RIGHT:
<Message> <MessageID>1</MessageID> <OperationType>Update</OperationType> <Price> <SKU>SKU</SKU> <StandardPrice currency="EUR">16.90</StandardPrice> <BusinessPrice>16.90</BusinessPrice> <MinimumSellerAllowedPrice currency="EUR">10,99</MinimumSellerAllowedPrice> <MaximumSellerAllowedPrice currency="EUR">16,90</MaximumSellerAllowedPrice> <Sale> <StartDate>2024-01-15T00:00:00.000Z</StartDate> <EndDate>2024-02-29T00:00:00.000Z</EndDate> <SalePrice currency="EUR">10.99</SalePrice> </Sale> </Price> </Message>
Maybe a solution is to change the order of:
namespace FikaAmazonAPI.ConstructFeed.Messages { public class PriceMessage { public PriceMessage(); public string SKU { get; set; } public StandardPrice StandardPrice { get; set; } public Sale Sale { get; set; } public decimal BusinessPrice { get; set; } public StandardPrice MinimumSellerAllowedPrice { get; set; } public StandardPrice MaximumSellerAllowedPrice { get; set; } } }
to
namespace FikaAmazonAPI.ConstructFeed.Messages { public class PriceMessage { public PriceMessage(); public string SKU { get; set; } public StandardPrice StandardPrice { get; set; } public decimal BusinessPrice { get; set; } public StandardPrice MinimumSellerAllowedPrice { get; set; } public StandardPrice MaximumSellerAllowedPrice { get; set; } public Sale Sale { get; set; } } }