Skip to content

Commit 92f406f

Browse files
author
Kevin Hellemun
committed
Merge branch 'release/0.13.0'
2 parents ac4c53a + 9691c3c commit 92f406f

File tree

202 files changed

+8500
-4915
lines changed

Some content is hidden

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

202 files changed

+8500
-4915
lines changed

.github/ISSUE_TEMPLATE.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,17 @@
77
## What happens:
88
1.
99

10-
## Logs
11-
- Logs
10+
## Traceback
11+
[//]: # (If there is a traceback please share it in a quote! You can do this by pasting the traceback text, highlighting it and pressing the quote button.)
1212

13-
## Extra info:
14-
- Tested on
13+
## SDK version and environment
14+
- Tested on [0.12.4](https://github.com/bunq/sdk_csharp/releases/tag/0.12.4)
15+
- [ ] Sandbox
16+
- [ ] Production
17+
18+
## Response id
19+
[//]: # (If this error has something to do with a request that fails, please provide the response id of the request.)
20+
- Response id:
1521

22+
## Extra info:
23+
[//]: # (Please provide any other relevant information here)

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[//]: # (Thanks for opening this pull request! Before you proceed please make sure that you have an issue that explains what this pull request will do.
2+
Make sure that all your commits link to this issue e.g. "My commit. \(bunq/sdk_csharp#<issue nr>\)".
3+
If this pull request is changing files that are located in "BunqSdk/Model/Generated" then this pull request will be closed as these files must/can only be changed on bunq's side.)
4+
5+
## This PR closes/fixes the following issues:
6+
[//]: # (If for some reason your pull request does not require a test case you can just mark this box as checked and explain why it does not require a test case.)
7+
- Closes bunq/sdk_csharp#
8+
- [ ] Tested

.idea/.idea.BunqSdk/.idea/contentModel.xml

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.zappr.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
autobranch:
2+
pattern: 'bunq/sdk_csharp#{number}-{title}'
3+
length: 100
4+
commit:
5+
message:
6+
patterns:
7+
- '([A-Za-z0-9 ]+)\. (\(bunq\/sdk_csharp#[0-9]+\))'
8+
specification:
9+
title:
10+
minimum-length:
11+
enabled: true
12+
length: 8
13+
body:
14+
minimum-length:
15+
enabled: true
16+
length: 8
17+
contains-url: true
18+
contains-issue-number: true
19+
template:
20+
differs-from-body: true
21+
pull-request:
22+
labels:
23+
additional: true
24+
required:
25+
- Can be merged

BunqSdk.Samples/AttachmentPublicSample.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@ public class AttachmentPublicSample : ISample
1616

1717
public void Run()
1818
{
19-
var apiContext = ApiContext.Restore();
19+
BunqContext.LoadApiContext(ApiContext.Restore());
2020
var customHeaders =
2121
new Dictionary<string, string>
2222
{
2323
{ApiClient.HEADER_CONTENT_TYPE, CONTENT_TYPE_IMAGE_JPEG},
2424
{ApiClient.HEADER_ATTACHMENT_DESCRIPTION, DESCRIPTION_TEST_JPG_ATTACHMENT}
2525
};
2626
var requestBytes = File.ReadAllBytes(PATH_ATTACHMENT_IN);
27-
var uuid = AttachmentPublic.Create(apiContext, requestBytes, customHeaders).Value;
28-
var responseBytes = AttachmentPublicContent.List(apiContext, uuid).Value;
27+
var uuid = AttachmentPublic.Create(requestBytes, customHeaders).Value;
28+
var responseBytes = AttachmentPublicContent.List(uuid).Value;
2929
var fileOut = new FileInfo(PATH_ATTACHMENT_OUT);
3030
fileOut.Directory.Create();
3131
File.WriteAllBytes(fileOut.FullName, responseBytes);

BunqSdk.Samples/CardDebitSample.cs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,23 @@ public class CardDebitSample : ISample
1414
private const string POINTER_TYPE_EMAIL = "EMAIL";
1515
private const string EMAIL_YOUR_COMPANY = "at@at.at"; // Put your user email here
1616
private const string POINTER_NAME_TEST = "test pointer";
17+
private const string CARD_PIN_ASSIGNMENT_TYPE_PRIMARY = "PRIMARY";
1718
private const int USER_ITEM_ID = 0; // Put your user ID here
19+
private const int MONETARY_ACCOUNT_ID = 0; // Put your monetaryAccount ID here
1820

1921
public void Run()
2022
{
21-
var apiContext = ApiContext.Restore();
22-
var requestMap = new Dictionary<string, object>
23-
{
24-
{CardDebit.FIELD_NAME_ON_CARD, NAME_YOUR_COMPANY},
25-
{CardDebit.FIELD_SECOND_LINE, GenerateRandomSecondLine()},
26-
{CardDebit.FIELD_PIN_CODE, PIN_CODE},
27-
{
28-
CardDebit.FIELD_ALIAS,
29-
new Pointer(POINTER_TYPE_EMAIL, EMAIL_YOUR_COMPANY) {Name = POINTER_NAME_TEST}
30-
},
31-
};
23+
BunqContext.LoadApiContext(ApiContext.Restore());
24+
var cardPinAssignment = new CardPinAssignment(
25+
CARD_PIN_ASSIGNMENT_TYPE_PRIMARY,
26+
PIN_CODE,
27+
MONETARY_ACCOUNT_ID
28+
);
29+
var allCardPinAssignments = new List<CardPinAssignment> {cardPinAssignment};
3230

33-
Console.WriteLine(CardDebit.Create(apiContext, requestMap, USER_ITEM_ID));
31+
Console.WriteLine(CardDebit.Create(GenerateRandomSecondLine(), NAME_YOUR_COMPANY,
32+
new Pointer(POINTER_TYPE_EMAIL, EMAIL_YOUR_COMPANY) {Name = POINTER_NAME_TEST},
33+
pinCodeAssignment: allCardPinAssignments));
3434
}
3535

3636
private static string GenerateRandomSecondLine()
@@ -40,4 +40,4 @@ private static string GenerateRandomSecondLine()
4040
return random.Next(0, (int) Math.Pow(10, 21) - 1).ToString();
4141
}
4242
}
43-
}
43+
}

BunqSdk.Samples/CustomerStatementExportSample.cs

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public class CustomerStatementExportSample : ISample
3535

3636
public void Run()
3737
{
38-
var apiContext = ApiContext.Restore();
38+
BunqContext.LoadApiContext(ApiContext.Restore());
3939
var timeSpanWeek = new TimeSpan(
4040
DAYS_IN_WEEK,
4141
TIME_UNIT_COUNT_NONE,
@@ -45,31 +45,18 @@ public void Run()
4545
var dateStart = DateTime.Now.Subtract(timeSpanWeek);
4646
var dateEnd = DateTime.Now;
4747

48-
var customerStatementMap = new Dictionary<string, object>
49-
{
50-
{CustomerStatementExport.FIELD_STATEMENT_FORMAT, STATEMENT_FORMAT},
51-
{CustomerStatementExport.FIELD_DATE_START, dateStart.ToString(FORMAT_DATE_STATEMENT)},
52-
{CustomerStatementExport.FIELD_DATE_END, dateEnd.ToString(FORMAT_DATE_STATEMENT)},
53-
};
48+
var userId = BunqContext.UserContext.UserId;
5449

55-
var userId = User.List(apiContext).Value[INDEX_FIRST].UserCompany.Id;
50+
var userIdInt = userId;
51+
var monetaryAccountId = BunqContext.UserContext.PrimaryMonetaryAccountBank.Id.Value;
5652

57-
if (userId != null)
58-
{
59-
var userIdInt = (int) userId;
60-
var monetaryAccountId = MonetaryAccountBank.List(apiContext, userIdInt).Value[INDEX_FIRST].Id;
53+
var monetaryAccountIdInt = monetaryAccountId;
54+
var customerStatementId = CustomerStatementExport.Create(STATEMENT_FORMAT,
55+
dateStart.ToString(FORMAT_DATE_STATEMENT), dateEnd.ToString(FORMAT_DATE_STATEMENT)).Value;
6156

62-
if (monetaryAccountId != null)
63-
{
64-
var monetaryAccountIdInt = (int) monetaryAccountId;
65-
var customerStatementId = CustomerStatementExport.Create(apiContext, customerStatementMap,
66-
userIdInt, monetaryAccountIdInt).Value;
57+
CustomerStatementExport.Delete(customerStatementId);
6758

68-
CustomerStatementExport.Delete(apiContext, userIdInt, monetaryAccountIdInt, customerStatementId);
69-
}
70-
}
71-
72-
apiContext.Save();
59+
BunqContext.ApiContext.Save();
7360
}
7461
}
75-
}
62+
}

BunqSdk.Samples/MonetaryAccountSample.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,11 @@ namespace Bunq.Sdk.Samples
77
{
88
public class MonetaryAccountSample : ISample
99
{
10-
private const int USER_ITEM_ID = 0; // Put your user ID here
11-
private const int MONETARY_ACCOUNT_ITEM_ID = 0; // Put your monetary account ID here
12-
1310
public void Run()
1411
{
15-
var apiContext = ApiContext.Restore();
16-
var monetaryAccount = MonetaryAccount.Get(apiContext, USER_ITEM_ID, MONETARY_ACCOUNT_ITEM_ID).Value;
17-
Console.WriteLine(monetaryAccount.MonetaryAccountBank);
12+
BunqContext.LoadApiContext(ApiContext.Restore());
13+
var monetaryAccount = BunqContext.UserContext.PrimaryMonetaryAccountBank;
14+
Console.WriteLine(monetaryAccount);
1815
}
1916
}
2017
}

BunqSdk.Samples/PaymentBatchSample.cs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.Collections.Generic;
33
using Bunq.Sdk.Context;
4+
using Bunq.Sdk.Model.Core;
45
using Bunq.Sdk.Model.Generated.Endpoint;
56
using Bunq.Sdk.Model.Generated.Object;
67
using Bunq.Sdk.Samples.Utils;
@@ -14,8 +15,6 @@ public class PaymentBatchSample : ISample
1415
private const string COUNTERPARTY_POINTER_TYPE = "EMAIL";
1516
private const string COUNTERPARTY_EMAIL = "bravo@bunq.com";
1617
private const string PAYMENT_DESCRIPTION = "This is a generated payment batch!";
17-
private const int USER_ITEM_ID = 0; // Put your user ID here
18-
private const int MONETARY_ACCOUNT_ITEM_ID = 0; // Put your monetary account ID here
1918

2019
public void Run()
2120
{
@@ -38,11 +37,18 @@ public void Run()
3837
}
3938
}
4039
};
40+
var allPayment = new List<Payment>();
41+
var payment = new Payment
42+
{
43+
Amount = new Amount(PAYMENT_AMOUNT, PAYMENT_CURRENCY),
44+
CounterpartyAlias =
45+
new MonetaryAccountReference(new Pointer(COUNTERPARTY_POINTER_TYPE, COUNTERPARTY_EMAIL)),
46+
Description = PAYMENT_DESCRIPTION
47+
};
4148

