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

feature/58 - Rename constants concerning PascalCase convention #68

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
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
24 changes: 12 additions & 12 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_SECOND_LINE, GenerateRandomSecondLine()},
{CardDebit.FIELD_PIN_CODE, PIN_CODE},
{CardDebit.FieldNameOnCard, NameYourCompany},
{CardDebit.FieldSecondLine, GenerateRandomSecondLine()},
{CardDebit.FieldPinCode, PinCode},
{
CardDebit.FIELD_ALIAS,
new Pointer(POINTER_TYPE_EMAIL, EMAIL_YOUR_COMPANY) {Name = POINTER_NAME_TEST}
CardDebit.FieldAlias,
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.FieldStatementFormat, StatementFormat},
{CustomerStatementExport.FieldDateStart, dateStart.ToString(FormatDateStatement)},
{CustomerStatementExport.FieldDateEnd, 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
30 changes: 15 additions & 15 deletions BunqSdk.Samples/PaymentBatchSample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,40 +9,40 @@ 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()
{
var apiContext = ApiContext.Restore();
var paymentBatchMap = new Dictionary<string, object>
{
{
PaymentBatch.FIELD_PAYMENTS,
PaymentBatch.FieldPayments,
new List<object>
{
new Dictionary<string, object>
{
{Payment.FIELD_AMOUNT, new Amount(PAYMENT_AMOUNT, PAYMENT_CURRENCY)},
{Payment.FieldAmount, new Amount(PaymentAmount, PaymentCurrency)},
{
Payment.FIELD_COUNTERPARTY_ALIAS,
new Pointer(COUNTERPARTY_POINTER_TYPE, COUNTERPARTY_EMAIL)
Payment.FieldCounterpartyAlias,
new Pointer(CounterpartyPointerType, CounterpartyEmail)
},
{Payment.FIELD_DESCRIPTION, PAYMENT_DESCRIPTION}
{Payment.FieldDescription, 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: ";
private const string MessageSecondLatestPageIds = "Second latest page IDs: ";
private const string MessageNoPriorPaymentsFound = "No prior payments found!";

/// <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);
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);
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
26 changes: 13 additions & 13 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.FieldAmount, new Amount(PaymentAmount, PaymentCurrency)},
{
Payment.FIELD_COUNTERPARTY_ALIAS,
new Pointer(COUNTERPARTY_POINTER_TYPE, COUNTERPARTY_EMAIL)
Payment.FieldCounterpartyAlias,
new Pointer(CounterpartyPointerType, CounterpartyEmail)
},
{Payment.FIELD_DESCRIPTION, PAYMENT_DESCRIPTION}
{Payment.FieldDescription, 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
34 changes: 17 additions & 17 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_ALLOW_BUNQME, true}
{RequestInquiry.FieldAmountInquired, new Amount(RequestAmount, RequestCurrency)},
{RequestInquiry.FieldCounterpartyAlias, new Pointer(CounterpartyPointerType, CounterpartyEmail)},
{RequestInquiry.FieldDescription, RequestDescription},
{RequestInquiry.FieldAllowBunqme, 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.FieldStatus, StatusRevoked}};
var requestUpdated = RequestInquiry.Update(apiContext, requestUpdateMap, UserItemId,
MonetaryAccountItemId, requestId);
Console.WriteLine(requestUpdated);
}
}
Expand Down
Loading