Skip to content

Commit 0527d0e

Browse files
committed
rebase
2 parents 803451e + e4e1552 commit 0527d0e

File tree

6 files changed

+94
-145
lines changed

6 files changed

+94
-145
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ AmazonConnection amazonConnection = new AmazonConnection(new AmazonCredential()
112112

113113
```
114114

115-
### Order List, For more orders sample please check [Here](https://github.com/abuzuhri/Amazon-SP-API-CSharp/blob/main/Source/FikaAmazonAPI.Test/Reports.cs).
115+
### Order List, For more orders sample please check [Here](https://github.com/abuzuhri/Amazon-SP-API-CSharp/blob/main/Source/FikaAmazonAPI.SampleCode/ReportsSample.cs).
116116
```CSharp
117117
ParameterOrderList serachOrderList = new ParameterOrderList();
118118
serachOrderList.CreatedAfter = DateTime.UtcNow.AddMinutes(-600000);
@@ -184,7 +184,7 @@ var orders = amazonConnection.Orders.GetOrders
184184
);
185185
```
186186

187-
### Report List, For more report sample please check [Here](https://github.com/abuzuhri/Amazon-SP-API-CSharp/blob/main/Source/FikaAmazonAPI.Test/Orders.cs).
187+
### Report List, For more report sample please check [Here](https://github.com/abuzuhri/Amazon-SP-API-CSharp/blob/main/Source/FikaAmazonAPI.SampleCode/OrdersSample.cs).
188188
```CSharp
189189
var parameters = new ParameterReportList();
190190
parameters.pageSize = 100;
@@ -301,7 +301,7 @@ var data = await amazonConnection.CatalogItem.SearchCatalogItems202204Async(
301301

302302

303303

304-
### Product Pricing, For more Pricing sample please check [Here](https://github.com/abuzuhri/Amazon-SP-API-CSharp/blob/main/Source/FikaAmazonAPI.Test/ProductPricing.cs).
304+
### Product Pricing, For more Pricing sample please check [Here](https://github.com/abuzuhri/Amazon-SP-API-CSharp/blob/main/Source/FikaAmazonAPI.SampleCode/ProductPricingSample.cs).
305305
```CSharp
306306

307307
var data = amazonConnection.ProductPricing.GetPricing(
@@ -325,7 +325,7 @@ var data = amazonConnection.ProductPricing.GetCompetitivePricing(
325325
```
326326

327327

328-
### Notifications Create Destination, For more Notifications sample please check [Here](https://github.com/abuzuhri/Amazon-SP-API-CSharp/blob/main/Source/FikaAmazonAPI.Test/Notifications.cs).
328+
### Notifications Create Destination, For more Notifications sample please check [Here](https://github.com/abuzuhri/Amazon-SP-API-CSharp/blob/main/Source/FikaAmazonAPI.SampleCode/NotificationsSample.cs).
329329
```CSharp
330330

331331
//EventBridge
@@ -351,7 +351,7 @@ var dataSqs = amazonConnection.Notification.CreateDestination(
351351
});
352352
```
353353

354-
### Notifications Create Subscription, For more Notifications sample please check [Here](https://github.com/abuzuhri/Amazon-SP-API-CSharp/blob/main/Source/FikaAmazonAPI.Test/Notifications.cs).
354+
### Notifications Create Subscription, For more Notifications sample please check [Here](https://github.com/abuzuhri/Amazon-SP-API-CSharp/blob/main/Source/FikaAmazonAPI.SampleCode/NotificationsSample.cs).
355355
```CSharp
356356

357357
//SQS
@@ -396,7 +396,7 @@ public class CustomMessageReceiver : IMessageReceiver
396396
Here full sample for submit feed to change price and generate XML and get final report for result same as in [doc](https://github.com/amzn/selling-partner-api-docs/blob/main/guides/en-US/use-case-guides/feeds-api-use-case-guide/feeds-api-use-case-guide_2021-06-30.md).
397397
Notes: not all [feed type](https://github.com/amzn/selling-partner-api-docs/blob/main/references/feeds-api/feedtype-values.md) finished as it's big work and effort but all classes are partial for easy change and you can generate XML outside and use our library to get data, now we support only submit existing product, change quantity and change price , I list most of XSD here Source\FikaAmazonAPI\ConstructFeed\xsd its will help you easy generate class and add it in your app to generate final feed xml.
398398

399-
#### Feed Submit for change price
399+
#### Feed Submit for change price , For more Feed sample please check [Here](https://github.com/abuzuhri/Amazon-SP-API-CSharp/blob/main/Source/FikaAmazonAPI.SampleCode/FeedsSample.cs).
400400
```CSharp
401401
ConstructFeedService createDocument = new ConstructFeedService("{SellerID}", "1.02");
402402

Source/FikaAmazonAPI.SampleCode/FeedsSample.cs

Lines changed: 51 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,14 @@ public void SubmitFeedInventory()
8686
var list = new List<InventoryMessage>();
8787
list.Add(new InventoryMessage()
8888
{
89-
SKU = "8432225129778...",
90-
Quantity = 0,
91-
FulfillmentLatency = "2",
89+
SKU = "API.853038006021.20789.1001",
90+
Quantity = 1
9291
});
9392
createDocument.AddInventoryMessage(list);
9493
var xml = createDocument.GetXML();
9594

9695
var feedID = amazonConnection.Feed.SubmitFeed(xml, FeedType.POST_INVENTORY_AVAILABILITY_DATA);
97-
96+
GetFeedDetails(feedID);
9897
}
9998

