Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public Order() { }
/// <param name="fulfillment">Information about how the order is being processed, packed, and shipped to the customer.</param>
/// <param name="orderItems">The list of all order items included in this order. (required)</param>
/// <param name="packages">Shipping packages created for this order, including tracking information. Note: Only available for merchant-fulfilled (FBM) orders.</param>
/// <param name="payment">Payment information for the order.</param>
public Order(string orderId,
List<OrderAliase> orderAliases,
DateTime createdTime,
Expand All @@ -49,7 +50,8 @@ public Order(string orderId,
OrderProceeds proceeds,
OrderFulfillment fulfillment,
List<OrderItem> orderItems,
List<Package> packages)
List<Package> packages,
OrderPayment payment)
{

this.OrderId = orderId;
Expand All @@ -65,6 +67,7 @@ public Order(string orderId,
this.Proceeds = proceeds;
this.Fulfillment = fulfillment;
this.Packages = packages;
this.Payment = payment;
}

/// <summary>
Expand Down Expand Up @@ -158,6 +161,13 @@ public Order(string orderId,
[DataMember(Name = "packages", EmitDefaultValue = false)]
public List<Package> Packages { get; set; }

/// <summary>
/// Payment information for the order.
/// </summary>
/// <value>Payment information for the order.</value>
[DataMember(Name = "payment", EmitDefaultValue = false)]
public OrderPayment Payment { get; set; }


/// <summary>
/// Returns the string presentation of the object
Expand All @@ -180,6 +190,7 @@ public override string ToString()
sb.Append(" Fulfillment: ").Append(Fulfillment).Append("\n");
sb.Append(" OrderItems: ").Append(OrderItems).Append("\n");
sb.Append(" Packages: ").Append(Packages).Append("\n");
sb.Append(" Payment: ").Append(Payment).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
Expand Down Expand Up @@ -278,6 +289,11 @@ public bool Equals(Order input)
Packages == input.Packages ||
Packages != null &&
Packages.SequenceEqual(input.Packages)
) &&
(
Payment == input.Payment ||
Payment != null &&
Payment.Equals(input.Payment)
);
}

Expand Down Expand Up @@ -316,6 +332,8 @@ public override int GetHashCode()
hashCode = hashCode * 59 + OrderItems.GetHashCode();
if (Packages != null)
hashCode = hashCode * 59 + Packages.GetHashCode();
if (Payment != null)
hashCode = hashCode * 59 + Payment.GetHashCode();
return hashCode;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;

