Skip to content

Commit b49464f

Browse files
authored
Merge pull request #946 from abuzuhri/fix/issues-940-941
Fix/issues 940 941
2 parents ede72d6 + ec44a9b commit b49464f

5 files changed

Lines changed: 379 additions & 5 deletions

File tree

Source/FikaAmazonAPI/AmazonSpApiSDK/Models/OrdersV20260101/Order.cs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public Order() { }
3737
/// <param name="fulfillment">Information about how the order is being processed, packed, and shipped to the customer.</param>
3838
/// <param name="orderItems">The list of all order items included in this order. (required)</param>
3939
/// <param name="packages">Shipping packages created for this order, including tracking information. Note: Only available for merchant-fulfilled (FBM) orders.</param>
40+
/// <param name="payment">Payment information for the order.</param>
4041
public Order(string orderId,
4142
List<OrderAliase> orderAliases,
4243
DateTime createdTime,
@@ -49,7 +50,8 @@ public Order(string orderId,
4950
OrderProceeds proceeds,
5051
OrderFulfillment fulfillment,
5152
List<OrderItem> orderItems,
52-
List<Package> packages)
53+
List<Package> packages,
54+
OrderPayment payment)
5355
{
5456

5557
this.OrderId = orderId;
@@ -65,6 +67,7 @@ public Order(string orderId,
6567
this.Proceeds = proceeds;
6668
this.Fulfillment = fulfillment;
6769
this.Packages = packages;
70+
this.Payment = payment;
6871
}
6972

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

164+
/// <summary>
165+
/// Payment information for the order.
166+
/// </summary>
167+
/// <value>Payment information for the order.</value>
168+
[DataMember(Name = "payment", EmitDefaultValue = false)]
169+
public OrderPayment Payment { get; set; }
170+
161171

162172
/// <summary>
163173
/// Returns the string presentation of the object
@@ -180,6 +190,7 @@ public override string ToString()
180190
sb.Append(" Fulfillment: ").Append(Fulfillment).Append("\n");
181191
sb.Append(" OrderItems: ").Append(OrderItems).Append("\n");
182192
sb.Append(" Packages: ").Append(Packages).Append("\n");
193+
sb.Append(" Payment: ").Append(Payment).Append("\n");
183194
sb.Append("}\n");
184195
return sb.ToString();
185196
}
@@ -278,6 +289,11 @@ public bool Equals(Order input)
278289
Packages == input.Packages ||
279290
Packages != null &&
280291
Packages.SequenceEqual(input.Packages)
292+
) &&
293+
(
294+
Payment == input.Payment ||
295+
Payment != null &&
296+
Payment.Equals(input.Payment)
281297
);
282298
}
283299

