Skip to content
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

Constants following PascalCase convention #71

Open
wants to merge 21 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
d50b8b8
Rename constants following PascalCase convention. (bunq/sdk_csharp#58)
Dec 27, 2017
46214e0
Add curly braces around the nested statement in this if block. (bunq/…
Dec 27, 2017
8fd7136
Add information to test readme file on how to run tests in VS IDE. (b…
Dec 27, 2017
3fbb0e1
Update gitignore file. (bunq/sdk_csharp#58)
Dec 27, 2017
9b16490
Remove underscore prefix from private variables. (bunq/sdk_csharp#58)
Dec 27, 2017
17d446c
Rename constants following PascalCase convention. (bunq/sdk_csharp#58)
Dec 27, 2017
f405de3
Rename constants following group identifier and PascalCase convention…
Dec 28, 2017
4a90c80
Rename constants consistently. (bunq/sdk_csharp#58)
Dec 28, 2017
c43eb8c
Pink Floyds TDSOTM is 42 minutes lenght and expensive Java teas. (bun…
Dec 28, 2017
d53ea29
Rename constants consistently. (bunq/sdk_csharp#58)
Dec 28, 2017
d453229
Add information to test readme file on how to run tests in VS Code ID…
Dec 28, 2017
2da16bf
Remove redundant string array. (bunq/sdk_csharp#58)
Dec 28, 2017
d66b682
Reordered constants to their group. (bunq/sdk_csharp#58)
OGKevin Dec 28, 2017
2279dc8
Added missing constant pre and suffixes. (bunq/sdk_csharp#58)
OGKevin Dec 28, 2017
5f8e799
Reordered constant to their separate group. (bunq/sdk_csharp#58)
OGKevin Dec 28, 2017
c153018
Added missing summaries. (bunq/sdk_csharp#58)
OGKevin Dec 28, 2017
1aa819d
Moved property with accessors below the ones without. (bunq/sdk_cshar…
OGKevin Dec 28, 2017
9962a6d
Removed plural. (bunq/sdk_csharp#58)
OGKevin Dec 28, 2017
f10e0d3
Changed method scope to private. (bunq/sdk_csharp#58)
OGKevin Dec 28, 2017
50a81c3
Removed plural from example test configuration josn. (bunq/sdk_csharp…
OGKevin Dec 28, 2017
4240c77
Add information to test readme file on how to run tests in cmd line. …
Dec 29, 2017
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ local.properties
x64/
build/
[Oo]bj/
/.vs

# MSTest test Results
[Tt]est[Rr]esult*/
Expand Down
6 changes: 3 additions & 3 deletions BunqSdk.Samples/ApiContextSaveSample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ namespace Bunq.Sdk.Samples
{
public class ApiContextSaveSample : ISample
{
private const string API_KEY = "### YOUR API KEY ###"; // Put your API key here
private const string DEVICE_DESCRIPTION = "Device description.";
private const string ApiKey = "### YOUR API KEY ###"; // Put your API key here
private const string DeviceDescription = "Device description.";

public void Run()
{
var apiContext = ApiContext.Create(ApiEnvironmentType.SANDBOX, API_KEY, DEVICE_DESCRIPTION);
var apiContext = ApiContext.Create(ApiEnvironmentType.Sandbox, ApiKey, DeviceDescription);
apiContext.Save();
}
}
Expand Down
16 changes: 8 additions & 8 deletions BunqSdk.Samples/AttachmentPublicSample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,24 @@ namespace Bunq.Sdk.Samples
{
public class AttachmentPublicSample : ISample
{
private const string CONTENT_TYPE_IMAGE_JPEG = "image/jpeg";
private const string DESCRIPTION_TEST_JPG_ATTACHMENT = "A test JPG attachment.";
private const string PATH_ATTACHMENT_IN = "Assets/Attachment.jpg";
private const string PATH_ATTACHMENT_OUT = "Tmp/AttachmentOut.jpg";
private const string ContentTypeImageJpeg = "image/jpeg";
private const string DescriptionTestJpgAttachment = "A test JPG attachment.";
private const string PathAttachmentIn = "Assets/Attachment.jpg";
private const string PathAttachmentOut = "Tmp/AttachmentOut.jpg";

public void Run()
{
var apiContext = ApiContext.Restore();
var customHeaders =
new Dictionary<string, string>
{
{ApiClient.HEADER_CONTENT_TYPE, CONTENT_TYPE_IMAGE_JPEG},
{ApiClient.HEADER_ATTACHMENT_DESCRIPTION, DESCRIPTION_TEST_JPG_ATTACHMENT}
{ApiClient.HeaderContentType, ContentTypeImageJpeg},
{ApiClient.HeaderAttachmentDescription, DescriptionTestJpgAttachment}
};
var requestBytes = File.ReadAllBytes(PATH_ATTACHMENT_IN);
var requestBytes = File.ReadAllBytes(PathAttachmentIn);
var uuid = AttachmentPublic.Create(apiContext, requestBytes, customHeaders).Value;
var responseBytes = AttachmentPublicContent.List(apiContext, uuid).Value;
var fileOut = new FileInfo(PATH_ATTACHMENT_OUT);
var fileOut = new FileInfo(PathAttachmentOut);
fileOut.Directory.Create();
File.WriteAllBytes(fileOut.FullName, responseBytes);
}
Expand Down
20 changes: 10 additions & 10 deletions BunqSdk.Samples/CardDebitSample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,28 @@ namespace Bunq.Sdk.Samples
{
public class CardDebitSample : ISample
{
private const string NAME_YOUR_COMPANY = "USER_COMPANY_NAME"; // Put your user name here
private const string PIN_CODE = "0461";
private const string POINTER_TYPE_EMAIL = "EMAIL";
private const string EMAIL_YOUR_COMPANY = "at@at.at"; // Put your user email here
private const string POINTER_NAME_TEST = "test pointer";
private const int USER_ITEM_ID = 0; // Put your user ID here
private const string NameYourCompany = "USER_COMPANY_NAME"; // Put your user name here
private const string PinCode = "0461";
private const string PointerTypeEmail = "EMAIL";
private const string EmailYourCompany = "at@at.at"; // Put your user email here
private const string PointerNameTest = "test pointer";
private const int UserItemId = 0; // Put your user ID here

public void Run()
{
var apiContext = ApiContext.Restore();
var requestMap = new Dictionary<string, object>
{
{CardDebit.FIELD_NAME_ON_CARD, NAME_YOUR_COMPANY},
{CardDebit.FIELD_NAME_ON_CARD, NameYourCompany},
{CardDebit.FIELD_SECOND_LINE, GenerateRandomSecondLine()},
{CardDebit.FIELD_PIN_CODE, PIN_CODE},
{CardDebit.FIELD_PIN_CODE, PinCode},
{
CardDebit.FIELD_ALIAS,
new Pointer(POINTER_TYPE_EMAIL, EMAIL_YOUR_COMPANY) {Name = POINTER_NAME_TEST}
new Pointer(PointerTypeEmail, EmailYourCompany) {Name = PointerNameTest}
},
};

Console.WriteLine(CardDebit.Create(apiContext, requestMap, USER_ITEM_ID));
Console.WriteLine(CardDebit.Create(apiContext, requestMap, UserItemId));
}

private static string GenerateRandomSecondLine()
Expand Down
28 changes: 14 additions & 14 deletions BunqSdk.Samples/CustomerStatementExportSample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,53 +11,53 @@ public class CustomerStatementExportSample : ISample
/// <summary>
/// Constant to translate weeks to milliseconds.
/// </summary>
private const int INDEX_FIRST = 0;
private const int IndexFirst = 0;

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

/// <summary>
/// Format of the statement file requested.
/// </summary>
private const string STATEMENT_FORMAT = "PDF";
private const string StatementFormat = "PDF";

/// <summary>
/// Measure of any time unit when none of it is needed.
/// </summary>
private const int TIME_UNIT_COUNT_NONE = 0;
private const int TimeUnitCountNone = 0;

/// <summary>
/// Measure of any time unit when none of it is needed.
/// </summary>
private const int DAYS_IN_WEEK = 7;
private const int DaysInWeek = 7;

public void Run()
{
var apiContext = ApiContext.Restore();
var timeSpanWeek = new TimeSpan(
DAYS_IN_WEEK,
TIME_UNIT_COUNT_NONE,
TIME_UNIT_COUNT_NONE,
TIME_UNIT_COUNT_NONE
DaysInWeek,
TimeUnitCountNone,
TimeUnitCountNone,
TimeUnitCountNone
);
var dateStart = DateTime.Now.Subtract(timeSpanWeek);
var dateEnd = DateTime.Now;

var customerStatementMap = new Dictionary<string, object>
{
{CustomerStatementExport.FIELD_STATEMENT_FORMAT, STATEMENT_FORMAT},
{CustomerStatementExport.FIELD_DATE_START, dateStart.ToString(FORMAT_DATE_STATEMENT)},
{CustomerStatementExport.FIELD_DATE_END, dateEnd.ToString(FORMAT_DATE_STATEMENT)},
{CustomerStatementExport.FIELD_STATEMENT_FORMAT, StatementFormat},
{CustomerStatementExport.FIELD_DATE_START, dateStart.ToString(FormatDateStatement)},
{CustomerStatementExport.FIELD_DATE_END, dateEnd.ToString(FormatDateStatement)},
};

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

if (userId != null)
{
var userIdInt = (int) userId;
var monetaryAccountId = MonetaryAccountBank.List(apiContext, userIdInt).Value[INDEX_FIRST].Id;
var monetaryAccountId = MonetaryAccountBank.List(apiContext, userIdInt).Value[IndexFirst].Id;

if (monetaryAccountId != null)
{
Expand Down
6 changes: 3 additions & 3 deletions BunqSdk.Samples/MonetaryAccountSample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ namespace Bunq.Sdk.Samples
{
public class MonetaryAccountSample : ISample
{
private const int USER_ITEM_ID = 0; // Put your user ID here
private const int MONETARY_ACCOUNT_ITEM_ID = 0; // Put your monetary account ID here
private const int UserItemId = 0; // Put your user ID here
private const int MonetaryAccountItemId = 0; // Put your monetary account ID here

public void Run()
{
var apiContext = ApiContext.Restore();
var monetaryAccount = MonetaryAccount.Get(apiContext, USER_ITEM_ID, MONETARY_ACCOUNT_ITEM_ID).Value;
var monetaryAccount = MonetaryAccount.Get(apiContext, UserItemId, MonetaryAccountItemId).Value;
Console.WriteLine(monetaryAccount.MonetaryAccountBank);
}
}
Expand Down
26 changes: 13 additions & 13 deletions BunqSdk.Samples/PaymentBatchSample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ namespace Bunq.Sdk.Samples
{
public class PaymentBatchSample : ISample
{
private const string PAYMENT_AMOUNT = "0.01";
private const string PAYMENT_CURRENCY = "EUR";
private const string COUNTERPARTY_POINTER_TYPE = "EMAIL";
private const string COUNTERPARTY_EMAIL = "bravo@bunq.com";
private const string PAYMENT_DESCRIPTION = "This is a generated payment batch!";
private const int USER_ITEM_ID = 0; // Put your user ID here
private const int MONETARY_ACCOUNT_ITEM_ID = 0; // Put your monetary account ID here
private const string PaymentAmount = "0.01";
private const string PaymentCurrency = "EUR";
private const string CounterpartyPointerType = "EMAIL";
private const string CounterpartyEmail = "bravo@bunq.com";
private const string PaymentDescription = "This is a generated payment batch!";
private const int UserItemId = 0; // Put your user ID here
private const int MonetaryAccountItemId = 0; // Put your monetary account ID here

public void Run()
{
Expand All @@ -28,21 +28,21 @@ public void Run()
{
new Dictionary<string, object>
{
{Payment.FIELD_AMOUNT, new Amount(PAYMENT_AMOUNT, PAYMENT_CURRENCY)},
{Payment.FIELD_AMOUNT, new Amount(PaymentAmount, PaymentCurrency)},
{
Payment.FIELD_COUNTERPARTY_ALIAS,
new Pointer(COUNTERPARTY_POINTER_TYPE, COUNTERPARTY_EMAIL)
new Pointer(CounterpartyPointerType, CounterpartyEmail)
},
{Payment.FIELD_DESCRIPTION, PAYMENT_DESCRIPTION}
{Payment.FIELD_DESCRIPTION, PaymentDescription}
}
}
}
};

var paymentBatchId = PaymentBatch.Create(apiContext, paymentBatchMap, USER_ITEM_ID,
MONETARY_ACCOUNT_ITEM_ID).Value;
var paymentBatchId = PaymentBatch.Create(apiContext, paymentBatchMap, UserItemId,
MonetaryAccountItemId).Value;

Console.WriteLine(PaymentBatch.Get(apiContext, USER_ITEM_ID, MONETARY_ACCOUNT_ITEM_ID, paymentBatchId));
Console.WriteLine(PaymentBatch.Get(apiContext, UserItemId, MonetaryAccountItemId, paymentBatchId));
}
}
}
24 changes: 12 additions & 12 deletions BunqSdk.Samples/PaymentListSample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,44 +12,44 @@ public class PaymentListSample : ISample
/// <summary>
/// Message constants.
/// </summary>
private const string MESSAGE_LATEST_PAGE_IDS = "Latest page IDs: ";
private const string MESSAGE_SECOND_LATEST_PAGE_IDS = "Second latest page IDs: ";
private const string MESSAGE_NO_PRIOR_PAYMENTS_FOUND = "No prior payments found!";
private const string MessageLatestPageIds = "Latest page IDs: ";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Plural -> MessageLatestPageAllPaymentId

private const string MessageSecondLatestPageIds = "Second latest page IDs: ";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Plural -> MessageSecondLatestPageAllPaymentId

private const string MessageNoPriorPaymentsFound = "No prior payments found!";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Plural -> MessageNoPriorPaymentFound


/// <summary>
/// Size of each page of payment listing.
/// </summary>
private const int PAGE_SIZE = 3;
private const int PageSize = 3;

/// <summary>
/// Constants to be changed to run the example.
/// </summary>
private const int USER_ITEM_ID = 0; // Put your user ID here
private const int MONETARY_ACCOUNT_ITEM_ID = 0; // Put your monetary account ID here
private const int UserItemId = 0; // Put your user ID here
private const int MonetaryAccountItemId = 0; // Put your monetary account ID here

public void Run()
{
var apiContext = ApiContext.Restore();
var paginationCountOnly = new Pagination
{
Count = PAGE_SIZE,
Count = PageSize,
};
Console.WriteLine(MESSAGE_LATEST_PAGE_IDS);
var paymentResponse = Payment.List(apiContext, USER_ITEM_ID, MONETARY_ACCOUNT_ITEM_ID,
Console.WriteLine(MessageLatestPageIds);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MessageLatestPageAllPaymentId

var paymentResponse = Payment.List(apiContext, UserItemId, MonetaryAccountItemId,
paginationCountOnly.UrlParamsCountOnly);
PrintPayments(paymentResponse.Value);
var pagination = paymentResponse.Pagination;

if (pagination.HasPreviousPage())
{
Console.WriteLine(MESSAGE_SECOND_LATEST_PAGE_IDS);
var previousPaymentResponse = Payment.List(apiContext, USER_ITEM_ID, MONETARY_ACCOUNT_ITEM_ID,
Console.WriteLine(MessageSecondLatestPageIds);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename (check for other occurrences too of renamed constants)

var previousPaymentResponse = Payment.List(apiContext, UserItemId, MonetaryAccountItemId,
pagination.UrlParamsPreviousPage);
PrintPayments(previousPaymentResponse.Value);
}
else
{
Console.WriteLine(MESSAGE_NO_PRIOR_PAYMENTS_FOUND);
Console.WriteLine(MessageNoPriorPaymentsFound);
}
}

Expand Down
24 changes: 12 additions & 12 deletions BunqSdk.Samples/PaymentSample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,30 @@ namespace Bunq.Sdk.Samples
{
public class PaymentSample : ISample
{
private const int USER_ITEM_ID = 0; // Put your user ID here
private const int MONETARY_ACCOUNT_ITEM_ID = 0; // Put your monetary account ID here
private const string PAYMENT_AMOUNT = "0.01";
private const string PAYMENT_CURRENCY = "EUR";
private const string COUNTERPARTY_POINTER_TYPE = "EMAIL";
private const string COUNTERPARTY_EMAIL = "bravo@bunq.com";
private const string PAYMENT_DESCRIPTION = "This is a generated payment!";
private const int UserItemId = 0; // Put your user ID here
private const int MonetaryAccountItemId = 0; // Put your monetary account ID here
private const string PaymentAmount = "0.01";
private const string PaymentCurrency = "EUR";
private const string CounterpartyPointerType = "EMAIL";
private const string CounterpartyEmail = "bravo@bunq.com";
private const string PaymentDescription = "This is a generated payment!";

public void Run()
{
var apiContext = ApiContext.Restore();
var paymentMap = new Dictionary<string, object>
{
{Payment.FIELD_AMOUNT, new Amount(PAYMENT_AMOUNT, PAYMENT_CURRENCY)},
{Payment.FIELD_AMOUNT, new Amount(PaymentAmount, PaymentCurrency)},
{
Payment.FIELD_COUNTERPARTY_ALIAS,
new Pointer(COUNTERPARTY_POINTER_TYPE, COUNTERPARTY_EMAIL)
new Pointer(CounterpartyPointerType, CounterpartyEmail)
},
{Payment.FIELD_DESCRIPTION, PAYMENT_DESCRIPTION}
{Payment.FIELD_DESCRIPTION, PaymentDescription}
};

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

Console.WriteLine(Payment.Get(apiContext, USER_ITEM_ID, MONETARY_ACCOUNT_ITEM_ID, paymentId));
Console.WriteLine(Payment.Get(apiContext, UserItemId, MonetaryAccountItemId, paymentId));

// Save the API context to account for all the changes that might have occurred to it
// during the sample execution
Expand Down
32 changes: 16 additions & 16 deletions BunqSdk.Samples/RequestSample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,31 @@ namespace Bunq.Sdk.Samples
{
public class RequestSample : ISample
{
private const string REQUEST_AMOUNT = "12.30";
private const string REQUEST_CURRENCY = "EUR";
private const string COUNTERPARTY_POINTER_TYPE = "EMAIL";
private const string COUNTERPARTY_EMAIL = "bravo@bunq.com";
private const string REQUEST_DESCRIPTION = "This is a generated request!";
private const int USER_ITEM_ID = 0; // Put your user ID here
private const int MONETARY_ACCOUNT_ITEM_ID = 0; // Put your monetary account ID here
private const string STATUS_REVOKED = "REVOKED";
private const string RequestAmount = "12.30";
private const string RequestCurrency = "EUR";
private const string CounterpartyPointerType = "EMAIL";
private const string CounterpartyEmail = "bravo@bunq.com";
private const string RequestDescription = "This is a generated request!";
private const int UserItemId = 0; // Put your user ID here
private const int MonetaryAccountItemId = 0; // Put your monetary account ID here
private const string StatusRevoked = "REVOKED";

public void Run()
{
var apiContext = ApiContext.Restore();
var requestMap = new Dictionary<string, object>
{
{RequestInquiry.FIELD_AMOUNT_INQUIRED, new Amount(REQUEST_AMOUNT, REQUEST_CURRENCY)},
{RequestInquiry.FIELD_COUNTERPARTY_ALIAS, new Pointer(COUNTERPARTY_POINTER_TYPE, COUNTERPARTY_EMAIL)},
{RequestInquiry.FIELD_DESCRIPTION, REQUEST_DESCRIPTION},
{RequestInquiry.FIELD_AMOUNT_INQUIRED, new Amount(RequestAmount, RequestCurrency)},
{RequestInquiry.FIELD_COUNTERPARTY_ALIAS, new Pointer(CounterpartyPointerType, CounterpartyEmail)},
{RequestInquiry.FIELD_DESCRIPTION, RequestDescription},
{RequestInquiry.FIELD_ALLOW_BUNQME, true}
};
var requestId = RequestInquiry.Create(apiContext, requestMap, USER_ITEM_ID, MONETARY_ACCOUNT_ITEM_ID).Value;
Console.WriteLine(RequestInquiry.Get(apiContext, USER_ITEM_ID, MONETARY_ACCOUNT_ITEM_ID, requestId));
var requestId = RequestInquiry.Create(apiContext, requestMap, UserItemId, MonetaryAccountItemId).Value;
Console.WriteLine(RequestInquiry.Get(apiContext, UserItemId, MonetaryAccountItemId, requestId));

var requestUpdateMap = new Dictionary<string, object> {{RequestInquiry.FIELD_STATUS, STATUS_REVOKED}};
var requestUpdated = RequestInquiry.Update(apiContext, requestUpdateMap, USER_ITEM_ID,
MONETARY_ACCOUNT_ITEM_ID, requestId);
var requestUpdateMap = new Dictionary<string, object> {{RequestInquiry.FIELD_STATUS, StatusRevoked}};
var requestUpdated = RequestInquiry.Update(apiContext, requestUpdateMap, UserItemId,
MonetaryAccountItemId, requestId);
Console.WriteLine(requestUpdated);
}
}
Expand Down
Loading