From 5aba23c1b9a552badfc919800cc4516ddfa87a72 Mon Sep 17 00:00:00 2001 From: Ingenico ePayments Date: Wed, 14 Feb 2024 09:21:59 +0100 Subject: [PATCH] Release 3.47.0. --- .github/workflows/deploy.yml | 38 +++++ .../Disputes/UploadDisputeFileExample.cs | 1 - .../Merchant/Payments/FindPaymentsExample.cs | 1 - .../Merchant/Payouts/FindPayoutsExample.cs | 1 - .../GetPaymentProductGroupExample.cs | 2 +- .../GetPaymentProductGroupsExample.cs | 2 +- .../Merchant/Products/GetDirectoryExample.cs | 1 - .../Merchant/Products/GetNetworksExample.cs | 1 - .../Products/GetPaymentProductExample.cs | 2 +- .../Products/GetPaymentProductsExample.cs | 2 +- .../Merchant/Refunds/FindRefundsExample.cs | 1 - .../Merchant/Services/ConvertAmountExample.cs | 1 - .../Services/GetPrivacyPolicyExample.cs | 1 - .../Merchant/Tokens/DeleteTokenExample.cs | 2 - .../connect-sdk-dotnet-examples.csproj | 4 +- .../connect-sdk-dotnet-it.csproj | 4 +- connect-sdk-dotnet-tests/CommunicatorTest.cs | 8 +- .../Defaultimpl/DefaultAuthenticatorTest.cs | 8 +- .../Logging/SysOutCommunicatorLoggerTest.cs | 3 +- .../connect-sdk-dotnet-tests.csproj | 4 +- .../connect-sdk-dotnet.StrongName.csproj | 4 +- connect-sdk-dotnet/AbstractParamRequest.cs | 4 +- connect-sdk-dotnet/ApiResource.cs | 32 ++-- connect-sdk-dotnet/Communicator.cs | 157 +++++++++--------- .../CommunicatorConfiguration.cs | 24 +-- .../CommunicatorConfigurationSection.cs | 6 +- .../CamelCaseKeepFullCapsNamingStrategy.cs | 2 +- .../DefaultImpl/DefaultAuthenticator.cs | 4 +- .../DefaultImpl/DefaultConnection.cs | 28 ++-- .../DefaultImpl/DefaultMarshaller.cs | 8 +- .../Domain/Definitions/AirlineData.cs | 2 +- .../Domain/Definitions/AirlineFlightLeg.cs | 2 +- .../Domain/Definitions/CustomerBase.cs | 2 +- .../Domain/Definitions/FraudFields.cs | 24 +-- .../Definitions/FraudFieldsShippingDetails.cs | 8 +- .../Definitions/CreatedPaymentOutput.cs | 2 +- .../AbstractCardPaymentMethodSpecificInput.cs | 6 +- ...rectDebitPaymentProduct771SpecificInput.cs | 2 +- .../Definitions/AccountFundingRecipient.cs | 1 + .../Definitions/AdditionalOrderInput.cs | 6 +- .../CardPaymentMethodSpecificInput.cs | 4 +- .../CashPaymentMethodSpecificInput.cs | 2 +- .../CashPaymentProduct1503SpecificInput.cs | 4 +- .../Domain/Payment/Definitions/Customer.cs | 2 +- .../Definitions/DecryptedPaymentData.cs | 2 +- .../Definitions/DeviceRenderOptions.cs | 2 +- .../ExternalCardholderAuthenticationData.cs | 2 +- .../Payment/Definitions/Level3SummaryData.cs | 8 +- .../Domain/Payment/Definitions/LineItem.cs | 2 +- .../Payment/Definitions/LoanRecipient.cs | 12 +- .../Domain/Payment/Definitions/Order.cs | 4 +- .../Definitions/OrderTypeInformation.cs | 3 + .../RedirectPaymentMethodSpecificInput.cs | 2 +- .../RedirectPaymentProduct809SpecificInput.cs | 2 +- .../RedirectPaymentProduct840SpecificInput.cs | 2 +- .../Domain/Payment/PaymentApprovalResponse.cs | 2 +- .../Domain/Payout/CreatePayoutRequest.cs | 16 +- .../BankTransferPayoutMethodSpecificInput.cs | 2 +- .../Definitions/ValueMappingElement.cs | 2 +- .../Definitions/CustomerRiskAssessment.cs | 2 +- .../Domain/Webhooks/WebhooksEvent.cs | 1 - connect-sdk-dotnet/EntityHeader.cs | 11 +- connect-sdk-dotnet/Factory.cs | 4 +- .../IMultipartFormDataRequest.cs | 4 - connect-sdk-dotnet/Logging/BodyObfuscator.cs | 6 +- .../Logging/HeaderObfuscator.cs | 6 +- .../Logging/IObfuscationCapable.cs | 8 +- .../Logging/LogMessageBuilder.cs | 8 +- connect-sdk-dotnet/Logging/LoggingUtil.cs | 2 - .../Logging/NLogCommunicatorLogger.cs | 2 +- connect-sdk-dotnet/Logging/ObfuscationRule.cs | 10 +- .../Logging/RequestLogMessageBuilder.cs | 10 +- .../Logging/ResponseLogMessageBuilder.cs | 22 +-- .../SystemConsoleCommunicatorLogger.cs | 2 +- connect-sdk-dotnet/Logging/ValueObfuscator.cs | 2 +- .../Merchant/Disputes/UploadFileRequest.cs | 3 - .../Merchant/Payments/FindPaymentsParams.cs | 1 - .../Merchant/Payouts/FindPayoutsParams.cs | 1 - .../Productgroups/FindProductgroupsParams.cs | 14 +- .../Productgroups/GetProductgroupParams.cs | 14 +- .../Merchant/Products/DirectoryParams.cs | 1 - .../Merchant/Products/FindProductsParams.cs | 14 +- .../Merchant/Products/GetProductParams.cs | 14 +- .../Merchant/Products/NetworksParams.cs | 1 - .../Merchant/Refunds/FindRefundsParams.cs | 1 - .../Merchant/Services/ConvertAmountParams.cs | 1 - .../Merchant/Services/PrivacypolicyParams.cs | 1 - .../Merchant/Tokens/DeleteTokenParams.cs | 1 - connect-sdk-dotnet/MetaDataProvider.cs | 32 ++-- connect-sdk-dotnet/MetaDataProviderBuilder.cs | 5 +- connect-sdk-dotnet/MultipartFormDataObject.cs | 16 +- connect-sdk-dotnet/ProxyConfiguration.cs | 2 +- connect-sdk-dotnet/RequestHeader.cs | 9 +- connect-sdk-dotnet/RequestParam.cs | 7 +- connect-sdk-dotnet/ResponseException.cs | 4 +- connect-sdk-dotnet/ResponseHeader.cs | 7 +- connect-sdk-dotnet/Session.cs | 4 +- .../ShoppingCartExtensionConfiguration.cs | 2 +- connect-sdk-dotnet/StringBuilderUtils.cs | 2 +- connect-sdk-dotnet/StringUtils.cs | 2 +- connect-sdk-dotnet/UriBuilderExtensions.cs | 2 +- connect-sdk-dotnet/UriConfiguration.cs | 2 +- connect-sdk-dotnet/UriUtils.cs | 5 +- .../Webhooks/ApiVersionMismatchException.cs | 2 +- .../Webhooks/ISecretKeyStore.cs | 2 - .../Webhooks/InMemorySecretKeyStore.cs | 13 +- connect-sdk-dotnet/Webhooks/WebhooksHelper.cs | 2 +- .../Webhooks/WebhooksHelperBuilder.cs | 4 +- connect-sdk-dotnet/connect-sdk-dotnet.csproj | 4 +- 109 files changed, 386 insertions(+), 395 deletions(-) create mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 00000000..da838602 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,38 @@ +name: Deploy + +on: + push: + tags: ['[0-9]+.[0-9]+*'] + +env: + SDK_VERSION: ${{ github.ref_name }} + +jobs: + deploy: + # Build on Windows 2022 to support .NET Framework 4.5 + runs-on: windows-2022 + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + persist-credentials: false + - name: Setup .NET + uses: actions/setup-dotnet@v3 + with: + dotnet-version: | + 2.1 + 3.1 + - name: Build + run: | + dotnet restore connect-sdk-dotnet + dotnet build -c Release connect-sdk-dotnet + dotnet pack -c Release connect-sdk-dotnet + dotnet restore connect-sdk-dotnet.StrongName + dotnet build -c Release connect-sdk-dotnet.StrongName + dotnet pack -c Release connect-sdk-dotnet.StrongName + - name: Deploy + run: | + dotnet nuget push connect-sdk-dotnet/bin/Release/connect-sdk-dotnet.${env:SDK_VERSION}.nupkg --api-key "${env:NUGET_API_KEY}" --source https://api.nuget.org/v3/index.json + dotnet nuget push connect-sdk-dotnet.StrongName/bin/Release/connect-sdk-dotnet.StrongName.${env:SDK_VERSION}.nupkg --api-key "${env:NUGET_API_KEY}" --source https://api.nuget.org/v3/index.json + env: + NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} diff --git a/connect-sdk-dotnet-examples/Merchant/Disputes/UploadDisputeFileExample.cs b/connect-sdk-dotnet-examples/Merchant/Disputes/UploadDisputeFileExample.cs index 57390fca..1ccf8652 100644 --- a/connect-sdk-dotnet-examples/Merchant/Disputes/UploadDisputeFileExample.cs +++ b/connect-sdk-dotnet-examples/Merchant/Disputes/UploadDisputeFileExample.cs @@ -3,7 +3,6 @@ * https://epayments-api.developer-ingenico.com/ */ using Ingenico.Connect.Sdk.Domain.Dispute; -using Ingenico.Connect.Sdk.Merchant.Disputes; using System.IO; namespace Ingenico.Connect.Sdk.Merchant.Disputes diff --git a/connect-sdk-dotnet-examples/Merchant/Payments/FindPaymentsExample.cs b/connect-sdk-dotnet-examples/Merchant/Payments/FindPaymentsExample.cs index fa56a296..62ad8998 100644 --- a/connect-sdk-dotnet-examples/Merchant/Payments/FindPaymentsExample.cs +++ b/connect-sdk-dotnet-examples/Merchant/Payments/FindPaymentsExample.cs @@ -3,7 +3,6 @@ * https://epayments-api.developer-ingenico.com/ */ using Ingenico.Connect.Sdk.Domain.Payment; -using Ingenico.Connect.Sdk.Merchant.Payments; namespace Ingenico.Connect.Sdk.Merchant.Payments { diff --git a/connect-sdk-dotnet-examples/Merchant/Payouts/FindPayoutsExample.cs b/connect-sdk-dotnet-examples/Merchant/Payouts/FindPayoutsExample.cs index 0e135097..ca401280 100644 --- a/connect-sdk-dotnet-examples/Merchant/Payouts/FindPayoutsExample.cs +++ b/connect-sdk-dotnet-examples/Merchant/Payouts/FindPayoutsExample.cs @@ -3,7 +3,6 @@ * https://epayments-api.developer-ingenico.com/ */ using Ingenico.Connect.Sdk.Domain.Payout; -using Ingenico.Connect.Sdk.Merchant.Payouts; namespace Ingenico.Connect.Sdk.Merchant.Payouts { diff --git a/connect-sdk-dotnet-examples/Merchant/Productgroups/GetPaymentProductGroupExample.cs b/connect-sdk-dotnet-examples/Merchant/Productgroups/GetPaymentProductGroupExample.cs index 7c482f10..ecd722c5 100644 --- a/connect-sdk-dotnet-examples/Merchant/Productgroups/GetPaymentProductGroupExample.cs +++ b/connect-sdk-dotnet-examples/Merchant/Productgroups/GetPaymentProductGroupExample.cs @@ -3,7 +3,6 @@ * https://epayments-api.developer-ingenico.com/ */ using Ingenico.Connect.Sdk.Domain.Product; -using Ingenico.Connect.Sdk.Merchant.Productgroups; namespace Ingenico.Connect.Sdk.Merchant.Productgroups { @@ -20,6 +19,7 @@ public async void Example() query.Locale = "en_US"; query.Amount = 1000L; query.IsRecurring = true; + query.IsInstallments = true; query.AddHide("fields"); PaymentProductGroupResponse response = await client.Merchant("merchantId").Productgroups().Get("cards", query); diff --git a/connect-sdk-dotnet-examples/Merchant/Productgroups/GetPaymentProductGroupsExample.cs b/connect-sdk-dotnet-examples/Merchant/Productgroups/GetPaymentProductGroupsExample.cs index 6e4dab1c..5e7b254a 100644 --- a/connect-sdk-dotnet-examples/Merchant/Productgroups/GetPaymentProductGroupsExample.cs +++ b/connect-sdk-dotnet-examples/Merchant/Productgroups/GetPaymentProductGroupsExample.cs @@ -3,7 +3,6 @@ * https://epayments-api.developer-ingenico.com/ */ using Ingenico.Connect.Sdk.Domain.Product; -using Ingenico.Connect.Sdk.Merchant.Productgroups; namespace Ingenico.Connect.Sdk.Merchant.Productgroups { @@ -20,6 +19,7 @@ public async void Example() query.Locale = "en_US"; query.Amount = 1000L; query.IsRecurring = true; + query.IsInstallments = true; query.AddHide("fields"); PaymentProductGroups response = await client.Merchant("merchantId").Productgroups().Find(query); diff --git a/connect-sdk-dotnet-examples/Merchant/Products/GetDirectoryExample.cs b/connect-sdk-dotnet-examples/Merchant/Products/GetDirectoryExample.cs index 0fd096b1..1924fb5c 100644 --- a/connect-sdk-dotnet-examples/Merchant/Products/GetDirectoryExample.cs +++ b/connect-sdk-dotnet-examples/Merchant/Products/GetDirectoryExample.cs @@ -3,7 +3,6 @@ * https://epayments-api.developer-ingenico.com/ */ using Ingenico.Connect.Sdk.Domain.Product; -using Ingenico.Connect.Sdk.Merchant.Products; namespace Ingenico.Connect.Sdk.Merchant.Products { diff --git a/connect-sdk-dotnet-examples/Merchant/Products/GetNetworksExample.cs b/connect-sdk-dotnet-examples/Merchant/Products/GetNetworksExample.cs index a5af8afd..5b4a7bae 100644 --- a/connect-sdk-dotnet-examples/Merchant/Products/GetNetworksExample.cs +++ b/connect-sdk-dotnet-examples/Merchant/Products/GetNetworksExample.cs @@ -3,7 +3,6 @@ * https://epayments-api.developer-ingenico.com/ */ using Ingenico.Connect.Sdk.Domain.Product; -using Ingenico.Connect.Sdk.Merchant.Products; namespace Ingenico.Connect.Sdk.Merchant.Products { diff --git a/connect-sdk-dotnet-examples/Merchant/Products/GetPaymentProductExample.cs b/connect-sdk-dotnet-examples/Merchant/Products/GetPaymentProductExample.cs index 2eec35ef..2d163693 100644 --- a/connect-sdk-dotnet-examples/Merchant/Products/GetPaymentProductExample.cs +++ b/connect-sdk-dotnet-examples/Merchant/Products/GetPaymentProductExample.cs @@ -3,7 +3,6 @@ * https://epayments-api.developer-ingenico.com/ */ using Ingenico.Connect.Sdk.Domain.Product; -using Ingenico.Connect.Sdk.Merchant.Products; namespace Ingenico.Connect.Sdk.Merchant.Products { @@ -20,6 +19,7 @@ public async void Example() query.Locale = "en_US"; query.Amount = 1000L; query.IsRecurring = true; + query.IsInstallments = true; query.ForceBasicFlow = false; query.AddHide("fields"); diff --git a/connect-sdk-dotnet-examples/Merchant/Products/GetPaymentProductsExample.cs b/connect-sdk-dotnet-examples/Merchant/Products/GetPaymentProductsExample.cs index 7fa4ffaa..0fd21a3a 100644 --- a/connect-sdk-dotnet-examples/Merchant/Products/GetPaymentProductsExample.cs +++ b/connect-sdk-dotnet-examples/Merchant/Products/GetPaymentProductsExample.cs @@ -3,7 +3,6 @@ * https://epayments-api.developer-ingenico.com/ */ using Ingenico.Connect.Sdk.Domain.Product; -using Ingenico.Connect.Sdk.Merchant.Products; namespace Ingenico.Connect.Sdk.Merchant.Products { @@ -20,6 +19,7 @@ public async void Example() query.Locale = "en_US"; query.Amount = 1000L; query.IsRecurring = true; + query.IsInstallments = true; query.AddHide("fields"); PaymentProducts response = await client.Merchant("merchantId").Products().Find(query); diff --git a/connect-sdk-dotnet-examples/Merchant/Refunds/FindRefundsExample.cs b/connect-sdk-dotnet-examples/Merchant/Refunds/FindRefundsExample.cs index cbba12a7..2b11bf49 100644 --- a/connect-sdk-dotnet-examples/Merchant/Refunds/FindRefundsExample.cs +++ b/connect-sdk-dotnet-examples/Merchant/Refunds/FindRefundsExample.cs @@ -3,7 +3,6 @@ * https://epayments-api.developer-ingenico.com/ */ using Ingenico.Connect.Sdk.Domain.Refund; -using Ingenico.Connect.Sdk.Merchant.Refunds; namespace Ingenico.Connect.Sdk.Merchant.Refunds { diff --git a/connect-sdk-dotnet-examples/Merchant/Services/ConvertAmountExample.cs b/connect-sdk-dotnet-examples/Merchant/Services/ConvertAmountExample.cs index 87b81e83..a0a0d8ed 100644 --- a/connect-sdk-dotnet-examples/Merchant/Services/ConvertAmountExample.cs +++ b/connect-sdk-dotnet-examples/Merchant/Services/ConvertAmountExample.cs @@ -3,7 +3,6 @@ * https://epayments-api.developer-ingenico.com/ */ using Ingenico.Connect.Sdk.Domain.Services; -using Ingenico.Connect.Sdk.Merchant.Services; namespace Ingenico.Connect.Sdk.Merchant.Services { diff --git a/connect-sdk-dotnet-examples/Merchant/Services/GetPrivacyPolicyExample.cs b/connect-sdk-dotnet-examples/Merchant/Services/GetPrivacyPolicyExample.cs index 68dd9b83..ad35f752 100644 --- a/connect-sdk-dotnet-examples/Merchant/Services/GetPrivacyPolicyExample.cs +++ b/connect-sdk-dotnet-examples/Merchant/Services/GetPrivacyPolicyExample.cs @@ -3,7 +3,6 @@ * https://epayments-api.developer-ingenico.com/ */ using Ingenico.Connect.Sdk.Domain.Services; -using Ingenico.Connect.Sdk.Merchant.Services; namespace Ingenico.Connect.Sdk.Merchant.Services { diff --git a/connect-sdk-dotnet-examples/Merchant/Tokens/DeleteTokenExample.cs b/connect-sdk-dotnet-examples/Merchant/Tokens/DeleteTokenExample.cs index 255a1bff..49ce9e29 100644 --- a/connect-sdk-dotnet-examples/Merchant/Tokens/DeleteTokenExample.cs +++ b/connect-sdk-dotnet-examples/Merchant/Tokens/DeleteTokenExample.cs @@ -2,8 +2,6 @@ * This class was auto-generated from the API references found at * https://epayments-api.developer-ingenico.com/ */ -using Ingenico.Connect.Sdk.Merchant.Tokens; - namespace Ingenico.Connect.Sdk.Merchant.Tokens { public class DeleteTokenExample diff --git a/connect-sdk-dotnet-examples/connect-sdk-dotnet-examples.csproj b/connect-sdk-dotnet-examples/connect-sdk-dotnet-examples.csproj index 65688415..a2288314 100644 --- a/connect-sdk-dotnet-examples/connect-sdk-dotnet-examples.csproj +++ b/connect-sdk-dotnet-examples/connect-sdk-dotnet-examples.csproj @@ -3,8 +3,8 @@ net45;netstandard2.0;netstandard2.1 Ingenico.Connect.Sdk - 3.46.0 - 3.46.0 + 3.47.0 + 3.47.0 false Ingenico ePayments Ingenico Connect .NET SDK examples diff --git a/connect-sdk-dotnet-it/connect-sdk-dotnet-it.csproj b/connect-sdk-dotnet-it/connect-sdk-dotnet-it.csproj index c5162210..7fe4587c 100644 --- a/connect-sdk-dotnet-it/connect-sdk-dotnet-it.csproj +++ b/connect-sdk-dotnet-it/connect-sdk-dotnet-it.csproj @@ -3,8 +3,8 @@ net45;netcoreapp2.1;netcoreapp3.1 Ingenico.Connect.Sdk - 3.46.0 - 3.46.0 + 3.47.0 + 3.47.0 false Ingenico ePayments Ingenico Connect .NET SDK integration tests diff --git a/connect-sdk-dotnet-tests/CommunicatorTest.cs b/connect-sdk-dotnet-tests/CommunicatorTest.cs index 149e0bbc..7e36c22c 100644 --- a/connect-sdk-dotnet-tests/CommunicatorTest.cs +++ b/connect-sdk-dotnet-tests/CommunicatorTest.cs @@ -17,8 +17,8 @@ public void TestToURIWithoutRequestParams() sessionMock.SetupGet(x => x.ApiEndpoint).Returns(baseUri); Communicator communicator = new Communicator(sessionMock.Object, DefaultImpl.DefaultMarshaller.Instance); - Uri uri = communicator.ToAbsoluteURI("v1/merchant/20000/convertamount", new List()); - Uri uri2 = communicator.ToAbsoluteURI("/v1/merchant/20000/convertamount", new List()); + Uri uri = communicator.ToAbsoluteUri("v1/merchant/20000/convertamount", new List()); + Uri uri2 = communicator.ToAbsoluteUri("/v1/merchant/20000/convertamount", new List()); Assert.That(uri, Is.EqualTo(new Uri("https://eu.sandbox.api-ingenico.com/v1/merchant/20000/convertamount"))); Assert.That(uri2, Is.EqualTo(new Uri("https://eu.sandbox.api-ingenico.com/v1/merchant/20000/convertamount"))); @@ -34,8 +34,8 @@ public void TestToURIWithRequestParams() list.Add(new RequestParam("dummy", "é&%=")); sessionMock.SetupGet(x => x.ApiEndpoint).Returns(baseUri); var communicator = new Communicator(sessionMock.Object, DefaultImpl.DefaultMarshaller.Instance); - Uri uri = communicator.ToAbsoluteURI("v1/merchant/20000/convertamount", list); - Uri uri2 = communicator.ToAbsoluteURI("/v1/merchant/20000/convertamount", list); + Uri uri = communicator.ToAbsoluteUri("v1/merchant/20000/convertamount", list); + Uri uri2 = communicator.ToAbsoluteUri("/v1/merchant/20000/convertamount", list); Assert.AreEqual(new Uri("https://eu.sandbox.api-ingenico.com/v1/merchant/20000/convertamount?amount=123&source=USD&target=EUR&dummy=%C3%A9%26%25%3D"), uri); Assert.AreEqual(new Uri("https://eu.sandbox.api-ingenico.com/v1/merchant/20000/convertamount?amount=123&source=USD&target=EUR&dummy=%C3%A9%26%25%3D"), uri2); diff --git a/connect-sdk-dotnet-tests/Defaultimpl/DefaultAuthenticatorTest.cs b/connect-sdk-dotnet-tests/Defaultimpl/DefaultAuthenticatorTest.cs index f5fe77a1..5524944b 100644 --- a/connect-sdk-dotnet-tests/Defaultimpl/DefaultAuthenticatorTest.cs +++ b/connect-sdk-dotnet-tests/Defaultimpl/DefaultAuthenticatorTest.cs @@ -11,16 +11,14 @@ public class DefaultAuthenticatorTest [TestCase] public void TestToCanonicalizeHeaderValue() { - DefaultAuthenticator authenticator = new DefaultAuthenticator(AuthorizationType.V1HMAC, "apiKeyId", "secretApiKey"); - Assert.AreEqual("aap noot", authenticator.ToCanonicalizeHeaderValue("aap\nnoot ")); - Assert.AreEqual("aap noot", authenticator.ToCanonicalizeHeaderValue(" aap\r\n noot")); + Assert.AreEqual("aap noot", DefaultAuthenticator.ToCanonicalizeHeaderValue("aap\nnoot ")); + Assert.AreEqual("aap noot", DefaultAuthenticator.ToCanonicalizeHeaderValue(" aap\r\n noot")); } [TestCase] public void TestToCanonicalizeHeaderValue2() { - DefaultAuthenticator authenticator = new DefaultAuthenticator(AuthorizationType.V1HMAC, "apiKeyId", "secretApiKey"); - var val1 = authenticator.ToCanonicalizeHeaderValue(" some value \r\n \n with some \r\n spaces "); + var val1 = DefaultAuthenticator.ToCanonicalizeHeaderValue(" some value \r\n \n with some \r\n spaces "); Assert.AreEqual("some value with some spaces", val1); } diff --git a/connect-sdk-dotnet-tests/Logging/SysOutCommunicatorLoggerTest.cs b/connect-sdk-dotnet-tests/Logging/SysOutCommunicatorLoggerTest.cs index e4c2fdb3..d3e0c763 100644 --- a/connect-sdk-dotnet-tests/Logging/SysOutCommunicatorLoggerTest.cs +++ b/connect-sdk-dotnet-tests/Logging/SysOutCommunicatorLoggerTest.cs @@ -55,7 +55,8 @@ public void TestLogWithException() { ICommunicatorLogger logger = SystemConsoleCommunicatorLogger.Instance; var exception = new Exception(); - try{ + try + { throw exception; } catch (Exception e) { diff --git a/connect-sdk-dotnet-tests/connect-sdk-dotnet-tests.csproj b/connect-sdk-dotnet-tests/connect-sdk-dotnet-tests.csproj index 5ae0762f..803f038a 100644 --- a/connect-sdk-dotnet-tests/connect-sdk-dotnet-tests.csproj +++ b/connect-sdk-dotnet-tests/connect-sdk-dotnet-tests.csproj @@ -3,8 +3,8 @@ net45;netcoreapp2.1;netcoreapp3.1 Ingenico.Connect.Sdk - 3.46.0 - 3.46.0 + 3.47.0 + 3.47.0 false Ingenico ePayments Ingenico Connect .NET SDK unit tests diff --git a/connect-sdk-dotnet.StrongName/connect-sdk-dotnet.StrongName.csproj b/connect-sdk-dotnet.StrongName/connect-sdk-dotnet.StrongName.csproj index 1d103a29..a68bf981 100644 --- a/connect-sdk-dotnet.StrongName/connect-sdk-dotnet.StrongName.csproj +++ b/connect-sdk-dotnet.StrongName/connect-sdk-dotnet.StrongName.csproj @@ -3,8 +3,8 @@ net45;netstandard2.0;netstandard2.1 Ingenico.Connect.Sdk - 3.46.0 - 3.46.0 + 3.47.0 + 3.47.0 true Ingenico ePayments Ingenico Connect .NET SDK diff --git a/connect-sdk-dotnet/AbstractParamRequest.cs b/connect-sdk-dotnet/AbstractParamRequest.cs index afa1c326..2e04b5db 100644 --- a/connect-sdk-dotnet/AbstractParamRequest.cs +++ b/connect-sdk-dotnet/AbstractParamRequest.cs @@ -5,8 +5,8 @@ namespace Ingenico.Connect.Sdk /// /// Represents a set of request parameters. /// - abstract public class AbstractParamRequest + public abstract class AbstractParamRequest { - abstract public IEnumerable ToRequestParameters(); + public abstract IEnumerable ToRequestParameters(); } } diff --git a/connect-sdk-dotnet/ApiResource.cs b/connect-sdk-dotnet/ApiResource.cs index dad0b0d2..d39a81ad 100644 --- a/connect-sdk-dotnet/ApiResource.cs +++ b/connect-sdk-dotnet/ApiResource.cs @@ -41,7 +41,7 @@ protected List ClientHeaders protected ApiResource(ApiResource parent, IDictionary pathContext) { - _parent = parent ?? throw new ArgumentException("parent is required"); ; + _parent = parent ?? throw new ArgumentException("parent is required"); _communicator = parent._communicator; _pathContext = pathContext; _clientMetaInfo = parent._clientMetaInfo; @@ -50,7 +50,7 @@ protected ApiResource(ApiResource parent, IDictionary pathContex protected ApiResource(Communicator communicator, string clientMetaInfo, IDictionary pathContext) { _parent = null; - _communicator = communicator ?? throw new ArgumentException("communicator is required"); ; + _communicator = communicator ?? throw new ArgumentException("communicator is required"); _pathContext = pathContext; _clientMetaInfo = clientMetaInfo; } @@ -63,49 +63,48 @@ protected string InstantiateUri(string uri, IDictionary pathCont return uri; } - protected Exception CreateException(System.Net.HttpStatusCode statusCode, string responseBody, object errorObject, CallContext context) + protected Exception CreateException(HttpStatusCode statusCode, string responseBody, object errorObject, CallContext context) { - if (errorObject is PaymentErrorResponse && ((PaymentErrorResponse)errorObject).PaymentResult != null) + PaymentErrorResponse paymentErrorResponse = errorObject as PaymentErrorResponse; + if (paymentErrorResponse?.PaymentResult != null) { return new DeclinedPaymentException(statusCode, responseBody, (PaymentErrorResponse)errorObject); } - if (errorObject is PayoutErrorResponse && ((PayoutErrorResponse)errorObject).PayoutResult != null) + PayoutErrorResponse payoutErrorResponse = errorObject as PayoutErrorResponse; + if (payoutErrorResponse?.PayoutResult != null) { return new DeclinedPayoutException(statusCode, responseBody, (PayoutErrorResponse)errorObject); } - if (errorObject is RefundErrorResponse && ((RefundErrorResponse)errorObject).RefundResult != null) + RefundErrorResponse refundErrorResponse = errorObject as RefundErrorResponse; + if (refundErrorResponse?.RefundResult != null) { return new DeclinedRefundException(statusCode, responseBody, (RefundErrorResponse)errorObject); } string errorId; IList errors; - if (errorObject is PaymentErrorResponse) + if (paymentErrorResponse != null) { - PaymentErrorResponse paymentErrorResponse = (PaymentErrorResponse)errorObject; errorId = paymentErrorResponse.ErrorId; errors = paymentErrorResponse.Errors; } - else if (errorObject is PayoutErrorResponse) + else if (payoutErrorResponse != null) { - PayoutErrorResponse payoutErrorResponse = (PayoutErrorResponse)errorObject; errorId = payoutErrorResponse.ErrorId; errors = payoutErrorResponse.Errors; } - else if (errorObject is RefundErrorResponse) + else if (refundErrorResponse != null) { - RefundErrorResponse refundErrorResponse = (RefundErrorResponse)errorObject; errorId = refundErrorResponse.ErrorId; errors = refundErrorResponse.Errors; } - else if (errorObject is ErrorResponse) + else if (errorObject is ErrorResponse errorResponse) { - ErrorResponse errorResponse = (ErrorResponse)errorObject; errorId = errorResponse.ErrorId; errors = errorResponse.Errors; } else { - throw new ArgumentException("unsupported error object type: " + errorObject.GetType().ToString()); + throw new ArgumentException("unsupported error object type: " + errorObject.GetType()); } switch (statusCode) @@ -164,8 +163,7 @@ static string ReplaceAll(string uri, IDictionary pathContext) static bool IsIdempotenceError(IEnumerable errors, CallContext context) { - return context != null - && context.IdempotenceKey != null + return context?.IdempotenceKey != null && errors.Count() == 1 && "1409".Equals(errors.ElementAt(0).Code); } diff --git a/connect-sdk-dotnet/Communicator.cs b/connect-sdk-dotnet/Communicator.cs index b8bdfb94..74cee07d 100644 --- a/connect-sdk-dotnet/Communicator.cs +++ b/connect-sdk-dotnet/Communicator.cs @@ -49,10 +49,9 @@ public BodyObfuscator BodyObfuscator { set { - IConnection connection = Session.Connection; - if (typeof(IObfuscationCapable).IsAssignableFrom(connection.GetType())) + if (Session.Connection is IObfuscationCapable obfuscationCapable) { - ((IObfuscationCapable)connection).BodyObfuscator = value; + obfuscationCapable.BodyObfuscator = value; } } } @@ -61,10 +60,9 @@ public HeaderObfuscator HeaderObfuscator { set { - IConnection connection = Session.Connection; - if (typeof(IObfuscationCapable).IsAssignableFrom(connection.GetType())) + if (Session.Connection is IObfuscationCapable obfuscationCapable) { - ((IObfuscationCapable)connection).HeaderObfuscator = value; + obfuscationCapable.HeaderObfuscator = value; } } } @@ -99,12 +97,12 @@ public async Task Get(string relativePath, IEnumerable req { IConnection connection = Session.Connection; IEnumerable requestParameterList = requestParameters?.ToRequestParameters(); - Uri uri = ToAbsoluteURI(relativePath, requestParameterList); + Uri uri = ToAbsoluteUri(relativePath, requestParameterList); requestHeaders = requestHeaders ?? new List(); requestHeaders = AddGenericHeaders(HttpMethod.Get, uri, requestHeaders, context); - return await connection.Get(uri, requestHeaders, (status, body, headers) => { - return ProcessResponse(status, body, headers, relativePath, context); - }).ConfigureAwait(false); + return await connection.Get(uri, requestHeaders, (status, body, headers) => + ProcessResponse(status, body, headers, relativePath, context) + ).ConfigureAwait(false); } /// @@ -124,12 +122,12 @@ public async Task Get(string relativePath, IEnumerable requestHe { IConnection connection = Session.Connection; IEnumerable requestParameterList = requestParameters?.ToRequestParameters(); - Uri uri = ToAbsoluteURI(relativePath, requestParameterList); + Uri uri = ToAbsoluteUri(relativePath, requestParameterList); requestHeaders = requestHeaders ?? new List(); requestHeaders = AddGenericHeaders(HttpMethod.Get, uri, requestHeaders, context); - await connection.Get(uri, requestHeaders, (status, body, headers) => { - return ProcessResponse(status, body, headers, relativePath, context, bodyHandler); - }).ConfigureAwait(false); + await connection.Get(uri, requestHeaders, (status, body, headers) => + ProcessResponse(status, body, headers, relativePath, context, bodyHandler) + ).ConfigureAwait(false); } /// @@ -148,12 +146,12 @@ public async Task Delete(string relativePath, IEnumerable { IConnection connection = Session.Connection; IEnumerable requestParameterList = requestParameters?.ToRequestParameters(); - Uri uri = ToAbsoluteURI(relativePath, requestParameterList); + Uri uri = ToAbsoluteUri(relativePath, requestParameterList); requestHeaders = requestHeaders ?? new List(); requestHeaders = AddGenericHeaders(HttpMethod.Delete, uri, requestHeaders, context); - return await connection.Delete(uri, requestHeaders, (status, body, headers) => { - return ProcessResponse(status, body, headers, relativePath, context); - }).ConfigureAwait(false); + return await connection.Delete(uri, requestHeaders, (status, body, headers) => + ProcessResponse(status, body, headers, relativePath, context) + ).ConfigureAwait(false); } /// @@ -173,12 +171,12 @@ public async Task Delete(string relativePath, IEnumerable reques { IConnection connection = Session.Connection; IEnumerable requestParameterList = requestParameters?.ToRequestParameters(); - Uri uri = ToAbsoluteURI(relativePath, requestParameterList); + Uri uri = ToAbsoluteUri(relativePath, requestParameterList); requestHeaders = requestHeaders ?? new List(); requestHeaders = AddGenericHeaders(HttpMethod.Delete, uri, requestHeaders, context); - await connection.Delete(uri, requestHeaders, (status, body, headers) => { - return ProcessResponse(status, body, headers, relativePath, context, bodyHandler); - }).ConfigureAwait(false); + await connection.Delete(uri, requestHeaders, (status, body, headers) => + ProcessResponse(status, body, headers, relativePath, context, bodyHandler) + ).ConfigureAwait(false); } /// @@ -196,19 +194,19 @@ await connection.Delete(uri, requestHeaders, (status, body, headers) => { public async Task Post(string relativePath, IEnumerable requestHeaders, AbstractParamRequest requestParameters, object requestBody, CallContext context) { - if (requestBody is MultipartFormDataObject) + if (requestBody is MultipartFormDataObject multipartFormDataObject) { - return await Post(relativePath, requestHeaders, requestParameters, (MultipartFormDataObject)requestBody, context).ConfigureAwait(false); + return await Post(relativePath, requestHeaders, requestParameters, multipartFormDataObject, context).ConfigureAwait(false); } - if (requestBody is IMultipartFormDataRequest) + if (requestBody is IMultipartFormDataRequest multipartFormDataRequest) { - MultipartFormDataObject multipart = ((IMultipartFormDataRequest)requestBody).ToMultipartFormDataObject(); + MultipartFormDataObject multipart = multipartFormDataRequest.ToMultipartFormDataObject(); return await Post(relativePath, requestHeaders, requestParameters, multipart, context).ConfigureAwait(false); } IConnection connection = Session.Connection; IEnumerable requestParameterList = requestParameters?.ToRequestParameters(); - Uri uri = ToAbsoluteURI(relativePath, requestParameterList); + Uri uri = ToAbsoluteUri(relativePath, requestParameterList); requestHeaders = requestHeaders ?? new List(); string requestJson = null; @@ -220,9 +218,9 @@ public async Task Post(string relativePath, IEnumerable re } requestHeaders = AddGenericHeaders(HttpMethod.Post, uri, requestHeaderList, context); - return await connection.Post(uri, requestHeaders, requestJson, (status, body, headers) => { - return ProcessResponse(status, body, headers, relativePath, context); - }).ConfigureAwait(false); + return await connection.Post(uri, requestHeaders, requestJson, (status, body, headers) => + ProcessResponse(status, body, headers, relativePath, context) + ).ConfigureAwait(false); } async Task Post(string relativePath, IEnumerable requestHeaders, AbstractParamRequest requestParameters, @@ -230,7 +228,7 @@ async Task Post(string relativePath, IEnumerable requestHe { IConnection connection = Session.Connection; IEnumerable requestParameterList = requestParameters?.ToRequestParameters(); - Uri uri = ToAbsoluteURI(relativePath, requestParameterList); + Uri uri = ToAbsoluteUri(relativePath, requestParameterList); requestHeaders = requestHeaders ?? new List(); IList requestHeaderList = requestHeaders.ToList(); @@ -238,9 +236,9 @@ async Task Post(string relativePath, IEnumerable requestHe requestHeaderList.Add(new EntityHeader("Content-Type", multipart.ContentType)); requestHeaders = AddGenericHeaders(HttpMethod.Post, uri, requestHeaderList, context); - return await connection.Post(uri, requestHeaders, multipart, (status, body, headers) => { - return ProcessResponse(status, body, headers, relativePath, context); - }).ConfigureAwait(false); + return await connection.Post(uri, requestHeaders, multipart, (status, body, headers) => + ProcessResponse(status, body, headers, relativePath, context) + ).ConfigureAwait(false); } /// @@ -259,21 +257,21 @@ async Task Post(string relativePath, IEnumerable requestHe public async Task Post(string relativePath, IEnumerable requestHeaders, AbstractParamRequest requestParameters, object requestBody, Action> bodyHandler, CallContext context) { - if (requestBody is MultipartFormDataObject) + if (requestBody is MultipartFormDataObject multipartFormDataObject) { - await Post(relativePath, requestHeaders, requestParameters, (MultipartFormDataObject)requestBody, bodyHandler, context).ConfigureAwait(false); + await Post(relativePath, requestHeaders, requestParameters, multipartFormDataObject, bodyHandler, context).ConfigureAwait(false); return; } - if (requestBody is IMultipartFormDataRequest) + if (requestBody is IMultipartFormDataRequest multipartFormDataRequest) { - MultipartFormDataObject multipart = ((IMultipartFormDataRequest)requestBody).ToMultipartFormDataObject(); + MultipartFormDataObject multipart = multipartFormDataRequest.ToMultipartFormDataObject(); await Post(relativePath, requestHeaders, requestParameters, multipart, bodyHandler, context).ConfigureAwait(false); return; } IConnection connection = Session.Connection; IEnumerable requestParameterList = requestParameters?.ToRequestParameters(); - Uri uri = ToAbsoluteURI(relativePath, requestParameterList); + Uri uri = ToAbsoluteUri(relativePath, requestParameterList); requestHeaders = requestHeaders ?? new List(); string requestJson = null; @@ -285,9 +283,9 @@ public async Task Post(string relativePath, IEnumerable requestH } requestHeaders = AddGenericHeaders(HttpMethod.Post, uri, requestHeaderList, context); - await connection.Post(uri, requestHeaders, requestJson, (status, body, headers) => { - return ProcessResponse(status, body, headers, relativePath, context, bodyHandler); - }).ConfigureAwait(false); + await connection.Post(uri, requestHeaders, requestJson, (status, body, headers) => + ProcessResponse(status, body, headers, relativePath, context, bodyHandler) + ).ConfigureAwait(false); } async Task Post(string relativePath, IEnumerable requestHeaders, AbstractParamRequest requestParameters, @@ -295,7 +293,7 @@ async Task Post(string relativePath, IEnumerable requestHeaders, { IConnection connection = Session.Connection; IEnumerable requestParameterList = requestParameters?.ToRequestParameters(); - Uri uri = ToAbsoluteURI(relativePath, requestParameterList); + Uri uri = ToAbsoluteUri(relativePath, requestParameterList); requestHeaders = requestHeaders ?? new List(); IList requestHeaderList = requestHeaders.ToList(); @@ -303,9 +301,9 @@ async Task Post(string relativePath, IEnumerable requestHeaders, requestHeaderList.Add(new EntityHeader("Content-Type", multipart.ContentType)); requestHeaders = AddGenericHeaders(HttpMethod.Post, uri, requestHeaderList, context); - await connection.Post(uri, requestHeaders, multipart, (status, body, headers) => { - return ProcessResponse(status, body, headers, relativePath, context, bodyHandler); - }).ConfigureAwait(false); + await connection.Post(uri, requestHeaders, multipart, (status, body, headers) => + ProcessResponse(status, body, headers, relativePath, context, bodyHandler) + ).ConfigureAwait(false); } /// @@ -323,19 +321,19 @@ await connection.Post(uri, requestHeaders, multipart, (status, body, headers) => public async Task Put(string relativePath, IEnumerable requestHeaders, AbstractParamRequest requestParameters, object requestBody, CallContext context) { - if (requestBody is MultipartFormDataObject) + if (requestBody is MultipartFormDataObject multipartFormDataObject) { - return await Put(relativePath, requestHeaders, requestParameters, (MultipartFormDataObject)requestBody, context).ConfigureAwait(false); + return await Put(relativePath, requestHeaders, requestParameters, multipartFormDataObject, context).ConfigureAwait(false); } - if (requestBody is IMultipartFormDataRequest) + if (requestBody is IMultipartFormDataRequest multipartFormDataRequest) { - MultipartFormDataObject multipart = ((IMultipartFormDataRequest)requestBody).ToMultipartFormDataObject(); + MultipartFormDataObject multipart = multipartFormDataRequest.ToMultipartFormDataObject(); return await Put(relativePath, requestHeaders, requestParameters, multipart, context).ConfigureAwait(false); } IConnection connection = Session.Connection; IEnumerable requestParameterList = requestParameters?.ToRequestParameters(); - Uri uri = ToAbsoluteURI(relativePath, requestParameterList); + Uri uri = ToAbsoluteUri(relativePath, requestParameterList); requestHeaders = requestHeaders ?? new List(); string requestJson = null; @@ -347,9 +345,9 @@ public async Task Put(string relativePath, IEnumerable req } requestHeaders = AddGenericHeaders(HttpMethod.Put, uri, requestHeaderList, context); - return await connection.Put(uri, requestHeaders, requestJson, (status, body, headers) => { - return ProcessResponse(status, body, headers, relativePath, context); - }).ConfigureAwait(false); + return await connection.Put(uri, requestHeaders, requestJson, (status, body, headers) => + ProcessResponse(status, body, headers, relativePath, context) + ).ConfigureAwait(false); } async Task Put(string relativePath, IEnumerable requestHeaders, AbstractParamRequest requestParameters, @@ -357,7 +355,7 @@ async Task Put(string relativePath, IEnumerable requestHea { IConnection connection = Session.Connection; IEnumerable requestParameterList = requestParameters?.ToRequestParameters(); - Uri uri = ToAbsoluteURI(relativePath, requestParameterList); + Uri uri = ToAbsoluteUri(relativePath, requestParameterList); requestHeaders = requestHeaders ?? new List(); IList requestHeaderList = requestHeaders.ToList(); @@ -365,9 +363,9 @@ async Task Put(string relativePath, IEnumerable requestHea requestHeaderList.Add(new EntityHeader("Content-Type", multipart.ContentType)); requestHeaders = AddGenericHeaders(HttpMethod.Put, uri, requestHeaderList, context); - return await connection.Put(uri, requestHeaders, multipart, (status, body, headers) => { - return ProcessResponse(status, body, headers, relativePath, context); - }).ConfigureAwait(false); + return await connection.Put(uri, requestHeaders, multipart, (status, body, headers) => + ProcessResponse(status, body, headers, relativePath, context) + ).ConfigureAwait(false); } /// @@ -386,21 +384,21 @@ async Task Put(string relativePath, IEnumerable requestHea public async Task Put(string relativePath, IEnumerable requestHeaders, AbstractParamRequest requestParameters, object requestBody, Action> bodyHandler, CallContext context) { - if (requestBody is MultipartFormDataObject) + if (requestBody is MultipartFormDataObject multipartFormDataObject) { - await Put(relativePath, requestHeaders, requestParameters, (MultipartFormDataObject)requestBody, bodyHandler, context).ConfigureAwait(false); + await Put(relativePath, requestHeaders, requestParameters, multipartFormDataObject, bodyHandler, context).ConfigureAwait(false); return; } - if (requestBody is IMultipartFormDataRequest) + if (requestBody is IMultipartFormDataRequest multipartFormDataRequest) { - MultipartFormDataObject multipart = ((IMultipartFormDataRequest)requestBody).ToMultipartFormDataObject(); + MultipartFormDataObject multipart = multipartFormDataRequest.ToMultipartFormDataObject(); await Put(relativePath, requestHeaders, requestParameters, multipart, bodyHandler, context).ConfigureAwait(false); return; } IConnection connection = Session.Connection; IEnumerable requestParameterList = requestParameters?.ToRequestParameters(); - Uri uri = ToAbsoluteURI(relativePath, requestParameterList); + Uri uri = ToAbsoluteUri(relativePath, requestParameterList); requestHeaders = requestHeaders ?? new List(); string requestJson = null; @@ -412,9 +410,9 @@ public async Task Put(string relativePath, IEnumerable requestHe } requestHeaders = AddGenericHeaders(HttpMethod.Put, uri, requestHeaderList, context); - await connection.Put(uri, requestHeaders, requestJson, (status, body, headers) => { - return ProcessResponse(status, body, headers, relativePath, context, bodyHandler); - }).ConfigureAwait(false); + await connection.Put(uri, requestHeaders, requestJson, (status, body, headers) => + ProcessResponse(status, body, headers, relativePath, context, bodyHandler) + ).ConfigureAwait(false); } async Task Put(string relativePath, IEnumerable requestHeaders, AbstractParamRequest requestParameters, @@ -422,7 +420,7 @@ async Task Put(string relativePath, IEnumerable requestHeaders, { IConnection connection = Session.Connection; IEnumerable requestParameterList = requestParameters?.ToRequestParameters(); - Uri uri = ToAbsoluteURI(relativePath, requestParameterList); + Uri uri = ToAbsoluteUri(relativePath, requestParameterList); requestHeaders = requestHeaders ?? new List(); IList requestHeaderList = requestHeaders.ToList(); @@ -430,9 +428,9 @@ async Task Put(string relativePath, IEnumerable requestHeaders, requestHeaderList.Add(new EntityHeader("Content-Type", multipart.ContentType)); requestHeaders = AddGenericHeaders(HttpMethod.Put, uri, requestHeaderList, context); - await connection.Put(uri, requestHeaders, multipart, (status, body, headers) => { - return ProcessResponse(status, body, headers, relativePath, context, bodyHandler); - }).ConfigureAwait(false); + await connection.Put(uri, requestHeaders, multipart, (status, body, headers) => + ProcessResponse(status, body, headers, relativePath, context, bodyHandler) + ).ConfigureAwait(false); } #endregion @@ -443,10 +441,9 @@ await connection.Put(uri, requestHeaders, multipart, (status, body, headers) => /// public void CloseExpiredConnections() { - IConnection connection = Session.Connection; - if (typeof(IPooledConnection).IsAssignableFrom(connection.GetType())) + if (Session.Connection is IPooledConnection pooledConnection) { - ((IPooledConnection)connection).CloseExpiredConnections(); + pooledConnection.CloseExpiredConnections(); } } @@ -457,18 +454,16 @@ public void CloseExpiredConnections() /// Idle time. public void CloseIdleConnections(TimeSpan timespan) { - IConnection connection = Session.Connection; - if (connection is IPooledConnection) + if (Session.Connection is IPooledConnection pooledConnection) { - ((IPooledConnection)connection).CloseIdleConnections(timespan); + pooledConnection.CloseIdleConnections(timespan); } } internal Session Session { get; } - internal Uri ToAbsoluteURI(string relativePath, IEnumerable requestParameters) + internal Uri ToAbsoluteUri(string relativePath, IEnumerable requestParameters) { - Uri apiEndpoint = Session.ApiEndpoint; if (apiEndpoint.HasPath()) @@ -495,7 +490,7 @@ internal Uri ToAbsoluteURI(string relativePath, IEnumerable reques Scheme = apiEndpoint.Scheme, Host = apiEndpoint.Host, Port = apiEndpoint.Port, - Path = absolutePath, + Path = absolutePath }; if (requestParameters != null) @@ -525,7 +520,7 @@ protected IEnumerable AddGenericHeaders(HttpMethod httpMethod, U requestHeaderList.Add(new RequestHeader("Date", GetHeaderDateString())); // add context specific headers - if (context != null && context.IdempotenceKey != null) + if (context?.IdempotenceKey != null) { requestHeaderList.Add(new RequestHeader("X-GCS-Idempotence-Key", context.IdempotenceKey)); } @@ -602,7 +597,7 @@ protected O ProcessResponse(HttpStatusCode statusCode, Stream stream, IEnumer return null; } - bool IsJson(IEnumerable headers) + static bool IsJson(IEnumerable headers) { string contentType = headers?.GetHeaderValue("Content-Type")?.ToLower(); return contentType == null || "application/json".Equals(contentType) || contentType.StartsWith("application/json", StringComparison.Ordinal); diff --git a/connect-sdk-dotnet/CommunicatorConfiguration.cs b/connect-sdk-dotnet/CommunicatorConfiguration.cs index 18d0df03..2dcf061e 100644 --- a/connect-sdk-dotnet/CommunicatorConfiguration.cs +++ b/connect-sdk-dotnet/CommunicatorConfiguration.cs @@ -242,20 +242,20 @@ public CommunicatorConfiguration(IDictionary properties) ApiEndpoint = GetApiEndpoint(properties); AuthorizationType = AuthorizationType.GetValueOf(GetProperty(properties, "connect.api.authorizationType")); - var connectTimout = int.Parse(GetProperty(properties, "connect.api.connectTimeout")); - ConnectTimeout = (connectTimout < 0) ? (TimeSpan?)TimeSpan.FromMilliseconds(connectTimout) : null; + var connectTimeout = int.Parse(GetProperty(properties, "connect.api.connectTimeout")); + ConnectTimeout = connectTimeout >= 0 ? (TimeSpan?)TimeSpan.FromMilliseconds(connectTimeout) : null; - var socketTimout = int.Parse(GetProperty(properties, "connect.api.socketTimeout")); - SocketTimeout = (socketTimout < 0) ? (TimeSpan?)TimeSpan.FromMilliseconds(socketTimout) : null; + var socketTimeout = int.Parse(GetProperty(properties, "connect.api.socketTimeout")); + SocketTimeout = socketTimeout >= 0 ? (TimeSpan?)TimeSpan.FromMilliseconds(socketTimeout) : null; MaxConnections = GetProperty(properties, "connect.api.maxConnections", DefaultMaxConnections); - var proxyURI = GetProperty(properties, "connect.api.proxy.uri"); + var proxyUri = GetProperty(properties, "connect.api.proxy.uri"); var proxyUser = GetProperty(properties, "connect.api.proxy.username"); var proxyPass = GetProperty(properties, "connect.api.proxy.password"); - if (proxyURI != null) + if (proxyUri != null) { - ProxyConfiguration.Uri = new Uri(proxyURI); + ProxyConfiguration.Uri = new Uri(proxyUri); ProxyConfiguration.Username = proxyUser; ProxyConfiguration.Password = proxyPass; } @@ -414,9 +414,9 @@ internal CommunicatorConfiguration(CommunicatorConfigurationSection section) static string GetProperty(IDictionary properties, string name, string defaultValue = null) { - if (properties.ContainsKey(name)) + if (properties.TryGetValue(name, out string value)) { - return properties[name]; + return value; } return defaultValue; } @@ -431,17 +431,17 @@ static int GetProperty(IDictionary properties, string key, int d return defaultValue; } - Uri GetApiEndpoint(IDictionary properties) + static Uri GetApiEndpoint(IDictionary properties) { var host = GetProperty(properties, "connect.api.endpoint.host", ""); var scheme = GetProperty(properties, "connect.api.endpoint.scheme", "https"); var port = GetProperty(properties, "connect.api.endpoint.port", -1); - return CreateURI(scheme, host, port); + return CreateUri(scheme, host, port); } - Uri CreateURI(string scheme, string host, int port) + static Uri CreateUri(string scheme, string host, int port) { try { diff --git a/connect-sdk-dotnet/CommunicatorConfigurationSection.cs b/connect-sdk-dotnet/CommunicatorConfigurationSection.cs index 4d72c75b..f5681a8a 100644 --- a/connect-sdk-dotnet/CommunicatorConfigurationSection.cs +++ b/connect-sdk-dotnet/CommunicatorConfigurationSection.cs @@ -3,12 +3,12 @@ namespace Ingenico.Connect.Sdk { - class CommunicatorConfigurationSection : ConfigurationSection + internal class CommunicatorConfigurationSection : ConfigurationSection { /// /// The default number of maximum connections /// - public const int DEFAULT_MAX_CONNECTIONS = 10; + public const int DefaultMaxConnections = 10; [ConfigurationProperty("apiEndpoint", IsRequired = true)] public UriConfiguration ApiEndpointConfig @@ -96,7 +96,7 @@ public TimeSpan? SocketTimeout } } - [ConfigurationProperty("maxConnections", IsRequired = false, DefaultValue = DEFAULT_MAX_CONNECTIONS)] + [ConfigurationProperty("maxConnections", IsRequired = false, DefaultValue = DefaultMaxConnections)] public int MaxConnections { get diff --git a/connect-sdk-dotnet/DefaultImpl/CamelCaseKeepFullCapsNamingStrategy.cs b/connect-sdk-dotnet/DefaultImpl/CamelCaseKeepFullCapsNamingStrategy.cs index a7cff3cf..6d0dd050 100644 --- a/connect-sdk-dotnet/DefaultImpl/CamelCaseKeepFullCapsNamingStrategy.cs +++ b/connect-sdk-dotnet/DefaultImpl/CamelCaseKeepFullCapsNamingStrategy.cs @@ -2,7 +2,7 @@ namespace Ingenico.Connect.Sdk.DefaultImpl { - sealed class CamelCaseKeepFullCapsNamingStrategy : CamelCaseNamingStrategy + internal sealed class CamelCaseKeepFullCapsNamingStrategy : CamelCaseNamingStrategy { public CamelCaseKeepFullCapsNamingStrategy() { diff --git a/connect-sdk-dotnet/DefaultImpl/DefaultAuthenticator.cs b/connect-sdk-dotnet/DefaultImpl/DefaultAuthenticator.cs index c5995d55..55e536ca 100644 --- a/connect-sdk-dotnet/DefaultImpl/DefaultAuthenticator.cs +++ b/connect-sdk-dotnet/DefaultImpl/DefaultAuthenticator.cs @@ -98,7 +98,7 @@ internal string SignData(string theString) return retVal; } - internal string ToCanonicalizeHeaderValue(string originalValue) + internal static string ToCanonicalizeHeaderValue(string originalValue) { var pattern = "\r?\n[\\s-[\r\n]]*"; var newString = new Regex(pattern, RegexOptions.Multiline | RegexOptions.CultureInvariant).Replace(originalValue, " ").Trim(); @@ -111,7 +111,7 @@ internal string ToCanonicalizeHeaderValue(string originalValue) readonly AuthorizationType _authorizationType; - string CanonicalizedResource(Uri uri) + static string CanonicalizedResource(Uri uri) { var sb = new StringBuilder(); sb.Append(Uri.EscapeUriString(uri.LocalPath)); diff --git a/connect-sdk-dotnet/DefaultImpl/DefaultConnection.cs b/connect-sdk-dotnet/DefaultImpl/DefaultConnection.cs index 59fb5848..e5a47039 100644 --- a/connect-sdk-dotnet/DefaultImpl/DefaultConnection.cs +++ b/connect-sdk-dotnet/DefaultImpl/DefaultConnection.cs @@ -13,11 +13,11 @@ namespace Ingenico.Connect.Sdk.DefaultImpl /// /// The default implementation for the connection interface. Supports Pooling, and is thread safe. /// - public class DefaultConnection : IPooledConnection, ILoggingCapable, IObfuscationCapable + public class DefaultConnection : IPooledConnection, IObfuscationCapable { public DefaultConnection(TimeSpan? socketTimeout, int maxConnections = 2, Proxy proxy = null, HttpClientHandler httpClientHandler = null) { - var handler = httpClientHandler != null ? httpClientHandler : new HttpClientHandler(); + var handler = httpClientHandler ?? new HttpClientHandler(); if (proxy != null) { handler.Proxy = new WebProxy(proxy.Uri); @@ -39,7 +39,7 @@ public DefaultConnection(TimeSpan? socketTimeout, int maxConnections = 2, Proxy internal DefaultConnection(TimeSpan? socketTimeout,ProxyConfiguration proxyConfig, int maxConnections = 2, HttpClientHandler httpClientHandler = null) { - var handler = httpClientHandler != null ? httpClientHandler : new HttpClientHandler(); + var handler = httpClientHandler ?? new HttpClientHandler(); if (proxyConfig != null) { handler.Proxy = new WebProxy(proxyConfig.Uri); @@ -61,7 +61,7 @@ internal DefaultConnection(TimeSpan? socketTimeout,ProxyConfiguration proxyConfi async Task SendHttpMessage(HttpMethod method, Uri uri, IEnumerable requestHeaders, Func, R>responseHandler, string body = null) { - var content = (body == null ? null : new StringContent(body)); + var content = body == null ? null : new StringContent(body); return await SendHttpMessage(method, uri, requestHeaders, responseHandler, content, body).ConfigureAwait(false); } @@ -86,7 +86,7 @@ async Task SendHttpMessage(HttpMethod method, Uri uri, IEnumerable Put(Uri uri, IEnumerable requestHeaders, #region IObfuscationCapable implementation public BodyObfuscator BodyObfuscator { - set - { - _bodyObfuscator = value ?? throw new ArgumentException("bodyObfuscator is required"); - } + set => _bodyObfuscator = value ?? throw new ArgumentException("bodyObfuscator is required"); } public HeaderObfuscator HeaderObfuscator { - set - { - _headerObfuscator = value ?? throw new ArgumentException("headerObfuscator is required"); - } + set => _headerObfuscator = value ?? throw new ArgumentException("headerObfuscator is required"); } #endregion @@ -323,12 +317,12 @@ void LogException(Guid guid, Exception exception) _communicatorLogger?.Log("Error occurred for outgoing request (requestId='" + guid + "')", exception); } - bool IsBinaryContent(string contentType) + static bool IsBinaryContent(string contentType) { return contentType != null && !contentType.StartsWith("text/", StringComparison.OrdinalIgnoreCase) - && (contentType.IndexOf("json", StringComparison.OrdinalIgnoreCase) < 0) - && (contentType.IndexOf("xml", StringComparison.OrdinalIgnoreCase) < 0); + && contentType.IndexOf("json", StringComparison.OrdinalIgnoreCase) < 0 + && contentType.IndexOf("xml", StringComparison.OrdinalIgnoreCase) < 0; } #endregion diff --git a/connect-sdk-dotnet/DefaultImpl/DefaultMarshaller.cs b/connect-sdk-dotnet/DefaultImpl/DefaultMarshaller.cs index f9f01264..8c607a83 100644 --- a/connect-sdk-dotnet/DefaultImpl/DefaultMarshaller.cs +++ b/connect-sdk-dotnet/DefaultImpl/DefaultMarshaller.cs @@ -12,13 +12,13 @@ public sealed class DefaultMarshaller : IMarshaller public static DefaultMarshaller Instance { get; } = new DefaultMarshaller(); #region IMarshaller Implementation - public string Marshal(object requestObject) => JsonConvert.SerializeObject(requestObject, _jsonSerializerSettings); + public string Marshal(object requestObject) => JsonConvert.SerializeObject(requestObject, JsonSerializerSettings); public T Unmarshal(string responseJson) { try { - T anObject = (T)JsonConvert.DeserializeObject(responseJson, typeof(T), _jsonSerializerSettings); + T anObject = (T)JsonConvert.DeserializeObject(responseJson, typeof(T), JsonSerializerSettings); return anObject; } catch (JsonReaderException exception) @@ -33,7 +33,7 @@ public T Unmarshal(Stream responseJson) { var sr = new StreamReader(responseJson); JsonReader jr = new JsonTextReader(sr); - var serializer = JsonSerializer.Create(_jsonSerializerSettings); + var serializer = JsonSerializer.Create(JsonSerializerSettings); T anObject = serializer.Deserialize(jr); return anObject; @@ -47,7 +47,7 @@ public T Unmarshal(Stream responseJson) #endregion - static readonly JsonSerializerSettings _jsonSerializerSettings = new JsonSerializerSettings + static readonly JsonSerializerSettings JsonSerializerSettings = new JsonSerializerSettings { ContractResolver = new DefaultContractResolver { diff --git a/connect-sdk-dotnet/Domain/Definitions/AirlineData.cs b/connect-sdk-dotnet/Domain/Definitions/AirlineData.cs index 757e768d..f9b24078 100644 --- a/connect-sdk-dotnet/Domain/Definitions/AirlineData.cs +++ b/connect-sdk-dotnet/Domain/Definitions/AirlineData.cs @@ -49,7 +49,7 @@ public class AirlineData /// false = unknown customer /// /// - [ObsoleteAttribute("Use Order.customer.accountType instead")] + [Obsolete("Use Order.customer.accountType instead")] public bool? IsRegisteredCustomer { get; set; } = null; /// diff --git a/connect-sdk-dotnet/Domain/Definitions/AirlineFlightLeg.cs b/connect-sdk-dotnet/Domain/Definitions/AirlineFlightLeg.cs index 85d6536a..3629632b 100644 --- a/connect-sdk-dotnet/Domain/Definitions/AirlineFlightLeg.cs +++ b/connect-sdk-dotnet/Domain/Definitions/AirlineFlightLeg.cs @@ -107,7 +107,7 @@ public class AirlineFlightLeg /// first /// /// - [ObsoleteAttribute("Use passengerClass instead")] + [Obsolete("Use passengerClass instead")] public string ServiceClass { get; set; } = null; /// diff --git a/connect-sdk-dotnet/Domain/Definitions/CustomerBase.cs b/connect-sdk-dotnet/Domain/Definitions/CustomerBase.cs index fb90dd84..f3ca413e 100644 --- a/connect-sdk-dotnet/Domain/Definitions/CustomerBase.cs +++ b/connect-sdk-dotnet/Domain/Definitions/CustomerBase.cs @@ -21,7 +21,7 @@ public class CustomerBase /// /// Local VAT number of the company /// - [ObsoleteAttribute("Use companyInformation.vatNumber instead")] + [Obsolete("Use companyInformation.vatNumber instead")] public string VatNumber { get; set; } = null; } } diff --git a/connect-sdk-dotnet/Domain/Definitions/FraudFields.cs b/connect-sdk-dotnet/Domain/Definitions/FraudFields.cs index 0a1e821e..1915b5f8 100644 --- a/connect-sdk-dotnet/Domain/Definitions/FraudFields.cs +++ b/connect-sdk-dotnet/Domain/Definitions/FraudFields.cs @@ -12,7 +12,7 @@ public class FraudFields /// /// Indicates that invoice and shipping addresses are equal. /// - [ObsoleteAttribute("For risk assessments there is no replacement. For other calls, use Order.shipping.addressIndicator instead")] + [Obsolete("For risk assessments there is no replacement. For other calls, use Order.shipping.addressIndicator instead")] public bool? AddressesAreIdentical { get; set; } = null; /// @@ -23,7 +23,7 @@ public class FraudFields /// /// The address that belongs to the owner of the card /// - [ObsoleteAttribute("This should be the same as Order.customer.billingAddress")] + [Obsolete("This should be the same as Order.customer.billingAddress")] public Address CardOwnerAddress { get; set; } = null; /// @@ -39,19 +39,19 @@ public class FraudFields /// manually - All fields were entered manually /// /// - [ObsoleteAttribute("Use Order.customer.device.defaultFormFill instead")] + [Obsolete("Use Order.customer.device.defaultFormFill instead")] public string DefaultFormFill { get; set; } = null; /// /// Indicates that the device fingerprint has been used while processing the order. /// - [ObsoleteAttribute("No replacement")] + [Obsolete("No replacement")] public bool? DeviceFingerprintActivated { get; set; } = null; /// /// One must set the deviceFingerprintTransactionId received by the response of the endpoint /{merchant}/products/{paymentProductId}/deviceFingerprint /// - [ObsoleteAttribute("Use Order.customer.device.deviceFingerprintTransactionId instead")] + [Obsolete("Use Order.customer.device.deviceFingerprintTransactionId instead")] public string DeviceFingerprintTransactionId { get; set; } = null; /// @@ -102,7 +102,7 @@ public class FraudFields /// false - The customer has not forgotten their password /// /// - [ObsoleteAttribute("Use Order.customer.account.hasForgottenPassword instead")] + [Obsolete("Use Order.customer.account.hasForgottenPassword instead")] public bool? HasForgottenPwd { get; set; } = null; /// @@ -112,7 +112,7 @@ public class FraudFields /// false - The customer has not used a password to gain access /// /// - [ObsoleteAttribute("Use Order.customer.account.hasPassword instead")] + [Obsolete("Use Order.customer.account.hasPassword instead")] public bool? HasPassword { get; set; } = null; /// @@ -122,7 +122,7 @@ public class FraudFields /// false - The customer is new/unknown customer /// /// - [ObsoleteAttribute("Use Order.customer.isPreviousCustomer instead")] + [Obsolete("Use Order.customer.isPreviousCustomer instead")] public bool? IsPreviousCustomer { get; set; } = null; /// @@ -133,19 +133,19 @@ public class FraudFields /// /// Comments included during shipping /// - [ObsoleteAttribute("Use Order.shipping.comments instead")] + [Obsolete("Use Order.shipping.comments instead")] public string ShipComments { get; set; } = null; /// /// Shipment tracking number /// - [ObsoleteAttribute("Use Order.shipping.trackingNumber instead")] + [Obsolete("Use Order.shipping.trackingNumber instead")] public string ShipmentTrackingNumber { get; set; } = null; /// /// Details on how the order is shipped to the customer /// - [ObsoleteAttribute("No replacement")] + [Obsolete("No replacement")] public FraudFieldsShippingDetails ShippingDetails { get; set; } = null; /// @@ -156,7 +156,7 @@ public class FraudFields /// /// The website from which the purchase was made /// - [ObsoleteAttribute("Use Merchant.websiteUrl instead")] + [Obsolete("Use Merchant.websiteUrl instead")] public string Website { get; set; } = null; } } diff --git a/connect-sdk-dotnet/Domain/Definitions/FraudFieldsShippingDetails.cs b/connect-sdk-dotnet/Domain/Definitions/FraudFieldsShippingDetails.cs index 44fae969..cc6e9ce2 100644 --- a/connect-sdk-dotnet/Domain/Definitions/FraudFieldsShippingDetails.cs +++ b/connect-sdk-dotnet/Domain/Definitions/FraudFieldsShippingDetails.cs @@ -6,25 +6,25 @@ namespace Ingenico.Connect.Sdk.Domain.Definitions { - [ObsoleteAttribute("No replacement")] + [Obsolete("No replacement")] public class FraudFieldsShippingDetails { /// /// Details regarding the shipping method /// - [ObsoleteAttribute("No replacement")] + [Obsolete("No replacement")] public string MethodDetails { get; set; } = null; /// /// Shipping method speed indicator /// - [ObsoleteAttribute("No replacement")] + [Obsolete("No replacement")] public int? MethodSpeed { get; set; } = null; /// /// Shipping method type indicator /// - [ObsoleteAttribute("No replacement")] + [Obsolete("No replacement")] public int? MethodType { get; set; } = null; } } diff --git a/connect-sdk-dotnet/Domain/Hostedcheckout/Definitions/CreatedPaymentOutput.cs b/connect-sdk-dotnet/Domain/Hostedcheckout/Definitions/CreatedPaymentOutput.cs index a964005a..6364ff27 100644 --- a/connect-sdk-dotnet/Domain/Hostedcheckout/Definitions/CreatedPaymentOutput.cs +++ b/connect-sdk-dotnet/Domain/Hostedcheckout/Definitions/CreatedPaymentOutput.cs @@ -68,7 +68,7 @@ public class CreatedPaymentOutput ///
Please see /// Statuses for a full overview of possible values. ///
- [ObsoleteAttribute("Use Payment.statusOutput.statusCategory instead")] + [Obsolete("Use Payment.statusOutput.statusCategory instead")] public string PaymentStatusCategory { get; set; } = null; /// diff --git a/connect-sdk-dotnet/Domain/Payment/Definitions/AbstractCardPaymentMethodSpecificInput.cs b/connect-sdk-dotnet/Domain/Payment/Definitions/AbstractCardPaymentMethodSpecificInput.cs index bba728c7..4f261c95 100644 --- a/connect-sdk-dotnet/Domain/Payment/Definitions/AbstractCardPaymentMethodSpecificInput.cs +++ b/connect-sdk-dotnet/Domain/Payment/Definitions/AbstractCardPaymentMethodSpecificInput.cs @@ -19,12 +19,12 @@ public class AbstractCardPaymentMethodSpecificInput : AbstractPaymentMethodSpeci public CardRecurrenceDetails Recurring { get; set; } = null; - [ObsoleteAttribute("Use recurring.recurringPaymentSequenceIndicator instead")] + [Obsolete("Use recurring.recurringPaymentSequenceIndicator instead")] public string RecurringPaymentSequenceIndicator { get; set; } = null; public bool? RequiresApproval { get; set; } = null; - [ObsoleteAttribute("Use threeDSecure.skipAuthentication instead")] + [Obsolete("Use threeDSecure.skipAuthentication instead")] public bool? SkipAuthentication { get; set; } = null; public bool? SkipFraudService { get; set; } = null; @@ -35,7 +35,7 @@ public class AbstractCardPaymentMethodSpecificInput : AbstractPaymentMethodSpeci public string TransactionChannel { get; set; } = null; - [ObsoleteAttribute("Use unscheduledCardOnFileSequenceIndicator instead")] + [Obsolete("Use unscheduledCardOnFileSequenceIndicator instead")] public string UnscheduledCardOnFileIndicator { get; set; } = null; public string UnscheduledCardOnFileRequestor { get; set; } = null; diff --git a/connect-sdk-dotnet/Domain/Payment/Definitions/AbstractSepaDirectDebitPaymentProduct771SpecificInput.cs b/connect-sdk-dotnet/Domain/Payment/Definitions/AbstractSepaDirectDebitPaymentProduct771SpecificInput.cs index 079e8961..b6c804b8 100644 --- a/connect-sdk-dotnet/Domain/Payment/Definitions/AbstractSepaDirectDebitPaymentProduct771SpecificInput.cs +++ b/connect-sdk-dotnet/Domain/Payment/Definitions/AbstractSepaDirectDebitPaymentProduct771SpecificInput.cs @@ -8,7 +8,7 @@ namespace Ingenico.Connect.Sdk.Domain.Payment.Definitions { public class AbstractSepaDirectDebitPaymentProduct771SpecificInput { - [ObsoleteAttribute("Use existingUniqueMandateReference or mandate.uniqueMandateReference instead")] + [Obsolete("Use existingUniqueMandateReference or mandate.uniqueMandateReference instead")] public string MandateReference { get; set; } = null; } } diff --git a/connect-sdk-dotnet/Domain/Payment/Definitions/AccountFundingRecipient.cs b/connect-sdk-dotnet/Domain/Payment/Definitions/AccountFundingRecipient.cs index c9afb262..a3e049d3 100644 --- a/connect-sdk-dotnet/Domain/Payment/Definitions/AccountFundingRecipient.cs +++ b/connect-sdk-dotnet/Domain/Payment/Definitions/AccountFundingRecipient.cs @@ -21,6 +21,7 @@ public class AccountFundingRecipient /// routingNumber = Routing Transit Number is a code used by financial institutions to identify other financial institutions. /// iban = International Bank Account Number, is a standard international numbering system for identifying bank accounts. /// bicNumber = Bank Identification Code is a number that is used to identify a specific bank. + /// giftCard = Gift card is a type of prepaid card that contains a specific amount of money that can be used at participating stores and marketplaces. /// /// public string AccountNumberType { get; set; } = null; diff --git a/connect-sdk-dotnet/Domain/Payment/Definitions/AdditionalOrderInput.cs b/connect-sdk-dotnet/Domain/Payment/Definitions/AdditionalOrderInput.cs index 17a079d7..942f787a 100644 --- a/connect-sdk-dotnet/Domain/Payment/Definitions/AdditionalOrderInput.cs +++ b/connect-sdk-dotnet/Domain/Payment/Definitions/AdditionalOrderInput.cs @@ -27,13 +27,13 @@ public class AdditionalOrderInput /// /// Object that holds Level3 summary data /// - [ObsoleteAttribute("Use Order.shoppingCart.amountBreakdown instead")] + [Obsolete("Use Order.shoppingCart.amountBreakdown instead")] public Level3SummaryData Level3SummaryData { get; set; } = null; /// /// Object containing specific data regarding the recipient of a loan in the UK /// - [ObsoleteAttribute("No replacement")] + [Obsolete("No replacement")] public LoanRecipient LoanRecipient { get; set; } = null; /// @@ -44,7 +44,7 @@ public class AdditionalOrderInput /// /// The number of installments in which this transaction will be paid, which can be used for card payments. Only used with some acquirers. In case you send in the details of this object, only the combination of card products and acquirers that do support installments will be shown on the MyCheckout hosted payment pages. /// - [ObsoleteAttribute("Use installments.numberOfInstallments instead")] + [Obsolete("Use installments.numberOfInstallments instead")] public long? NumberOfInstallments { get; set; } = null; /// diff --git a/connect-sdk-dotnet/Domain/Payment/Definitions/CardPaymentMethodSpecificInput.cs b/connect-sdk-dotnet/Domain/Payment/Definitions/CardPaymentMethodSpecificInput.cs index 4299f259..fae9655c 100644 --- a/connect-sdk-dotnet/Domain/Payment/Definitions/CardPaymentMethodSpecificInput.cs +++ b/connect-sdk-dotnet/Domain/Payment/Definitions/CardPaymentMethodSpecificInput.cs @@ -18,7 +18,7 @@ public class CardPaymentMethodSpecificInput : AbstractCardPaymentMethodSpecificI /// /// Object containing 3D secure details. /// - [ObsoleteAttribute("Use threeDSecure.externalCardholderAuthenticationData instead")] + [Obsolete("Use threeDSecure.externalCardholderAuthenticationData instead")] public ExternalCardholderAuthenticationData ExternalCardholderAuthenticationData { get; set; } = null; /// @@ -51,7 +51,7 @@ public class CardPaymentMethodSpecificInput : AbstractCardPaymentMethodSpecificI /// protocol://. This protocol must be registered on the device first. ///
URLs without a protocol will be rejected. ///
- [ObsoleteAttribute("Use threeDSecure.redirectionData.returnUrl instead")] + [Obsolete("Use threeDSecure.redirectionData.returnUrl instead")] public string ReturnUrl { get; set; } = null; /// diff --git a/connect-sdk-dotnet/Domain/Payment/Definitions/CashPaymentMethodSpecificInput.cs b/connect-sdk-dotnet/Domain/Payment/Definitions/CashPaymentMethodSpecificInput.cs index d6513597..1ee7cb9f 100644 --- a/connect-sdk-dotnet/Domain/Payment/Definitions/CashPaymentMethodSpecificInput.cs +++ b/connect-sdk-dotnet/Domain/Payment/Definitions/CashPaymentMethodSpecificInput.cs @@ -11,7 +11,7 @@ public class CashPaymentMethodSpecificInput : AbstractCashPaymentMethodSpecificI /// /// Object that holds the specific data for Boleto Bancario in Brazil (payment product 1503) /// - [ObsoleteAttribute("No replacement")] + [Obsolete("No replacement")] public CashPaymentProduct1503SpecificInput PaymentProduct1503SpecificInput { get; set; } = null; /// diff --git a/connect-sdk-dotnet/Domain/Payment/Definitions/CashPaymentProduct1503SpecificInput.cs b/connect-sdk-dotnet/Domain/Payment/Definitions/CashPaymentProduct1503SpecificInput.cs index 9131cc8a..be311003 100644 --- a/connect-sdk-dotnet/Domain/Payment/Definitions/CashPaymentProduct1503SpecificInput.cs +++ b/connect-sdk-dotnet/Domain/Payment/Definitions/CashPaymentProduct1503SpecificInput.cs @@ -6,7 +6,7 @@ namespace Ingenico.Connect.Sdk.Domain.Payment.Definitions { - [ObsoleteAttribute("No replacement")] + [Obsolete("No replacement")] public class CashPaymentProduct1503SpecificInput { /// @@ -15,7 +15,7 @@ public class CashPaymentProduct1503SpecificInput /// protocol://. This protocol must be registered on the device first. ///
URLs without a protocol will be rejected. ///
- [ObsoleteAttribute("No replacement, since Boleto Bancario no longer needs a return URL")] + [Obsolete("No replacement, since Boleto Bancario no longer needs a return URL")] public string ReturnUrl { get; set; } = null; } } diff --git a/connect-sdk-dotnet/Domain/Payment/Definitions/Customer.cs b/connect-sdk-dotnet/Domain/Payment/Definitions/Customer.cs index 70a08175..8732a6a9 100644 --- a/connect-sdk-dotnet/Domain/Payment/Definitions/Customer.cs +++ b/connect-sdk-dotnet/Domain/Payment/Definitions/Customer.cs @@ -95,7 +95,7 @@ public class Customer : CustomerBase /// /// Object containing shipping address details /// - [ObsoleteAttribute("Use Order.shipping.address instead")] + [Obsolete("Use Order.shipping.address instead")] public AddressPersonal ShippingAddress { get; set; } = null; } } diff --git a/connect-sdk-dotnet/Domain/Payment/Definitions/DecryptedPaymentData.cs b/connect-sdk-dotnet/Domain/Payment/Definitions/DecryptedPaymentData.cs index ff874be7..09896e9a 100644 --- a/connect-sdk-dotnet/Domain/Payment/Definitions/DecryptedPaymentData.cs +++ b/connect-sdk-dotnet/Domain/Payment/Definitions/DecryptedPaymentData.cs @@ -14,7 +14,7 @@ public class DecryptedPaymentData /// For Google Pay, maps to the paymentMethodDetails.authMethod property in the encrypted payment data. /// . ///
- [ObsoleteAttribute("Use decryptedPaymentData.paymentMethod instead")] + [Obsolete("Use decryptedPaymentData.paymentMethod instead")] public string AuthMethod { get; set; } = null; /// diff --git a/connect-sdk-dotnet/Domain/Payment/Definitions/DeviceRenderOptions.cs b/connect-sdk-dotnet/Domain/Payment/Definitions/DeviceRenderOptions.cs index 49c8e7b2..678a09a1 100644 --- a/connect-sdk-dotnet/Domain/Payment/Definitions/DeviceRenderOptions.cs +++ b/connect-sdk-dotnet/Domain/Payment/Definitions/DeviceRenderOptions.cs @@ -29,7 +29,7 @@ public class DeviceRenderOptions /// html-other = HTML Other (only valid when cardPaymentMethodSpecificInput.threeDSecure.sdkData.deviceRenderOptions.sdkInterface is set to html) /// /// - [ObsoleteAttribute("Use deviceRenderOptions.sdkUiTypes instead")] + [Obsolete("Use deviceRenderOptions.sdkUiTypes instead")] public string SdkUiType { get; set; } = null; /// diff --git a/connect-sdk-dotnet/Domain/Payment/Definitions/ExternalCardholderAuthenticationData.cs b/connect-sdk-dotnet/Domain/Payment/Definitions/ExternalCardholderAuthenticationData.cs index 7e45e8d1..2c6af1c2 100644 --- a/connect-sdk-dotnet/Domain/Payment/Definitions/ExternalCardholderAuthenticationData.cs +++ b/connect-sdk-dotnet/Domain/Payment/Definitions/ExternalCardholderAuthenticationData.cs @@ -67,7 +67,7 @@ public class ExternalCardholderAuthenticationData /// /// The 3-D Secure Server transaction ID that is used for the 3-D Secure version 2 Authentication. /// - [ObsoleteAttribute("No replacement")] + [Obsolete("No replacement")] public string ThreeDServerTransactionId { get; set; } = null; /// diff --git a/connect-sdk-dotnet/Domain/Payment/Definitions/Level3SummaryData.cs b/connect-sdk-dotnet/Domain/Payment/Definitions/Level3SummaryData.cs index 8ce0c7f2..2c6d5598 100644 --- a/connect-sdk-dotnet/Domain/Payment/Definitions/Level3SummaryData.cs +++ b/connect-sdk-dotnet/Domain/Payment/Definitions/Level3SummaryData.cs @@ -6,25 +6,25 @@ namespace Ingenico.Connect.Sdk.Domain.Payment.Definitions { - [ObsoleteAttribute("Use ShoppingCart.amountBreakdown instead")] + [Obsolete("Use ShoppingCart.amountBreakdown instead")] public class Level3SummaryData { /// /// Discount on the entire transaction, with the last 2 digits are implied decimal places /// - [ObsoleteAttribute("Use ShoppingCart.amountBreakdown with type DISCOUNT instead")] + [Obsolete("Use ShoppingCart.amountBreakdown with type DISCOUNT instead")] public long? DiscountAmount { get; set; } = null; /// /// Duty on the entire transaction, with the last 2 digits are implied decimal places /// - [ObsoleteAttribute("Use ShoppingCart.amountBreakdown with type DUTY instead")] + [Obsolete("Use ShoppingCart.amountBreakdown with type DUTY instead")] public long? DutyAmount { get; set; } = null; /// /// Shippingcost on the entire transaction, with the last 2 digits are implied decimal places /// - [ObsoleteAttribute("Use ShoppingCart.amountBreakdown with type SHIPPING instead")] + [Obsolete("Use ShoppingCart.amountBreakdown with type SHIPPING instead")] public long? ShippingAmount { get; set; } = null; } } diff --git a/connect-sdk-dotnet/Domain/Payment/Definitions/LineItem.cs b/connect-sdk-dotnet/Domain/Payment/Definitions/LineItem.cs index d462c500..98cbf40d 100644 --- a/connect-sdk-dotnet/Domain/Payment/Definitions/LineItem.cs +++ b/connect-sdk-dotnet/Domain/Payment/Definitions/LineItem.cs @@ -23,7 +23,7 @@ public class LineItem /// /// Object containing additional information that when supplied can have a beneficial effect on the discountrates /// - [ObsoleteAttribute("Use orderLineDetails instead")] + [Obsolete("Use orderLineDetails instead")] public LineItemLevel3InterchangeInformation Level3InterchangeInformation { get; set; } = null; /// diff --git a/connect-sdk-dotnet/Domain/Payment/Definitions/LoanRecipient.cs b/connect-sdk-dotnet/Domain/Payment/Definitions/LoanRecipient.cs index 0ba670f2..a5a43fd8 100644 --- a/connect-sdk-dotnet/Domain/Payment/Definitions/LoanRecipient.cs +++ b/connect-sdk-dotnet/Domain/Payment/Definitions/LoanRecipient.cs @@ -6,38 +6,38 @@ namespace Ingenico.Connect.Sdk.Domain.Payment.Definitions { - [ObsoleteAttribute("No replacement")] + [Obsolete("No replacement")] public class LoanRecipient { /// /// Should be filled with the last 10 digits of the bank account number of the recipient of the loan. /// - [ObsoleteAttribute("No replacement")] + [Obsolete("No replacement")] public string AccountNumber { get; set; } = null; /// /// The date of birth of the customer of the recipient of the loan. ///
Format: YYYYMMDD ///
- [ObsoleteAttribute("No replacement")] + [Obsolete("No replacement")] public string DateOfBirth { get; set; } = null; /// /// Should be filled with the first 6 and last 4 digits of the PAN number of the recipient of the loan. /// - [ObsoleteAttribute("No replacement")] + [Obsolete("No replacement")] public string PartialPan { get; set; } = null; /// /// Surname of the recipient of the loan. /// - [ObsoleteAttribute("No replacement")] + [Obsolete("No replacement")] public string Surname { get; set; } = null; /// /// Zip code of the recipient of the loan /// - [ObsoleteAttribute("No replacement")] + [Obsolete("No replacement")] public string Zip { get; set; } = null; } } diff --git a/connect-sdk-dotnet/Domain/Payment/Definitions/Order.cs b/connect-sdk-dotnet/Domain/Payment/Definitions/Order.cs index e1a7c640..49c650bb 100644 --- a/connect-sdk-dotnet/Domain/Payment/Definitions/Order.cs +++ b/connect-sdk-dotnet/Domain/Payment/Definitions/Order.cs @@ -28,7 +28,7 @@ public class Order /// /// Shopping cart data /// - [ObsoleteAttribute("Use shoppingCart.items instead")] + [Obsolete("Use shoppingCart.items instead")] public IList Items { get; set; } = null; /// @@ -39,7 +39,7 @@ public class Order /// /// Object containing seller details /// - [ObsoleteAttribute("Use Merchant.seller instead")] + [Obsolete("Use Merchant.seller instead")] public Seller Seller { get; set; } = null; /// diff --git a/connect-sdk-dotnet/Domain/Payment/Definitions/OrderTypeInformation.cs b/connect-sdk-dotnet/Domain/Payment/Definitions/OrderTypeInformation.cs index 08604e42..f3dd231f 100644 --- a/connect-sdk-dotnet/Domain/Payment/Definitions/OrderTypeInformation.cs +++ b/connect-sdk-dotnet/Domain/Payment/Definitions/OrderTypeInformation.cs @@ -14,6 +14,9 @@ public class OrderTypeInformation /// businessToConsumer = When fund is being transferred from business to consumer (B2C) /// businessToBusiness = When fund is being transferred from business to business (B2B) /// prefundingStagedWallet = When funding is being used to load the funds into the wallet account. + /// storedValueDigitalWallet = When funding is being used to load the funds into a stored value digital wallet. + /// fundingGiftCardForPersonalUse = When funding a gift card for personal use. + /// fundingGiftCardForSomeoneElse = When funding a gift card for someone else. /// /// public string FundingType { get; set; } = null; diff --git a/connect-sdk-dotnet/Domain/Payment/Definitions/RedirectPaymentMethodSpecificInput.cs b/connect-sdk-dotnet/Domain/Payment/Definitions/RedirectPaymentMethodSpecificInput.cs index cb576f57..f65d5dde 100644 --- a/connect-sdk-dotnet/Domain/Payment/Definitions/RedirectPaymentMethodSpecificInput.cs +++ b/connect-sdk-dotnet/Domain/Payment/Definitions/RedirectPaymentMethodSpecificInput.cs @@ -67,7 +67,7 @@ public class RedirectPaymentMethodSpecificInput : AbstractRedirectPaymentMethodS /// protocol://. This protocol must be registered on the device first. ///
URLs without a protocol will be rejected. ///
- [ObsoleteAttribute("Use redirectionData.returnUrl instead")] + [Obsolete("Use redirectionData.returnUrl instead")] public string ReturnUrl { get; set; } = null; } } diff --git a/connect-sdk-dotnet/Domain/Payment/Definitions/RedirectPaymentProduct809SpecificInput.cs b/connect-sdk-dotnet/Domain/Payment/Definitions/RedirectPaymentProduct809SpecificInput.cs index 16ec412c..68a55c84 100644 --- a/connect-sdk-dotnet/Domain/Payment/Definitions/RedirectPaymentProduct809SpecificInput.cs +++ b/connect-sdk-dotnet/Domain/Payment/Definitions/RedirectPaymentProduct809SpecificInput.cs @@ -12,7 +12,7 @@ public class RedirectPaymentProduct809SpecificInput /// This sets the maximum amount of minutes a customer has to complete the payment at the bank. After this period has expired it is impossible for the customer to make a payment and in case no payment has been made the transaction will be marked as unsuccessful and expired by the bank. Setting the expirationPeriod is convenient if you want to maximise the time a customer has to complete the payment. Please note that it is normal for a customer to take up to 5 minutes to complete a payment. Setting this value below 10 minutes is not advised. ///
You can set this value in minutes with a maximum value of 60 minutes. If no input is provided the default value of 60 is used for the transaction. ///
- [ObsoleteAttribute("Use RedirectPaymentMethodSpecificInput.expirationPeriod instead")] + [Obsolete("Use RedirectPaymentMethodSpecificInput.expirationPeriod instead")] public string ExpirationPeriod { get; set; } = null; /// diff --git a/connect-sdk-dotnet/Domain/Payment/Definitions/RedirectPaymentProduct840SpecificInput.cs b/connect-sdk-dotnet/Domain/Payment/Definitions/RedirectPaymentProduct840SpecificInput.cs index 25ad0846..370e4982 100644 --- a/connect-sdk-dotnet/Domain/Payment/Definitions/RedirectPaymentProduct840SpecificInput.cs +++ b/connect-sdk-dotnet/Domain/Payment/Definitions/RedirectPaymentProduct840SpecificInput.cs @@ -11,7 +11,7 @@ public class RedirectPaymentProduct840SpecificInput : AbstractRedirectPaymentPro /// /// A free text string that you can send to PayPal. With a special agreement between PayPal and you, PayPal uses the data in that property, for custom services they offer to you. /// - [ObsoleteAttribute("Use Order.references.descriptor instead")] + [Obsolete("Use Order.references.descriptor instead")] public string Custom { get; set; } = null; /// diff --git a/connect-sdk-dotnet/Domain/Payment/PaymentApprovalResponse.cs b/connect-sdk-dotnet/Domain/Payment/PaymentApprovalResponse.cs index c7aad4eb..790bd3dc 100644 --- a/connect-sdk-dotnet/Domain/Payment/PaymentApprovalResponse.cs +++ b/connect-sdk-dotnet/Domain/Payment/PaymentApprovalResponse.cs @@ -28,7 +28,7 @@ public class PaymentApprovalResponse /// Object containing additional payment method specific details ///
Deprecated: this property does not support different outputs for payment methods other than cards. Please use cardPaymentMethodSpecificOutput instead. ///
- [ObsoleteAttribute("Use cardPaymentMethodSpecificOutput instead")] + [Obsolete("Use cardPaymentMethodSpecificOutput instead")] public ApprovePaymentCardPaymentMethodSpecificOutput PaymentMethodSpecificOutput { get; set; } = null; } } diff --git a/connect-sdk-dotnet/Domain/Payout/CreatePayoutRequest.cs b/connect-sdk-dotnet/Domain/Payout/CreatePayoutRequest.cs index b1571ca1..86c5621d 100644 --- a/connect-sdk-dotnet/Domain/Payout/CreatePayoutRequest.cs +++ b/connect-sdk-dotnet/Domain/Payout/CreatePayoutRequest.cs @@ -13,19 +13,19 @@ public class CreatePayoutRequest /// /// Object containing amount and ISO currency code attributes /// - [ObsoleteAttribute("Moved to PayoutDetails")] + [Obsolete("Moved to PayoutDetails")] public AmountOfMoney AmountOfMoney { get; set; } = null; /// /// Object containing account holder name and bank account information. This property can only be used for payouts in the UK. /// - [ObsoleteAttribute("Moved to BankTransferPayoutMethodSpecificInput")] + [Obsolete("Moved to BankTransferPayoutMethodSpecificInput")] public BankAccountBban BankAccountBban { get; set; } = null; /// /// Object containing account holder and IBAN information. /// - [ObsoleteAttribute("Moved to BankTransferPayoutMethodSpecificInput")] + [Obsolete("Moved to BankTransferPayoutMethodSpecificInput")] public BankAccountIban BankAccountIban { get; set; } = null; /// @@ -41,7 +41,7 @@ public class CreatePayoutRequest /// /// Object containing the details of the customer. /// - [ObsoleteAttribute("Moved to PayoutDetails")] + [Obsolete("Moved to PayoutDetails")] public PayoutCustomer Customer { get; set; } = null; /// @@ -53,7 +53,7 @@ public class CreatePayoutRequest /// Date of the payout sent to the bank by us ///
Format: YYYYMMDD ///
- [ObsoleteAttribute("Moved to BankTransferPayoutMethodSpecificInput")] + [Obsolete("Moved to BankTransferPayoutMethodSpecificInput")] public string PayoutDate { get; set; } = null; /// @@ -64,19 +64,19 @@ public class CreatePayoutRequest /// /// Text to be printed on the bank account statement of the beneficiary. The maximum allowed length might differ per country. The data will be automatically truncated to the maximum allowed length. /// - [ObsoleteAttribute("Moved to BankTransferPayoutMethodSpecificInput")] + [Obsolete("Moved to BankTransferPayoutMethodSpecificInput")] public string PayoutText { get; set; } = null; /// /// Object that holds all reference properties that are linked to this transaction /// - [ObsoleteAttribute("Moved to PayoutDetails")] + [Obsolete("Moved to PayoutDetails")] public PayoutReferences References { get; set; } = null; /// /// The BIC is the Business Identifier Code, also known as SWIFT or Bank Identifier code. It is a code with an internationally agreed format to Identify a specific bank. The BIC contains 8 or 11 positions: the first 4 contain the bank code, followed by the country code and location code. /// - [ObsoleteAttribute("Moved to BankTransferPayoutMethodSpecificInput")] + [Obsolete("Moved to BankTransferPayoutMethodSpecificInput")] public string SwiftCode { get; set; } = null; } } diff --git a/connect-sdk-dotnet/Domain/Payout/Definitions/BankTransferPayoutMethodSpecificInput.cs b/connect-sdk-dotnet/Domain/Payout/Definitions/BankTransferPayoutMethodSpecificInput.cs index cbdad8e8..112a9b92 100644 --- a/connect-sdk-dotnet/Domain/Payout/Definitions/BankTransferPayoutMethodSpecificInput.cs +++ b/connect-sdk-dotnet/Domain/Payout/Definitions/BankTransferPayoutMethodSpecificInput.cs @@ -22,7 +22,7 @@ public class BankTransferPayoutMethodSpecificInput : AbstractPayoutMethodSpecifi /// /// Object containing the details of the customer. /// - [ObsoleteAttribute("Moved to PayoutDetails")] + [Obsolete("Moved to PayoutDetails")] public PayoutCustomer Customer { get; set; } = null; /// diff --git a/connect-sdk-dotnet/Domain/Product/Definitions/ValueMappingElement.cs b/connect-sdk-dotnet/Domain/Product/Definitions/ValueMappingElement.cs index 307fc8c2..bf4dc0e5 100644 --- a/connect-sdk-dotnet/Domain/Product/Definitions/ValueMappingElement.cs +++ b/connect-sdk-dotnet/Domain/Product/Definitions/ValueMappingElement.cs @@ -17,7 +17,7 @@ public class ValueMappingElement /// /// Key name /// - [ObsoleteAttribute("Use displayElements instead with ID 'displayName'")] + [Obsolete("Use displayElements instead with ID 'displayName'")] public string DisplayName { get; set; } = null; /// diff --git a/connect-sdk-dotnet/Domain/Riskassessments/Definitions/CustomerRiskAssessment.cs b/connect-sdk-dotnet/Domain/Riskassessments/Definitions/CustomerRiskAssessment.cs index 9de98816..8f4bad06 100644 --- a/connect-sdk-dotnet/Domain/Riskassessments/Definitions/CustomerRiskAssessment.cs +++ b/connect-sdk-dotnet/Domain/Riskassessments/Definitions/CustomerRiskAssessment.cs @@ -62,7 +62,7 @@ public class CustomerRiskAssessment /// /// Object containing shipping address details /// - [ObsoleteAttribute("Use Order.shipping.address instead")] + [Obsolete("Use Order.shipping.address instead")] public AddressPersonal ShippingAddress { get; set; } = null; } } diff --git a/connect-sdk-dotnet/Domain/Webhooks/WebhooksEvent.cs b/connect-sdk-dotnet/Domain/Webhooks/WebhooksEvent.cs index 628ff643..e0da10bd 100644 --- a/connect-sdk-dotnet/Domain/Webhooks/WebhooksEvent.cs +++ b/connect-sdk-dotnet/Domain/Webhooks/WebhooksEvent.cs @@ -1,4 +1,3 @@ -using System; using Ingenico.Connect.Sdk.Domain.Dispute; using Ingenico.Connect.Sdk.Domain.Payment; using Ingenico.Connect.Sdk.Domain.Refund; diff --git a/connect-sdk-dotnet/EntityHeader.cs b/connect-sdk-dotnet/EntityHeader.cs index f02dda0c..43a5deca 100644 --- a/connect-sdk-dotnet/EntityHeader.cs +++ b/connect-sdk-dotnet/EntityHeader.cs @@ -6,7 +6,7 @@ namespace Ingenico.Connect.Sdk /// /// A header that specifies metadata about the content of the request or response. Immutable. /// - class EntityHeader : IRequestHeader, IResponseHeader + internal class EntityHeader : IRequestHeader, IResponseHeader { public EntityHeader(string name, string value) { @@ -18,7 +18,7 @@ public EntityHeader(string name, string value) Value = NormalizeValue(value); } - private string NormalizeValue(string value) + private static string NormalizeValue(string value) { if (string.IsNullOrEmpty(value)) { @@ -50,11 +50,8 @@ private string NormalizeValue(string value) public override int GetHashCode() => Tuple.Create(Name, Value).GetHashCode(); - public bool Equals(EntityHeader obj) - => (obj?.Name?.Equals(Name) ?? false) - && (obj?.Value?.Equals(Value) ?? false); + public bool Equals(EntityHeader obj) => (obj?.Name?.Equals(Name) ?? false) && (obj.Value?.Equals(Value) ?? false); - public override bool Equals(object obj) - => obj is EntityHeader && Equals(obj as EntityHeader); + public override bool Equals(object obj) => Equals(obj as EntityHeader); } } diff --git a/connect-sdk-dotnet/Factory.cs b/connect-sdk-dotnet/Factory.cs index 9e400dba..8f23236d 100644 --- a/connect-sdk-dotnet/Factory.cs +++ b/connect-sdk-dotnet/Factory.cs @@ -7,7 +7,7 @@ namespace Ingenico.Connect.Sdk /// /// Ingenico ePayments platform factory for several SDK components. /// - public sealed class Factory + public static class Factory { /// /// Creates a based on the configuration values in @@ -200,7 +200,5 @@ public static Client CreateClient(Communicator communicator) { return new Client(communicator); } - - Factory() { } } } diff --git a/connect-sdk-dotnet/IMultipartFormDataRequest.cs b/connect-sdk-dotnet/IMultipartFormDataRequest.cs index 820f71e1..c4d81478 100644 --- a/connect-sdk-dotnet/IMultipartFormDataRequest.cs +++ b/connect-sdk-dotnet/IMultipartFormDataRequest.cs @@ -1,7 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Collections.Immutable; - namespace Ingenico.Connect.Sdk { /// diff --git a/connect-sdk-dotnet/Logging/BodyObfuscator.cs b/connect-sdk-dotnet/Logging/BodyObfuscator.cs index d291eb8e..f0b73116 100644 --- a/connect-sdk-dotnet/Logging/BodyObfuscator.cs +++ b/connect-sdk-dotnet/Logging/BodyObfuscator.cs @@ -16,11 +16,11 @@ public class BodyObfuscator BodyObfuscator(IDictionary obfuscationRules) { - _obfuscationRules = ImmutableDictionary.ToImmutableDictionary(obfuscationRules); + _obfuscationRules = obfuscationRules.ToImmutableDictionary(); _propertyRegex = BuildPropertyPattern(obfuscationRules.Keys); } - Regex BuildPropertyPattern(IEnumerable propertyNames) + static Regex BuildPropertyPattern(IEnumerable propertyNames) { if (propertyNames.IsEmpty()) { @@ -187,7 +187,7 @@ public Builder ObfuscateCustom(string propertyName, ObfuscationRule obfuscationR public BodyObfuscator Build() { - return new BodyObfuscator(this.ObfuscationRules); + return new BodyObfuscator(ObfuscationRules); } internal Builder() diff --git a/connect-sdk-dotnet/Logging/HeaderObfuscator.cs b/connect-sdk-dotnet/Logging/HeaderObfuscator.cs index 4f983d57..db9482b5 100644 --- a/connect-sdk-dotnet/Logging/HeaderObfuscator.cs +++ b/connect-sdk-dotnet/Logging/HeaderObfuscator.cs @@ -13,13 +13,13 @@ public class HeaderObfuscator HeaderObfuscator(IDictionary obfuscationRules) { - _obfuscationRules = ImmutableDictionary.ToImmutableDictionary(obfuscationRules, StringComparer.OrdinalIgnoreCase); + _obfuscationRules = obfuscationRules.ToImmutableDictionary(StringComparer.OrdinalIgnoreCase); } /// /// Obfuscates the value for the given header as necessary. /// - public String ObfuscateHeader(String name, String value) + public string ObfuscateHeader(string name, string value) { if (_obfuscationRules.TryGetValue(name, out ObfuscationRule obfuscationRule)) { @@ -101,7 +101,7 @@ public Builder ObfuscateCustom(string headerName, ObfuscationRule obfuscationRul public HeaderObfuscator Build() { - return new HeaderObfuscator(this.ObfuscationRules); + return new HeaderObfuscator(ObfuscationRules); } internal Builder() diff --git a/connect-sdk-dotnet/Logging/IObfuscationCapable.cs b/connect-sdk-dotnet/Logging/IObfuscationCapable.cs index 7099ad4e..84dcdef6 100644 --- a/connect-sdk-dotnet/Logging/IObfuscationCapable.cs +++ b/connect-sdk-dotnet/Logging/IObfuscationCapable.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Ingenico.Connect.Sdk.Logging +namespace Ingenico.Connect.Sdk.Logging { /// /// Classes that implement this interface support obfuscating bodies and headers. diff --git a/connect-sdk-dotnet/Logging/LogMessageBuilder.cs b/connect-sdk-dotnet/Logging/LogMessageBuilder.cs index c176333e..5685042e 100644 --- a/connect-sdk-dotnet/Logging/LogMessageBuilder.cs +++ b/connect-sdk-dotnet/Logging/LogMessageBuilder.cs @@ -66,7 +66,7 @@ protected LogMessageBuilder(string requestId, BodyObfuscator bodyObfuscator, Hea HeaderObfuscator = headerObfuscator ?? throw new ArgumentException("headerObfuscator is required"); } - [ObsoleteAttribute("Use the constructor that takes a BodyObfuscator and HeaderObfuscator instead")] + [Obsolete("Use the constructor that takes a BodyObfuscator and HeaderObfuscator instead")] protected LogMessageBuilder(string requestId) : this(requestId, BodyObfuscator.DefaultObfuscator, HeaderObfuscator.DefaultObfuscator) { @@ -77,12 +77,12 @@ protected string EmptyIfNull(string value) return value ?? ""; } - bool IsBinaryContent(string contentType) + static bool IsBinaryContent(string contentType) { return contentType != null && !contentType.StartsWith("text/", StringComparison.OrdinalIgnoreCase) - && (contentType.IndexOf("json", StringComparison.OrdinalIgnoreCase) < 0) - && (contentType.IndexOf("xml", StringComparison.OrdinalIgnoreCase) < 0); + && contentType.IndexOf("json", StringComparison.OrdinalIgnoreCase) < 0 + && contentType.IndexOf("xml", StringComparison.OrdinalIgnoreCase) < 0; } } } diff --git a/connect-sdk-dotnet/Logging/LoggingUtil.cs b/connect-sdk-dotnet/Logging/LoggingUtil.cs index 3e97df11..0f07fad0 100644 --- a/connect-sdk-dotnet/Logging/LoggingUtil.cs +++ b/connect-sdk-dotnet/Logging/LoggingUtil.cs @@ -1,5 +1,3 @@ -using System; - namespace Ingenico.Connect.Sdk.Logging { /// diff --git a/connect-sdk-dotnet/Logging/NLogCommunicatorLogger.cs b/connect-sdk-dotnet/Logging/NLogCommunicatorLogger.cs index ec403824..d0f8ea5d 100644 --- a/connect-sdk-dotnet/Logging/NLogCommunicatorLogger.cs +++ b/connect-sdk-dotnet/Logging/NLogCommunicatorLogger.cs @@ -26,7 +26,7 @@ public NLogCommunicatorLogger(ILogger logger, LogLevel level) : this(logger, lev /// The level to use when logging through public NLogCommunicatorLogger(ILogger logger, LogLevel logLevel, LogLevel errorLogLevel) { - _logger = logger ?? throw new ArgumentNullException(); ; + _logger = logger ?? throw new ArgumentNullException(); _logLevel = logLevel ?? LogLevel.Debug; _errorLogLevel = errorLogLevel ?? LogLevel.Error; } diff --git a/connect-sdk-dotnet/Logging/ObfuscationRule.cs b/connect-sdk-dotnet/Logging/ObfuscationRule.cs index 9972b40e..4beb3dcc 100644 --- a/connect-sdk-dotnet/Logging/ObfuscationRule.cs +++ b/connect-sdk-dotnet/Logging/ObfuscationRule.cs @@ -1,13 +1,7 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Ingenico.Connect.Sdk.Logging +namespace Ingenico.Connect.Sdk.Logging { /// /// An obfuscation rule defines how a single value is obfuscated. This can be as simple as returning a fixed mask, or as complex as necessary. /// - public delegate String ObfuscationRule(string value); + public delegate string ObfuscationRule(string value); } diff --git a/connect-sdk-dotnet/Logging/RequestLogMessageBuilder.cs b/connect-sdk-dotnet/Logging/RequestLogMessageBuilder.cs index dc852cb1..f10b1f2a 100644 --- a/connect-sdk-dotnet/Logging/RequestLogMessageBuilder.cs +++ b/connect-sdk-dotnet/Logging/RequestLogMessageBuilder.cs @@ -7,12 +7,12 @@ namespace Ingenico.Connect.Sdk.Logging /// public class RequestLogMessageBuilder : LogMessageBuilder { - const string messageTemplateWithoutBody = @"Outgoing request (requestId='{0}'): + const string MessageTemplateWithoutBody = @"Outgoing request (requestId='{0}'): method: '{1}' uri: '{2}' headers: '{3}'"; - const string messageTemplateWithBody = messageTemplateWithoutBody + @" + const string MessageTemplateWithBody = MessageTemplateWithoutBody + @" content-type: '{4}' body: '{5}'"; @@ -23,7 +23,7 @@ public RequestLogMessageBuilder(string requestId, string method, string uri, Bod _uri = uri; } - [ObsoleteAttribute("Use the constructor that takes a BodyObfuscator and HeaderObfuscator instead")] + [Obsolete("Use the constructor that takes a BodyObfuscator and HeaderObfuscator instead")] public RequestLogMessageBuilder(string requestId, string method, string uri) : base(requestId) { @@ -39,14 +39,14 @@ public override string Message string body = Body; if (body == null) { - return string.Format(messageTemplateWithoutBody, RequestId, + return string.Format(MessageTemplateWithoutBody, RequestId, EmptyIfNull(_method), EmptyIfNull(_uri), Headers); } - return string.Format(messageTemplateWithBody, RequestId, + return string.Format(MessageTemplateWithBody, RequestId, EmptyIfNull(_method), EmptyIfNull(_uri), Headers, diff --git a/connect-sdk-dotnet/Logging/ResponseLogMessageBuilder.cs b/connect-sdk-dotnet/Logging/ResponseLogMessageBuilder.cs index 39f07ed3..1ac6d33a 100644 --- a/connect-sdk-dotnet/Logging/ResponseLogMessageBuilder.cs +++ b/connect-sdk-dotnet/Logging/ResponseLogMessageBuilder.cs @@ -8,7 +8,7 @@ namespace Ingenico.Connect.Sdk.Logging /// public class ResponseLogMessageBuilder : LogMessageBuilder { - const string messageTemplate = @"Incoming response (requestId='{0}' + '{1}' ms): + const string MessageTemplate = @"Incoming response (requestId='{0}' + '{1}' ms): status-code: '{2}' headers: '{3}' content-type: '{4}' @@ -21,31 +21,25 @@ public ResponseLogMessageBuilder(string requestId, HttpStatusCode statusCode, Ti Duration = duration; } - [ObsoleteAttribute("Use the constructor that takes a BodyObfuscator and HeaderObfuscator instead")] + [Obsolete("Use the constructor that takes a BodyObfuscator and HeaderObfuscator instead")] public ResponseLogMessageBuilder(string requestId, HttpStatusCode statusCode) : base(requestId) { _statusCode = statusCode; } - [ObsoleteAttribute("Ignores the duration argument. Set the Duration property instead")] + [Obsolete("Ignores the duration argument. Set the Duration property instead")] public ResponseLogMessageBuilder(string requestId, HttpStatusCode statusCode, long duration) : base(requestId) { _statusCode = statusCode; } - public override string Message - { - get - { - return string.Format(messageTemplate, RequestId, (long)Duration.TotalMilliseconds, - (int)_statusCode, - Headers, - EmptyIfNull(ContentType), - EmptyIfNull(Body)); - } - } + public override string Message => string.Format(MessageTemplate, RequestId, (long)Duration.TotalMilliseconds, + (int)_statusCode, + Headers, + EmptyIfNull(ContentType), + EmptyIfNull(Body)); public TimeSpan Duration { get; set; } diff --git a/connect-sdk-dotnet/Logging/SystemConsoleCommunicatorLogger.cs b/connect-sdk-dotnet/Logging/SystemConsoleCommunicatorLogger.cs index 2bc35ec8..e4d354b6 100644 --- a/connect-sdk-dotnet/Logging/SystemConsoleCommunicatorLogger.cs +++ b/connect-sdk-dotnet/Logging/SystemConsoleCommunicatorLogger.cs @@ -37,6 +37,6 @@ public void Log(string message, Exception exception) } - string DatePrefix => DateTime.Now.ToString("s") + " "; + static string DatePrefix => DateTime.Now.ToString("s") + " "; } } diff --git a/connect-sdk-dotnet/Logging/ValueObfuscator.cs b/connect-sdk-dotnet/Logging/ValueObfuscator.cs index 1c75d257..a327cebd 100644 --- a/connect-sdk-dotnet/Logging/ValueObfuscator.cs +++ b/connect-sdk-dotnet/Logging/ValueObfuscator.cs @@ -1,6 +1,6 @@ namespace Ingenico.Connect.Sdk.Logging { - class ValueObfuscator + internal class ValueObfuscator { internal static readonly ValueObfuscator All = new ValueObfuscator(0, 0, 0); diff --git a/connect-sdk-dotnet/Merchant/Disputes/UploadFileRequest.cs b/connect-sdk-dotnet/Merchant/Disputes/UploadFileRequest.cs index 00b5b0c9..ff02eaf6 100644 --- a/connect-sdk-dotnet/Merchant/Disputes/UploadFileRequest.cs +++ b/connect-sdk-dotnet/Merchant/Disputes/UploadFileRequest.cs @@ -2,9 +2,6 @@ * This class was auto-generated from the API references found at * https://epayments-api.developer-ingenico.com/ */ -using Ingenico.Connect.Sdk; -using System.Collections.Generic; - namespace Ingenico.Connect.Sdk.Merchant.Disputes { /// diff --git a/connect-sdk-dotnet/Merchant/Payments/FindPaymentsParams.cs b/connect-sdk-dotnet/Merchant/Payments/FindPaymentsParams.cs index fbddcf59..af272a7f 100644 --- a/connect-sdk-dotnet/Merchant/Payments/FindPaymentsParams.cs +++ b/connect-sdk-dotnet/Merchant/Payments/FindPaymentsParams.cs @@ -2,7 +2,6 @@ * This class was auto-generated from the API references found at * https://epayments-api.developer-ingenico.com/ */ -using Ingenico.Connect.Sdk; using System.Collections.Generic; namespace Ingenico.Connect.Sdk.Merchant.Payments diff --git a/connect-sdk-dotnet/Merchant/Payouts/FindPayoutsParams.cs b/connect-sdk-dotnet/Merchant/Payouts/FindPayoutsParams.cs index 35bcac5a..4fca6a7d 100644 --- a/connect-sdk-dotnet/Merchant/Payouts/FindPayoutsParams.cs +++ b/connect-sdk-dotnet/Merchant/Payouts/FindPayoutsParams.cs @@ -2,7 +2,6 @@ * This class was auto-generated from the API references found at * https://epayments-api.developer-ingenico.com/ */ -using Ingenico.Connect.Sdk; using System.Collections.Generic; namespace Ingenico.Connect.Sdk.Merchant.Payouts diff --git a/connect-sdk-dotnet/Merchant/Productgroups/FindProductgroupsParams.cs b/connect-sdk-dotnet/Merchant/Productgroups/FindProductgroupsParams.cs index 6981bea6..bc0a5257 100644 --- a/connect-sdk-dotnet/Merchant/Productgroups/FindProductgroupsParams.cs +++ b/connect-sdk-dotnet/Merchant/Productgroups/FindProductgroupsParams.cs @@ -2,7 +2,6 @@ * This class was auto-generated from the API references found at * https://epayments-api.developer-ingenico.com/ */ -using Ingenico.Connect.Sdk; using System.Collections.Generic; namespace Ingenico.Connect.Sdk.Merchant.Productgroups @@ -42,6 +41,15 @@ public class FindProductgroupsParams : AbstractParamRequest /// public bool? IsRecurring { get; set; } = null; + /// + /// This allows you to filter payment products based on their support for installments or not + /// + /// true + /// false + /// If this is omitted all payment products are returned. + /// + public bool? IsInstallments { get; set; } = null; + /// /// Allows you to hide elements from the response, reducing the amount of data that needs to be returned to your client. Possible options are: /// @@ -86,6 +94,10 @@ public override IEnumerable ToRequestParameters() { result.Add(new RequestParam("isRecurring", IsRecurring.ToString().ToLower())); } + if (IsInstallments != null) + { + result.Add(new RequestParam("isInstallments", IsInstallments.ToString().ToLower())); + } if (Hide != null) { foreach (var hideElement in Hide) diff --git a/connect-sdk-dotnet/Merchant/Productgroups/GetProductgroupParams.cs b/connect-sdk-dotnet/Merchant/Productgroups/GetProductgroupParams.cs index 5288349f..49972468 100644 --- a/connect-sdk-dotnet/Merchant/Productgroups/GetProductgroupParams.cs +++ b/connect-sdk-dotnet/Merchant/Productgroups/GetProductgroupParams.cs @@ -2,7 +2,6 @@ * This class was auto-generated from the API references found at * https://epayments-api.developer-ingenico.com/ */ -using Ingenico.Connect.Sdk; using System.Collections.Generic; namespace Ingenico.Connect.Sdk.Merchant.Productgroups @@ -42,6 +41,15 @@ public class GetProductgroupParams : AbstractParamRequest /// public bool? IsRecurring { get; set; } = null; + /// + /// This allows you to filter payment products based on their support for installments or not + /// + /// true + /// false + /// If this is omitted all payment products are returned. + /// + public bool? IsInstallments { get; set; } = null; + /// /// Allows you to hide elements from the response, reducing the amount of data that needs to be returned to your client. Possible options are: /// @@ -86,6 +94,10 @@ public override IEnumerable ToRequestParameters() { result.Add(new RequestParam("isRecurring", IsRecurring.ToString().ToLower())); } + if (IsInstallments != null) + { + result.Add(new RequestParam("isInstallments", IsInstallments.ToString().ToLower())); + } if (Hide != null) { foreach (var hideElement in Hide) diff --git a/connect-sdk-dotnet/Merchant/Products/DirectoryParams.cs b/connect-sdk-dotnet/Merchant/Products/DirectoryParams.cs index c0a1495a..edb30c1f 100644 --- a/connect-sdk-dotnet/Merchant/Products/DirectoryParams.cs +++ b/connect-sdk-dotnet/Merchant/Products/DirectoryParams.cs @@ -2,7 +2,6 @@ * This class was auto-generated from the API references found at * https://epayments-api.developer-ingenico.com/ */ -using Ingenico.Connect.Sdk; using System.Collections.Generic; namespace Ingenico.Connect.Sdk.Merchant.Products diff --git a/connect-sdk-dotnet/Merchant/Products/FindProductsParams.cs b/connect-sdk-dotnet/Merchant/Products/FindProductsParams.cs index 1bf77802..3cca38db 100644 --- a/connect-sdk-dotnet/Merchant/Products/FindProductsParams.cs +++ b/connect-sdk-dotnet/Merchant/Products/FindProductsParams.cs @@ -2,7 +2,6 @@ * This class was auto-generated from the API references found at * https://epayments-api.developer-ingenico.com/ */ -using Ingenico.Connect.Sdk; using System.Collections.Generic; namespace Ingenico.Connect.Sdk.Merchant.Products @@ -42,6 +41,15 @@ public class FindProductsParams : AbstractParamRequest /// public bool? IsRecurring { get; set; } = null; + /// + /// This allows you to filter payment products based on their support for installments or not + /// + /// true + /// false + /// If this is omitted all payment products are returned. + /// + public bool? IsInstallments { get; set; } = null; + /// /// Allows you to hide elements from the response, reducing the amount of data that needs to be returned to your client. Possible options are: /// @@ -89,6 +97,10 @@ public override IEnumerable ToRequestParameters() { result.Add(new RequestParam("isRecurring", IsRecurring.ToString().ToLower())); } + if (IsInstallments != null) + { + result.Add(new RequestParam("isInstallments", IsInstallments.ToString().ToLower())); + } if (Hide != null) { foreach (var hideElement in Hide) diff --git a/connect-sdk-dotnet/Merchant/Products/GetProductParams.cs b/connect-sdk-dotnet/Merchant/Products/GetProductParams.cs index d044d120..f28bb31e 100644 --- a/connect-sdk-dotnet/Merchant/Products/GetProductParams.cs +++ b/connect-sdk-dotnet/Merchant/Products/GetProductParams.cs @@ -2,7 +2,6 @@ * This class was auto-generated from the API references found at * https://epayments-api.developer-ingenico.com/ */ -using Ingenico.Connect.Sdk; using System.Collections.Generic; namespace Ingenico.Connect.Sdk.Merchant.Products @@ -42,6 +41,15 @@ public class GetProductParams : AbstractParamRequest /// public bool? IsRecurring { get; set; } = null; + /// + /// This allows you to filter payment products based on their support for installments or not + /// + /// true + /// false + /// If this is omitted all payment products are returned. + /// + public bool? IsInstallments { get; set; } = null; + /// /// Allows you to hide elements from the response, reducing the amount of data that needs to be returned to your client. Possible options are: /// @@ -91,6 +99,10 @@ public override IEnumerable ToRequestParameters() { result.Add(new RequestParam("isRecurring", IsRecurring.ToString().ToLower())); } + if (IsInstallments != null) + { + result.Add(new RequestParam("isInstallments", IsInstallments.ToString().ToLower())); + } if (Hide != null) { foreach (var hideElement in Hide) diff --git a/connect-sdk-dotnet/Merchant/Products/NetworksParams.cs b/connect-sdk-dotnet/Merchant/Products/NetworksParams.cs index 7bad6863..e99b611d 100644 --- a/connect-sdk-dotnet/Merchant/Products/NetworksParams.cs +++ b/connect-sdk-dotnet/Merchant/Products/NetworksParams.cs @@ -2,7 +2,6 @@ * This class was auto-generated from the API references found at * https://epayments-api.developer-ingenico.com/ */ -using Ingenico.Connect.Sdk; using System.Collections.Generic; namespace Ingenico.Connect.Sdk.Merchant.Products diff --git a/connect-sdk-dotnet/Merchant/Refunds/FindRefundsParams.cs b/connect-sdk-dotnet/Merchant/Refunds/FindRefundsParams.cs index 4da8ed4a..66fe686d 100644 --- a/connect-sdk-dotnet/Merchant/Refunds/FindRefundsParams.cs +++ b/connect-sdk-dotnet/Merchant/Refunds/FindRefundsParams.cs @@ -2,7 +2,6 @@ * This class was auto-generated from the API references found at * https://epayments-api.developer-ingenico.com/ */ -using Ingenico.Connect.Sdk; using System.Collections.Generic; namespace Ingenico.Connect.Sdk.Merchant.Refunds diff --git a/connect-sdk-dotnet/Merchant/Services/ConvertAmountParams.cs b/connect-sdk-dotnet/Merchant/Services/ConvertAmountParams.cs index e3c7603b..fe1515f2 100644 --- a/connect-sdk-dotnet/Merchant/Services/ConvertAmountParams.cs +++ b/connect-sdk-dotnet/Merchant/Services/ConvertAmountParams.cs @@ -2,7 +2,6 @@ * This class was auto-generated from the API references found at * https://epayments-api.developer-ingenico.com/ */ -using Ingenico.Connect.Sdk; using System.Collections.Generic; namespace Ingenico.Connect.Sdk.Merchant.Services diff --git a/connect-sdk-dotnet/Merchant/Services/PrivacypolicyParams.cs b/connect-sdk-dotnet/Merchant/Services/PrivacypolicyParams.cs index 3d3ed18e..b04ffa02 100644 --- a/connect-sdk-dotnet/Merchant/Services/PrivacypolicyParams.cs +++ b/connect-sdk-dotnet/Merchant/Services/PrivacypolicyParams.cs @@ -2,7 +2,6 @@ * This class was auto-generated from the API references found at * https://epayments-api.developer-ingenico.com/ */ -using Ingenico.Connect.Sdk; using System.Collections.Generic; namespace Ingenico.Connect.Sdk.Merchant.Services diff --git a/connect-sdk-dotnet/Merchant/Tokens/DeleteTokenParams.cs b/connect-sdk-dotnet/Merchant/Tokens/DeleteTokenParams.cs index 02015e3e..4c113a76 100644 --- a/connect-sdk-dotnet/Merchant/Tokens/DeleteTokenParams.cs +++ b/connect-sdk-dotnet/Merchant/Tokens/DeleteTokenParams.cs @@ -2,7 +2,6 @@ * This class was auto-generated from the API references found at * https://epayments-api.developer-ingenico.com/ */ -using Ingenico.Connect.Sdk; using System.Collections.Generic; namespace Ingenico.Connect.Sdk.Merchant.Tokens diff --git a/connect-sdk-dotnet/MetaDataProvider.cs b/connect-sdk-dotnet/MetaDataProvider.cs index eb6af8b9..1907e330 100644 --- a/connect-sdk-dotnet/MetaDataProvider.cs +++ b/connect-sdk-dotnet/MetaDataProvider.cs @@ -40,7 +40,7 @@ public static void ValidateAdditionalRequestHeader(RequestHeader additionalReque public static readonly IEnumerable ProhibitedHeaders = new ReadOnlyCollection(new List { - SERVER_META_INFO_HEADER, + ServerMetaInfoHeader, "X-GCS-Idempotence-Key", "Date", "Content-Type", @@ -61,10 +61,10 @@ public static readonly IEnumerable ProhibitedHeaders }; string serverMetaInfoString = DefaultMarshaller.Instance.Marshal(serverMetaInfo); - RequestHeader serverMetaInfoHeader = new RequestHeader(SERVER_META_INFO_HEADER, serverMetaInfoString.ToBase64String()); + RequestHeader serverMetaInfoHeader = new RequestHeader(ServerMetaInfoHeader, serverMetaInfoString.ToBase64String()); ServerMetaDataHeaders = new List { serverMetaInfoHeader } - .Concat(additionalRequestHeaders ?? Enumerable.Empty()); ; + .Concat(additionalRequestHeaders ?? Enumerable.Empty()); } internal class ServerMetaInfo @@ -80,25 +80,19 @@ internal class ServerMetaInfo public ShoppingCartExtension ShoppingCartExtension { get; set; } } - internal string SdkIdentifier => "DotnetServerSDK/v" + SDK_VERSION; + internal string SdkIdentifier => "DotnetServerSDK/v" + SdkVersion; - internal string PlatformIdentifier - { - get - { - StringBuilder sb = new StringBuilder(); - sb.Append(Environment.OSVersion.Platform); - sb.Append("/"); - sb.Append(Environment.OSVersion.Version); - sb.Append(" .NET/"); - sb.Append(Environment.Version); - return sb.ToString(); - } - } + internal string PlatformIdentifier => new StringBuilder() + .Append(Environment.OSVersion.Platform) + .Append("/") + .Append(Environment.OSVersion.Version) + .Append(" .NET/") + .Append(Environment.Version) + .ToString(); - const string SDK_VERSION = "3.46.0"; + const string SdkVersion = "3.47.0"; - const string SERVER_META_INFO_HEADER = "X-GCS-ServerMetaInfo"; + const string ServerMetaInfoHeader = "X-GCS-ServerMetaInfo"; internal static void ValidateAdditionalRequestHeaders(IEnumerable additionalRequestHeaders) { diff --git a/connect-sdk-dotnet/MetaDataProviderBuilder.cs b/connect-sdk-dotnet/MetaDataProviderBuilder.cs index f140bb7d..cd597b6c 100644 --- a/connect-sdk-dotnet/MetaDataProviderBuilder.cs +++ b/connect-sdk-dotnet/MetaDataProviderBuilder.cs @@ -33,10 +33,7 @@ public class MetaDataProviderBuilder /// public IEnumerable AdditionalRequestHeaders { - get - { - return _additionalRequestHeaders; - } + get => _additionalRequestHeaders; set { MetaDataProvider.ValidateAdditionalRequestHeaders(value); diff --git a/connect-sdk-dotnet/MultipartFormDataObject.cs b/connect-sdk-dotnet/MultipartFormDataObject.cs index 6f42d7a1..067d5e32 100644 --- a/connect-sdk-dotnet/MultipartFormDataObject.cs +++ b/connect-sdk-dotnet/MultipartFormDataObject.cs @@ -21,21 +21,9 @@ public MultipartFormDataObject() public string ContentType { get; } - public IDictionary Values - { - get - { - return ImmutableDictionary.ToImmutableDictionary(_values); - } - } + public IDictionary Values => _values.ToImmutableDictionary(); - public IDictionary Files - { - get - { - return ImmutableDictionary.ToImmutableDictionary(_files); - } - } + public IDictionary Files => _files.ToImmutableDictionary(); public void AddValue(string parameterName, string value) { diff --git a/connect-sdk-dotnet/ProxyConfiguration.cs b/connect-sdk-dotnet/ProxyConfiguration.cs index 59c7a46f..b8b4d7ca 100644 --- a/connect-sdk-dotnet/ProxyConfiguration.cs +++ b/connect-sdk-dotnet/ProxyConfiguration.cs @@ -3,7 +3,7 @@ namespace Ingenico.Connect.Sdk { - class ProxyConfiguration : UriConfiguration + internal class ProxyConfiguration : UriConfiguration { public ProxyConfiguration(Uri address) : this(address, null, null) diff --git a/connect-sdk-dotnet/RequestHeader.cs b/connect-sdk-dotnet/RequestHeader.cs index af450881..9ceae552 100644 --- a/connect-sdk-dotnet/RequestHeader.cs +++ b/connect-sdk-dotnet/RequestHeader.cs @@ -18,7 +18,7 @@ public RequestHeader(string name, string value) Value = NormalizeValue(value); } - private string NormalizeValue(string value) + private static string NormalizeValue(string value) { if (string.IsNullOrEmpty(value)) { @@ -43,11 +43,8 @@ private string NormalizeValue(string value) public override int GetHashCode() => Tuple.Create(Name, Value).GetHashCode(); - public bool Equals(RequestHeader obj) - => (obj?.Name?.Equals(Name) ?? false) - && (obj?.Value?.Equals(Value) ?? false); + public bool Equals(RequestHeader obj) => (obj?.Name?.Equals(Name) ?? false) && (obj.Value?.Equals(Value) ?? false); - public override bool Equals(object obj) - => obj is RequestHeader && Equals(obj as RequestHeader); + public override bool Equals(object obj) => Equals(obj as RequestHeader); } } diff --git a/connect-sdk-dotnet/RequestParam.cs b/connect-sdk-dotnet/RequestParam.cs index 7fa5248c..dfdbb526 100644 --- a/connect-sdk-dotnet/RequestParam.cs +++ b/connect-sdk-dotnet/RequestParam.cs @@ -32,11 +32,8 @@ public RequestParam(string name, string value) public override int GetHashCode() => Tuple.Create(Name, Value).GetHashCode(); - public bool Equals(RequestParam obj) - => (obj?.Name?.Equals(Name) ?? false) - && (obj?.Value?.Equals(Value) ?? false); + public bool Equals(RequestParam obj) => (obj?.Name?.Equals(Name) ?? false) && (obj.Value?.Equals(Value) ?? false); - public override bool Equals(object obj) - => obj is RequestParam && Equals(obj as RequestParam); + public override bool Equals(object obj) => Equals(obj as RequestParam); } } diff --git a/connect-sdk-dotnet/ResponseException.cs b/connect-sdk-dotnet/ResponseException.cs index 786df770..432c412d 100644 --- a/connect-sdk-dotnet/ResponseException.cs +++ b/connect-sdk-dotnet/ResponseException.cs @@ -26,7 +26,7 @@ public class ResponseException : Exception /// public IEnumerable Headers { get; } - public ResponseException(HttpStatusCode statusCode, string body, IEnumerable headers) : base() + public ResponseException(HttpStatusCode statusCode, string body, IEnumerable headers) { Body = body; StatusCode = statusCode; @@ -46,7 +46,7 @@ public override string ToString() sb.Append("; statusCode=").Append(statusCode); } string responseBody = Body; - if (responseBody != null && responseBody.Length > 0) + if (!string.IsNullOrEmpty(responseBody)) { sb.Append("; responseBody='").Append(responseBody).Append("'"); } diff --git a/connect-sdk-dotnet/ResponseHeader.cs b/connect-sdk-dotnet/ResponseHeader.cs index 80364c0e..7c530140 100644 --- a/connect-sdk-dotnet/ResponseHeader.cs +++ b/connect-sdk-dotnet/ResponseHeader.cs @@ -28,11 +28,8 @@ public ResponseHeader(string name, string value) public override int GetHashCode() => Tuple.Create(Name, Value).GetHashCode(); - public bool Equals(ResponseHeader obj) - => (obj?.Name?.Equals(Name) ?? false) - && (obj?.Value?.Equals(Value) ?? false); + public bool Equals(ResponseHeader obj) => (obj?.Name?.Equals(Name) ?? false) && (obj.Value?.Equals(Value) ?? false); - public override bool Equals(object obj) - => obj is ResponseHeader && Equals(obj as ResponseHeader); + public override bool Equals(object obj) => Equals(obj as ResponseHeader); } } diff --git a/connect-sdk-dotnet/Session.cs b/connect-sdk-dotnet/Session.cs index c66f1e31..9ed07725 100644 --- a/connect-sdk-dotnet/Session.cs +++ b/connect-sdk-dotnet/Session.cs @@ -45,8 +45,8 @@ public Session(Uri apiEndpoint, IConnection connection, IAuthenticator authentic } ApiEndpoint = apiEndpoint; Connection = connection ?? throw new ArgumentException("connection is required"); - Authenticator = authenticator ?? throw new ArgumentException("authenticator is required"); ; - MetaDataProvider = metaDataProvider ?? throw new ArgumentException("metaDataProvider is required"); ; + Authenticator = authenticator ?? throw new ArgumentException("authenticator is required"); + MetaDataProvider = metaDataProvider ?? throw new ArgumentException("metaDataProvider is required"); } // Only for unit testing, will result in an invalid object diff --git a/connect-sdk-dotnet/ShoppingCartExtensionConfiguration.cs b/connect-sdk-dotnet/ShoppingCartExtensionConfiguration.cs index 1c97f395..07344f5a 100644 --- a/connect-sdk-dotnet/ShoppingCartExtensionConfiguration.cs +++ b/connect-sdk-dotnet/ShoppingCartExtensionConfiguration.cs @@ -2,7 +2,7 @@ namespace Ingenico.Connect.Sdk { - class ShoppingCartExtensionConfiguration : ConfigurationElement + internal class ShoppingCartExtensionConfiguration : ConfigurationElement { public ShoppingCartExtension ShoppingCartExtension { diff --git a/connect-sdk-dotnet/StringBuilderUtils.cs b/connect-sdk-dotnet/StringBuilderUtils.cs index 9ee9c621..44ce5753 100644 --- a/connect-sdk-dotnet/StringBuilderUtils.cs +++ b/connect-sdk-dotnet/StringBuilderUtils.cs @@ -2,7 +2,7 @@ namespace Ingenico.Connect.Sdk { - static class StringBuilderUtils + internal static class StringBuilderUtils { internal static StringBuilder AppendLLine(this StringBuilder sb, string aString) => sb.Append(aString).Append("\n"); diff --git a/connect-sdk-dotnet/StringUtils.cs b/connect-sdk-dotnet/StringUtils.cs index deaf2377..1632e45b 100644 --- a/connect-sdk-dotnet/StringUtils.cs +++ b/connect-sdk-dotnet/StringUtils.cs @@ -5,7 +5,7 @@ namespace Ingenico.Connect.Sdk { - static class StringUtils + internal static class StringUtils { internal static string FromBase64String(this string input) => Encoding.GetString(Convert.FromBase64String(input)); diff --git a/connect-sdk-dotnet/UriBuilderExtensions.cs b/connect-sdk-dotnet/UriBuilderExtensions.cs index b550fbe7..894a7020 100644 --- a/connect-sdk-dotnet/UriBuilderExtensions.cs +++ b/connect-sdk-dotnet/UriBuilderExtensions.cs @@ -3,7 +3,7 @@ namespace Ingenico.Connect.Sdk { - static class UriBuilderExtensions + internal static class UriBuilderExtensions { public static void AddParameter(this UriBuilder builder, string name, string value) { diff --git a/connect-sdk-dotnet/UriConfiguration.cs b/connect-sdk-dotnet/UriConfiguration.cs index 59bb1a0c..fbe23bdd 100644 --- a/connect-sdk-dotnet/UriConfiguration.cs +++ b/connect-sdk-dotnet/UriConfiguration.cs @@ -3,7 +3,7 @@ namespace Ingenico.Connect.Sdk { - class UriConfiguration : ConfigurationElement + internal class UriConfiguration : ConfigurationElement { public Uri Uri { diff --git a/connect-sdk-dotnet/UriUtils.cs b/connect-sdk-dotnet/UriUtils.cs index 4e674dce..804b2999 100644 --- a/connect-sdk-dotnet/UriUtils.cs +++ b/connect-sdk-dotnet/UriUtils.cs @@ -1,11 +1,8 @@ using System; -using System.Collections.Generic; -using System.Text; -using System.Linq; namespace Ingenico.Connect.Sdk { - static class UriUtils + internal static class UriUtils { internal static bool HasPath(this Uri apiEndpoint) => !string.IsNullOrEmpty(apiEndpoint.LocalPath) && !apiEndpoint.LocalPath.Equals("/"); diff --git a/connect-sdk-dotnet/Webhooks/ApiVersionMismatchException.cs b/connect-sdk-dotnet/Webhooks/ApiVersionMismatchException.cs index d8d40e59..aae024b5 100644 --- a/connect-sdk-dotnet/Webhooks/ApiVersionMismatchException.cs +++ b/connect-sdk-dotnet/Webhooks/ApiVersionMismatchException.cs @@ -5,7 +5,7 @@ namespace Ingenico.Connect.Sdk.Webhooks /// /// Represents an error because a webhooks event has an API version that this version of the SDK does not support. /// - class ApiVersionMismatchException : Exception + public class ApiVersionMismatchException : Exception { /// /// The Api version from the webhooks event. diff --git a/connect-sdk-dotnet/Webhooks/ISecretKeyStore.cs b/connect-sdk-dotnet/Webhooks/ISecretKeyStore.cs index 154bd72b..6fdb2204 100644 --- a/connect-sdk-dotnet/Webhooks/ISecretKeyStore.cs +++ b/connect-sdk-dotnet/Webhooks/ISecretKeyStore.cs @@ -1,5 +1,3 @@ -using System; - namespace Ingenico.Connect.Sdk.Webhooks { /// diff --git a/connect-sdk-dotnet/Webhooks/InMemorySecretKeyStore.cs b/connect-sdk-dotnet/Webhooks/InMemorySecretKeyStore.cs index 8b4823af..1b74afdd 100644 --- a/connect-sdk-dotnet/Webhooks/InMemorySecretKeyStore.cs +++ b/connect-sdk-dotnet/Webhooks/InMemorySecretKeyStore.cs @@ -17,38 +17,39 @@ private InMemorySecretKeyStore () public static readonly InMemorySecretKeyStore Instance = new InMemorySecretKeyStore (); - private readonly IDictionary store = new ConcurrentDictionary (); + private readonly IDictionary _store = new ConcurrentDictionary (); /// /// Stores the given secret key for the given key id. /// public void StoreSecretKey(string keyId, string secretKey) { - if (keyId == null || keyId.Trim().IsEmpty()) { + if (keyId == null || keyId.Trim().IsEmpty()) + { throw new ArgumentNullException ("keyId is required"); } if (secretKey == null || secretKey.Trim().IsEmpty()) { throw new ArgumentNullException("secretKey is required"); } - store.Add(keyId, secretKey); + _store.Add(keyId, secretKey); } /// /// Removes the secret key for the given key id. /// public void RemoveSecretKey(string keyId) { - store.Remove (keyId); + _store.Remove (keyId); } /// /// Removes all stored secret keys /// public void Clear() { - store.Clear (); + _store.Clear (); } public string GetSecretKey(string keyId) { - if (store.TryGetValue(keyId, out string secretKey)) + if (_store.TryGetValue(keyId, out string secretKey)) { return secretKey; } diff --git a/connect-sdk-dotnet/Webhooks/WebhooksHelper.cs b/connect-sdk-dotnet/Webhooks/WebhooksHelper.cs index 10f49932..8dd04576 100644 --- a/connect-sdk-dotnet/Webhooks/WebhooksHelper.cs +++ b/connect-sdk-dotnet/Webhooks/WebhooksHelper.cs @@ -63,7 +63,7 @@ protected void Validate(byte[] body, IEnumerable requestHeaders) _signatureValidator.Validate(body, requestHeaders); } - private void ValidateApiVersion(WebhooksEvent unmarshalledEvent) + private static void ValidateApiVersion(WebhooksEvent unmarshalledEvent) { if (!Client.ApiVersion.Equals(unmarshalledEvent.ApiVersion)) { diff --git a/connect-sdk-dotnet/Webhooks/WebhooksHelperBuilder.cs b/connect-sdk-dotnet/Webhooks/WebhooksHelperBuilder.cs index e43d8129..182d5ed4 100644 --- a/connect-sdk-dotnet/Webhooks/WebhooksHelperBuilder.cs +++ b/connect-sdk-dotnet/Webhooks/WebhooksHelperBuilder.cs @@ -14,7 +14,7 @@ public class WebhooksHelperBuilder /// Sets the to use. /// public WebhooksHelperBuilder WithMarshaller(IMarshaller marshaller) { - this.Marshaller = marshaller; + Marshaller = marshaller; return this; } @@ -22,7 +22,7 @@ public WebhooksHelperBuilder WithMarshaller(IMarshaller marshaller) { /// Sets the to use. /// public WebhooksHelperBuilder WithSecretKeyStore(ISecretKeyStore secretKeyStore) { - this.SecretKeyStore = secretKeyStore; + SecretKeyStore = secretKeyStore; return this; } diff --git a/connect-sdk-dotnet/connect-sdk-dotnet.csproj b/connect-sdk-dotnet/connect-sdk-dotnet.csproj index 5a5fc3d9..09efbf14 100644 --- a/connect-sdk-dotnet/connect-sdk-dotnet.csproj +++ b/connect-sdk-dotnet/connect-sdk-dotnet.csproj @@ -3,8 +3,8 @@ net45;netstandard2.0;netstandard2.1 Ingenico.Connect.Sdk - 3.46.0 - 3.46.0 + 3.47.0 + 3.47.0 true Ingenico ePayments Ingenico Connect .NET SDK