@@ -316,6 +332,8 @@ public override int GetHashCode()
316332
hashCode = hashCode * 59 + OrderItems.GetHashCode();
317333
if (Packages != null)
318334
hashCode = hashCode * 59 + Packages.GetHashCode();
335+
if (Payment != null)
336+
hashCode = hashCode * 59 + Payment.GetHashCode();
319337
return hashCode;
320338
}
321339
}
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
using Newtonsoft.Json;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.ComponentModel.DataAnnotations;
5+
using System.Linq;
6+
using System.Runtime.Serialization;
7+
using System.Text;
8+
9+
namespace FikaAmazonAPI.AmazonSpApiSDK.Models.OrdersV20260101
10+
{
11+
/// <summary>
12+
/// Payment information about the order.
13+
/// </summary>
14+
[DataContract]
15+
public partial class OrderPayment : IEquatable<OrderPayment>, IValidatableObject
16+
{
17+
/// <summary>
18+
/// Initializes a new instance of the <see cref="OrderPayment" /> class.
19+
/// </summary>
20+
public OrderPayment()
21+
{
22+
}
23+
24+
/// <summary>
25+
/// Initializes a new instance of the <see cref="OrderPayment" /> class.
26+
/// </summary>
27+
/// <param name="paymentExecutions">A list of payment executions for the order.</param>
28+
public OrderPayment(List<PaymentExecution> paymentExecutions)
29+
{
30+
this.PaymentExecutions = paymentExecutions;
31+
}
32+
33+
/// <summary>
34+
/// A list of payment executions for the order.
35+
/// </summary>
36+
/// <value>A list of payment executions for the order.</value>
37+
[DataMember(Name = "paymentExecutions", EmitDefaultValue = false)]
38+
public List<PaymentExecution> PaymentExecutions { get; set; }
39+
40+
/// <summary>
41+
/// Returns the string presentation of the object
42+
/// </summary>
43+
/// <returns>String presentation of the object</returns>
44+
public override string ToString()
45+
{
46+
var sb = new StringBuilder();
47+
sb.Append("class OrderPayment {\n");
48+
sb.Append(" PaymentExecutions: ").Append(PaymentExecutions).Append("\n");
49+
sb.Append("}\n");
50+
return sb.ToString();
51+
}
52+
53+
/// <summary>
54+
/// Returns the JSON string presentation of the object
55+
/// </summary>
56+
/// <returns>JSON string presentation of the object</returns>
57+
public virtual string ToJson()
58+
{
59+
return JsonConvert.SerializeObject(this, Formatting.Indented);
60+
}
61+
62+
/// <summary>
63+
/// Returns true if objects are equal
64+
/// </summary>
65+
/// <param name="obj">Object to be compared</param>
66+
/// <returns>Boolean</returns>
67+
public override bool Equals(object obj)
68+
{
69+
return this.Equals(obj as OrderPayment);
70+
}
71+
72+
/// <summary>
73+
/// Returns true if OrderPayment instances are equal
74+
/// </summary>
75+
/// <param name="input">Instance of OrderPayment to be compared</param>
76+
/// <returns>Boolean</returns>
77+
public bool Equals(OrderPayment input)
78+
{
79+
if (input == null)
80+
return false;
81+
82+
return
83+
(
84+
this.PaymentExecutions == input.PaymentExecutions ||
85+
(this.PaymentExecutions != null &&
86+
this.PaymentExecutions.SequenceEqual(input.PaymentExecutions))
87+
);
88+
}
89+
90+
/// <summary>
91+
/// Gets the hash code
92+
/// </summary>
93+
/// <returns>Hash code</returns>
94+
public override int GetHashCode()
95+
{
96+
unchecked // Overflow is fine, just wrap
97+
{
98+
int hashCode = 41;
99+
if (this.PaymentExecutions != null)
100+
{
101+
foreach (var paymentExecution in this.PaymentExecutions)
102+
hashCode = hashCode * 59 + (paymentExecution?.GetHashCode() ?? 0);
103+
}
104+
return hashCode;
105+
}
106+
}
107+
108+
/// <summary>
109+
/// To validate all properties of the instance
110+
/// </summary>
111+
/// <param name="validationContext">Validation context</param>
112+
/// <returns>Validation Result</returns>
113+
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
114+
{
115+
yield break;
116+
}
117+
}
118+
119+
}
Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
using Newtonsoft.Json;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.ComponentModel.DataAnnotations;
5+
using System.Runtime.Serialization;
6+
using System.Text;
7+
8+
namespace FikaAmazonAPI.AmazonSpApiSDK.Models.OrdersV20260101
9+
{
10+
/// <summary>
11+
/// Payment execution details for an order.
12+
/// </summary>
13+
[DataContract]
14+
public partial class PaymentExecution : IEquatable<PaymentExecution>, IValidatableObject
15+
{
16+
/// <summary>
17+
/// Initializes a new instance of the <see cref="PaymentExecution" /> class.
18+
/// </summary>
19+
public PaymentExecution()
20+
{
21+
}
22+
23+
/// <summary>
24+
/// Initializes a new instance of the <see cref="PaymentExecution" /> class.
25+
/// </summary>
26+
/// <param name="paymentMethod">The payment method used for this payment execution (for example, CashOnDelivery, ConvenienceStore, CreditCard, Invoice, Pix, and so on).</param>
27+
/// <param name="paymentAmount">The monetary value of the payment execution.</param>
28+
/// <param name="acquirerId">The unique identifier of the payment processor or acquiring bank that authorizes the payment.</param>
29+
/// <param name="cardBrand">The card network or brand used in the payment transaction (for example, Visa or Mastercard).</param>
30+
/// <param name="authorizationCode">The unique code that confirms the payment authorization.</param>
31+
public PaymentExecution(string paymentMethod, Money paymentAmount, string acquirerId, string cardBrand, string authorizationCode)
32+
{
33+
this.PaymentMethod = paymentMethod;
34+
this.PaymentAmount = paymentAmount;
35+
this.AcquirerId = acquirerId;
36+
this.CardBrand = cardBrand;
37+
this.AuthorizationCode = authorizationCode;
38+
}
39+
40+
/// <summary>
41+
/// The payment method used for this payment execution (for example, CashOnDelivery, ConvenienceStore, CreditCard, Invoice, Pix, and so on).
42+
/// </summary>
43+
/// <value>The payment method used for this payment execution (for example, CashOnDelivery, ConvenienceStore, CreditCard, Invoice, Pix, and so on).</value>
44+
[DataMember(Name = "paymentMethod", EmitDefaultValue = false)]
45+
public string PaymentMethod { get; set; }
46+
47+
/// <summary>
48+
/// The monetary value of the payment execution.
49+
/// </summary>
50+
/// <value>The monetary value of the payment execution.</value>
51+
[DataMember(Name = "paymentAmount", EmitDefaultValue = false)]
52+
public Money PaymentAmount { get; set; }
53+
54+
/// <summary>
55+
/// The unique identifier of the payment processor or acquiring bank that authorizes the payment.
56+
/// <br/><br/>
57+
/// Note: This attribute is only available for orders in the Brazil (BR) marketplace when the paymentMethod is CreditCard or Pix.
58+
/// </summary>
59+
/// <value>The unique identifier of the payment processor or acquiring bank that authorizes the payment.</value>
60+
[DataMember(Name = "acquirerId", EmitDefaultValue = false)]
61+
public string AcquirerId { get; set; }
62+
63+
/// <summary>
64+
/// The card network or brand used in the payment transaction (for example, Visa or Mastercard).
65+
/// <br/><br/>
66+
/// Note: This attribute is only available for orders in the Brazil (BR) marketplace when the paymentMethod is CreditCard.
67+
/// </summary>
68+
/// <value>The card network or brand used in the payment transaction (for example, Visa or Mastercard).</value>
69+
[DataMember(Name = "cardBrand", EmitDefaultValue = false)]
70+
public string CardBrand { get; set; }
71+
72+
/// <summary>
73+
/// The unique code that confirms the payment authorization.
74+
/// <br/><br/>
75+
/// Note: This attribute is only available for orders in the Brazil (BR) marketplace when the paymentMethod is CreditCard or Pix.
76+
/// </summary>
77+
/// <value>The unique code that confirms the payment authorization.</value>
78+
[DataMember(Name = "authorizationCode", EmitDefaultValue = false)]
79+
public string AuthorizationCode { get; set; }
80+
81+
/// <summary>
82+
/// Returns the string presentation of the object
83+
/// </summary>
84+
/// <returns>String presentation of the object</returns>
85+
public override string ToString()
86+
{
87+
var sb = new StringBuilder();
88+
sb.Append("class PaymentExecution {\n");
89+
sb.Append(" PaymentMethod: ").Append(PaymentMethod).Append("\n");
90+
sb.Append(" PaymentAmount: ").Append(PaymentAmount).Append("\n");
91+
sb.Append(" AcquirerId: ").Append(AcquirerId).Append("\n");
92+
sb.Append(" CardBrand: ").Append(CardBrand).Append("\n");
93+
sb.Append(" AuthorizationCode: ").Append(AuthorizationCode).Append("\n");
94+
sb.Append("}\n");
95+
return sb.ToString();
96+
}
97+
98+
/// <summary>
99+
/// Returns the JSON string presentation of the object
100+
/// </summary>
101+
/// <returns>JSON string presentation of the object</returns>
102+
public virtual string ToJson()
103+
{
104+
return JsonConvert.SerializeObject(this, Formatting.Indented);
105+
}
106+
107+
/// <summary>
108+
/// Returns true if objects are equal
109+
/// </summary>
110+
/// <param name="obj">Object to be compared</param>
111+
/// <returns>Boolean</returns>
112+
public override bool Equals(object obj)
113+
{
114+
return this.Equals(obj as PaymentExecution);
115+
}
116+
117+
/// <summary>
118+
/// Returns true if PaymentExecution instances are equal
119+
/// </summary>
120+
/// <param name="input">Instance of PaymentExecution to be compared</param>
121+
/// <returns>Boolean</returns>
122+
public bool Equals(PaymentExecution input)
123+
{
124+
if (input == null)
125+
return false;
126+
127+
return
128+
(
129+
this.PaymentMethod == input.PaymentMethod ||
130+
(this.PaymentMethod != null &&
131+
this.PaymentMethod.Equals(input.PaymentMethod))
132+
) &&
133+
(
134+
this.PaymentAmount == input.PaymentAmount ||
135+
(this.PaymentAmount != null &&
136+
this.PaymentAmount.Equals(input.PaymentAmount))
137+
) &&
138+
(
139+
this.AcquirerId == input.AcquirerId ||
140+
(this.AcquirerId != null &&
141+
this.AcquirerId.Equals(input.AcquirerId))
142+
) &&
143+
(
144+
this.CardBrand == input.CardBrand ||
145+
(this.CardBrand != null &&
146+
this.CardBrand.Equals(input.CardBrand))
147+
) &&
148+
(
149+
this.AuthorizationCode == input.AuthorizationCode ||
150+
(this.AuthorizationCode != null &&
151+
this.AuthorizationCode.Equals(input.AuthorizationCode))
152+
);
153+
}
154+
155+
/// <summary>
156+
/// Gets the hash code
157+
/// </summary>
158+
/// <returns>Hash code</returns>
159+
public override int GetHashCode()
160+
{
161+
unchecked // Overflow is fine, just wrap
162+
{
163+
int hashCode = 41;
164+
if (this.PaymentMethod != null)
165+
hashCode = hashCode * 59 + this.PaymentMethod.GetHashCode();
166+
if (this.PaymentAmount != null)
167+
hashCode = hashCode * 59 + this.PaymentAmount.GetHashCode();
168+
if (this.AcquirerId != null)
169+
hashCode = hashCode * 59 + this.AcquirerId.GetHashCode();
170+
if (this.CardBrand != null)
171+
hashCode = hashCode * 59 + this.CardBrand.GetHashCode();
172+
if (this.AuthorizationCode != null)
173+
hashCode = hashCode * 59 + this.AuthorizationCode.GetHashCode();
174+
return hashCode;
175+
}
176+
}
177+
178+
/// <summary>
179+
/// To validate all properties of the instance
180+
/// </summary>
181+
/// <param name="validationContext">Validation context</param>
182+
/// <returns>Validation Result</returns>
183+
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
184+
{
185+
yield break;
186+
}
187+
}
188+
189+
}

0 commit comments

Comments
 (0)