Skip to content
Open
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
10 changes: 10 additions & 0 deletions Adyen/Transfers/Client/ClientUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ public static bool TryDeserialize<T>(ref Utf8JsonReader reader, JsonSerializerOp
return Models.NOLocalAccountIdentification.TypeEnum.ToJsonValue(nOLocalAccountIdentificationTypeEnum);
if (obj is Models.NZLocalAccountIdentification.TypeEnum nZLocalAccountIdentificationTypeEnum)
return Models.NZLocalAccountIdentification.TypeEnum.ToJsonValue(nZLocalAccountIdentificationTypeEnum);
if (obj is Models.NetworkReason.NamespaceEnum networkReasonNamespaceEnum)
return Models.NetworkReason.NamespaceEnum.ToJsonValue(networkReasonNamespaceEnum);
if (obj is Models.NumberAndBicAccountIdentification.TypeEnum numberAndBicAccountIdentificationTypeEnum)
return Models.NumberAndBicAccountIdentification.TypeEnum.ToJsonValue(numberAndBicAccountIdentificationTypeEnum);
if (obj is Models.PLLocalAccountIdentification.TypeEnum pLLocalAccountIdentificationTypeEnum)
Expand Down Expand Up @@ -230,6 +232,8 @@ public static bool TryDeserialize<T>(ref Utf8JsonReader reader, JsonSerializerOp
return Models.TransferData.ReasonEnum.ToJsonValue(transferDataReasonEnum);
if (obj is Models.TransferData.TypeEnum transferDataTypeEnum)
return Models.TransferData.TypeEnum.ToJsonValue(transferDataTypeEnum);
if (obj is Models.TransferDataTracing.TypeEnum transferDataTracingTypeEnum)
return Models.TransferDataTracing.TypeEnum.ToJsonValue(transferDataTracingTypeEnum);
if (obj is Models.TransferDataTracking.TypeEnum transferDataTrackingTypeEnum)
return Models.TransferDataTracking.TypeEnum.ToJsonValue(transferDataTrackingTypeEnum);
if (obj is Models.TransferEvent.ReasonEnum transferEventReasonEnum)
Expand All @@ -240,6 +244,8 @@ public static bool TryDeserialize<T>(ref Utf8JsonReader reader, JsonSerializerOp
return Models.TransferEvent.TypeEnum.ToJsonValue(transferEventTypeEnum);
if (obj is Models.TransferEventEventsDataInner.TypeEnum transferEventEventsDataInnerTypeEnum)
return Models.TransferEventEventsDataInner.TypeEnum.ToJsonValue(transferEventEventsDataInnerTypeEnum);
if (obj is Models.TransferEventTracingData.TypeEnum transferEventTracingDataTypeEnum)
return Models.TransferEventTracingData.TypeEnum.ToJsonValue(transferEventTracingDataTypeEnum);
if (obj is Models.TransferEventTrackingData.TypeEnum transferEventTrackingDataTypeEnum)
return Models.TransferEventTrackingData.TypeEnum.ToJsonValue(transferEventTrackingDataTypeEnum);
if (obj is Models.TransferInfo.CategoryEnum transferInfoCategoryEnum)
Expand All @@ -252,8 +258,12 @@ public static bool TryDeserialize<T>(ref Utf8JsonReader reader, JsonSerializerOp
return Models.TransferInfo.TypeEnum.ToJsonValue(transferInfoTypeEnum);
if (obj is Models.TransferReview.ScaOnApprovalEnum transferReviewScaOnApprovalEnum)
return Models.TransferReview.ScaOnApprovalEnum.ToJsonValue(transferReviewScaOnApprovalEnum);
if (obj is Models.UKFpsTracingData.TypeEnum uKFpsTracingDataTypeEnum)
return Models.UKFpsTracingData.TypeEnum.ToJsonValue(uKFpsTracingDataTypeEnum);
if (obj is Models.UKLocalAccountIdentification.TypeEnum uKLocalAccountIdentificationTypeEnum)
return Models.UKLocalAccountIdentification.TypeEnum.ToJsonValue(uKLocalAccountIdentificationTypeEnum);
if (obj is Models.USAchTracingData.TypeEnum uSAchTracingDataTypeEnum)
return Models.USAchTracingData.TypeEnum.ToJsonValue(uSAchTracingDataTypeEnum);
if (obj is Models.USLocalAccountIdentification.AccountTypeEnum uSLocalAccountIdentificationAccountTypeEnum)
return Models.USLocalAccountIdentification.AccountTypeEnum.ToJsonValue(uSLocalAccountIdentificationAccountTypeEnum);
if (obj is Models.USLocalAccountIdentification.TypeEnum uSLocalAccountIdentificationTypeEnum)
Expand Down
5 changes: 5 additions & 0 deletions Adyen/Transfers/Client/HostConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ public HostConfiguration(IServiceCollection services)
_jsonOptions.Converters.Add(new NOLocalAccountIdentificationJsonConverter());
_jsonOptions.Converters.Add(new NZLocalAccountIdentificationJsonConverter());
_jsonOptions.Converters.Add(new NameLocationJsonConverter());
_jsonOptions.Converters.Add(new NetworkReasonJsonConverter());
_jsonOptions.Converters.Add(new NumberAndBicAccountIdentificationJsonConverter());
_jsonOptions.Converters.Add(new PLLocalAccountIdentificationJsonConverter());
_jsonOptions.Converters.Add(new PartyIdentificationJsonConverter());
Expand Down Expand Up @@ -143,9 +144,11 @@ public HostConfiguration(IServiceCollection services)
_jsonOptions.Converters.Add(new TransferJsonConverter());
_jsonOptions.Converters.Add(new TransferCategoryDataJsonConverter());
_jsonOptions.Converters.Add(new TransferDataJsonConverter());
_jsonOptions.Converters.Add(new TransferDataTracingJsonConverter());
_jsonOptions.Converters.Add(new TransferDataTrackingJsonConverter());
_jsonOptions.Converters.Add(new TransferEventJsonConverter());
_jsonOptions.Converters.Add(new TransferEventEventsDataInnerJsonConverter());
_jsonOptions.Converters.Add(new TransferEventTracingDataJsonConverter());
_jsonOptions.Converters.Add(new TransferEventTrackingDataJsonConverter());
_jsonOptions.Converters.Add(new TransferInfoJsonConverter());
_jsonOptions.Converters.Add(new TransferNotificationCounterPartyJsonConverter());
Expand All @@ -155,7 +158,9 @@ public HostConfiguration(IServiceCollection services)
_jsonOptions.Converters.Add(new TransferReviewJsonConverter());
_jsonOptions.Converters.Add(new TransferServiceRestServiceErrorJsonConverter());
_jsonOptions.Converters.Add(new TransferViewJsonConverter());
_jsonOptions.Converters.Add(new UKFpsTracingDataJsonConverter());
_jsonOptions.Converters.Add(new UKLocalAccountIdentificationJsonConverter());
_jsonOptions.Converters.Add(new USAchTracingDataJsonConverter());
_jsonOptions.Converters.Add(new USLocalAccountIdentificationJsonConverter());
_jsonOptions.Converters.Add(new UltimatePartyIdentificationJsonConverter());
JsonSerializerOptionsProvider jsonSerializerOptionsProvider = new(_jsonOptions);
Expand Down
21 changes: 8 additions & 13 deletions Adyen/Transfers/Models/AULocalAccountIdentification.cs
Original file line number Diff line number Diff line change
Expand Up @@ -172,14 +172,14 @@ public override void Write(Utf8JsonWriter writer, TypeEnum value, JsonSerializer
/// </summary>
/// <value>The bank account number, without separators or whitespace.</value>
[JsonPropertyName("accountNumber")]
public string AccountNumber { get; set; }
public string? AccountNumber { get; set; }

/// <summary>
/// The 6-digit [Bank State Branch (BSB) code](https://en.wikipedia.org/wiki/Bank_state_branch), without separators or whitespace.
/// </summary>
/// <value>The 6-digit [Bank State Branch (BSB) code](https://en.wikipedia.org/wiki/Bank_state_branch), without separators or whitespace.</value>
[JsonPropertyName("bsbCode")]
public string BsbCode { get; set; }
public string? BsbCode { get; set; }

/// <summary>
/// Returns the string presentation of the object
Expand Down Expand Up @@ -254,19 +254,14 @@ public override AULocalAccountIdentification Read(ref Utf8JsonReader utf8JsonRea
}
}

if (!accountNumber.IsSet)
throw new ArgumentException("Property is required for class AULocalAccountIdentification.", nameof(accountNumber));

if (!bsbCode.IsSet)
throw new ArgumentException("Property is required for class AULocalAccountIdentification.", nameof(bsbCode));

if (!type.IsSet)
throw new ArgumentException("Property is required for class AULocalAccountIdentification.", nameof(type));

var aULocalAccountIdentification = new AULocalAccountIdentification();
aULocalAccountIdentification.AccountNumber = accountNumber.Value!;
aULocalAccountIdentification.BsbCode = bsbCode.Value!;
aULocalAccountIdentification.Type = type.Value!;
if (accountNumber.IsSet)
aULocalAccountIdentification.AccountNumber = accountNumber.Value!;
if (bsbCode.IsSet)
aULocalAccountIdentification.BsbCode = bsbCode.Value!;
if (type.IsSet)
aULocalAccountIdentification.Type = type.Value!;
return aULocalAccountIdentification;
}

Expand Down
1 change: 1 addition & 0 deletions Adyen/Transfers/Models/AdditionalBankIdentification.cs
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ public override AdditionalBankIdentification Read(ref Utf8JsonReader utf8JsonRea
}
}


var additionalBankIdentification = new AdditionalBankIdentification();
if (code.IsSet)
additionalBankIdentification.Code = code.Value;
Expand Down
7 changes: 3 additions & 4 deletions Adyen/Transfers/Models/Address.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public Address()
/// </summary>
/// <value>The two-character ISO 3166-1 alpha-2 country code. For example, **US**, **NL**, or **GB**.</value>
[JsonPropertyName("country")]
public string Country { get; set; }
public string? Country { get; set; }

/// <summary>
/// This is used to track if an optional field is set. If set, <see cref="City"/> will be populated.
Expand Down Expand Up @@ -210,11 +210,10 @@ public override Address Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve
}
}

