diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index e775c30..53ac721 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -3,13 +3,13 @@ "isRoot": true, "tools": { "csharpier": { - "version": "0.22.1", + "version": "0.29.2", "commands": [ "dotnet-csharpier" ] }, "husky": { - "version": "0.5.4", + "version": "0.7.1", "commands": [ "husky" ] diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 7a7128b..78eee2c 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -18,7 +18,7 @@ jobs: id-token: write strategy: matrix: - dotnet-version: [ '7.0.x' ] + dotnet-version: [ '8.0.x' ] steps: - name: Get repo uses: actions/checkout@v3 @@ -43,7 +43,7 @@ jobs: dotnet tool restore --tool-manifest src/.config/dotnet-tools.json cd src dotnet csharpier . --check - # - name: Install dependencies for IntegrationTests - # run: dotnet restore src/Tests/Vipps.net.IntegrationTests/Vipps.net.IntegrationTests.csproj - # - name: Run Integration Tests - # run: dotnet test src/Tests/Vipps.net.IntegrationTests/Vipps.net.IntegrationTests.csproj --no-restore --verbosity normal --environment vmp_net_sdk_CLIENT_ID=${{ secrets.CLIENT_ID }} --environment vmp_net_sdk_CLIENT_SECRET=${{ secrets.CLIENT_SECRET }} --environment vmp_net_sdk_SUBSCRIPTION_KEY=${{ secrets.SUBSCRIPTION_KEY }} --environment vmp_net_sdk_MERCHANT_SERIAL_NUMBER=${{ secrets.MERCHANT_SERIAL_NUMBER }} + - name: Install dependencies for IntegrationTests + run: dotnet restore src/Tests/Vipps.net.IntegrationTests/Vipps.net.IntegrationTests.csproj + - name: Run Integration Tests + run: dotnet test src/Tests/Vipps.net.IntegrationTests/Vipps.net.IntegrationTests.csproj --no-restore --verbosity normal --environment vmp_net_sdk_CLIENT_ID=${{ secrets.CLIENT_ID }} --environment vmp_net_sdk_CLIENT_SECRET=${{ secrets.CLIENT_SECRET }} --environment vmp_net_sdk_SUBSCRIPTION_KEY=${{ secrets.SUBSCRIPTION_KEY }} --environment vmp_net_sdk_MERCHANT_SERIAL_NUMBER=${{ secrets.MERCHANT_SERIAL_NUMBER }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 30d6780..932f690 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,7 +13,7 @@ jobs: contents: write # needed to push tag strategy: matrix: - dotnet-version: [ '7.0.x' ] + dotnet-version: [ '8.0.x' ] steps: - name: Get repo with depth uses: actions/checkout@v3 diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..6c78cd1 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,12 @@ +# Changelog + +# [2.0.1] - October 2024 +Update dependencies + +# [2.0.0] - October 2024 +This is a re-release of the 0.9.x to supersede the 1.x.x versions. This release is a major release and includes breaking changes. + +# [1.0.x] - October 2024 - DEPRECATED +This release is a major release and includes breaking changes. + +# [0.9.x] - 2023 diff --git a/src/Tests/Vipps.net.IntegrationTests/CheckoutServiceTests.cs b/src/Tests/Vipps.net.IntegrationTests/CheckoutServiceTests.cs index 9ea6be1..0868391 100644 --- a/src/Tests/Vipps.net.IntegrationTests/CheckoutServiceTests.cs +++ b/src/Tests/Vipps.net.IntegrationTests/CheckoutServiceTests.cs @@ -19,10 +19,10 @@ public async Task Can_Create_And_Get_Session() MerchantInfo = new Models.Checkout.PaymentMerchantInfo { CallbackAuthorizationToken = Guid.NewGuid().ToString(), - CallbackUrl = "https://no.where.com/callback", - ReturnUrl = "https://no.where.com/return", - TermsAndConditionsUrl = "https://no.where.com/terms" - } + CallbackUrl = "https://apitest.vipps.no/does-not-exist-callback", + ReturnUrl = "https://apitest.vipps.no/does-not-exist-return", + TermsAndConditionsUrl = "https://apitest.vipps.no/does-not-exist-terms", + }, }; var sessionResponse = await vippsApi.CheckoutService.InitiateSession( diff --git a/src/Tests/Vipps.net.IntegrationTests/EpaymentServiceTests.cs b/src/Tests/Vipps.net.IntegrationTests/EpaymentServiceTests.cs index a873abd..c7707fa 100644 --- a/src/Tests/Vipps.net.IntegrationTests/EpaymentServiceTests.cs +++ b/src/Tests/Vipps.net.IntegrationTests/EpaymentServiceTests.cs @@ -87,14 +87,16 @@ private static CreatePaymentRequest GetCreatePaymentRequest(string reference) Amount = new Amount { Currency = Currency.NOK, - Value = 100 // 100 øre = 1 KR + Value = + 100 // 100 øre = 1 KR + , }, PaymentMethod = new PaymentMethod { Type = PaymentMethodType.WALLET }, UserFlow = CreatePaymentRequestUserFlow.WEB_REDIRECT, Reference = reference, PaymentDescription = nameof(CheckoutServiceTests.Can_Create_And_Get_Session), ReturnUrl = $"https://no.where.com/{reference}", - Customer = new Customer { } + Customer = new Customer { }, }; } } diff --git a/src/Tests/Vipps.net.IntegrationTests/TestSetup.cs b/src/Tests/Vipps.net.IntegrationTests/TestSetup.cs index 2b915de..301b73b 100644 --- a/src/Tests/Vipps.net.IntegrationTests/TestSetup.cs +++ b/src/Tests/Vipps.net.IntegrationTests/TestSetup.cs @@ -33,7 +33,7 @@ public static IVippsApi CreateVippsAPI() UseTestMode = true, PluginName = Assembly.GetExecutingAssembly().GetName().Name, PluginVersion = - Assembly.GetExecutingAssembly().GetName().Version?.ToString() ?? "1.0.0" + Assembly.GetExecutingAssembly().GetName().Version?.ToString() ?? "1.0.0", }; // The following line configures vipps with custom settings diff --git a/src/Tests/Vipps.net.IntegrationTests/Vipps.net.IntegrationTests.csproj b/src/Tests/Vipps.net.IntegrationTests/Vipps.net.IntegrationTests.csproj index 5e6a285..d013374 100644 --- a/src/Tests/Vipps.net.IntegrationTests/Vipps.net.IntegrationTests.csproj +++ b/src/Tests/Vipps.net.IntegrationTests/Vipps.net.IntegrationTests.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 enable enable @@ -27,14 +27,17 @@ - - - - - - - - + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + diff --git a/src/Vipps.net.AspCoreDemo/Controllers/CheckoutController.cs b/src/Vipps.net.AspCoreDemo/Controllers/CheckoutController.cs index 79397d7..fb5fe08 100644 --- a/src/Vipps.net.AspCoreDemo/Controllers/CheckoutController.cs +++ b/src/Vipps.net.AspCoreDemo/Controllers/CheckoutController.cs @@ -35,8 +35,8 @@ public async Task> CreateSession() { Amount = new Amount { Currency = "NOK", Value = 10000 }, PaymentDescription = "test", - Reference = Guid.NewGuid().ToString() - } + Reference = Guid.NewGuid().ToString(), + }, }; _logger.LogInformation( diff --git a/src/Vipps.net.AspCoreDemo/Startup.cs b/src/Vipps.net.AspCoreDemo/Startup.cs index 70df6b3..031e6b6 100644 --- a/src/Vipps.net.AspCoreDemo/Startup.cs +++ b/src/Vipps.net.AspCoreDemo/Startup.cs @@ -24,14 +24,14 @@ public void ConfigureServices(IServiceCollection services) { var vippsConfigurationOptions = new VippsConfigurationOptions { - ClientId = Configuration.GetValue("CLIENT-ID")!, - ClientSecret = Configuration.GetValue("CLIENT-SECRET")!, - MerchantSerialNumber = Configuration.GetValue("MERCHANT-SERIAL-NUMBER")!, - SubscriptionKey = Configuration.GetValue("SUBSCRIPTION-KEY")!, + ClientId = Configuration["CLIENT-ID"], + ClientSecret = Configuration["CLIENT-SECRET"], + MerchantSerialNumber = Configuration["MERCHANT-SERIAL-NUMBER"], + SubscriptionKey = Configuration["SUBSCRIPTION-KEY"], UseTestMode = true, PluginName = Assembly.GetExecutingAssembly().GetName().Name, PluginVersion = - Assembly.GetExecutingAssembly().GetName().Version?.ToString() ?? "1.0.0" + Assembly.GetExecutingAssembly().GetName().Version?.ToString() ?? "1.0.0", }; services.AddTransient(_ => vippsConfigurationOptions); diff --git a/src/Vipps.net.AspCoreDemo/Vipps.net.AspCoreDemo.csproj b/src/Vipps.net.AspCoreDemo/Vipps.net.AspCoreDemo.csproj index 829541a..3c84ce6 100644 --- a/src/Vipps.net.AspCoreDemo/Vipps.net.AspCoreDemo.csproj +++ b/src/Vipps.net.AspCoreDemo/Vipps.net.AspCoreDemo.csproj @@ -2,13 +2,13 @@ 5fcb55b3-f577-4b73-a82a-f13b33796367 - netcoreapp3.1 + net8.0 - - - + + + diff --git a/src/Vipps.net.AspDemo/App_Start/RouteConfig.cs b/src/Vipps.net.AspDemo/App_Start/RouteConfig.cs index 8bf538d..d1d7c20 100644 --- a/src/Vipps.net.AspDemo/App_Start/RouteConfig.cs +++ b/src/Vipps.net.AspDemo/App_Start/RouteConfig.cs @@ -16,7 +16,7 @@ public static void RegisterRoutes(RouteCollection routes) { controller = "Home", action = "Index", - id = UrlParameter.Optional + id = UrlParameter.Optional, } ); } diff --git a/src/Vipps.net.AspDemo/App_Start/VippsApiConfig.cs b/src/Vipps.net.AspDemo/App_Start/VippsApiConfig.cs index 6a4402b..1f21de4 100644 --- a/src/Vipps.net.AspDemo/App_Start/VippsApiConfig.cs +++ b/src/Vipps.net.AspDemo/App_Start/VippsApiConfig.cs @@ -23,7 +23,7 @@ public static void Configure() UseTestMode = bool.Parse(ConfigurationManager.AppSettings["UseTestMode"]), PluginName = Assembly.GetExecutingAssembly().GetName().Name, PluginVersion = - Assembly.GetExecutingAssembly().GetName().Version?.ToString() ?? "1.0.0" + Assembly.GetExecutingAssembly().GetName().Version?.ToString() ?? "1.0.0", }; _vippsApi = new VippsApi(configurationOptions); diff --git a/src/Vipps.net.AspDemo/Services/CheckoutSessionService.cs b/src/Vipps.net.AspDemo/Services/CheckoutSessionService.cs index c8a75a8..238162d 100644 --- a/src/Vipps.net.AspDemo/Services/CheckoutSessionService.cs +++ b/src/Vipps.net.AspDemo/Services/CheckoutSessionService.cs @@ -20,8 +20,8 @@ internal static async Task CreateSession() { Amount = new Amount { Currency = "NOK", Value = 10000 }, PaymentDescription = "test", - Reference = Guid.NewGuid().ToString() - } + Reference = Guid.NewGuid().ToString(), + }, }; var result = await VippsApiConfig.VippsApi.CheckoutService.InitiateSession(request); diff --git a/src/Vipps.net.Demo/Controllers/CheckoutController.cs b/src/Vipps.net.Demo/Controllers/CheckoutController.cs index 6b3f59b..6ed76f3 100644 --- a/src/Vipps.net.Demo/Controllers/CheckoutController.cs +++ b/src/Vipps.net.Demo/Controllers/CheckoutController.cs @@ -32,8 +32,8 @@ public async Task> CreateSession() { Amount = new Amount { Currency = "NOK", Value = 10000 }, PaymentDescription = "test", - Reference = Guid.NewGuid().ToString() - } + Reference = Guid.NewGuid().ToString(), + }, }; _logger.LogInformation( diff --git a/src/Vipps.net.Demo/Program.cs b/src/Vipps.net.Demo/Program.cs index db1770c..5f4f0b0 100644 --- a/src/Vipps.net.Demo/Program.cs +++ b/src/Vipps.net.Demo/Program.cs @@ -27,7 +27,8 @@ private static void Main(string[] args) SubscriptionKey = builder.Configuration.GetValue("SUBSCRIPTION-KEY")!, UseTestMode = true, PluginName = Assembly.GetExecutingAssembly().GetName().Name, - PluginVersion = Assembly.GetExecutingAssembly().GetName().Version?.ToString() ?? "1.0.0" + PluginVersion = + Assembly.GetExecutingAssembly().GetName().Version?.ToString() ?? "1.0.0", }; builder.Services.AddTransient(_ => vippsConfigurationOptions); diff --git a/src/Vipps.net.Demo/Vipps.net.Demo.csproj b/src/Vipps.net.Demo/Vipps.net.Demo.csproj index 9e64d53..1046b38 100644 --- a/src/Vipps.net.Demo/Vipps.net.Demo.csproj +++ b/src/Vipps.net.Demo/Vipps.net.Demo.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 enable enable e1850619-4f06-4444-b271-437c887123f0 @@ -10,9 +10,9 @@ - - - + + + diff --git a/src/Vipps.net/Helpers/PolicyHelper.cs b/src/Vipps.net/Helpers/PolicyHelper.cs index 0376cc2..6f53650 100644 --- a/src/Vipps.net/Helpers/PolicyHelper.cs +++ b/src/Vipps.net/Helpers/PolicyHelper.cs @@ -31,15 +31,15 @@ string errorMessage ) { return Policy - .HandleResult( - r => (int)r.StatusCode >= (int)HttpStatusCode.InternalServerError + .HandleResult(r => + (int)r.StatusCode >= (int)HttpStatusCode.InternalServerError ) .FallbackAsync( new HttpResponseMessage(HttpStatusCode.InternalServerError), async (result, context) => { - var responseString = await result.Result.Content - .ReadAsStringAsync() + var responseString = await result + .Result.Content.ReadAsStringAsync() .ConfigureAwait(false); logger?.LogError( $"{errorMessage}{CommonErrorMessagePart}", diff --git a/src/Vipps.net/Helpers/VippsRequestSerializer.cs b/src/Vipps.net/Helpers/VippsRequestSerializer.cs index b8cf17a..4414a79 100644 --- a/src/Vipps.net/Helpers/VippsRequestSerializer.cs +++ b/src/Vipps.net/Helpers/VippsRequestSerializer.cs @@ -9,7 +9,7 @@ internal static class VippsRequestSerializer { NullValueHandling = NullValueHandling.Ignore, DefaultValueHandling = DefaultValueHandling.Include, - Converters = new[] { new Newtonsoft.Json.Converters.StringEnumConverter() } + Converters = new[] { new Newtonsoft.Json.Converters.StringEnumConverter() }, }; internal static string SerializeVippsRequest(T vippsRequest) diff --git a/src/Vipps.net/Infrastructure/AccessTokenServiceClient.cs b/src/Vipps.net/Infrastructure/AccessTokenServiceClient.cs index 9aa1493..82ee679 100644 --- a/src/Vipps.net/Infrastructure/AccessTokenServiceClient.cs +++ b/src/Vipps.net/Infrastructure/AccessTokenServiceClient.cs @@ -29,7 +29,7 @@ CancellationToken cancellationToken { { Constants.HeaderNameClientId, _vippsConfigurationOptions.ClientId }, { Constants.HeaderNameClientSecret, _vippsConfigurationOptions.ClientSecret }, - { Constants.SubscriptionKey, _vippsConfigurationOptions.SubscriptionKey } + { Constants.SubscriptionKey, _vippsConfigurationOptions.SubscriptionKey }, } ); } diff --git a/src/Vipps.net/Infrastructure/BaseServiceClient.cs b/src/Vipps.net/Infrastructure/BaseServiceClient.cs index 29a62f0..53dc389 100644 --- a/src/Vipps.net/Infrastructure/BaseServiceClient.cs +++ b/src/Vipps.net/Infrastructure/BaseServiceClient.cs @@ -163,8 +163,8 @@ CancellationToken cancellationToken { #pragma warning disable IDE0079 // Remove unnecessary suppression. This is caused by us building multiple targets. In some (net 6, 7), the overload with the cancellationToken is preferred. In the others, it does not exist. #pragma warning disable CA2016 // Forward the 'CancellationToken' parameter to methods - var responseContent = await response.Content - .ReadAsStringAsync() + var responseContent = await response + .Content.ReadAsStringAsync() .ConfigureAwait(false); #pragma warning restore CA2016 // Forward the 'CancellationToken' parameter to methods #pragma warning restore IDE0079 // Remove unnecessary suppression diff --git a/src/Vipps.net/Infrastructure/EpaymentServiceClient.cs b/src/Vipps.net/Infrastructure/EpaymentServiceClient.cs index 729181e..8fc2f8f 100644 --- a/src/Vipps.net/Infrastructure/EpaymentServiceClient.cs +++ b/src/Vipps.net/Infrastructure/EpaymentServiceClient.cs @@ -37,7 +37,7 @@ CancellationToken cancellationToken $"{Constants.AuthorizationSchemeNameBearer} {authToken.Token}" }, { "Idempotency-Key", Guid.NewGuid().ToString() }, - { Constants.SubscriptionKey, _vippsConfigurationOptions.SubscriptionKey } + { Constants.SubscriptionKey, _vippsConfigurationOptions.SubscriptionKey }, }; return headers; } diff --git a/src/Vipps.net/Infrastructure/VippsHttpClient.cs b/src/Vipps.net/Infrastructure/VippsHttpClient.cs index 1319af4..91e2408 100644 --- a/src/Vipps.net/Infrastructure/VippsHttpClient.cs +++ b/src/Vipps.net/Infrastructure/VippsHttpClient.cs @@ -66,7 +66,7 @@ private HttpClient CreateDefaultHttpClient() var httpClient = new HttpClient() { Timeout = DefaultTimeOut, - BaseAddress = new Uri(UrlHelper.GetBaseUrl(_options.UseTestMode)) + BaseAddress = new Uri(UrlHelper.GetBaseUrl(_options.UseTestMode)), }; return httpClient; @@ -93,7 +93,7 @@ private Dictionary GetHeaders() string.IsNullOrWhiteSpace(_options.PluginVersion) ? "0.0.1" : _options.PluginVersion - } + }, }; } } diff --git a/src/Vipps.net/Vipps.net.csproj b/src/Vipps.net/Vipps.net.csproj index 7e1444d..dd363e8 100644 --- a/src/Vipps.net/Vipps.net.csproj +++ b/src/Vipps.net/Vipps.net.csproj @@ -1,12 +1,12 @@  - net6.0;net7.0;netcoreapp3.1;netstandard2.0;net48 + net6.0;netstandard2.0;net48 disable disable Vipps.net Vipps.net SDK Vipps.net - 2.0.0 + 2.0.1 Vipps Mobilepay AS Vipps Mobilepay AS Vipps SDK .Net @@ -34,13 +34,29 @@ - - + + - + + + 8.4.2 + + + + + + + + + + + + + +