forked from Adyen/adyen-dotnet-api-library
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPaymentInstrument.cs
391 lines (358 loc) · 20.7 KB
/
PaymentInstrument.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
/*
* Configuration webhooks
*
*
* The version of the OpenAPI document: 1
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.IO;
using System.Runtime.Serialization;
using System.Text;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System.ComponentModel.DataAnnotations;
using OpenAPIDateConverter = Adyen.ApiSerialization.OpenAPIDateConverter;
namespace Adyen.Model.ConfigurationWebhooks
{
/// <summary>
/// PaymentInstrument
/// </summary>
[DataContract(Name = "PaymentInstrument")]
public partial class PaymentInstrument : IEquatable<PaymentInstrument>, IValidatableObject
{
/// <summary>
/// The status of the payment instrument. If a status is not specified when creating a payment instrument, it is set to **Active** by default. However, there can be exceptions for cards based on the `card.formFactor` and the `issuingCountryCode`. For example, when issuing physical cards in the US, the default status is **Requested**. Possible values: * **Active**: The payment instrument is active and can be used to make payments. * **Requested**: The payment instrument has been requested. This state is applicable for physical cards. * **Inactive**: The payment instrument is inactive and cannot be used to make payments. * **Suspended**: The payment instrument is temporarily suspended and cannot be used to make payments. * **Closed**: The payment instrument is permanently closed. This action cannot be undone. * **Stolen** * **Lost**
/// </summary>
/// <value>The status of the payment instrument. If a status is not specified when creating a payment instrument, it is set to **Active** by default. However, there can be exceptions for cards based on the `card.formFactor` and the `issuingCountryCode`. For example, when issuing physical cards in the US, the default status is **Requested**. Possible values: * **Active**: The payment instrument is active and can be used to make payments. * **Requested**: The payment instrument has been requested. This state is applicable for physical cards. * **Inactive**: The payment instrument is inactive and cannot be used to make payments. * **Suspended**: The payment instrument is temporarily suspended and cannot be used to make payments. * **Closed**: The payment instrument is permanently closed. This action cannot be undone. * **Stolen** * **Lost** </value>
[JsonConverter(typeof(StringEnumConverter))]
public enum StatusEnum
{
/// <summary>
/// Enum Active for value: Active
/// </summary>
[EnumMember(Value = "Active")]
Active = 1,
/// <summary>
/// Enum Closed for value: Closed
/// </summary>
[EnumMember(Value = "Closed")]
Closed = 2,
/// <summary>
/// Enum Inactive for value: Inactive
/// </summary>
[EnumMember(Value = "Inactive")]
Inactive = 3,
/// <summary>
/// Enum Lost for value: Lost
/// </summary>
[EnumMember(Value = "Lost")]
Lost = 4,
/// <summary>
/// Enum Requested for value: Requested
/// </summary>
[EnumMember(Value = "Requested")]
Requested = 5,
/// <summary>
/// Enum Stolen for value: Stolen
/// </summary>
[EnumMember(Value = "Stolen")]
Stolen = 6,
/// <summary>
/// Enum Suspended for value: Suspended
/// </summary>
[EnumMember(Value = "Suspended")]
Suspended = 7,
/// <summary>
/// Enum Blocked for value: blocked
/// </summary>
[EnumMember(Value = "blocked")]
Blocked = 8,
/// <summary>
/// Enum Discarded for value: discarded
/// </summary>
[EnumMember(Value = "discarded")]
Discarded = 9
}
/// <summary>
/// The status of the payment instrument. If a status is not specified when creating a payment instrument, it is set to **Active** by default. However, there can be exceptions for cards based on the `card.formFactor` and the `issuingCountryCode`. For example, when issuing physical cards in the US, the default status is **Requested**. Possible values: * **Active**: The payment instrument is active and can be used to make payments. * **Requested**: The payment instrument has been requested. This state is applicable for physical cards. * **Inactive**: The payment instrument is inactive and cannot be used to make payments. * **Suspended**: The payment instrument is temporarily suspended and cannot be used to make payments. * **Closed**: The payment instrument is permanently closed. This action cannot be undone. * **Stolen** * **Lost**
/// </summary>
/// <value>The status of the payment instrument. If a status is not specified when creating a payment instrument, it is set to **Active** by default. However, there can be exceptions for cards based on the `card.formFactor` and the `issuingCountryCode`. For example, when issuing physical cards in the US, the default status is **Requested**. Possible values: * **Active**: The payment instrument is active and can be used to make payments. * **Requested**: The payment instrument has been requested. This state is applicable for physical cards. * **Inactive**: The payment instrument is inactive and cannot be used to make payments. * **Suspended**: The payment instrument is temporarily suspended and cannot be used to make payments. * **Closed**: The payment instrument is permanently closed. This action cannot be undone. * **Stolen** * **Lost** </value>
[DataMember(Name = "status", EmitDefaultValue = false)]
public StatusEnum? Status { get; set; }
/// <summary>
/// Type of payment instrument. Possible value: **card**, **bankAccount**.
/// </summary>
/// <value>Type of payment instrument. Possible value: **card**, **bankAccount**. </value>
[JsonConverter(typeof(StringEnumConverter))]
public enum TypeEnum
{
/// <summary>
/// Enum BankAccount for value: bankAccount
/// </summary>
[EnumMember(Value = "bankAccount")]
BankAccount = 1,
/// <summary>
/// Enum Card for value: card
/// </summary>
[EnumMember(Value = "card")]
Card = 2
}
/// <summary>
/// Type of payment instrument. Possible value: **card**, **bankAccount**.
/// </summary>
/// <value>Type of payment instrument. Possible value: **card**, **bankAccount**. </value>
[DataMember(Name = "type", IsRequired = false, EmitDefaultValue = false)]
public TypeEnum Type { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="PaymentInstrument" /> class.
/// </summary>
[JsonConstructorAttribute]
protected PaymentInstrument() { }
/// <summary>
/// Initializes a new instance of the <see cref="PaymentInstrument" /> class.
/// </summary>
/// <param name="balanceAccountId">The unique identifier of the [balance account](https://docs.adyen.com/api-explorer/#/balanceplatform/v1/post/balanceAccounts__resParam_id) associated with the payment instrument. (required).</param>
/// <param name="bankAccount">bankAccount.</param>
/// <param name="card">card.</param>
/// <param name="description">Your description for the payment instrument, maximum 300 characters..</param>
/// <param name="id">The unique identifier of the payment instrument. (required).</param>
/// <param name="issuingCountryCode">The two-character [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country code where the payment instrument is issued. For example, **NL** or **US**. (required).</param>
/// <param name="paymentInstrumentGroupId">The unique identifier of the [payment instrument group](https://docs.adyen.com/api-explorer/#/balanceplatform/v1/post/paymentInstrumentGroups__resParam_id) to which the payment instrument belongs..</param>
/// <param name="reference">Your reference for the payment instrument, maximum 150 characters..</param>
/// <param name="status">The status of the payment instrument. If a status is not specified when creating a payment instrument, it is set to **Active** by default. However, there can be exceptions for cards based on the `card.formFactor` and the `issuingCountryCode`. For example, when issuing physical cards in the US, the default status is **Requested**. Possible values: * **Active**: The payment instrument is active and can be used to make payments. * **Requested**: The payment instrument has been requested. This state is applicable for physical cards. * **Inactive**: The payment instrument is inactive and cannot be used to make payments. * **Suspended**: The payment instrument is temporarily suspended and cannot be used to make payments. * **Closed**: The payment instrument is permanently closed. This action cannot be undone. * **Stolen** * **Lost** .</param>
/// <param name="type">Type of payment instrument. Possible value: **card**, **bankAccount**. (required).</param>
public PaymentInstrument(string balanceAccountId = default(string), PaymentInstrumentBankAccount bankAccount = default(PaymentInstrumentBankAccount), Card card = default(Card), string description = default(string), string id = default(string), string issuingCountryCode = default(string), string paymentInstrumentGroupId = default(string), string reference = default(string), StatusEnum? status = default(StatusEnum?), TypeEnum type = default(TypeEnum))
{
this.BalanceAccountId = balanceAccountId;
this.Id = id;
this.IssuingCountryCode = issuingCountryCode;
this.Type = type;
this.BankAccount = bankAccount;
this.Card = card;
this.Description = description;
this.PaymentInstrumentGroupId = paymentInstrumentGroupId;
this.Reference = reference;
this.Status = status;
}
/// <summary>
/// The unique identifier of the [balance account](https://docs.adyen.com/api-explorer/#/balanceplatform/v1/post/balanceAccounts__resParam_id) associated with the payment instrument.
/// </summary>
/// <value>The unique identifier of the [balance account](https://docs.adyen.com/api-explorer/#/balanceplatform/v1/post/balanceAccounts__resParam_id) associated with the payment instrument.</value>
[DataMember(Name = "balanceAccountId", IsRequired = false, EmitDefaultValue = false)]
public string BalanceAccountId { get; set; }
/// <summary>
/// Gets or Sets BankAccount
/// </summary>
[DataMember(Name = "bankAccount", EmitDefaultValue = false)]
public PaymentInstrumentBankAccount BankAccount { get; set; }
/// <summary>
/// Gets or Sets Card
/// </summary>
[DataMember(Name = "card", EmitDefaultValue = false)]
public Card Card { get; set; }
/// <summary>
/// Your description for the payment instrument, maximum 300 characters.
/// </summary>
/// <value>Your description for the payment instrument, maximum 300 characters.</value>
[DataMember(Name = "description", EmitDefaultValue = false)]
public string Description { get; set; }
/// <summary>
/// The unique identifier of the payment instrument.
/// </summary>
/// <value>The unique identifier of the payment instrument.</value>
[DataMember(Name = "id", IsRequired = false, EmitDefaultValue = false)]
public string Id { get; set; }
/// <summary>
/// The two-character [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country code where the payment instrument is issued. For example, **NL** or **US**.
/// </summary>
/// <value>The two-character [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country code where the payment instrument is issued. For example, **NL** or **US**.</value>
[DataMember(Name = "issuingCountryCode", IsRequired = false, EmitDefaultValue = false)]
public string IssuingCountryCode { get; set; }
/// <summary>
/// The unique identifier of the [payment instrument group](https://docs.adyen.com/api-explorer/#/balanceplatform/v1/post/paymentInstrumentGroups__resParam_id) to which the payment instrument belongs.
/// </summary>
/// <value>The unique identifier of the [payment instrument group](https://docs.adyen.com/api-explorer/#/balanceplatform/v1/post/paymentInstrumentGroups__resParam_id) to which the payment instrument belongs.</value>
[DataMember(Name = "paymentInstrumentGroupId", EmitDefaultValue = false)]
public string PaymentInstrumentGroupId { get; set; }
/// <summary>
/// Your reference for the payment instrument, maximum 150 characters.
/// </summary>
/// <value>Your reference for the payment instrument, maximum 150 characters.</value>
[DataMember(Name = "reference", EmitDefaultValue = false)]
public string Reference { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString()
{
StringBuilder sb = new StringBuilder();
sb.Append("class PaymentInstrument {\n");
sb.Append(" BalanceAccountId: ").Append(BalanceAccountId).Append("\n");
sb.Append(" BankAccount: ").Append(BankAccount).Append("\n");
sb.Append(" Card: ").Append(Card).Append("\n");
sb.Append(" Description: ").Append(Description).Append("\n");
sb.Append(" Id: ").Append(Id).Append("\n");
sb.Append(" IssuingCountryCode: ").Append(IssuingCountryCode).Append("\n");
sb.Append(" PaymentInstrumentGroupId: ").Append(PaymentInstrumentGroupId).Append("\n");
sb.Append(" Reference: ").Append(Reference).Append("\n");
sb.Append(" Status: ").Append(Status).Append("\n");
sb.Append(" Type: ").Append(Type).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 Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.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 PaymentInstrument);
}
/// <summary>
/// Returns true if PaymentInstrument instances are equal
/// </summary>
/// <param name="input">Instance of PaymentInstrument to be compared</param>
/// <returns>Boolean</returns>
public bool Equals(PaymentInstrument input)
{
if (input == null)
{
return false;
}
return
(
this.BalanceAccountId == input.BalanceAccountId ||
(this.BalanceAccountId != null &&
this.BalanceAccountId.Equals(input.BalanceAccountId))
) &&
(
this.BankAccount == input.BankAccount ||
(this.BankAccount != null &&
this.BankAccount.Equals(input.BankAccount))
) &&
(
this.Card == input.Card ||
(this.Card != null &&
this.Card.Equals(input.Card))
) &&
(
this.Description == input.Description ||
(this.Description != null &&
this.Description.Equals(input.Description))
) &&
(
this.Id == input.Id ||
(this.Id != null &&
this.Id.Equals(input.Id))
) &&
(
this.IssuingCountryCode == input.IssuingCountryCode ||
(this.IssuingCountryCode != null &&
this.IssuingCountryCode.Equals(input.IssuingCountryCode))
) &&
(
this.PaymentInstrumentGroupId == input.PaymentInstrumentGroupId ||
(this.PaymentInstrumentGroupId != null &&
this.PaymentInstrumentGroupId.Equals(input.PaymentInstrumentGroupId))
) &&
(
this.Reference == input.Reference ||
(this.Reference != null &&
this.Reference.Equals(input.Reference))
) &&
(
this.Status == input.Status ||
this.Status.Equals(input.Status)
) &&
(
this.Type == input.Type ||
this.Type.Equals(input.Type)
);
}
/// <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.BalanceAccountId != null)
{
hashCode = (hashCode * 59) + this.BalanceAccountId.GetHashCode();
}
if (this.BankAccount != null)
{
hashCode = (hashCode * 59) + this.BankAccount.GetHashCode();
}
if (this.Card != null)
{
hashCode = (hashCode * 59) + this.Card.GetHashCode();
}
if (this.Description != null)
{
hashCode = (hashCode * 59) + this.Description.GetHashCode();
}
if (this.Id != null)
{
hashCode = (hashCode * 59) + this.Id.GetHashCode();
}
if (this.IssuingCountryCode != null)
{
hashCode = (hashCode * 59) + this.IssuingCountryCode.GetHashCode();
}
if (this.PaymentInstrumentGroupId != null)
{
hashCode = (hashCode * 59) + this.PaymentInstrumentGroupId.GetHashCode();
}
if (this.Reference != null)
{
hashCode = (hashCode * 59) + this.Reference.GetHashCode();
}
hashCode = (hashCode * 59) + this.Status.GetHashCode();
hashCode = (hashCode * 59) + this.Type.GetHashCode();
return hashCode;
}
}
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
public IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> Validate(ValidationContext validationContext)
{
// Description (string) maxLength
if (this.Description != null && this.Description.Length > 300)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Description, length must be less than 300.", new [] { "Description" });
}
// Reference (string) maxLength
if (this.Reference != null && this.Reference.Length > 150)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Reference, length must be less than 150.", new [] { "Reference" });
}
yield break;
}
}
}