Skip to content

Added support for BalanceWebhookSettings API & Webhooks #1138

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
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
164 changes: 118 additions & 46 deletions Adyen.Test/BalancePlatformTest.cs

Large diffs are not rendered by default.

472 changes: 256 additions & 216 deletions Adyen.Test/WebhooksTests/BalancePlatformWebhookHandlerTest.cs

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Adyen/Adyen.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
<PackageReference Include="JsonSubTypes" Version="2.0.1" />
</ItemGroup>
<!-- .NET 4.5 references, compilation flags and build options -->
<ItemGroup Condition=" '$(TargetFramework)' == 'net461' ">
Expand Down
6 changes: 3 additions & 3 deletions Adyen/Model/BalancePlatform/BalanceAccount.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ protected BalanceAccount() { }
/// </summary>
/// <param name="accountHolderId">The unique identifier of the [account holder](https://docs.adyen.com/api-explorer/#/balanceplatform/latest/post/accountHolders__resParam_id) associated with the balance account. (required).</param>
/// <param name="balances">List of balances with the amount and currency..</param>
/// <param name="defaultCurrencyCode">The default three-character [ISO currency code](https://docs.adyen.com/development-resources/currency-codes) of the balance account. The default value is **EUR**. &gt; After a balance account is created, you cannot change its default currency..</param>
/// <param name="defaultCurrencyCode">The default three-character [ISO currency code](https://docs.adyen.com/development-resources/currency-codes) of the balance account. This is the currency displayed on the Balance Account overview page in your Customer Area. The default value is **EUR**. &gt; After a balance account is created, you cannot change its default currency..</param>
/// <param name="description">A human-readable description of the balance account, maximum 300 characters. You can use this parameter to distinguish between multiple balance accounts under an account holder..</param>
/// <param name="id">The unique identifier of the balance account. (required).</param>
/// <param name="metadata">A set of key and value pairs for general use. The keys do not have specific names and may be used for storing miscellaneous data as desired. &gt; Note that during an update of metadata, the omission of existing key-value pairs will result in the deletion of those key-value pairs..</param>
Expand Down Expand Up @@ -119,9 +119,9 @@ protected BalanceAccount() { }
public List<Balance> Balances { get; set; }

/// <summary>
/// The default three-character [ISO currency code](https://docs.adyen.com/development-resources/currency-codes) of the balance account. The default value is **EUR**. &gt; After a balance account is created, you cannot change its default currency.
/// The default three-character [ISO currency code](https://docs.adyen.com/development-resources/currency-codes) of the balance account. This is the currency displayed on the Balance Account overview page in your Customer Area. The default value is **EUR**. &gt; After a balance account is created, you cannot change its default currency.
/// </summary>
/// <value>The default three-character [ISO currency code](https://docs.adyen.com/development-resources/currency-codes) of the balance account. The default value is **EUR**. &gt; After a balance account is created, you cannot change its default currency.</value>
/// <value>The default three-character [ISO currency code](https://docs.adyen.com/development-resources/currency-codes) of the balance account. This is the currency displayed on the Balance Account overview page in your Customer Area. The default value is **EUR**. &gt; After a balance account is created, you cannot change its default currency.</value>
[DataMember(Name = "defaultCurrencyCode", EmitDefaultValue = false)]
public string DefaultCurrencyCode { get; set; }

Expand Down
6 changes: 3 additions & 3 deletions Adyen/Model/BalancePlatform/BalanceAccountBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ protected BalanceAccountBase() { }
/// Initializes a new instance of the <see cref="BalanceAccountBase" /> class.
/// </summary>
/// <param name="accountHolderId">The unique identifier of the [account holder](https://docs.adyen.com/api-explorer/#/balanceplatform/latest/post/accountHolders__resParam_id) associated with the balance account. (required).</param>
/// <param name="defaultCurrencyCode">The default three-character [ISO currency code](https://docs.adyen.com/development-resources/currency-codes) of the balance account. The default value is **EUR**. &gt; After a balance account is created, you cannot change its default currency..</param>
/// <param name="defaultCurrencyCode">The default three-character [ISO currency code](https://docs.adyen.com/development-resources/currency-codes) of the balance account. This is the currency displayed on the Balance Account overview page in your Customer Area. The default value is **EUR**. &gt; After a balance account is created, you cannot change its default currency..</param>
/// <param name="description">A human-readable description of the balance account, maximum 300 characters. You can use this parameter to distinguish between multiple balance accounts under an account holder..</param>
/// <param name="id">The unique identifier of the balance account. (required).</param>
/// <param name="metadata">A set of key and value pairs for general use. The keys do not have specific names and may be used for storing miscellaneous data as desired. &gt; Note that during an update of metadata, the omission of existing key-value pairs will result in the deletion of those key-value pairs..</param>
Expand Down Expand Up @@ -110,9 +110,9 @@ protected BalanceAccountBase() { }
public string AccountHolderId { get; set; }

