-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
210 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
## Steps to reproduce: | ||
1. | ||
|
||
## What should happen: | ||
1. | ||
|
||
## What happens: | ||
1. | ||
|
||
## Logs | ||
- Logs | ||
|
||
## Extra info: | ||
- Tested on | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
using Bunq.Sdk.Context; | ||
using Bunq.Sdk.Http; | ||
using Bunq.Sdk.Json; | ||
using Bunq.Sdk.Model.Core; | ||
using Bunq.Sdk.Security; | ||
using Newtonsoft.Json; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using System; | ||
|
||
namespace Bunq.Sdk.Model.Generated.Endpoint | ||
{ | ||
/// <summary> | ||
/// Endpoint for generating and retrieving a new CVC2 code. | ||
/// </summary> | ||
public class CardGeneratedCvc2 : BunqModel | ||
{ | ||
/// <summary> | ||
/// Endpoint constants. | ||
/// </summary> | ||
private const string ENDPOINT_URL_CREATE = "user/{0}/card/{1}/generated-cvc2"; | ||
private const string ENDPOINT_URL_READ = "user/{0}/card/{1}/generated-cvc2/{2}"; | ||
private const string ENDPOINT_URL_LISTING = "user/{0}/card/{1}/generated-cvc2"; | ||
|
||
/// <summary> | ||
/// Object type. | ||
/// </summary> | ||
private const string OBJECT_TYPE = "CardGeneratedCvc2"; | ||
|
||
/// <summary> | ||
/// The id of the cvc code. | ||
/// </summary> | ||
[JsonProperty(PropertyName = "id")] | ||
public int? Id { get; private set; } | ||
|
||
/// <summary> | ||
/// The timestamp of the cvc code's creation. | ||
/// </summary> | ||
[JsonProperty(PropertyName = "created")] | ||
public string Created { get; private set; } | ||
|
||
/// <summary> | ||
/// The timestamp of the cvc code's last update. | ||
/// </summary> | ||
[JsonProperty(PropertyName = "updated")] | ||
public string Updated { get; private set; } | ||
|
||
/// <summary> | ||
/// The cvc2 code. | ||
/// </summary> | ||
[JsonProperty(PropertyName = "cvc2")] | ||
public string Cvc2 { get; private set; } | ||
|
||
/// <summary> | ||
/// The status of the cvc2. Can be AVAILABLE, USED, EXPIRED, BLOCKED. | ||
/// </summary> | ||
[JsonProperty(PropertyName = "status")] | ||
public string Status { get; private set; } | ||
|
||
/// <summary> | ||
/// Expiry time of the cvc2. | ||
/// </summary> | ||
[JsonProperty(PropertyName = "expiry_time")] | ||
public string ExpiryTime { get; private set; } | ||
|
||
/// <summary> | ||
/// Generate a new CVC2 code for a card. | ||
/// </summary> | ||
public static BunqResponse<CardGeneratedCvc2> Create(ApiContext apiContext, IDictionary<string, object> requestMap, int userId, int cardId, IDictionary<string, string> customHeaders = null) | ||
{ | ||
if (customHeaders == null) customHeaders = new Dictionary<string, string>(); | ||
|
||
var apiClient = new ApiClient(apiContext); | ||
var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); | ||
requestBytes = SecurityUtils.Encrypt(apiContext, requestBytes, customHeaders); | ||
var responseRaw = apiClient.Post(string.Format(ENDPOINT_URL_CREATE, userId, cardId), requestBytes, customHeaders); | ||
|
||
return FromJson<CardGeneratedCvc2>(responseRaw, OBJECT_TYPE); | ||
} | ||
|
||
/// <summary> | ||
/// Get the details for a specific generated CVC2 code. | ||
/// </summary> | ||
public static BunqResponse<CardGeneratedCvc2> Get(ApiContext apiContext, int userId, int cardId, int cardGeneratedCvc2Id, IDictionary<string, string> customHeaders = null) | ||
{ | ||
if (customHeaders == null) customHeaders = new Dictionary<string, string>(); | ||
|
||
var apiClient = new ApiClient(apiContext); | ||
var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, userId, cardId, cardGeneratedCvc2Id), new Dictionary<string, string>(), customHeaders); | ||
|
||
return FromJson<CardGeneratedCvc2>(responseRaw, OBJECT_TYPE); | ||
} | ||
|
||
/// <summary> | ||
/// Get all generated CVC2 codes for a card. | ||
/// </summary> | ||
public static BunqResponse<List<CardGeneratedCvc2>> List(ApiContext apiContext, int userId, int cardId, IDictionary<string, string> urlParams = null, IDictionary<string, string> customHeaders = null) | ||
{ | ||
if (urlParams == null) urlParams = new Dictionary<string, string>(); | ||
if (customHeaders == null) customHeaders = new Dictionary<string, string>(); | ||
|
||
var apiClient = new ApiClient(apiContext); | ||
var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, userId, cardId), urlParams, customHeaders); | ||
|
||
return FromJsonList<CardGeneratedCvc2>(responseRaw, OBJECT_TYPE); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
BunqSdk/Model/Generated/Object/DraftPaymentAnchorObject.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using Bunq.Sdk.Model.Core; | ||
using Bunq.Sdk.Model.Generated.Endpoint; | ||
using Newtonsoft.Json; | ||
using System.Collections.Generic; | ||
|
||
namespace Bunq.Sdk.Model.Generated.Object | ||
{ | ||
/// <summary> | ||
/// </summary> | ||
public class DraftPaymentAnchorObject : BunqModel | ||
{ | ||
/// <summary> | ||
/// </summary> | ||
[JsonProperty(PropertyName = "Payment")] | ||
public Payment Payment { get; set; } | ||
|
||
/// <summary> | ||
/// </summary> | ||
[JsonProperty(PropertyName = "PaymentBatch")] | ||
public PaymentBatch PaymentBatch { get; set; } | ||
} | ||
} |