Skip to content

Commit 0d41f8c

Browse files
committed
fix PII token error and Update Order model
1 parent 26b7beb commit 0d41f8c

File tree

10 files changed

+528
-172
lines changed

10 files changed

+528
-172
lines changed

Source/FikaAmazonAPI.Sample/Program.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class Program
2929
static async Task Main(string[] args)
3030
{
3131

32-
32+
3333
AmazonConnection amazonConnection = new AmazonConnection(new AmazonCredential()
3434
{
3535
AccessKey = Environment.GetEnvironmentVariable("AccessKey"),
@@ -43,8 +43,12 @@ static async Task Main(string[] args)
4343

4444
}) ;
4545

46+
var orderData=amazonConnection.Orders.GetOrder(new ParameterGetOrder()
47+
{
48+
OrderId = "404-6678802-8633900"
49+
});
50+
4651

47-
4852

4953
while (true)
5054
{
Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
using Newtonsoft.Json;
2+
using Newtonsoft.Json.Converters;
3+
using System;
4+
using System.Collections.Generic;
5+
using System.ComponentModel.DataAnnotations;
6+
using System.IO;
7+
using System.Runtime.Serialization;
8+
using System.Text;
9+
10+
namespace FikaAmazonAPI.AmazonSpApiSDK.Models.Orders
11+
{
12+
/// <summary>
13+
/// Buyer information
14+
/// </summary>
15+
[DataContract]
16+
public partial class BuyerInfo : IEquatable<BuyerInfo>, IValidatableObject
17+
{
18+
/// <summary>
19+
/// Initializes a new instance of the <see cref="BuyerInfo" /> class.
20+
/// </summary>
21+
/// <param name="buyerEmail">The anonymized email address of the buyer..</param>
22+
/// <param name="buyerName">The name of the buyer..</param>
23+
/// <param name="buyerCounty">The county of the buyer..</param>
24+
/// <param name="buyerTaxInfo">Tax information about the buyer..</param>
25+
/// <param name="purchaseOrderNumber">The purchase order (PO) number entered by the buyer at checkout. Returned only for orders where the buyer entered a PO number at checkout..</param>
26+
public BuyerInfo(string buyerEmail = default(string), string buyerName = default(string), string buyerCounty = default(string), BuyerTaxInfo buyerTaxInfo = default(BuyerTaxInfo), string purchaseOrderNumber = default(string))
27+
{
28+
this.BuyerEmail = buyerEmail;
29+
this.BuyerName = buyerName;
30+
this.BuyerCounty = buyerCounty;
31+
this.BuyerTaxInfo = buyerTaxInfo;
32+
this.PurchaseOrderNumber = purchaseOrderNumber;
33+
}
34+
35+
/// <summary>
36+
/// The anonymized email address of the buyer.
37+
/// </summary>
38+
/// <value>The anonymized email address of the buyer.</value>
39+
[DataMember(Name = "BuyerEmail", EmitDefaultValue = false)]
40+
public string BuyerEmail { get; set; }
41+
42+
/// <summary>
43+
/// The name of the buyer.
44+
/// </summary>
45+
/// <value>The name of the buyer.</value>
46+
[DataMember(Name = "BuyerName", EmitDefaultValue = false)]
47+
public string BuyerName { get; set; }
48+
49+
/// <summary>
50+
/// The county of the buyer.
51+
/// </summary>
52+
/// <value>The county of the buyer.</value>
53+
[DataMember(Name = "BuyerCounty", EmitDefaultValue = false)]
54+
public string BuyerCounty { get; set; }
55+
56+
/// <summary>
57+
/// Tax information about the buyer.
58+
/// </summary>
59+
/// <value>Tax information about the buyer.</value>
60+
[DataMember(Name = "BuyerTaxInfo", EmitDefaultValue = false)]
61+
public BuyerTaxInfo BuyerTaxInfo { get; set; }
62+
63+
/// <summary>
64+
/// The purchase order (PO) number entered by the buyer at checkout. Returned only for orders where the buyer entered a PO number at checkout.
65+
/// </summary>
66+
/// <value>The purchase order (PO) number entered by the buyer at checkout. Returned only for orders where the buyer entered a PO number at checkout.</value>
67+
[DataMember(Name = "PurchaseOrderNumber", EmitDefaultValue = false)]
68+
public string PurchaseOrderNumber { get; set; }
69+
70+
/// <summary>
71+
/// Returns the string presentation of the object
72+
/// </summary>
73+
/// <returns>String presentation of the object</returns>
74+
public override string ToString()
75+
{
76+
var sb = new StringBuilder();
77+
sb.Append("class BuyerInfo {\n");
78+
sb.Append(" BuyerEmail: ").Append(BuyerEmail).Append("\n");
79+
sb.Append(" BuyerName: ").Append(BuyerName).Append("\n");
80+
sb.Append(" BuyerCounty: ").Append(BuyerCounty).Append("\n");
81+
sb.Append(" BuyerTaxInfo: ").Append(BuyerTaxInfo).Append("\n");
82+
sb.Append(" PurchaseOrderNumber: ").Append(PurchaseOrderNumber).Append("\n");
83+
sb.Append("}\n");
84+
return sb.ToString();
85+
}
86+
87+
/// <summary>
88+
/// Returns the JSON string presentation of the object
89+
/// </summary>
90+
/// <returns>JSON string presentation of the object</returns>
91+
public virtual string ToJson()
92+
{
93+
return JsonConvert.SerializeObject(this, Formatting.Indented);
94+
}
95+
96+
/// <summary>
97+
/// Returns true if objects are equal
98+
/// </summary>
99+
/// <param name="input">Object to be compared</param>
100+
/// <returns>Boolean</returns>
101+
public override bool Equals(object input)
102+
{
103+
return this.Equals(input as BuyerInfo);
104+
}
105+
106+
/// <summary>
107+
/// Returns true if BuyerInfo instances are equal
108+
/// </summary>
109+
/// <param name="input">Instance of BuyerInfo to be compared</param>
110+
/// <returns>Boolean</returns>
111+
public bool Equals(BuyerInfo input)
112+
{
113+
if (input == null)
114+
return false;
115+
116+
return
117+
(
118+
this.BuyerEmail == input.BuyerEmail ||
119+
(this.BuyerEmail != null &&
120+
this.BuyerEmail.Equals(input.BuyerEmail))
121+
) &&
122+
(
123+
this.BuyerName == input.BuyerName ||
124+
(this.BuyerName != null &&
125+
this.BuyerName.Equals(input.BuyerName))
126+
) &&
127+
(
128+
this.BuyerCounty == input.BuyerCounty ||
129+
(this.BuyerCounty != null &&
130+
this.BuyerCounty.Equals(input.BuyerCounty))
131+
) &&
132+
(
133+
this.BuyerTaxInfo == input.BuyerTaxInfo ||
134+
(this.BuyerTaxInfo != null &&
135+
this.BuyerTaxInfo.Equals(input.BuyerTaxInfo))
136+
) &&
137+
(
138+
this.PurchaseOrderNumber == input.PurchaseOrderNumber ||
139+
(this.PurchaseOrderNumber != null &&
140+
this.PurchaseOrderNumber.Equals(input.PurchaseOrderNumber))
141+
);
142+
}
143+
144+
/// <summary>
145+
/// Gets the hash code
146+
/// </summary>
147+
/// <returns>Hash code</returns>
148+
public override int GetHashCode()
149+
{
150+
unchecked // Overflow is fine, just wrap
151+
{
152+
int hashCode = 41;
153+
if (this.BuyerEmail != null)
154+
hashCode = hashCode * 59 + this.BuyerEmail.GetHashCode();
155+
if (this.BuyerName != null)
156+
hashCode = hashCode * 59 + this.BuyerName.GetHashCode();
157+
if (this.BuyerCounty != null)
158+
hashCode = hashCode * 59 + this.BuyerCounty.GetHashCode();
159+
if (this.BuyerTaxInfo != null)
160+
hashCode = hashCode * 59 + this.BuyerTaxInfo.GetHashCode();
161+
if (this.PurchaseOrderNumber != null)
162+
hashCode = hashCode * 59 + this.PurchaseOrderNumber.GetHashCode();
163+
return hashCode;
164+
}
165+
}
166+
167+
/// <summary>
168+
/// To validate all properties of the instance
169+
/// </summary>
170+
/// <param name="validationContext">Validation context</param>
171+
/// <returns>Validation Result</returns>
172+
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
173+
{
174+
yield break;
175+
}
176+
}
177+
}

Source/FikaAmazonAPI/AmazonSpApiSDK/Models/Orders/GetOrderResponse.cs

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,42 +15,43 @@
1515
using System.Runtime.Serialization;
1616
using System.Text;
1717

18+
1819
namespace FikaAmazonAPI.AmazonSpApiSDK.Models.Orders
1920
{
2021
/// <summary>
2122
/// The response schema for the getOrder operation.
2223
/// </summary>
2324
[DataContract]
24-
public partial class GetOrderResponse : IEquatable<GetOrderResponse>, IValidatableObject
25+
public partial class GetOrderResponse : IEquatable<GetOrderResponse>, IValidatableObject
2526
{
26-
public GetOrderResponse()
27-
{
28-
this.Payload = default(CreateReportResult);
29-
this.Errors = default(ErrorList);
30-
}
3127
/// <summary>
3228
/// Initializes a new instance of the <see cref="GetOrderResponse" /> class.
3329
/// </summary>
34-
/// <param name="Payload">The payload for the getOrder operation..</param>
35-
/// <param name="Errors">One or more unexpected errors occurred during the getOrder operation..</param>
36-
public GetOrderResponse(CreateReportResult Payload = default(CreateReportResult), ErrorList Errors = default(ErrorList))
30+
/// <param name="payload">The payload for the getOrder operation..</param>
31+
/// <param name="errors">One or more unexpected errors occurred during the getOrder operation..</param>
32+
public GetOrderResponse(Order payload = default(Order), ErrorList errors = default(ErrorList))
3733
{
38-
this.Payload = Payload;
39-
this.Errors = Errors;
34+
this.Payload = payload;
35+
this.Errors = errors;
36+
}
37+
public GetOrderResponse()
38+
{
39+
this.Payload = default(Order);
40+
this.Errors = default(ErrorList);
4041
}
4142

4243
/// <summary>
4344
/// The payload for the getOrder operation.
4445
/// </summary>
4546
/// <value>The payload for the getOrder operation.</value>
46-
[DataMember(Name = "payload", EmitDefaultValue = false)]
47-
public CreateReportResult Payload { get; set; }
47+
[DataMember(Name="payload", EmitDefaultValue=false)]
48+
public Order Payload { get; set; }
4849

4950
/// <summary>
5051
/// One or more unexpected errors occurred during the getOrder operation.
5152
/// </summary>
5253
/// <value>One or more unexpected errors occurred during the getOrder operation.</value>
53-
[DataMember(Name = "errors", EmitDefaultValue = false)]
54+
[DataMember(Name="errors", EmitDefaultValue=false)]
5455
public ErrorList Errors { get; set; }
5556

5657
/// <summary>
@@ -66,12 +67,12 @@ public override string ToString()
6667
sb.Append("}\n");
6768
return sb.ToString();
6869
}
69-
70+
7071
/// <summary>
7172
/// Returns the JSON string presentation of the object
7273
/// </summary>
7374
/// <returns>JSON string presentation of the object</returns>
74-
public string ToJson()
75+
public virtual string ToJson()
7576
{
7677
return JsonConvert.SerializeObject(this, Formatting.Indented);
7778
}
@@ -96,12 +97,12 @@ public bool Equals(GetOrderResponse input)
9697
if (input == null)
9798
return false;
9899

99-
return
100+
return
100101
(
101102
this.Payload == input.Payload ||
102103
(this.Payload != null &&
103104
this.Payload.Equals(input.Payload))
104-
) &&
105+
) &&
105106
(
106107
this.Errors == input.Errors ||
107108
(this.Errors != null &&
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+

2+
using Newtonsoft.Json;
3+
using System;
4+
using System.Collections.Generic;
5+
using System.ComponentModel.DataAnnotations;
6+
using System.Runtime.Serialization;
7+
using System.Text;
8+
9+
namespace FikaAmazonAPI.AmazonSpApiSDK.Models.Orders
10+
{
11+
/// <summary>
12+
/// Tax information about the marketplace.
13+
/// </summary>
14+
[DataContract]
15+
public partial class MarketplaceTaxInfo : IEquatable<MarketplaceTaxInfo>, IValidatableObject
16+
{
17+
/// <summary>
18+
/// Initializes a new instance of the <see cref="MarketplaceTaxInfo" /> class.
19+
/// </summary>
20+
/// <param name="taxClassifications">A list of tax classifications that apply to the order..</param>
21+
public MarketplaceTaxInfo(List<TaxClassification> taxClassifications = default(List<TaxClassification>))
22+
{
23+
this.TaxClassifications = taxClassifications;
24+
}
25+
26+
/// <summary>
27+
/// A list of tax classifications that apply to the order.
28+
/// </summary>
29+
/// <value>A list of tax classifications that apply to the order.</value>
30+
[DataMember(Name = "TaxClassifications", EmitDefaultValue = false)]
31+
public List<TaxClassification> TaxClassifications { get; set; }
32+
33+
/// <summary>
34+
/// Returns the string presentation of the object
35+
/// </summary>
36+
/// <returns>String presentation of the object</returns>
37+
public override string ToString()
38+
{
39+
var sb = new StringBuilder();
40+
sb.Append("class MarketplaceTaxInfo {\n");
41+
sb.Append(" TaxClassifications: ").Append(TaxClassifications).Append("\n");
42+
sb.Append("}\n");
43+
return sb.ToString();
44+
}
45+
46+
/// <summary>
47+
/// Returns the JSON string presentation of the object
48+
/// </summary>
49+
/// <returns>JSON string presentation of the object</returns>
50+
public virtual string ToJson()
51+
{
52+
return JsonConvert.SerializeObject(this, Formatting.Indented);
53+
}
54+
55+
/// <summary>
56+
/// Returns true if objects are equal
57+
/// </summary>
58+
/// <param name="input">Object to be compared</param>
59+
/// <returns>Boolean</returns>
60+
public override bool Equals(object input)
61+
{
62+
return this.Equals(input as MarketplaceTaxInfo);
63+
}
64+
65+
/// <summary>
66+
/// Returns true if MarketplaceTaxInfo instances are equal
67+
/// </summary>
68+
/// <param name="input">Instance of MarketplaceTaxInfo to be compared</param>
69+
/// <returns>Boolean</returns>
70+
public bool Equals(MarketplaceTaxInfo input)
71+
{
72+
if (input == null)
73+
return false;
74+
75+
return
76+
(
77+
this.TaxClassifications == input.TaxClassifications ||
78+
this.TaxClassifications != null
79+
);
80+
}
81+
82+
/// <summary>
83+
/// Gets the hash code
84+
/// </summary>
85+
/// <returns>Hash code</returns>
86+
public override int GetHashCode()
87+
{
88+
unchecked // Overflow is fine, just wrap
89+
{
90+
int hashCode = 41;
91+
if (this.TaxClassifications != null)
92+
hashCode = hashCode * 59 + this.TaxClassifications.GetHashCode();
93+
return hashCode;
94+
}
95+
}
96+
97+
/// <summary>
98+
/// To validate all properties of the instance
99+
/// </summary>
100+
/// <param name="validationContext">Validation context</param>
101+
/// <returns>Validation Result</returns>
102+
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
103+
{
104+
yield break;
105+
}
106+
}
107+
}

0 commit comments

Comments
 (0)