/// <summary>
/// The default three-character [ISO currency code](https://docs.adyen.com/development-resources/currency-codes) of the balance account. The default value is **EUR**. &gt; After a balance account is created, you cannot change its default currency.
/// The default three-character [ISO currency code](https://docs.adyen.com/development-resources/currency-codes) of the balance account. This is the currency displayed on the Balance Account overview page in your Customer Area. The default value is **EUR**. &gt; After a balance account is created, you cannot change its default currency.
/// </summary>
/// <value>The default three-character [ISO currency code](https://docs.adyen.com/development-resources/currency-codes) of the balance account. The default value is **EUR**. &gt; After a balance account is created, you cannot change its default currency.</value>
/// <value>The default three-character [ISO currency code](https://docs.adyen.com/development-resources/currency-codes) of the balance account. This is the currency displayed on the Balance Account overview page in your Customer Area. The default value is **EUR**. &gt; After a balance account is created, you cannot change its default currency.</value>
[DataMember(Name = "defaultCurrencyCode", EmitDefaultValue = false)]
public string DefaultCurrencyCode { get; set; }

Expand Down
6 changes: 3 additions & 3 deletions Adyen/Model/BalancePlatform/BalanceAccountInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ protected BalanceAccountInfo() { }
/// Initializes a new instance of the <see cref="BalanceAccountInfo" /> class.
/// </summary>
/// <param name="accountHolderId">The unique identifier of the [account holder](https://docs.adyen.com/api-explorer/#/balanceplatform/latest/post/accountHolders__resParam_id) associated with the balance account. (required).</param>
/// <param name="defaultCurrencyCode">The default three-character [ISO currency code](https://docs.adyen.com/development-resources/currency-codes) of the balance account. The default value is **EUR**. &gt; After a balance account is created, you cannot change its default currency..</param>
/// <param name="defaultCurrencyCode">The default three-character [ISO currency code](https://docs.adyen.com/development-resources/currency-codes) of the balance account. This is the currency displayed on the Balance Account overview page in your Customer Area. The default value is **EUR**. &gt; After a balance account is created, you cannot change its default currency..</param>
/// <param name="description">A human-readable description of the balance account, maximum 300 characters. You can use this parameter to distinguish between multiple balance accounts under an account holder..</param>
/// <param name="metadata">A set of key and value pairs for general use. The keys do not have specific names and may be used for storing miscellaneous data as desired. &gt; Note that during an update of metadata, the omission of existing key-value pairs will result in the deletion of those key-value pairs..</param>
/// <param name="platformPaymentConfiguration">platformPaymentConfiguration.</param>
Expand All @@ -66,9 +66,9 @@ protected BalanceAccountInfo() { }
public string AccountHolderId { get; set; }

/// <summary>
/// The default three-character [ISO currency code](https://docs.adyen.com/development-resources/currency-codes) of the balance account. The default value is **EUR**. &gt; After a balance account is created, you cannot change its default currency.
/// The default three-character [ISO currency code](https://docs.adyen.com/development-resources/currency-codes) of the balance account. This is the currency displayed on the Balance Account overview page in your Customer Area. The default value is **EUR**. &gt; After a balance account is created, you cannot change its default currency.
/// </summary>
/// <value>The default three-character [ISO currency code](https://docs.adyen.com/development-resources/currency-codes) of the balance account. The default value is **EUR**. &gt; After a balance account is created, you cannot change its default currency.</value>
/// <value>The default three-character [ISO currency code](https://docs.adyen.com/development-resources/currency-codes) of the balance account. This is the currency displayed on the Balance Account overview page in your Customer Area. The default value is **EUR**. &gt; After a balance account is created, you cannot change its default currency.</value>
[DataMember(Name = "defaultCurrencyCode", EmitDefaultValue = false)]
public string DefaultCurrencyCode { get; set; }