10099
/// <summary>
@@ -119,42 +118,9 @@ public void SubmitFeedAddProductMessage()
119118

120119
var feedID = amazonConnection.Feed.SubmitFeed(xml, FeedType.POST_PRODUCT_DATA);
121120

122-
123-
string ResultFeedDocumentId = string.Empty;
124-
while (string.IsNullOrEmpty(ResultFeedDocumentId))
125-
{
126-
var feedOutput = amazonConnection.Feed.GetFeed(feedID);
127-
if (feedOutput.ProcessingStatus == Feed.ProcessingStatusEnum.DONE)
128-
{
129-
var outPut = amazonConnection.Feed.GetFeedDocument(feedOutput.ResultFeedDocumentId);
130-
131-
var reportOutput = outPut.Url;
132-
133-
var processingReport = amazonConnection.Feed.GetFeedDocumentProcessingReport(reportOutput);
134-
135-
Console.WriteLine("Amazon KSA Change Price");
136-
Console.WriteLine("MessagesProcessed=" + processingReport.ProcessingSummary.MessagesProcessed);
137-
Console.WriteLine("MessagesSuccessful= " + processingReport.ProcessingSummary.MessagesSuccessful);
138-
Console.WriteLine("MessagesWithError=" + processingReport.ProcessingSummary.MessagesWithError);
139-
Console.WriteLine("MessagesWithWarning=" + processingReport.ProcessingSummary.MessagesWithWarning);
140-
141-
if (processingReport.Result != null && processingReport.Result.Count > 0)
142-
{
143-
foreach (var itm in processingReport.Result)
144-
{
145-
Console.WriteLine("ResultDescription=" + itm.AdditionalInfo?.SKU ?? string.Empty + " > " + itm.ResultDescription);
146-
}
147-
}
148-
149-
break;
150-
}
151-
152-
if (!(feedOutput.ProcessingStatus == Feed.ProcessingStatusEnum.INPROGRESS ||
153-
feedOutput.ProcessingStatus == Feed.ProcessingStatusEnum.INQUEUE))
154-
break;
155-
else Thread.Sleep(10000);
156-
}
121+
GetFeedDetails(feedID);
157122
}
123+
158124
public async void SubmitFeedPRICING(double PRICE, string SKU)
159125
{
160126

@@ -176,32 +142,7 @@ public async void SubmitFeedPRICING(double PRICE, string SKU)
176142

177143
var feedID = await amazonConnection.Feed.SubmitFeedAsync(xml, FeedType.POST_PRODUCT_PRICING_DATA);
178144

179-
string ResultFeedDocumentId = string.Empty;
180-
while (string.IsNullOrEmpty(ResultFeedDocumentId))
181-
{
182-
var feedOutput = await amazonConnection.Feed.GetFeedAsync(feedID);
183-
if (feedOutput.ProcessingStatus == AmazonSpApiSDK.Models.Feeds.Feed.ProcessingStatusEnum.DONE)
184-
{
185-
var outPut = await amazonConnection.Feed.GetFeedDocumentAsync(feedOutput.ResultFeedDocumentId);
186-
187-
var reportOutput = outPut.Url;
188-
189-
var processingReport = await amazonConnection.Feed.GetFeedDocumentProcessingReportAsync(reportOutput);
190-
191-
Console.WriteLine("MessagesProcessed=" + processingReport.ProcessingSummary.MessagesProcessed);
192-
Console.WriteLine("MessagesSuccessful= " + processingReport.ProcessingSummary.MessagesSuccessful);
193-
Console.WriteLine("MessagesWithError=" + processingReport.ProcessingSummary.MessagesWithError);
194-
Console.WriteLine("MessagesWithWarning=" + processingReport.ProcessingSummary.MessagesWithWarning);
195-
Console.WriteLine("ResultDescription=" + processingReport.Result.FirstOrDefault()?.ResultDescription);
196-
}
197-
198-
if (!(feedOutput.ProcessingStatus == AmazonSpApiSDK.Models.Feeds.Feed.ProcessingStatusEnum.INPROGRESS ||
199-
feedOutput.ProcessingStatus == AmazonSpApiSDK.Models.Feeds.Feed.ProcessingStatusEnum.INQUEUE))
200-
break;
201-
else Thread.Sleep(10000);
202-
}
203-
204-
145+
GetFeedDetails(feedID);
205146

206147
}
207148