if (!country.IsSet)
throw new ArgumentException("Property is required for class Address.", nameof(country));

var address = new Address();
address.Country = country.Value!;
if (country.IsSet)
address.Country = country.Value!;
if (city.IsSet)
address.City = city.Value;
if (line1.IsSet)
Expand Down
1 change: 1 addition & 0 deletions Adyen/Transfers/Models/Airline.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ public override Airline Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve
}
}


var airline = new Airline();
if (legs.IsSet)
airline.Legs = legs.Value;
Expand Down
13 changes: 5 additions & 8 deletions Adyen/Transfers/Models/Amount.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public Amount()
/// </summary>
/// <value>The three-character [ISO currency code](https://docs.adyen.com/development-resources/currency-codes#currency-codes) of the amount.</value>
[JsonPropertyName("currency")]
public string Currency { get; set; }
public string? Currency { get; set; }

/// <summary>
/// The numeric value of the amount, in [minor units](https://docs.adyen.com/development-resources/currency-codes#minor-units).
Expand Down Expand Up @@ -127,15 +127,12 @@ public override Amount Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver
}
}

if (!currency.IsSet)
throw new ArgumentException("Property is required for class Amount.", nameof(currency));

if (!value.IsSet)
throw new ArgumentException("Property is required for class Amount.", nameof(value));

