line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Amazon::MWS::Products; |
2
|
|
|
|
|
|
|
|
3
|
8
|
|
|
8
|
|
44
|
use Amazon::MWS::Routines qw(:all); |
|
8
|
|
|
|
|
15
|
|
|
8
|
|
|
|
|
8635
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
my $version = '2011-10-01'; |
6
|
|
|
|
|
|
|
my $products_service = "/Products/$version"; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
define_api_method GetServiceStatus => |
9
|
|
|
|
|
|
|
raw_body => 0, |
10
|
|
|
|
|
|
|
version => $version, |
11
|
|
|
|
|
|
|
service => "$products_service", |
12
|
|
|
|
|
|
|
parameters => {}, |
13
|
|
|
|
|
|
|
respond => sub { |
14
|
|
|
|
|
|
|
my $root = shift; |
15
|
|
|
|
|
|
|
return $root->{Status}; |
16
|
|
|
|
|
|
|
}; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
define_api_method ListMatchingProducts => |
19
|
|
|
|
|
|
|
raw_body => 0, |
20
|
|
|
|
|
|
|
service => "$products_service", |
21
|
|
|
|
|
|
|
version => $version, |
22
|
|
|
|
|
|
|
parameters => { |
23
|
|
|
|
|
|
|
Query => { |
24
|
|
|
|
|
|
|
type => 'string', |
25
|
|
|
|
|
|
|
required => 1 |
26
|
|
|
|
|
|
|
}, |
27
|
|
|
|
|
|
|
MarketplaceId => { type => 'string', required=>1 }, |
28
|
|
|
|
|
|
|
}, |
29
|
|
|
|
|
|
|
respond => sub { |
30
|
|
|
|
|
|
|
my $root = shift; |
31
|
|
|
|
|
|
|
# unclear if we can get an array here. TODO. |
32
|
|
|
|
|
|
|
return $root->{Products}->{Product}; |
33
|
|
|
|
|
|
|
}; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
define_api_method GetMatchingProduct => |
36
|
|
|
|
|
|
|
raw_body => 1, |
37
|
|
|
|
|
|
|
service => "$products_service", |
38
|
|
|
|
|
|
|
version => $version, |
39
|
|
|
|
|
|
|
parameters => { |
40
|
|
|
|
|
|
|
ASINList => { |
41
|
|
|
|
|
|
|
type => 'ASINList', |
42
|
|
|
|
|
|
|
required => 1 |
43
|
|
|
|
|
|
|
}, |
44
|
|
|
|
|
|
|
MarketplaceId => { type => 'string', required=>1 }, |
45
|
|
|
|
|
|
|
}; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
define_api_method GetMatchingProductForId => |
48
|
|
|
|
|
|
|
raw_body => 0, |
49
|
|
|
|
|
|
|
service => $products_service, |
50
|
|
|
|
|
|
|
version => $version, |
51
|
|
|
|
|
|
|
parameters => { |
52
|
|
|
|
|
|
|
MarketplaceId => { |
53
|
|
|
|
|
|
|
type => 'string', |
54
|
|
|
|
|
|
|
required => 1 |
55
|
|
|
|
|
|
|
}, |
56
|
|
|
|
|
|
|
IdType => { |
57
|
|
|
|
|
|
|
type => 'string', |
58
|
|
|
|
|
|
|
required => 1 |
59
|
|
|
|
|
|
|
}, |
60
|
|
|
|
|
|
|
IdList => { |
61
|
|
|
|
|
|
|
type => 'IdList', |
62
|
|
|
|
|
|
|
required => 1, |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
}, |
65
|
|
|
|
|
|
|
respond => sub { |
66
|
|
|
|
|
|
|
my $root = shift; |
67
|
|
|
|
|
|
|
return unless $root; # failed totally |
68
|
|
|
|
|
|
|
if (ref($root) ne 'ARRAY') { |
69
|
|
|
|
|
|
|
return [ $root ]; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
else { |
72
|
|
|
|
|
|
|
return $root; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
}; |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
define_api_method GetMyFeesEstimate => |
77
|
|
|
|
|
|
|
raw_body => 0, |
78
|
|
|
|
|
|
|
service => $products_service, |
79
|
|
|
|
|
|
|
version => $version, |
80
|
|
|
|
|
|
|
parameters => { |
81
|
|
|
|
|
|
|
'FeesEstimateRequestList' => { |
82
|
|
|
|
|
|
|
required => 1, |
83
|
|
|
|
|
|
|
array_names => ['MarketplaceId','IdType','IdValue','IsAmazonFulfilled','Identifier', |
84
|
|
|
|
|
|
|
'PriceToEstimateFees.ListingPrice.Amount', 'PriceToEstimateFees.ListingPrice.CurrencyCode', |
85
|
|
|
|
|
|
|
'PriceToEstimateFees.Shipping.Amount', 'PriceToEstimateFees.Shipping.CurrencyCode', |
86
|
|
|
|
|
|
|
'PriceToEstimateFees.Points.PointsNumber'], |
87
|
|
|
|
|
|
|
type => 'FeesEstimateRequestArray', |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
}, |
90
|
|
|
|
|
|
|
}, |
91
|
|
|
|
|
|
|
respond => sub { |
92
|
|
|
|
|
|
|
my $root = shift; |
93
|
|
|
|
|
|
|
return unless $root; # failed totally |
94
|
|
|
|
|
|
|
if (ref($root) ne 'ARRAY') { |
95
|
|
|
|
|
|
|
return [ $root ]; |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
else { |
98
|
|
|
|
|
|
|
return $root; |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
}; |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
define_api_method GetLowestOfferListingsForSKU => |
103
|
|
|
|
|
|
|
raw_body => 0, |
104
|
|
|
|
|
|
|
service => "$products_service", |
105
|
|
|
|
|
|
|
version => $version, |
106
|
|
|
|
|
|
|
parameters => { |
107
|
|
|
|
|
|
|
SellerSKUList => { |
108
|
|
|
|
|
|
|
type => 'SellerSKUList', |
109
|
|
|
|
|
|
|
required => 1 |
110
|
|
|
|
|
|
|
}, |
111
|
|
|
|
|
|
|
MarketplaceId => { type => 'string', required=>1 }, |
112
|
|
|
|
|
|
|
ItemCondition => { type => 'List', values=>['Any', 'New', 'Used', 'Collectible', 'Refurbished', 'Club'], |
113
|
|
|
|
|
|
|
required => 0 }, |
114
|
|
|
|
|
|
|
ExcludeMe => { type => 'boolean' }, |
115
|
|
|
|
|
|
|
}, |
116
|
|
|
|
|
|
|
respond => \&_convert_lowest_offers_listing; |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
define_api_method GetLowestOfferListingsForASIN => |
119
|
|
|
|
|
|
|
raw_body => 0, |
120
|
|
|
|
|
|
|
service => "$products_service", |
121
|
|
|
|
|
|
|
version => $version, |
122
|
|
|
|
|
|
|
parameters => { |
123
|
|
|
|
|
|
|
ASINList => { |
124
|
|
|
|
|
|
|
type => 'ASINList', |
125
|
|
|
|
|
|
|
required => 1 |
126
|
|
|
|
|
|
|
}, |
127
|
|
|
|
|
|
|
MarketplaceId => { type => 'string', required=>1 }, |
128
|
|
|
|
|
|
|
ItemCondition => { type => 'List', values=>['Any', 'New', 'Used', 'Collectible', 'Refurbished', 'Club'], |
129
|
|
|
|
|
|
|
required => 0 }, |
130
|
|
|
|
|
|
|
ExcludeMe => { type => 'boolean' }, |
131
|
|
|
|
|
|
|
}, |
132
|
|
|
|
|
|
|
respond => \&_convert_lowest_offers_listing; |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
define_api_method GetCompetitivePricingForSKU => |
136
|
|
|
|
|
|
|
raw_body => 1, |
137
|
|
|
|
|
|
|
service => "$products_service", |
138
|
|
|
|
|
|
|
version => $version, |
139
|
|
|
|
|
|
|
parameters => { |
140
|
|
|
|
|
|
|
SellerSKUList => { |
141
|
|
|
|
|
|
|
type => 'SellerSKUList', |
142
|
|
|
|
|
|
|
required => 1 |
143
|
|
|
|
|
|
|
}, |
144
|
|
|
|
|
|
|
MarketplaceId => { type => 'string', required=>1 }, |
145
|
|
|
|
|
|
|
}; |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
define_api_method GetCompetitivePricingForASIN => |
148
|
|
|
|
|
|
|
raw_body => 1, |
149
|
|
|
|
|
|
|
service => "$products_service", |
150
|
|
|
|
|
|
|
version => $version, |
151
|
|
|
|
|
|
|
parameters => { |
152
|
|
|
|
|
|
|
ASINList => { |
153
|
|
|
|
|
|
|
type => 'ASINList', |
154
|
|
|
|
|
|
|
required => 1 |
155
|
|
|
|
|
|
|
}, |
156
|
|
|
|
|
|
|
MarketplaceId => { type => 'string', required=>1 }, |
157
|
|
|
|
|
|
|
}; |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
define_api_method GetLowestPricedOffersForSKU => |
160
|
|
|
|
|
|
|
raw_body => 1, |
161
|
|
|
|
|
|
|
service => "$products_service", |
162
|
|
|
|
|
|
|
version => $version, |
163
|
|
|
|
|
|
|
parameters => { |
164
|
|
|
|
|
|
|
SellerSKU => { |
165
|
|
|
|
|
|
|
type => 'string', |
166
|
|
|
|
|
|
|
required => 1 |
167
|
|
|
|
|
|
|
}, |
168
|
|
|
|
|
|
|
MarketplaceId => { type => 'string', required=>1 }, |
169
|
|
|
|
|
|
|
ItemCondition => { type => 'List', values=>['Any', 'New', 'Used', 'Collectible', 'Refurbished', 'Club'], |
170
|
|
|
|
|
|
|
required => 1 }, |
171
|
|
|
|
|
|
|
}; |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
define_api_method GetLowestPricedOffersForASIN => |
174
|
|
|
|
|
|
|
raw_body => 1, |
175
|
|
|
|
|
|
|
service => "$products_service", |
176
|
|
|
|
|
|
|
version => $version, |
177
|
|
|
|
|
|
|
parameters => { |
178
|
|
|
|
|
|
|
ASIN => { |
179
|
|
|
|
|
|
|
type => 'string', |
180
|
|
|
|
|
|
|
required => 1 |
181
|
|
|
|
|
|
|
}, |
182
|
|
|
|
|
|
|
MarketplaceId => { type => 'string', required=>1 }, |
183
|
|
|
|
|
|
|
ItemCondition => { type => 'List', values=>['Any', 'New', 'Used', 'Collectible', 'Refurbished', 'Club'], |
184
|
|
|
|
|
|
|
required => 1 }, |
185
|
|
|
|
|
|
|
}; |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
define_api_method GetMyPriceForSKU => |
188
|
|
|
|
|
|
|
raw_body => 1, |
189
|
|
|
|
|
|
|
service => "$products_service", |
190
|
|
|
|
|
|
|
version => $version, |
191
|
|
|
|
|
|
|
parameters => { |
192
|
|
|
|
|
|
|
SellerSKUList => { |
193
|
|
|
|
|
|
|
type => 'SellerSKUList', |
194
|
|
|
|
|
|
|
required => 1 |
195
|
|
|
|
|
|
|
}, |
196
|
|
|
|
|
|
|
MarketplaceId => { type => 'string', required=>1 }, |
197
|
|
|
|
|
|
|
ItemCondition => { type => 'List', values=>['Any', 'New', 'Used', 'Collectible', 'Refurbished', 'Club'], |
198
|
|
|
|
|
|
|
required => 0 }, |
199
|
|
|
|
|
|
|
}; |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
define_api_method GetMyPriceForASIN => |
202
|
|
|
|
|
|
|
raw_body => 1, |
203
|
|
|
|
|
|
|
service => "$products_service", |
204
|
|
|
|
|
|
|
version => $version, |
205
|
|
|
|
|
|
|
parameters => { |
206
|
|
|
|
|
|
|
ASINList => { |
207
|
|
|
|
|
|
|
type => 'ASINList', |
208
|
|
|
|
|
|
|
required => 1 |
209
|
|
|
|
|
|
|
}, |
210
|
|
|
|
|
|
|
MarketplaceId => { type => 'string', required=>1 }, |
211
|
|
|
|
|
|
|
ItemCondition => { type => 'List', values=>['Any', 'New', 'Used', 'Collectible', 'Refurbished', 'Club'], |
212
|
|
|
|
|
|
|
required => 0 }, |
213
|
|
|
|
|
|
|
}; |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
define_api_method GetProductCategoriesForSKU => |
216
|
|
|
|
|
|
|
raw_body => 1, |
217
|
|
|
|
|
|
|
service => "$products_service", |
218
|
|
|
|
|
|
|
version => $version, |
219
|
|
|
|
|
|
|
parameters => { |
220
|
|
|
|
|
|
|
SellerSKU => { |
221
|
|
|
|
|
|
|
type => 'string', |
222
|
|
|
|
|
|
|
required => 1 |
223
|
|
|
|
|
|
|
}, |
224
|
|
|
|
|
|
|
MarketplaceId => { type => 'string', required=>1 }, |
225
|
|
|
|
|
|
|
}; |
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
define_api_method GetProductCategoriesForASIN => |
228
|
|
|
|
|
|
|
raw_body => 0, |
229
|
|
|
|
|
|
|
service => "$products_service", |
230
|
|
|
|
|
|
|
version => $version, |
231
|
|
|
|
|
|
|
parameters => { |
232
|
|
|
|
|
|
|
ASIN => { |
233
|
|
|
|
|
|
|
type => 'string', |
234
|
|
|
|
|
|
|
required => 1 |
235
|
|
|
|
|
|
|
}, |
236
|
|
|
|
|
|
|
MarketplaceId => { type => 'string', required=>1 }, |
237
|
|
|
|
|
|
|
}, |
238
|
|
|
|
|
|
|
respond => sub { |
239
|
|
|
|
|
|
|
my $root = shift; |
240
|
|
|
|
|
|
|
force_array($root, 'Self'); |
241
|
|
|
|
|
|
|
return $root->{Self}; |
242
|
|
|
|
|
|
|
}; |
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
sub _convert_lowest_offers_listing { |
245
|
0
|
|
|
0
|
|
|
my $root = shift; |
246
|
0
|
0
|
|
|
|
|
return [] unless $root; |
247
|
|
|
|
|
|
|
# here basically we cut out the info we sent and get only the listings. |
248
|
0
|
0
|
|
|
|
|
if (my $listing = $root->{Product}->{LowestOfferListings}->{LowestOfferListing}) { |
249
|
0
|
0
|
|
|
|
|
if (ref($listing) ne 'ARRAY') { |
250
|
0
|
|
|
|
|
|
return [ $listing ]; |
251
|
|
|
|
|
|
|
} |
252
|
|
|
|
|
|
|
else { |
253
|
0
|
|
|
|
|
|
return $listing; |
254
|
|
|
|
|
|
|
} |
255
|
|
|
|
|
|
|
} |
256
|
|
|
|
|
|
|
else { |
257
|
0
|
|
|
|
|
|
return []; |
258
|
|
|
|
|
|
|
} |
259
|
|
|
|
|
|
|
} |
260
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
1; |
263
|
|
|
|
|
|
|
|