@@ -229,9 +170,7 @@ public void FeebPostOrderFullfillment()
229170
var feedID = amazonConnection.Feed.SubmitFeed(xml, FeedType.POST_ORDER_FULFILLMENT_DATA);
230171

231172

232-
var feedOutput = amazonConnection.Feed.GetFeed(feedID);
233-
var outPut = amazonConnection.Feed.GetFeedDocument(feedOutput.ResultFeedDocumentId);
234-
var processingReport = amazonConnection.Feed.GetFeedDocumentProcessingReport(outPut.Url);
173+
GetFeedDetails(feedID);
235174
}
236175

237176
public void SubmitFeedOrderAcknowledgement()
@@ -254,6 +193,7 @@ public void SubmitFeedOrderAcknowledgement()
254193
var xml = createDocument.GetXML();
255194

256195
var feedID = amazonConnection.Feed.SubmitFeed(xml, FeedType.POST_ORDER_ACKNOWLEDGEMENT_DATA);
196+
GetFeedDetails(feedID);
257197
}
258198

259199
public void SubmitFeedOrderAdjustment()
@@ -291,6 +231,7 @@ public void SubmitFeedOrderAdjustment()
291231
var xml = createDocument.GetXML();
292232

293233
var feedID = amazonConnection.Feed.SubmitFeed(xml, FeedType.POST_PAYMENT_ADJUSTMENT_DATA);
234+
GetFeedDetails(feedID);
294235
}
295236

296237
public void CartonContentsRequestFeed()
@@ -331,6 +272,48 @@ public void CartonContentsRequestFeed()
331272
var xml222 = createDocument2.GetXML();
332273

333274
var feedID = amazonConnection.Feed.SubmitFeed(xml222, FeedType.POST_FBA_INBOUND_CARTON_CONTENTS);
275+
GetFeedDetails(feedID);
276+
}
277+
278+
private void GetFeedDetails(string feedID)
279+
{
280+
string ResultFeedDocumentId = string.Empty;
281+
while (string.IsNullOrEmpty(ResultFeedDocumentId))
282+
{
283+
var feedOutput = amazonConnection.Feed.GetFeed(feedID);
284+
if (feedOutput.ProcessingStatus == Feed.ProcessingStatusEnum.DONE)
285+
{
286+
var outPut = amazonConnection.Feed.GetFeedDocument(feedOutput.ResultFeedDocumentId);
287+
288+
var reportOutput = outPut.Url;
289+
290+
var processingReport = amazonConnection.Feed.GetFeedDocumentProcessingReport(outPut);
291+
292+
DisplayProcessingReportMessage(processingReport);
293+
294+
break;
295+
}
296+
297+
if (!(feedOutput.ProcessingStatus == Feed.ProcessingStatusEnum.INPROGRESS ||
298+
feedOutput.ProcessingStatus == Feed.ProcessingStatusEnum.INQUEUE))
299+
break;
300+
else Thread.Sleep(10000);
301+
}
302+
}
303+
private void DisplayProcessingReportMessage(ProcessingReportMessage processingReport)
304+
{
305+
Console.WriteLine("MessagesProcessed=" + processingReport.ProcessingSummary.MessagesProcessed);
306+
Console.WriteLine("MessagesSuccessful= " + processingReport.ProcessingSummary.MessagesSuccessful);
307+
Console.WriteLine("MessagesWithError=" + processingReport.ProcessingSummary.MessagesWithError);
308+
Console.WriteLine("MessagesWithWarning=" + processingReport.ProcessingSummary.MessagesWithWarning);
309+
310+
if (processingReport.Result != null && processingReport.Result.Count > 0)
311+
{
312+
foreach (var itm in processingReport.Result)
313+
{
314+
Console.WriteLine("ResultDescription=" + itm.AdditionalInfo?.SKU ?? string.Empty + " > " + itm.ResultDescription);
315+
}
316+
}
334317
}
335318
}
336319
}

Source/FikaAmazonAPI.SampleCode/Program.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ static async Task Main(string[] args)
4646