Expand Down
158 changes: 158 additions & 0 deletions Adyen/Model/BalancePlatform/BalanceWebhookSetting.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
/*
* Configuration API
*
*
* The version of the OpenAPI document: 2
*
* 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 JsonSubTypes;
using System.ComponentModel.DataAnnotations;
using OpenAPIDateConverter = Adyen.ApiSerialization.OpenAPIDateConverter;

namespace Adyen.Model.BalancePlatform
{
/// <summary>
/// BalanceWebhookSetting
/// </summary>
[DataContract(Name = "BalanceWebhookSetting")]
[JsonConverter(typeof(JsonSubtypes), "Type")]
[JsonSubtypes.KnownSubType(typeof(BalanceWebhookSetting), "balance")]
public partial class BalanceWebhookSetting : WebhookSetting, IEquatable<BalanceWebhookSetting>, IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="BalanceWebhookSetting" /> class.
/// </summary>
[JsonConstructorAttribute]
protected BalanceWebhookSetting() { }
/// <summary>
/// Initializes a new instance of the <see cref="BalanceWebhookSetting" /> class.
/// </summary>
/// <param name="conditions">The list of settings and criteria for triggering the [balance webhook](https://docs.adyen.com/api-explorer/balance-webhooks/latest/post/balanceAccount.balance.updated)..</param>
/// <param name="currency">The three-character [ISO currency code](https://docs.adyen.com/development-resources/currency-codes) of the balance. (required).</param>
/// <param name="id">The unique identifier of the webhook setting. (required).</param>
/// <param name="status">status (required).</param>
/// <param name="target">target (required).</param>
/// <param name="type">type (required) (default to &quot;BalanceWebhookSetting&quot;).</param>
public BalanceWebhookSetting(List<Condition> conditions = default(List<Condition>), string currency = default(string), string id = default(string), string status = default(string), Target target = default(Target), SettingType type = SettingType.Balance) : base(currency, id, status, target, type)
{
this.Conditions = conditions;
}

/// <summary>
/// The list of settings and criteria for triggering the [balance webhook](https://docs.adyen.com/api-explorer/balance-webhooks/latest/post/balanceAccount.balance.updated).
/// </summary>
/// <value>The list of settings and criteria for triggering the [balance webhook](https://docs.adyen.com/api-explorer/balance-webhooks/latest/post/balanceAccount.balance.updated).</value>
[DataMember(Name = "conditions", EmitDefaultValue = false)]
public List<Condition> Conditions { 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 BalanceWebhookSetting {\n");
sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n");
sb.Append(" Conditions: ").Append(Conditions).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 override 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 BalanceWebhookSetting);
}

/// <summary>
/// Returns true if BalanceWebhookSetting instances are equal
/// </summary>
/// <param name="input">Instance of BalanceWebhookSetting to be compared</param>
/// <returns>Boolean</returns>
public bool Equals(BalanceWebhookSetting input)
{
if (input == null)
{
return false;
}
return base.Equals(input) &&
(
this.Conditions == input.Conditions ||
this.Conditions != null &&
input.Conditions != null &&
this.Conditions.SequenceEqual(input.Conditions)
);
}

/// <summary>
/// Gets the hash code
/// </summary>
/// <returns>Hash code</returns>
public override int GetHashCode()
{
unchecked // Overflow is fine, just wrap
{
int hashCode = base.GetHashCode();
if (this.Conditions != null)
{
hashCode = (hashCode * 59) + this.Conditions.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)
{
return this.BaseValidate(validationContext);
}

/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
protected IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> BaseValidate(ValidationContext validationContext)
{
foreach (var x in BaseValidate(validationContext))
{
yield return x;
}
yield break;
}
}

}
Loading
Loading