Skip to content

Commit d53ea29

Browse files
author
Joao Antao
committed
Rename constants consistently. (#58)
1 parent c43eb8c commit d53ea29

19 files changed

+134
-144
lines changed

BunqSdk.Samples/CustomerStatementExportSample.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace Bunq.Sdk.Samples
99
public class CustomerStatementExportSample : ISample
1010
{
1111
/// <summary>
12-
/// Constant to translate weeks to milliseconds.
12+
/// Constant value zero.
1313
/// </summary>
1414
private const int IndexFirst = 0;
1515

@@ -29,7 +29,7 @@ public class CustomerStatementExportSample : ISample
2929
private const int TimeUnitCountNone = 0;
3030

3131
/// <summary>
32-
/// Measure of any time unit when none of it is needed.
32+
/// Measure of days in week.
3333
/// </summary>
3434
private const int DaysInWeek = 7;
3535

BunqSdk.Samples/PaymentBatchSample.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ namespace Bunq.Sdk.Samples
99
{
1010
public class PaymentBatchSample : ISample
1111
{
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!";
12+
private const string ValueAmountEur = "0.01";
13+
private const string ValueCurrencyEur = "EUR";
14+
private const string CounterPartyPointerType = "EMAIL";
15+
private const string CounterPartyEmail = "bravo@bunq.com";
16+
private const string ValueDescription = "This is a generated payment batch!";
1717
private const int UserItemId = 0; // Put your user ID here
1818
private const int MonetaryAccountItemId = 0; // Put your monetary account ID here
1919

@@ -28,12 +28,12 @@ public void Run()
2828
{
2929
new Dictionary<string, object>
3030
{
31-
{Payment.FIELD_AMOUNT, new Amount(PaymentAmount, PaymentCurrency)},
31+
{Payment.FIELD_AMOUNT, new Amount(ValueAmountEur, ValueCurrencyEur)},
3232
{
3333
Payment.FIELD_COUNTERPARTY_ALIAS,
34-
new Pointer(CounterpartyPointerType, CounterpartyEmail)
34+
new Pointer(CounterPartyPointerType, CounterPartyEmail)
3535
},
36-
{Payment.FIELD_DESCRIPTION, PaymentDescription}
36+
{Payment.FIELD_DESCRIPTION, ValueDescription}
3737
}
3838
}
3939
}

BunqSdk.Samples/PaymentListSample.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ public class PaymentListSample : ISample
1212
/// <summary>
1313
/// Message constants.
1414
/// </summary>
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!";
15+
private const string MessageLatestPageAllPaymentId = "Latest page IDs: ";
16+
private const string MessageSecondLatestPageAllPaymentId = "Second latest page IDs: ";
17+
private const string MessageNoPriorPaymentFound = "No prior payments found!";
1818

1919
/// <summary>
2020
/// Size of each page of payment listing.
@@ -34,22 +34,22 @@ public void Run()
3434
{
3535
Count = PageSize,
3636
};
37-
Console.WriteLine(MessageLatestPageIds);
37+
Console.WriteLine(MessageLatestPageAllPaymentId);
3838
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(MessageSecondLatestPageIds);
45+
Console.WriteLine(MessageSecondLatestPageAllPaymentId);
4646
var previousPaymentResponse = Payment.List(apiContext, UserItemId, MonetaryAccountItemId,
4747
pagination.UrlParamsPreviousPage);
4848
PrintPayments(previousPaymentResponse.Value);
4949
}
5050
else
5151
{
52-
Console.WriteLine(MessageNoPriorPaymentsFound);
52+
Console.WriteLine(MessageNoPriorPaymentFound);
5353
}
5454
}
5555

BunqSdk.Samples/PaymentSample.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,23 @@ public class PaymentSample : ISample
1111
{
1212
private const int UserItemId = 0; // Put your user ID here
1313
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!";
14+
private const string ValueAmountEur = "0.01";
15+
private const string ValueCurrencyEur = "EUR";
16+
private const string CounterPartyPointerType = "EMAIL";
17+
private const string CounterPartyEmail = "bravo@bunq.com";
18+
private const string ValueDescription = "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(PaymentAmount, PaymentCurrency)},
25+
{Payment.FIELD_AMOUNT, new Amount(ValueAmountEur, ValueCurrencyEur)},
2626
{
2727
Payment.FIELD_COUNTERPARTY_ALIAS,
28-
new Pointer(CounterpartyPointerType, CounterpartyEmail)
28+
new Pointer(CounterPartyPointerType, CounterPartyEmail)
2929
},
30-
{Payment.FIELD_DESCRIPTION, PaymentDescription}
30+
{Payment.FIELD_DESCRIPTION, ValueDescription}
3131
};
3232

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

BunqSdk.Samples/RequestSample.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,29 +9,29 @@ namespace Bunq.Sdk.Samples
99
{
1010
public class RequestSample : ISample
1111
{
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!";
12+
private const string ValueAmountEur = "12.30";
13+
private const string ValueCurrencyEur = "EUR";
14+
private const string CounterPartyPointerType = "EMAIL";
15+
private const string CounterPartyEmail = "bravo@bunq.com";
16+
private const string ValueDescription = "This is a generated request!";
17+
private const string ValueStatusRevoked = "REVOKED";
1718
private const int UserItemId = 0; // Put your user ID here
1819
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(RequestAmount, RequestCurrency)},
27-
{RequestInquiry.FIELD_COUNTERPARTY_ALIAS, new Pointer(CounterpartyPointerType, CounterpartyEmail)},
28-
{RequestInquiry.FIELD_DESCRIPTION, RequestDescription},
26+
{RequestInquiry.FIELD_AMOUNT_INQUIRED, new Amount(ValueAmountEur, ValueCurrencyEur)},
27+
{RequestInquiry.FIELD_COUNTERPARTY_ALIAS, new Pointer(CounterPartyPointerType, CounterPartyEmail)},
28+
{RequestInquiry.FIELD_DESCRIPTION, ValueDescription},
2929
{RequestInquiry.FIELD_ALLOW_BUNQME, true}
3030
};
3131
var requestId = RequestInquiry.Create(apiContext, requestMap, UserItemId, MonetaryAccountItemId).Value;
3232
Console.WriteLine(RequestInquiry.Get(apiContext, UserItemId, MonetaryAccountItemId, requestId));
3333

34-
var requestUpdateMap = new Dictionary<string, object> {{RequestInquiry.FIELD_STATUS, StatusRevoked}};
34+
var requestUpdateMap = new Dictionary<string, object> {{RequestInquiry.FIELD_STATUS, ValueStatusRevoked}};
3535
var requestUpdated = RequestInquiry.Update(apiContext, requestUpdateMap, UserItemId,
3636
MonetaryAccountItemId, requestId);
3737
Console.WriteLine(requestUpdated);

BunqSdk.Tests/BunqSdkTestBase.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public class BunqSdkTestBase
2323
/// Configuration items.
2424
/// </summary>
2525
private static readonly string ApiKey = Config.GetApiKey();
26-
private static readonly string[] FieldPermittedIps = Config.GetPermittedIps();
26+
private static readonly string[] FieldAllPermittedIp = Config.GetAllPermittedIp();
2727

2828
/// <summary>
2929
/// Gets an Api Context, re-creates if needed and returns it.
@@ -50,7 +50,7 @@ protected static ApiContext GetApiContext()
5050
private static ApiContext CreateApiContext()
5151
{
5252
return ApiContext.Create(ApiEnvironmentType.Sandbox, ApiKey, DeviceDescriptionTest,
53-
new List<string>(FieldPermittedIps));
53+
new List<string>(FieldAllPermittedIp));
5454
}
5555
}
5656
}

