From 7ba01edd0a22b08abcd32f235bac55b70301da98 Mon Sep 17 00:00:00 2001 From: Rico Simlinger Date: Wed, 12 Sep 2018 16:28:32 +0200 Subject: [PATCH] Release/1.8.0 (#18) --- CHANGELOG.md | 22 +++++++++++++++ lib/Secucard.Connect/Client/ProductService.cs | 19 ++++++++++++- .../Payment/Model/SecupayCreditcard.cs | 7 +---- .../Product/Payment/Model/SecupayInvoice.cs | 7 +---- .../Product/Payment/Service/PaymentService.cs | 28 ++++++------------- .../Properties/AssemblyInfo.cs | 4 +-- lib/Secucard.Connect/SecucardConnect.cs | 2 +- 7 files changed, 53 insertions(+), 36 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c66a78..c522f24 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,27 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ### Removed +## [1.8.0] - 2018-08-30 + +### Added + +- Payment: AssignExternalInvoicePdf + +### Fixed + +- Payment: Cancel returned (in some special cases) always false +- Payment: Capture returned (in some special cases) always false +- Payment: UpdateBasket returned (in some special cases) always false +- Payment: ReverseAccrual returned (in some special cases) always false +- Payment: SetShippingInformation returned (in some special cases) always false + +### Removed + +- Payment: container into SecupayCreditcard-Model (was not implemented in the api) +- Payment: container into SecupayInvoice-Model (was not implemented in the api) +- Payment: InitSubsequent (was not implemented in the api) +- Payment: UpdateSubscription (was not implemented in the api) + ## [1.7.0] - 2018-08-22 ### Added @@ -184,4 +205,5 @@ First release [1.5.0]: https://github.com/secucard/secucard-connect-net-sdk/compare/1.4.1...1.5.0 [1.6.0]: https://github.com/secucard/secucard-connect-net-sdk/compare/1.5.0...1.6.0 [1.7.0]: https://github.com/secucard/secucard-connect-net-sdk/compare/1.6.0...1.7.0 +[1.8.0]: https://github.com/secucard/secucard-connect-net-sdk/compare/1.7.0...1.8.0 diff --git a/lib/Secucard.Connect/Client/ProductService.cs b/lib/Secucard.Connect/Client/ProductService.cs index 8660c33..f89ce02 100644 --- a/lib/Secucard.Connect/Client/ProductService.cs +++ b/lib/Secucard.Connect/Client/ProductService.cs @@ -97,7 +97,24 @@ private R Update(R obj, ChannelOptions options) where R : SecuObject }, options); } - protected bool Update(string id, string action, string actionArg, object obj, ChannelOptions options) + protected R Update(string id, string action, string actionArg, object obj, ChannelOptions options) + where R : SecuObject + { + var actionArgs = new List(); + if (actionArg != null) actionArgs.Add(actionArg); + return Request(new ChannelRequest + { + Method = ChannelMethod.UpdateWithArgs, + Product = GetMetaData().Product, + Resource = GetMetaData().Resource, + Action = action, + ActionArgs = actionArgs, + ObjectId = id, + Object = obj + }, options); + } + + protected bool UpdateToBool(string id, string action, string actionArg, object obj, ChannelOptions options) { var actionArgs = new List(); if (actionArg != null) actionArgs.Add(actionArg); diff --git a/lib/Secucard.Connect/Product/Payment/Model/SecupayCreditcard.cs b/lib/Secucard.Connect/Product/Payment/Model/SecupayCreditcard.cs index 5b2fb32..4016efe 100644 --- a/lib/Secucard.Connect/Product/Payment/Model/SecupayCreditcard.cs +++ b/lib/Secucard.Connect/Product/Payment/Model/SecupayCreditcard.cs @@ -5,14 +5,9 @@ [DataContract] public class SecupayCreditcard : Transaction { - [DataMember(Name = "container")] - public Container Container { get; set; } - public override string ToString() { - return "SecupayCreditcard{" + - "container=" + Container + - "} " + base.ToString(); + return "SecupayCreditcard{ " + base.ToString() + " }"; } } } \ No newline at end of file diff --git a/lib/Secucard.Connect/Product/Payment/Model/SecupayInvoice.cs b/lib/Secucard.Connect/Product/Payment/Model/SecupayInvoice.cs index 32d46f5..fab22dc 100644 --- a/lib/Secucard.Connect/Product/Payment/Model/SecupayInvoice.cs +++ b/lib/Secucard.Connect/Product/Payment/Model/SecupayInvoice.cs @@ -5,14 +5,9 @@ [DataContract] public class SecupayInvoice : Transaction { - [DataMember(Name = "container")] - public Container Container { get; set; } - public override string ToString() { - return "SecupayInvoice{" + - "container=" + Container + - "} " + base.ToString(); + return "SecupayInvoice{ " + base.ToString() + " }"; } } } \ No newline at end of file diff --git a/lib/Secucard.Connect/Product/Payment/Service/PaymentService.cs b/lib/Secucard.Connect/Product/Payment/Service/PaymentService.cs index 4295c0b..3b6f7fe 100644 --- a/lib/Secucard.Connect/Product/Payment/Service/PaymentService.cs +++ b/lib/Secucard.Connect/Product/Payment/Service/PaymentService.cs @@ -18,12 +18,12 @@ public bool Cancel(string paymentId, string contractId = null, int amount = 0) data.Amount = amount; data.Contract = new Contract { Id = contractId }; - return this.Execute(paymentId, "cancel", null, data, null) != null; + return this.ExecuteToBool(paymentId, "cancel", null, data, null); } public bool Capture(string paymentId) { - return this.Execute(paymentId, "capture", null, null, null) != null; + return this.Execute(paymentId, "capture", null, null, null) != null; } public bool UpdateBasket(string paymentId, Basket[] basket) @@ -32,7 +32,7 @@ public bool UpdateBasket(string paymentId, Basket[] basket) data.Id = paymentId; data.Basket = basket; - return this.Execute(paymentId, "basket", null, data, null) != null; + return this.Update(paymentId, "basket", null, data, null) != null; } public bool ReverseAccrual(string paymentId) @@ -41,31 +41,19 @@ public bool ReverseAccrual(string paymentId) data.Id = paymentId; data.Accrual = false; - return this.Execute(paymentId, "accrual", null, data, null) != null; - } - - public bool InitSubsequent(string paymentId, int amount, Basket[] basket) - { - T data = this.CreateModelInstance(); - data.Id = paymentId; - data.Amount = amount; - data.Basket = basket; - - return this.Execute(paymentId, "subsequent", null, data, null) != null; + return this.Update(paymentId, "accrual", null, data, null) != null; } public bool SetShippingInformation(string paymentId, ShippingInformation data) { - return this.Update(paymentId, "shippingInformation", null, data, null); + return this.UpdateToBool(paymentId, "shippingInformation", null, data, null); } - public bool UpdateSubscription(string paymentId, string purpose) + public bool AssignExternalInvoicePdf(string paymentId, string documentUploadId, bool updateExisting = false) { - T data = this.CreateModelInstance(); - data.Id = paymentId; - data.Subscription = new Subscription { Purpose = purpose }; + var data = new { update_existing = updateExisting }; - return this.Execute(paymentId, "subscription", null, data, null) != null; + return this.ExecuteToBool(paymentId, "assignExternalInvoicePdf", documentUploadId, data, null); } public override void RegisterEvents() diff --git a/lib/Secucard.Connect/Properties/AssemblyInfo.cs b/lib/Secucard.Connect/Properties/AssemblyInfo.cs index ba5be9d..7388fe9 100644 --- a/lib/Secucard.Connect/Properties/AssemblyInfo.cs +++ b/lib/Secucard.Connect/Properties/AssemblyInfo.cs @@ -35,5 +35,5 @@ // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.7.0.0")] -[assembly: AssemblyFileVersion("1.7.0.0")] \ No newline at end of file +[assembly: AssemblyVersion("1.8.0.0")] +[assembly: AssemblyFileVersion("1.8.0.0")] \ No newline at end of file diff --git a/lib/Secucard.Connect/SecucardConnect.cs b/lib/Secucard.Connect/SecucardConnect.cs index 9fef211..dde507d 100644 --- a/lib/Secucard.Connect/SecucardConnect.cs +++ b/lib/Secucard.Connect/SecucardConnect.cs @@ -25,7 +25,7 @@ namespace Secucard.Connect /// public class SecucardConnect { - public const string Version = "1.7.0"; + public const string Version = "1.8.0"; private readonly ClientConfiguration _configuration; private readonly ClientContext _context; private readonly Dictionary _serviceDict;