Skip to content

Added cvc_endpoint. #35 #36

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 26, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions BunqSdk/Model/Generated/Endpoint/Card.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ public class Card : BunqModel
[JsonProperty(PropertyName = "public_uuid")]
public string PublicUuid { get; private set; }

/// <summary>
/// The type of the card. Can be MAESTRO, MASTERCARD.
/// </summary>
[JsonProperty(PropertyName = "type")]
public string Type { get; private set; }

/// <summary>
/// The second line of text on the card
/// </summary>
Expand Down
6 changes: 6 additions & 0 deletions BunqSdk/Model/Generated/Endpoint/CardDebit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ public class CardDebit : BunqModel
[JsonProperty(PropertyName = "public_uuid")]
public string PublicUuid { get; private set; }

/// <summary>
/// The type of the card. Can be MAESTRO, MASTERCARD.
/// </summary>
[JsonProperty(PropertyName = "type")]
public string Type { get; private set; }

/// <summary>
/// The second line of text on the card
/// </summary>
Expand Down
90 changes: 90 additions & 0 deletions BunqSdk/Model/Generated/Endpoint/CardGeneratedCvc2.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
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 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);
}
}
}
7 changes: 5 additions & 2 deletions BunqSdk/Model/Generated/Endpoint/CashRegister.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@
namespace Bunq.Sdk.Model.Generated.Endpoint
{
/// <summary>
/// CashRegisters act as an point of sale. They have a specific name and avatar, and optionally a location. A
/// CashRegister is used to create Tabs. A CashRegister can have an QR code that links to one of its Tabs.
/// CashRegisters are virtual points of sale. They have a specific name and avatar, and optionally, a
/// location.<br/>With a CashRegister you can create a Tab and then use a QR code to receive payments.<br/>Check out
/// our Quickstart example to learn how you can easily <a href="/api/1/page/usecase-tab-payment">create Tab
/// payments</a>.<br/><br/>Notification filters can be set on a CashRegister to receive callbacks. For more
/// information check the <a href="/api/1/page/callbacks">dedicated callbacks page</a>.
/// </summary>
public class CashRegister : BunqModel
{
Expand Down
2 changes: 1 addition & 1 deletion BunqSdk/Model/Generated/Endpoint/MonetaryAccountBank.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace Bunq.Sdk.Model.Generated.Endpoint
/// MonetaryAccountBanks and update specific fields of an existing MonetaryAccountBank. Examples of fields that can
/// be updated are the description, the daily limit and the avatar of the account.<br/><br/>Notification filters can
/// be set on a monetary account level to receive callbacks. For more information check the <a
/// href="/api/2/page/callbacks">dedicated callbacks page</a>.
/// href="/api/1/page/callbacks">dedicated callbacks page</a>.
/// </summary>
public class MonetaryAccountBank : BunqModel
{
Expand Down
4 changes: 3 additions & 1 deletion BunqSdk/Model/Generated/Endpoint/UserCompany.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
namespace Bunq.Sdk.Model.Generated.Endpoint
{
/// <summary>
/// Show the authenticated user, if it is a company.
/// With UserCompany you can retrieve information regarding the authenticated UserCompany and update specific
/// fields.<br/><br/>Notification filters can be set on a UserCompany level to receive callbacks. For more
/// information check the <a href="/api/1/page/callbacks">dedicated callbacks page</a>.
/// </summary>
public class UserCompany : BunqModel
{
Expand Down
4 changes: 3 additions & 1 deletion BunqSdk/Model/Generated/Endpoint/UserPerson.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
namespace Bunq.Sdk.Model.Generated.Endpoint
{
/// <summary>
/// Show the authenticated user, if it is a person.
/// With UserPerson you can retrieve information regarding the authenticated UserPerson and update specific
/// fields.<br/><br/>Notification filters can be set on a UserPerson level to receive callbacks. For more
/// information check the <a href="/api/1/page/callbacks">dedicated callbacks page</a>.
/// </summary>
public class UserPerson : BunqModel
{
Expand Down