BunqSdk.Tests/Config.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public class Config
99
/// <summary>
1010
/// Delimiter between the IP addresses in the PERMITTED_IPS field.
1111
/// </summary>
12-
private const char DelimiterIps = ',';
12+
private const char DelimiterIp = ',';
1313

1414
/// <summary>
1515
/// Length of an empty array.
@@ -22,7 +22,7 @@ public class Config
2222
private const string FieldConfigFilePath = "../../../Resources/config.json";
2323
private const string FieldUserId = "USER_ID";
2424
private const string FieldApiKey = "API_KEY";
25-
private const string FieldPermittedIps = "PERMITTED_IPS";
25+
private const string FieldAllPermittedIp = "PERMITTED_IP";
2626
private const string FieldAttachmentPublicTest = "AttachmentPublicTest";
2727
private const string FieldAttachmentPathIn = "PATH_IN";
2828
private const string FieldAttachmentDescription = "DESCRIPTION";
@@ -72,7 +72,7 @@ public static string GetAttachmentPathIn()
7272
return GetConfig()[FieldAttachmentPublicTest][FieldAttachmentPathIn].ToString();
7373
}
7474

75-
public static string GetAttachmentDescrpition()
75+
public static string GetAttachmentDescription()
7676
{
7777
return GetConfig()[FieldAttachmentPublicTest][FieldAttachmentDescription].ToString();
7878
}
@@ -82,13 +82,13 @@ public static string GetAttachmentContentType()
8282
return GetConfig()[FieldAttachmentPublicTest][FieldAttachmentContentType].ToString();
8383
}
8484

