Skip to content

Commit a75fe49

Browse files
authored
Merge pull request #10 from MarcoStuurman/add-confirmation-code
Added confirmation code to login credentials overview (bunq/tinker_php#25)
2 parents 4f57a3c + f9a12e5 commit a75fe49

File tree

1 file changed

+63
-53
lines changed

1 file changed

+63
-53
lines changed

TinkerSrc/Lib/ShareLib.cs

Lines changed: 63 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ public static class ShareLib
1818
private const string OptionCallbackUrl = "url=";
1919
private const string OptionRecipient = "recipient=";
2020

21+
private const string PointerTypePhone = "PHONE_NUMBER";
22+
2123
private static ApiEnvironmentType _environmentType = ApiEnvironmentType.SANDBOX;
2224

2325
public static ApiEnvironmentType DetermineEnvironmentType(string[] args)
@@ -179,11 +181,11 @@ public static void PrintUser(int id, string displayName)
179181
Console.Out.Write(Environment.NewLine + " User");
180182

181183
Console.Out.Write(@"
182-
┌───────────────────────────────────────────────────────────────────────
183-
│ ID │ " + id + @"
184-
├───────────────────────────────────────────────────────────────────────
185-
│ Username │ " + displayName + @"
186-
└───────────────────────────────────────────────────────────────────────
184+
┌───────────────────────────────────────────────────────────────────────
185+
│ ID │ " + id + @"
186+
├───────────────────────────────────────────────────────────────────────
187+
│ Username │ " + displayName + @"
188+
└───────────────────────────────────────────────────────────────────────
187189
");
188190
}
189191

@@ -202,12 +204,12 @@ private static void PrintMonetaryAccountBank(MonetaryAccountBank monetaryAccount
202204
var pointerIban = BunqLib.GetPointerIbanFromMonetaryAccountBank(monetaryAccountBank);
203205

204206
Console.Out.Write(@"
205-
┌───────────────────────────────────────────────────────────────────────
206-
│ ID │ " + monetaryAccountBank.Id + @"
207-
├───────────────────────────────────────────────────────────────────────
208-
│ Description │ " + monetaryAccountBank.Description + @"
209-
├───────────────────────────────────────────────────────────────────────
210-
│ IBAN │ " + pointerIban.Value);
207+
┌───────────────────────────────────────────────────────────────────────
208+
│ ID │ " + monetaryAccountBank.Id + @"
209+
├───────────────────────────────────────────────────────────────────────
210+
│ Description │ " + monetaryAccountBank.Description + @"
211+
├───────────────────────────────────────────────────────────────────────
212+
│ IBAN │ " + pointerIban.Value);
211213

212214
if (monetaryAccountBank.Balance == null)
213215
{
@@ -216,11 +218,11 @@ private static void PrintMonetaryAccountBank(MonetaryAccountBank monetaryAccount
216218
else
217219
{
218220
Console.Out.Write(@"
219-
├───────────────────────────────────────────────────────────────────────
220-
│ Balance │ " + monetaryAccountBank.Balance.Currency + " " + monetaryAccountBank.Balance.Value);
221+
├───────────────────────────────────────────────────────────────────────
222+
│ Balance │ " + monetaryAccountBank.Balance.Currency + " " + monetaryAccountBank.Balance.Value);
221223
}
222224
Console.Out.Write(@"
223-
└───────────────────────────────────────────────────────────────────────
225+
└───────────────────────────────────────────────────────────────────────
224226
");
225227
}
226228

@@ -237,15 +239,15 @@ public static void PrintAllPayment(List<Payment> allPayment)
237239
private static void PrintPayment(Payment payment)
238240
{
239241
Console.Out.Write(@"
240-
┌───────────────────────────────────────────────────────────────────────
241-
│ ID │ " + payment.Id + @"
242-
├───────────────────────────────────────────────────────────────────────
243-
│ Description │ " + payment.Description + @"
244-
├───────────────────────────────────────────────────────────────────────
245-
│ Amount │ " + payment.Amount.Currency + " " + payment.Amount.Value + @"
246-
├───────────────────────────────────────────────────────────────────────
247-
│ Recipient │ " + payment.CounterpartyAlias.LabelMonetaryAccount.DisplayName + @"
248-
└───────────────────────────────────────────────────────────────────────
242+
┌───────────────────────────────────────────────────────────────────────
243+
│ ID │ " + payment.Id + @"
244+
├───────────────────────────────────────────────────────────────────────
245+
│ Description │ " + payment.Description + @"
246+
├───────────────────────────────────────────────────────────────────────
247+
│ Amount │ " + payment.Amount.Currency + " " + payment.Amount.Value + @"
248+
├───────────────────────────────────────────────────────────────────────
249+
│ Recipient │ " + payment.CounterpartyAlias.LabelMonetaryAccount.DisplayName + @"
250+
└───────────────────────────────────────────────────────────────────────
249251
");
250252
}
251253

@@ -262,17 +264,17 @@ public static void PrintAllRequest(List<RequestInquiry> allRequest)
262264
public static void PrintRequest(RequestInquiry request)
263265
{
264266
Console.Out.Write(@"
265-
┌───────────────────────────────────────────────────────────────────────
266-
│ ID │ " + request.Id + @"
267-
├───────────────────────────────────────────────────────────────────────
268-
│ Description │ " + request.Description + @"
269-
├───────────────────────────────────────────────────────────────────────
270-
│ Status │ " + request.Status + @"
271-
├───────────────────────────────────────────────────────────────────────
272-
│ Amount │ " + request.AmountInquired.Currency + " " + request.AmountInquired.Value + @"
273-
├───────────────────────────────────────────────────────────────────────
274-
│ Recipient │ " + request.CounterpartyAlias.LabelMonetaryAccount.DisplayName + @"
275-
└───────────────────────────────────────────────────────────────────────
267+
┌───────────────────────────────────────────────────────────────────────
268+
│ ID │ " + request.Id + @"
269+
├───────────────────────────────────────────────────────────────────────
270+
│ Description │ " + request.Description + @"
271+
├───────────────────────────────────────────────────────────────────────
272+
│ Status │ " + request.Status + @"
273+
├───────────────────────────────────────────────────────────────────────
274+
│ Amount │ " + request.AmountInquired.Currency + " " + request.AmountInquired.Value + @"
275+
├───────────────────────────────────────────────────────────────────────
276+
│ Recipient │ " + request.CounterpartyAlias.LabelMonetaryAccount.DisplayName + @"
277+
└───────────────────────────────────────────────────────────────────────
276278
");
277279
}
278280

@@ -293,17 +295,17 @@ private static void PrintCard(Card card, List<MonetaryAccountBank> allMonetaryAc
293295
var monetaryAccountDescription = monetaryAccountBank.Description ?? "account description";
294296

295297
Console.Out.Write(@"
296-
┌───────────────────────────────────────────────────────────────────────
297-
│ ID │ " + card.Id + @"
298-
├───────────────────────────────────────────────────────────────────────
299-
│ Type │ " + card.Type + @"
300-
├───────────────────────────────────────────────────────────────────────
301-
│ Name on Card │ " + card.NameOnCard + @"
302-
├───────────────────────────────────────────────────────────────────────
303-
│ Description │ " + cardDescription + @"
304-
├───────────────────────────────────────────────────────────────────────
305-
│ Linked Account │ " + monetaryAccountDescription + " " + card.LabelMonetaryAccountCurrent.LabelMonetaryAccount.Iban + @"
306-
└───────────────────────────────────────────────────────────────────────");
298+
┌───────────────────────────────────────────────────────────────────────
299+
│ ID │ " + card.Id + @"
300+
├───────────────────────────────────────────────────────────────────────
301+
│ Type │ " + card.Type + @"
302+
├───────────────────────────────────────────────────────────────────────
303+
│ Name on Card │ " + card.NameOnCard + @"
304+
├───────────────────────────────────────────────────────────────────────
305+
│ Description │ " + cardDescription + @"
306+
├───────────────────────────────────────────────────────────────────────
307+
│ Linked Account │ " + monetaryAccountDescription + " " + card.LabelMonetaryAccountCurrent.LabelMonetaryAccount.Iban + @"
308+
└───────────────────────────────────────────────────────────────────────");
307309
}
308310

309311
public static void PrintAllUserAlias(IEnumerable<Pointer> allUserAlias)
@@ -313,15 +315,23 @@ public static void PrintAllUserAlias(IEnumerable<Pointer> allUserAlias)
313315
foreach (var alias in allUserAlias)
314316
{
315317
Console.Out.Write(@"
316-
┌────────────────┬───────────────────────────────────────────────────────
317-
│ Value │ " + alias.Value + @"
318-
├────────────────┼───────────────────────────────────────────────────────
319-
│ Type │ " + alias.Type + @"
320-
├────────────────┼───────────────────────────────────────────────────────
321-
│ Login code │ 000000
322-
└────────────────┴───────────────────────────────────────────────────────"
318+
┌───────────────────┬────────────────────────────────────────────────────
319+
│ Value │ " + alias.Value + @"
320+
├───────────────────┼────────────────────────────────────────────────────
321+
│ Type │ " + alias.Type
322+
);
323+
if (alias.Type.Equals(PointerTypePhone)) {
324+
Console.Out.Write(@"
325+
├───────────────────┼────────────────────────────────────────────────────
326+
│ Confirmation code │ 123456"
327+
);
328+
}
329+
Console.Out.Write(@"
330+
├───────────────────┼────────────────────────────────────────────────────
331+
│ Login code │ 000000
332+
└───────────────────┴────────────────────────────────────────────────────"
323333
);
324334
}
325335
}
326336
}
327-
}
337+
}

0 commit comments

Comments
 (0)