Skip to content

Commit a502315

Browse files
Merge branch 'release/1.13.0'
2 parents e97bfb5 + f5e4744 commit a502315

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1960
-1342
lines changed

BunqSdk.Tests/Model/Generated/Endpoint/CardDebitTest.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public class CardDebitTest : BunqSdkTestBase
2626
private const int NonnegativeIntegerMinimum = 0;
2727
private const int CardSecondLineLengthMaximum = 20;
2828
private const string CardTypeMaestro = "MAESTRO";
29+
private const string ProductTypeMaestroDebit = "MAESTRO_DEBIT";
2930

3031
/// <summary>
3132
/// Number constants.
@@ -55,6 +56,7 @@ public void TestOrderNewMaestroCard()
5556
GetAnAllowedName(),
5657
CardTypeMaestro,
5758
GetAlias(),
59+
ProductTypeMaestroDebit,
5860
allCardPinAssignments
5961
).Value;
6062

BunqSdk.Tests/Model/Generated/Object/NotificationUrlTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ public void TestShareInviteBankModel()
212212
{
213213
ExecuteNotificationUrlTest(
214214
JsonPathShareInviteBankInquiryModel,
215-
typeof(ShareInviteBankInquiry),
215+
typeof(ShareInviteMonetaryAccountInquiry),
216216
GetShareInviteBankInquiry
217217
);
218218
}
@@ -222,7 +222,7 @@ public void TestShareInviteBankResponse()
222222
{
223223
ExecuteNotificationUrlTest(
224224
JsonPathShareInviteBankResponseModel,
225-
typeof(ShareInviteBankResponse),
225+
typeof(ShareInviteMonetaryAccountResponse),
226226
GetShareInviteBankResponse
227227
);
228228
}

BunqSdk/BunqSdk.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<PackageId>Bunq.Sdk</PackageId>
99
</PropertyGroup>
1010
<PropertyGroup>
11-
<VersionPrefix>1.12.1</VersionPrefix>
11+
<VersionPrefix>1.13.0</VersionPrefix>
1212
</PropertyGroup>
1313
<PropertyGroup>
1414
<RootNamespace>Bunq.Sdk</RootNamespace>

BunqSdk/CHANGELOG.md

Lines changed: 284 additions & 0 deletions
Large diffs are not rendered by default.

