diff --git a/samples/CheckoutSdk.SampleApp.Tests/CheckoutSdk.SampleApp.Tests.csproj b/samples/CheckoutSdk.SampleApp.Tests/CheckoutSdk.SampleApp.Tests.csproj index 250002e4..a421dc2e 100644 --- a/samples/CheckoutSdk.SampleApp.Tests/CheckoutSdk.SampleApp.Tests.csproj +++ b/samples/CheckoutSdk.SampleApp.Tests/CheckoutSdk.SampleApp.Tests.csproj @@ -1,10 +1,11 @@ - netcoreapp2.1 + netcoreapp2.2 false Checkout.SampleApp.Tests + diff --git a/samples/CheckoutSdk.SampleApp/CheckoutSdk.SampleApp.csproj b/samples/CheckoutSdk.SampleApp/CheckoutSdk.SampleApp.csproj index 7d1f0942..3bf0d801 100644 --- a/samples/CheckoutSdk.SampleApp/CheckoutSdk.SampleApp.csproj +++ b/samples/CheckoutSdk.SampleApp/CheckoutSdk.SampleApp.csproj @@ -1,16 +1,19 @@ - netcoreapp2.1 + netcoreapp2.2 Checkout.SampleApp - - + + + + - + + \ No newline at end of file diff --git a/samples/CheckoutSdk.SampleApp/Controllers/PaymentsController.cs b/samples/CheckoutSdk.SampleApp/Controllers/PaymentsController.cs index 033fe85c..8b794f05 100644 --- a/samples/CheckoutSdk.SampleApp/Controllers/PaymentsController.cs +++ b/samples/CheckoutSdk.SampleApp/Controllers/PaymentsController.cs @@ -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; diff --git a/samples/CheckoutSdk.SampleApp/CustomCkoHttpClientFactory.cs b/samples/CheckoutSdk.SampleApp/CustomCkoHttpClientFactory.cs new file mode 100644 index 00000000..009d77a3 --- /dev/null +++ b/samples/CheckoutSdk.SampleApp/CustomCkoHttpClientFactory.cs @@ -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(); + } + } +} \ No newline at end of file diff --git a/samples/CheckoutSdk.SampleApp/Startup.cs b/samples/CheckoutSdk.SampleApp/Startup.cs index 841effb8..6b002b00 100644 --- a/samples/CheckoutSdk.SampleApp/Startup.cs +++ b/samples/CheckoutSdk.SampleApp/Startup.cs @@ -17,8 +17,9 @@ public Startup(IConfiguration configuration) public void ConfigureServices(IServiceCollection services) { services.AddMvc(); - services.AddCheckoutSdk(Configuration); + services.AddHttpClient(); + services.AddTransient(); } public void Configure(IApplicationBuilder app, IHostingEnvironment env) diff --git a/src/CheckoutSdk/Payments/ActionProcessingResponse.cs b/src/CheckoutSdk/Payments/ActionProcessingResponse.cs new file mode 100644 index 00000000..994350c6 --- /dev/null +++ b/src/CheckoutSdk/Payments/ActionProcessingResponse.cs @@ -0,0 +1,13 @@ +namespace Checkout.Payments +{ + /// + /// Information related to the processing of a payment action + /// + public class ActionProcessingResponse : ProcessingResponse + { + /// + /// Gets or sets the ARN generated during the processing of captures and refunds + /// + public string AcquirerReferenceNumber { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Payments/PaymentAction.cs b/src/CheckoutSdk/Payments/PaymentAction.cs index 2dae2538..c5587935 100644 --- a/src/CheckoutSdk/Payments/PaymentAction.cs +++ b/src/CheckoutSdk/Payments/PaymentAction.cs @@ -13,42 +13,42 @@ public class PaymentAction : Resource /// Gets or sets the unique identifier of the payment action. /// public string Id { get; set; } - + /// /// Gets or sets the type of action. /// public string Type { get; set; } - + /// /// Gets or sets the date/time the action was processed. /// public DateTime ProcessedOn { get; set; } - + /// /// Gets or sets the action amount. /// public int Amount { get; set; } - + /// /// Gets or sets the acquirer authorization code where applicable. /// public string AuthCode { get; set; } - + /// /// Gets or sets the Checkout.com Gateway response code. /// public string ResponseCode { get; set; } - + /// /// Gets or sets the response summary. /// public string ResponseSummary { get; set; } - + /// /// Gets or sets your reference for the action. /// public string Reference { get; set; } - + /// /// Gets or sets the key/value pairs that were attached to the action. /// @@ -58,5 +58,11 @@ public class PaymentAction : Resource /// Gets or sets the approved flag for the action. /// public bool Approved { get; set; } + + /// + /// Gets or sets information related to the processing of a payment action + /// + /// + public ActionProcessingResponse Processing { get; set; } } } \ No newline at end of file diff --git a/src/CheckoutSdk/Payments/PaymentProcessed.cs b/src/CheckoutSdk/Payments/PaymentProcessed.cs index bc36a2ed..088ee941 100644 --- a/src/CheckoutSdk/Payments/PaymentProcessed.cs +++ b/src/CheckoutSdk/Payments/PaymentProcessed.cs @@ -86,6 +86,11 @@ public class PaymentProcessed : Resource /// Gets your reference for the payment. /// public string Reference { get; set; } + + /// + /// Gets the acquirer information related to the processing of the payment + /// + public ProcessingResponse Processing { get; set; } /// /// The final Electronic Commerce Indicator security level used to authorize the payment. Applicable for 3D-Secure, digital wallets and network token payments. diff --git a/src/CheckoutSdk/Payments/ProcessingResponse.cs b/src/CheckoutSdk/Payments/ProcessingResponse.cs new file mode 100644 index 00000000..62d5dbfa --- /dev/null +++ b/src/CheckoutSdk/Payments/ProcessingResponse.cs @@ -0,0 +1,19 @@ +namespace Checkout.Payments +{ + /// + /// Information related to the processing of the payment + /// + public class ProcessingResponse + { + /// + /// Gets or sets the retrieval reference number - a unique identifier for the authorization that is submitted to the card scheme during processing + /// + /// + public string RetrievalReferenceNumber { get; set; } + + /// + /// Gets or sets the unique identifier for the transaction generated by the acquirer + /// + public string AcquirerTransactionId { get; set; } + } +} \ No newline at end of file diff --git a/test/CheckoutSdk.Tests/Payments/CardSourcePaymentsTests.cs b/test/CheckoutSdk.Tests/Payments/CardSourcePaymentsTests.cs index 2a862364..c53d5ad7 100644 --- a/test/CheckoutSdk.Tests/Payments/CardSourcePaymentsTests.cs +++ b/test/CheckoutSdk.Tests/Payments/CardSourcePaymentsTests.cs @@ -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] diff --git a/test/CheckoutSdk.Tests/Payments/GetPaymentTests.cs b/test/CheckoutSdk.Tests/Payments/GetPaymentTests.cs index 66d178e8..65d4861c 100644 --- a/test/CheckoutSdk.Tests/Payments/GetPaymentTests.cs +++ b/test/CheckoutSdk.Tests/Payments/GetPaymentTests.cs @@ -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] @@ -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]