Skip to content

Commit

Permalink
Merge pull request #689 from Edogusma/VendorTransaction
Browse files Browse the repository at this point in the history
Add VendorTransaction API
  • Loading branch information
abuzuhri authored Dec 11, 2023
2 parents 6247c95 + 0a74eec commit a38aaf7
Show file tree
Hide file tree
Showing 36 changed files with 476 additions and 61 deletions.
3 changes: 3 additions & 0 deletions Source/FikaAmazonAPI/AmazonConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public class AmazonConnection
public VendorDirectFulfillmentOrderService VendorDirectFulfillmentOrders => this._VendorDirectFulfillmentOrders ?? throw _NoCredentials;
public VendorOrderService VendorOrders => this._VendorOrders ?? throw _NoCredentials;

public VendorTransactionStatusService VendorTransactionStatus => this._VendorTransactionStatus ?? throw _NoCredentials;

private OrderService _Orders { get; set; }
private ReportService _Reports { get; set; }
Expand Down Expand Up @@ -82,6 +83,7 @@ public class AmazonConnection
private FulFillmentOutboundService _FulFillmentOutbound { get; set; }
private VendorDirectFulfillmentOrderService _VendorDirectFulfillmentOrders { get; set; }
private VendorOrderService _VendorOrders { get; set; }
private VendorTransactionStatusService _VendorTransactionStatus { get; set; }

private UnauthorizedAccessException _NoCredentials = new UnauthorizedAccessException($"Error, you cannot make calls to Amazon without credentials!");

Expand Down Expand Up @@ -142,6 +144,7 @@ private void Init(AmazonCredential Credentials)
this._FulFillmentOutbound = new FulFillmentOutboundService(this.Credentials);
this._VendorDirectFulfillmentOrders = new VendorDirectFulfillmentOrderService(this.Credentials);
this._VendorOrders = new VendorOrderService(this.Credentials);
this._VendorTransactionStatus = new VendorTransactionStatusService(this.Credentials);

AmazonCredential.DebugMode = this.Credentials.IsDebugMode;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public AmazonProcessingReportDeserializeException(string msg, string reportConte
{
ReportContent = reportContent;
}
}
}