85-
public static string[] GetPermittedIps()
85+
public static string[] GetAllPermittedIp()
8686
{
87-
var permittedIpsString = GetConfig()[FieldPermittedIps].ToString();
87+
var allPermittedIp = GetConfig()[FieldAllPermittedIp].ToString();
8888

89-
return permittedIpsString.Length == LengthNone ?
90-
new string[LengthNone] :
91-
permittedIpsString.Split(DelimiterIps);
89+
return allPermittedIp.Length == LengthNone
90+
? new string[LengthNone]
91+
: allPermittedIp.Split(DelimiterIp);
9292
}
9393

9494
public static string GetApiKey()

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@ public class AttachmentPublicTest : BunqSdkTestBase
1818
/// Config values.
1919
/// </summary>
2020
private const string PathAttachment = "../../../Resources";
21-
2221
private static readonly string ContentType = Config.GetAttachmentContentType();
23-
private static readonly string AttachmentDescription = Config.GetAttachmentDescrpition();
22+
private static readonly string AttachmentDescription = Config.GetAttachmentDescription();
2423
private static readonly string AttachmentPathIn = Config.GetAttachmentPathIn();
2524

2625
/// <summary>

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,10 @@ public class AvatarTest : BunqSdkTestBase
1818
/// <summary>
1919
/// Config values.
2020
/// </summary>
21-
private const string PathToAttachment = "../../../Resources";
21+
private const string PathAttachment = "../../../Resources";
2222
private const int IndexFirst = 0;
23-
24-
private static readonly string ContentType = Config.GetAttachmentContentType();
25-
private static readonly string AttachmentDescription = Config.GetAttachmentDescrpition();
23+
private static readonly string AttachmentContentType = Config.GetAttachmentContentType();
24+
private static readonly string AttachmentDescription = Config.GetAttachmentDescription();
2625
private static readonly string AttachmentPathIn = Config.GetAttachmentPathIn();
2726

2827
/// <summary>
@@ -37,7 +36,7 @@ public class AvatarTest : BunqSdkTestBase
3736
[Fact]
3837
public void TestCreateAvatarAndRetrieval()
3938
{
40-
var fileContentByte = File.ReadAllBytes(PathToAttachment + AttachmentPathIn);
39+
var fileContentByte = File.ReadAllBytes(PathAttachment + AttachmentPathIn);
4140
var attachmentUuid = UploadAvatarAndGetUuid(fileContentByte);
4241

4342
var avatarMap = new Dictionary<string, object>
@@ -59,7 +58,7 @@ private static string UploadAvatarAndGetUuid(byte[] fileContentByte)
5958
var customHeaders = new Dictionary<string, string>
6059
{
6160
{ApiClient.HeaderAttachmentDescription, AttachmentDescription},
62-
{ApiClient.HeaderContentType, ContentType},
61+
{ApiClient.HeaderContentType, AttachmentContentType},
6362
};
6463

6564
return AttachmentPublic.Create(ApiContext, fileContentByte, customHeaders).Value;

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ public class CardDebitTest : BunqSdkTestBase
2323
private const int BaseDecimal = 10;
2424
private const int CardSecondLineLengthMaximum = 20;
2525
private const int NumberOne = 1;
26-
2726
private static readonly int UserId = Config.GetUserId();
2827

2928
/// <summary>

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,10 @@ public class DraftShareInviteBankQrCodeContentTest : BunqSdkTestBase
1818
/// <summary>
1919
/// Config values.
2020
/// </summary>
21-
private const string FilenameQrCodeImage = "tmp/qrcode.png";
21+
private const string FileNameQrCodeImage = "tmp/qrcode.png";
2222
private const int TimeUnitAmountZero = 0;
2323
private const int TimeUnitAmountOne = 1;
2424
private const string FormatDate = "yyyy-MM-dd HH:mm:ss";
25-
2625
private static readonly int UserId = Config.GetUserId();
2726

2827
/// <summary>
@@ -42,7 +41,7 @@ public void TestCreateInviteBankAndGetQrCode()
4241

4342
var qrContent = DraftShareInviteBankQrCodeContent.List(ApiContext, UserId, draftId).Value;
4443

45-
var fileOut = new FileInfo(FilenameQrCodeImage);
44+
var fileOut = new FileInfo(FileNameQrCodeImage);
4645
fileOut.Directory.Create();
4746
File.WriteAllBytes(fileOut.FullName, qrContent);
4847
}

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ public class MonetaryAccountBankTest : BunqSdkTestBase
1414
/// <summary>
1515
/// Config values
1616
/// </summary>
17-
private const string MonetaryAccountBankStatus = "CANCELLED";
18-
private const string MonetaryAccountBankSubStatus = "REDEMPTION_VOLUNTARY";
19-
private const string MonetaryAccountBankReason = "OTHER";
20-
private const string MonetaryAccountBankReasonDescription = "Because this is a test";
21-
private const string MonetaryAccountBankCurrencyEur = "EUR";
22-
private const string MonetaryAccountBankDescription = "Test C# monetary account";
17+
private const string ValueStatus = "CANCELLED";
18+
private const string ValueSubStatus = "REDEMPTION_VOLUNTARY";
19+
private const string ValueReason = "OTHER";
20+
private const string ValueReasonDescription = "Because this is a test";
21+
private const string ValueCurrencyEur = "EUR";
22+
private const string ValueDescription = "Test C# monetary account";
2323

