Skip to content

Commit

Permalink
Release/1.8.0 (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
r-simlinger authored Sep 12, 2018
1 parent 2084370 commit 7ba01ed
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 36 deletions.
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

19 changes: 18 additions & 1 deletion lib/Secucard.Connect/Client/ProductService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,24 @@ private R Update<R>(R obj, ChannelOptions options) where R : SecuObject
}, options);
}

protected bool Update(string id, string action, string actionArg, object obj, ChannelOptions options)
protected R Update<R>(string id, string action, string actionArg, object obj, ChannelOptions options)
where R : SecuObject
{
var actionArgs = new List<string>();
if (actionArg != null) actionArgs.Add(actionArg);
return Request<R>(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<string>();
if (actionArg != null) actionArgs.Add(actionArg);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() + " }";
}
}
}
7 changes: 1 addition & 6 deletions lib/Secucard.Connect/Product/Payment/Model/SecupayInvoice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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() + " }";
}
}
}
28 changes: 8 additions & 20 deletions lib/Secucard.Connect/Product/Payment/Service/PaymentService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Model.Transaction>(paymentId, "cancel", null, data, null) != null;
return this.ExecuteToBool(paymentId, "cancel", null, data, null);
}

public bool Capture(string paymentId)
{
return this.Execute<Model.Transaction>(paymentId, "capture", null, null, null) != null;
return this.Execute<T>(paymentId, "capture", null, null, null) != null;
}

public bool UpdateBasket(string paymentId, Basket[] basket)
Expand All @@ -32,7 +32,7 @@ public bool UpdateBasket(string paymentId, Basket[] basket)
data.Id = paymentId;
data.Basket = basket;

return this.Execute<Model.Transaction>(paymentId, "basket", null, data, null) != null;
return this.Update<T>(paymentId, "basket", null, data, null) != null;
}

public bool ReverseAccrual(string paymentId)
Expand All @@ -41,31 +41,19 @@ public bool ReverseAccrual(string paymentId)
data.Id = paymentId;
data.Accrual = false;

return this.Execute<Model.Transaction>(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<Model.Transaction>(paymentId, "subsequent", null, data, null) != null;
return this.Update<T>(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<Model.Transaction>(paymentId, "subscription", null, data, null) != null;
return this.ExecuteToBool(paymentId, "assignExternalInvoicePdf", documentUploadId, data, null);
}

public override void RegisterEvents()
Expand Down
4 changes: 2 additions & 2 deletions lib/Secucard.Connect/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
[assembly: AssemblyVersion("1.8.0.0")]
[assembly: AssemblyFileVersion("1.8.0.0")]
2 changes: 1 addition & 1 deletion lib/Secucard.Connect/SecucardConnect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace Secucard.Connect
/// </summary>
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<string, IService> _serviceDict;
Expand Down

0 comments on commit 7ba01ed

Please sign in to comment.