Skip to content

Commit

Permalink
Version 1.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-foster-cko authored Sep 11, 2019
2 parents bac31a0 + 686e419 commit 7507863
Show file tree
Hide file tree
Showing 11 changed files with 88 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<TargetFramework>netcoreapp2.2</TargetFramework>
<IsPackable>false</IsPackable>
<RootNamespace>Checkout.SampleApp.Tests</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App"/>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" />
<PackageReference Include="Moq" Version="4.10.0" />
<PackageReference Include="Shouldly" Version="3.0.1" />
Expand Down
11 changes: 7 additions & 4 deletions samples/CheckoutSdk.SampleApp/CheckoutSdk.SampleApp.csproj
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<TargetFramework>netcoreapp2.2</TargetFramework>
<RootNamespace>Checkout.SampleApp</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.1.6"/>
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.1.6"/>
<PackageReference Include="Microsoft.AspNetCore.App"/>
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.2.0"/>
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.2.2"/>
<PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="2.2.0"/>
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\CheckoutSDK.Extensions.Microsoft\CheckoutSDK.Extensions.Microsoft.csproj" />
<ProjectReference Include="..\..\src\CheckoutSDK\CheckoutSDK.csproj"/>
<ProjectReference Include="..\..\src\CheckoutSDK.Extensions.Microsoft\CheckoutSDK.Extensions.Microsoft.csproj"/>
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using Checkout.Common;
using Checkout.Payments;
using Checkout.SampleApp.Models;
using Microsoft.ApplicationInsights.AspNetCore.Extensions;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using System;
Expand Down
19 changes: 19 additions & 0 deletions samples/CheckoutSdk.SampleApp/CustomCkoHttpClientFactory.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System.Net.Http;

namespace Checkout.SampleApp
{
public class CustomCkoHttpClientFactory : IHttpClientFactory
{
private readonly System.Net.Http.IHttpClientFactory _msHttpClientFactory;

public CustomCkoHttpClientFactory(System.Net.Http.IHttpClientFactory msHttpClientFactory)
{
_msHttpClientFactory = msHttpClientFactory;
}

public HttpClient CreateClient()
{
return _msHttpClientFactory.CreateClient();
}
}
}
3 changes: 2 additions & 1 deletion samples/CheckoutSdk.SampleApp/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ public Startup(IConfiguration configuration)
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc();

services.AddCheckoutSdk(Configuration);
services.AddHttpClient();
services.AddTransient<IHttpClientFactory, CustomCkoHttpClientFactory>();
}

public void Configure(IApplicationBuilder app, IHostingEnvironment env)
Expand Down
13 changes: 13 additions & 0 deletions src/CheckoutSdk/Payments/ActionProcessingResponse.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace Checkout.Payments
{
/// <summary>
/// Information related to the processing of a payment action
/// </summary>
public class ActionProcessingResponse : ProcessingResponse
{
/// <summary>
/// Gets or sets the ARN generated during the processing of captures and refunds
/// </summary>
public string AcquirerReferenceNumber { get; set; }
}
}
22 changes: 14 additions & 8 deletions src/CheckoutSdk/Payments/PaymentAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,42 +13,42 @@ public class PaymentAction : Resource
/// Gets or sets the unique identifier of the payment action.
/// </summary>
public string Id { get; set; }

/// <summary>
/// Gets or sets the type of action.
/// </summary>
public string Type { get; set; }

/// <summary>
/// Gets or sets the date/time the action was processed.
/// </summary>
public DateTime ProcessedOn { get; set; }

/// <summary>
/// Gets or sets the action amount.
/// </summary>
public int Amount { get; set; }

/// <summary>
/// Gets or sets the acquirer authorization code where applicable.
/// </summary>
public string AuthCode { get; set; }

/// <summary>
/// Gets or sets the Checkout.com Gateway response code.
/// </summary>
public string ResponseCode { get; set; }

/// <summary>
/// Gets or sets the response summary.
/// </summary>
public string ResponseSummary { get; set; }

/// <summary>
/// Gets or sets your reference for the action.
/// </summary>
public string Reference { get; set; }

/// <summary>
/// Gets or sets the key/value pairs that were attached to the action.
/// </summary>
Expand All @@ -58,5 +58,11 @@ public class PaymentAction : Resource
/// Gets or sets the approved flag for the action.
/// </summary>
public bool Approved { get; set; }

/// <summary>
/// Gets or sets information related to the processing of a payment action
/// </summary>
/// <value></value>
public ActionProcessingResponse Processing { get; set; }
}
}
5 changes: 5 additions & 0 deletions src/CheckoutSdk/Payments/PaymentProcessed.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ public class PaymentProcessed : Resource
/// Gets your reference for the payment.
/// </summary>
public string Reference { get; set; }

/// <summary>
/// Gets the acquirer information related to the processing of the payment
/// </summary>
public ProcessingResponse Processing { get; set; }

/// <summary>
/// The final Electronic Commerce Indicator security level used to authorize the payment. Applicable for 3D-Secure, digital wallets and network token payments.
Expand Down
19 changes: 19 additions & 0 deletions src/CheckoutSdk/Payments/ProcessingResponse.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
namespace Checkout.Payments
{
/// <summary>
/// Information related to the processing of the payment
/// </summary>
public class ProcessingResponse
{
/// <summary>
/// Gets or sets the retrieval reference number - a unique identifier for the authorization that is submitted to the card scheme during processing
/// </summary>
/// <value></value>
public string RetrievalReferenceNumber { get; set; }

/// <summary>
/// Gets or sets the unique identifier for the transaction generated by the acquirer
/// </summary>
public string AcquirerTransactionId { get; set; }
}
}
3 changes: 3 additions & 0 deletions test/CheckoutSdk.Tests/Payments/CardSourcePaymentsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ public async Task CanRequestNonThreeDsCardPayment()
paymentResponse.Payment.CanCapture().ShouldBeTrue();
paymentResponse.Payment.CanVoid().ShouldBeTrue();
paymentResponse.Payment.Source.AsCard().ShouldNotBeNull();
paymentResponse.Payment.Processing.ShouldNotBeNull();
paymentResponse.Payment.Processing.AcquirerTransactionId.ShouldNotBeNullOrWhiteSpace();
paymentResponse.Payment.Processing.RetrievalReferenceNumber.ShouldNotBeNullOrWhiteSpace();
}

[Fact]
Expand Down
4 changes: 4 additions & 0 deletions test/CheckoutSdk.Tests/Payments/GetPaymentTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@ public async Task CanGetPaymentAction()
paymentAction.AuthCode.ShouldBe(payment.AuthCode);
paymentAction.Type.ShouldBe(ActionType.Authorization);
paymentAction.Links.ShouldNotBeNull();
paymentAction.Processing.ShouldNotBeNull();
paymentAction.Processing.AcquirerTransactionId.ShouldNotBeNullOrWhiteSpace();
paymentAction.Processing.RetrievalReferenceNumber.ShouldNotBeNullOrWhiteSpace();
}

[Fact]
Expand All @@ -213,6 +216,7 @@ public async Task CanGetMultiplePaymentActions()
capturePaymentAction.Id.ShouldBe(captureResponse.ActionId);
capturePaymentAction.Reference.ShouldBe(captureResponse.Reference);
capturePaymentAction.Links.ShouldNotBeNull();
capturePaymentAction.Processing.AcquirerReferenceNumber.ShouldNotBeNullOrWhiteSpace();
}

[Fact]
Expand Down

0 comments on commit 7507863

Please sign in to comment.