BunqSdk/Http/ApiClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public class ApiClient
6464
/// Values for the default headers
6565
/// </summary>
6666
private const string CACHE_CONTROL_NONE = "no-cache";
67-
private const string USER_AGENT_BUNQ = "bunq-sdk-csharp/1.12.1";
67+
private const string USER_AGENT_BUNQ = "bunq-sdk-csharp/1.13.0";
6868
private const string LANGUAGE_EN_US = "en_US";
6969
private const string REGION_NL_NL = "nl_NL";
7070
private const string GEOLOCATION_ZERO = "0 0 0 0 NL";
Lines changed: 208 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,208 @@
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.Model.Generated.Object;
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+
/// View for requesting Bancontact transactions and polling their status.
15+
/// </summary>
16+
public class BancontactMerchantTransaction : BunqModel
17+
{
18+
/// <summary>
19+
/// Endpoint constants.
20+
/// </summary>
21+
protected const string ENDPOINT_URL_CREATE = "user/{0}/monetary-account/{1}/bancontact-merchant-transaction";
22+
23+
protected const string ENDPOINT_URL_READ = "user/{0}/monetary-account/{1}/bancontact-merchant-transaction/{2}";
24+
protected const string ENDPOINT_URL_LISTING = "user/{0}/monetary-account/{1}/bancontact-merchant-transaction";
25+
26+
/// <summary>
27+
/// Field constants.
28+
/// </summary>
29+
public const string FIELD_AMOUNT_REQUESTED = "amount_requested";
30+
31+
/// <summary>
32+
/// Object type.
33+
/// </summary>
34+
private const string OBJECT_TYPE_GET = "BancontactMerchantTransaction";
35+
36+
/// <summary>
37+
/// The requested amount of money to add.
38+
/// </summary>
39+
[JsonProperty(PropertyName = "amount_requested")]
40+
public Amount AmountRequested { get; set; }
41+
42+
/// <summary>
43+
/// The id of the monetary account this bancontact merchant transaction links to.
44+
/// </summary>
45+
[JsonProperty(PropertyName = "monetary_account_id")]
46+
public int? MonetaryAccountId { get; set; }
47+
48+
/// <summary>
49+
/// The alias of the monetary account to add money to.
50+
/// </summary>
51+
[JsonProperty(PropertyName = "alias")]
52+
public MonetaryAccountReference Alias { get; set; }
53+
54+
/// <summary>
55+
/// When the transaction will expire.
56+
/// </summary>
57+
[JsonProperty(PropertyName = "expiration")]
58+
public string Expiration { get; set; }
59+
60+
/// <summary>
61+
/// The URL to visit complete the bancontact transaction.
62+
/// </summary>
63+
[JsonProperty(PropertyName = "url_redirect")]
64+
public string UrlRedirect { get; set; }
65+
66+
/// <summary>
67+
/// The deep link to visit complete the bancontact transaction.
68+
/// </summary>
69+
[JsonProperty(PropertyName = "url_deep_link")]
70+
public string UrlDeepLink { get; set; }
71+
72+
/// <summary>
73+
/// The status of the transaction.
74+
/// </summary>
75+
[JsonProperty(PropertyName = "status")]
76+
public string Status { get; set; }
77+
78+
/// <summary>
79+
/// When the status was last updated.
80+
/// </summary>
81+
[JsonProperty(PropertyName = "status_timestamp")]
82+
public string StatusTimestamp { get; set; }
83+
84+
/// <summary>
85+
/// The transaction ID of the bancontact transaction.
86+
/// </summary>
87+
[JsonProperty(PropertyName = "transaction_id")]
88+
public string TransactionId { get; set; }
89+
90+
91+
/// <summary>
92+
/// </summary>
93+
/// <param name="amountRequested">The requested amount of money to add.</param>
94+
public static BunqResponse<int> Create(Amount amountRequested, int? monetaryAccountId = null,
95+
IDictionary<string, string> customHeaders = null)
96+
{
97+
if (customHeaders == null) customHeaders = new Dictionary<string, string>();
98+
99+
var apiClient = new ApiClient(GetApiContext());
100+
101+
var requestMap = new Dictionary<string, object>
102+
{
103+
{FIELD_AMOUNT_REQUESTED, amountRequested},
104+
};
105+
106+
var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap));
107+
var responseRaw =
108+
apiClient.Post(
109+
string.Format(ENDPOINT_URL_CREATE, DetermineUserId(),
110+
DetermineMonetaryAccountId(monetaryAccountId)), requestBytes, customHeaders);
111+
112+
return ProcessForId(responseRaw);
113+
}
114+
115+
/// <summary>
116+
/// </summary>
117+
public static BunqResponse<BancontactMerchantTransaction> Get(int bancontactMerchantTransactionId,
118+
int? monetaryAccountId = null, IDictionary<string, string> customHeaders = null)
119+
{
120+
if (customHeaders == null) customHeaders = new Dictionary<string, string>();
121+
122+
var apiClient = new ApiClient(GetApiContext());
123+
var responseRaw =
124+
apiClient.Get(
125+
string.Format(ENDPOINT_URL_READ, DetermineUserId(), DetermineMonetaryAccountId(monetaryAccountId),
126+
bancontactMerchantTransactionId), new Dictionary<string, string>(), customHeaders);
127+
128+
return FromJson<BancontactMerchantTransaction>(responseRaw, OBJECT_TYPE_GET);
129+
}
130+
131+
/// <summary>
132+
/// </summary>
133+
public static BunqResponse<List<BancontactMerchantTransaction>> List(int? monetaryAccountId = null,
134+
IDictionary<string, string> urlParams = null, IDictionary<string, string> customHeaders = null)
135+
{
136+
if (urlParams == null) urlParams = new Dictionary<string, string>();
137+
if (customHeaders == null) customHeaders = new Dictionary<string, string>();
138+
139+
var apiClient = new ApiClient(GetApiContext());
140+
var responseRaw =
141+
apiClient.Get(
142+
string.Format(ENDPOINT_URL_LISTING, DetermineUserId(),
143+
DetermineMonetaryAccountId(monetaryAccountId)), urlParams, customHeaders);
144+
145+
return FromJsonList<BancontactMerchantTransaction>(responseRaw, OBJECT_TYPE_GET);
146+
}
147+
148+
149+
/// <summary>
150+
/// </summary>
151+
public override bool IsAllFieldNull()
152+
{
153+
if (this.MonetaryAccountId != null)
154+
{
155+
return false;
156+
}
157+
158+
if (this.Alias != null)
159+
{
160+
return false;
161+
}
162+
163+
if (this.AmountRequested != null)
164+
{
165+
return false;
166+
}
167+
168+
if (this.Expiration != null)
169+
{
170+
return false;
171+
}
172+
173+
if (this.UrlRedirect != null)
174+
{
175+
return false;
176+
}
177+
178+
if (this.UrlDeepLink != null)
179+
{
180+
return false;
181+
}
182+
183+
if (this.Status != null)
184+
{
185+
return false;
186+
}
187+
188+
if (this.StatusTimestamp != null)
189+
{
190+
return false;
191+
}
192+
193+
if (this.TransactionId != null)
194+
{
195+
return false;
196+
}
197+
198+
return true;
199+
}
200+
201+
/// <summary>
202+
/// </summary>
203+
public static BancontactMerchantTransaction CreateFromJsonString(string json)
204+
{
205+
return BunqModel.CreateFromJsonString<BancontactMerchantTransaction>(json);
206+
}
207+
}
208+
}

