Skip to content

Commit 1e22ad2

Browse files
authored
Merge pull request #36 from bunq/feature/cvc_endpoint
Added cvc_endpoint. #35
2 parents 19200fa + 38a939e commit 1e22ad2

File tree

7 files changed

+114
-5
lines changed

7 files changed

+114
-5
lines changed

BunqSdk/Model/Generated/Endpoint/Card.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@ public class Card : BunqModel
6565
[JsonProperty(PropertyName = "public_uuid")]
6666
public string PublicUuid { get; private set; }
6767

68+
/// <summary>
69+
/// The type of the card. Can be MAESTRO, MASTERCARD.
70+
/// </summary>
71+
[JsonProperty(PropertyName = "type")]
72+
public string Type { get; private set; }
73+
6874
/// <summary>
6975
/// The second line of text on the card
7076
/// </summary>

BunqSdk/Model/Generated/Endpoint/CardDebit.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ public class CardDebit : BunqModel
6262
[JsonProperty(PropertyName = "public_uuid")]
6363
public string PublicUuid { get; private set; }
6464

65+
/// <summary>
66+
/// The type of the card. Can be MAESTRO, MASTERCARD.
67+
/// </summary>
68+
[JsonProperty(PropertyName = "type")]
69+
public string Type { get; private set; }
70+
6571
/// <summary>
6672
/// The second line of text on the card
6773
/// </summary>
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
using Bunq.Sdk.Context;
2+
using Bunq.Sdk.Http;
3+
using Bunq.Sdk.Json;
4+
using Bunq.Sdk.Model.Core;
5+
using Bunq.Sdk.Security;
6+
using Newtonsoft.Json;
7+
using System.Collections.Generic;
8+
using System.Text;
9+
using System;
10+
11+
namespace Bunq.Sdk.Model.Generated.Endpoint
12+
{
13+
/// <summary>
14+
/// Endpoint for generating and retrieving a new CVC2 code.
15+
/// </summary>
16+
public class CardGeneratedCvc2 : BunqModel
17+
{
18+
/// <summary>
19+
/// Endpoint constants.
20+
/// </summary>
21+
private const string ENDPOINT_URL_CREATE = "user/{0}/card/{1}/generated-cvc2";
22+
private const string ENDPOINT_URL_READ = "user/{0}/card/{1}/generated-cvc2/{2}";
23+
private const string ENDPOINT_URL_LISTING = "user/{0}/card/{1}/generated-cvc2";
24+
25+
/// <summary>
26+
/// Object type.
27+
/// </summary>
28+
private const string OBJECT_TYPE = "CardGeneratedCvc2";
29+
30+
/// <summary>
31+
/// The cvc2 code.
32+
/// </summary>
33+
[JsonProperty(PropertyName = "cvc2")]
34+
public string Cvc2 { get; private set; }
35+
36+
/// <summary>
37+
/// The status of the cvc2. Can be AVAILABLE, USED, EXPIRED, BLOCKED.
38+
/// </summary>
39+
[JsonProperty(PropertyName = "status")]
40+
public string Status { get; private set; }
41+
42+
/// <summary>
43+
/// Expiry time of the cvc2.
44+
/// </summary>
45+
[JsonProperty(PropertyName = "expiry_time")]
46+
public string ExpiryTime { get; private set; }
47+
48+
/// <summary>
49+
/// Generate a new CVC2 code for a card.
50+
/// </summary>
51+
public static BunqResponse<CardGeneratedCvc2> Create(ApiContext apiContext, IDictionary<string, object> requestMap, int userId, int cardId, IDictionary<string, string> customHeaders = null)
52+
{
53+
if (customHeaders == null) customHeaders = new Dictionary<string, string>();
54+
55+
var apiClient = new ApiClient(apiContext);
56+
var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap));
57+
requestBytes = SecurityUtils.Encrypt(apiContext, requestBytes, customHeaders);
58+
var responseRaw = apiClient.Post(string.Format(ENDPOINT_URL_CREATE, userId, cardId), requestBytes, customHeaders);
59+
60+
return FromJson<CardGeneratedCvc2>(responseRaw, OBJECT_TYPE);
61+
}
62+
63+
/// <summary>
64+
/// Get the details for a specific generated CVC2 code.
65+
/// </summary>
66+
public static BunqResponse<CardGeneratedCvc2> Get(ApiContext apiContext, int userId, int cardId, int cardGeneratedCvc2Id, IDictionary<string, string> customHeaders = null)
67+
{
68+
if (customHeaders == null) customHeaders = new Dictionary<string, string>();
69+
70+
var apiClient = new ApiClient(apiContext);
71+
var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_READ, userId, cardId, cardGeneratedCvc2Id), new Dictionary<string, string>(), customHeaders);
72+
73+
return FromJson<CardGeneratedCvc2>(responseRaw, OBJECT_TYPE);
74+
}
75+
76+
/// <summary>
77+
/// Get all generated CVC2 codes for a card.
78+
/// </summary>
79+
public static BunqResponse<List<CardGeneratedCvc2>> List(ApiContext apiContext, int userId, int cardId, IDictionary<string, string> urlParams = null, IDictionary<string, string> customHeaders = null)
80+
{
81+
if (urlParams == null) urlParams = new Dictionary<string, string>();
82+
if (customHeaders == null) customHeaders = new Dictionary<string, string>();
83+
84+
var apiClient = new ApiClient(apiContext);
85+
var responseRaw = apiClient.Get(string.Format(ENDPOINT_URL_LISTING, userId, cardId), urlParams, customHeaders);
86+
87+
return FromJsonList<CardGeneratedCvc2>(responseRaw, OBJECT_TYPE);
88+
}
89+
}
90+
}

