Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
mattbrailsford committed Dec 14, 2023
1 parent ede3a0c commit 35c98bb
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 1,354 deletions.
7 changes: 4 additions & 3 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
<GlobalPackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" />
<GlobalPackageReference Include="Nerdbank.GitVersioning" Version="3.5.119" />
<GlobalPackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.435" />
<GlobalPackageReference Include="Umbraco.Code" Version="2.0.0" />
<GlobalPackageReference Include="Umbraco.Code" Version="2.1.0" />
<GlobalPackageReference Include="Umbraco.GitVersioning.Extensions" Version="0.2.0" />
</ItemGroup>
<ItemGroup>
<PackageVersion Include="Flurl.Http" Version="[3.2.4, 4)" />
<PackageVersion Include="Umbraco.Commerce.Core" Version="[13.0.0-rc1, 14)" />
<PackageVersion Include="Flurl.Http" Version="[4.0.0, 5)" />
<PackageVersion Include="Flurl.Http.Newtonsoft" Version="[0.9.0, 1)" />
<PackageVersion Include="Umbraco.Commerce.Core" Version="[13.0.0, 14)" />
<PackageVersion Include="Microsoft.AspNet.WebApi.Client" Version="[6, 7)" />
</ItemGroup>
</Project>
16 changes: 8 additions & 8 deletions src/Umbraco.Commerce.PaymentProviders.Klarna/Api/KlarnaClient.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Flurl.Http;
using Flurl.Http.Configuration;
using Flurl.Http.Newtonsoft;
using Newtonsoft.Json;
using System;
using System.IO;
Expand Down Expand Up @@ -29,45 +29,45 @@ public KlarnaClient(KlarnaClientConfig config)
public async Task<KlarnaMerchantSession> CreateMerchantSessionAsync(KlarnaCreateMerchantSessionOptions opts, CancellationToken cancellationToken = default)
{
return await RequestAsync("/payments/v1/sessions", async (req, ct) => await req
.PostJsonAsync(opts, ct)
.PostJsonAsync(opts, cancellationToken: ct)
.ReceiveJson<KlarnaMerchantSession>().ConfigureAwait(false),
cancellationToken).ConfigureAwait(false);
}

public async Task<KlarnaHppSession> CreateHppSessionAsync(KlarnaCreateHppSessionOptions opts, CancellationToken cancellationToken = default)
{
return await RequestAsync("/hpp/v1/sessions", async (req, ct) => await req
.PostJsonAsync(opts, ct)
.PostJsonAsync(opts, cancellationToken: ct)
.ReceiveJson<KlarnaHppSession>().ConfigureAwait(false),
cancellationToken).ConfigureAwait(false);
}

public async Task<KlarnaOrder> GetOrderAsync(string orderId, CancellationToken cancellationToken = default)
{
return await RequestAsync($"/ordermanagement/v1/orders/{orderId}", async (req, ct) => await req
.GetAsync(ct)
.GetAsync(cancellationToken: ct)
.ReceiveJson<KlarnaOrder>().ConfigureAwait(false),
cancellationToken).ConfigureAwait(false);
}

public async Task CancelOrderAsync(string orderId, CancellationToken cancellationToken = default)
{
await RequestAsync($"/ordermanagement/v1/orders/{orderId}/cancel", async (req, ct) => await req
.PostAsync(null, ct).ConfigureAwait(false),
.PostAsync(null, cancellationToken: ct).ConfigureAwait(false),
cancellationToken).ConfigureAwait(false);
}

public async Task CaptureOrderAsync(string orderId, KlarnaCaptureOptions opts, CancellationToken cancellationToken = default)
{
await RequestAsync($"/ordermanagement/v1/orders/{orderId}/captures", async (req, ct) => await req
.PostJsonAsync(opts, ct).ConfigureAwait(false),
.PostJsonAsync(opts, cancellationToken: ct).ConfigureAwait(false),
cancellationToken).ConfigureAwait(false);
}

public async Task RefundOrderAsync(string orderId, KlarnaRefundOptions opts, CancellationToken cancellationToken = default)
{
await RequestAsync($"/ordermanagement/v1/orders/{orderId}/refunds", async (req, ct) => await req
.PostJsonAsync(opts, ct).ConfigureAwait(false),
.PostJsonAsync(opts, cancellationToken: ct).ConfigureAwait(false),
cancellationToken).ConfigureAwait(false);
}

Expand All @@ -90,7 +90,7 @@ public KlarnaSessionEvent ParseSessionEvent(Stream stream)
private async Task<TResult> RequestAsync<TResult>(string url, Func<IFlurlRequest, CancellationToken, Task<TResult>> func, CancellationToken cancellationToken = default)
{
var req = new FlurlRequest(_config.BaseUrl + url)
.ConfigureRequest(x => x.JsonSerializer = new NewtonsoftJsonSerializer(new JsonSerializerSettings
.WithSettings(x => x.JsonSerializer = new NewtonsoftJsonSerializer(new JsonSerializerSettings
{
NullValueHandling = NullValueHandling.Ignore,
ObjectCreationHandling = ObjectCreationHandling.Replace,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,6 @@ public override async Task<PaymentFormResult> GenerateFormAsync(PaymentProviderC
};
}



public override async Task<CallbackResult> ProcessCallbackAsync(PaymentProviderContext<KlarnaHppSettings> ctx, CancellationToken cancellationToken = default)
{
var qs = HttpUtility.ParseQueryString(ctx.Request.RequestUri.Query);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

<ItemGroup>
<PackageReference Include="Flurl.Http" />
<PackageReference Include="Flurl.Http.Newtonsoft" />
<PackageReference Include="Microsoft.AspNet.WebApi.Client" />
<PackageReference Include="Umbraco.Commerce.Core" />
</ItemGroup>
Expand Down
Loading

0 comments on commit 35c98bb

Please sign in to comment.