Skip to content
Merged
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
116 changes: 63 additions & 53 deletions TinkerSrc/Lib/ShareLib.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ public static class ShareLib
private const string OptionCallbackUrl = "url=";
private const string OptionRecipient = "recipient=";

private const string PointerTypePhone = "PHONE_NUMBER";

private static ApiEnvironmentType _environmentType = ApiEnvironmentType.SANDBOX;

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

Console.Out.Write(@"
┌───────────────────────────────────────────────────────────────────────
│ ID │ " + id + @"
├───────────────────────────────────────────────────────────────────────
│ Username │ " + displayName + @"
└───────────────────────────────────────────────────────────────────────
┌───────────────────────────────────────────────────────────────────────
│ ID │ " + id + @"
├───────────────────────────────────────────────────────────────────────
│ Username │ " + displayName + @"
└───────────────────────────────────────────────────────────────────────
");
}

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

Console.Out.Write(@"
┌───────────────────────────────────────────────────────────────────────
│ ID │ " + monetaryAccountBank.Id + @"
├───────────────────────────────────────────────────────────────────────
│ Description │ " + monetaryAccountBank.Description + @"
├───────────────────────────────────────────────────────────────────────
│ IBAN │ " + pointerIban.Value);
┌───────────────────────────────────────────────────────────────────────
│ ID │ " + monetaryAccountBank.Id + @"
├───────────────────────────────────────────────────────────────────────
│ Description │ " + monetaryAccountBank.Description + @"
├───────────────────────────────────────────────────────────────────────
│ IBAN │ " + pointerIban.Value);

if (monetaryAccountBank.Balance == null)
{
Expand All @@ -216,11 +218,11 @@ private static void PrintMonetaryAccountBank(MonetaryAccountBank monetaryAccount
else
{
Console.Out.Write(@"
├───────────────────────────────────────────────────────────────────────
│ Balance │ " + monetaryAccountBank.Balance.Currency + " " + monetaryAccountBank.Balance.Value);
├───────────────────────────────────────────────────────────────────────
│ Balance │ " + monetaryAccountBank.Balance.Currency + " " + monetaryAccountBank.Balance.Value);
}
Console.Out.Write(@"
└───────────────────────────────────────────────────────────────────────
└───────────────────────────────────────────────────────────────────────
");
}

Expand All @@ -237,15 +239,15 @@ public static void PrintAllPayment(List<Payment> allPayment)
private static void PrintPayment(Payment payment)
{
Console.Out.Write(@"
┌───────────────────────────────────────────────────────────────────────
│ ID │ " + payment.Id + @"
├───────────────────────────────────────────────────────────────────────
│ Description │ " + payment.Description + @"
├───────────────────────────────────────────────────────────────────────
│ Amount │ " + payment.Amount.Currency + " " + payment.Amount.Value + @"
├───────────────────────────────────────────────────────────────────────
│ Recipient │ " + payment.CounterpartyAlias.LabelMonetaryAccount.DisplayName + @"
└───────────────────────────────────────────────────────────────────────
┌───────────────────────────────────────────────────────────────────────
│ ID │ " + payment.Id + @"
├───────────────────────────────────────────────────────────────────────
│ Description │ " + payment.Description + @"
├───────────────────────────────────────────────────────────────────────
│ Amount │ " + payment.Amount.Currency + " " + payment.Amount.Value + @"
├───────────────────────────────────────────────────────────────────────
│ Recipient │ " + payment.CounterpartyAlias.LabelMonetaryAccount.DisplayName + @"
└───────────────────────────────────────────────────────────────────────
");
}

Expand All @@ -262,17 +264,17 @@ public static void PrintAllRequest(List<RequestInquiry> allRequest)
public static void PrintRequest(RequestInquiry request)
{
Console.Out.Write(@"
┌───────────────────────────────────────────────────────────────────────
│ ID │ " + request.Id + @"
├───────────────────────────────────────────────────────────────────────
│ Description │ " + request.Description + @"
├───────────────────────────────────────────────────────────────────────
│ Status │ " + request.Status + @"
├───────────────────────────────────────────────────────────────────────
│ Amount │ " + request.AmountInquired.Currency + " " + request.AmountInquired.Value + @"
├───────────────────────────────────────────────────────────────────────
│ Recipient │ " + request.CounterpartyAlias.LabelMonetaryAccount.DisplayName + @"
└───────────────────────────────────────────────────────────────────────
┌───────────────────────────────────────────────────────────────────────
│ ID │ " + request.Id + @"
├───────────────────────────────────────────────────────────────────────
│ Description │ " + request.Description + @"
├───────────────────────────────────────────────────────────────────────
│ Status │ " + request.Status + @"
├───────────────────────────────────────────────────────────────────────
│ Amount │ " + request.AmountInquired.Currency + " " + request.AmountInquired.Value + @"
├───────────────────────────────────────────────────────────────────────
│ Recipient │ " + request.CounterpartyAlias.LabelMonetaryAccount.DisplayName + @"
└───────────────────────────────────────────────────────────────────────
");
}

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

Console.Out.Write(@"
┌───────────────────────────────────────────────────────────────────────
│ ID │ " + card.Id + @"
├───────────────────────────────────────────────────────────────────────
│ Type │ " + card.Type + @"
├───────────────────────────────────────────────────────────────────────
│ Name on Card │ " + card.NameOnCard + @"
├───────────────────────────────────────────────────────────────────────
│ Description │ " + cardDescription + @"
├───────────────────────────────────────────────────────────────────────
│ Linked Account │ " + monetaryAccountDescription + " " + card.LabelMonetaryAccountCurrent.LabelMonetaryAccount.Iban + @"
└───────────────────────────────────────────────────────────────────────");
┌───────────────────────────────────────────────────────────────────────
│ ID │ " + card.Id + @"
├───────────────────────────────────────────────────────────────────────
│ Type │ " + card.Type + @"
├───────────────────────────────────────────────────────────────────────
│ Name on Card │ " + card.NameOnCard + @"
├───────────────────────────────────────────────────────────────────────
│ Description │ " + cardDescription + @"
├───────────────────────────────────────────────────────────────────────
│ Linked Account │ " + monetaryAccountDescription + " " + card.LabelMonetaryAccountCurrent.LabelMonetaryAccount.Iban + @"
└───────────────────────────────────────────────────────────────────────");
}

public static void PrintAllUserAlias(IEnumerable<Pointer> allUserAlias)
Expand All @@ -313,15 +315,23 @@ public static void PrintAllUserAlias(IEnumerable<Pointer> allUserAlias)
foreach (var alias in allUserAlias)
{
Console.Out.Write(@"
┌────────────────┬───────────────────────────────────────────────────────
│ Value │ " + alias.Value + @"
├────────────────┼───────────────────────────────────────────────────────
│ Type │ " + alias.Type + @"
├────────────────┼───────────────────────────────────────────────────────
│ Login code │ 000000
└────────────────┴───────────────────────────────────────────────────────"
┌───────────────────┬────────────────────────────────────────────────────
│ Value │ " + alias.Value + @"
├───────────────────┼────────────────────────────────────────────────────
│ Type │ " + alias.Type
);
if (alias.Type.Equals(PointerTypePhone)) {
Console.Out.Write(@"
├───────────────────┼────────────────────────────────────────────────────
│ Confirmation code │ 123456"
);
}
Console.Out.Write(@"
├───────────────────┼────────────────────────────────────────────────────
│ Login code │ 000000
└───────────────────┴────────────────────────────────────────────────────"
);
}
}
}
}
}