forked from Adyen/adyen-dotnet-api-library
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCard.cs
387 lines (361 loc) · 17.2 KB
/
Card.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
/*
* 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>
/// Card
/// </summary>
[DataContract(Name = "Card")]
public partial class Card : IEquatable<Card>, IValidatableObject
{
/// <summary>
/// The form factor of the card. Possible values: **virtual**, **physical**.
/// </summary>
/// <value>The form factor of the card. Possible values: **virtual**, **physical**.</value>
[JsonConverter(typeof(StringEnumConverter))]
public enum FormFactorEnum
{
/// <summary>
/// Enum Physical for value: physical
/// </summary>
[EnumMember(Value = "physical")]
Physical = 1,
/// <summary>
/// Enum Unknown for value: unknown
/// </summary>
[EnumMember(Value = "unknown")]
Unknown = 2,
/// <summary>
/// Enum Virtual for value: virtual
/// </summary>
[EnumMember(Value = "virtual")]
Virtual = 3
}
/// <summary>
/// The form factor of the card. Possible values: **virtual**, **physical**.
/// </summary>
/// <value>The form factor of the card. Possible values: **virtual**, **physical**.</value>
[DataMember(Name = "formFactor", IsRequired = false, EmitDefaultValue = false)]
public FormFactorEnum FormFactor { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="Card" /> class.
/// </summary>
[JsonConstructorAttribute]
protected Card() { }
/// <summary>
/// Initializes a new instance of the <see cref="Card" /> class.
/// </summary>
/// <param name="authentication">authentication.</param>
/// <param name="bin">The bank identification number (BIN) of the card number..</param>
/// <param name="brand">The brand of the physical or the virtual card. Possible values: **visa**, **mc**. (required).</param>
/// <param name="brandVariant">The brand variant of the physical or the virtual card. For example, **visadebit** or **mcprepaid**. >Reach out to your Adyen contact to get the values relevant for your integration. (required).</param>
/// <param name="cardholderName">The name of the cardholder. Maximum length: 26 characters. (required).</param>
/// <param name="configuration">configuration.</param>
/// <param name="cvc">The CVC2 value of the card. > The CVC2 is not sent by default. This is only returned in the `POST` response for single-use virtual cards..</param>
/// <param name="deliveryContact">deliveryContact.</param>
/// <param name="expiration">expiration.</param>
/// <param name="formFactor">The form factor of the card. Possible values: **virtual**, **physical**. (required).</param>
/// <param name="lastFour">Last last four digits of the card number..</param>
/// <param name="number">The primary account number (PAN) of the card. > The PAN is masked by default and returned only for single-use virtual cards. (required).</param>
/// <param name="threeDSecure">Allocates a specific product range for either a physical or a virtual card. Possible values: **fullySupported**, **secureCorporate**. >Reach out to your Adyen contact to get the values relevant for your integration..</param>
public Card(Authentication authentication = default(Authentication), string bin = default(string), string brand = default(string), string brandVariant = default(string), string cardholderName = default(string), CardConfiguration configuration = default(CardConfiguration), string cvc = default(string), Contact deliveryContact = default(Contact), Expiry expiration = default(Expiry), FormFactorEnum formFactor = default(FormFactorEnum), string lastFour = default(string), string number = default(string), string threeDSecure = default(string))
{
this.Brand = brand;
this.BrandVariant = brandVariant;
this.CardholderName = cardholderName;
this.FormFactor = formFactor;
this.Number = number;
this.Authentication = authentication;
this.Bin = bin;
this._Configuration = configuration;
this.Cvc = cvc;
this.DeliveryContact = deliveryContact;
this.Expiration = expiration;
this.LastFour = lastFour;
this.ThreeDSecure = threeDSecure;
}
/// <summary>
/// Gets or Sets Authentication
/// </summary>
[DataMember(Name = "authentication", EmitDefaultValue = false)]
public Authentication Authentication { get; set; }
/// <summary>
/// The bank identification number (BIN) of the card number.
/// </summary>
/// <value>The bank identification number (BIN) of the card number.</value>
[DataMember(Name = "bin", EmitDefaultValue = false)]
public string Bin { get; set; }
/// <summary>
/// The brand of the physical or the virtual card. Possible values: **visa**, **mc**.
/// </summary>
/// <value>The brand of the physical or the virtual card. Possible values: **visa**, **mc**.</value>
[DataMember(Name = "brand", IsRequired = false, EmitDefaultValue = false)]
public string Brand { get; set; }
/// <summary>
/// The brand variant of the physical or the virtual card. For example, **visadebit** or **mcprepaid**. >Reach out to your Adyen contact to get the values relevant for your integration.
/// </summary>
/// <value>The brand variant of the physical or the virtual card. For example, **visadebit** or **mcprepaid**. >Reach out to your Adyen contact to get the values relevant for your integration.</value>
[DataMember(Name = "brandVariant", IsRequired = false, EmitDefaultValue = false)]
public string BrandVariant { get; set; }
/// <summary>
/// The name of the cardholder. Maximum length: 26 characters.
/// </summary>
/// <value>The name of the cardholder. Maximum length: 26 characters.</value>
[DataMember(Name = "cardholderName", IsRequired = false, EmitDefaultValue = false)]
public string CardholderName { get; set; }
/// <summary>
/// Gets or Sets _Configuration
/// </summary>
[DataMember(Name = "configuration", EmitDefaultValue = false)]
public CardConfiguration _Configuration { get; set; }
/// <summary>
/// The CVC2 value of the card. > The CVC2 is not sent by default. This is only returned in the `POST` response for single-use virtual cards.
/// </summary>
/// <value>The CVC2 value of the card. > The CVC2 is not sent by default. This is only returned in the `POST` response for single-use virtual cards.</value>
[DataMember(Name = "cvc", EmitDefaultValue = false)]
public string Cvc { get; set; }
/// <summary>
/// Gets or Sets DeliveryContact
/// </summary>
[DataMember(Name = "deliveryContact", EmitDefaultValue = false)]
public Contact DeliveryContact { get; set; }
/// <summary>
/// Gets or Sets Expiration
/// </summary>
[DataMember(Name = "expiration", EmitDefaultValue = false)]
public Expiry Expiration { get; set; }
/// <summary>
/// Last last four digits of the card number.
/// </summary>
/// <value>Last last four digits of the card number.</value>
[DataMember(Name = "lastFour", EmitDefaultValue = false)]
public string LastFour { get; set; }
/// <summary>
/// The primary account number (PAN) of the card. > The PAN is masked by default and returned only for single-use virtual cards.
/// </summary>
/// <value>The primary account number (PAN) of the card. > The PAN is masked by default and returned only for single-use virtual cards.</value>
[DataMember(Name = "number", IsRequired = false, EmitDefaultValue = false)]
public string Number { get; set; }
/// <summary>
/// Allocates a specific product range for either a physical or a virtual card. Possible values: **fullySupported**, **secureCorporate**. >Reach out to your Adyen contact to get the values relevant for your integration.
/// </summary>
/// <value>Allocates a specific product range for either a physical or a virtual card. Possible values: **fullySupported**, **secureCorporate**. >Reach out to your Adyen contact to get the values relevant for your integration.</value>
[DataMember(Name = "threeDSecure", EmitDefaultValue = false)]
public string ThreeDSecure { 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 Card {\n");
sb.Append(" Authentication: ").Append(Authentication).Append("\n");
sb.Append(" Bin: ").Append(Bin).Append("\n");
sb.Append(" Brand: ").Append(Brand).Append("\n");
sb.Append(" BrandVariant: ").Append(BrandVariant).Append("\n");
sb.Append(" CardholderName: ").Append(CardholderName).Append("\n");
sb.Append(" _Configuration: ").Append(_Configuration).Append("\n");
sb.Append(" Cvc: ").Append(Cvc).Append("\n");
sb.Append(" DeliveryContact: ").Append(DeliveryContact).Append("\n");
sb.Append(" Expiration: ").Append(Expiration).Append("\n");
sb.Append(" FormFactor: ").Append(FormFactor).Append("\n");
sb.Append(" LastFour: ").Append(LastFour).Append("\n");
sb.Append(" Number: ").Append(Number).Append("\n");
sb.Append(" ThreeDSecure: ").Append(ThreeDSecure).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 Card);
}
/// <summary>
/// Returns true if Card instances are equal
/// </summary>
/// <param name="input">Instance of Card to be compared</param>
/// <returns>Boolean</returns>
public bool Equals(Card input)
{
if (input == null)
{
return false;
}
return
(
this.Authentication == input.Authentication ||
(this.Authentication != null &&
this.Authentication.Equals(input.Authentication))
) &&
(
this.Bin == input.Bin ||
(this.Bin != null &&
this.Bin.Equals(input.Bin))
) &&
(
this.Brand == input.Brand ||
(this.Brand != null &&
this.Brand.Equals(input.Brand))
) &&
(
this.BrandVariant == input.BrandVariant ||
(this.BrandVariant != null &&
this.BrandVariant.Equals(input.BrandVariant))
) &&
(
this.CardholderName == input.CardholderName ||
(this.CardholderName != null &&
this.CardholderName.Equals(input.CardholderName))
) &&
(
this._Configuration == input._Configuration ||
(this._Configuration != null &&
this._Configuration.Equals(input._Configuration))
) &&
(
this.Cvc == input.Cvc ||
(this.Cvc != null &&
this.Cvc.Equals(input.Cvc))
) &&
(
this.DeliveryContact == input.DeliveryContact ||
(this.DeliveryContact != null &&
this.DeliveryContact.Equals(input.DeliveryContact))
) &&
(
this.Expiration == input.Expiration ||
(this.Expiration != null &&
this.Expiration.Equals(input.Expiration))
) &&
(
this.FormFactor == input.FormFactor ||
this.FormFactor.Equals(input.FormFactor)
) &&
(
this.LastFour == input.LastFour ||
(this.LastFour != null &&
this.LastFour.Equals(input.LastFour))
) &&
(
this.Number == input.Number ||
(this.Number != null &&
this.Number.Equals(input.Number))
) &&
(
this.ThreeDSecure == input.ThreeDSecure ||
(this.ThreeDSecure != null &&
this.ThreeDSecure.Equals(input.ThreeDSecure))
);
}
/// <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.Authentication != null)
{
hashCode = (hashCode * 59) + this.Authentication.GetHashCode();
}
if (this.Bin != null)
{
hashCode = (hashCode * 59) + this.Bin.GetHashCode();
}
if (this.Brand != null)
{
hashCode = (hashCode * 59) + this.Brand.GetHashCode();
}
if (this.BrandVariant != null)
{
hashCode = (hashCode * 59) + this.BrandVariant.GetHashCode();
}
if (this.CardholderName != null)
{
hashCode = (hashCode * 59) + this.CardholderName.GetHashCode();
}
if (this._Configuration != null)
{
hashCode = (hashCode * 59) + this._Configuration.GetHashCode();
}
if (this.Cvc != null)
{
hashCode = (hashCode * 59) + this.Cvc.GetHashCode();
}
if (this.DeliveryContact != null)
{
hashCode = (hashCode * 59) + this.DeliveryContact.GetHashCode();
}
if (this.Expiration != null)
{
hashCode = (hashCode * 59) + this.Expiration.GetHashCode();
}
hashCode = (hashCode * 59) + this.FormFactor.GetHashCode();
if (this.LastFour != null)
{
hashCode = (hashCode * 59) + this.LastFour.GetHashCode();
}
if (this.Number != null)
{
hashCode = (hashCode * 59) + this.Number.GetHashCode();
}
if (this.ThreeDSecure != null)
{
hashCode = (hashCode * 59) + this.ThreeDSecure.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)
{
// CardholderName (string) maxLength
if (this.CardholderName != null && this.CardholderName.Length > 26)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for CardholderName, length must be less than 26.", new [] { "CardholderName" });
}
yield break;
}
}
}