MWS.pm untested

filter: Statementstmt 0.0% 0 / 1 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 0.0% 0 / 1 SCAR -
1 package Amazon::MWS;
2  
3 =head1 NAME
4  
5 Amazon::MWS - Perl interface to Amazon Marketplace Web Services
6  
7 =head1 VERSION
8  
9 0.150
10  
11 =cut
12  
13 our $VERSION = '0.150';
14  
15 =head1 DESCRIPTION
16  
17 See L<Amazon::MWS::Client> for the implementation of the low level
18 Amazon MWS API.
19  
20 For the high level methods provided by the L<Amazon::MWS::Uploader>
21 you are going to need to supply database storage.
22  
23 =head2 Uploading products
24  
25 Basically you take the products which need to be uploaded to Amazon
26 and create L<Amazon::MWS::XML::Product> objects from them:
27  
28 use Amazon::MWS::XML::Product;
29 use Amazon::MWS::Uploader;
30 use Try::Tiny;
31  
32 my @upload;
33  
34 foreach my $product_object (@send_to_amazon) {
35 my %prod = ....
36  
37 try {
38 my $product = Amazon::MWS::XML::Product->new(%prod);
39 push @upload, $product;
40 } catch {
41 warn "Failure with $prod{sku} : $_";
42 };
43 }
44  
45 Now you create an L<Amazon::MWS::XML::Uploader> object and do the
46 actual upload.
47  
48 my $uploader = Amazon::MWS::XML::Uploader->new(...);
49  
50 try {
51 $uploader->products(\@upload);
52 $uploader->upload;
53 } catch {
54 die "Uploader failure with: $_";
55 };
56  
57 A product upload goes through the following steps:
58  
59 =over 4
60  
61 =item product
62  
63 Basic product data.
64  
65 =item inventory
66  
67 Product inventory count (required).
68  
69 =item price
70  
71 Product price (required).
72  
73 =item image
74  
75 Product images (required).
76  
77 Please note that B<only http:// links> are allowed. If you pass https://
78 links, they will be rejected by Amazon.
79  
80 =item variants
81  
82 Product variants (optional).
83  
84 =back
85  
86 You are not by any means finished with the upload, see L</Resume uploads>.
87  
88 =head2 Delete products
89  
90 Deleting products is much more straightforward, but you have still to
91 care of tracking the upload process, see again L</Resume uploads>.
92  
93 my $uploader = Amazon::MWS::Uploader->new(...);
94 $uploader->delete_skus(@skus);
95  
96 =head2 Resume uploads
97  
98 This is necessary to check whether the upload has been
99 processed by Amazon.
100  
101 my $uploader = Amazon::MWS::XML::Uploader->new(...);
102 $uploader->resume;
103  
104 The uploader also goes automatically through the steps for the
105 product uploads.
106  
107 =head1 MWS in practice
108  
109 =head2 Product price
110  
111 Every product uploaded needs a price of 0.01 or higher, otherwise you
112 get the following error:
113  
114 0.00 price (standard or sales) will not be accepted.
115 Please ensure that every SKU in your feed has a price at least equal to or greater than 0.01
116  
117 =head2 Shipping costs
118  
119 You need to configure the shipping costs in Amazon Seller Central, you can't pass them
120 through MWS:
121  
122 L<https://sellercentral.amazon.com/gp/shipping/dispatch.html>
123  
124 =head2 Stuck uploads
125  
126 There is no guarantee that Amazon finishes your uploads at all. We had uploads
127 stuck for at least a week.
128  
129 =head2 Multiple marketplaces
130  
131 You can use this module and the uploader for multiple Amazon marketplaces.
132 Please make sure that you disable Amazon's synchronisation between marketplaces.
133  
134 For marketplaces with a different currency you need to convert your price first.
135  
136 The list of marketplaces can be found at:
137  
138 L<http://docs.developer.amazonservices.com/en_US/dev_guide/DG_Endpoints.html>
139  
140 =head2 Throttling and Quota
141  
142 With Amazon MWS you have to deal with Amazon throttling your uploads and
143 imposing quotas.
144  
145 Possible reasons:
146  
147 =over 4
148  
149 =item Upload too often
150  
151 =item Stuck uploads
152  
153 =item Orders with orderlines
154  
155 =back
156  
157 =head3 Throttle Reponse
158  
159 <?xml version="1.0"?>
160 <ErrorResponse xmlns="http://mws.amazonaws.com/doc/2009-01-01/">
161 <Error>
162 <Type></Type>
163 <Code>RequestThrottled</Code>
164 <Message>Request is throttled</Message>
165 </Error>
166 <RequestID>a7b39ee6-4f76-48ee-92f1-43bc54f693df</RequestID>
167 </ErrorResponse>
168  
169 =head3 Quota Exceeded Error Response
170  
171 <?xml version="1.0"?>
172 <ErrorResponse xmlns="http://mws.amazonaws.com/doc/2009-01-01/">
173 <Error>
174 <Type></Type>
175 <Code>QuotaExceeded</Code>
176 <Message>You exceeded your quota of 80.0 requests per 1 hour for operation Feeds/2009-01-01/GetFeedSubmissionList. Your quota will reset on Thu Dec 18 07:39:00 UTC 2014</Message>
177 </Error>
178 <RequestID>5115e00d-35a8-4589-8083-f0ef998f76ef</RequestID>
179 </ErrorResponse>
180  
181 =head2 Upload Errors
182  
183 =head3 Error 8572: Incorrect UPCs/EANs/...
184  
185 error: You are using UPCs, EANs, ISBNs, ASINs, or JAN codes
186 that do not match the products you are trying to list. Using incorrect UPCs,
187 EANs, ISBNs, ASINs or JAN codes is prohibited and it can result in your ASIN
188 creation privileges being suspended or permanently removed.
189  
190 This happened in our case with products having self assigned EAN codes, but
191 with a well known manufacturer. Apparently Amazon knows about the EAN ranges
192 for this manufacturer.
193  
194 =head3 Error 18181
195  
196 The format of the tracking number passed to Amazon was invalid, e.g.
197 wrong number of characters.
198  
199 =head3 Error 20013: Image file size
200  
201 error: Image file size: 13972730 bytes exceeds the the maximum allowed file size: 10485760 bytes.
202  
203 There is no point in using such big image files for Amazon.
204  
205 =head3 Error 99001: "brand_name"
206  
207 Brand is a required field for products.
208  
209 =head1 Uploader Module
210  
211 L<Amazon::MWS::Uploader> is an upload agent for Amazon::MWS.
212  
213 =head1 XML Modules
214  
215 =over 4
216  
217 =item Generic Feed
218  
219 L<Amazon::MWS::XML::GenericFeed>
220  
221 =item Feed
222  
223 L<Amazon::MWS::XML::Feed>
224  
225 =item Product
226  
227 L<Amazon::MWS::XML::Product>
228  
229 =item Address
230  
231 L<Amazon::MWS::XML::Address>
232  
233 =item Order
234  
235 L<Amazon::MWS::XML::Order>
236  
237 =item OrderlineItem
238  
239 L<Amazon::MWS::XML::OrderlineItem>
240  
241 =back
242  
243 =head1 ACKNOWLEDGEMENTS
244  
245 James Rinser (additional API methods).
246  
247 =head1 AUTHORS
248  
249 Paul Driver
250 Phil Smith
251 Marco Pessotto
252 Stefan Hornburg (Racke)
253  
254 =head2 COPYRIGHT
255  
256 This is free software; you can redistribute it and/or modify it under the same terms
257 as the Perl 5 programming language system itself.
258  
259 =cut
260  
261 1;