Skip to content

Commit 34c57a1

Browse files
authored
Merge pull request #85 from J-W-Chan/main
fix some bug.
2 parents 0aab922 + 34ca22c commit 34c57a1

14 files changed

+755
-15
lines changed

Source/FikaAmazonAPI/AmazonSpApiSDK/Models/ListingsItems/ListingsItemSubmissionResponse.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public enum StatusEnum
6060
/// Initializes a new instance of the <see cref="ListingsItemSubmissionResponse" /> class.
6161
/// </summary>
6262
[JsonConstructorAttribute]
63-
protected ListingsItemSubmissionResponse() { }
63+
public ListingsItemSubmissionResponse() { }
6464
/// <summary>
6565
/// Initializes a new instance of the <see cref="ListingsItemSubmissionResponse" /> class.
6666
/// </summary>

Source/FikaAmazonAPI/AmazonSpApiSDK/Models/Token/CreateRestrictedDataTokenRequest.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,7 @@ public class CreateRestrictedDataTokenRequest
88
{
99
public IList<RestrictedResource> restrictedResources { get; set; }
1010

11+
public string targetApplication { get; set; }
12+
1113
}
1214
}

Source/FikaAmazonAPI/AmazonSpApiSDK/Runtime/AWSSignerHelper.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ public virtual string ExtractCanonicalURIParameters(string resource)
5858
IEnumerable<string> encodedSegments = resource.Split(new char[] { '/' }, StringSplitOptions.None);
5959

6060
// Encode twice
61-
encodedSegments = encodedSegments.Select(segment => Utils.UrlEncode(segment));
61+
//use Utils.UrlDecode before Encode twice
62+
encodedSegments = encodedSegments.Select(segment => Utils.UrlEncode(Utils.UrlDecode(segment)));
6263
encodedSegments = encodedSegments.Select(segment => Utils.UrlEncode(segment));
6364

6465
canonicalUri += string.Join(Slash, encodedSegments.ToArray());

Source/FikaAmazonAPI/AmazonSpApiSDK/Runtime/Utils.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System.Globalization;
2+
using System.Net;
23
using System.Security.Cryptography;
34
using System.Text;
45

@@ -30,6 +31,16 @@ public static string UrlEncode(string data)
3031
return encoded.ToString();
3132
}
3233