public class ExceptionResponse
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public GetFulfillmentPreviewItem() { }
/// The seller SKU of the item.
/// </summary>
/// <value>The seller SKU of the item.</value>
[DataMember(Name = "sellerSku", EmitDefaultValue = false)]
[DataMember(Name = "SellerSKU", EmitDefaultValue = false)]
public string SellerSKU { get; set; }

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ public override string ToString() {
return JsonConvert.SerializeObject(this, Formatting.Indented);
}

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ public override string ToString() {
return JsonConvert.SerializeObject(this, Formatting.Indented);
}

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ public override string ToString() {
return JsonConvert.SerializeObject(this, Formatting.Indented);
}

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ public override string ToString() {
return JsonConvert.SerializeObject(this, Formatting.Indented);
}

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ public override string ToString() {
return JsonConvert.SerializeObject(this, Formatting.Indented);
}

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ public override string ToString() {
return JsonConvert.SerializeObject(this, Formatting.Indented);
}

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ public override string ToString() {
return JsonConvert.SerializeObject(this, Formatting.Indented);
}

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ public override string ToString() {
return JsonConvert.SerializeObject(this, Formatting.Indented);
}

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ public override string ToString() {
return JsonConvert.SerializeObject(this, Formatting.Indented);
}

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ public override string ToString() {
return JsonConvert.SerializeObject(this, Formatting.Indented);
}

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ public override string ToString() {
return JsonConvert.SerializeObject(this, Formatting.Indented);
}

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,22 @@ namespace FikaAmazonAPI.AmazonSpApiSDK.Models.VendorOrders
[JsonConverter(typeof(StringEnumConverter))]
public enum AcknowledgementCode
{
/*
* Amazon interpretation is that the quantity stated in ACK02 will be immediatelyshipped / delivered on the stated date.
*/
[EnumMember(Value = "Accepted")]
Accepted,

/*
* Amazon interpretation is that the quantity stated in ACK02 is back-ordered and willbe shipped / delivered on the stated date.
*/
[EnumMember(Value = "Backordered")]
Backordered,

/*
* Amazon interpretation is that the quantity stated in ACK02 will not be delivered toAmazon as part of this Purchase Order.
* The Amazon nomenclature for this is "soft reject", meaning that the item will be reordered withnext order run. If you want to remove this item from being ordered you should use ACK code R2which will be a "hard reject", meaning that Amazon will restrict this item from being re-ordered.
*/
[EnumMember(Value = "Rejected")]
Rejected
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public partial class OrderItemStatus : IEquatable<OrderItemStatus>, IValidatable
public OrderItemStatus() { }
public OrderItemStatus(
string itemSequenceNumber = default(string), string buyerProductIdentifier = default(string), string vendorProductIdentifier = default(string), Money netCost = default(Money), Money listPrice = default(Money),
orderedQuantity orderedQuantity = default(orderedQuantity), acknowledgementStatus acknowledgementStatus = default(acknowledgementStatus)
orderedQuantity orderedQuantity = default(orderedQuantity), AcknowledgementStatus acknowledgementStatus = default(AcknowledgementStatus)
)
{
if (itemSequenceNumber == null)
Expand Down Expand Up @@ -57,7 +57,7 @@ public OrderItemStatus(
public orderedQuantity OrderedQuantity { get; set; }

[DataMember(Name = "acknowledgementStatus", EmitDefaultValue = false)]
public acknowledgementStatus AcknowledgementStatus { get; set; }
public AcknowledgementStatus AcknowledgementStatus { get; set; }

[DataMember(Name = "receivingStatus", EmitDefaultValue = false)]
public receivingStatus ReceivingStatus { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Newtonsoft.Json;
using System.ComponentModel.DataAnnotations;
using FikaAmazonAPI.AmazonSpApiSDK.Models.Authorization;
using FikaAmazonAPI.AmazonSpApiSDK.Models.VendorTransactions;

namespace FikaAmazonAPI.AmazonSpApiSDK.Models.VendorOrders
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
namespace FikaAmazonAPI.AmazonSpApiSDK.Models.VendorOrders
{
[DataContract]
public partial class acknowledgementStatus : IEquatable<acknowledgementStatus>, IValidatableObject
public partial class AcknowledgementStatus : IEquatable<AcknowledgementStatus>, IValidatableObject
{
[JsonConstructorAttribute]
public acknowledgementStatus() { }
public acknowledgementStatus(
public AcknowledgementStatus() { }
public AcknowledgementStatus(
ItemConfirmationStatus? confirmationStatus = default(ItemConfirmationStatus?), ItemQuantity acceptedQuantity = default(ItemQuantity), ItemQuantity rejectedQuantity = default(ItemQuantity),
List<AcknowledgementStatusDetails> acknowledgementStatusDetails = default(List<AcknowledgementStatusDetails>)
)
Expand Down Expand Up @@ -69,15 +69,15 @@ public virtual string ToJson()
/// <returns>Boolean</returns>
public override bool Equals(object input)
{
return this.Equals(input as acknowledgementStatus);
return this.Equals(input as AcknowledgementStatus);
}

/// <summary>
/// Returns true if ItemQuantity instances are equal
/// </summary>
/// <param name="input">Instance of ItemQuantity to be compared</param>
/// <returns>Boolean</returns>
public bool Equals(acknowledgementStatus input)
public bool Equals(AcknowledgementStatus input)
{
if (input == null)
return false;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
using System;
using System.Text;
using System.Collections.Generic;
using System.Runtime.Serialization;
using System.ComponentModel.DataAnnotations;
using Newtonsoft.Json;

namespace FikaAmazonAPI.AmazonSpApiSDK.Models.VendorTransactions
{
/// <summary>
/// The response schema for the getTransactionResponse operation.
/// </summary>
[DataContract]
public partial class GetTransactionResponse : IEquatable<GetTransactionResponse>, IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="GetTransactionResponse" /> class.
/// </summary>
/// <param name="payload">The payload for the getTransactionResponse operation..</param>
/// <param name="errors">errors.</param>
public GetTransactionResponse(Transaction payload = default, ErrorList errors = default)
{
Payload = payload;
Errors = errors;
}
public GetTransactionResponse()
{
Payload = default;
Errors = default;
}
/// <summary>
/// The payload for the getTransactionResponse operation.
/// </summary>
/// <value>The payload for the getTransactionResponse operation.</value>
[DataMember(Name = "payload", EmitDefaultValue = false)]
public Transaction Payload { get; set; }

/// <summary>
/// Gets or Sets Errors
/// </summary>
[DataMember(Name = "errors", EmitDefaultValue = false)]
public ErrorList Errors { 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 GetTransactionResponse {\n");
sb.Append(" Payload: ").Append(Payload).Append("\n");
sb.Append(" Errors: ").Append(Errors).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 Equals(input as GetTransactionResponse);
}

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

return
(
Payload == input.Payload ||
Payload != null &&
Payload.Equals(input.Payload)
) &&
(
Errors == input.Errors ||
Errors != null &&
Errors.Equals(input.Errors)
);
}

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

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

}

}
Loading

0 comments on commit a38aaf7

Please sign in to comment.