var amount = new Amount();
amount.Currency = currency.Value!;
amount.Value = value.Value!.Value;
if (currency.IsSet)
amount.Currency = currency.Value!;
if (value.IsSet)
amount.Value = value.Value!.Value;
return amount;
}

Expand Down
1 change: 1 addition & 0 deletions Adyen/Transfers/Models/AmountAdjustment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ public override AmountAdjustment Read(ref Utf8JsonReader utf8JsonReader, Type ty
}
}


var amountAdjustment = new AmountAdjustment();
if (amount.IsSet)
amountAdjustment.Amount = amount.Value;
Expand Down
1 change: 1 addition & 0 deletions Adyen/Transfers/Models/ApproveTransfersRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ public override ApproveTransfersRequest Read(ref Utf8JsonReader utf8JsonReader,
}
}


var approveTransfersRequest = new ApproveTransfersRequest();
if (transferIds.IsSet)
approveTransfersRequest.TransferIds = transferIds.Value;
Expand Down
29 changes: 11 additions & 18 deletions Adyen/Transfers/Models/BRLocalAccountIdentification.cs
Original file line number Diff line number Diff line change
Expand Up @@ -172,21 +172,21 @@ public override void Write(Utf8JsonWriter writer, TypeEnum value, JsonSerializer
/// </summary>
/// <value>The bank account number, without separators or whitespace.</value>
[JsonPropertyName("accountNumber")]
public string AccountNumber { get; set; }
public string? AccountNumber { get; set; }

/// <summary>
/// The 3-digit bank code, with leading zeros.
/// </summary>
/// <value>The 3-digit bank code, with leading zeros.</value>
[JsonPropertyName("bankCode")]
public string BankCode { get; set; }
public string? BankCode { get; set; }

/// <summary>
/// The bank account branch number, without separators or whitespace.
/// </summary>
/// <value>The bank account branch number, without separators or whitespace.</value>
[JsonPropertyName("branchNumber")]
public string BranchNumber { get; set; }
public string? BranchNumber { get; set; }

/// <summary>
/// This is used to track if an optional field is set. If set, <see cref="Ispb"/> will be populated.
Expand Down Expand Up @@ -285,25 +285,18 @@ public override BRLocalAccountIdentification Read(ref Utf8JsonReader utf8JsonRea
}
}

