From 5d72d6eda94d721fdaa46fdd655a5b092f508b9d Mon Sep 17 00:00:00 2001 From: FSichinger Date: Tue, 19 Sep 2017 09:53:59 +0200 Subject: [PATCH] Added method for partial capture function --- GoPay.net-sdk/GoPay.net-sdk.csproj | 1 + GoPay.net-sdk/src/GPConnector.cs | 10 +++++++++ .../src/Model/Payment/CapturePayment.cs | 21 +++++++++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 GoPay.net-sdk/src/Model/Payment/CapturePayment.cs diff --git a/GoPay.net-sdk/GoPay.net-sdk.csproj b/GoPay.net-sdk/GoPay.net-sdk.csproj index e5cbc91..3b7927f 100644 --- a/GoPay.net-sdk/GoPay.net-sdk.csproj +++ b/GoPay.net-sdk/GoPay.net-sdk.csproj @@ -80,6 +80,7 @@ + diff --git a/GoPay.net-sdk/src/GPConnector.cs b/GoPay.net-sdk/src/GPConnector.cs index c14c63d..a88534f 100644 --- a/GoPay.net-sdk/src/GPConnector.cs +++ b/GoPay.net-sdk/src/GPConnector.cs @@ -175,6 +175,16 @@ public async Task CapturePaymentAsync(long id) return await Task.Factory.StartNew(() => Deserialize(response.Content)); } + /// + public PaymentResult CapturePayment(long id, CapturePayment capturePayment) + { + var restRequest = CreateRestRequest(@"/payments/payment/{id}/capture", "application/json"); + restRequest.AddParameter("id", id, ParameterType.UrlSegment); + restRequest.AddJsonBody(capturePayment); + var response = Client.Execute(restRequest); + return ProcessResponse(response); + } + /// public PaymentResult VoidAuthorization(long id) { diff --git a/GoPay.net-sdk/src/Model/Payment/CapturePayment.cs b/GoPay.net-sdk/src/Model/Payment/CapturePayment.cs new file mode 100644 index 0000000..237c6d1 --- /dev/null +++ b/GoPay.net-sdk/src/Model/Payment/CapturePayment.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using Newtonsoft.Json; +using GoPay.EETProp; + +namespace GoPay.Model.Payments +{ + public class CapturePayment + { + + [JsonProperty("amount")] + public long Amount { get; set; } + + [JsonProperty("items")] + public List Items { get; set; } + + [JsonProperty("eet")] + public EET Eet { get; set; } + + } +}