34+
/// <summary>
35+
/// Decode
36+
/// </summary>
37+
/// <param name="data"></param>
38+
/// <returns></returns>
39+
public static string UrlDecode(string data)
40+
{
41+
return WebUtility.UrlDecode(data);
42+
}
43+
3344
/// <summary>
3445
/// Returns hashed value of input data using SHA256
3546
/// </summary>
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
using FikaAmazonAPI.Search;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.IO;
5+
using System.Linq;
6+
using System.Text;
7+
8+
namespace FikaAmazonAPI.Parameter.ListingItem
9+
{
10+
public class ParameterDeleteListingItem: ParameterBased
11+
{
12+
13+
public bool Check()
14+
{
15+
if (string.IsNullOrWhiteSpace(this.sellerId))
16+
{
17+
throw new InvalidDataException("SellerId is a required property for ParameterDeleteListingItem and cannot be null");
18+
}
19+
if (string.IsNullOrWhiteSpace(this.sku))
20+
{
21+
throw new InvalidDataException("Sku is a required property for ParameterDeleteListingItem and cannot be null");
22+
}
23+
if (this.marketplaceIds == null || !marketplaceIds.Any())
24+
{
25+
throw new InvalidDataException("MarketplaceIds is a required property for ParameterDeleteListingItem and cannot be null");
26+
}
27+
return true;
28+
}
29+
30+
public string sellerId { get; set; }
31+
32+
public string sku { get; set; }
33+
34+
public IList<string> marketplaceIds { get; set; }
35+
36+
public string issueLocale { get; set; }
37+
}
38+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using FikaAmazonAPI.Search;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Text;
5+
6+
namespace FikaAmazonAPI.Parameter.ListingItem
7+
{
8+
public class ParameterListingItemCommon
9+
{
10+
public string SellerId { get; set; }
11+
12+
public string Sku { get; set; }
13+
14+
public IList<string> MarketplaceIds { get; set; }
15+
}
16+
}
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
using FikaAmazonAPI.AmazonSpApiSDK.Models.Token;
2+
using FikaAmazonAPI.Search;
3+
using System;
4+
using System.Collections.Generic;
5+
using System.IO;
6+
using System.Linq;
7+
using System.Text;
8+
9+
namespace FikaAmazonAPI.Parameter.ListingItem
10+
{
11+
public class ParameterPatchListingItem : ParameterBased
12+
{
13+
public bool Check()
14+
{
15+
if (string.IsNullOrWhiteSpace(this.sellerId))
16+
{
17+
throw new InvalidDataException("SellerId is a required property for ParameterPatchListingItem and cannot be null");
18+
}
19+
if (string.IsNullOrWhiteSpace(this.sku))
20+
{
21+
throw new InvalidDataException("Sku is a required property for ParameterPatchListingItem and cannot be null");
22+
}
23+
if (this.marketplaceIds == null || !this.marketplaceIds.Any())
24+
{
25+
throw new InvalidDataException("MarketplaceIds is a required property for ParameterPatchListingItem and cannot be null");
26+
}
27+
if (this.listingsItemPatchRequest == null)
28+
{
29+
throw new InvalidDataException("ListingsItemPutRequest is a required property for ParameterPatchListingItem and cannot be null");
30+
}
31+
if (string.IsNullOrWhiteSpace(this.listingsItemPatchRequest.productType))
32+
{
33+
throw new InvalidDataException("ListingsItemPutRequest is a required property for ParameterPatchListingItem and cannot be null");
34+
}
35+
if (this.listingsItemPatchRequest.patches==null|| !this.listingsItemPatchRequest.patches.Any())
36+
{
37+
throw new InvalidDataException("Patches is a required property for ParameterPatchListingItem and cannot be null");
38+
}
39+
return true;
40+
}
41+
42+
public string sellerId { get; set; }
43+
44+
public string sku { get; set; }
45+
46+
public IList<string> marketplaceIds { get; set; }
47+
48+
public string issueLocale { get; set; }
49+
50+
public ListingsItemPatchRequest listingsItemPatchRequest { get; set; }
51+
52+
}
53+
54+
public class ListingsItemPatchRequest
55+
{
56+
public string productType { get; set; }
57+
58+
public IList<PatchOperation> patches { get; set; }
59+
}
60+
61+
public class PatchOperation
62+
{
63+
public Op op { get; set; }
64+
public string path { get; set; }
65+
66+
public IList<object> value { get; set; }
67+
}
68+
69+
public enum Op
70+
{
71+
add,
72+
replace,
73+
delete
74+
}
75+
}
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
using FikaAmazonAPI.AmazonSpApiSDK.Models.Token;
2+
using FikaAmazonAPI.Search;
3+
using System;
4+
using System.Collections.Generic;
5+
using System.IO;
6+
using System.Linq;
7+
using System.Text;
8+
9+
namespace FikaAmazonAPI.Parameter.ListingItem
10+
{
11+
public class ParameterPutListingItem : ParameterBased
12+
{
13+
public bool Check()
14+
{
15+
if (string.IsNullOrWhiteSpace(this.sellerId))
16+
{
17+
throw new InvalidDataException("SellerId is a required property for ParameterPutListingItem and cannot be null");
18+
}
19+
if (string.IsNullOrWhiteSpace(this.sku))
20+
{
21+
throw new InvalidDataException("Sku is a required property for ParameterPutListingItem and cannot be null");
22+
}
23+
if (this.marketplaceIds == null || !marketplaceIds.Any())
24+
{
25+
throw new InvalidDataException("MarketplaceIds is a required property for ParameterPutListingItem and cannot be null");
26+
}
27+
if (listingsItemPutRequest == null)
28+
{
29+
throw new InvalidDataException("ListingsItemPutRequest is a required property for ParameterPutListingItem and cannot be null");
30+
}
31+
if (string.IsNullOrWhiteSpace(this.listingsItemPutRequest.ProductType))
32+
{
33+
throw new InvalidDataException("ProductType is a required property for ListingsItemPutRequest and cannot be null");
34+
}
35+
if (this.listingsItemPutRequest.Attributes==null)
36+
{
37+
throw new InvalidDataException("Attributes is a required property for ListingsItemPutRequest and cannot be null");
38+
}
39+
return true;
40+
}
41+
public string sellerId { get; set; }
42+
43+
public string sku { get; set; }
44+
45+
public IList<string> marketplaceIds { get; set; }
46+
47+
public string issueLocale { get; set; }
48+
49+
public ListingsItemPutRequest listingsItemPutRequest { get; set; }
50+
51+
}
52+
53+
public class ListingsItemPutRequest
54+
{
55+
public string ProductType { get; set; }
56+
57+
public Requirements Requirements { get; set; }
58+
59+
public Object Attributes { get; set; }
60+
}
61+
62+
public enum Requirements
63+
{
64+
LISTING,
65+
LISTING_PRODUCT_ONLY,
66+
LISTING_OFFER_ONLY
67+
}
68+
}

Source/FikaAmazonAPI/Parameter/Report/ParameterReportList.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public ParameterReportList()
2020
/// <summary>
2121
/// A list of processing statuses used to filter reports.
2222
/// </summary>
23-
public IList<ReportTypes> processingStatuses { get; set; }
23+
public IList<ProcessingStatuses> processingStatuses { get; set; }
2424
/// <summary>
2525
/// A list of marketplace identifiers used to filter reports. The reports returned will match at least one of the marketplaces that you specify. Minimum : 1 Maximum : 10
2626
/// </summary>

Source/FikaAmazonAPI/ReportGeneration/ReportManager.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,27 @@ private string GetFeedbackFromDate(AmazonConnection amazonConnection, DateTime f
3434
{
3535
return amazonConnection.Reports.CreateReportAndDownloadFile(ReportTypes.GET_SELLER_FEEDBACK_DATA, fromDate);
3636
}
37+
38+
#endregion
39+
40+
#region Performance
41+
public SellerFeedBackDataResult GetSellerFeedBackDataFromDays(int days)
42+
{
43+
DateTime fromDate = DateTime.UtcNow.AddDays(-1 * days);
44+
DateTime toDate = DateTime.UtcNow;
45+
return GetSellerPerformance(fromDate, toDate);
46+
}
47+
public SellerFeedBackDataResult GetSellerPerformance(DateTime fromDate, DateTime toDate)
48+
{
49+
var path = GetSellerPerformance(_amazonConnection, fromDate, toDate);
50+
SellerFeedBackData sellerPerformanceReport = new SellerFeedBackData(path);
51+
return sellerPerformanceReport.Data;
52+
}
53+
54+
private string GetSellerPerformance(AmazonConnection amazonConnection, DateTime fromDate, DateTime toDate)
55+
{
56+
return amazonConnection.Reports.CreateReportAndDownloadFile(ReportTypes.GET_SELLER_FEEDBACK_DATA, fromDate);
57+
}
3758
#endregion
3859

3960
#region Reimbursement

0 commit comments

Comments
 (0)