if (!accountNumber.IsSet)
throw new ArgumentException("Property is required for class BRLocalAccountIdentification.", nameof(accountNumber));

if (!bankCode.IsSet)
throw new ArgumentException("Property is required for class BRLocalAccountIdentification.", nameof(bankCode));

if (!branchNumber.IsSet)
throw new ArgumentException("Property is required for class BRLocalAccountIdentification.", nameof(branchNumber));

if (!type.IsSet)
throw new ArgumentException("Property is required for class BRLocalAccountIdentification.", nameof(type));

var bRLocalAccountIdentification = new BRLocalAccountIdentification();
bRLocalAccountIdentification.AccountNumber = accountNumber.Value!;
bRLocalAccountIdentification.BankCode = bankCode.Value!;
bRLocalAccountIdentification.BranchNumber = branchNumber.Value!;
if (accountNumber.IsSet)
bRLocalAccountIdentification.AccountNumber = accountNumber.Value!;
if (bankCode.IsSet)
bRLocalAccountIdentification.BankCode = bankCode.Value!;
if (branchNumber.IsSet)
bRLocalAccountIdentification.BranchNumber = branchNumber.Value!;
if (ispb.IsSet)
bRLocalAccountIdentification.Ispb = ispb.Value;
bRLocalAccountIdentification.Type = type.Value!;
if (type.IsSet)
bRLocalAccountIdentification.Type = type.Value!;
return bRLocalAccountIdentification;
}

Expand Down
1 change: 1 addition & 0 deletions Adyen/Transfers/Models/BalanceMutation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ public override BalanceMutation Read(ref Utf8JsonReader utf8JsonReader, Type typ
}
}


var balanceMutation = new BalanceMutation();
if (balance.IsSet)
balanceMutation.Balance = balance.Value;
Expand Down
15 changes: 6 additions & 9 deletions Adyen/Transfers/Models/BankAccountV3.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ public BankAccountV3()
/// <see cref="AccountHolder"/>.
/// </summary>
[JsonPropertyName("accountHolder")]
public PartyIdentification AccountHolder { get; set; }
public PartyIdentification? AccountHolder { get; set; }

/// <summary>
/// <see cref="AccountIdentification"/>.
/// </summary>
[JsonPropertyName("accountIdentification")]
public BankAccountV3AccountIdentification AccountIdentification { get; set; }
public BankAccountV3AccountIdentification? AccountIdentification { get; set; }

/// <summary>
/// This is used to track if an optional field is set. If set, <see cref="StoredPaymentMethodId"/> will be populated.
Expand Down Expand Up @@ -144,15 +144,12 @@ public override BankAccountV3 Read(ref Utf8JsonReader utf8JsonReader, Type typeT
}
}

if (!accountHolder.IsSet)
throw new ArgumentException("Property is required for class BankAccountV3.", nameof(accountHolder));

if (!accountIdentification.IsSet)
throw new ArgumentException("Property is required for class BankAccountV3.", nameof(accountIdentification));

var bankAccountV3 = new BankAccountV3();
bankAccountV3.AccountHolder = accountHolder.Value!;
bankAccountV3.AccountIdentification = accountIdentification.Value!;
if (accountHolder.IsSet)
bankAccountV3.AccountHolder = accountHolder.Value!;
if (accountIdentification.IsSet)
bankAccountV3.AccountIdentification = accountIdentification.Value!;
if (storedPaymentMethodId.IsSet)
bankAccountV3.StoredPaymentMethodId = storedPaymentMethodId.Value;
return bankAccountV3;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -738,8 +738,6 @@ public override BankAccountV3AccountIdentification Read(ref Utf8JsonReader utf8J
}
}

if (!type.IsSet)
throw new ArgumentException("Property is required for class BankAccountV3AccountIdentification.", nameof(type));

if (aULocalAccountIdentification != null)
return new BankAccountV3AccountIdentification(aULocalAccountIdentification);
Expand Down
1 change: 1 addition & 0 deletions Adyen/Transfers/Models/BankCategoryData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,7 @@ public override BankCategoryData Read(ref Utf8JsonReader utf8JsonReader, Type ty
}
}


var bankCategoryData = new BankCategoryData();
if (priority.IsSet)
bankCategoryData.Priority = priority.Value;
Expand Down
Loading
Loading