BunqSdk/Model/Generated/Endpoint/Card.cs

Lines changed: 1 addition & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
using Bunq.Sdk.Json;
44
using Bunq.Sdk.Model.Core;
55
using Bunq.Sdk.Model.Generated.Object;
6-
using Bunq.Sdk.Security;
76
using Newtonsoft.Json;
87
using System.Collections.Generic;
98
using System.Text;
@@ -33,10 +32,8 @@ public class Card : BunqModel
3332
public const string FIELD_STATUS = "status";
3433
public const string FIELD_CARD_LIMIT = "card_limit";
3534
public const string FIELD_CARD_LIMIT_ATM = "card_limit_atm";
36-
public const string FIELD_MAG_STRIPE_PERMISSION = "mag_stripe_permission";
3735
public const string FIELD_COUNTRY_PERMISSION = "country_permission";
3836
public const string FIELD_PIN_CODE_ASSIGNMENT = "pin_code_assignment";
39-
public const string FIELD_PRIMARY_ACCOUNT_NUMBERS_VIRTUAL = "primary_account_numbers_virtual";
4037
public const string FIELD_PRIMARY_ACCOUNT_NUMBERS = "primary_account_numbers";
4138
public const string FIELD_MONETARY_ACCOUNT_ID_FALLBACK = "monetary_account_id_fallback";
4239

@@ -78,12 +75,6 @@ public class Card : BunqModel
7875
[JsonProperty(PropertyName = "card_limit_atm")]
7976
public Amount CardLimitAtm { get; set; }
8077

81-
/// <summary>
82-
/// DEPRECATED: Whether or not it is allowed to use the mag stripe for the card.
83-
/// </summary>
84-
[JsonProperty(PropertyName = "mag_stripe_permission")]
85-
public CardMagStripePermission MagStripePermission { get; set; }
86-
8778
/// <summary>
8879
/// The countries for which to grant (temporary) permissions to use the card.
8980
/// </summary>
@@ -96,12 +87,6 @@ public class Card : BunqModel
9687
[JsonProperty(PropertyName = "pin_code_assignment")]
9788
public List<CardPinAssignment> PinCodeAssignment { get; set; }
9889

99-
/// <summary>
100-
/// Array of PANs, status, description and account id for online cards.
101-
/// </summary>
102-
[JsonProperty(PropertyName = "primary_account_numbers_virtual")]
103-
public List<CardVirtualPrimaryAccountNumber> PrimaryAccountNumbersVirtual { get; set; }
104-
10590
/// <summary>
10691
/// Array of PANs and their attributes.
10792
/// </summary>
@@ -182,12 +167,6 @@ public class Card : BunqModel
182167
[JsonProperty(PropertyName = "name_on_card")]
183168
public string NameOnCard { get; set; }
184169

