From 7f789482c8b3a10af01cd5bbb989478b92a3b300 Mon Sep 17 00:00:00 2001 From: kwokhe Date: Wed, 7 May 2025 22:22:00 +0200 Subject: [PATCH 1/2] Added support for BalanceWebhookSettings API Updated unit tests --- Adyen.Test/BalancePlatformTest.cs | 164 +++++++---- Adyen/Adyen.csproj | 1 + Adyen/Model/BalancePlatform/BalanceAccount.cs | 6 +- .../BalancePlatform/BalanceAccountBase.cs | 6 +- .../BalancePlatform/BalanceAccountInfo.cs | 6 +- .../BalancePlatform/BalanceWebhookSetting.cs | 158 +++++++++++ .../BalanceWebhookSettingAllOf.cs | 130 +++++++++ .../BalanceWebhookSettingInfo.cs | 238 ++++++++++++++++ .../BalanceWebhookSettingInfoUpdate.cs | 233 ++++++++++++++++ .../BalancePlatform/BankIdentification.cs | 22 +- Adyen/Model/BalancePlatform/Condition.cs | 226 +++++++++++++++ .../CreateSweepConfigurationV2.cs | 28 +- .../DefaultErrorResponseEntity.cs | 259 ++++++++++++++++++ Adyen/Model/BalancePlatform/InvalidField.cs | 40 +-- .../BalancePlatform/PaymentInstrument.cs | 40 ++- Adyen/Model/BalancePlatform/SettingType.cs | 43 +++ .../BalancePlatform/SweepConfigurationV2.cs | 28 +- Adyen/Model/BalancePlatform/Target.cs | 176 ++++++++++++ Adyen/Model/BalancePlatform/TargetUpdate.cs | 171 ++++++++++++ .../TransactionRuleRestrictions.cs | 38 ++- .../TransferRouteRequirementsInner.cs | 35 ++- .../USInstantPayoutAddressRequirement.cs | 164 +++++++++++ .../UpdatePaymentInstrument.cs | 40 ++- .../UpdateSweepConfigurationV2.cs | 28 +- .../WalletProviderAccountScoreRestriction.cs | 148 ++++++++++ .../WalletProviderDeviceScore.cs | 148 ++++++++++ Adyen/Model/BalancePlatform/WebhookSetting.cs | 217 +++++++++++++++ .../WebhookSettingsResponse.cs | 130 +++++++++ .../BalancePlatform/BalancesService.cs | 204 ++++++++++++++ 29 files changed, 3007 insertions(+), 120 deletions(-) create mode 100644 Adyen/Model/BalancePlatform/BalanceWebhookSetting.cs create mode 100644 Adyen/Model/BalancePlatform/BalanceWebhookSettingAllOf.cs create mode 100644 Adyen/Model/BalancePlatform/BalanceWebhookSettingInfo.cs create mode 100644 Adyen/Model/BalancePlatform/BalanceWebhookSettingInfoUpdate.cs create mode 100644 Adyen/Model/BalancePlatform/Condition.cs create mode 100644 Adyen/Model/BalancePlatform/DefaultErrorResponseEntity.cs create mode 100644 Adyen/Model/BalancePlatform/SettingType.cs create mode 100644 Adyen/Model/BalancePlatform/Target.cs create mode 100644 Adyen/Model/BalancePlatform/TargetUpdate.cs create mode 100644 Adyen/Model/BalancePlatform/USInstantPayoutAddressRequirement.cs create mode 100644 Adyen/Model/BalancePlatform/WalletProviderAccountScoreRestriction.cs create mode 100644 Adyen/Model/BalancePlatform/WalletProviderDeviceScore.cs create mode 100644 Adyen/Model/BalancePlatform/WebhookSetting.cs create mode 100644 Adyen/Model/BalancePlatform/WebhookSettingsResponse.cs create mode 100644 Adyen/Service/BalancePlatform/BalancesService.cs diff --git a/Adyen.Test/BalancePlatformTest.cs b/Adyen.Test/BalancePlatformTest.cs index 81e489e9f..46a5e0a8c 100644 --- a/Adyen.Test/BalancePlatformTest.cs +++ b/Adyen.Test/BalancePlatformTest.cs @@ -4,6 +4,7 @@ using Adyen.Model.BalancePlatform; using Adyen.Service.BalancePlatform; using Microsoft.VisualStudio.TestTools.UnitTesting; +using Newtonsoft.Json; using NSubstitute; namespace Adyen.Test @@ -21,12 +22,12 @@ public void GetAccountHoldersIdTest() { var client = CreateMockTestClientApiKeyBasedRequestAsync("mocks/balanceplatform/AccountHolder.json"); var service = new AccountHoldersService(client); - + var response = service.GetAccountHolder("AH32272223222B5CM4MWJ892H"); Assert.AreEqual(response.Status, AccountHolder.StatusEnum.Active); Assert.AreEqual(response.Id, "AH32272223222B5CM4MWJ892H"); } - + /// /// Test PostAccountHolders /// @@ -43,7 +44,7 @@ public void PostAccountHoldersTest() Assert.AreEqual(response.Status, AccountHolder.StatusEnum.Active); Assert.AreEqual(response.Id, "AH32272223222B5CM4MWJ892H"); } - + /// /// Test PatchAccountHoldersId /// @@ -60,7 +61,7 @@ public void PatchAccountHoldersIdTest() Assert.AreEqual(response.Status, AccountHolder.StatusEnum.Active); Assert.AreEqual(response.Id, "AH32272223222B5CM4MWJ892H"); } - + /// /// Test GetAccountHoldersIdBalanceAccountsAsync /// @@ -69,7 +70,7 @@ public void GetAccountHoldersIdBalanceAccountsAsyncTest() { var client = CreateMockTestClientApiKeyBasedRequestAsync("mocks/balanceplatform/PaginatedBalanceAccountsResponse.json"); var service = new AccountHoldersService(client); - + var response = service.GetAllBalanceAccountsOfAccountHolderAsync("id", offset: 1, limit: 3).Result; Assert.AreEqual("BA32272223222B59K6ZXHBFN6", response.BalanceAccounts[0].Id); Assert.AreEqual(BalanceAccountBase.StatusEnum.Closed, response.BalanceAccounts[1].Status); @@ -90,13 +91,13 @@ public void GetAccountHoldersIdBalanceAccountsAsyncTest() public void GetBalanceAccountsIdTest() { var client = CreateMockTestClientApiKeyBasedRequestAsync("mocks/balanceplatform/BalanceAccount.json"); - var service = new BalanceAccountsService(client); - + var service = new BalanceAccountsService(client); + var response = service.GetBalanceAccount("AH32272223222B5CM4MWJ892H"); Assert.AreEqual(response.Status, BalanceAccount.StatusEnum.Active); Assert.AreEqual(response.Id, "BA3227C223222B5BLP6JQC3FD"); } - + /// /// Test GetBalanceAccountsId /// @@ -113,7 +114,7 @@ public void PostBalanceAccountsTest() Assert.AreEqual(response.Status, BalanceAccount.StatusEnum.Active); Assert.AreEqual(response.Id, "BA3227C223222B5BLP6JQC3FD"); } - + /// /// Test PatchBalanceAccountsIdAsync /// @@ -126,7 +127,7 @@ public void PatchBalanceAccountsIdAsyncTest() Assert.AreEqual(response.Status, BalanceAccount.StatusEnum.Active); Assert.AreEqual(response.Id, "BA3227C223222B5BLP6JQC3FD"); } - + /// /// Test PostBalanceAccountsBalanceAccountIdSweeps /// @@ -135,12 +136,12 @@ public void PostBalanceAccountsBalanceAccountIdSweepsTest() { var client = CreateMockTestClientApiKeyBasedRequestAsync("mocks/balanceplatform/SweepConfiguration.json"); var service = new BalanceAccountsService(client); - + var response = service.CreateSweep("1245yhgeswkrw", new CreateSweepConfigurationV2()); Assert.AreEqual(response.Status, SweepConfigurationV2.StatusEnum.Active); Assert.AreEqual(response.Type, SweepConfigurationV2.TypeEnum.Pull); } - + /// /// Test GetBalanceAccountsBalanceAccountIdSweeps /// @@ -149,7 +150,7 @@ public void GetBalanceAccountsBalanceAccountIdSweepsTest() { var client = CreateMockTestClientApiKeyBasedRequestAsync("mocks/balanceplatform/BalanceSweepConfigurationsResponse.json"); var service = new BalanceAccountsService(client); - + var response = service.GetAllSweepsForBalanceAccount("balanceAccountId"); Assert.AreEqual(response.Sweeps[0].Status, SweepConfigurationV2.StatusEnum.Active); Assert.AreEqual(response.Sweeps[0].Id, "SWPC4227C224555B5FTD2NT2JV4WN5"); @@ -160,7 +161,7 @@ public void GetBalanceAccountsBalanceAccountIdSweepsTest() null, null, HttpMethod.Get, new CancellationToken()); } - + /// /// Test PatchBalanceAccountsBalanceAccountIdSweepsSweepId /// @@ -169,8 +170,8 @@ public void PatchBalanceAccountsBalanceAccountIdSweepsSweepIdTest() { var client = CreateMockTestClientApiKeyBasedRequestAsync("mocks/balanceplatform/SweepConfiguration.json"); var service = new BalanceAccountsService(client); - - var response = service.UpdateSweep("balanceID", "sweepId",new UpdateSweepConfigurationV2()); + + var response = service.UpdateSweep("balanceID", "sweepId", new UpdateSweepConfigurationV2()); Assert.AreEqual(response.Status, SweepConfigurationV2.StatusEnum.Active); Assert.AreEqual(response.Type, SweepConfigurationV2.TypeEnum.Pull); } @@ -185,7 +186,7 @@ public void DeleteBalanceAccountsBalanceAccountIdSweepsSweepIdTest() var service = new BalanceAccountsService(client); service.DeleteSweep("balanceID", "sweepId"); } - + /// /// Test PatchBalanceAccountsBalanceAccountIdSweepsSweepId /// @@ -194,11 +195,12 @@ public void GetBalanceAccountsIdPaymentInstrumentsTest() { var client = CreateMockTestClientApiKeyBasedRequestAsync("mocks/balanceplatform/PaginatedPaymentInstrumentsResponse.json"); var service = new BalanceAccountsService(client); - + var response = service.GetPaymentInstrumentsLinkedToBalanceAccount("balanceID"); Assert.AreEqual(response.PaymentInstruments[0].Status, PaymentInstrument.StatusEnum.Active); Assert.AreEqual(response.PaymentInstruments[0].Id, "PI32272223222B59M5TM658DT"); } + #endregion #region General @@ -211,12 +213,12 @@ public void GetBalancePlatformsIdTest() { var client = CreateMockTestClientApiKeyBasedRequestAsync("mocks/balanceplatform/BalancePlatform.json"); var service = new PlatformService(client); - + var response = service.GetBalancePlatform("uniqueIdentifier"); Assert.AreEqual(response.Status, "Active"); Assert.AreEqual(response.Id, "YOUR_BALANCE_PLATFORM"); } - + /// /// Test GetBalancePlatformsIdAccountHolders /// @@ -225,7 +227,7 @@ public void GetBalancePlatformsIdAccountHoldersTest() { var client = CreateMockTestClientApiKeyBasedRequestAsync("mocks/balanceplatform/PaginatedAccountHoldersResponse.json"); var service = new PlatformService(client); - + var response = service.GetAllAccountHoldersUnderBalancePlatform("uniqueIdentifier"); Assert.AreEqual(response.AccountHolders[0].Id, "AH32272223222B59DDWSCCMP7"); Assert.AreEqual(response.AccountHolders[0].Status, AccountHolder.StatusEnum.Active); @@ -243,12 +245,12 @@ public void GetPaymentInstrumentGroupsIdTest() { var client = CreateMockTestClientApiKeyBasedRequestAsync("mocks/balanceplatform/PaymentInstrumentGroup.json"); var service = new PaymentInstrumentGroupsService(client); - + var response = service.GetPaymentInstrumentGroup("uniqueIdentifier"); Assert.AreEqual(response.Id, "PG3227C223222B5CMD3FJFKGZ"); Assert.AreEqual(response.BalancePlatform, "YOUR_BALANCE_PLATFORM"); } - + /// /// Test PostPaymentInstrumentGroups /// @@ -257,12 +259,12 @@ public void PostPaymentInstrumentGroupsTest() { var client = CreateMockTestClientApiKeyBasedRequestAsync("mocks/balanceplatform/PaymentInstrumentGroup.json"); var service = new PaymentInstrumentGroupsService(client); - + var response = service.CreatePaymentInstrumentGroup(new PaymentInstrumentGroupInfo()); Assert.AreEqual(response.Id, "PG3227C223222B5CMD3FJFKGZ"); Assert.AreEqual(response.BalancePlatform, "YOUR_BALANCE_PLATFORM"); } - + /// /// Test GetPaymentInstrumentGroupsIdTransactionRules /// @@ -271,7 +273,7 @@ public void GetPaymentInstrumentGroupsIdTransactionRulesTest() { var client = CreateMockTestClientApiKeyBasedRequestAsync("mocks/balanceplatform/TransactionRulesResponse.json"); var service = new PaymentInstrumentGroupsService(client); - + var response = service.GetAllTransactionRulesForPaymentInstrumentGroup("id"); Assert.AreEqual(response.TransactionRules[0].Type, TransactionRule.TypeEnum.Velocity); Assert.AreEqual(response.TransactionRules[0].Id, "TR32272223222B5CMDGMC9F4F"); @@ -289,12 +291,12 @@ public void PostPaymentInstrumentsTest() { var client = CreateMockTestClientApiKeyBasedRequestAsync("mocks/balanceplatform/PaymentInstrument.json"); var service = new PaymentInstrumentsService(client); - + var response = service.CreatePaymentInstrument(new PaymentInstrumentInfo()); Assert.AreEqual(response.BalanceAccountId, "BA3227C223222B5CTBLR8BWJB"); Assert.AreEqual(response.Type, PaymentInstrument.TypeEnum.BankAccount); } - + /// /// Test PatchPaymentInstrumentsId /// @@ -303,12 +305,12 @@ public void PatchPaymentInstrumentsIdTest() { var client = CreateMockTestClientApiKeyBasedRequestAsync("mocks/balanceplatform/PaymentInstrument.json"); var service = new PaymentInstrumentsService(client); - + var response = service.UpdatePaymentInstrument("id", new PaymentInstrumentUpdateRequest()); Assert.AreEqual(response.BalanceAccountId, "BA3227C223222B5CTBLR8BWJB"); Assert.AreEqual(response.Type, UpdatePaymentInstrument.TypeEnum.BankAccount); } - + /// /// Test GetPaymentInstrumentsId /// @@ -317,12 +319,12 @@ public void GetPaymentInstrumentsIdTest() { var client = CreateMockTestClientApiKeyBasedRequestAsync("mocks/balanceplatform/PaymentInstrument.json"); var service = new PaymentInstrumentsService(client); - + var response = service.GetPaymentInstrument("id"); Assert.AreEqual(response.BalanceAccountId, "BA3227C223222B5CTBLR8BWJB"); Assert.AreEqual(response.Type, PaymentInstrument.TypeEnum.BankAccount); } - + /// /// Test GetPaymentInstrumentsIdTransactionRules /// @@ -331,7 +333,7 @@ public void GetPaymentInstrumentsIdTransactionRulesTest() { var client = CreateMockTestClientApiKeyBasedRequestAsync("mocks/balanceplatform/TransactionRulesResponse.json"); var service = new PaymentInstrumentsService(client); - + var response = service.GetAllTransactionRulesForPaymentInstrument("id"); Assert.AreEqual(response.TransactionRules[0].Id, "TR32272223222B5CMDGMC9F4F"); Assert.AreEqual(response.TransactionRules[0].Type, TransactionRule.TypeEnum.Velocity); @@ -349,13 +351,13 @@ public void PostTransactionRulesTest() { var client = CreateMockTestClientApiKeyBasedRequestAsync("mocks/balanceplatform/TransactionRule.json"); var service = new TransactionRulesService(client); - + var response = service.CreateTransactionRule(new TransactionRuleInfo()); Assert.AreEqual(response.EntityKey.EntityReference, "PI3227C223222B5BPCMFXD2XG"); Assert.AreEqual(response.EntityKey.EntityType, "paymentInstrument"); Assert.AreEqual(response.Interval.Type, TransactionRuleInterval.TypeEnum.PerTransaction); } - + /// /// Test PatchTransactionRulesTransactionRuleId /// @@ -364,13 +366,13 @@ public void PatchTransactionRulesTransactionRuleIdTest() { var client = CreateMockTestClientApiKeyBasedRequestAsync("mocks/balanceplatform/TransactionRule.json"); var service = new TransactionRulesService(client); - + var response = service.UpdateTransactionRule("transactionRuleId", new TransactionRuleInfo()); Assert.AreEqual(response.EntityKey.EntityReference, "PI3227C223222B5BPCMFXD2XG"); Assert.AreEqual(response.EntityKey.EntityType, "paymentInstrument"); Assert.AreEqual(response.Interval.Type, TransactionRuleInterval.TypeEnum.PerTransaction); } - + /// /// Test GetTransactionRulesTransactionRuleId /// @@ -379,12 +381,12 @@ public void GetTransactionRulesTransactionRuleIdTest() { var client = CreateMockTestClientApiKeyBasedRequestAsync("mocks/balanceplatform/TransactionRuleResponse.json"); var service = new TransactionRulesService(client); - + var response = service.GetTransactionRule("transactionRuleId"); Assert.AreEqual(response.TransactionRule.Id, "TR32272223222B5CMD3V73HXG"); Assert.AreEqual(response.TransactionRule.Interval.Type, TransactionRuleInterval.TypeEnum.Monthly); } - + /// /// Test DeleteTransactionRulesTransactionRuleId /// @@ -394,11 +396,13 @@ public void DeleteTransactionRulesTransactionRuleIdTest() var client = CreateMockTestClientApiKeyBasedRequestAsync("mocks/balanceplatform/TransactionRuleResponse.json"); var service = new TransactionRulesService(client); var response = service.DeleteTransactionRule("transactionRuleId"); - + } + #endregion - + #region BankAccountValidation + /// /// Test /validateBankAccountIdentification /// @@ -411,11 +415,11 @@ public void ValidateBankAccountTest() { AccountIdentification = new BankAccountIdentificationValidationRequestAccountIdentification( new CZLocalAccountIdentification - { - AccountNumber = "123456789", - BankCode = "bankCode", - Type = CZLocalAccountIdentification.TypeEnum.CzLocal - }) + { + AccountNumber = "123456789", + BankCode = "bankCode", + Type = CZLocalAccountIdentification.TypeEnum.CzLocal + }) }; service.ValidateBankAccountIdentification(bankAccountIdentificationValidationRequest); ClientInterfaceSubstitute.Received().RequestAsync( @@ -423,6 +427,74 @@ public void ValidateBankAccountTest() Arg.Any(), null, HttpMethod.Post, new CancellationToken()); } + #endregion + + [TestMethod] + public void Deserialize_WebhookSettingsPayload_Returns_WebhookSettings() + { + // Arrange + string json = @" + { + ""WebhookSettings"": [ + { + ""id"": ""BWHS00000000000000000000000001"", + ""type"": ""balance"", + ""target"": { + ""type"": ""balancePlatform"", + ""id"": ""YOUR_BALANCE_PLATFORM"" + }, + ""currency"": ""USD"", + ""status"": ""active"", + ""conditions"": [ + { + ""balanceType"": ""available"", + ""conditionType"": ""lessThan"", + ""value"": 500000 + } + ] + }, + { + ""id"": ""BWHS00000000000000000000000002"", + ""type"": ""balance"", + ""target"": { + ""type"": ""balanceAccount"", + ""id"": ""BA00000000000000000LIABLE"" + }, + ""currency"": ""USD"", + ""status"": ""active"", + ""conditions"": [ + { + ""balanceType"": ""available"", + ""conditionType"": ""greaterThan"", + ""value"": 1000000 + } + ] + } + ] + }"; + + // Act + WebhookSettingsResponse response = JsonConvert.DeserializeObject(json); + + // Assert + Assert.IsNotNull(response); + Assert.AreEqual(2, response.WebhookSettings.Count); + + BalanceWebhookSetting first = response.WebhookSettings[0] as BalanceWebhookSetting; + Assert.AreEqual("BWHS00000000000000000000000001", first.Id); + Assert.AreEqual(Target.TypeEnum.BalancePlatform, first.Target.Type); + Assert.AreEqual("USD", first.Currency); + Assert.AreEqual(Condition.ConditionTypeEnum.LessThan, first.Conditions[0].ConditionType); + Assert.AreEqual(Condition.BalanceTypeEnum.Available, first.Conditions[0].BalanceType); + Assert.AreEqual(500_000, first.Conditions[0].Value); + + BalanceWebhookSetting second = response.WebhookSettings[1] as BalanceWebhookSetting; + Assert.AreEqual("BWHS00000000000000000000000002", second.Id); + Assert.AreEqual(Target.TypeEnum.BalanceAccount, second.Target.Type); + Assert.AreEqual(Condition.ConditionTypeEnum.GreaterThan, second.Conditions[0].ConditionType); + Assert.AreEqual(Condition.BalanceTypeEnum.Available, second.Conditions[0].BalanceType); + Assert.AreEqual(1_000_000, second.Conditions[0].Value); + } } } \ No newline at end of file diff --git a/Adyen/Adyen.csproj b/Adyen/Adyen.csproj index cd5d54b59..4d4470e5e 100644 --- a/Adyen/Adyen.csproj +++ b/Adyen/Adyen.csproj @@ -41,6 +41,7 @@ + diff --git a/Adyen/Model/BalancePlatform/BalanceAccount.cs b/Adyen/Model/BalancePlatform/BalanceAccount.cs index d2d24428e..8f0329956 100644 --- a/Adyen/Model/BalancePlatform/BalanceAccount.cs +++ b/Adyen/Model/BalancePlatform/BalanceAccount.cs @@ -82,7 +82,7 @@ protected BalanceAccount() { } /// /// 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). /// List of balances with the amount and currency.. - /// The default three-character [ISO currency code](https://docs.adyen.com/development-resources/currency-codes) of the balance account. The default value is **EUR**. > 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**. > After a balance account is created, you cannot change its default currency.. /// 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.. /// The unique identifier of the balance account. (required). /// 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. > Note that during an update of metadata, the omission of existing key-value pairs will result in the deletion of those key-value pairs.. @@ -119,9 +119,9 @@ protected BalanceAccount() { } public List Balances { get; set; } /// - /// The default three-character [ISO currency code](https://docs.adyen.com/development-resources/currency-codes) of the balance account. The default value is **EUR**. > 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**. > 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. The default value is **EUR**. > 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**. > After a balance account is created, you cannot change its default currency. [DataMember(Name = "defaultCurrencyCode", EmitDefaultValue = false)] public string DefaultCurrencyCode { get; set; } diff --git a/Adyen/Model/BalancePlatform/BalanceAccountBase.cs b/Adyen/Model/BalancePlatform/BalanceAccountBase.cs index a508812b0..9afc0cdc6 100644 --- a/Adyen/Model/BalancePlatform/BalanceAccountBase.cs +++ b/Adyen/Model/BalancePlatform/BalanceAccountBase.cs @@ -81,7 +81,7 @@ protected BalanceAccountBase() { } /// Initializes a new instance of the class. /// /// 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). - /// The default three-character [ISO currency code](https://docs.adyen.com/development-resources/currency-codes) of the balance account. The default value is **EUR**. > 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**. > After a balance account is created, you cannot change its default currency.. /// 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.. /// The unique identifier of the balance account. (required). /// 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. > Note that during an update of metadata, the omission of existing key-value pairs will result in the deletion of those key-value pairs.. @@ -110,9 +110,9 @@ protected BalanceAccountBase() { } public string AccountHolderId { get; set; } /// - /// The default three-character [ISO currency code](https://docs.adyen.com/development-resources/currency-codes) of the balance account. The default value is **EUR**. > 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**. > 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. The default value is **EUR**. > 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**. > After a balance account is created, you cannot change its default currency. [DataMember(Name = "defaultCurrencyCode", EmitDefaultValue = false)] public string DefaultCurrencyCode { get; set; } diff --git a/Adyen/Model/BalancePlatform/BalanceAccountInfo.cs b/Adyen/Model/BalancePlatform/BalanceAccountInfo.cs index 43d951368..8b0f421bf 100644 --- a/Adyen/Model/BalancePlatform/BalanceAccountInfo.cs +++ b/Adyen/Model/BalancePlatform/BalanceAccountInfo.cs @@ -41,7 +41,7 @@ protected BalanceAccountInfo() { } /// Initializes a new instance of the class. /// /// 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). - /// The default three-character [ISO currency code](https://docs.adyen.com/development-resources/currency-codes) of the balance account. The default value is **EUR**. > 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**. > After a balance account is created, you cannot change its default currency.. /// 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.. /// 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. > Note that during an update of metadata, the omission of existing key-value pairs will result in the deletion of those key-value pairs.. /// platformPaymentConfiguration. @@ -66,9 +66,9 @@ protected BalanceAccountInfo() { } public string AccountHolderId { get; set; } /// - /// The default three-character [ISO currency code](https://docs.adyen.com/development-resources/currency-codes) of the balance account. The default value is **EUR**. > 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**. > 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. The default value is **EUR**. > 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**. > After a balance account is created, you cannot change its default currency. [DataMember(Name = "defaultCurrencyCode", EmitDefaultValue = false)] public string DefaultCurrencyCode { get; set; } diff --git a/Adyen/Model/BalancePlatform/BalanceWebhookSetting.cs b/Adyen/Model/BalancePlatform/BalanceWebhookSetting.cs new file mode 100644 index 000000000..e3ed774a1 --- /dev/null +++ b/Adyen/Model/BalancePlatform/BalanceWebhookSetting.cs @@ -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 +{ + /// + /// BalanceWebhookSetting + /// + [DataContract(Name = "BalanceWebhookSetting")] + [JsonConverter(typeof(JsonSubtypes), "Type")] + [JsonSubtypes.KnownSubType(typeof(BalanceWebhookSetting), "balance")] + public partial class BalanceWebhookSetting : WebhookSetting, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected BalanceWebhookSetting() { } + /// + /// Initializes a new instance of the class. + /// + /// The list of settings and criteria for triggering the [balance webhook](https://docs.adyen.com/api-explorer/balance-webhooks/latest/post/balanceAccount.balance.updated).. + /// The three-character [ISO currency code](https://docs.adyen.com/development-resources/currency-codes) of the balance. (required). + /// The unique identifier of the webhook setting. (required). + /// status (required). + /// target (required). + /// type (required) (default to "BalanceWebhookSetting"). + public BalanceWebhookSetting(List conditions = default(List), 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; + } + + /// + /// The list of settings and criteria for triggering the [balance webhook](https://docs.adyen.com/api-explorer/balance-webhooks/latest/post/balanceAccount.balance.updated). + /// + /// The list of settings and criteria for triggering the [balance webhook](https://docs.adyen.com/api-explorer/balance-webhooks/latest/post/balanceAccount.balance.updated). + [DataMember(Name = "conditions", EmitDefaultValue = false)] + public List Conditions { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + 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(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as BalanceWebhookSetting); + } + + /// + /// Returns true if BalanceWebhookSetting instances are equal + /// + /// Instance of BalanceWebhookSetting to be compared + /// Boolean + 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) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + 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; + } + } + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + public IEnumerable Validate(ValidationContext validationContext) + { + return this.BaseValidate(validationContext); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + protected IEnumerable BaseValidate(ValidationContext validationContext) + { + foreach (var x in BaseValidate(validationContext)) + { + yield return x; + } + yield break; + } + } + +} diff --git a/Adyen/Model/BalancePlatform/BalanceWebhookSettingAllOf.cs b/Adyen/Model/BalancePlatform/BalanceWebhookSettingAllOf.cs new file mode 100644 index 000000000..2be09c538 --- /dev/null +++ b/Adyen/Model/BalancePlatform/BalanceWebhookSettingAllOf.cs @@ -0,0 +1,130 @@ +/* +* 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 System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Adyen.ApiSerialization.OpenAPIDateConverter; + +namespace Adyen.Model.BalancePlatform +{ + /// + /// BalanceWebhookSettingAllOf + /// + [DataContract(Name = "BalanceWebhookSetting_allOf")] + public partial class BalanceWebhookSettingAllOf : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// The list of settings and criteria for triggering the [balance webhook](https://docs.adyen.com/api-explorer/balance-webhooks/latest/post/balanceAccount.balance.updated).. + public BalanceWebhookSettingAllOf(List conditions = default(List)) + { + this.Conditions = 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). + /// + /// The list of settings and criteria for triggering the [balance webhook](https://docs.adyen.com/api-explorer/balance-webhooks/latest/post/balanceAccount.balance.updated). + [DataMember(Name = "conditions", EmitDefaultValue = false)] + public List Conditions { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class BalanceWebhookSettingAllOf {\n"); + sb.Append(" Conditions: ").Append(Conditions).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as BalanceWebhookSettingAllOf); + } + + /// + /// Returns true if BalanceWebhookSettingAllOf instances are equal + /// + /// Instance of BalanceWebhookSettingAllOf to be compared + /// Boolean + public bool Equals(BalanceWebhookSettingAllOf input) + { + if (input == null) + { + return false; + } + return + ( + this.Conditions == input.Conditions || + this.Conditions != null && + input.Conditions != null && + this.Conditions.SequenceEqual(input.Conditions) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Conditions != null) + { + hashCode = (hashCode * 59) + this.Conditions.GetHashCode(); + } + return hashCode; + } + } + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + public IEnumerable Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/Adyen/Model/BalancePlatform/BalanceWebhookSettingInfo.cs b/Adyen/Model/BalancePlatform/BalanceWebhookSettingInfo.cs new file mode 100644 index 000000000..f204a38e3 --- /dev/null +++ b/Adyen/Model/BalancePlatform/BalanceWebhookSettingInfo.cs @@ -0,0 +1,238 @@ +/* +* 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 System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Adyen.ApiSerialization.OpenAPIDateConverter; + +namespace Adyen.Model.BalancePlatform +{ + /// + /// BalanceWebhookSettingInfo + /// + [DataContract(Name = "BalanceWebhookSettingInfo")] + public partial class BalanceWebhookSettingInfo : IEquatable, IValidatableObject + { + /// + /// The status of the webhook setting. Possible values: * **active**: You receive a balance webhook if any of the conditions in this setting are met. * **inactive**: You do not receive a balance webhook even if the conditions in this settings are met. + /// + /// The status of the webhook setting. Possible values: * **active**: You receive a balance webhook if any of the conditions in this setting are met. * **inactive**: You do not receive a balance webhook even if the conditions in this settings are met. + [JsonConverter(typeof(StringEnumConverter))] + public enum StatusEnum + { + /// + /// Enum Active for value: active + /// + [EnumMember(Value = "active")] + Active = 1, + + /// + /// Enum Inactive for value: inactive + /// + [EnumMember(Value = "inactive")] + Inactive = 2 + + } + + + /// + /// The status of the webhook setting. Possible values: * **active**: You receive a balance webhook if any of the conditions in this setting are met. * **inactive**: You do not receive a balance webhook even if the conditions in this settings are met. + /// + /// The status of the webhook setting. Possible values: * **active**: You receive a balance webhook if any of the conditions in this setting are met. * **inactive**: You do not receive a balance webhook even if the conditions in this settings are met. + [DataMember(Name = "status", IsRequired = false, EmitDefaultValue = false)] + public StatusEnum Status { get; set; } + /// + /// The type of the webhook you are configuring. Set to **balance**. + /// + /// The type of the webhook you are configuring. Set to **balance**. + [JsonConverter(typeof(StringEnumConverter))] + public enum TypeEnum + { + /// + /// Enum Balance for value: balance + /// + [EnumMember(Value = "balance")] + Balance = 1 + + } + + + /// + /// The type of the webhook you are configuring. Set to **balance**. + /// + /// The type of the webhook you are configuring. Set to **balance**. + [DataMember(Name = "type", IsRequired = false, EmitDefaultValue = false)] + public TypeEnum Type { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected BalanceWebhookSettingInfo() { } + /// + /// Initializes a new instance of the class. + /// + /// The array of conditions a balance change must meet for Adyen to send the webhook.. + /// The three-character [ISO currency code](https://docs.adyen.com/development-resources/currency-codes) of the balance. (required). + /// The status of the webhook setting. Possible values: * **active**: You receive a balance webhook if any of the conditions in this setting are met. * **inactive**: You do not receive a balance webhook even if the conditions in this settings are met. (required). + /// target (required). + /// The type of the webhook you are configuring. Set to **balance**. (required). + public BalanceWebhookSettingInfo(List conditions = default(List), string currency = default(string), StatusEnum status = default(StatusEnum), Target target = default(Target), TypeEnum type = default(TypeEnum)) + { + this.Currency = currency; + this.Status = status; + this.Target = target; + this.Type = type; + this.Conditions = conditions; + } + + /// + /// The array of conditions a balance change must meet for Adyen to send the webhook. + /// + /// The array of conditions a balance change must meet for Adyen to send the webhook. + [DataMember(Name = "conditions", EmitDefaultValue = false)] + public List Conditions { get; set; } + + /// + /// The three-character [ISO currency code](https://docs.adyen.com/development-resources/currency-codes) of the balance. + /// + /// The three-character [ISO currency code](https://docs.adyen.com/development-resources/currency-codes) of the balance. + [DataMember(Name = "currency", IsRequired = false, EmitDefaultValue = false)] + public string Currency { get; set; } + + /// + /// Gets or Sets Target + /// + [DataMember(Name = "target", IsRequired = false, EmitDefaultValue = false)] + public Target Target { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class BalanceWebhookSettingInfo {\n"); + sb.Append(" Conditions: ").Append(Conditions).Append("\n"); + sb.Append(" Currency: ").Append(Currency).Append("\n"); + sb.Append(" Status: ").Append(Status).Append("\n"); + sb.Append(" Target: ").Append(Target).Append("\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as BalanceWebhookSettingInfo); + } + + /// + /// Returns true if BalanceWebhookSettingInfo instances are equal + /// + /// Instance of BalanceWebhookSettingInfo to be compared + /// Boolean + public bool Equals(BalanceWebhookSettingInfo input) + { + if (input == null) + { + return false; + } + return + ( + this.Conditions == input.Conditions || + this.Conditions != null && + input.Conditions != null && + this.Conditions.SequenceEqual(input.Conditions) + ) && + ( + this.Currency == input.Currency || + (this.Currency != null && + this.Currency.Equals(input.Currency)) + ) && + ( + this.Status == input.Status || + this.Status.Equals(input.Status) + ) && + ( + this.Target == input.Target || + (this.Target != null && + this.Target.Equals(input.Target)) + ) && + ( + this.Type == input.Type || + this.Type.Equals(input.Type) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Conditions != null) + { + hashCode = (hashCode * 59) + this.Conditions.GetHashCode(); + } + if (this.Currency != null) + { + hashCode = (hashCode * 59) + this.Currency.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Status.GetHashCode(); + if (this.Target != null) + { + hashCode = (hashCode * 59) + this.Target.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Type.GetHashCode(); + return hashCode; + } + } + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + public IEnumerable Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/Adyen/Model/BalancePlatform/BalanceWebhookSettingInfoUpdate.cs b/Adyen/Model/BalancePlatform/BalanceWebhookSettingInfoUpdate.cs new file mode 100644 index 000000000..6682ec8e7 --- /dev/null +++ b/Adyen/Model/BalancePlatform/BalanceWebhookSettingInfoUpdate.cs @@ -0,0 +1,233 @@ +/* +* 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 System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Adyen.ApiSerialization.OpenAPIDateConverter; + +namespace Adyen.Model.BalancePlatform +{ + /// + /// BalanceWebhookSettingInfoUpdate + /// + [DataContract(Name = "BalanceWebhookSettingInfoUpdate")] + public partial class BalanceWebhookSettingInfoUpdate : IEquatable, IValidatableObject + { + /// + /// The status of the webhook setting. Possible values: * **active**: You receive a balance webhook if any of the conditions in this setting are met. * **inactive**: You do not receive a balance webhook even if the conditions in this settings are met. + /// + /// The status of the webhook setting. Possible values: * **active**: You receive a balance webhook if any of the conditions in this setting are met. * **inactive**: You do not receive a balance webhook even if the conditions in this settings are met. + [JsonConverter(typeof(StringEnumConverter))] + public enum StatusEnum + { + /// + /// Enum Active for value: active + /// + [EnumMember(Value = "active")] + Active = 1, + + /// + /// Enum Inactive for value: inactive + /// + [EnumMember(Value = "inactive")] + Inactive = 2 + + } + + + /// + /// The status of the webhook setting. Possible values: * **active**: You receive a balance webhook if any of the conditions in this setting are met. * **inactive**: You do not receive a balance webhook even if the conditions in this settings are met. + /// + /// The status of the webhook setting. Possible values: * **active**: You receive a balance webhook if any of the conditions in this setting are met. * **inactive**: You do not receive a balance webhook even if the conditions in this settings are met. + [DataMember(Name = "status", EmitDefaultValue = false)] + public StatusEnum? Status { get; set; } + /// + /// The type of the webhook you are configuring. Set to **balance**. + /// + /// The type of the webhook you are configuring. Set to **balance**. + [JsonConverter(typeof(StringEnumConverter))] + public enum TypeEnum + { + /// + /// Enum Balance for value: balance + /// + [EnumMember(Value = "balance")] + Balance = 1 + + } + + + /// + /// The type of the webhook you are configuring. Set to **balance**. + /// + /// The type of the webhook you are configuring. Set to **balance**. + [DataMember(Name = "type", EmitDefaultValue = false)] + public TypeEnum? Type { get; set; } + /// + /// Initializes a new instance of the class. + /// + /// The array of conditions a balance change must meet for Adyen to send the webhook.. + /// The three-character [ISO currency code](https://docs.adyen.com/development-resources/currency-codes) of the balance.. + /// The status of the webhook setting. Possible values: * **active**: You receive a balance webhook if any of the conditions in this setting are met. * **inactive**: You do not receive a balance webhook even if the conditions in this settings are met.. + /// target. + /// The type of the webhook you are configuring. Set to **balance**.. + public BalanceWebhookSettingInfoUpdate(List conditions = default(List), string currency = default(string), StatusEnum? status = default(StatusEnum?), TargetUpdate target = default(TargetUpdate), TypeEnum? type = default(TypeEnum?)) + { + this.Conditions = conditions; + this.Currency = currency; + this.Status = status; + this.Target = target; + this.Type = type; + } + + /// + /// The array of conditions a balance change must meet for Adyen to send the webhook. + /// + /// The array of conditions a balance change must meet for Adyen to send the webhook. + [DataMember(Name = "conditions", EmitDefaultValue = false)] + public List Conditions { get; set; } + + /// + /// The three-character [ISO currency code](https://docs.adyen.com/development-resources/currency-codes) of the balance. + /// + /// The three-character [ISO currency code](https://docs.adyen.com/development-resources/currency-codes) of the balance. + [DataMember(Name = "currency", EmitDefaultValue = false)] + public string Currency { get; set; } + + /// + /// Gets or Sets Target + /// + [DataMember(Name = "target", EmitDefaultValue = false)] + public TargetUpdate Target { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class BalanceWebhookSettingInfoUpdate {\n"); + sb.Append(" Conditions: ").Append(Conditions).Append("\n"); + sb.Append(" Currency: ").Append(Currency).Append("\n"); + sb.Append(" Status: ").Append(Status).Append("\n"); + sb.Append(" Target: ").Append(Target).Append("\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as BalanceWebhookSettingInfoUpdate); + } + + /// + /// Returns true if BalanceWebhookSettingInfoUpdate instances are equal + /// + /// Instance of BalanceWebhookSettingInfoUpdate to be compared + /// Boolean + public bool Equals(BalanceWebhookSettingInfoUpdate input) + { + if (input == null) + { + return false; + } + return + ( + this.Conditions == input.Conditions || + this.Conditions != null && + input.Conditions != null && + this.Conditions.SequenceEqual(input.Conditions) + ) && + ( + this.Currency == input.Currency || + (this.Currency != null && + this.Currency.Equals(input.Currency)) + ) && + ( + this.Status == input.Status || + this.Status.Equals(input.Status) + ) && + ( + this.Target == input.Target || + (this.Target != null && + this.Target.Equals(input.Target)) + ) && + ( + this.Type == input.Type || + this.Type.Equals(input.Type) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Conditions != null) + { + hashCode = (hashCode * 59) + this.Conditions.GetHashCode(); + } + if (this.Currency != null) + { + hashCode = (hashCode * 59) + this.Currency.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Status.GetHashCode(); + if (this.Target != null) + { + hashCode = (hashCode * 59) + this.Target.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Type.GetHashCode(); + return hashCode; + } + } + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + public IEnumerable Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/Adyen/Model/BalancePlatform/BankIdentification.cs b/Adyen/Model/BalancePlatform/BankIdentification.cs index bf45d0b79..dafc36540 100644 --- a/Adyen/Model/BalancePlatform/BankIdentification.cs +++ b/Adyen/Model/BalancePlatform/BankIdentification.cs @@ -33,37 +33,43 @@ namespace Adyen.Model.BalancePlatform public partial class BankIdentification : IEquatable, IValidatableObject { /// - /// The type of the identification. Possible values: **iban**, **routingNumber**, **sortCode**. + /// The type of the identification. Possible values: **iban**, **routingNumber**, **sortCode**, **bic**. /// - /// The type of the identification. Possible values: **iban**, **routingNumber**, **sortCode**. + /// The type of the identification. Possible values: **iban**, **routingNumber**, **sortCode**, **bic**. [JsonConverter(typeof(StringEnumConverter))] public enum IdentificationTypeEnum { + /// + /// Enum Bic for value: bic + /// + [EnumMember(Value = "bic")] + Bic = 1, + /// /// Enum Iban for value: iban /// [EnumMember(Value = "iban")] - Iban = 1, + Iban = 2, /// /// Enum RoutingNumber for value: routingNumber /// [EnumMember(Value = "routingNumber")] - RoutingNumber = 2, + RoutingNumber = 3, /// /// Enum SortCode for value: sortCode /// [EnumMember(Value = "sortCode")] - SortCode = 3 + SortCode = 4 } /// - /// The type of the identification. Possible values: **iban**, **routingNumber**, **sortCode**. + /// The type of the identification. Possible values: **iban**, **routingNumber**, **sortCode**, **bic**. /// - /// The type of the identification. Possible values: **iban**, **routingNumber**, **sortCode**. + /// The type of the identification. Possible values: **iban**, **routingNumber**, **sortCode**, **bic**. [DataMember(Name = "identificationType", EmitDefaultValue = false)] public IdentificationTypeEnum? IdentificationType { get; set; } /// @@ -71,7 +77,7 @@ public enum IdentificationTypeEnum /// /// Two-character [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country code.. /// The bank identification code.. - /// The type of the identification. Possible values: **iban**, **routingNumber**, **sortCode**.. + /// The type of the identification. Possible values: **iban**, **routingNumber**, **sortCode**, **bic**.. public BankIdentification(string country = default(string), string identification = default(string), IdentificationTypeEnum? identificationType = default(IdentificationTypeEnum?)) { this.Country = country; diff --git a/Adyen/Model/BalancePlatform/Condition.cs b/Adyen/Model/BalancePlatform/Condition.cs new file mode 100644 index 000000000..5a3209160 --- /dev/null +++ b/Adyen/Model/BalancePlatform/Condition.cs @@ -0,0 +1,226 @@ +/* +* 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 System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Adyen.ApiSerialization.OpenAPIDateConverter; + +namespace Adyen.Model.BalancePlatform +{ + /// + /// Condition + /// + [DataContract(Name = "Condition")] + public partial class Condition : IEquatable, IValidatableObject + { + /// + /// Define the type of balance about which you want to get notified. Possible values: * **available**: the balance available for use. * **balance**: the sum of transactions that have already been settled. * **pending**: the sum of transactions that will be settled in the future. * **reserved**: the balance currently held in reserve. + /// + /// Define the type of balance about which you want to get notified. Possible values: * **available**: the balance available for use. * **balance**: the sum of transactions that have already been settled. * **pending**: the sum of transactions that will be settled in the future. * **reserved**: the balance currently held in reserve. + [JsonConverter(typeof(StringEnumConverter))] + public enum BalanceTypeEnum + { + /// + /// Enum Balance for value: balance + /// + [EnumMember(Value = "balance")] + Balance = 1, + + /// + /// Enum Available for value: available + /// + [EnumMember(Value = "available")] + Available = 2, + + /// + /// Enum Pending for value: pending + /// + [EnumMember(Value = "pending")] + Pending = 3, + + /// + /// Enum Reserved for value: reserved + /// + [EnumMember(Value = "reserved")] + Reserved = 4 + + } + + + /// + /// Define the type of balance about which you want to get notified. Possible values: * **available**: the balance available for use. * **balance**: the sum of transactions that have already been settled. * **pending**: the sum of transactions that will be settled in the future. * **reserved**: the balance currently held in reserve. + /// + /// Define the type of balance about which you want to get notified. Possible values: * **available**: the balance available for use. * **balance**: the sum of transactions that have already been settled. * **pending**: the sum of transactions that will be settled in the future. * **reserved**: the balance currently held in reserve. + [DataMember(Name = "balanceType", IsRequired = false, EmitDefaultValue = false)] + public BalanceTypeEnum BalanceType { get; set; } + /// + /// Define when you want to get notified about a balance change. Possible values: * **greaterThan**: the balance in the account(s) exceeds the specified `value`. * **greaterThanOrEqual**: the balance in the account(s) reaches or exceeds the specified `value`. * **lessThan**: the balance in the account(s) drops below the specified `value`. * **lessThanOrEqual**: the balance in the account(s) reaches to drops below the specified `value`. + /// + /// Define when you want to get notified about a balance change. Possible values: * **greaterThan**: the balance in the account(s) exceeds the specified `value`. * **greaterThanOrEqual**: the balance in the account(s) reaches or exceeds the specified `value`. * **lessThan**: the balance in the account(s) drops below the specified `value`. * **lessThanOrEqual**: the balance in the account(s) reaches to drops below the specified `value`. + [JsonConverter(typeof(StringEnumConverter))] + public enum ConditionTypeEnum + { + /// + /// Enum GreaterThan for value: greaterThan + /// + [EnumMember(Value = "greaterThan")] + GreaterThan = 1, + + /// + /// Enum GreaterThanOrEqual for value: greaterThanOrEqual + /// + [EnumMember(Value = "greaterThanOrEqual")] + GreaterThanOrEqual = 2, + + /// + /// Enum LessThan for value: lessThan + /// + [EnumMember(Value = "lessThan")] + LessThan = 3, + + /// + /// Enum LessThanOrEqual for value: lessThanOrEqual + /// + [EnumMember(Value = "lessThanOrEqual")] + LessThanOrEqual = 4 + + } + + + /// + /// Define when you want to get notified about a balance change. Possible values: * **greaterThan**: the balance in the account(s) exceeds the specified `value`. * **greaterThanOrEqual**: the balance in the account(s) reaches or exceeds the specified `value`. * **lessThan**: the balance in the account(s) drops below the specified `value`. * **lessThanOrEqual**: the balance in the account(s) reaches to drops below the specified `value`. + /// + /// Define when you want to get notified about a balance change. Possible values: * **greaterThan**: the balance in the account(s) exceeds the specified `value`. * **greaterThanOrEqual**: the balance in the account(s) reaches or exceeds the specified `value`. * **lessThan**: the balance in the account(s) drops below the specified `value`. * **lessThanOrEqual**: the balance in the account(s) reaches to drops below the specified `value`. + [DataMember(Name = "conditionType", IsRequired = false, EmitDefaultValue = false)] + public ConditionTypeEnum ConditionType { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected Condition() { } + /// + /// Initializes a new instance of the class. + /// + /// Define the type of balance about which you want to get notified. Possible values: * **available**: the balance available for use. * **balance**: the sum of transactions that have already been settled. * **pending**: the sum of transactions that will be settled in the future. * **reserved**: the balance currently held in reserve. (required). + /// Define when you want to get notified about a balance change. Possible values: * **greaterThan**: the balance in the account(s) exceeds the specified `value`. * **greaterThanOrEqual**: the balance in the account(s) reaches or exceeds the specified `value`. * **lessThan**: the balance in the account(s) drops below the specified `value`. * **lessThanOrEqual**: the balance in the account(s) reaches to drops below the specified `value`. (required). + /// The value limit in the specified balance type and currency, in minor units. (required). + public Condition(BalanceTypeEnum balanceType = default(BalanceTypeEnum), ConditionTypeEnum conditionType = default(ConditionTypeEnum), long? value = default(long?)) + { + this.BalanceType = balanceType; + this.ConditionType = conditionType; + this.Value = value; + } + + /// + /// The value limit in the specified balance type and currency, in minor units. + /// + /// The value limit in the specified balance type and currency, in minor units. + [DataMember(Name = "value", IsRequired = false, EmitDefaultValue = false)] + public long? Value { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Condition {\n"); + sb.Append(" BalanceType: ").Append(BalanceType).Append("\n"); + sb.Append(" ConditionType: ").Append(ConditionType).Append("\n"); + sb.Append(" Value: ").Append(Value).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as Condition); + } + + /// + /// Returns true if Condition instances are equal + /// + /// Instance of Condition to be compared + /// Boolean + public bool Equals(Condition input) + { + if (input == null) + { + return false; + } + return + ( + this.BalanceType == input.BalanceType || + this.BalanceType.Equals(input.BalanceType) + ) && + ( + this.ConditionType == input.ConditionType || + this.ConditionType.Equals(input.ConditionType) + ) && + ( + this.Value == input.Value || + this.Value.Equals(input.Value) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.BalanceType.GetHashCode(); + hashCode = (hashCode * 59) + this.ConditionType.GetHashCode(); + hashCode = (hashCode * 59) + this.Value.GetHashCode(); + return hashCode; + } + } + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + public IEnumerable Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/Adyen/Model/BalancePlatform/CreateSweepConfigurationV2.cs b/Adyen/Model/BalancePlatform/CreateSweepConfigurationV2.cs index fbb7580cd..e7dec8af0 100644 --- a/Adyen/Model/BalancePlatform/CreateSweepConfigurationV2.cs +++ b/Adyen/Model/BalancePlatform/CreateSweepConfigurationV2.cs @@ -113,9 +113,9 @@ public enum PrioritiesEnum /// - /// The list of priorities for the bank transfer. This sets the speed at which the transfer is sent and the fees that you have to pay. You can provide multiple priorities. Adyen will try to pay out using the priority you list first. If that's not possible, it moves on to the next option in the order of your provided priorities. Possible values: * **regular**: for normal, low-value transactions. * **fast**: a faster way to transfer funds, but the fees are higher. Recommended for high-priority, low-value transactions. * **wire**: the fastest way to transfer funds, but this has the highest fees. Recommended for high-priority, high-value transactions. * **instant**: for instant funds transfers in [SEPA countries](https://www.ecb.europa.eu/paym/integration/retail/sepa/html/index.en.html). * **crossBorder**: for high-value transfers to a recipient in a different country. * **internal**: for transfers to an Adyen-issued business bank account (by bank account number/IBAN). Set `category` to **bank**. For more details, see optional priorities setup for [marketplaces](https://docs.adyen.com/marketplaces/payout-to-users/scheduled-payouts#optional-priorities-setup) or [platforms](https://docs.adyen.com/platforms/payout-to-users/scheduled-payouts#optional-priorities-setup). + /// The list of priorities for the bank transfer. This sets the speed at which the transfer is sent and the fees that you have to pay. You can provide multiple priorities, ordered by your preference. Adyen will try to pay out using the priorities in the given order. If the first priority is not currently supported or enabled for your platform, the system will try the next one, and so on. The request will be accepted as long as **at least one** of the provided priorities is valid (i.e., supported by Adyen and activated for your platform). For example, if you provide `[\"wire\",\"regular\"]`, and `wire` is not supported but `regular` is, the request will still be accepted and processed. Possible values: * **regular**: for normal, low-value transactions. * **fast**: a faster way to transfer funds, but the fees are higher. Recommended for high-priority, low-value transactions. * **wire**: the fastest way to transfer funds, but this has the highest fees. Recommended for high-priority, high-value transactions. * **instant**: for instant funds transfers in [SEPA countries](https://www.ecb.europa.eu/paym/integration/retail/sepa/html/index.en.html). * **crossBorder**: for high-value transfers to a recipient in a different country. * **internal**: for transfers to an Adyen-issued business bank account (by bank account number/IBAN). Set `category` to **bank**. For more details, see optional priorities setup for [marketplaces](https://docs.adyen.com/marketplaces/payout-to-users/scheduled-payouts#optional-priorities-setup) or [platforms](https://docs.adyen.com/platforms/payout-to-users/scheduled-payouts#optional-priorities-setup). /// - /// The list of priorities for the bank transfer. This sets the speed at which the transfer is sent and the fees that you have to pay. You can provide multiple priorities. Adyen will try to pay out using the priority you list first. If that's not possible, it moves on to the next option in the order of your provided priorities. Possible values: * **regular**: for normal, low-value transactions. * **fast**: a faster way to transfer funds, but the fees are higher. Recommended for high-priority, low-value transactions. * **wire**: the fastest way to transfer funds, but this has the highest fees. Recommended for high-priority, high-value transactions. * **instant**: for instant funds transfers in [SEPA countries](https://www.ecb.europa.eu/paym/integration/retail/sepa/html/index.en.html). * **crossBorder**: for high-value transfers to a recipient in a different country. * **internal**: for transfers to an Adyen-issued business bank account (by bank account number/IBAN). Set `category` to **bank**. For more details, see optional priorities setup for [marketplaces](https://docs.adyen.com/marketplaces/payout-to-users/scheduled-payouts#optional-priorities-setup) or [platforms](https://docs.adyen.com/platforms/payout-to-users/scheduled-payouts#optional-priorities-setup). + /// The list of priorities for the bank transfer. This sets the speed at which the transfer is sent and the fees that you have to pay. You can provide multiple priorities, ordered by your preference. Adyen will try to pay out using the priorities in the given order. If the first priority is not currently supported or enabled for your platform, the system will try the next one, and so on. The request will be accepted as long as **at least one** of the provided priorities is valid (i.e., supported by Adyen and activated for your platform). For example, if you provide `[\"wire\",\"regular\"]`, and `wire` is not supported but `regular` is, the request will still be accepted and processed. Possible values: * **regular**: for normal, low-value transactions. * **fast**: a faster way to transfer funds, but the fees are higher. Recommended for high-priority, low-value transactions. * **wire**: the fastest way to transfer funds, but this has the highest fees. Recommended for high-priority, high-value transactions. * **instant**: for instant funds transfers in [SEPA countries](https://www.ecb.europa.eu/paym/integration/retail/sepa/html/index.en.html). * **crossBorder**: for high-value transfers to a recipient in a different country. * **internal**: for transfers to an Adyen-issued business bank account (by bank account number/IBAN). Set `category` to **bank**. For more details, see optional priorities setup for [marketplaces](https://docs.adyen.com/marketplaces/payout-to-users/scheduled-payouts#optional-priorities-setup) or [platforms](https://docs.adyen.com/platforms/payout-to-users/scheduled-payouts#optional-priorities-setup). [DataMember(Name = "priorities", EmitDefaultValue = false)] public List Priorities { get; set; } /// @@ -215,53 +215,59 @@ public enum ReasonEnum [EnumMember(Value = "notEnoughBalance")] NotEnoughBalance = 15, + /// + /// Enum Pending for value: pending + /// + [EnumMember(Value = "pending")] + Pending = 16, + /// /// Enum PendingApproval for value: pendingApproval /// [EnumMember(Value = "pendingApproval")] - PendingApproval = 16, + PendingApproval = 17, /// /// Enum PendingExecution for value: pendingExecution /// [EnumMember(Value = "pendingExecution")] - PendingExecution = 17, + PendingExecution = 18, /// /// Enum RefusedByCounterpartyBank for value: refusedByCounterpartyBank /// [EnumMember(Value = "refusedByCounterpartyBank")] - RefusedByCounterpartyBank = 18, + RefusedByCounterpartyBank = 19, /// /// Enum RefusedByCustomer for value: refusedByCustomer /// [EnumMember(Value = "refusedByCustomer")] - RefusedByCustomer = 19, + RefusedByCustomer = 20, /// /// Enum RouteNotFound for value: routeNotFound /// [EnumMember(Value = "routeNotFound")] - RouteNotFound = 20, + RouteNotFound = 21, /// /// Enum ScaFailed for value: scaFailed /// [EnumMember(Value = "scaFailed")] - ScaFailed = 21, + ScaFailed = 22, /// /// Enum TransferInstrumentDoesNotExist for value: transferInstrumentDoesNotExist /// [EnumMember(Value = "transferInstrumentDoesNotExist")] - TransferInstrumentDoesNotExist = 22, + TransferInstrumentDoesNotExist = 23, /// /// Enum Unknown for value: unknown /// [EnumMember(Value = "unknown")] - Unknown = 23 + Unknown = 24 } @@ -349,7 +355,7 @@ protected CreateSweepConfigurationV2() { } /// counterparty (required). /// The three-character [ISO currency code](https://docs.adyen.com/development-resources/currency-codes) in uppercase. For example, **EUR**. The sweep currency must match any of the [balances currencies](https://docs.adyen.com/api-explorer/#/balanceplatform/latest/get/balanceAccounts/{id}__resParam_balances). (required). /// The message that will be used in the sweep transfer's description body with a maximum length of 140 characters. If the message is longer after replacing placeholders, the message will be cut off at 140 characters.. - /// The list of priorities for the bank transfer. This sets the speed at which the transfer is sent and the fees that you have to pay. You can provide multiple priorities. Adyen will try to pay out using the priority you list first. If that's not possible, it moves on to the next option in the order of your provided priorities. Possible values: * **regular**: for normal, low-value transactions. * **fast**: a faster way to transfer funds, but the fees are higher. Recommended for high-priority, low-value transactions. * **wire**: the fastest way to transfer funds, but this has the highest fees. Recommended for high-priority, high-value transactions. * **instant**: for instant funds transfers in [SEPA countries](https://www.ecb.europa.eu/paym/integration/retail/sepa/html/index.en.html). * **crossBorder**: for high-value transfers to a recipient in a different country. * **internal**: for transfers to an Adyen-issued business bank account (by bank account number/IBAN). Set `category` to **bank**. For more details, see optional priorities setup for [marketplaces](https://docs.adyen.com/marketplaces/payout-to-users/scheduled-payouts#optional-priorities-setup) or [platforms](https://docs.adyen.com/platforms/payout-to-users/scheduled-payouts#optional-priorities-setup).. + /// The list of priorities for the bank transfer. This sets the speed at which the transfer is sent and the fees that you have to pay. You can provide multiple priorities, ordered by your preference. Adyen will try to pay out using the priorities in the given order. If the first priority is not currently supported or enabled for your platform, the system will try the next one, and so on. The request will be accepted as long as **at least one** of the provided priorities is valid (i.e., supported by Adyen and activated for your platform). For example, if you provide `[\"wire\",\"regular\"]`, and `wire` is not supported but `regular` is, the request will still be accepted and processed. Possible values: * **regular**: for normal, low-value transactions. * **fast**: a faster way to transfer funds, but the fees are higher. Recommended for high-priority, low-value transactions. * **wire**: the fastest way to transfer funds, but this has the highest fees. Recommended for high-priority, high-value transactions. * **instant**: for instant funds transfers in [SEPA countries](https://www.ecb.europa.eu/paym/integration/retail/sepa/html/index.en.html). * **crossBorder**: for high-value transfers to a recipient in a different country. * **internal**: for transfers to an Adyen-issued business bank account (by bank account number/IBAN). Set `category` to **bank**. For more details, see optional priorities setup for [marketplaces](https://docs.adyen.com/marketplaces/payout-to-users/scheduled-payouts#optional-priorities-setup) or [platforms](https://docs.adyen.com/platforms/payout-to-users/scheduled-payouts#optional-priorities-setup).. /// Your reference for the sweep configuration.. /// The reference sent to or received from the counterparty. Only alphanumeric characters are allowed.. /// schedule (required). diff --git a/Adyen/Model/BalancePlatform/DefaultErrorResponseEntity.cs b/Adyen/Model/BalancePlatform/DefaultErrorResponseEntity.cs new file mode 100644 index 000000000..8da37f0b5 --- /dev/null +++ b/Adyen/Model/BalancePlatform/DefaultErrorResponseEntity.cs @@ -0,0 +1,259 @@ +/* +* 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 System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Adyen.ApiSerialization.OpenAPIDateConverter; + +namespace Adyen.Model.BalancePlatform +{ + /// + /// Standardized error response following RFC-7807 format + /// + [DataContract(Name = "DefaultErrorResponseEntity")] + public partial class DefaultErrorResponseEntity : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// A human-readable explanation specific to this occurrence of the problem.. + /// Unique business error code.. + /// A URI that identifies the specific occurrence of the problem if applicable.. + /// Array of fields with validation errors when applicable.. + /// The unique reference for the request.. + /// The HTTP status code.. + /// A short, human-readable summary of the problem type.. + /// A URI that identifies the validation error type. It points to human-readable documentation for the problem type.. + public DefaultErrorResponseEntity(string detail = default(string), string errorCode = default(string), string instance = default(string), List invalidFields = default(List), string requestId = default(string), int? status = default(int?), string title = default(string), string type = default(string)) + { + this.Detail = detail; + this.ErrorCode = errorCode; + this.Instance = instance; + this.InvalidFields = invalidFields; + this.RequestId = requestId; + this.Status = status; + this.Title = title; + this.Type = type; + } + + /// + /// A human-readable explanation specific to this occurrence of the problem. + /// + /// A human-readable explanation specific to this occurrence of the problem. + [DataMember(Name = "detail", EmitDefaultValue = false)] + public string Detail { get; set; } + + /// + /// Unique business error code. + /// + /// Unique business error code. + [DataMember(Name = "errorCode", EmitDefaultValue = false)] + public string ErrorCode { get; set; } + + /// + /// A URI that identifies the specific occurrence of the problem if applicable. + /// + /// A URI that identifies the specific occurrence of the problem if applicable. + [DataMember(Name = "instance", EmitDefaultValue = false)] + public string Instance { get; set; } + + /// + /// Array of fields with validation errors when applicable. + /// + /// Array of fields with validation errors when applicable. + [DataMember(Name = "invalidFields", EmitDefaultValue = false)] + public List InvalidFields { get; set; } + + /// + /// The unique reference for the request. + /// + /// The unique reference for the request. + [DataMember(Name = "requestId", EmitDefaultValue = false)] + public string RequestId { get; set; } + + /// + /// The HTTP status code. + /// + /// The HTTP status code. + [DataMember(Name = "status", EmitDefaultValue = false)] + public int? Status { get; set; } + + /// + /// A short, human-readable summary of the problem type. + /// + /// A short, human-readable summary of the problem type. + [DataMember(Name = "title", EmitDefaultValue = false)] + public string Title { get; set; } + + /// + /// A URI that identifies the validation error type. It points to human-readable documentation for the problem type. + /// + /// A URI that identifies the validation error type. It points to human-readable documentation for the problem type. + [DataMember(Name = "type", EmitDefaultValue = false)] + public string Type { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class DefaultErrorResponseEntity {\n"); + sb.Append(" Detail: ").Append(Detail).Append("\n"); + sb.Append(" ErrorCode: ").Append(ErrorCode).Append("\n"); + sb.Append(" Instance: ").Append(Instance).Append("\n"); + sb.Append(" InvalidFields: ").Append(InvalidFields).Append("\n"); + sb.Append(" RequestId: ").Append(RequestId).Append("\n"); + sb.Append(" Status: ").Append(Status).Append("\n"); + sb.Append(" Title: ").Append(Title).Append("\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as DefaultErrorResponseEntity); + } + + /// + /// Returns true if DefaultErrorResponseEntity instances are equal + /// + /// Instance of DefaultErrorResponseEntity to be compared + /// Boolean + public bool Equals(DefaultErrorResponseEntity input) + { + if (input == null) + { + return false; + } + return + ( + this.Detail == input.Detail || + (this.Detail != null && + this.Detail.Equals(input.Detail)) + ) && + ( + this.ErrorCode == input.ErrorCode || + (this.ErrorCode != null && + this.ErrorCode.Equals(input.ErrorCode)) + ) && + ( + this.Instance == input.Instance || + (this.Instance != null && + this.Instance.Equals(input.Instance)) + ) && + ( + this.InvalidFields == input.InvalidFields || + this.InvalidFields != null && + input.InvalidFields != null && + this.InvalidFields.SequenceEqual(input.InvalidFields) + ) && + ( + this.RequestId == input.RequestId || + (this.RequestId != null && + this.RequestId.Equals(input.RequestId)) + ) && + ( + this.Status == input.Status || + this.Status.Equals(input.Status) + ) && + ( + this.Title == input.Title || + (this.Title != null && + this.Title.Equals(input.Title)) + ) && + ( + this.Type == input.Type || + (this.Type != null && + this.Type.Equals(input.Type)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Detail != null) + { + hashCode = (hashCode * 59) + this.Detail.GetHashCode(); + } + if (this.ErrorCode != null) + { + hashCode = (hashCode * 59) + this.ErrorCode.GetHashCode(); + } + if (this.Instance != null) + { + hashCode = (hashCode * 59) + this.Instance.GetHashCode(); + } + if (this.InvalidFields != null) + { + hashCode = (hashCode * 59) + this.InvalidFields.GetHashCode(); + } + if (this.RequestId != null) + { + hashCode = (hashCode * 59) + this.RequestId.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Status.GetHashCode(); + if (this.Title != null) + { + hashCode = (hashCode * 59) + this.Title.GetHashCode(); + } + if (this.Type != null) + { + hashCode = (hashCode * 59) + this.Type.GetHashCode(); + } + return hashCode; + } + } + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + public IEnumerable Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/Adyen/Model/BalancePlatform/InvalidField.cs b/Adyen/Model/BalancePlatform/InvalidField.cs index c588762d5..ac86a886f 100644 --- a/Adyen/Model/BalancePlatform/InvalidField.cs +++ b/Adyen/Model/BalancePlatform/InvalidField.cs @@ -40,23 +40,16 @@ protected InvalidField() { } /// /// Initializes a new instance of the class. /// - /// Description of the validation error. (required). /// The field that has an invalid value. (required). /// The invalid value. (required). - public InvalidField(string message = default(string), string name = default(string), string value = default(string)) + /// Description of the validation error. (required). + public InvalidField(string name = default(string), string value = default(string), string message = default(string)) { - this.Message = message; this.Name = name; this.Value = value; + this.Message = message; } - /// - /// Description of the validation error. - /// - /// Description of the validation error. - [DataMember(Name = "message", IsRequired = false, EmitDefaultValue = false)] - public string Message { get; set; } - /// /// The field that has an invalid value. /// @@ -71,6 +64,13 @@ protected InvalidField() { } [DataMember(Name = "value", IsRequired = false, EmitDefaultValue = false)] public string Value { get; set; } + /// + /// Description of the validation error. + /// + /// Description of the validation error. + [DataMember(Name = "message", IsRequired = false, EmitDefaultValue = false)] + public string Message { get; set; } + /// /// Returns the string presentation of the object /// @@ -79,9 +79,9 @@ public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("class InvalidField {\n"); - sb.Append(" Message: ").Append(Message).Append("\n"); sb.Append(" Name: ").Append(Name).Append("\n"); sb.Append(" Value: ").Append(Value).Append("\n"); + sb.Append(" Message: ").Append(Message).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -117,11 +117,6 @@ public bool Equals(InvalidField input) return false; } return - ( - this.Message == input.Message || - (this.Message != null && - this.Message.Equals(input.Message)) - ) && ( this.Name == input.Name || (this.Name != null && @@ -131,6 +126,11 @@ public bool Equals(InvalidField input) this.Value == input.Value || (this.Value != null && this.Value.Equals(input.Value)) + ) && + ( + this.Message == input.Message || + (this.Message != null && + this.Message.Equals(input.Message)) ); } @@ -143,10 +143,6 @@ public override int GetHashCode() unchecked // Overflow is fine, just wrap { int hashCode = 41; - if (this.Message != null) - { - hashCode = (hashCode * 59) + this.Message.GetHashCode(); - } if (this.Name != null) { hashCode = (hashCode * 59) + this.Name.GetHashCode(); @@ -155,6 +151,10 @@ public override int GetHashCode() { hashCode = (hashCode * 59) + this.Value.GetHashCode(); } + if (this.Message != null) + { + hashCode = (hashCode * 59) + this.Message.GetHashCode(); + } return hashCode; } } diff --git a/Adyen/Model/BalancePlatform/PaymentInstrument.cs b/Adyen/Model/BalancePlatform/PaymentInstrument.cs index 20936aa90..c9b1f4816 100644 --- a/Adyen/Model/BalancePlatform/PaymentInstrument.cs +++ b/Adyen/Model/BalancePlatform/PaymentInstrument.cs @@ -187,11 +187,13 @@ protected PaymentInstrument() { } /// 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). /// 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.. /// Your reference for the payment instrument, maximum 150 characters.. + /// The unique identifier of the payment instrument that replaced this payment instrument.. + /// The unique identifier of the payment instrument that is replaced by this payment instrument.. /// 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 **inactive**. Possible values: * **active**: The payment instrument is active and can be used to make payments. * **inactive**: The payment instrument is inactive and cannot be used to make payments. * **suspended**: The payment instrument is suspended, either because it was stolen or lost. * **closed**: The payment instrument is permanently closed. This action cannot be undone. . /// The status comment provides additional information for the statusReason of the payment instrument.. /// The reason for the status of the payment instrument. Possible values: **accountClosure**, **damaged**, **endOfLife**, **expired**, **lost**, **stolen**, **suspectedFraud**, **transactionRule**, **other**. If the reason is **other**, you must also send the `statusComment` parameter describing the status change.. /// The type of payment instrument. Possible values: **card**, **bankAccount**. (required). - public PaymentInstrument(List additionalBankAccountIdentifications = default(List), string balanceAccountId = default(string), BankAccountDetails bankAccount = default(BankAccountDetails), 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?), string statusComment = default(string), StatusReasonEnum? statusReason = default(StatusReasonEnum?), TypeEnum type = default(TypeEnum)) + public PaymentInstrument(List additionalBankAccountIdentifications = default(List), string balanceAccountId = default(string), BankAccountDetails bankAccount = default(BankAccountDetails), Card card = default(Card), string description = default(string), string id = default(string), string issuingCountryCode = default(string), string paymentInstrumentGroupId = default(string), string reference = default(string), string replacedById = default(string), string replacementOfId = default(string), StatusEnum? status = default(StatusEnum?), string statusComment = default(string), StatusReasonEnum? statusReason = default(StatusReasonEnum?), TypeEnum type = default(TypeEnum)) { this.BalanceAccountId = balanceAccountId; this.Id = id; @@ -203,6 +205,8 @@ protected PaymentInstrument() { } this.Description = description; this.PaymentInstrumentGroupId = paymentInstrumentGroupId; this.Reference = reference; + this.ReplacedById = replacedById; + this.ReplacementOfId = replacementOfId; this.Status = status; this.StatusComment = statusComment; this.StatusReason = statusReason; @@ -270,6 +274,20 @@ protected PaymentInstrument() { } [DataMember(Name = "reference", EmitDefaultValue = false)] public string Reference { get; set; } + /// + /// The unique identifier of the payment instrument that replaced this payment instrument. + /// + /// The unique identifier of the payment instrument that replaced this payment instrument. + [DataMember(Name = "replacedById", EmitDefaultValue = false)] + public string ReplacedById { get; set; } + + /// + /// The unique identifier of the payment instrument that is replaced by this payment instrument. + /// + /// The unique identifier of the payment instrument that is replaced by this payment instrument. + [DataMember(Name = "replacementOfId", EmitDefaultValue = false)] + public string ReplacementOfId { get; set; } + /// /// The status comment provides additional information for the statusReason of the payment instrument. /// @@ -294,6 +312,8 @@ public override string ToString() sb.Append(" IssuingCountryCode: ").Append(IssuingCountryCode).Append("\n"); sb.Append(" PaymentInstrumentGroupId: ").Append(PaymentInstrumentGroupId).Append("\n"); sb.Append(" Reference: ").Append(Reference).Append("\n"); + sb.Append(" ReplacedById: ").Append(ReplacedById).Append("\n"); + sb.Append(" ReplacementOfId: ").Append(ReplacementOfId).Append("\n"); sb.Append(" Status: ").Append(Status).Append("\n"); sb.Append(" StatusComment: ").Append(StatusComment).Append("\n"); sb.Append(" StatusReason: ").Append(StatusReason).Append("\n"); @@ -379,6 +399,16 @@ public bool Equals(PaymentInstrument input) (this.Reference != null && this.Reference.Equals(input.Reference)) ) && + ( + this.ReplacedById == input.ReplacedById || + (this.ReplacedById != null && + this.ReplacedById.Equals(input.ReplacedById)) + ) && + ( + this.ReplacementOfId == input.ReplacementOfId || + (this.ReplacementOfId != null && + this.ReplacementOfId.Equals(input.ReplacementOfId)) + ) && ( this.Status == input.Status || this.Status.Equals(input.Status) @@ -443,6 +473,14 @@ public override int GetHashCode() { hashCode = (hashCode * 59) + this.Reference.GetHashCode(); } + if (this.ReplacedById != null) + { + hashCode = (hashCode * 59) + this.ReplacedById.GetHashCode(); + } + if (this.ReplacementOfId != null) + { + hashCode = (hashCode * 59) + this.ReplacementOfId.GetHashCode(); + } hashCode = (hashCode * 59) + this.Status.GetHashCode(); if (this.StatusComment != null) { diff --git a/Adyen/Model/BalancePlatform/SettingType.cs b/Adyen/Model/BalancePlatform/SettingType.cs new file mode 100644 index 000000000..2fe7b6da9 --- /dev/null +++ b/Adyen/Model/BalancePlatform/SettingType.cs @@ -0,0 +1,43 @@ +/* +* 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 System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Adyen.ApiSerialization.OpenAPIDateConverter; + +namespace Adyen.Model.BalancePlatform +{ + /// + /// Defines SettingType + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum SettingType + { + /// + /// Enum Balance for value: balance + /// + [EnumMember(Value = "balance")] + Balance = 1 + + } + +} diff --git a/Adyen/Model/BalancePlatform/SweepConfigurationV2.cs b/Adyen/Model/BalancePlatform/SweepConfigurationV2.cs index a06b3f8b6..0cb84ba91 100644 --- a/Adyen/Model/BalancePlatform/SweepConfigurationV2.cs +++ b/Adyen/Model/BalancePlatform/SweepConfigurationV2.cs @@ -113,9 +113,9 @@ public enum PrioritiesEnum /// - /// The list of priorities for the bank transfer. This sets the speed at which the transfer is sent and the fees that you have to pay. You can provide multiple priorities. Adyen will try to pay out using the priority you list first. If that's not possible, it moves on to the next option in the order of your provided priorities. Possible values: * **regular**: for normal, low-value transactions. * **fast**: a faster way to transfer funds, but the fees are higher. Recommended for high-priority, low-value transactions. * **wire**: the fastest way to transfer funds, but this has the highest fees. Recommended for high-priority, high-value transactions. * **instant**: for instant funds transfers in [SEPA countries](https://www.ecb.europa.eu/paym/integration/retail/sepa/html/index.en.html). * **crossBorder**: for high-value transfers to a recipient in a different country. * **internal**: for transfers to an Adyen-issued business bank account (by bank account number/IBAN). Set `category` to **bank**. For more details, see optional priorities setup for [marketplaces](https://docs.adyen.com/marketplaces/payout-to-users/scheduled-payouts#optional-priorities-setup) or [platforms](https://docs.adyen.com/platforms/payout-to-users/scheduled-payouts#optional-priorities-setup). + /// The list of priorities for the bank transfer. This sets the speed at which the transfer is sent and the fees that you have to pay. You can provide multiple priorities, ordered by your preference. Adyen will try to pay out using the priorities in the given order. If the first priority is not currently supported or enabled for your platform, the system will try the next one, and so on. The request will be accepted as long as **at least one** of the provided priorities is valid (i.e., supported by Adyen and activated for your platform). For example, if you provide `[\"wire\",\"regular\"]`, and `wire` is not supported but `regular` is, the request will still be accepted and processed. Possible values: * **regular**: for normal, low-value transactions. * **fast**: a faster way to transfer funds, but the fees are higher. Recommended for high-priority, low-value transactions. * **wire**: the fastest way to transfer funds, but this has the highest fees. Recommended for high-priority, high-value transactions. * **instant**: for instant funds transfers in [SEPA countries](https://www.ecb.europa.eu/paym/integration/retail/sepa/html/index.en.html). * **crossBorder**: for high-value transfers to a recipient in a different country. * **internal**: for transfers to an Adyen-issued business bank account (by bank account number/IBAN). Set `category` to **bank**. For more details, see optional priorities setup for [marketplaces](https://docs.adyen.com/marketplaces/payout-to-users/scheduled-payouts#optional-priorities-setup) or [platforms](https://docs.adyen.com/platforms/payout-to-users/scheduled-payouts#optional-priorities-setup). /// - /// The list of priorities for the bank transfer. This sets the speed at which the transfer is sent and the fees that you have to pay. You can provide multiple priorities. Adyen will try to pay out using the priority you list first. If that's not possible, it moves on to the next option in the order of your provided priorities. Possible values: * **regular**: for normal, low-value transactions. * **fast**: a faster way to transfer funds, but the fees are higher. Recommended for high-priority, low-value transactions. * **wire**: the fastest way to transfer funds, but this has the highest fees. Recommended for high-priority, high-value transactions. * **instant**: for instant funds transfers in [SEPA countries](https://www.ecb.europa.eu/paym/integration/retail/sepa/html/index.en.html). * **crossBorder**: for high-value transfers to a recipient in a different country. * **internal**: for transfers to an Adyen-issued business bank account (by bank account number/IBAN). Set `category` to **bank**. For more details, see optional priorities setup for [marketplaces](https://docs.adyen.com/marketplaces/payout-to-users/scheduled-payouts#optional-priorities-setup) or [platforms](https://docs.adyen.com/platforms/payout-to-users/scheduled-payouts#optional-priorities-setup). + /// The list of priorities for the bank transfer. This sets the speed at which the transfer is sent and the fees that you have to pay. You can provide multiple priorities, ordered by your preference. Adyen will try to pay out using the priorities in the given order. If the first priority is not currently supported or enabled for your platform, the system will try the next one, and so on. The request will be accepted as long as **at least one** of the provided priorities is valid (i.e., supported by Adyen and activated for your platform). For example, if you provide `[\"wire\",\"regular\"]`, and `wire` is not supported but `regular` is, the request will still be accepted and processed. Possible values: * **regular**: for normal, low-value transactions. * **fast**: a faster way to transfer funds, but the fees are higher. Recommended for high-priority, low-value transactions. * **wire**: the fastest way to transfer funds, but this has the highest fees. Recommended for high-priority, high-value transactions. * **instant**: for instant funds transfers in [SEPA countries](https://www.ecb.europa.eu/paym/integration/retail/sepa/html/index.en.html). * **crossBorder**: for high-value transfers to a recipient in a different country. * **internal**: for transfers to an Adyen-issued business bank account (by bank account number/IBAN). Set `category` to **bank**. For more details, see optional priorities setup for [marketplaces](https://docs.adyen.com/marketplaces/payout-to-users/scheduled-payouts#optional-priorities-setup) or [platforms](https://docs.adyen.com/platforms/payout-to-users/scheduled-payouts#optional-priorities-setup). [DataMember(Name = "priorities", EmitDefaultValue = false)] public List Priorities { get; set; } /// @@ -215,53 +215,59 @@ public enum ReasonEnum [EnumMember(Value = "notEnoughBalance")] NotEnoughBalance = 15, + /// + /// Enum Pending for value: pending + /// + [EnumMember(Value = "pending")] + Pending = 16, + /// /// Enum PendingApproval for value: pendingApproval /// [EnumMember(Value = "pendingApproval")] - PendingApproval = 16, + PendingApproval = 17, /// /// Enum PendingExecution for value: pendingExecution /// [EnumMember(Value = "pendingExecution")] - PendingExecution = 17, + PendingExecution = 18, /// /// Enum RefusedByCounterpartyBank for value: refusedByCounterpartyBank /// [EnumMember(Value = "refusedByCounterpartyBank")] - RefusedByCounterpartyBank = 18, + RefusedByCounterpartyBank = 19, /// /// Enum RefusedByCustomer for value: refusedByCustomer /// [EnumMember(Value = "refusedByCustomer")] - RefusedByCustomer = 19, + RefusedByCustomer = 20, /// /// Enum RouteNotFound for value: routeNotFound /// [EnumMember(Value = "routeNotFound")] - RouteNotFound = 20, + RouteNotFound = 21, /// /// Enum ScaFailed for value: scaFailed /// [EnumMember(Value = "scaFailed")] - ScaFailed = 21, + ScaFailed = 22, /// /// Enum TransferInstrumentDoesNotExist for value: transferInstrumentDoesNotExist /// [EnumMember(Value = "transferInstrumentDoesNotExist")] - TransferInstrumentDoesNotExist = 22, + TransferInstrumentDoesNotExist = 23, /// /// Enum Unknown for value: unknown /// [EnumMember(Value = "unknown")] - Unknown = 23 + Unknown = 24 } @@ -349,7 +355,7 @@ protected SweepConfigurationV2() { } /// counterparty (required). /// The three-character [ISO currency code](https://docs.adyen.com/development-resources/currency-codes) in uppercase. For example, **EUR**. The sweep currency must match any of the [balances currencies](https://docs.adyen.com/api-explorer/#/balanceplatform/latest/get/balanceAccounts/{id}__resParam_balances). (required). /// The message that will be used in the sweep transfer's description body with a maximum length of 140 characters. If the message is longer after replacing placeholders, the message will be cut off at 140 characters.. - /// The list of priorities for the bank transfer. This sets the speed at which the transfer is sent and the fees that you have to pay. You can provide multiple priorities. Adyen will try to pay out using the priority you list first. If that's not possible, it moves on to the next option in the order of your provided priorities. Possible values: * **regular**: for normal, low-value transactions. * **fast**: a faster way to transfer funds, but the fees are higher. Recommended for high-priority, low-value transactions. * **wire**: the fastest way to transfer funds, but this has the highest fees. Recommended for high-priority, high-value transactions. * **instant**: for instant funds transfers in [SEPA countries](https://www.ecb.europa.eu/paym/integration/retail/sepa/html/index.en.html). * **crossBorder**: for high-value transfers to a recipient in a different country. * **internal**: for transfers to an Adyen-issued business bank account (by bank account number/IBAN). Set `category` to **bank**. For more details, see optional priorities setup for [marketplaces](https://docs.adyen.com/marketplaces/payout-to-users/scheduled-payouts#optional-priorities-setup) or [platforms](https://docs.adyen.com/platforms/payout-to-users/scheduled-payouts#optional-priorities-setup).. + /// The list of priorities for the bank transfer. This sets the speed at which the transfer is sent and the fees that you have to pay. You can provide multiple priorities, ordered by your preference. Adyen will try to pay out using the priorities in the given order. If the first priority is not currently supported or enabled for your platform, the system will try the next one, and so on. The request will be accepted as long as **at least one** of the provided priorities is valid (i.e., supported by Adyen and activated for your platform). For example, if you provide `[\"wire\",\"regular\"]`, and `wire` is not supported but `regular` is, the request will still be accepted and processed. Possible values: * **regular**: for normal, low-value transactions. * **fast**: a faster way to transfer funds, but the fees are higher. Recommended for high-priority, low-value transactions. * **wire**: the fastest way to transfer funds, but this has the highest fees. Recommended for high-priority, high-value transactions. * **instant**: for instant funds transfers in [SEPA countries](https://www.ecb.europa.eu/paym/integration/retail/sepa/html/index.en.html). * **crossBorder**: for high-value transfers to a recipient in a different country. * **internal**: for transfers to an Adyen-issued business bank account (by bank account number/IBAN). Set `category` to **bank**. For more details, see optional priorities setup for [marketplaces](https://docs.adyen.com/marketplaces/payout-to-users/scheduled-payouts#optional-priorities-setup) or [platforms](https://docs.adyen.com/platforms/payout-to-users/scheduled-payouts#optional-priorities-setup).. /// Your reference for the sweep configuration.. /// The reference sent to or received from the counterparty. Only alphanumeric characters are allowed.. /// schedule (required). diff --git a/Adyen/Model/BalancePlatform/Target.cs b/Adyen/Model/BalancePlatform/Target.cs new file mode 100644 index 000000000..d3a10110e --- /dev/null +++ b/Adyen/Model/BalancePlatform/Target.cs @@ -0,0 +1,176 @@ +/* +* 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 System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Adyen.ApiSerialization.OpenAPIDateConverter; + +namespace Adyen.Model.BalancePlatform +{ + /// + /// Target + /// + [DataContract(Name = "Target")] + public partial class Target : IEquatable, IValidatableObject + { + /// + /// The resource for which you want to receive notifications. Possible values: * **balancePlatform**: receive notifications about balance changes in your entire balance platform. * **accountHolder**: receive notifications about balance changes of a specific user. * **balanceAccount**: receive notifications about balance changes in a specific balance account. + /// + /// The resource for which you want to receive notifications. Possible values: * **balancePlatform**: receive notifications about balance changes in your entire balance platform. * **accountHolder**: receive notifications about balance changes of a specific user. * **balanceAccount**: receive notifications about balance changes in a specific balance account. + [JsonConverter(typeof(StringEnumConverter))] + public enum TypeEnum + { + /// + /// Enum BalanceAccount for value: balanceAccount + /// + [EnumMember(Value = "balanceAccount")] + BalanceAccount = 1, + + /// + /// Enum AccountHolder for value: accountHolder + /// + [EnumMember(Value = "accountHolder")] + AccountHolder = 2, + + /// + /// Enum BalancePlatform for value: balancePlatform + /// + [EnumMember(Value = "balancePlatform")] + BalancePlatform = 3 + + } + + + /// + /// The resource for which you want to receive notifications. Possible values: * **balancePlatform**: receive notifications about balance changes in your entire balance platform. * **accountHolder**: receive notifications about balance changes of a specific user. * **balanceAccount**: receive notifications about balance changes in a specific balance account. + /// + /// The resource for which you want to receive notifications. Possible values: * **balancePlatform**: receive notifications about balance changes in your entire balance platform. * **accountHolder**: receive notifications about balance changes of a specific user. * **balanceAccount**: receive notifications about balance changes in a specific balance account. + [DataMember(Name = "type", IsRequired = false, EmitDefaultValue = false)] + public TypeEnum Type { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected Target() { } + /// + /// Initializes a new instance of the class. + /// + /// The unique identifier of the `target.type`. This can be the ID of your: * balance platform * account holder * account holder's balance account (required). + /// The resource for which you want to receive notifications. Possible values: * **balancePlatform**: receive notifications about balance changes in your entire balance platform. * **accountHolder**: receive notifications about balance changes of a specific user. * **balanceAccount**: receive notifications about balance changes in a specific balance account. (required). + public Target(string id = default(string), TypeEnum type = default(TypeEnum)) + { + this.Id = id; + this.Type = type; + } + + /// + /// The unique identifier of the `target.type`. This can be the ID of your: * balance platform * account holder * account holder's balance account + /// + /// The unique identifier of the `target.type`. This can be the ID of your: * balance platform * account holder * account holder's balance account + [DataMember(Name = "id", IsRequired = false, EmitDefaultValue = false)] + public string Id { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Target {\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as Target); + } + + /// + /// Returns true if Target instances are equal + /// + /// Instance of Target to be compared + /// Boolean + public bool Equals(Target input) + { + if (input == null) + { + return false; + } + return + ( + this.Id == input.Id || + (this.Id != null && + this.Id.Equals(input.Id)) + ) && + ( + this.Type == input.Type || + this.Type.Equals(input.Type) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Id != null) + { + hashCode = (hashCode * 59) + this.Id.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Type.GetHashCode(); + return hashCode; + } + } + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + public IEnumerable Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/Adyen/Model/BalancePlatform/TargetUpdate.cs b/Adyen/Model/BalancePlatform/TargetUpdate.cs new file mode 100644 index 000000000..4506bd459 --- /dev/null +++ b/Adyen/Model/BalancePlatform/TargetUpdate.cs @@ -0,0 +1,171 @@ +/* +* 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 System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Adyen.ApiSerialization.OpenAPIDateConverter; + +namespace Adyen.Model.BalancePlatform +{ + /// + /// TargetUpdate + /// + [DataContract(Name = "TargetUpdate")] + public partial class TargetUpdate : IEquatable, IValidatableObject + { + /// + /// The resource for which you want to receive notifications. Possible values: * **balancePlatform**: receive notifications about balance changes in your entire balance platform. * **accountHolder**: receive notifications about balance changes of a specific user. * **balanceAccount**: receive notifications about balance changes in a specific balance account. + /// + /// The resource for which you want to receive notifications. Possible values: * **balancePlatform**: receive notifications about balance changes in your entire balance platform. * **accountHolder**: receive notifications about balance changes of a specific user. * **balanceAccount**: receive notifications about balance changes in a specific balance account. + [JsonConverter(typeof(StringEnumConverter))] + public enum TypeEnum + { + /// + /// Enum BalanceAccount for value: balanceAccount + /// + [EnumMember(Value = "balanceAccount")] + BalanceAccount = 1, + + /// + /// Enum AccountHolder for value: accountHolder + /// + [EnumMember(Value = "accountHolder")] + AccountHolder = 2, + + /// + /// Enum BalancePlatform for value: balancePlatform + /// + [EnumMember(Value = "balancePlatform")] + BalancePlatform = 3 + + } + + + /// + /// The resource for which you want to receive notifications. Possible values: * **balancePlatform**: receive notifications about balance changes in your entire balance platform. * **accountHolder**: receive notifications about balance changes of a specific user. * **balanceAccount**: receive notifications about balance changes in a specific balance account. + /// + /// The resource for which you want to receive notifications. Possible values: * **balancePlatform**: receive notifications about balance changes in your entire balance platform. * **accountHolder**: receive notifications about balance changes of a specific user. * **balanceAccount**: receive notifications about balance changes in a specific balance account. + [DataMember(Name = "type", EmitDefaultValue = false)] + public TypeEnum? Type { get; set; } + /// + /// Initializes a new instance of the class. + /// + /// The unique identifier of the `target.type`. This can be the ID of your: * balance platform * account holder * account holder's balance account. + /// The resource for which you want to receive notifications. Possible values: * **balancePlatform**: receive notifications about balance changes in your entire balance platform. * **accountHolder**: receive notifications about balance changes of a specific user. * **balanceAccount**: receive notifications about balance changes in a specific balance account.. + public TargetUpdate(string id = default(string), TypeEnum? type = default(TypeEnum?)) + { + this.Id = id; + this.Type = type; + } + + /// + /// The unique identifier of the `target.type`. This can be the ID of your: * balance platform * account holder * account holder's balance account + /// + /// The unique identifier of the `target.type`. This can be the ID of your: * balance platform * account holder * account holder's balance account + [DataMember(Name = "id", EmitDefaultValue = false)] + public string Id { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class TargetUpdate {\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as TargetUpdate); + } + + /// + /// Returns true if TargetUpdate instances are equal + /// + /// Instance of TargetUpdate to be compared + /// Boolean + public bool Equals(TargetUpdate input) + { + if (input == null) + { + return false; + } + return + ( + this.Id == input.Id || + (this.Id != null && + this.Id.Equals(input.Id)) + ) && + ( + this.Type == input.Type || + this.Type.Equals(input.Type) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Id != null) + { + hashCode = (hashCode * 59) + this.Id.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Type.GetHashCode(); + return hashCode; + } + } + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + public IEnumerable Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/Adyen/Model/BalancePlatform/TransactionRuleRestrictions.cs b/Adyen/Model/BalancePlatform/TransactionRuleRestrictions.cs index 7edae221f..e30d4c30b 100644 --- a/Adyen/Model/BalancePlatform/TransactionRuleRestrictions.cs +++ b/Adyen/Model/BalancePlatform/TransactionRuleRestrictions.cs @@ -57,7 +57,9 @@ public partial class TransactionRuleRestrictions : IEquatabletimeOfDay. /// tokenRequestors. /// totalAmount. - public TransactionRuleRestrictions(ActiveNetworkTokensRestriction activeNetworkTokens = default(ActiveNetworkTokensRestriction), BrandVariantsRestriction brandVariants = default(BrandVariantsRestriction), CounterpartyBankRestriction counterpartyBank = default(CounterpartyBankRestriction), CounterpartyTypesRestriction counterpartyTypes = default(CounterpartyTypesRestriction), CountriesRestriction countries = default(CountriesRestriction), DayOfWeekRestriction dayOfWeek = default(DayOfWeekRestriction), DifferentCurrenciesRestriction differentCurrencies = default(DifferentCurrenciesRestriction), EntryModesRestriction entryModes = default(EntryModesRestriction), InternationalTransactionRestriction internationalTransaction = default(InternationalTransactionRestriction), MatchingTransactionsRestriction matchingTransactions = default(MatchingTransactionsRestriction), MatchingValuesRestriction matchingValues = default(MatchingValuesRestriction), MccsRestriction mccs = default(MccsRestriction), MerchantNamesRestriction merchantNames = default(MerchantNamesRestriction), MerchantsRestriction merchants = default(MerchantsRestriction), ProcessingTypesRestriction processingTypes = default(ProcessingTypesRestriction), RiskScoresRestriction riskScores = default(RiskScoresRestriction), SameAmountRestriction sameAmountRestriction = default(SameAmountRestriction), SameCounterpartyRestriction sameCounterpartyRestriction = default(SameCounterpartyRestriction), SourceAccountTypesRestriction sourceAccountTypes = default(SourceAccountTypesRestriction), TimeOfDayRestriction timeOfDay = default(TimeOfDayRestriction), TokenRequestorsRestriction tokenRequestors = default(TokenRequestorsRestriction), TotalAmountRestriction totalAmount = default(TotalAmountRestriction)) + /// walletProviderAccountScore. + /// walletProviderDeviceScore. + public TransactionRuleRestrictions(ActiveNetworkTokensRestriction activeNetworkTokens = default(ActiveNetworkTokensRestriction), BrandVariantsRestriction brandVariants = default(BrandVariantsRestriction), CounterpartyBankRestriction counterpartyBank = default(CounterpartyBankRestriction), CounterpartyTypesRestriction counterpartyTypes = default(CounterpartyTypesRestriction), CountriesRestriction countries = default(CountriesRestriction), DayOfWeekRestriction dayOfWeek = default(DayOfWeekRestriction), DifferentCurrenciesRestriction differentCurrencies = default(DifferentCurrenciesRestriction), EntryModesRestriction entryModes = default(EntryModesRestriction), InternationalTransactionRestriction internationalTransaction = default(InternationalTransactionRestriction), MatchingTransactionsRestriction matchingTransactions = default(MatchingTransactionsRestriction), MatchingValuesRestriction matchingValues = default(MatchingValuesRestriction), MccsRestriction mccs = default(MccsRestriction), MerchantNamesRestriction merchantNames = default(MerchantNamesRestriction), MerchantsRestriction merchants = default(MerchantsRestriction), ProcessingTypesRestriction processingTypes = default(ProcessingTypesRestriction), RiskScoresRestriction riskScores = default(RiskScoresRestriction), SameAmountRestriction sameAmountRestriction = default(SameAmountRestriction), SameCounterpartyRestriction sameCounterpartyRestriction = default(SameCounterpartyRestriction), SourceAccountTypesRestriction sourceAccountTypes = default(SourceAccountTypesRestriction), TimeOfDayRestriction timeOfDay = default(TimeOfDayRestriction), TokenRequestorsRestriction tokenRequestors = default(TokenRequestorsRestriction), TotalAmountRestriction totalAmount = default(TotalAmountRestriction), WalletProviderAccountScoreRestriction walletProviderAccountScore = default(WalletProviderAccountScoreRestriction), WalletProviderDeviceScore walletProviderDeviceScore = default(WalletProviderDeviceScore)) { this.ActiveNetworkTokens = activeNetworkTokens; this.BrandVariants = brandVariants; @@ -81,6 +83,8 @@ public partial class TransactionRuleRestrictions : IEquatable @@ -215,6 +219,18 @@ public partial class TransactionRuleRestrictions : IEquatable + /// Gets or Sets WalletProviderAccountScore + /// + [DataMember(Name = "walletProviderAccountScore", EmitDefaultValue = false)] + public WalletProviderAccountScoreRestriction WalletProviderAccountScore { get; set; } + + /// + /// Gets or Sets WalletProviderDeviceScore + /// + [DataMember(Name = "walletProviderDeviceScore", EmitDefaultValue = false)] + public WalletProviderDeviceScore WalletProviderDeviceScore { get; set; } + /// /// Returns the string presentation of the object /// @@ -245,6 +261,8 @@ public override string ToString() sb.Append(" TimeOfDay: ").Append(TimeOfDay).Append("\n"); sb.Append(" TokenRequestors: ").Append(TokenRequestors).Append("\n"); sb.Append(" TotalAmount: ").Append(TotalAmount).Append("\n"); + sb.Append(" WalletProviderAccountScore: ").Append(WalletProviderAccountScore).Append("\n"); + sb.Append(" WalletProviderDeviceScore: ").Append(WalletProviderDeviceScore).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -389,6 +407,16 @@ public bool Equals(TransactionRuleRestrictions input) this.TotalAmount == input.TotalAmount || (this.TotalAmount != null && this.TotalAmount.Equals(input.TotalAmount)) + ) && + ( + this.WalletProviderAccountScore == input.WalletProviderAccountScore || + (this.WalletProviderAccountScore != null && + this.WalletProviderAccountScore.Equals(input.WalletProviderAccountScore)) + ) && + ( + this.WalletProviderDeviceScore == input.WalletProviderDeviceScore || + (this.WalletProviderDeviceScore != null && + this.WalletProviderDeviceScore.Equals(input.WalletProviderDeviceScore)) ); } @@ -489,6 +517,14 @@ public override int GetHashCode() { hashCode = (hashCode * 59) + this.TotalAmount.GetHashCode(); } + if (this.WalletProviderAccountScore != null) + { + hashCode = (hashCode * 59) + this.WalletProviderAccountScore.GetHashCode(); + } + if (this.WalletProviderDeviceScore != null) + { + hashCode = (hashCode * 59) + this.WalletProviderDeviceScore.GetHashCode(); + } return hashCode; } } diff --git a/Adyen/Model/BalancePlatform/TransferRouteRequirementsInner.cs b/Adyen/Model/BalancePlatform/TransferRouteRequirementsInner.cs index 513da3fdf..4e8770dcc 100644 --- a/Adyen/Model/BalancePlatform/TransferRouteRequirementsInner.cs +++ b/Adyen/Model/BalancePlatform/TransferRouteRequirementsInner.cs @@ -106,6 +106,18 @@ public TransferRouteRequirementsInner(PaymentInstrumentRequirement actualInstanc this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); } + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of USInstantPayoutAddressRequirement. + public TransferRouteRequirementsInner(USInstantPayoutAddressRequirement actualInstance) + { + this.IsNullable = false; + this.SchemaType= "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + /// /// Initializes a new instance of the class /// with the class @@ -156,13 +168,17 @@ public override Object ActualInstance { this._actualInstance = value; } + else if (value.GetType() == typeof(USInstantPayoutAddressRequirement)) + { + this._actualInstance = value; + } else if (value.GetType() == typeof(USInternationalAchAddressRequirement)) { this._actualInstance = value; } else { - throw new ArgumentException("Invalid instance found. Must be the following types: AddressRequirement, AmountMinMaxRequirement, AmountNonZeroDecimalsRequirement, BankAccountIdentificationTypeRequirement, IbanAccountIdentificationRequirement, PaymentInstrumentRequirement, USInternationalAchAddressRequirement"); + throw new ArgumentException("Invalid instance found. Must be the following types: AddressRequirement, AmountMinMaxRequirement, AmountNonZeroDecimalsRequirement, BankAccountIdentificationTypeRequirement, IbanAccountIdentificationRequirement, PaymentInstrumentRequirement, USInstantPayoutAddressRequirement, USInternationalAchAddressRequirement"); } } } @@ -227,6 +243,16 @@ public PaymentInstrumentRequirement GetPaymentInstrumentRequirement() return (PaymentInstrumentRequirement)this.ActualInstance; } + /// + /// Get the actual instance of `USInstantPayoutAddressRequirement`. If the actual instance is not `USInstantPayoutAddressRequirement`, + /// the InvalidClassException will be thrown + /// + /// An instance of USInstantPayoutAddressRequirement + public USInstantPayoutAddressRequirement GetUSInstantPayoutAddressRequirement() + { + return (USInstantPayoutAddressRequirement)this.ActualInstance; + } + /// /// Get the actual instance of `USInternationalAchAddressRequirement`. If the actual instance is not `USInternationalAchAddressRequirement`, /// the InvalidClassException will be thrown @@ -325,6 +351,13 @@ public static TransferRouteRequirementsInner FromJson(string jsonString) matchedTypes.Add("PaymentInstrumentRequirement"); match++; } + // Check if the jsonString type enum matches the USInstantPayoutAddressRequirement type enums + if (ContainsValue(type)) + { + newTransferRouteRequirementsInner = new TransferRouteRequirementsInner(JsonConvert.DeserializeObject(jsonString, TransferRouteRequirementsInner.SerializerSettings)); + matchedTypes.Add("USInstantPayoutAddressRequirement"); + match++; + } // Check if the jsonString type enum matches the USInternationalAchAddressRequirement type enums if (ContainsValue(type)) { diff --git a/Adyen/Model/BalancePlatform/USInstantPayoutAddressRequirement.cs b/Adyen/Model/BalancePlatform/USInstantPayoutAddressRequirement.cs new file mode 100644 index 000000000..502625fe3 --- /dev/null +++ b/Adyen/Model/BalancePlatform/USInstantPayoutAddressRequirement.cs @@ -0,0 +1,164 @@ +/* +* 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 System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Adyen.ApiSerialization.OpenAPIDateConverter; + +namespace Adyen.Model.BalancePlatform +{ + /// + /// USInstantPayoutAddressRequirement + /// + [DataContract(Name = "USInstantPayoutAddressRequirement")] + public partial class USInstantPayoutAddressRequirement : IEquatable, IValidatableObject + { + /// + /// **usInstantPayoutAddressRequirement** + /// + /// **usInstantPayoutAddressRequirement** + [JsonConverter(typeof(StringEnumConverter))] + public enum TypeEnum + { + /// + /// Enum UsInstantPayoutAddressRequirement for value: usInstantPayoutAddressRequirement + /// + [EnumMember(Value = "usInstantPayoutAddressRequirement")] + UsInstantPayoutAddressRequirement = 1 + + } + + + /// + /// **usInstantPayoutAddressRequirement** + /// + /// **usInstantPayoutAddressRequirement** + [DataMember(Name = "type", IsRequired = false, EmitDefaultValue = false)] + public TypeEnum Type { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected USInstantPayoutAddressRequirement() { } + /// + /// Initializes a new instance of the class. + /// + /// Specifies that you must provide complete street addresses for the party and counterParty for transactions greater than USD 3000.. + /// **usInstantPayoutAddressRequirement** (required) (default to TypeEnum.UsInstantPayoutAddressRequirement). + public USInstantPayoutAddressRequirement(string description = default(string), TypeEnum type = TypeEnum.UsInstantPayoutAddressRequirement) + { + this.Type = type; + this.Description = description; + } + + /// + /// Specifies that you must provide complete street addresses for the party and counterParty for transactions greater than USD 3000. + /// + /// Specifies that you must provide complete street addresses for the party and counterParty for transactions greater than USD 3000. + [DataMember(Name = "description", EmitDefaultValue = false)] + public string Description { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class USInstantPayoutAddressRequirement {\n"); + sb.Append(" Description: ").Append(Description).Append("\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as USInstantPayoutAddressRequirement); + } + + /// + /// Returns true if USInstantPayoutAddressRequirement instances are equal + /// + /// Instance of USInstantPayoutAddressRequirement to be compared + /// Boolean + public bool Equals(USInstantPayoutAddressRequirement input) + { + if (input == null) + { + return false; + } + return + ( + this.Description == input.Description || + (this.Description != null && + this.Description.Equals(input.Description)) + ) && + ( + this.Type == input.Type || + this.Type.Equals(input.Type) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Description != null) + { + hashCode = (hashCode * 59) + this.Description.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Type.GetHashCode(); + return hashCode; + } + } + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + public IEnumerable Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/Adyen/Model/BalancePlatform/UpdatePaymentInstrument.cs b/Adyen/Model/BalancePlatform/UpdatePaymentInstrument.cs index c5a51ca40..34ca75f42 100644 --- a/Adyen/Model/BalancePlatform/UpdatePaymentInstrument.cs +++ b/Adyen/Model/BalancePlatform/UpdatePaymentInstrument.cs @@ -187,11 +187,13 @@ protected UpdatePaymentInstrument() { } /// 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). /// 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.. /// Your reference for the payment instrument, maximum 150 characters.. + /// The unique identifier of the payment instrument that replaced this payment instrument.. + /// The unique identifier of the payment instrument that is replaced by this payment instrument.. /// 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 **inactive**. Possible values: * **active**: The payment instrument is active and can be used to make payments. * **inactive**: The payment instrument is inactive and cannot be used to make payments. * **suspended**: The payment instrument is suspended, either because it was stolen or lost. * **closed**: The payment instrument is permanently closed. This action cannot be undone. . /// Comment for the status of the payment instrument. Required if `statusReason` is **other**.. /// The reason for the status of the payment instrument. Possible values: **accountClosure**, **damaged**, **endOfLife**, **expired**, **lost**, **stolen**, **suspectedFraud**, **transactionRule**, **other**. If the reason is **other**, you must also send the `statusComment` parameter describing the status change.. /// The type of payment instrument. Possible values: **card**, **bankAccount**. (required). - public UpdatePaymentInstrument(List additionalBankAccountIdentifications = default(List), string balanceAccountId = default(string), BankAccountDetails bankAccount = default(BankAccountDetails), 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?), string statusComment = default(string), StatusReasonEnum? statusReason = default(StatusReasonEnum?), TypeEnum type = default(TypeEnum)) + public UpdatePaymentInstrument(List additionalBankAccountIdentifications = default(List), string balanceAccountId = default(string), BankAccountDetails bankAccount = default(BankAccountDetails), Card card = default(Card), string description = default(string), string id = default(string), string issuingCountryCode = default(string), string paymentInstrumentGroupId = default(string), string reference = default(string), string replacedById = default(string), string replacementOfId = default(string), StatusEnum? status = default(StatusEnum?), string statusComment = default(string), StatusReasonEnum? statusReason = default(StatusReasonEnum?), TypeEnum type = default(TypeEnum)) { this.BalanceAccountId = balanceAccountId; this.Id = id; @@ -203,6 +205,8 @@ protected UpdatePaymentInstrument() { } this.Description = description; this.PaymentInstrumentGroupId = paymentInstrumentGroupId; this.Reference = reference; + this.ReplacedById = replacedById; + this.ReplacementOfId = replacementOfId; this.Status = status; this.StatusComment = statusComment; this.StatusReason = statusReason; @@ -270,6 +274,20 @@ protected UpdatePaymentInstrument() { } [DataMember(Name = "reference", EmitDefaultValue = false)] public string Reference { get; set; } + /// + /// The unique identifier of the payment instrument that replaced this payment instrument. + /// + /// The unique identifier of the payment instrument that replaced this payment instrument. + [DataMember(Name = "replacedById", EmitDefaultValue = false)] + public string ReplacedById { get; set; } + + /// + /// The unique identifier of the payment instrument that is replaced by this payment instrument. + /// + /// The unique identifier of the payment instrument that is replaced by this payment instrument. + [DataMember(Name = "replacementOfId", EmitDefaultValue = false)] + public string ReplacementOfId { get; set; } + /// /// Comment for the status of the payment instrument. Required if `statusReason` is **other**. /// @@ -294,6 +312,8 @@ public override string ToString() sb.Append(" IssuingCountryCode: ").Append(IssuingCountryCode).Append("\n"); sb.Append(" PaymentInstrumentGroupId: ").Append(PaymentInstrumentGroupId).Append("\n"); sb.Append(" Reference: ").Append(Reference).Append("\n"); + sb.Append(" ReplacedById: ").Append(ReplacedById).Append("\n"); + sb.Append(" ReplacementOfId: ").Append(ReplacementOfId).Append("\n"); sb.Append(" Status: ").Append(Status).Append("\n"); sb.Append(" StatusComment: ").Append(StatusComment).Append("\n"); sb.Append(" StatusReason: ").Append(StatusReason).Append("\n"); @@ -379,6 +399,16 @@ public bool Equals(UpdatePaymentInstrument input) (this.Reference != null && this.Reference.Equals(input.Reference)) ) && + ( + this.ReplacedById == input.ReplacedById || + (this.ReplacedById != null && + this.ReplacedById.Equals(input.ReplacedById)) + ) && + ( + this.ReplacementOfId == input.ReplacementOfId || + (this.ReplacementOfId != null && + this.ReplacementOfId.Equals(input.ReplacementOfId)) + ) && ( this.Status == input.Status || this.Status.Equals(input.Status) @@ -443,6 +473,14 @@ public override int GetHashCode() { hashCode = (hashCode * 59) + this.Reference.GetHashCode(); } + if (this.ReplacedById != null) + { + hashCode = (hashCode * 59) + this.ReplacedById.GetHashCode(); + } + if (this.ReplacementOfId != null) + { + hashCode = (hashCode * 59) + this.ReplacementOfId.GetHashCode(); + } hashCode = (hashCode * 59) + this.Status.GetHashCode(); if (this.StatusComment != null) { diff --git a/Adyen/Model/BalancePlatform/UpdateSweepConfigurationV2.cs b/Adyen/Model/BalancePlatform/UpdateSweepConfigurationV2.cs index 204f7cc72..7b3ea3a53 100644 --- a/Adyen/Model/BalancePlatform/UpdateSweepConfigurationV2.cs +++ b/Adyen/Model/BalancePlatform/UpdateSweepConfigurationV2.cs @@ -113,9 +113,9 @@ public enum PrioritiesEnum /// - /// The list of priorities for the bank transfer. This sets the speed at which the transfer is sent and the fees that you have to pay. You can provide multiple priorities. Adyen will try to pay out using the priority you list first. If that's not possible, it moves on to the next option in the order of your provided priorities. Possible values: * **regular**: for normal, low-value transactions. * **fast**: a faster way to transfer funds, but the fees are higher. Recommended for high-priority, low-value transactions. * **wire**: the fastest way to transfer funds, but this has the highest fees. Recommended for high-priority, high-value transactions. * **instant**: for instant funds transfers in [SEPA countries](https://www.ecb.europa.eu/paym/integration/retail/sepa/html/index.en.html). * **crossBorder**: for high-value transfers to a recipient in a different country. * **internal**: for transfers to an Adyen-issued business bank account (by bank account number/IBAN). Set `category` to **bank**. For more details, see optional priorities setup for [marketplaces](https://docs.adyen.com/marketplaces/payout-to-users/scheduled-payouts#optional-priorities-setup) or [platforms](https://docs.adyen.com/platforms/payout-to-users/scheduled-payouts#optional-priorities-setup). + /// The list of priorities for the bank transfer. This sets the speed at which the transfer is sent and the fees that you have to pay. You can provide multiple priorities, ordered by your preference. Adyen will try to pay out using the priorities in the given order. If the first priority is not currently supported or enabled for your platform, the system will try the next one, and so on. The request will be accepted as long as **at least one** of the provided priorities is valid (i.e., supported by Adyen and activated for your platform). For example, if you provide `[\"wire\",\"regular\"]`, and `wire` is not supported but `regular` is, the request will still be accepted and processed. Possible values: * **regular**: for normal, low-value transactions. * **fast**: a faster way to transfer funds, but the fees are higher. Recommended for high-priority, low-value transactions. * **wire**: the fastest way to transfer funds, but this has the highest fees. Recommended for high-priority, high-value transactions. * **instant**: for instant funds transfers in [SEPA countries](https://www.ecb.europa.eu/paym/integration/retail/sepa/html/index.en.html). * **crossBorder**: for high-value transfers to a recipient in a different country. * **internal**: for transfers to an Adyen-issued business bank account (by bank account number/IBAN). Set `category` to **bank**. For more details, see optional priorities setup for [marketplaces](https://docs.adyen.com/marketplaces/payout-to-users/scheduled-payouts#optional-priorities-setup) or [platforms](https://docs.adyen.com/platforms/payout-to-users/scheduled-payouts#optional-priorities-setup). /// - /// The list of priorities for the bank transfer. This sets the speed at which the transfer is sent and the fees that you have to pay. You can provide multiple priorities. Adyen will try to pay out using the priority you list first. If that's not possible, it moves on to the next option in the order of your provided priorities. Possible values: * **regular**: for normal, low-value transactions. * **fast**: a faster way to transfer funds, but the fees are higher. Recommended for high-priority, low-value transactions. * **wire**: the fastest way to transfer funds, but this has the highest fees. Recommended for high-priority, high-value transactions. * **instant**: for instant funds transfers in [SEPA countries](https://www.ecb.europa.eu/paym/integration/retail/sepa/html/index.en.html). * **crossBorder**: for high-value transfers to a recipient in a different country. * **internal**: for transfers to an Adyen-issued business bank account (by bank account number/IBAN). Set `category` to **bank**. For more details, see optional priorities setup for [marketplaces](https://docs.adyen.com/marketplaces/payout-to-users/scheduled-payouts#optional-priorities-setup) or [platforms](https://docs.adyen.com/platforms/payout-to-users/scheduled-payouts#optional-priorities-setup). + /// The list of priorities for the bank transfer. This sets the speed at which the transfer is sent and the fees that you have to pay. You can provide multiple priorities, ordered by your preference. Adyen will try to pay out using the priorities in the given order. If the first priority is not currently supported or enabled for your platform, the system will try the next one, and so on. The request will be accepted as long as **at least one** of the provided priorities is valid (i.e., supported by Adyen and activated for your platform). For example, if you provide `[\"wire\",\"regular\"]`, and `wire` is not supported but `regular` is, the request will still be accepted and processed. Possible values: * **regular**: for normal, low-value transactions. * **fast**: a faster way to transfer funds, but the fees are higher. Recommended for high-priority, low-value transactions. * **wire**: the fastest way to transfer funds, but this has the highest fees. Recommended for high-priority, high-value transactions. * **instant**: for instant funds transfers in [SEPA countries](https://www.ecb.europa.eu/paym/integration/retail/sepa/html/index.en.html). * **crossBorder**: for high-value transfers to a recipient in a different country. * **internal**: for transfers to an Adyen-issued business bank account (by bank account number/IBAN). Set `category` to **bank**. For more details, see optional priorities setup for [marketplaces](https://docs.adyen.com/marketplaces/payout-to-users/scheduled-payouts#optional-priorities-setup) or [platforms](https://docs.adyen.com/platforms/payout-to-users/scheduled-payouts#optional-priorities-setup). [DataMember(Name = "priorities", EmitDefaultValue = false)] public List Priorities { get; set; } /// @@ -215,53 +215,59 @@ public enum ReasonEnum [EnumMember(Value = "notEnoughBalance")] NotEnoughBalance = 15, + /// + /// Enum Pending for value: pending + /// + [EnumMember(Value = "pending")] + Pending = 16, + /// /// Enum PendingApproval for value: pendingApproval /// [EnumMember(Value = "pendingApproval")] - PendingApproval = 16, + PendingApproval = 17, /// /// Enum PendingExecution for value: pendingExecution /// [EnumMember(Value = "pendingExecution")] - PendingExecution = 17, + PendingExecution = 18, /// /// Enum RefusedByCounterpartyBank for value: refusedByCounterpartyBank /// [EnumMember(Value = "refusedByCounterpartyBank")] - RefusedByCounterpartyBank = 18, + RefusedByCounterpartyBank = 19, /// /// Enum RefusedByCustomer for value: refusedByCustomer /// [EnumMember(Value = "refusedByCustomer")] - RefusedByCustomer = 19, + RefusedByCustomer = 20, /// /// Enum RouteNotFound for value: routeNotFound /// [EnumMember(Value = "routeNotFound")] - RouteNotFound = 20, + RouteNotFound = 21, /// /// Enum ScaFailed for value: scaFailed /// [EnumMember(Value = "scaFailed")] - ScaFailed = 21, + ScaFailed = 22, /// /// Enum TransferInstrumentDoesNotExist for value: transferInstrumentDoesNotExist /// [EnumMember(Value = "transferInstrumentDoesNotExist")] - TransferInstrumentDoesNotExist = 22, + TransferInstrumentDoesNotExist = 23, /// /// Enum Unknown for value: unknown /// [EnumMember(Value = "unknown")] - Unknown = 23 + Unknown = 24 } @@ -344,7 +350,7 @@ public enum TypeEnum /// counterparty. /// The three-character [ISO currency code](https://docs.adyen.com/development-resources/currency-codes) in uppercase. For example, **EUR**. The sweep currency must match any of the [balances currencies](https://docs.adyen.com/api-explorer/#/balanceplatform/latest/get/balanceAccounts/{id}__resParam_balances).. /// The message that will be used in the sweep transfer's description body with a maximum length of 140 characters. If the message is longer after replacing placeholders, the message will be cut off at 140 characters.. - /// The list of priorities for the bank transfer. This sets the speed at which the transfer is sent and the fees that you have to pay. You can provide multiple priorities. Adyen will try to pay out using the priority you list first. If that's not possible, it moves on to the next option in the order of your provided priorities. Possible values: * **regular**: for normal, low-value transactions. * **fast**: a faster way to transfer funds, but the fees are higher. Recommended for high-priority, low-value transactions. * **wire**: the fastest way to transfer funds, but this has the highest fees. Recommended for high-priority, high-value transactions. * **instant**: for instant funds transfers in [SEPA countries](https://www.ecb.europa.eu/paym/integration/retail/sepa/html/index.en.html). * **crossBorder**: for high-value transfers to a recipient in a different country. * **internal**: for transfers to an Adyen-issued business bank account (by bank account number/IBAN). Set `category` to **bank**. For more details, see optional priorities setup for [marketplaces](https://docs.adyen.com/marketplaces/payout-to-users/scheduled-payouts#optional-priorities-setup) or [platforms](https://docs.adyen.com/platforms/payout-to-users/scheduled-payouts#optional-priorities-setup).. + /// The list of priorities for the bank transfer. This sets the speed at which the transfer is sent and the fees that you have to pay. You can provide multiple priorities, ordered by your preference. Adyen will try to pay out using the priorities in the given order. If the first priority is not currently supported or enabled for your platform, the system will try the next one, and so on. The request will be accepted as long as **at least one** of the provided priorities is valid (i.e., supported by Adyen and activated for your platform). For example, if you provide `[\"wire\",\"regular\"]`, and `wire` is not supported but `regular` is, the request will still be accepted and processed. Possible values: * **regular**: for normal, low-value transactions. * **fast**: a faster way to transfer funds, but the fees are higher. Recommended for high-priority, low-value transactions. * **wire**: the fastest way to transfer funds, but this has the highest fees. Recommended for high-priority, high-value transactions. * **instant**: for instant funds transfers in [SEPA countries](https://www.ecb.europa.eu/paym/integration/retail/sepa/html/index.en.html). * **crossBorder**: for high-value transfers to a recipient in a different country. * **internal**: for transfers to an Adyen-issued business bank account (by bank account number/IBAN). Set `category` to **bank**. For more details, see optional priorities setup for [marketplaces](https://docs.adyen.com/marketplaces/payout-to-users/scheduled-payouts#optional-priorities-setup) or [platforms](https://docs.adyen.com/platforms/payout-to-users/scheduled-payouts#optional-priorities-setup).. /// Your reference for the sweep configuration.. /// The reference sent to or received from the counterparty. Only alphanumeric characters are allowed.. /// schedule. diff --git a/Adyen/Model/BalancePlatform/WalletProviderAccountScoreRestriction.cs b/Adyen/Model/BalancePlatform/WalletProviderAccountScoreRestriction.cs new file mode 100644 index 000000000..3c07ae903 --- /dev/null +++ b/Adyen/Model/BalancePlatform/WalletProviderAccountScoreRestriction.cs @@ -0,0 +1,148 @@ +/* +* 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 System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Adyen.ApiSerialization.OpenAPIDateConverter; + +namespace Adyen.Model.BalancePlatform +{ + /// + /// WalletProviderAccountScoreRestriction + /// + [DataContract(Name = "WalletProviderAccountScoreRestriction")] + public partial class WalletProviderAccountScoreRestriction : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected WalletProviderAccountScoreRestriction() { } + /// + /// Initializes a new instance of the class. + /// + /// Defines how the condition must be evaluated. (required). + /// value. + public WalletProviderAccountScoreRestriction(string operation = default(string), int? value = default(int?)) + { + this.Operation = operation; + this.Value = value; + } + + /// + /// Defines how the condition must be evaluated. + /// + /// Defines how the condition must be evaluated. + [DataMember(Name = "operation", IsRequired = false, EmitDefaultValue = false)] + public string Operation { get; set; } + + /// + /// Gets or Sets Value + /// + [DataMember(Name = "value", EmitDefaultValue = false)] + public int? Value { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class WalletProviderAccountScoreRestriction {\n"); + sb.Append(" Operation: ").Append(Operation).Append("\n"); + sb.Append(" Value: ").Append(Value).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as WalletProviderAccountScoreRestriction); + } + + /// + /// Returns true if WalletProviderAccountScoreRestriction instances are equal + /// + /// Instance of WalletProviderAccountScoreRestriction to be compared + /// Boolean + public bool Equals(WalletProviderAccountScoreRestriction input) + { + if (input == null) + { + return false; + } + return + ( + this.Operation == input.Operation || + (this.Operation != null && + this.Operation.Equals(input.Operation)) + ) && + ( + this.Value == input.Value || + this.Value.Equals(input.Value) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Operation != null) + { + hashCode = (hashCode * 59) + this.Operation.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Value.GetHashCode(); + return hashCode; + } + } + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + public IEnumerable Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/Adyen/Model/BalancePlatform/WalletProviderDeviceScore.cs b/Adyen/Model/BalancePlatform/WalletProviderDeviceScore.cs new file mode 100644 index 000000000..b6e64c848 --- /dev/null +++ b/Adyen/Model/BalancePlatform/WalletProviderDeviceScore.cs @@ -0,0 +1,148 @@ +/* +* 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 System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Adyen.ApiSerialization.OpenAPIDateConverter; + +namespace Adyen.Model.BalancePlatform +{ + /// + /// WalletProviderDeviceScore + /// + [DataContract(Name = "WalletProviderDeviceScore")] + public partial class WalletProviderDeviceScore : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected WalletProviderDeviceScore() { } + /// + /// Initializes a new instance of the class. + /// + /// Defines how the condition must be evaluated. (required). + /// value. + public WalletProviderDeviceScore(string operation = default(string), int? value = default(int?)) + { + this.Operation = operation; + this.Value = value; + } + + /// + /// Defines how the condition must be evaluated. + /// + /// Defines how the condition must be evaluated. + [DataMember(Name = "operation", IsRequired = false, EmitDefaultValue = false)] + public string Operation { get; set; } + + /// + /// Gets or Sets Value + /// + [DataMember(Name = "value", EmitDefaultValue = false)] + public int? Value { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class WalletProviderDeviceScore {\n"); + sb.Append(" Operation: ").Append(Operation).Append("\n"); + sb.Append(" Value: ").Append(Value).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as WalletProviderDeviceScore); + } + + /// + /// Returns true if WalletProviderDeviceScore instances are equal + /// + /// Instance of WalletProviderDeviceScore to be compared + /// Boolean + public bool Equals(WalletProviderDeviceScore input) + { + if (input == null) + { + return false; + } + return + ( + this.Operation == input.Operation || + (this.Operation != null && + this.Operation.Equals(input.Operation)) + ) && + ( + this.Value == input.Value || + this.Value.Equals(input.Value) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Operation != null) + { + hashCode = (hashCode * 59) + this.Operation.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Value.GetHashCode(); + return hashCode; + } + } + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + public IEnumerable Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/Adyen/Model/BalancePlatform/WebhookSetting.cs b/Adyen/Model/BalancePlatform/WebhookSetting.cs new file mode 100644 index 000000000..c567aef9b --- /dev/null +++ b/Adyen/Model/BalancePlatform/WebhookSetting.cs @@ -0,0 +1,217 @@ +/* +* 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 +{ + /// + /// WebhookSetting + /// + [DataContract(Name = "WebhookSetting")] + [JsonConverter(typeof(JsonSubtypes), "Type")] + [JsonSubtypes.KnownSubType(typeof(BalanceWebhookSetting), "BalanceWebhookSetting")] + [JsonSubtypes.KnownSubType(typeof(BalanceWebhookSetting), "balance")] + public partial class WebhookSetting : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets Type + /// + [DataMember(Name = "type", IsRequired = false, EmitDefaultValue = false)] + public SettingType Type { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected WebhookSetting() { } + /// + /// Initializes a new instance of the class. + /// + /// The three-character [ISO currency code](https://docs.adyen.com/development-resources/currency-codes) of the balance. (required). + /// The unique identifier of the webhook setting. (required). + /// status (required). + /// target (required). + /// type (required). + public WebhookSetting(string currency = default(string), string id = default(string), string status = default(string), Target target = default(Target), SettingType type = default(SettingType)) + { + this.Currency = currency; + this.Id = id; + this.Status = status; + this.Target = target; + this.Type = type; + } + + /// + /// The three-character [ISO currency code](https://docs.adyen.com/development-resources/currency-codes) of the balance. + /// + /// The three-character [ISO currency code](https://docs.adyen.com/development-resources/currency-codes) of the balance. + [DataMember(Name = "currency", IsRequired = false, EmitDefaultValue = false)] + public string Currency { get; set; } + + /// + /// The unique identifier of the webhook setting. + /// + /// The unique identifier of the webhook setting. + [DataMember(Name = "id", IsRequired = false, EmitDefaultValue = false)] + public string Id { get; set; } + + /// + /// Gets or Sets Status + /// + [DataMember(Name = "status", IsRequired = false, EmitDefaultValue = false)] + public string Status { get; set; } + + /// + /// Gets or Sets Target + /// + [DataMember(Name = "target", IsRequired = false, EmitDefaultValue = false)] + public Target Target { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class WebhookSetting {\n"); + sb.Append(" Currency: ").Append(Currency).Append("\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" Status: ").Append(Status).Append("\n"); + sb.Append(" Target: ").Append(Target).Append("\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as WebhookSetting); + } + + /// + /// Returns true if WebhookSetting instances are equal + /// + /// Instance of WebhookSetting to be compared + /// Boolean + public bool Equals(WebhookSetting input) + { + if (input == null) + { + return false; + } + return + ( + this.Currency == input.Currency || + (this.Currency != null && + this.Currency.Equals(input.Currency)) + ) && + ( + this.Id == input.Id || + (this.Id != null && + this.Id.Equals(input.Id)) + ) && + ( + this.Status == input.Status || + (this.Status != null && + this.Status.Equals(input.Status)) + ) && + ( + this.Target == input.Target || + (this.Target != null && + this.Target.Equals(input.Target)) + ) && + ( + this.Type == input.Type || + this.Type.Equals(input.Type) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Currency != null) + { + hashCode = (hashCode * 59) + this.Currency.GetHashCode(); + } + if (this.Id != null) + { + hashCode = (hashCode * 59) + this.Id.GetHashCode(); + } + if (this.Status != null) + { + hashCode = (hashCode * 59) + this.Status.GetHashCode(); + } + if (this.Target != null) + { + hashCode = (hashCode * 59) + this.Target.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Type.GetHashCode(); + return hashCode; + } + } + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + public IEnumerable Validate(ValidationContext validationContext) + { + return this.BaseValidate(validationContext); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + protected IEnumerable BaseValidate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/Adyen/Model/BalancePlatform/WebhookSettingsResponse.cs b/Adyen/Model/BalancePlatform/WebhookSettingsResponse.cs new file mode 100644 index 000000000..2ad045145 --- /dev/null +++ b/Adyen/Model/BalancePlatform/WebhookSettingsResponse.cs @@ -0,0 +1,130 @@ +/* +* 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 System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Adyen.ApiSerialization.OpenAPIDateConverter; + +namespace Adyen.Model.BalancePlatform +{ + /// + /// WebhookSettingsResponse + /// + [DataContract(Name = "WebhookSettingsResponse")] + public partial class WebhookSettingsResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// The list of webhook settings.. + public WebhookSettingsResponse(List webhookSettings = default(List)) + { + this.WebhookSettings = webhookSettings; + } + + /// + /// The list of webhook settings. + /// + /// The list of webhook settings. + [DataMember(Name = "webhookSettings", EmitDefaultValue = false)] + public List WebhookSettings { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class WebhookSettingsResponse {\n"); + sb.Append(" WebhookSettings: ").Append(WebhookSettings).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as WebhookSettingsResponse); + } + + /// + /// Returns true if WebhookSettings instances are equal + /// + /// Instance of WebhookSettings to be compared + /// Boolean + public bool Equals(WebhookSettingsResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.WebhookSettings == input.WebhookSettings || + this.WebhookSettings != null && + input.WebhookSettings != null && + this.WebhookSettings.SequenceEqual(input.WebhookSettings) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.WebhookSettings != null) + { + hashCode = (hashCode * 59) + this.WebhookSettings.GetHashCode(); + } + return hashCode; + } + } + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + public IEnumerable Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/Adyen/Service/BalancePlatform/BalancesService.cs b/Adyen/Service/BalancePlatform/BalancesService.cs new file mode 100644 index 000000000..0ad7723d7 --- /dev/null +++ b/Adyen/Service/BalancePlatform/BalancesService.cs @@ -0,0 +1,204 @@ +/* +* 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.Generic; +using System.Net.Http; +using System.Threading; +using System.Threading.Tasks; +using Adyen.Model; +using Adyen.Model.BalancePlatform; + +namespace Adyen.Service.BalancePlatform +{ + /// + /// BalancesService Interface + /// + public interface IBalancesService + { + /// + /// Create a balance webhook setting + /// + /// - The unique identifier of the balance platform. + /// - The unique identifier of the balance webhook. + /// - + /// - Additional request options. + /// . + Model.BalancePlatform.WebhookSetting CreateWebhookSetting(string balancePlatformId, string webhookId, BalanceWebhookSettingInfo balanceWebhookSettingInfo, RequestOptions requestOptions = default); + + /// + /// Create a balance webhook setting + /// + /// - The unique identifier of the balance platform. + /// - The unique identifier of the balance webhook. + /// - + /// - Additional request options. + /// A CancellationToken enables cooperative cancellation between threads, thread pool work items, or Task objects. + /// Task of . + Task CreateWebhookSettingAsync(string balancePlatformId, string webhookId, BalanceWebhookSettingInfo balanceWebhookSettingInfo, RequestOptions requestOptions = default, CancellationToken cancellationToken = default); + + /// + /// Delete a balance webhook setting by id + /// + /// - The unique identifier of the balance platform. + /// - The unique identifier of the balance webhook. + /// - The unique identifier of the balance webhook setting. + /// - Additional request options. + void DeleteWebhookSetting(string balancePlatformId, string webhookId, string settingId, RequestOptions requestOptions = default); + + /// + /// Delete a balance webhook setting by id + /// + /// - The unique identifier of the balance platform. + /// - The unique identifier of the balance webhook. + /// - The unique identifier of the balance webhook setting. + /// - Additional request options. + /// A CancellationToken enables cooperative cancellation between threads, thread pool work items, or Task objects. + Task DeleteWebhookSettingAsync(string balancePlatformId, string webhookId, string settingId, RequestOptions requestOptions = default, CancellationToken cancellationToken = default); + + /// + /// Get all balance webhook settings + /// + /// - The unique identifier of the balance platform. + /// - The unique identifier of the balance webhook. + /// - Additional request options. + /// . + Model.BalancePlatform.WebhookSettingsResponse GetAllWebhookSettings(string balancePlatformId, string webhookId, RequestOptions requestOptions = default); + + /// + /// Get all balance webhook settings + /// + /// - The unique identifier of the balance platform. + /// - The unique identifier of the balance webhook. + /// - Additional request options. + /// A CancellationToken enables cooperative cancellation between threads, thread pool work items, or Task objects. + /// Task of . + Task GetAllWebhookSettingsAsync(string balancePlatformId, string webhookId, RequestOptions requestOptions = default, CancellationToken cancellationToken = default); + + /// + /// Get a balance webhook setting by id + /// + /// - The unique identifier of the balance platform. + /// - The unique identifier of the balance webhook. + /// - The unique identifier of the balance webhook setting. + /// - Additional request options. + /// . + Model.BalancePlatform.WebhookSetting GetWebhookSetting(string balancePlatformId, string webhookId, string settingId, RequestOptions requestOptions = default); + + /// + /// Get a balance webhook setting by id + /// + /// - The unique identifier of the balance platform. + /// - The unique identifier of the balance webhook. + /// - The unique identifier of the balance webhook setting. + /// - Additional request options. + /// A CancellationToken enables cooperative cancellation between threads, thread pool work items, or Task objects. + /// Task of . + Task GetWebhookSettingAsync(string balancePlatformId, string webhookId, string settingId, RequestOptions requestOptions = default, CancellationToken cancellationToken = default); + + /// + /// Update a balance webhook setting by id + /// + /// - The unique identifier of the balance platform. + /// - The unique identifier of the balance webhook. + /// - The unique identifier of the balance webhook setting. + /// - + /// - Additional request options. + /// . + Model.BalancePlatform.WebhookSetting UpdateWebhookSetting(string balancePlatformId, string webhookId, string settingId, BalanceWebhookSettingInfoUpdate balanceWebhookSettingInfoUpdate, RequestOptions requestOptions = default); + + /// + /// Update a balance webhook setting by id + /// + /// - The unique identifier of the balance platform. + /// - The unique identifier of the balance webhook. + /// - The unique identifier of the balance webhook setting. + /// - + /// - Additional request options. + /// A CancellationToken enables cooperative cancellation between threads, thread pool work items, or Task objects. + /// Task of . + Task UpdateWebhookSettingAsync(string balancePlatformId, string webhookId, string settingId, BalanceWebhookSettingInfoUpdate balanceWebhookSettingInfoUpdate, RequestOptions requestOptions = default, CancellationToken cancellationToken = default); + + } + + /// + /// Represents a collection of functions to interact with the BalancesService API endpoints + /// + public class BalancesService : AbstractService, IBalancesService + { + private readonly string _baseUrl; + + public BalancesService(Client client) : base(client) + { + _baseUrl = CreateBaseUrl("https://balanceplatform-api-test.adyen.com/bcl/v2"); + } + + public Model.BalancePlatform.WebhookSetting CreateWebhookSetting(string balancePlatformId, string webhookId, BalanceWebhookSettingInfo balanceWebhookSettingInfo, RequestOptions requestOptions = default) + { + return CreateWebhookSettingAsync(balancePlatformId, webhookId, balanceWebhookSettingInfo, requestOptions).ConfigureAwait(false).GetAwaiter().GetResult(); + } + + public async Task CreateWebhookSettingAsync(string balancePlatformId, string webhookId, BalanceWebhookSettingInfo balanceWebhookSettingInfo, RequestOptions requestOptions = default, CancellationToken cancellationToken = default) + { + var endpoint = _baseUrl + $"/balancePlatforms/{balancePlatformId}/webhooks/{webhookId}/settings"; + var resource = new ServiceResource(this, endpoint); + return await resource.RequestAsync(balanceWebhookSettingInfo.ToJson(), requestOptions, new HttpMethod("POST"), cancellationToken).ConfigureAwait(false); + } + + public void DeleteWebhookSetting(string balancePlatformId, string webhookId, string settingId, RequestOptions requestOptions = default) + { + DeleteWebhookSettingAsync(balancePlatformId, webhookId, settingId, requestOptions).ConfigureAwait(false).GetAwaiter().GetResult(); + } + + public async Task DeleteWebhookSettingAsync(string balancePlatformId, string webhookId, string settingId, RequestOptions requestOptions = default, CancellationToken cancellationToken = default) + { + var endpoint = _baseUrl + $"/balancePlatforms/{balancePlatformId}/webhooks/{webhookId}/settings/{settingId}"; + var resource = new ServiceResource(this, endpoint); + await resource.RequestAsync(null, requestOptions, new HttpMethod("DELETE"), cancellationToken).ConfigureAwait(false); + } + + public Model.BalancePlatform.WebhookSettingsResponse GetAllWebhookSettings(string balancePlatformId, string webhookId, RequestOptions requestOptions = default) + { + return GetAllWebhookSettingsAsync(balancePlatformId, webhookId, requestOptions).ConfigureAwait(false).GetAwaiter().GetResult(); + } + + public async Task GetAllWebhookSettingsAsync(string balancePlatformId, string webhookId, RequestOptions requestOptions = default, CancellationToken cancellationToken = default) + { + var endpoint = _baseUrl + $"/balancePlatforms/{balancePlatformId}/webhooks/{webhookId}/settings"; + var resource = new ServiceResource(this, endpoint); + return await resource.RequestAsync(null, requestOptions, new HttpMethod("GET"), cancellationToken).ConfigureAwait(false); + } + + public Model.BalancePlatform.WebhookSetting GetWebhookSetting(string balancePlatformId, string webhookId, string settingId, RequestOptions requestOptions = default) + { + return GetWebhookSettingAsync(balancePlatformId, webhookId, settingId, requestOptions).ConfigureAwait(false).GetAwaiter().GetResult(); + } + + public async Task GetWebhookSettingAsync(string balancePlatformId, string webhookId, string settingId, RequestOptions requestOptions = default, CancellationToken cancellationToken = default) + { + var endpoint = _baseUrl + $"/balancePlatforms/{balancePlatformId}/webhooks/{webhookId}/settings/{settingId}"; + var resource = new ServiceResource(this, endpoint); + return await resource.RequestAsync(null, requestOptions, new HttpMethod("GET"), cancellationToken).ConfigureAwait(false); + } + + public Model.BalancePlatform.WebhookSetting UpdateWebhookSetting(string balancePlatformId, string webhookId, string settingId, BalanceWebhookSettingInfoUpdate balanceWebhookSettingInfoUpdate, RequestOptions requestOptions = default) + { + return UpdateWebhookSettingAsync(balancePlatformId, webhookId, settingId, balanceWebhookSettingInfoUpdate, requestOptions).ConfigureAwait(false).GetAwaiter().GetResult(); + } + + public async Task UpdateWebhookSettingAsync(string balancePlatformId, string webhookId, string settingId, BalanceWebhookSettingInfoUpdate balanceWebhookSettingInfoUpdate, RequestOptions requestOptions = default, CancellationToken cancellationToken = default) + { + var endpoint = _baseUrl + $"/balancePlatforms/{balancePlatformId}/webhooks/{webhookId}/settings/{settingId}"; + var resource = new ServiceResource(this, endpoint); + return await resource.RequestAsync(balanceWebhookSettingInfoUpdate.ToJson(), requestOptions, new HttpMethod("PATCH"), cancellationToken).ConfigureAwait(false); + } + } +} \ No newline at end of file From 5ac52c3213256fbb319e751d9dfe3a8a4076fda5 Mon Sep 17 00:00:00 2001 From: kwokhe Date: Wed, 7 May 2025 23:47:57 +0200 Subject: [PATCH 2/2] Added support for BalanceNotification Webhooks --- .../BalancePlatformWebhookHandlerTest.cs | 472 ++++++++++-------- .../BalanceWebhooks/AbstractOpenAPISchema.cs | 81 +++ .../BalanceNotificationData.cs | 246 +++++++++ .../BalanceNotificationRequest.cs | 201 ++++++++ .../BalanceNotificationResponse.cs | 129 +++++ Adyen/Model/BalanceWebhooks/Balances.cs | 170 +++++++ .../Webhooks/BalancePlatformWebhookHandler.cs | 21 + 7 files changed, 1104 insertions(+), 216 deletions(-) create mode 100644 Adyen/Model/BalanceWebhooks/AbstractOpenAPISchema.cs create mode 100644 Adyen/Model/BalanceWebhooks/BalanceNotificationData.cs create mode 100644 Adyen/Model/BalanceWebhooks/BalanceNotificationRequest.cs create mode 100644 Adyen/Model/BalanceWebhooks/BalanceNotificationResponse.cs create mode 100644 Adyen/Model/BalanceWebhooks/Balances.cs diff --git a/Adyen.Test/WebhooksTests/BalancePlatformWebhookHandlerTest.cs b/Adyen.Test/WebhooksTests/BalancePlatformWebhookHandlerTest.cs index 2ae2f1617..6b554e42d 100644 --- a/Adyen.Test/WebhooksTests/BalancePlatformWebhookHandlerTest.cs +++ b/Adyen.Test/WebhooksTests/BalancePlatformWebhookHandlerTest.cs @@ -1,5 +1,6 @@ using System; using Adyen.Model.AcsWebhooks; +using Adyen.Model.BalanceWebhooks; using Adyen.Model.ConfigurationWebhooks; using Adyen.Model.NegativeBalanceWarningWebhooks; using Adyen.Model.ReportWebhooks; @@ -11,18 +12,18 @@ namespace Adyen.Test.WebhooksTests { - [TestClass] - public class BalancePlatformWebhookHandlerTest : BaseTest - { - private readonly BalancePlatformWebhookHandler _balancePlatformWebhookHandler = new BalancePlatformWebhookHandler(); + [TestClass] + public class BalancePlatformWebhookHandlerTest : BaseTest + { + private readonly BalancePlatformWebhookHandler _balancePlatformWebhookHandler = new BalancePlatformWebhookHandler(); - [TestMethod] - [DataRow("balancePlatform.accountHolder.created", AccountHolderNotificationRequest.TypeEnum.Created)] - [DataRow("balancePlatform.accountHolder.updated", AccountHolderNotificationRequest.TypeEnum.Updated)] - public void Given_AccountHolder_Webhook_When_Type_Is_Provided_Result_Should_Deserialize(string type, AccountHolderNotificationRequest.TypeEnum expected) - { - // Arrange - string jsonPayload = @" + [TestMethod] + [DataRow("balancePlatform.accountHolder.created", AccountHolderNotificationRequest.TypeEnum.Created)] + [DataRow("balancePlatform.accountHolder.updated", AccountHolderNotificationRequest.TypeEnum.Updated)] + public void Given_AccountHolder_Webhook_When_Type_Is_Provided_Result_Should_Deserialize(string type, AccountHolderNotificationRequest.TypeEnum expected) + { + // Arrange + string jsonPayload = @" { 'data': { 'balancePlatform': 'YOUR_BALANCE_PLATFORM', @@ -47,50 +48,50 @@ public void Given_AccountHolder_Webhook_When_Type_Is_Provided_Result_Should_Dese }, 'environment': 'test', 'type': '" + type + "'" + -"}"; - // Act - _balancePlatformWebhookHandler.GetAccountHolderNotificationRequest(jsonPayload, out AccountHolderNotificationRequest target); - - // Assert - Assert.IsNotNull(target); - Assert.AreEqual("YOUR_BALANCE_PLATFORM", target.Data.BalancePlatform); - Assert.AreEqual("NL", target.Data.AccountHolder.ContactDetails.Address.Country); - Assert.AreEqual("274", target.Data.AccountHolder.ContactDetails.Address.HouseNumberOrName); - Assert.AreEqual("1020CD", target.Data.AccountHolder.ContactDetails.Address.PostalCode); - Assert.AreEqual("Brannan Street", target.Data.AccountHolder.ContactDetails.Address.Street); - Assert.AreEqual("s.hopper@example.com", target.Data.AccountHolder.ContactDetails.Email); - Assert.AreEqual("+315551231234", target.Data.AccountHolder.ContactDetails.Phone.Number); - Assert.AreEqual(Phone.TypeEnum.Mobile, target.Data.AccountHolder.ContactDetails.Phone.Type); - Assert.AreEqual("S.Hopper - Staff 123", target.Data.AccountHolder.Description); - Assert.AreEqual("AH00000000000000000000001", target.Data.AccountHolder.Id); - Assert.AreEqual(AccountHolder.StatusEnum.Active, target.Data.AccountHolder.Status); - Assert.AreEqual("test", target.Environment); - Assert.AreEqual(expected, target.Type); - } + "}"; + // Act + _balancePlatformWebhookHandler.GetAccountHolderNotificationRequest(jsonPayload, out AccountHolderNotificationRequest target); - [TestMethod] - public void Given_AccountHolder_Webhook_When_Type_Is_Unknown_Result_Should_Be_Null() - { - string jsonPayload = @"{ 'type': 'unknowntype' }"; - bool response = _balancePlatformWebhookHandler.GetAccountHolderNotificationRequest(jsonPayload, out AccountHolderNotificationRequest target); - Assert.IsFalse(response); - Assert.IsNull(target); - } + // Assert + Assert.IsNotNull(target); + Assert.AreEqual("YOUR_BALANCE_PLATFORM", target.Data.BalancePlatform); + Assert.AreEqual("NL", target.Data.AccountHolder.ContactDetails.Address.Country); + Assert.AreEqual("274", target.Data.AccountHolder.ContactDetails.Address.HouseNumberOrName); + Assert.AreEqual("1020CD", target.Data.AccountHolder.ContactDetails.Address.PostalCode); + Assert.AreEqual("Brannan Street", target.Data.AccountHolder.ContactDetails.Address.Street); + Assert.AreEqual("s.hopper@example.com", target.Data.AccountHolder.ContactDetails.Email); + Assert.AreEqual("+315551231234", target.Data.AccountHolder.ContactDetails.Phone.Number); + Assert.AreEqual(Phone.TypeEnum.Mobile, target.Data.AccountHolder.ContactDetails.Phone.Type); + Assert.AreEqual("S.Hopper - Staff 123", target.Data.AccountHolder.Description); + Assert.AreEqual("AH00000000000000000000001", target.Data.AccountHolder.Id); + Assert.AreEqual(AccountHolder.StatusEnum.Active, target.Data.AccountHolder.Status); + Assert.AreEqual("test", target.Environment); + Assert.AreEqual(expected, target.Type); + } - [TestMethod] - public void Given_AccountHolder_Webhook_When_Invalid_Json_Result_Should_Throw_JsonReaderException() - { - string jsonPayload = "{ invalid,.json; }"; - Assert.ThrowsException(() => _balancePlatformWebhookHandler.GetAccountHolderNotificationRequest(jsonPayload, out var _)); - } + [TestMethod] + public void Given_AccountHolder_Webhook_When_Type_Is_Unknown_Result_Should_Be_Null() + { + string jsonPayload = @"{ 'type': 'unknowntype' }"; + bool response = _balancePlatformWebhookHandler.GetAccountHolderNotificationRequest(jsonPayload, out AccountHolderNotificationRequest target); + Assert.IsFalse(response); + Assert.IsNull(target); + } - [TestMethod] + [TestMethod] + public void Given_AccountHolder_Webhook_When_Invalid_Json_Result_Should_Throw_JsonReaderException() + { + string jsonPayload = "{ invalid,.json; }"; + Assert.ThrowsException(() => _balancePlatformWebhookHandler.GetAccountHolderNotificationRequest(jsonPayload, out var _)); + } - public void Test_BalancePlatform_AccountHolderUpdated_LEM_V3() - { - // Note: We're using double-quotes here as some descriptions in the JSON payload contain single quotes ' - // Assert - const string jsonPayload = @" + [TestMethod] + + public void Test_BalancePlatform_AccountHolderUpdated_LEM_V3() + { + // Note: We're using double-quotes here as some descriptions in the JSON payload contain single quotes ' + // Assert + const string jsonPayload = @" { ""data"": { ""balancePlatform"": ""YOUR_BALANCE_PLATFORM"", @@ -241,49 +242,50 @@ public void Test_BalancePlatform_AccountHolderUpdated_LEM_V3() ""type"": ""balancePlatform.accountHolder.updated"" }"; - _balancePlatformWebhookHandler.GetAccountHolderNotificationRequest(jsonPayload, out AccountHolderNotificationRequest accountHolderUpdatedWebhook); + _balancePlatformWebhookHandler.GetAccountHolderNotificationRequest(jsonPayload, out AccountHolderNotificationRequest accountHolderUpdatedWebhook); - Assert.IsNotNull(accountHolderUpdatedWebhook); - Assert.AreEqual(accountHolderUpdatedWebhook.Type, AccountHolderNotificationRequest.TypeEnum.Updated); - Assert.AreEqual("YOUR_BALANCE_PLATFORM", accountHolderUpdatedWebhook.Data.BalancePlatform); - Assert.AreEqual("AH00000000000000000001", accountHolderUpdatedWebhook.Data.AccountHolder.Id); - Assert.AreEqual("LE00000000000000000001", accountHolderUpdatedWebhook.Data.AccountHolder.LegalEntityId); - Assert.AreEqual("YOUR_REFERENCE-2412C", accountHolderUpdatedWebhook.Data.AccountHolder.Reference); - Assert.AreEqual(AccountHolder.StatusEnum.Active, accountHolderUpdatedWebhook.Data.AccountHolder.Status); - Assert.IsTrue(accountHolderUpdatedWebhook.Data.AccountHolder.Capabilities.TryGetValue("sendToTransferInstrument", out AccountHolderCapability capabilitiesData)); - Assert.AreEqual(true, capabilitiesData.Enabled); - Assert.AreEqual(true, capabilitiesData.Requested); - Assert.AreEqual(false, capabilitiesData.Allowed); - Assert.AreEqual(AccountHolderCapability.VerificationStatusEnum.Pending, capabilitiesData.VerificationStatus); - Assert.AreEqual(4, accountHolderUpdatedWebhook.Data.AccountHolder.Capabilities["sendToTransferInstrument"].Problems.Count); - Assert.AreEqual("LE00000000000000000001", accountHolderUpdatedWebhook.Data.AccountHolder.Capabilities["sendToTransferInstrument"].Problems[0].Entity.Id); - Assert.AreEqual(CapabilityProblemEntity.TypeEnum.LegalEntity, accountHolderUpdatedWebhook.Data.AccountHolder.Capabilities["sendToTransferInstrument"].Problems[0].Entity.Type); - Assert.AreEqual("2_902", accountHolderUpdatedWebhook.Data.AccountHolder.Capabilities["sendToTransferInstrument"].Problems[0].VerificationErrors[0].Code); - Assert.AreEqual("Terms Of Service forms are not accepted.", accountHolderUpdatedWebhook.Data.AccountHolder.Capabilities["sendToTransferInstrument"].Problems[0].VerificationErrors[0].Message); - Assert.AreEqual("Accept TOS", accountHolderUpdatedWebhook.Data.AccountHolder.Capabilities["sendToTransferInstrument"].Problems[0].VerificationErrors[0].RemediatingActions[0].Message); - Assert.AreEqual("SE00000000000000000001", accountHolderUpdatedWebhook.Data.AccountHolder.Capabilities["sendToTransferInstrument"].Problems[1].Entity.Id); - Assert.AreEqual(CapabilityProblemEntity.TypeEnum.BankAccount, accountHolderUpdatedWebhook.Data.AccountHolder.Capabilities["sendToTransferInstrument"].Problems[1].Entity.Type); - Assert.AreEqual("2_8037", accountHolderUpdatedWebhook.Data.AccountHolder.Capabilities["sendToTransferInstrument"].Problems[1].VerificationErrors[0].Code); - Assert.AreEqual("'bankStatement' was missing.", accountHolderUpdatedWebhook.Data.AccountHolder.Capabilities["sendToTransferInstrument"].Problems[1].VerificationErrors[0].Message); - Assert.AreEqual("Upload a bank statement", accountHolderUpdatedWebhook.Data.AccountHolder.Capabilities["sendToTransferInstrument"].Problems[1].VerificationErrors[0].RemediatingActions[0].Message); - Assert.AreEqual("SE00000000000000000002", accountHolderUpdatedWebhook.Data.AccountHolder.Capabilities["sendToTransferInstrument"].Problems[2].Entity.Id); - Assert.AreEqual(CapabilityProblemEntity.TypeEnum.BankAccount, accountHolderUpdatedWebhook.Data.AccountHolder.Capabilities["sendToTransferInstrument"].Problems[2].Entity.Type); - Assert.AreEqual("2_8037", accountHolderUpdatedWebhook.Data.AccountHolder.Capabilities["sendToTransferInstrument"].Problems[2].VerificationErrors[0].Code); - Assert.AreEqual("'bankStatement' was missing.", accountHolderUpdatedWebhook.Data.AccountHolder.Capabilities["sendToTransferInstrument"].Problems[2].VerificationErrors[0].Message); - Assert.AreEqual("Upload a bank statement", accountHolderUpdatedWebhook.Data.AccountHolder.Capabilities["sendToTransferInstrument"].Problems[2].VerificationErrors[0].RemediatingActions[0].Message); - Assert.AreEqual("LE00000000000000000001", accountHolderUpdatedWebhook.Data.AccountHolder.Capabilities["sendToTransferInstrument"].Problems[3].Entity.Id); - Assert.AreEqual(CapabilityProblemEntity.TypeEnum.LegalEntity, accountHolderUpdatedWebhook.Data.AccountHolder.Capabilities["sendToTransferInstrument"].Problems[3].Entity.Type); - Assert.AreEqual("2_8189", accountHolderUpdatedWebhook.Data.AccountHolder.Capabilities["sendToTransferInstrument"].Problems[3].VerificationErrors[0].Code); - Assert.AreEqual("'UBO through control' was missing.", accountHolderUpdatedWebhook.Data.AccountHolder.Capabilities["sendToTransferInstrument"].Problems[3].VerificationErrors[0].Message); - Assert.AreEqual("Add 'organization.entityAssociations' of type 'uboThroughControl' to legal entity", accountHolderUpdatedWebhook.Data.AccountHolder.Capabilities["sendToTransferInstrument"].Problems[3].VerificationErrors[0].RemediatingActions[0].Message); - Assert.AreEqual("live", accountHolderUpdatedWebhook.Environment); - Assert.AreEqual(DateTime.Parse("2024-12-15T15:42:03+01:00"), accountHolderUpdatedWebhook.Timestamp); - } + Assert.IsNotNull(accountHolderUpdatedWebhook); + Assert.AreEqual(accountHolderUpdatedWebhook.Type, AccountHolderNotificationRequest.TypeEnum.Updated); + Assert.AreEqual("YOUR_BALANCE_PLATFORM", accountHolderUpdatedWebhook.Data.BalancePlatform); + Assert.AreEqual("AH00000000000000000001", accountHolderUpdatedWebhook.Data.AccountHolder.Id); + Assert.AreEqual("LE00000000000000000001", accountHolderUpdatedWebhook.Data.AccountHolder.LegalEntityId); + Assert.AreEqual("YOUR_REFERENCE-2412C", accountHolderUpdatedWebhook.Data.AccountHolder.Reference); + Assert.AreEqual(AccountHolder.StatusEnum.Active, accountHolderUpdatedWebhook.Data.AccountHolder.Status); + Assert.IsTrue(accountHolderUpdatedWebhook.Data.AccountHolder.Capabilities.TryGetValue("sendToTransferInstrument", out AccountHolderCapability capabilitiesData)); + Assert.AreEqual(true, capabilitiesData.Enabled); + Assert.AreEqual(true, capabilitiesData.Requested); + Assert.AreEqual(false, capabilitiesData.Allowed); + Assert.AreEqual(AccountHolderCapability.VerificationStatusEnum.Pending, capabilitiesData.VerificationStatus); + Assert.AreEqual(4, accountHolderUpdatedWebhook.Data.AccountHolder.Capabilities["sendToTransferInstrument"].Problems.Count); + Assert.AreEqual("LE00000000000000000001", accountHolderUpdatedWebhook.Data.AccountHolder.Capabilities["sendToTransferInstrument"].Problems[0].Entity.Id); + Assert.AreEqual(CapabilityProblemEntity.TypeEnum.LegalEntity, accountHolderUpdatedWebhook.Data.AccountHolder.Capabilities["sendToTransferInstrument"].Problems[0].Entity.Type); + Assert.AreEqual("2_902", accountHolderUpdatedWebhook.Data.AccountHolder.Capabilities["sendToTransferInstrument"].Problems[0].VerificationErrors[0].Code); + Assert.AreEqual("Terms Of Service forms are not accepted.", accountHolderUpdatedWebhook.Data.AccountHolder.Capabilities["sendToTransferInstrument"].Problems[0].VerificationErrors[0].Message); + Assert.AreEqual("Accept TOS", accountHolderUpdatedWebhook.Data.AccountHolder.Capabilities["sendToTransferInstrument"].Problems[0].VerificationErrors[0].RemediatingActions[0].Message); + Assert.AreEqual("SE00000000000000000001", accountHolderUpdatedWebhook.Data.AccountHolder.Capabilities["sendToTransferInstrument"].Problems[1].Entity.Id); + Assert.AreEqual(CapabilityProblemEntity.TypeEnum.BankAccount, accountHolderUpdatedWebhook.Data.AccountHolder.Capabilities["sendToTransferInstrument"].Problems[1].Entity.Type); + Assert.AreEqual("2_8037", accountHolderUpdatedWebhook.Data.AccountHolder.Capabilities["sendToTransferInstrument"].Problems[1].VerificationErrors[0].Code); + Assert.AreEqual("'bankStatement' was missing.", accountHolderUpdatedWebhook.Data.AccountHolder.Capabilities["sendToTransferInstrument"].Problems[1].VerificationErrors[0].Message); + Assert.AreEqual("Upload a bank statement", accountHolderUpdatedWebhook.Data.AccountHolder.Capabilities["sendToTransferInstrument"].Problems[1].VerificationErrors[0].RemediatingActions[0].Message); + Assert.AreEqual("SE00000000000000000002", accountHolderUpdatedWebhook.Data.AccountHolder.Capabilities["sendToTransferInstrument"].Problems[2].Entity.Id); + Assert.AreEqual(CapabilityProblemEntity.TypeEnum.BankAccount, accountHolderUpdatedWebhook.Data.AccountHolder.Capabilities["sendToTransferInstrument"].Problems[2].Entity.Type); + Assert.AreEqual("2_8037", accountHolderUpdatedWebhook.Data.AccountHolder.Capabilities["sendToTransferInstrument"].Problems[2].VerificationErrors[0].Code); + Assert.AreEqual("'bankStatement' was missing.", accountHolderUpdatedWebhook.Data.AccountHolder.Capabilities["sendToTransferInstrument"].Problems[2].VerificationErrors[0].Message); + Assert.AreEqual("Upload a bank statement", accountHolderUpdatedWebhook.Data.AccountHolder.Capabilities["sendToTransferInstrument"].Problems[2].VerificationErrors[0].RemediatingActions[0].Message); + Assert.AreEqual("LE00000000000000000001", accountHolderUpdatedWebhook.Data.AccountHolder.Capabilities["sendToTransferInstrument"].Problems[3].Entity.Id); + Assert.AreEqual(CapabilityProblemEntity.TypeEnum.LegalEntity, accountHolderUpdatedWebhook.Data.AccountHolder.Capabilities["sendToTransferInstrument"].Problems[3].Entity.Type); + Assert.AreEqual("2_8189", accountHolderUpdatedWebhook.Data.AccountHolder.Capabilities["sendToTransferInstrument"].Problems[3].VerificationErrors[0].Code); + Assert.AreEqual("'UBO through control' was missing.", accountHolderUpdatedWebhook.Data.AccountHolder.Capabilities["sendToTransferInstrument"].Problems[3].VerificationErrors[0].Message); + Assert.AreEqual("Add 'organization.entityAssociations' of type 'uboThroughControl' to legal entity", + accountHolderUpdatedWebhook.Data.AccountHolder.Capabilities["sendToTransferInstrument"].Problems[3].VerificationErrors[0].RemediatingActions[0].Message); + Assert.AreEqual("live", accountHolderUpdatedWebhook.Environment); + Assert.AreEqual(DateTime.Parse("2024-12-15T15:42:03+01:00"), accountHolderUpdatedWebhook.Timestamp); + } - [TestMethod] - public void Test_POC_Integration() - { - string jsonPayload = @" + [TestMethod] + public void Test_POC_Integration() + { + string jsonPayload = @" { 'data': { 'balancePlatform': 'YOUR_BALANCE_PLATFORM', @@ -310,34 +312,34 @@ public void Test_POC_Integration() 'type': 'balancePlatform.accountHolder.created' }"; - var handler = new BalancePlatformWebhookHandler(); - var response = handler.GetGenericBalancePlatformWebhook(jsonPayload); - try - { - if (response.GetType() == typeof(AccountHolderNotificationRequest)) - { - var accountHolderNotificationRequest = (AccountHolderNotificationRequest)response; - Assert.AreEqual(accountHolderNotificationRequest.Environment, "test"); - } - - if (response.GetType() == typeof(BalanceAccountNotificationRequest)) - { - var balanceAccountNotificationRequest = (BalanceAccountNotificationRequest)response; - Assert.Fail(balanceAccountNotificationRequest.Data.BalancePlatform); - } - } - catch (System.Exception e) - { - Assert.Fail(); - throw new System.Exception(e.ToString()); - } + var handler = new BalancePlatformWebhookHandler(); + var response = handler.GetGenericBalancePlatformWebhook(jsonPayload); + try + { + if (response.GetType() == typeof(AccountHolderNotificationRequest)) + { + var accountHolderNotificationRequest = (AccountHolderNotificationRequest)response; + Assert.AreEqual(accountHolderNotificationRequest.Environment, "test"); } - [TestMethod] - public void Test_TransactionWebhook_V4() + if (response.GetType() == typeof(BalanceAccountNotificationRequest)) { - // Arrange - const string jsonPayload = @" + var balanceAccountNotificationRequest = (BalanceAccountNotificationRequest)response; + Assert.Fail(balanceAccountNotificationRequest.Data.BalancePlatform); + } + } + catch (System.Exception e) + { + Assert.Fail(); + throw new System.Exception(e.ToString()); + } + } + + [TestMethod] + public void Test_TransactionWebhook_V4() + { + // Arrange + const string jsonPayload = @" { 'data': { 'id': 'EVJN42272224222B5JB8BRC84N686ZEUR', @@ -368,35 +370,35 @@ public void Test_TransactionWebhook_V4() 'type': 'balancePlatform.transaction.created', 'environment': 'test' }"; - Assert.IsFalse(_balancePlatformWebhookHandler.GetPaymentNotificationRequest(jsonPayload, out var _)); - - // Act - _balancePlatformWebhookHandler.GetTransactionNotificationRequestV4(jsonPayload, out TransactionNotificationRequestV4 target); - - // Assert - Assert.IsNotNull(target); - Assert.AreEqual(TransactionNotificationRequestV4.TypeEnum.BalancePlatformTransactionCreated, target.Type); - Assert.AreEqual(Transaction.StatusEnum.Booked, target.Data.Status); - Assert.AreEqual("BA00000000000000000000001", target.Data.BalanceAccount.Id); - Assert.IsTrue(target.Data.ValueDate.Equals(DateTime.Parse("2023-03-01T00:00:00+02:00"))); - Assert.AreEqual("YOUR_BALANCE_PLATFORM", target.Data.BalancePlatform); - Assert.AreEqual("AH00000000000000000000001", target.Data.AccountHolder.Id); - Assert.AreEqual("Your description for the account holder", target.Data.AccountHolder.Description); - Assert.AreEqual("Your reference for the account holder", target.Data.AccountHolder.Reference); - Assert.AreEqual("JN4227222422265", target.Data.Transfer.Id); - Assert.AreEqual("Split_item_1", target.Data.Transfer.Reference); - Assert.AreEqual(DateTime.Parse("2023-02-28T13:30:05+02:00"), target.Data.CreationDate); - Assert.AreEqual(DateTime.Parse("2023-02-28T13:30:20+02:00"), target.Data.BookingDate); - Assert.AreEqual(7000, target.Data.Amount.Value); - Assert.AreEqual("EUR", target.Data.Amount.Currency); - Assert.AreEqual("test", target.Environment); - } + Assert.IsFalse(_balancePlatformWebhookHandler.GetPaymentNotificationRequest(jsonPayload, out var _)); - [TestMethod] - public void Test_ReportCreatedWebhook() - { - // Arrange - const string jsonPayload = @" + // Act + _balancePlatformWebhookHandler.GetTransactionNotificationRequestV4(jsonPayload, out TransactionNotificationRequestV4 target); + + // Assert + Assert.IsNotNull(target); + Assert.AreEqual(TransactionNotificationRequestV4.TypeEnum.BalancePlatformTransactionCreated, target.Type); + Assert.AreEqual(Transaction.StatusEnum.Booked, target.Data.Status); + Assert.AreEqual("BA00000000000000000000001", target.Data.BalanceAccount.Id); + Assert.IsTrue(target.Data.ValueDate.Equals(DateTime.Parse("2023-03-01T00:00:00+02:00"))); + Assert.AreEqual("YOUR_BALANCE_PLATFORM", target.Data.BalancePlatform); + Assert.AreEqual("AH00000000000000000000001", target.Data.AccountHolder.Id); + Assert.AreEqual("Your description for the account holder", target.Data.AccountHolder.Description); + Assert.AreEqual("Your reference for the account holder", target.Data.AccountHolder.Reference); + Assert.AreEqual("JN4227222422265", target.Data.Transfer.Id); + Assert.AreEqual("Split_item_1", target.Data.Transfer.Reference); + Assert.AreEqual(DateTime.Parse("2023-02-28T13:30:05+02:00"), target.Data.CreationDate); + Assert.AreEqual(DateTime.Parse("2023-02-28T13:30:20+02:00"), target.Data.BookingDate); + Assert.AreEqual(7000, target.Data.Amount.Value); + Assert.AreEqual("EUR", target.Data.Amount.Currency); + Assert.AreEqual("test", target.Environment); + } + + [TestMethod] + public void Test_ReportCreatedWebhook() + { + // Arrange + const string jsonPayload = @" { 'data': { 'balancePlatform': 'YOUR_BALANCE_PLATFORM', @@ -411,27 +413,27 @@ public void Test_ReportCreatedWebhook() 'type': 'balancePlatform.report.created' }"; - // Act - _balancePlatformWebhookHandler.GetReportNotificationRequest(jsonPayload, out ReportNotificationRequest target); + // Act + _balancePlatformWebhookHandler.GetReportNotificationRequest(jsonPayload, out ReportNotificationRequest target); - // Assert - Assert.IsNotNull(target); - Assert.AreEqual(target.Type, ReportNotificationRequest.TypeEnum.BalancePlatformReportCreated); - Assert.AreEqual("YOUR_BALANCE_PLATFORM", target.Data.BalancePlatform); - Assert.AreEqual("balanceplatform_accounting_report_2024_07_01.csv", target.Data.Id); - Assert.AreEqual("balanceplatform_accounting_report_2024_07_01.csv", target.Data.FileName); - Assert.AreEqual("balanceplatform_accounting_report", target.Data.ReportType); - Assert.AreEqual(DateTime.Parse("2024-07-02T02:01:08+02:00"), target.Data.CreationDate); - Assert.AreEqual("https://balanceplatform-test.adyen.com/balanceplatform/.../.../.../balanceplatform_accounting_report_2024_07_01.csv", target.Data.DownloadUrl); - Assert.AreEqual("test", target.Environment); - Assert.AreEqual(DateTime.Parse("2024-07-02T02:01:05+02:00"), target.Timestamp); - } - - [TestMethod] - public void Test_AuthenticationCreatedWebhook() - { - // Arrange - const string jsonPayload = @" + // Assert + Assert.IsNotNull(target); + Assert.AreEqual(target.Type, ReportNotificationRequest.TypeEnum.BalancePlatformReportCreated); + Assert.AreEqual("YOUR_BALANCE_PLATFORM", target.Data.BalancePlatform); + Assert.AreEqual("balanceplatform_accounting_report_2024_07_01.csv", target.Data.Id); + Assert.AreEqual("balanceplatform_accounting_report_2024_07_01.csv", target.Data.FileName); + Assert.AreEqual("balanceplatform_accounting_report", target.Data.ReportType); + Assert.AreEqual(DateTime.Parse("2024-07-02T02:01:08+02:00"), target.Data.CreationDate); + Assert.AreEqual("https://balanceplatform-test.adyen.com/balanceplatform/.../.../.../balanceplatform_accounting_report_2024_07_01.csv", target.Data.DownloadUrl); + Assert.AreEqual("test", target.Environment); + Assert.AreEqual(DateTime.Parse("2024-07-02T02:01:05+02:00"), target.Timestamp); + } + + [TestMethod] + public void Test_AuthenticationCreatedWebhook() + { + // Arrange + const string jsonPayload = @" { 'data': { 'authentication': { @@ -471,41 +473,41 @@ public void Test_AuthenticationCreatedWebhook() 'type': 'balancePlatform.authentication.created' }"; - // Act - _balancePlatformWebhookHandler.GetAuthenticationNotificationRequest(jsonPayload, out AuthenticationNotificationRequest target); + // Act + _balancePlatformWebhookHandler.GetAuthenticationNotificationRequest(jsonPayload, out AuthenticationNotificationRequest target); - // Assert - Assert.IsNotNull(target); - Assert.AreEqual(target.Type, AuthenticationNotificationRequest.TypeEnum.BalancePlatformAuthenticationCreated); - Assert.AreEqual("YOUR_BALANCE_PLATFORM", target.Data.BalancePlatform); - Assert.AreEqual("497f6eca-6276-4993-bfeb-53cbbbba6f08", target.Data.Id); - Assert.AreEqual("PI3227C223222B5BPCMFXD2XG", target.Data.PaymentInstrumentId); - Assert.AreEqual(AuthenticationNotificationData.StatusEnum.Authenticated, target.Data.Status); - Assert.AreEqual("MyShop", target.Data.Purchase.MerchantName); - Assert.AreEqual("2022-12-22T15:49:03+01:00", target.Data.Purchase.Date); - Assert.AreEqual("EUR", target.Data.Purchase.OriginalAmount.Currency); - Assert.AreEqual(1000, target.Data.Purchase.OriginalAmount.Value); - Assert.AreEqual(DateTime.Parse("2022-12-22T15:45:03+01:00"), target.Data.Authentication.CreatedAt); - Assert.AreEqual(AuthenticationInfo.DeviceChannelEnum.App, target.Data.Authentication.DeviceChannel); - Assert.AreEqual(ChallengeInfo.FlowEnum.OOB, target.Data.Authentication.Challenge.Flow); - Assert.AreEqual(DateTime.Parse("2022-12-22T15:49:03+01:00"), target.Data.Authentication.Challenge.LastInteraction); - Assert.AreEqual(AuthenticationInfo.ChallengeIndicatorEnum._01, target.Data.Authentication.ChallengeIndicator); - Assert.AreEqual(AuthenticationInfo.ExemptionIndicatorEnum.LowValue, target.Data.Authentication.ExemptionIndicator); - Assert.AreEqual(true, target.Data.Authentication.InPSD2Scope); - Assert.AreEqual(AuthenticationInfo.MessageCategoryEnum.Payment, target.Data.Authentication.MessageCategory); - Assert.AreEqual("2.2.0", target.Data.Authentication.MessageVersion); - Assert.AreEqual(0, target.Data.Authentication.RiskScore); - Assert.AreEqual("6edcc246-23ee-4e94-ac5d-8ae620bea7d9", target.Data.Authentication.ThreeDSServerTransID); - Assert.AreEqual(AuthenticationInfo.TransStatusEnum.Y, target.Data.Authentication.TransStatus); - Assert.AreEqual("test", target.Environment); - Assert.AreEqual(DateTime.Parse("2022-12-22T15:42:03+01:00"), target.Timestamp); - } + // Assert + Assert.IsNotNull(target); + Assert.AreEqual(target.Type, AuthenticationNotificationRequest.TypeEnum.BalancePlatformAuthenticationCreated); + Assert.AreEqual("YOUR_BALANCE_PLATFORM", target.Data.BalancePlatform); + Assert.AreEqual("497f6eca-6276-4993-bfeb-53cbbbba6f08", target.Data.Id); + Assert.AreEqual("PI3227C223222B5BPCMFXD2XG", target.Data.PaymentInstrumentId); + Assert.AreEqual(AuthenticationNotificationData.StatusEnum.Authenticated, target.Data.Status); + Assert.AreEqual("MyShop", target.Data.Purchase.MerchantName); + Assert.AreEqual("2022-12-22T15:49:03+01:00", target.Data.Purchase.Date); + Assert.AreEqual("EUR", target.Data.Purchase.OriginalAmount.Currency); + Assert.AreEqual(1000, target.Data.Purchase.OriginalAmount.Value); + Assert.AreEqual(DateTime.Parse("2022-12-22T15:45:03+01:00"), target.Data.Authentication.CreatedAt); + Assert.AreEqual(AuthenticationInfo.DeviceChannelEnum.App, target.Data.Authentication.DeviceChannel); + Assert.AreEqual(ChallengeInfo.FlowEnum.OOB, target.Data.Authentication.Challenge.Flow); + Assert.AreEqual(DateTime.Parse("2022-12-22T15:49:03+01:00"), target.Data.Authentication.Challenge.LastInteraction); + Assert.AreEqual(AuthenticationInfo.ChallengeIndicatorEnum._01, target.Data.Authentication.ChallengeIndicator); + Assert.AreEqual(AuthenticationInfo.ExemptionIndicatorEnum.LowValue, target.Data.Authentication.ExemptionIndicator); + Assert.AreEqual(true, target.Data.Authentication.InPSD2Scope); + Assert.AreEqual(AuthenticationInfo.MessageCategoryEnum.Payment, target.Data.Authentication.MessageCategory); + Assert.AreEqual("2.2.0", target.Data.Authentication.MessageVersion); + Assert.AreEqual(0, target.Data.Authentication.RiskScore); + Assert.AreEqual("6edcc246-23ee-4e94-ac5d-8ae620bea7d9", target.Data.Authentication.ThreeDSServerTransID); + Assert.AreEqual(AuthenticationInfo.TransStatusEnum.Y, target.Data.Authentication.TransStatus); + Assert.AreEqual("test", target.Environment); + Assert.AreEqual(DateTime.Parse("2022-12-22T15:42:03+01:00"), target.Timestamp); + } - [TestMethod] - public void Test_NegativeBalanceCompensationWarningWebhook() - { - // Arrange - const string jsonPayload = @" + [TestMethod] + public void Test_NegativeBalanceCompensationWarningWebhook() + { + // Arrange + const string jsonPayload = @" { 'data': { 'balancePlatform': 'YOUR_BALANCE_PLATFORM', @@ -529,23 +531,61 @@ public void Test_NegativeBalanceCompensationWarningWebhook() 'type': 'balancePlatform.negativeBalanceCompensationWarning.scheduled' }"; - // Act - _balancePlatformWebhookHandler.GetNegativeBalanceCompensationWarningNotificationRequest(jsonPayload, out NegativeBalanceCompensationWarningNotificationRequest target); - - // Assert - Assert.IsNotNull(target); - Assert.AreEqual(NegativeBalanceCompensationWarningNotificationRequest.TypeEnum.BalancePlatformNegativeBalanceCompensationWarningScheduled, target.Type); - Assert.AreEqual("YOUR_BALANCE_PLATFORM", target.Data.BalancePlatform); - Assert.AreEqual(DateTime.Parse("2024-07-02T02:01:08+02:00"), target.Data.CreationDate); - Assert.AreEqual("BA00000000000000000001", target.Data.Id); - Assert.AreEqual("YOUR_REFERENCE", target.Data.AccountHolder.Reference); - Assert.AreEqual("EUR", target.Data.Amount.Currency); - Assert.AreEqual(-145050, target.Data.Amount.Value); - Assert.AreEqual("BA11111111111111111111", target.Data.LiableBalanceAccountId); - Assert.AreEqual(DateTime.Parse("2024-10-19T00:33:13+02:00"), target.Data.NegativeBalanceSince); - Assert.AreEqual(DateTime.Parse("2024-12-01T01:00:00+01:00"), target.Data.ScheduledCompensationAt); - Assert.AreEqual("test", target.Environment); - Assert.AreEqual(DateTime.Parse("2024-10-22T00:00:00+02:00"), target.Timestamp); - } + // Act + _balancePlatformWebhookHandler.GetNegativeBalanceCompensationWarningNotificationRequest(jsonPayload, out NegativeBalanceCompensationWarningNotificationRequest target); + + // Assert + Assert.IsNotNull(target); + Assert.AreEqual(NegativeBalanceCompensationWarningNotificationRequest.TypeEnum.BalancePlatformNegativeBalanceCompensationWarningScheduled, target.Type); + Assert.AreEqual("YOUR_BALANCE_PLATFORM", target.Data.BalancePlatform); + Assert.AreEqual(DateTime.Parse("2024-07-02T02:01:08+02:00"), target.Data.CreationDate); + Assert.AreEqual("BA00000000000000000001", target.Data.Id); + Assert.AreEqual("YOUR_REFERENCE", target.Data.AccountHolder.Reference); + Assert.AreEqual("EUR", target.Data.Amount.Currency); + Assert.AreEqual(-145050, target.Data.Amount.Value); + Assert.AreEqual("BA11111111111111111111", target.Data.LiableBalanceAccountId); + Assert.AreEqual(DateTime.Parse("2024-10-19T00:33:13+02:00"), target.Data.NegativeBalanceSince); + Assert.AreEqual(DateTime.Parse("2024-12-01T01:00:00+01:00"), target.Data.ScheduledCompensationAt); + Assert.AreEqual("test", target.Environment); + Assert.AreEqual(DateTime.Parse("2024-10-22T00:00:00+02:00"), target.Timestamp); + } + + [TestMethod] + public void Test_BalanceNotificationRequestWebhook() + { + // Arrange + string json = @"{ + ""data"": { + ""settingIds"": [""BWHS00000000000000000000000001""], + ""creationDate"": ""2025-01-19T13:37:38+02:00"", + ""balancePlatform"": ""YOUR_BALANCE_PLATFORM"", + ""currency"": ""USD"", + ""balances"": { + ""available"": 499900, + ""pending"": 350000, + ""reserved"": 120000, + ""balance"": 470000 + } + }, + ""environment"": ""test"", + ""type"": ""balancePlatform.balanceAccount.balance.updated"" + }"; + + // Act + _balancePlatformWebhookHandler.GetBalanceNotificationRequest(json, out BalanceNotificationRequest target); + + // Assert + Assert.IsNotNull(target); + Assert.AreEqual("YOUR_BALANCE_PLATFORM", target.Data.BalancePlatform); + Assert.AreEqual("BWHS00000000000000000000000001", target.Data.SettingIds[0]); + Assert.AreEqual(DateTime.Parse("2025-01-19T13:37:38+02:00"), target.Data.CreationDate); + Assert.AreEqual("USD", target.Data.Currency); + Assert.AreEqual(499900, target.Data.Balances.Available); + Assert.AreEqual(350000, target.Data.Balances.Pending); + Assert.AreEqual(120000, target.Data.Balances.Reserved); + Assert.AreEqual(470000, target.Data.Balances.Balance); + Assert.AreEqual("test", target.Environment); + Assert.AreEqual(BalanceNotificationRequest.TypeEnum.BalancePlatformBalanceAccountBalanceUpdated, target.Type); } + } } \ No newline at end of file diff --git a/Adyen/Model/BalanceWebhooks/AbstractOpenAPISchema.cs b/Adyen/Model/BalanceWebhooks/AbstractOpenAPISchema.cs new file mode 100644 index 000000000..adf16b160 --- /dev/null +++ b/Adyen/Model/BalanceWebhooks/AbstractOpenAPISchema.cs @@ -0,0 +1,81 @@ +/* +* Balance webhook +* +* +* 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.Generic; +using System.Reflection; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Serialization; + +namespace Adyen.Model.BalanceWebhooks +{ + /// + /// Abstract base class for oneOf, anyOf schemas in the OpenAPI specification + /// + public abstract partial class AbstractOpenAPISchema + { + /// + /// Custom JSON serializer + /// + static public readonly JsonSerializerSettings SerializerSettings = new JsonSerializerSettings + { + // OpenAPI generated types generally hide default constructors. + ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, + MissingMemberHandling = MissingMemberHandling.Ignore, + ContractResolver = new DefaultContractResolver + { + NamingStrategy = new CamelCaseNamingStrategy + { + OverrideSpecifiedNames = false + } + } + }; + + /// + /// Gets or Sets the actual instance + /// + public abstract Object ActualInstance { get; set; } + + /// + /// Gets or Sets IsNullable to indicate whether the instance is nullable + /// + public bool IsNullable { get; protected set; } + + /// + /// Gets or Sets the schema type, which can be either `oneOf` or `anyOf` + /// + public string SchemaType { get; protected set; } + + /// + /// Converts the instance into JSON string. + /// + public abstract string ToJson(); + + // Check if the contains TypeEnum value + protected static bool ContainsValue(string type) where T : struct, IConvertible + { + // Search for type in .TypeEnum + List list = new List(); + var members = typeof(T).GetTypeInfo().DeclaredMembers; + foreach (var member in members) + { + var val = member?.GetCustomAttribute(false)?.Value; + if (!string.IsNullOrEmpty(val)) + { + list.Add(val); + } + } + + return list.Contains(type); + } + } +} diff --git a/Adyen/Model/BalanceWebhooks/BalanceNotificationData.cs b/Adyen/Model/BalanceWebhooks/BalanceNotificationData.cs new file mode 100644 index 000000000..bda75fa0c --- /dev/null +++ b/Adyen/Model/BalanceWebhooks/BalanceNotificationData.cs @@ -0,0 +1,246 @@ +/* +* Balance webhook +* +* +* 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.BalanceWebhooks +{ + /// + /// BalanceNotificationData + /// + [DataContract(Name = "BalanceNotificationData")] + public partial class BalanceNotificationData : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected BalanceNotificationData() { } + /// + /// Initializes a new instance of the class. + /// + /// The unique identifier of the balance account. (required). + /// The unique identifier of the balance platform.. + /// balances (required). + /// The date and time when the event was triggered, in ISO 8601 extended format. For example, **2020-12-18T10:15:30+01:00**.. + /// TThe three-character [ISO currency code](https://docs.adyen.com/development-resources/currency-codes). (required). + /// The unique identifier of the balance webhook setting. (required). + public BalanceNotificationData(string balanceAccountId = default(string), string balancePlatform = default(string), Balances balances = default(Balances), DateTime creationDate = default(DateTime), string currency = default(string), List settingIds = default(List)) + { + this.BalanceAccountId = balanceAccountId; + this.Balances = balances; + this.Currency = currency; + this.SettingIds = settingIds; + this.BalancePlatform = balancePlatform; + this.CreationDate = creationDate; + } + + /// + /// The unique identifier of the balance account. + /// + /// The unique identifier of the balance account. + [DataMember(Name = "balanceAccountId", IsRequired = false, EmitDefaultValue = false)] + public string BalanceAccountId { get; set; } + + /// + /// The unique identifier of the balance platform. + /// + /// The unique identifier of the balance platform. + [DataMember(Name = "balancePlatform", EmitDefaultValue = false)] + public string BalancePlatform { get; set; } + + /// + /// Gets or Sets Balances + /// + [DataMember(Name = "balances", IsRequired = false, EmitDefaultValue = false)] + public Balances Balances { get; set; } + + /// + /// The date and time when the event was triggered, in ISO 8601 extended format. For example, **2020-12-18T10:15:30+01:00**. + /// + /// The date and time when the event was triggered, in ISO 8601 extended format. For example, **2020-12-18T10:15:30+01:00**. + [DataMember(Name = "creationDate", EmitDefaultValue = false)] + public DateTime CreationDate { get; set; } + + /// + /// TThe three-character [ISO currency code](https://docs.adyen.com/development-resources/currency-codes). + /// + /// TThe three-character [ISO currency code](https://docs.adyen.com/development-resources/currency-codes). + [DataMember(Name = "currency", IsRequired = false, EmitDefaultValue = false)] + public string Currency { get; set; } + + /// + /// The ID of the resource. + /// + /// The ID of the resource. + [DataMember(Name = "id", EmitDefaultValue = false)] + public string Id { get; private set; } + + /// + /// The unique identifier of the balance webhook setting. + /// + /// The unique identifier of the balance webhook setting. + [DataMember(Name = "settingIds", IsRequired = false, EmitDefaultValue = false)] + public List SettingIds { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class BalanceNotificationData {\n"); + sb.Append(" BalanceAccountId: ").Append(BalanceAccountId).Append("\n"); + sb.Append(" BalancePlatform: ").Append(BalancePlatform).Append("\n"); + sb.Append(" Balances: ").Append(Balances).Append("\n"); + sb.Append(" CreationDate: ").Append(CreationDate).Append("\n"); + sb.Append(" Currency: ").Append(Currency).Append("\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" SettingIds: ").Append(SettingIds).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as BalanceNotificationData); + } + + /// + /// Returns true if BalanceNotificationData instances are equal + /// + /// Instance of BalanceNotificationData to be compared + /// Boolean + public bool Equals(BalanceNotificationData input) + { + if (input == null) + { + return false; + } + return + ( + this.BalanceAccountId == input.BalanceAccountId || + (this.BalanceAccountId != null && + this.BalanceAccountId.Equals(input.BalanceAccountId)) + ) && + ( + this.BalancePlatform == input.BalancePlatform || + (this.BalancePlatform != null && + this.BalancePlatform.Equals(input.BalancePlatform)) + ) && + ( + this.Balances == input.Balances || + (this.Balances != null && + this.Balances.Equals(input.Balances)) + ) && + ( + this.CreationDate == input.CreationDate || + (this.CreationDate != null && + this.CreationDate.Equals(input.CreationDate)) + ) && + ( + this.Currency == input.Currency || + (this.Currency != null && + this.Currency.Equals(input.Currency)) + ) && + ( + this.Id == input.Id || + (this.Id != null && + this.Id.Equals(input.Id)) + ) && + ( + this.SettingIds == input.SettingIds || + this.SettingIds != null && + input.SettingIds != null && + this.SettingIds.SequenceEqual(input.SettingIds) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + 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.BalancePlatform != null) + { + hashCode = (hashCode * 59) + this.BalancePlatform.GetHashCode(); + } + if (this.Balances != null) + { + hashCode = (hashCode * 59) + this.Balances.GetHashCode(); + } + if (this.CreationDate != null) + { + hashCode = (hashCode * 59) + this.CreationDate.GetHashCode(); + } + if (this.Currency != null) + { + hashCode = (hashCode * 59) + this.Currency.GetHashCode(); + } + if (this.Id != null) + { + hashCode = (hashCode * 59) + this.Id.GetHashCode(); + } + if (this.SettingIds != null) + { + hashCode = (hashCode * 59) + this.SettingIds.GetHashCode(); + } + return hashCode; + } + } + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + public IEnumerable Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/Adyen/Model/BalanceWebhooks/BalanceNotificationRequest.cs b/Adyen/Model/BalanceWebhooks/BalanceNotificationRequest.cs new file mode 100644 index 000000000..a3213657b --- /dev/null +++ b/Adyen/Model/BalanceWebhooks/BalanceNotificationRequest.cs @@ -0,0 +1,201 @@ +/* +* Balance webhook +* +* +* 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.BalanceWebhooks +{ + /// + /// BalanceNotificationRequest + /// + [DataContract(Name = "BalanceNotificationRequest")] + public partial class BalanceNotificationRequest : IEquatable, IValidatableObject + { + /// + /// Type of webhook. + /// + /// Type of webhook. + [JsonConverter(typeof(StringEnumConverter))] + public enum TypeEnum + { + /// + /// Enum BalancePlatformBalanceAccountBalanceUpdated for value: balancePlatform.balanceAccount.balance.updated + /// + [EnumMember(Value = "balancePlatform.balanceAccount.balance.updated")] + BalancePlatformBalanceAccountBalanceUpdated = 1 + + } + + + /// + /// Type of webhook. + /// + /// Type of webhook. + [DataMember(Name = "type", IsRequired = false, EmitDefaultValue = false)] + public TypeEnum Type { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected BalanceNotificationRequest() { } + /// + /// Initializes a new instance of the class. + /// + /// data (required). + /// The environment from which the webhook originated. Possible values: **test**, **live**. (required). + /// When the event was queued.. + /// Type of webhook. (required). + public BalanceNotificationRequest(BalanceNotificationData data = default(BalanceNotificationData), string environment = default(string), DateTime timestamp = default(DateTime), TypeEnum type = default(TypeEnum)) + { + this.Data = data; + this.Environment = environment; + this.Type = type; + this.Timestamp = timestamp; + } + + /// + /// Gets or Sets Data + /// + [DataMember(Name = "data", IsRequired = false, EmitDefaultValue = false)] + public BalanceNotificationData Data { get; set; } + + /// + /// The environment from which the webhook originated. Possible values: **test**, **live**. + /// + /// The environment from which the webhook originated. Possible values: **test**, **live**. + [DataMember(Name = "environment", IsRequired = false, EmitDefaultValue = false)] + public string Environment { get; set; } + + /// + /// When the event was queued. + /// + /// When the event was queued. + [DataMember(Name = "timestamp", EmitDefaultValue = false)] + public DateTime Timestamp { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class BalanceNotificationRequest {\n"); + sb.Append(" Data: ").Append(Data).Append("\n"); + sb.Append(" Environment: ").Append(Environment).Append("\n"); + sb.Append(" Timestamp: ").Append(Timestamp).Append("\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as BalanceNotificationRequest); + } + + /// + /// Returns true if BalanceAccountBalanceNotificationRequest instances are equal + /// + /// Instance of BalanceAccountBalanceNotificationRequest to be compared + /// Boolean + public bool Equals(BalanceNotificationRequest input) + { + if (input == null) + { + return false; + } + return + ( + this.Data == input.Data || + (this.Data != null && + this.Data.Equals(input.Data)) + ) && + ( + this.Environment == input.Environment || + (this.Environment != null && + this.Environment.Equals(input.Environment)) + ) && + ( + this.Timestamp == input.Timestamp || + (this.Timestamp != null && + this.Timestamp.Equals(input.Timestamp)) + ) && + ( + this.Type == input.Type || + this.Type.Equals(input.Type) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Data != null) + { + hashCode = (hashCode * 59) + this.Data.GetHashCode(); + } + if (this.Environment != null) + { + hashCode = (hashCode * 59) + this.Environment.GetHashCode(); + } + if (this.Timestamp != null) + { + hashCode = (hashCode * 59) + this.Timestamp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Type.GetHashCode(); + return hashCode; + } + } + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + public IEnumerable Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/Adyen/Model/BalanceWebhooks/BalanceNotificationResponse.cs b/Adyen/Model/BalanceWebhooks/BalanceNotificationResponse.cs new file mode 100644 index 000000000..dc8d301cf --- /dev/null +++ b/Adyen/Model/BalanceWebhooks/BalanceNotificationResponse.cs @@ -0,0 +1,129 @@ +/* +* Balance webhook +* +* +* 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.BalanceWebhooks +{ + /// + /// BalanaceNotificationResponse + /// + [DataContract(Name = "BalancePlatformNotificationResponse")] + public partial class BalanceNotificationResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// Respond with any **2xx** HTTP status code to [accept the webhook](https://docs.adyen.com/development-resources/webhooks#accept-notifications).. + public BalanceNotificationResponse(string notificationResponse = default(string)) + { + this.NotificationResponse = notificationResponse; + } + + /// + /// Respond with any **2xx** HTTP status code to [accept the webhook](https://docs.adyen.com/development-resources/webhooks#accept-notifications). + /// + /// Respond with any **2xx** HTTP status code to [accept the webhook](https://docs.adyen.com/development-resources/webhooks#accept-notifications). + [DataMember(Name = "notificationResponse", EmitDefaultValue = false)] + public string NotificationResponse { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class BalanceNotificationResponse {\n"); + sb.Append(" NotificationResponse: ").Append(NotificationResponse).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as BalanceNotificationResponse); + } + + /// + /// Returns true if BalancePlatformNotificationResponse instances are equal + /// + /// Instance of BalancePlatformNotificationResponse to be compared + /// Boolean + public bool Equals(BalanceNotificationResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.NotificationResponse == input.NotificationResponse || + (this.NotificationResponse != null && + this.NotificationResponse.Equals(input.NotificationResponse)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.NotificationResponse != null) + { + hashCode = (hashCode * 59) + this.NotificationResponse.GetHashCode(); + } + return hashCode; + } + } + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + public IEnumerable Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/Adyen/Model/BalanceWebhooks/Balances.cs b/Adyen/Model/BalanceWebhooks/Balances.cs new file mode 100644 index 000000000..74451eb8f --- /dev/null +++ b/Adyen/Model/BalanceWebhooks/Balances.cs @@ -0,0 +1,170 @@ +/* +* Balance webhook +* +* +* 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.BalanceWebhooks +{ + /// + /// Balances + /// + [DataContract(Name = "Balances")] + public partial class Balances : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// The balance that is available for use.. + /// The sum of transactions that have already been settled.. + /// The sum of transactions that will be settled in the future.. + /// The balance currently held in reserve.. + public Balances(long? available = default(long?), long? balance = default(long?), long? pending = default(long?), long? reserved = default(long?)) + { + this.Available = available; + this.Balance = balance; + this.Pending = pending; + this.Reserved = reserved; + } + + /// + /// The balance that is available for use. + /// + /// The balance that is available for use. + [DataMember(Name = "available", EmitDefaultValue = false)] + public long? Available { get; set; } + + /// + /// The sum of transactions that have already been settled. + /// + /// The sum of transactions that have already been settled. + [DataMember(Name = "balance", EmitDefaultValue = false)] + public long? Balance { get; set; } + + /// + /// The sum of transactions that will be settled in the future. + /// + /// The sum of transactions that will be settled in the future. + [DataMember(Name = "pending", EmitDefaultValue = false)] + public long? Pending { get; set; } + + /// + /// The balance currently held in reserve. + /// + /// The balance currently held in reserve. + [DataMember(Name = "reserved", EmitDefaultValue = false)] + public long? Reserved { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Balances {\n"); + sb.Append(" Available: ").Append(Available).Append("\n"); + sb.Append(" Balance: ").Append(Balance).Append("\n"); + sb.Append(" Pending: ").Append(Pending).Append("\n"); + sb.Append(" Reserved: ").Append(Reserved).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as Balances); + } + + /// + /// Returns true if Balances instances are equal + /// + /// Instance of Balances to be compared + /// Boolean + public bool Equals(Balances input) + { + if (input == null) + { + return false; + } + return + ( + this.Available == input.Available || + this.Available.Equals(input.Available) + ) && + ( + this.Balance == input.Balance || + this.Balance.Equals(input.Balance) + ) && + ( + this.Pending == input.Pending || + this.Pending.Equals(input.Pending) + ) && + ( + this.Reserved == input.Reserved || + this.Reserved.Equals(input.Reserved) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.Available.GetHashCode(); + hashCode = (hashCode * 59) + this.Balance.GetHashCode(); + hashCode = (hashCode * 59) + this.Pending.GetHashCode(); + hashCode = (hashCode * 59) + this.Reserved.GetHashCode(); + return hashCode; + } + } + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + public IEnumerable Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/Adyen/Webhooks/BalancePlatformWebhookHandler.cs b/Adyen/Webhooks/BalancePlatformWebhookHandler.cs index 1e4a72b4e..5f8084d7c 100644 --- a/Adyen/Webhooks/BalancePlatformWebhookHandler.cs +++ b/Adyen/Webhooks/BalancePlatformWebhookHandler.cs @@ -4,6 +4,7 @@ using System.Reflection; using System.Runtime.Serialization; using Adyen.Model.AcsWebhooks; +using Adyen.Model.BalanceWebhooks; using Adyen.Model.ReportWebhooks; using Adyen.Model.ConfigurationWebhooks; using Adyen.Model.NegativeBalanceWarningWebhooks; @@ -39,6 +40,11 @@ public dynamic GetGenericBalancePlatformWebhook(string jsonPayload) { return balanceAccountNotificationRequest; } + + if (GetBalanceNotificationRequest(jsonPayload, out BalanceNotificationRequest balanceNotificationRequest)) + { + return balanceNotificationRequest; + } if (GetCardOrderNotificationRequest(jsonPayload, out CardOrderNotificationRequest cardOrderNotificationRequest)) { @@ -119,6 +125,21 @@ public bool GetBalanceAccountNotificationRequest(string jsonPayload, out Balance result = JsonConvert.DeserializeObject(jsonPayload); return true; } + + /// + /// Deserializes from the . + /// + /// The json payload of the webhook. + /// . + /// A return value indicates whether the deserialization succeeded. + /// Throws when json is invalid. + public bool GetBalanceNotificationRequest(string jsonPayload, out BalanceNotificationRequest result) + { + result = null; + if (!ContainsValue(jsonPayload)) return false; + result = JsonConvert.DeserializeObject(jsonPayload); + return true; + } /// /// Deserializes from the .