BunqSdk/Model/Generated/Endpoint/CashRegister.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,11 @@
1111
namespace Bunq.Sdk.Model.Generated.Endpoint
1212
{
1313
/// <summary>
14-
/// CashRegisters act as an point of sale. They have a specific name and avatar, and optionally a location. A
15-
/// CashRegister is used to create Tabs. A CashRegister can have an QR code that links to one of its Tabs.
14+
/// CashRegisters are virtual points of sale. They have a specific name and avatar, and optionally, a
15+
/// location.<br/>With a CashRegister you can create a Tab and then use a QR code to receive payments.<br/>Check out
16+
/// our Quickstart example to learn how you can easily <a href="/api/1/page/usecase-tab-payment">create Tab
17+
/// payments</a>.<br/><br/>Notification filters can be set on a CashRegister to receive callbacks. For more
18+
/// information check the <a href="/api/1/page/callbacks">dedicated callbacks page</a>.
1619
/// </summary>
1720
public class CashRegister : BunqModel
1821
{

BunqSdk/Model/Generated/Endpoint/MonetaryAccountBank.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ namespace Bunq.Sdk.Model.Generated.Endpoint
1515
/// MonetaryAccountBanks and update specific fields of an existing MonetaryAccountBank. Examples of fields that can
1616
/// be updated are the description, the daily limit and the avatar of the account.<br/><br/>Notification filters can
1717
/// be set on a monetary account level to receive callbacks. For more information check the <a
18-
/// href="/api/2/page/callbacks">dedicated callbacks page</a>.
18+
/// href="/api/1/page/callbacks">dedicated callbacks page</a>.
1919
/// </summary>
2020
public class MonetaryAccountBank : BunqModel
2121
{

BunqSdk/Model/Generated/Endpoint/UserCompany.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
namespace Bunq.Sdk.Model.Generated.Endpoint
1212
{
1313
/// <summary>
14-
/// Show the authenticated user, if it is a company.
14+
/// With UserCompany you can retrieve information regarding the authenticated UserCompany and update specific
15+
/// fields.<br/><br/>Notification filters can be set on a UserCompany level to receive callbacks. For more
16+
/// information check the <a href="/api/1/page/callbacks">dedicated callbacks page</a>.
1517
/// </summary>
1618
public class UserCompany : BunqModel
1719
{

BunqSdk/Model/Generated/Endpoint/UserPerson.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
namespace Bunq.Sdk.Model.Generated.Endpoint
1212
{
1313
/// <summary>
14-
/// Show the authenticated user, if it is a person.
14+
/// With UserPerson you can retrieve information regarding the authenticated UserPerson and update specific
15+
/// fields.<br/><br/>Notification filters can be set on a UserPerson level to receive callbacks. For more
16+
/// information check the <a href="/api/1/page/callbacks">dedicated callbacks page</a>.
1517
/// </summary>
1618
public class UserPerson : BunqModel
1719
{

0 commit comments

Comments
 (0)