Skip to content

Commit

Permalink
fix PII token error and Update Order model
Browse files Browse the repository at this point in the history
  • Loading branch information
abuzuhri committed Dec 7, 2021
1 parent 26b7beb commit 0d41f8c
Show file tree
Hide file tree
Showing 10 changed files with 528 additions and 172 deletions.
8 changes: 6 additions & 2 deletions Source/FikaAmazonAPI.Sample/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Program
static async Task Main(string[] args)
{


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

}) ;

var orderData=amazonConnection.Orders.GetOrder(new ParameterGetOrder()
{
OrderId = "404-6678802-8633900"
});




while (true)
{
Expand Down
177 changes: 177 additions & 0 deletions Source/FikaAmazonAPI/AmazonSpApiSDK/Models/Orders/BuyerInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.IO;
using System.Runtime.Serialization;
using System.Text;

namespace FikaAmazonAPI.AmazonSpApiSDK.Models.Orders
{
/// <summary>
/// Buyer information
/// </summary>
[DataContract]
public partial class BuyerInfo : IEquatable<BuyerInfo>, IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="BuyerInfo" /> class.
/// </summary>
/// <param name="buyerEmail">The anonymized email address of the buyer..</param>
/// <param name="buyerName">The name of the buyer..</param>
/// <param name="buyerCounty">The county of the buyer..</param>
/// <param name="buyerTaxInfo">Tax information about the buyer..</param>
/// <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>
public BuyerInfo(string buyerEmail = default(string), string buyerName = default(string), string buyerCounty = default(string), BuyerTaxInfo buyerTaxInfo = default(BuyerTaxInfo), string purchaseOrderNumber = default(string))
{
this.BuyerEmail = buyerEmail;
this.BuyerName = buyerName;
this.BuyerCounty = buyerCounty;
this.BuyerTaxInfo = buyerTaxInfo;
this.PurchaseOrderNumber = purchaseOrderNumber;
}

/// <summary>
/// The anonymized email address of the buyer.
/// </summary>
/// <value>The anonymized email address of the buyer.</value>
[DataMember(Name = "BuyerEmail", EmitDefaultValue = false)]
public string BuyerEmail { get; set; }

/// <summary>
/// The name of the buyer.
/// </summary>
/// <value>The name of the buyer.</value>
[DataMember(Name = "BuyerName", EmitDefaultValue = false)]
public string BuyerName { get; set; }

/// <summary>
/// The county of the buyer.
/// </summary>
/// <value>The county of the buyer.</value>
[DataMember(Name = "BuyerCounty", EmitDefaultValue = false)]
public string BuyerCounty { get; set; }

/// <summary>
/// Tax information about the buyer.
/// </summary>
/// <value>Tax information about the buyer.</value>
[DataMember(Name = "BuyerTaxInfo", EmitDefaultValue = false)]
public BuyerTaxInfo BuyerTaxInfo { get; set; }

/// <summary>
/// The purchase order (PO) number entered by the buyer at checkout. Returned only for orders where the buyer entered a PO number at checkout.
/// </summary>
/// <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>
[DataMember(Name = "PurchaseOrderNumber", EmitDefaultValue = false)]
public string PurchaseOrderNumber { get; set; }

/// <summary>
/// Returns the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString()
{
var sb = new StringBuilder();
sb.Append("class BuyerInfo {\n");
sb.Append(" BuyerEmail: ").Append(BuyerEmail).Append("\n");
sb.Append(" BuyerName: ").Append(BuyerName).Append("\n");
sb.Append(" BuyerCounty: ").Append(BuyerCounty).Append("\n");
sb.Append(" BuyerTaxInfo: ").Append(BuyerTaxInfo).Append("\n");
sb.Append(" PurchaseOrderNumber: ").Append(PurchaseOrderNumber).Append("\n");
sb.Append("}\n");
return sb.ToString();
}

/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public virtual string ToJson()
{
return JsonConvert.SerializeObject(this, Formatting.Indented);
}

/// <summary>
/// Returns true if objects are equal
/// </summary>
/// <param name="input">Object to be compared</param>
/// <returns>Boolean</returns>
public override bool Equals(object input)
{
return this.Equals(input as BuyerInfo);
}

/// <summary>
/// Returns true if BuyerInfo instances are equal
/// </summary>
/// <param name="input">Instance of BuyerInfo to be compared</param>
/// <returns>Boolean</returns>
public bool Equals(BuyerInfo input)
{
if (input == null)
return false;

return
(
this.BuyerEmail == input.BuyerEmail ||
(this.BuyerEmail != null &&
this.BuyerEmail.Equals(input.BuyerEmail))
) &&
(
this.BuyerName == input.BuyerName ||
(this.BuyerName != null &&
this.BuyerName.Equals(input.BuyerName))
) &&
(
this.BuyerCounty == input.BuyerCounty ||
(this.BuyerCounty != null &&
this.BuyerCounty.Equals(input.BuyerCounty))
) &&
(
this.BuyerTaxInfo == input.BuyerTaxInfo ||
(this.BuyerTaxInfo != null &&
this.BuyerTaxInfo.Equals(input.BuyerTaxInfo))
) &&
(
this.PurchaseOrderNumber == input.PurchaseOrderNumber ||
(this.PurchaseOrderNumber != null &&
this.PurchaseOrderNumber.Equals(input.PurchaseOrderNumber))
);
}

/// <summary>
/// Gets the hash code
/// </summary>
/// <returns>Hash code</returns>
public override int GetHashCode()
{
unchecked // Overflow is fine, just wrap
{
int hashCode = 41;
if (this.BuyerEmail != null)
hashCode = hashCode * 59 + this.BuyerEmail.GetHashCode();
if (this.BuyerName != null)
hashCode = hashCode * 59 + this.BuyerName.GetHashCode();
if (this.BuyerCounty != null)
hashCode = hashCode * 59 + this.BuyerCounty.GetHashCode();
if (this.BuyerTaxInfo != null)
hashCode = hashCode * 59 + this.BuyerTaxInfo.GetHashCode();
if (this.PurchaseOrderNumber != null)
hashCode = hashCode * 59 + this.PurchaseOrderNumber.GetHashCode();
return hashCode;
}
}

/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{
yield break;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,42 +15,43 @@
using System.Runtime.Serialization;
using System.Text;


namespace FikaAmazonAPI.AmazonSpApiSDK.Models.Orders
{
/// <summary>
/// The response schema for the getOrder operation.
/// </summary>
[DataContract]
public partial class GetOrderResponse : IEquatable<GetOrderResponse>, IValidatableObject
public partial class GetOrderResponse : IEquatable<GetOrderResponse>, IValidatableObject
{
public GetOrderResponse()
{
this.Payload = default(CreateReportResult);
this.Errors = default(ErrorList);
}
/// <summary>
/// Initializes a new instance of the <see cref="GetOrderResponse" /> class.
/// </summary>
/// <param name="Payload">The payload for the getOrder operation..</param>
/// <param name="Errors">One or more unexpected errors occurred during the getOrder operation..</param>
public GetOrderResponse(CreateReportResult Payload = default(CreateReportResult), ErrorList Errors = default(ErrorList))
/// <param name="payload">The payload for the getOrder operation..</param>
/// <param name="errors">One or more unexpected errors occurred during the getOrder operation..</param>
public GetOrderResponse(Order payload = default(Order), ErrorList errors = default(ErrorList))
{
this.Payload = Payload;
this.Errors = Errors;
this.Payload = payload;
this.Errors = errors;
}
public GetOrderResponse()
{
this.Payload = default(Order);
this.Errors = default(ErrorList);
}

/// <summary>
/// The payload for the getOrder operation.
/// </summary>
/// <value>The payload for the getOrder operation.</value>
[DataMember(Name = "payload", EmitDefaultValue = false)]
public CreateReportResult Payload { get; set; }
[DataMember(Name="payload", EmitDefaultValue=false)]
public Order Payload { get; set; }

/// <summary>
/// One or more unexpected errors occurred during the getOrder operation.
/// </summary>
/// <value>One or more unexpected errors occurred during the getOrder operation.</value>
[DataMember(Name = "errors", EmitDefaultValue = false)]
[DataMember(Name="errors", EmitDefaultValue=false)]
public ErrorList Errors { get; set; }

/// <summary>
Expand All @@ -66,12 +67,12 @@ public override string ToString()
sb.Append("}\n");
return sb.ToString();
}

/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public string ToJson()
public virtual string ToJson()
{
return JsonConvert.SerializeObject(this, Formatting.Indented);
}
Expand All @@ -96,12 +97,12 @@ public bool Equals(GetOrderResponse input)
if (input == null)
return false;

return
return
(
this.Payload == input.Payload ||
(this.Payload != null &&
this.Payload.Equals(input.Payload))
) &&
) &&
(
this.Errors == input.Errors ||
(this.Errors != null &&
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@

using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
using System.Text;

namespace FikaAmazonAPI.AmazonSpApiSDK.Models.Orders
{
/// <summary>
/// Tax information about the marketplace.
/// </summary>
[DataContract]
public partial class MarketplaceTaxInfo : IEquatable<MarketplaceTaxInfo>, IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="MarketplaceTaxInfo" /> class.
/// </summary>
/// <param name="taxClassifications">A list of tax classifications that apply to the order..</param>
public MarketplaceTaxInfo(List<TaxClassification> taxClassifications = default(List<TaxClassification>))
{
this.TaxClassifications = taxClassifications;
}

/// <summary>
/// A list of tax classifications that apply to the order.
/// </summary>
/// <value>A list of tax classifications that apply to the order.</value>
[DataMember(Name = "TaxClassifications", EmitDefaultValue = false)]
public List<TaxClassification> TaxClassifications { get; set; }

/// <summary>
/// Returns the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString()
{
var sb = new StringBuilder();
sb.Append("class MarketplaceTaxInfo {\n");
sb.Append(" TaxClassifications: ").Append(TaxClassifications).Append("\n");
sb.Append("}\n");
return sb.ToString();
}

/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public virtual string ToJson()
{
return JsonConvert.SerializeObject(this, Formatting.Indented);
}

/// <summary>
/// Returns true if objects are equal
/// </summary>
/// <param name="input">Object to be compared</param>
/// <returns>Boolean</returns>
public override bool Equals(object input)
{
return this.Equals(input as MarketplaceTaxInfo);
}

/// <summary>
/// Returns true if MarketplaceTaxInfo instances are equal
/// </summary>
/// <param name="input">Instance of MarketplaceTaxInfo to be compared</param>
/// <returns>Boolean</returns>
public bool Equals(MarketplaceTaxInfo input)
{
if (input == null)
return false;

return
(
this.TaxClassifications == input.TaxClassifications ||
this.TaxClassifications != null
);
}

/// <summary>
/// Gets the hash code
/// </summary>
/// <returns>Hash code</returns>
public override int GetHashCode()
{
unchecked // Overflow is fine, just wrap
{
int hashCode = 41;
if (this.TaxClassifications != null)
hashCode = hashCode * 59 + this.TaxClassifications.GetHashCode();
return hashCode;
}
}

/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{
yield break;
}
}
}
Loading

0 comments on commit 0d41f8c

Please sign in to comment.