Skip to content

Commit d50b8b8

Browse files
author
Joao Antao
committed
Rename constants following PascalCase convention. (#58)
1 parent c71114b commit d50b8b8

36 files changed

+469
-470
lines changed

BunqSdk.Samples/ApiContextSaveSample.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ namespace Bunq.Sdk.Samples
55
{
66
public class ApiContextSaveSample : ISample
77
{
8-
private const string API_KEY = "### YOUR API KEY ###"; // Put your API key here
9-
private const string DEVICE_DESCRIPTION = "Device description.";
8+
private const string ApiKey = "### YOUR API KEY ###"; // Put your API key here
9+
private const string DeviceDescription = "Device description.";
1010

1111
public void Run()
1212
{
13-
var apiContext = ApiContext.Create(ApiEnvironmentType.SANDBOX, API_KEY, DEVICE_DESCRIPTION);
13+
var apiContext = ApiContext.Create(ApiEnvironmentType.Sandbox, ApiKey, DeviceDescription);
1414
apiContext.Save();
1515
}
1616
}

BunqSdk.Samples/AttachmentPublicSample.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,24 @@ namespace Bunq.Sdk.Samples
99
{
1010
public class AttachmentPublicSample : ISample
1111
{
12-
private const string CONTENT_TYPE_IMAGE_JPEG = "image/jpeg";
13-
private const string DESCRIPTION_TEST_JPG_ATTACHMENT = "A test JPG attachment.";
14-
private const string PATH_ATTACHMENT_IN = "Assets/Attachment.jpg";
15-
private const string PATH_ATTACHMENT_OUT = "Tmp/AttachmentOut.jpg";
12+
private const string ContentTypeImageJpeg = "image/jpeg";
13+
private const string DescriptionTestJpgAttachment = "A test JPG attachment.";
14+
private const string PathAttachmentIn = "Assets/Attachment.jpg";
15+
private const string PathAttachmentOut = "Tmp/AttachmentOut.jpg";
1616

1717
public void Run()
1818
{
1919
var apiContext = ApiContext.Restore();
2020
var customHeaders =
2121
new Dictionary<string, string>
2222
{
23-
{ApiClient.HEADER_CONTENT_TYPE, CONTENT_TYPE_IMAGE_JPEG},
24-
{ApiClient.HEADER_ATTACHMENT_DESCRIPTION, DESCRIPTION_TEST_JPG_ATTACHMENT}
23+
{ApiClient.HeaderContentType, ContentTypeImageJpeg},
24+
{ApiClient.HeaderAttachmentDescription, DescriptionTestJpgAttachment}
2525
};
26-
var requestBytes = File.ReadAllBytes(PATH_ATTACHMENT_IN);
26+
var requestBytes = File.ReadAllBytes(PathAttachmentIn);
2727
var uuid = AttachmentPublic.Create(apiContext, requestBytes, customHeaders).Value;
2828
var responseBytes = AttachmentPublicContent.List(apiContext, uuid).Value;
29-
var fileOut = new FileInfo(PATH_ATTACHMENT_OUT);
29+
var fileOut = new FileInfo(PathAttachmentOut);
3030
fileOut.Directory.Create();
3131
File.WriteAllBytes(fileOut.FullName, responseBytes);
3232
}

BunqSdk.Samples/CardDebitSample.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,28 @@ namespace Bunq.Sdk.Samples
99
{
1010
public class CardDebitSample : ISample
1111
{
12-
private const string NAME_YOUR_COMPANY = "USER_COMPANY_NAME"; // Put your user name here
13-
private const string PIN_CODE = "0461";
14-
private const string POINTER_TYPE_EMAIL = "EMAIL";
15-
private const string EMAIL_YOUR_COMPANY = "at@at.at"; // Put your user email here
16-
private const string POINTER_NAME_TEST = "test pointer";
17-
private const int USER_ITEM_ID = 0; // Put your user ID here
12+
private const string NameYourCompany = "USER_COMPANY_NAME"; // Put your user name here
13+
private const string PinCode = "0461";
14+
private const string PointerTypeEmail = "EMAIL";
15+
private const string EmailYourCompany = "at@at.at"; // Put your user email here
16+
private const string PointerNameTest = "test pointer";
17+
private const int UserItemId = 0; // Put your user ID here
1818

1919
public void Run()
2020
{
2121
var apiContext = ApiContext.Restore();
2222
var requestMap = new Dictionary<string, object>
2323
{
24-
{CardDebit.FIELD_NAME_ON_CARD, NAME_YOUR_COMPANY},
24+
{CardDebit.FIELD_NAME_ON_CARD, NameYourCompany},
2525
{CardDebit.FIELD_SECOND_LINE, GenerateRandomSecondLine()},
26-
{CardDebit.FIELD_PIN_CODE, PIN_CODE},
26+
{CardDebit.FIELD_PIN_CODE, PinCode},
2727
{
2828
CardDebit.FIELD_ALIAS,
29-
new Pointer(POINTER_TYPE_EMAIL, EMAIL_YOUR_COMPANY) {Name = POINTER_NAME_TEST}
29+
new Pointer(PointerTypeEmail, EmailYourCompany) {Name = PointerNameTest}
3030
},
3131
};
3232

33-
Console.WriteLine(CardDebit.Create(apiContext, requestMap, USER_ITEM_ID));
33+
Console.WriteLine(CardDebit.Create(apiContext, requestMap, UserItemId));
3434
}
3535

3636
private static string GenerateRandomSecondLine()

BunqSdk.Samples/CustomerStatementExportSample.cs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,53 +11,53 @@ public class CustomerStatementExportSample : ISample
1111
/// <summary>
1212
/// Constant to translate weeks to milliseconds.
1313
/// </summary>
14-
private const int INDEX_FIRST = 0;
14+
private const int IndexFirst = 0;
1515

1616
/// <summary>
1717
/// Date format for Customer Statement Export endpoint.
1818
/// </summary>
19-
private const string FORMAT_DATE_STATEMENT = "yyyy-MM-dd";
19+
private const string FormatDateStatement = "yyyy-MM-dd";
2020

2121
/// <summary>
2222
/// Format of the statement file requested.
2323
/// </summary>
24-
private const string STATEMENT_FORMAT = "PDF";
24+
private const string StatementFormat = "PDF";
2525

2626
/// <summary>
2727
/// Measure of any time unit when none of it is needed.
2828
/// </summary>
29-
private const int TIME_UNIT_COUNT_NONE = 0;
29+
private const int TimeUnitCountNone = 0;
3030

3131
/// <summary>
3232
/// Measure of any time unit when none of it is needed.
3333
/// </summary>
34-
private const int DAYS_IN_WEEK = 7;
34+
private const int DaysInWeek = 7;
3535

3636
public void Run()
3737
{
3838
var apiContext = ApiContext.Restore();
3939
var timeSpanWeek = new TimeSpan(
40-
DAYS_IN_WEEK,
41-
TIME_UNIT_COUNT_NONE,
42-
TIME_UNIT_COUNT_NONE,
43-
TIME_UNIT_COUNT_NONE
40+
DaysInWeek,
41+
TimeUnitCountNone,
42+
TimeUnitCountNone,
43+
TimeUnitCountNone
4444
);
4545
var dateStart = DateTime.Now.Subtract(timeSpanWeek);
4646
var dateEnd = DateTime.Now;
4747

4848
var customerStatementMap = new Dictionary<string, object>
4949
{
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)},
50+
{CustomerStatementExport.FIELD_STATEMENT_FORMAT, StatementFormat},
51+
{CustomerStatementExport.FIELD_DATE_START, dateStart.ToString(FormatDateStatement)},
52+
{CustomerStatementExport.FIELD_DATE_END, dateEnd.ToString(FormatDateStatement)},
5353
};
5454

55-
var userId = User.List(apiContext).Value[INDEX_FIRST].UserCompany.Id;
55+
var userId = User.List(apiContext).Value[IndexFirst].UserCompany.Id;
5656

5757
if (userId != null)
5858
{
5959
var userIdInt = (int) userId;
60-
var monetaryAccountId = MonetaryAccountBank.List(apiContext, userIdInt).Value[INDEX_FIRST].Id;
60+
var monetaryAccountId = MonetaryAccountBank.List(apiContext, userIdInt).Value[IndexFirst].Id;
6161

6262
if (monetaryAccountId != null)
6363
{

BunqSdk.Samples/MonetaryAccountSample.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ 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
10+
private const int UserItemId = 0; // Put your user ID here
11+
private const int MonetaryAccountItemId = 0; // Put your monetary account ID here
1212

1313
public void Run()
1414
{
1515
var apiContext = ApiContext.Restore();
16-
var monetaryAccount = MonetaryAccount.Get(apiContext, USER_ITEM_ID, MONETARY_ACCOUNT_ITEM_ID).Value;
16+
var monetaryAccount = MonetaryAccount.Get(apiContext, UserItemId, MonetaryAccountItemId).Value;
1717
Console.WriteLine(monetaryAccount.MonetaryAccountBank);
1818
}
1919
}

BunqSdk.Samples/PaymentBatchSample.cs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ namespace Bunq.Sdk.Samples
99
{
1010
public class PaymentBatchSample : ISample
1111
{
12-
private const string PAYMENT_AMOUNT = "0.01";
13-
private const string PAYMENT_CURRENCY = "EUR";
14-
private const string COUNTERPARTY_POINTER_TYPE = "EMAIL";
15-
private const string COUNTERPARTY_EMAIL = "bravo@bunq.com";
16-
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
12+
private const string PaymentAmount = "0.01";
13+
private const string PaymentCurrency = "EUR";
14+
private const string CounterpartyPointerType = "EMAIL";
15+
private const string CounterpartyEmail = "bravo@bunq.com";
16+
private const string PaymentDescription = "This is a generated payment batch!";
17+
private const int UserItemId = 0; // Put your user ID here
18+
private const int MonetaryAccountItemId = 0; // Put your monetary account ID here
1919

2020
public void Run()
2121
{
@@ -28,21 +28,21 @@ public void Run()
2828
{
2929
new Dictionary<string, object>
3030
{
31-
{Payment.FIELD_AMOUNT, new Amount(PAYMENT_AMOUNT, PAYMENT_CURRENCY)},
31+
{Payment.FIELD_AMOUNT, new Amount(PaymentAmount, PaymentCurrency)},
3232
{
3333
Payment.FIELD_COUNTERPARTY_ALIAS,
34-
new Pointer(COUNTERPARTY_POINTER_TYPE, COUNTERPARTY_EMAIL)
34+
new Pointer(CounterpartyPointerType, CounterpartyEmail)
3535
},
36-
{Payment.FIELD_DESCRIPTION, PAYMENT_DESCRIPTION}
36+
{Payment.FIELD_DESCRIPTION, PaymentDescription}
3737
}
3838
}
3939
}
4040
};
4141

42-
var paymentBatchId = PaymentBatch.Create(apiContext, paymentBatchMap, USER_ITEM_ID,
43-
MONETARY_ACCOUNT_ITEM_ID).Value;
42+
var paymentBatchId = PaymentBatch.Create(apiContext, paymentBatchMap, UserItemId,
43+
MonetaryAccountItemId).Value;
4444

45-
Console.WriteLine(PaymentBatch.Get(apiContext, USER_ITEM_ID, MONETARY_ACCOUNT_ITEM_ID, paymentBatchId));
45+
Console.WriteLine(PaymentBatch.Get(apiContext, UserItemId, MonetaryAccountItemId, paymentBatchId));
4646
}
4747
}
4848
}

BunqSdk.Samples/PaymentListSample.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,44 +12,44 @@ public class PaymentListSample : ISample
1212
/// <summary>
1313
/// Message constants.
1414
/// </summary>
15-
private const string MESSAGE_LATEST_PAGE_IDS = "Latest page IDs: ";
16-
private const string MESSAGE_SECOND_LATEST_PAGE_IDS = "Second latest page IDs: ";
17-
private const string MESSAGE_NO_PRIOR_PAYMENTS_FOUND = "No prior payments found!";
15+
private const string MessageLatestPageIds = "Latest page IDs: ";
16+
private const string MessageSecondLatestPageIds = "Second latest page IDs: ";
17+
private const string MessageNoPriorPaymentsFound = "No prior payments found!";
1818

1919
/// <summary>
2020
/// Size of each page of payment listing.
2121
/// </summary>
22-
private const int PAGE_SIZE = 3;
22+
private const int PageSize = 3;
2323

2424
/// <summary>
2525
/// Constants to be changed to run the example.
2626
/// </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
27+
private const int UserItemId = 0; // Put your user ID here
28+
private const int MonetaryAccountItemId = 0; // Put your monetary account ID here
2929

3030
public void Run()
3131
{
3232
var apiContext = ApiContext.Restore();
3333
var paginationCountOnly = new Pagination
3434
{
35-
Count = PAGE_SIZE,
35+
Count = PageSize,
3636
};
37-
Console.WriteLine(MESSAGE_LATEST_PAGE_IDS);
38-
var paymentResponse = Payment.List(apiContext, USER_ITEM_ID, MONETARY_ACCOUNT_ITEM_ID,
37+
Console.WriteLine(MessageLatestPageIds);
38+
var paymentResponse = Payment.List(apiContext, UserItemId, MonetaryAccountItemId,
3939
paginationCountOnly.UrlParamsCountOnly);
4040
PrintPayments(paymentResponse.Value);
4141
var pagination = paymentResponse.Pagination;
4242

4343
if (pagination.HasPreviousPage())
4444
{
45-
Console.WriteLine(MESSAGE_SECOND_LATEST_PAGE_IDS);
46-
var previousPaymentResponse = Payment.List(apiContext, USER_ITEM_ID, MONETARY_ACCOUNT_ITEM_ID,
45+
Console.WriteLine(MessageSecondLatestPageIds);
46+
var previousPaymentResponse = Payment.List(apiContext, UserItemId, MonetaryAccountItemId,
4747
pagination.UrlParamsPreviousPage);
4848
PrintPayments(previousPaymentResponse.Value);
4949
}
5050
else
5151
{
52-
Console.WriteLine(MESSAGE_NO_PRIOR_PAYMENTS_FOUND);
52+
Console.WriteLine(MessageNoPriorPaymentsFound);
5353
}
5454
}
5555

BunqSdk.Samples/PaymentSample.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,30 +9,30 @@ namespace Bunq.Sdk.Samples
99
{
1010
public class PaymentSample : ISample
1111
{
12-
private const int USER_ITEM_ID = 0; // Put your user ID here
13-
private const int MONETARY_ACCOUNT_ITEM_ID = 0; // Put your monetary account ID here
14-
private const string PAYMENT_AMOUNT = "0.01";
15-
private const string PAYMENT_CURRENCY = "EUR";
16-
private const string COUNTERPARTY_POINTER_TYPE = "EMAIL";
17-
private const string COUNTERPARTY_EMAIL = "bravo@bunq.com";
18-
private const string PAYMENT_DESCRIPTION = "This is a generated payment!";
12+
private const int UserItemId = 0; // Put your user ID here
13+
private const int MonetaryAccountItemId = 0; // Put your monetary account ID here
14+
private const string PaymentAmount = "0.01";
15+
private const string PaymentCurrency = "EUR";
16+
private const string CounterpartyPointerType = "EMAIL";
17+
private const string CounterpartyEmail = "bravo@bunq.com";
18+
private const string PaymentDescription = "This is a generated payment!";
1919

2020
public void Run()
2121
{
2222
var apiContext = ApiContext.Restore();
2323
var paymentMap = new Dictionary<string, object>
2424
{
25-
{Payment.FIELD_AMOUNT, new Amount(PAYMENT_AMOUNT, PAYMENT_CURRENCY)},
25+
{Payment.FIELD_AMOUNT, new Amount(PaymentAmount, PaymentCurrency)},
2626
{
2727
Payment.FIELD_COUNTERPARTY_ALIAS,
28-
new Pointer(COUNTERPARTY_POINTER_TYPE, COUNTERPARTY_EMAIL)
28+
new Pointer(CounterpartyPointerType, CounterpartyEmail)
2929
},
30-
{Payment.FIELD_DESCRIPTION, PAYMENT_DESCRIPTION}
30+
{Payment.FIELD_DESCRIPTION, PaymentDescription}
3131
};
3232

33-
var paymentId = Payment.Create(apiContext, paymentMap, USER_ITEM_ID, MONETARY_ACCOUNT_ITEM_ID).Value;
33+
var paymentId = Payment.Create(apiContext, paymentMap, UserItemId, MonetaryAccountItemId).Value;
3434

35-
Console.WriteLine(Payment.Get(apiContext, USER_ITEM_ID, MONETARY_ACCOUNT_ITEM_ID, paymentId));
35+
Console.WriteLine(Payment.Get(apiContext, UserItemId, MonetaryAccountItemId, paymentId));
3636

3737
// Save the API context to account for all the changes that might have occurred to it
3838
// during the sample execution

BunqSdk.Samples/RequestSample.cs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,31 +9,31 @@ namespace Bunq.Sdk.Samples
99
{
1010
public class RequestSample : ISample
1111
{
12-
private const string REQUEST_AMOUNT = "12.30";
13-
private const string REQUEST_CURRENCY = "EUR";
14-
private const string COUNTERPARTY_POINTER_TYPE = "EMAIL";
15-
private const string COUNTERPARTY_EMAIL = "bravo@bunq.com";
16-
private const string REQUEST_DESCRIPTION = "This is a generated request!";
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
19-
private const string STATUS_REVOKED = "REVOKED";
12+
private const string RequestAmount = "12.30";
13+
private const string RequestCurrency = "EUR";
14+
private const string CounterpartyPointerType = "EMAIL";
15+
private const string CounterpartyEmail = "bravo@bunq.com";
16+
private const string RequestDescription = "This is a generated request!";
17+
private const int UserItemId = 0; // Put your user ID here
18+
private const int MonetaryAccountItemId = 0; // Put your monetary account ID here
19+
private const string StatusRevoked = "REVOKED";
2020

2121
public void Run()
2222
{
2323
var apiContext = ApiContext.Restore();
2424
var requestMap = new Dictionary<string, object>
2525
{
26-
{RequestInquiry.FIELD_AMOUNT_INQUIRED, new Amount(REQUEST_AMOUNT, REQUEST_CURRENCY)},
27-
{RequestInquiry.FIELD_COUNTERPARTY_ALIAS, new Pointer(COUNTERPARTY_POINTER_TYPE, COUNTERPARTY_EMAIL)},
28-
{RequestInquiry.FIELD_DESCRIPTION, REQUEST_DESCRIPTION},
26+
{RequestInquiry.FIELD_AMOUNT_INQUIRED, new Amount(RequestAmount, RequestCurrency)},
27+
{RequestInquiry.FIELD_COUNTERPARTY_ALIAS, new Pointer(CounterpartyPointerType, CounterpartyEmail)},
28+
{RequestInquiry.FIELD_DESCRIPTION, RequestDescription},
2929
{RequestInquiry.FIELD_ALLOW_BUNQME, true}
3030
};
31-
var requestId = RequestInquiry.Create(apiContext, requestMap, USER_ITEM_ID, MONETARY_ACCOUNT_ITEM_ID).Value;
32-
Console.WriteLine(RequestInquiry.Get(apiContext, USER_ITEM_ID, MONETARY_ACCOUNT_ITEM_ID, requestId));
31+
var requestId = RequestInquiry.Create(apiContext, requestMap, UserItemId, MonetaryAccountItemId).Value;
32+
Console.WriteLine(RequestInquiry.Get(apiContext, UserItemId, MonetaryAccountItemId, requestId));
3333

34-
var requestUpdateMap = new Dictionary<string, object> {{RequestInquiry.FIELD_STATUS, STATUS_REVOKED}};
35-
var requestUpdated = RequestInquiry.Update(apiContext, requestUpdateMap, USER_ITEM_ID,
36-
MONETARY_ACCOUNT_ITEM_ID, requestId);
34+
var requestUpdateMap = new Dictionary<string, object> {{RequestInquiry.FIELD_STATUS, StatusRevoked}};
35+
var requestUpdated = RequestInquiry.Update(apiContext, requestUpdateMap, UserItemId,
36+
MonetaryAccountItemId, requestId);
3737
Console.WriteLine(requestUpdated);
3838
}
3939
}

0 commit comments

Comments
 (0)