namespace FikaAmazonAPI.AmazonSpApiSDK.Models.OrdersV20260101
{
/// <summary>
/// Payment information about the order.
/// </summary>
[DataContract]
public partial class OrderPayment : IEquatable<OrderPayment>, IValidatableObject

Check warning on line 15 in Source/FikaAmazonAPI/AmazonSpApiSDK/Models/OrdersV20260101/OrderPayment.cs

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Seal class 'OrderPayment' or implement 'IEqualityComparer<T>' instead.

See more on https://sonarcloud.io/project/issues?id=abuzuhri_Amazon-SP-API-CSharp&issues=AZ66FDH6dOVWHzRDgAXe&open=AZ66FDH6dOVWHzRDgAXe&pullRequest=946
{
/// <summary>
/// Initializes a new instance of the <see cref="OrderPayment" /> class.
/// </summary>
public OrderPayment()
{
}

/// <summary>
/// Initializes a new instance of the <see cref="OrderPayment" /> class.
/// </summary>
/// <param name="paymentExecutions">A list of payment executions for the order.</param>
public OrderPayment(List<PaymentExecution> paymentExecutions)
{
this.PaymentExecutions = paymentExecutions;
}

/// <summary>
/// A list of payment executions for the order.
/// </summary>
/// <value>A list of payment executions for the order.</value>
[DataMember(Name = "paymentExecutions", EmitDefaultValue = false)]
public List<PaymentExecution> PaymentExecutions { 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 OrderPayment {\n");
sb.Append(" PaymentExecutions: ").Append(PaymentExecutions).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="obj">Object to be compared</param>
/// <returns>Boolean</returns>
public override bool Equals(object obj)
{
return this.Equals(obj as OrderPayment);
}

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

return
(
this.PaymentExecutions == input.PaymentExecutions ||
(this.PaymentExecutions != null &&
this.PaymentExecutions.SequenceEqual(input.PaymentExecutions))
);
}

/// <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.PaymentExecutions != null)
{
foreach (var paymentExecution in this.PaymentExecutions)
hashCode = hashCode * 59 + (paymentExecution?.GetHashCode() ?? 0);
}
return hashCode;
}
}
Comment thread
Copilot marked this conversation as resolved.

/// <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
@@ -0,0 +1,189 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
using System.Text;

namespace FikaAmazonAPI.AmazonSpApiSDK.Models.OrdersV20260101
{
/// <summary>
/// Payment execution details for an order.
/// </summary>
[DataContract]
public partial class PaymentExecution : IEquatable<PaymentExecution>, IValidatableObject

Check warning on line 14 in Source/FikaAmazonAPI/AmazonSpApiSDK/Models/OrdersV20260101/PaymentExecution.cs

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Seal class 'PaymentExecution' or implement 'IEqualityComparer<T>' instead.

See more on https://sonarcloud.io/project/issues?id=abuzuhri_Amazon-SP-API-CSharp&issues=AZ66FDJzdOVWHzRDgAXf&open=AZ66FDJzdOVWHzRDgAXf&pullRequest=946
{
/// <summary>
/// Initializes a new instance of the <see cref="PaymentExecution" /> class.
/// </summary>
public PaymentExecution()
{
}

/// <summary>
/// Initializes a new instance of the <see cref="PaymentExecution" /> class.
/// </summary>
/// <param name="paymentMethod">The payment method used for this payment execution (for example, CashOnDelivery, ConvenienceStore, CreditCard, Invoice, Pix, and so on).</param>
/// <param name="paymentAmount">The monetary value of the payment execution.</param>
/// <param name="acquirerId">The unique identifier of the payment processor or acquiring bank that authorizes the payment.</param>
/// <param name="cardBrand">The card network or brand used in the payment transaction (for example, Visa or Mastercard).</param>
/// <param name="authorizationCode">The unique code that confirms the payment authorization.</param>
public PaymentExecution(string paymentMethod, Money paymentAmount, string acquirerId, string cardBrand, string authorizationCode)
{
this.PaymentMethod = paymentMethod;
this.PaymentAmount = paymentAmount;
this.AcquirerId = acquirerId;
this.CardBrand = cardBrand;
this.AuthorizationCode = authorizationCode;
}

/// <summary>
/// The payment method used for this payment execution (for example, CashOnDelivery, ConvenienceStore, CreditCard, Invoice, Pix, and so on).
/// </summary>
/// <value>The payment method used for this payment execution (for example, CashOnDelivery, ConvenienceStore, CreditCard, Invoice, Pix, and so on).</value>
[DataMember(Name = "paymentMethod", EmitDefaultValue = false)]
public string PaymentMethod { get; set; }

/// <summary>
/// The monetary value of the payment execution.
/// </summary>
/// <value>The monetary value of the payment execution.</value>
[DataMember(Name = "paymentAmount", EmitDefaultValue = false)]
public Money PaymentAmount { get; set; }

/// <summary>
/// The unique identifier of the payment processor or acquiring bank that authorizes the payment.
/// <br/><br/>
/// Note: This attribute is only available for orders in the Brazil (BR) marketplace when the paymentMethod is CreditCard or Pix.
/// </summary>
/// <value>The unique identifier of the payment processor or acquiring bank that authorizes the payment.</value>
[DataMember(Name = "acquirerId", EmitDefaultValue = false)]
public string AcquirerId { get; set; }

/// <summary>
/// The card network or brand used in the payment transaction (for example, Visa or Mastercard).
/// <br/><br/>
/// Note: This attribute is only available for orders in the Brazil (BR) marketplace when the paymentMethod is CreditCard.
/// </summary>
/// <value>The card network or brand used in the payment transaction (for example, Visa or Mastercard).</value>
[DataMember(Name = "cardBrand", EmitDefaultValue = false)]
public string CardBrand { get; set; }

/// <summary>
/// The unique code that confirms the payment authorization.
/// <br/><br/>
/// Note: This attribute is only available for orders in the Brazil (BR) marketplace when the paymentMethod is CreditCard or Pix.
/// </summary>
/// <value>The unique code that confirms the payment authorization.</value>
[DataMember(Name = "authorizationCode", EmitDefaultValue = false)]
public string AuthorizationCode { 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 PaymentExecution {\n");
sb.Append(" PaymentMethod: ").Append(PaymentMethod).Append("\n");
sb.Append(" PaymentAmount: ").Append(PaymentAmount).Append("\n");
sb.Append(" AcquirerId: ").Append(AcquirerId).Append("\n");
sb.Append(" CardBrand: ").Append(CardBrand).Append("\n");
sb.Append(" AuthorizationCode: ").Append(AuthorizationCode).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="obj">Object to be compared</param>
/// <returns>Boolean</returns>
public override bool Equals(object obj)
{
return this.Equals(obj as PaymentExecution);
}

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

return
(
this.PaymentMethod == input.PaymentMethod ||
(this.PaymentMethod != null &&
this.PaymentMethod.Equals(input.PaymentMethod))
) &&
(
this.PaymentAmount == input.PaymentAmount ||
(this.PaymentAmount != null &&
this.PaymentAmount.Equals(input.PaymentAmount))
) &&
(
this.AcquirerId == input.AcquirerId ||
(this.AcquirerId != null &&
this.AcquirerId.Equals(input.AcquirerId))
) &&
(
this.CardBrand == input.CardBrand ||
(this.CardBrand != null &&
this.CardBrand.Equals(input.CardBrand))
) &&
(
this.AuthorizationCode == input.AuthorizationCode ||
(this.AuthorizationCode != null &&
this.AuthorizationCode.Equals(input.AuthorizationCode))
);
}

/// <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.PaymentMethod != null)
hashCode = hashCode * 59 + this.PaymentMethod.GetHashCode();
if (this.PaymentAmount != null)
hashCode = hashCode * 59 + this.PaymentAmount.GetHashCode();
if (this.AcquirerId != null)
hashCode = hashCode * 59 + this.AcquirerId.GetHashCode();
if (this.CardBrand != null)
hashCode = hashCode * 59 + this.CardBrand.GetHashCode();
if (this.AuthorizationCode != null)
hashCode = hashCode * 59 + this.AuthorizationCode.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
Loading