Skip to content

Commit

Permalink
Fix bug #127
Browse files Browse the repository at this point in the history
  • Loading branch information
abuzuhri committed Mar 4, 2022
1 parent d99fe43 commit 56a1212
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Source/FikaAmazonAPI/Services/OrderService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,22 @@ public async Task<OrderList> GetOrdersAsync(ParameterOrderList searchOrderList)
orderList = response.Payload.Orders;
while (!string.IsNullOrEmpty(nextToken))
{
var orderPayload = GetGetOrdersByNextToken(nextToken, searchOrderList.MarketplaceIds);
var orderPayload = GetGetOrdersByNextToken(nextToken, searchOrderList);
orderList.AddRange(orderPayload.Orders);
nextToken = orderPayload.NextToken;
}
return orderList;
}

public OrdersList GetGetOrdersByNextToken(string nextToken, IList<string> marketplaceIds) =>
Task.Run(() => GetGetOrdersByNextTokenAsync(nextToken, marketplaceIds)).ConfigureAwait(false).GetAwaiter().GetResult();
public async Task<OrdersList> GetGetOrdersByNextTokenAsync(string nextToken, IList<string> marketplaceIds)
public OrdersList GetGetOrdersByNextToken(string nextToken, ParameterOrderList searchOrderList) =>
Task.Run(() => GetGetOrdersByNextTokenAsync(nextToken, searchOrderList)).ConfigureAwait(false).GetAwaiter().GetResult();
public async Task<OrdersList> GetGetOrdersByNextTokenAsync(string nextToken, ParameterOrderList searchOrderList)
{
List<KeyValuePair<string, string>> queryParameters = new List<KeyValuePair<string, string>>();
queryParameters.Add(new KeyValuePair<string, string>("NextToken", nextToken));
queryParameters.Add(new KeyValuePair<string, string>("MarketplaceIds", string.Join(",", marketplaceIds)));
queryParameters.Add(new KeyValuePair<string, string>("MarketplaceIds", string.Join(",", searchOrderList.MarketplaceIds)));

await CreateAuthorizedRequestAsync(OrdersApiUrls.Orders, RestSharp.Method.GET, queryParameters);
await CreateAuthorizedRequestAsync(OrdersApiUrls.Orders, RestSharp.Method.GET, queryParameters, parameter: searchOrderList);
var response = await ExecuteRequestAsync<GetOrdersResponse>(Utils.RateLimitType.Order_GetOrders);
return response.Payload;
}
Expand Down

0 comments on commit 56a1212

Please sign in to comment.