42-
var paymentBatchId = PaymentBatch.Create(apiContext, paymentBatchMap, USER_ITEM_ID,
43-
MONETARY_ACCOUNT_ITEM_ID).Value;
49+
var paymentBatchId = PaymentBatch.Create(allPayment).Value;
4450

45-
Console.WriteLine(PaymentBatch.Get(apiContext, USER_ITEM_ID, MONETARY_ACCOUNT_ITEM_ID, paymentBatchId));
51+
Console.WriteLine(PaymentBatch.Get(paymentBatchId));
4652
}
4753
}
4854
}

BunqSdk.Samples/PaymentListSample.cs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,30 +21,22 @@ public class PaymentListSample : ISample
2121
/// </summary>
2222
private const int PAGE_SIZE = 3;
2323

24-
/// <summary>
25-
/// Constants to be changed to run the example.
26-
/// </summary>
27-
private const int USER_ITEM_ID = 0; // Put your user ID here
28-
private const int MONETARY_ACCOUNT_ITEM_ID = 0; // Put your monetary account ID here
29-
3024
public void Run()
3125
{
32-
var apiContext = ApiContext.Restore();
26+
BunqContext.LoadApiContext(ApiContext.Restore());
3327
var paginationCountOnly = new Pagination
3428
{
3529
Count = PAGE_SIZE,
3630
};
3731
Console.WriteLine(MESSAGE_LATEST_PAGE_IDS);
38-
var paymentResponse = Payment.List(apiContext, USER_ITEM_ID, MONETARY_ACCOUNT_ITEM_ID,
39-
paginationCountOnly.UrlParamsCountOnly);
32+
var paymentResponse = Payment.List(urlParams: paginationCountOnly.UrlParamsCountOnly);
4033
PrintPayments(paymentResponse.Value);
4134
var pagination = paymentResponse.Pagination;
4235

4336
if (pagination.HasPreviousPage())
4437
{
4538
Console.WriteLine(MESSAGE_SECOND_LATEST_PAGE_IDS);
46-
var previousPaymentResponse = Payment.List(apiContext, USER_ITEM_ID, MONETARY_ACCOUNT_ITEM_ID,
47-
pagination.UrlParamsPreviousPage);
39+
var previousPaymentResponse = Payment.List(urlParams: pagination.UrlParamsPreviousPage);
4840
PrintPayments(previousPaymentResponse.Value);
4941
}
5042
else

BunqSdk.Samples/PaymentSample.cs

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,15 @@ public class PaymentSample : ISample
1919

2020
public void Run()
2121
{
22-
var apiContext = ApiContext.Restore();
23-
var paymentMap = new Dictionary<string, object>
24-
{
25-
{Payment.FIELD_AMOUNT, new Amount(PAYMENT_AMOUNT, PAYMENT_CURRENCY)},
26-
{
27-
Payment.FIELD_COUNTERPARTY_ALIAS,
28-
new Pointer(COUNTERPARTY_POINTER_TYPE, COUNTERPARTY_EMAIL)
29-
},
30-
{Payment.FIELD_DESCRIPTION, PAYMENT_DESCRIPTION}
31-
};
22+
BunqContext.LoadApiContext(ApiContext.Restore());
23+
var paymentId = Payment.Create(new Amount(PAYMENT_AMOUNT, PAYMENT_CURRENCY),
24+
new Pointer(COUNTERPARTY_POINTER_TYPE, COUNTERPARTY_EMAIL), PAYMENT_DESCRIPTION).Value;
3225

33-
var paymentId = Payment.Create(apiContext, paymentMap, USER_ITEM_ID, MONETARY_ACCOUNT_ITEM_ID).Value;
26+
Console.WriteLine(Payment.Get(paymentId));
3427

35-
Console.WriteLine(Payment.Get(apiContext, USER_ITEM_ID, MONETARY_ACCOUNT_ITEM_ID, paymentId));
36-
3728
// Save the API context to account for all the changes that might have occurred to it
3829
// during the sample execution
39-
apiContext.Save();
30+
BunqContext.ApiContext.Save();
4031
}
4132
}
42-
}
33+
}

0 commit comments

Comments
 (0)