185-
/// <summary>
186-
/// The last 4 digits of the PAN of the card.
187-
/// </summary>
188-
[JsonProperty(PropertyName = "primary_account_number_four_digit")]
189-
public string PrimaryAccountNumberFourDigit { get; set; }
190-
191170
/// <summary>
192171
/// The monetary account this card was ordered on and the label user that owns the card.
193172
/// </summary>
@@ -217,17 +196,13 @@ public class Card : BunqModel
217196
/// <param name="status">The status to set for the card. Can be ACTIVE, DEACTIVATED, LOST, STOLEN or CANCELLED, and can only be set to LOST/STOLEN/CANCELLED when order status is ACCEPTED_FOR_PRODUCTION/DELIVERED_TO_CUSTOMER/CARD_UPDATE_REQUESTED/CARD_UPDATE_SENT/CARD_UPDATE_ACCEPTED. Can only be set to DEACTIVATED after initial activation, i.e. order_status is DELIVERED_TO_CUSTOMER/CARD_UPDATE_REQUESTED/CARD_UPDATE_SENT/CARD_UPDATE_ACCEPTED. Mind that all the possible choices (apart from ACTIVE and DEACTIVATED) are permanent and cannot be changed after.</param>
218197
/// <param name="cardLimit">The spending limit for the card.</param>
219198
/// <param name="cardLimitAtm">The ATM spending limit for the card.</param>
220-
/// <param name="magStripePermission">DEPRECATED: Whether or not it is allowed to use the mag stripe for the card.</param>
221199
/// <param name="countryPermission">The countries for which to grant (temporary) permissions to use the card.</param>
222200
/// <param name="pinCodeAssignment">Array of Types, PINs, account IDs assigned to the card.</param>
223-
/// <param name="primaryAccountNumbersVirtual">Array of PANs, status, description and account id for online cards.</param>
224201
/// <param name="primaryAccountNumbers">Array of PANs and their attributes.</param>
225202
/// <param name="monetaryAccountIdFallback">ID of the MA to be used as fallback for this card if insufficient balance. Fallback account is removed if not supplied.</param>
226203
public static BunqResponse<Card> Update(int cardId, string pinCode = null, string activationCode = null,
227204
string status = null, Amount cardLimit = null, Amount cardLimitAtm = null,
228-
CardMagStripePermission magStripePermission = null, List<CardCountryPermission> countryPermission = null,
229-
List<CardPinAssignment> pinCodeAssignment = null,
230-
List<CardVirtualPrimaryAccountNumber> primaryAccountNumbersVirtual = null,
205+
List<CardCountryPermission> countryPermission = null, List<CardPinAssignment> pinCodeAssignment = null,
231206
List<CardPrimaryAccountNumber> primaryAccountNumbers = null, int? monetaryAccountIdFallback = null,
232207
IDictionary<string, string> customHeaders = null)
233208
{
@@ -242,16 +217,13 @@ public static BunqResponse<Card> Update(int cardId, string pinCode = null, strin
242217
{FIELD_STATUS, status},
243218
{FIELD_CARD_LIMIT, cardLimit},
244219
{FIELD_CARD_LIMIT_ATM, cardLimitAtm},
245-
{FIELD_MAG_STRIPE_PERMISSION, magStripePermission},
246220
{FIELD_COUNTRY_PERMISSION, countryPermission},
247221
{FIELD_PIN_CODE_ASSIGNMENT, pinCodeAssignment},
248-
{FIELD_PRIMARY_ACCOUNT_NUMBERS_VIRTUAL, primaryAccountNumbersVirtual},
249222
{FIELD_PRIMARY_ACCOUNT_NUMBERS, primaryAccountNumbers},
250223
{FIELD_MONETARY_ACCOUNT_ID_FALLBACK, monetaryAccountIdFallback},
251224
};
252225

253226
var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap));
254-
requestBytes = SecurityUtils.Encrypt(GetApiContext(), requestBytes, customHeaders);
255227
var responseRaw = apiClient.Put(string.Format(ENDPOINT_URL_UPDATE, DetermineUserId(), cardId), requestBytes,
256228
customHeaders);
257229

@@ -353,16 +325,6 @@ public override bool IsAllFieldNull()
353325
return false;
354326
}
355327

356-
if (this.PrimaryAccountNumberFourDigit != null)
357-
{
358-
return false;
359-
}
360-
361-
if (this.PrimaryAccountNumbersVirtual != null)
362-
{
363-
return false;
364-
}
365-
366328
if (this.PrimaryAccountNumbers != null)
367329
{
368330
return false;

0 commit comments

Comments
 (0)