2424
private static readonly int UserId = Config.GetUserId();
2525

@@ -36,8 +36,8 @@ public void TestCreationNewMonetaryAccount()
3636
{
3737
var requestMap = new Dictionary<string, object>
3838
{
39-
{MonetaryAccountBank.FIELD_CURRENCY, MonetaryAccountBankCurrencyEur},
40-
{MonetaryAccountBank.FIELD_DESCRIPTION, MonetaryAccountBankDescription}
39+
{MonetaryAccountBank.FIELD_CURRENCY, ValueCurrencyEur},
40+
{MonetaryAccountBank.FIELD_DESCRIPTION, ValueDescription}
4141
};
4242
var monetaryAccountToCloseId = MonetaryAccountBank.Create(ApiContext, requestMap, UserId).Value;
4343

@@ -48,10 +48,10 @@ private static void DeleteMonetaryAccount(int idToClose)
4848
{
4949
var requestMap = new Dictionary<string, object>
5050
{
51-
{MonetaryAccountBank.FIELD_STATUS, MonetaryAccountBankStatus},
52-
{MonetaryAccountBank.FIELD_SUB_STATUS, MonetaryAccountBankSubStatus},
53-
{MonetaryAccountBank.FIELD_REASON, MonetaryAccountBankReason},
54-
{MonetaryAccountBank.FIELD_REASON_DESCRIPTION, MonetaryAccountBankReasonDescription}
51+
{MonetaryAccountBank.FIELD_STATUS, ValueStatus},
52+
{MonetaryAccountBank.FIELD_SUB_STATUS, ValueSubStatus},
53+
{MonetaryAccountBank.FIELD_REASON, ValueReason},
54+
{MonetaryAccountBank.FIELD_REASON_DESCRIPTION, ValueReasonDescription}
5555
};
5656
MonetaryAccountBank.Update(ApiContext, requestMap, UserId, idToClose);
5757
}

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

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,13 @@ public class PaymentChatTest : BunqSdkTestBase
1717
/// <summary>
1818
/// Config values.
1919
/// </summary>
20-
private const string PaymentChatAmountEur = "0.01";
21-
private const string PaymentChatCurrencyEur = "EUR";
22-
private const string PaymentChatDescription = "Payment From C# Test";
23-
private const string PaymentChatText = "test msg send from C# test";
24-
20+
private const string ValueAmountEur = "0.01";
21+
private const string ValueCurrencyEur = "EUR";
22+
private const string ValueDescription = "Payment from C# test";
23+
private const string ValueText = "Test message sent from C# test";
2524
private static readonly int UserId = Config.GetUserId();
2625
private static readonly int MonetaryAccountId = Config.GetMonetarytAccountId();
27-
private static readonly Pointer CounterPartyAlias = Config.GetCounterPartyAliasSelf();
26+
private static readonly Pointer CounterPartyAliasSelf = Config.GetCounterPartyAliasSelf();
2827

2928
/// <summary>
3029
/// API context used for the test API calls.
@@ -43,7 +42,7 @@ public void TestSendPaymentChat()
4342

4443
var chatMessageMap = new Dictionary<string, object>
4544
{
46-
{ChatMessageText.FIELD_TEXT, PaymentChatText}
45+
{ChatMessageText.FIELD_TEXT, ValueText}
4746
};
4847
ChatMessageText.Create(ApiContext, chatMessageMap, UserId, chatId);
4948
}
@@ -52,9 +51,9 @@ private static int CreatePaymentAndGetId()
5251
{
5352
var requestMap = new Dictionary<string, object>
5453
{
55-
{Payment.FIELD_AMOUNT, new Amount(PaymentChatAmountEur, PaymentChatCurrencyEur)},
56-
{Payment.FIELD_COUNTERPARTY_ALIAS, CounterPartyAlias},
57-
{Payment.FIELD_DESCRIPTION, PaymentChatDescription},
54+
{Payment.FIELD_AMOUNT, new Amount(ValueAmountEur, ValueCurrencyEur)},
55+
{Payment.FIELD_COUNTERPARTY_ALIAS, CounterPartyAliasSelf},
56+
{Payment.FIELD_DESCRIPTION, ValueDescription},
5857
};
5958

6059
return Payment.Create(ApiContext, requestMap, UserId, MonetaryAccountId).Value;

0 commit comments

Comments
 (0)