4747
var offfers = amazonConnection.ProductPricing.GetItemOffers(new Parameter.ProductPricing.ParameterGetItemOffers
4848
{
49-
Asin = "B07WYJF6KJ"
49+
Asin = "B0000512CU",
50+
CustomerType=CustomerType.Business,
51+
ItemCondition = ItemCondition.New,
5052
});
5153

5254

Source/FikaAmazonAPI/AmazonSpApiSDK/Models/ProductPricing/QuantityDiscountPriceType.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public QuantityDiscountPriceType() { }
4242
/// <param name="quantityTier">Indicates at what quantity this price becomes active. (required).</param>
4343
/// <param name="quantityDiscountType">Indicates the type of quantity discount this price applies to. (required).</param>
4444
/// <param name="listingPrice">The price at this quantity tier. (required).</param>
45-
public QuantityDiscountPriceType(int? quantityTier = default(int?), QuantityDiscountType quantityDiscountType = default(QuantityDiscountType), MoneyType listingPrice = default(MoneyType))
45+
public QuantityDiscountPriceType(int? quantityTier = default(int?), QuantityDiscountType quantityDiscountType = default(QuantityDiscountType), MoneyType price = default(MoneyType))
4646
{
4747
// to ensure "quantityTier" is required (not null)
4848
if (quantityTier == null)
@@ -63,13 +63,13 @@ public QuantityDiscountPriceType() { }
6363
this.QuantityDiscountType = quantityDiscountType;
6464
}
6565
// to ensure "listingPrice" is required (not null)
66-
if (listingPrice == null)
66+
if (price == null)
6767
{
6868
throw new InvalidDataException("listingPrice is a required property for QuantityDiscountPriceType and cannot be null");
6969
}
7070
else
7171
{
72-
this.ListingPrice = listingPrice;
72+
this.Price = price;
7373
}
7474
}
7575

@@ -85,8 +85,8 @@ public QuantityDiscountPriceType() { }
8585
/// The price at this quantity tier.
8686
/// </summary>
8787
/// <value>The price at this quantity tier.</value>
88-
[DataMember(Name="listingPrice", EmitDefaultValue=false)]
89-
public MoneyType ListingPrice { get; set; }
88+
[DataMember(Name= "price", EmitDefaultValue=false)]
89+
public MoneyType Price { get; set; }
9090

9191
/// <summary>
9292
/// Returns the string presentation of the object
@@ -98,7 +98,7 @@ public override string ToString()
9898
sb.Append("class QuantityDiscountPriceType {\n");
9999
sb.Append(" QuantityTier: ").Append(QuantityTier).Append("\n");
100100
sb.Append(" QuantityDiscountType: ").Append(QuantityDiscountType).Append("\n");
101-
sb.Append(" ListingPrice: ").Append(ListingPrice).Append("\n");
101+
sb.Append(" ListingPrice: ").Append(Price).Append("\n");
102102
sb.Append("}\n");
103103
return sb.ToString();
104104
}
@@ -144,9 +144,9 @@ public bool Equals(QuantityDiscountPriceType input)
144144
this.QuantityDiscountType.Equals(input.QuantityDiscountType))
145145
) &&
146146
(
147-
this.ListingPrice == input.ListingPrice ||
148-
(this.ListingPrice != null &&
149-
this.ListingPrice.Equals(input.ListingPrice))
147+
this.Price == input.Price ||
148+
(this.Price != null &&
149+
this.Price.Equals(input.Price))
150150
);
151151
}
152152

@@ -163,8 +163,8 @@ public override int GetHashCode()
163163
hashCode = hashCode * 59 + this.QuantityTier.GetHashCode();
164164
if (this.QuantityDiscountType != null)
165165
hashCode = hashCode * 59 + this.QuantityDiscountType.GetHashCode();
166-
if (this.ListingPrice != null)
167-
hashCode = hashCode * 59 + this.ListingPrice.GetHashCode();
166+
if (this.Price != null)
167+
hashCode = hashCode * 59 + this.Price.GetHashCode();
168168
return hashCode;
169169
}
170170
}

Source/FikaAmazonAPI/FikaAmazonAPI.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
<Product>CSharp Amazon Sp API</Product>
88
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
99
<LangVersion>8.0</LangVersion>
10-
<Version>1.5.17</Version>
11-
<AssemblyVersion>1.5.17</AssemblyVersion>
12-
<FileVersion>1.5.17</FileVersion>
10+
<Version>1.5.19</Version>
11+
<AssemblyVersion>1.5.19</AssemblyVersion>
12+
<FileVersion>1.5.19</FileVersion>
1313
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
1414
<PackageProjectUrl>https://github.com/abuzuhri/Amazon-SP-API-CSharp</PackageProjectUrl>
1515
<PackageLicenseExpression>MIT</PackageLicenseExpression>

0 commit comments

Comments
 (0)