53 lines
3.2 KiB
Text
53 lines
3.2 KiB
Text
|
|
// SPDX-License-Identifier: GPL-3.0-only
|
||
|
|
// SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
|
||
|
|
|
||
|
|
export module Nostro.App:Format;
|
||
|
|
|
||
|
|
import std;
|
||
|
|
import Nostro;
|
||
|
|
|
||
|
|
// How the app words what a bank gives it: money, dates as a person reads them in their own time zone, and a
|
||
|
|
// bank's capitals in plain words. English only; every such wording is here, and none of it names a bank.
|
||
|
|
|
||
|
|
export namespace Nostro::App {
|
||
|
|
// An IBAN in groups of four, as it is printed on a card; anything else as it is.
|
||
|
|
std::string GroupIban(std::string_view iban);
|
||
|
|
// What an account is found by, in the app and by nostrod: its IBAN, or its name where the bank gave it none.
|
||
|
|
std::string AccountKey(const Account& account);
|
||
|
|
// Who a payment is to or from, as a person would say it: by name, else by IBAN or address, and "Unknown" where
|
||
|
|
// the bank gives neither, as it does for someone it knows by a phone number alone.
|
||
|
|
std::string PartyName(const BunqLabel& party);
|
||
|
|
std::string PartyName(const BunqCounterparty& party);
|
||
|
|
// An amount as a person reads it, its thousands apart: "€12,500.00", "-€3.00".
|
||
|
|
std::string Money(std::int64_t minor, Currency currency);
|
||
|
|
// The same with a plus on what came in, as a list of payments shows it: "+€12.50", "-€3.00", "€0.00".
|
||
|
|
std::string SignedMoney(std::int64_t minor, Currency currency);
|
||
|
|
|
||
|
|
// The day a moment falls on in local time, as one number: moments of one day have the same.
|
||
|
|
std::int64_t LocalDay(std::chrono::system_clock::time_point time);
|
||
|
|
// That day as a list's heading: "Today", "Yesterday", "Monday 3 November", and with its year when that is not
|
||
|
|
// `now`'s.
|
||
|
|
std::string DayLabel(std::chrono::system_clock::time_point time, std::chrono::system_clock::time_point now);
|
||
|
|
// "3 Nov", and with its year when that is not `now`'s.
|
||
|
|
std::string ShortDate(std::chrono::system_clock::time_point time, std::chrono::system_clock::time_point now);
|
||
|
|
// "14:05".
|
||
|
|
std::string ClockTime(std::chrono::system_clock::time_point time);
|
||
|
|
// "3 November 2026, 14:05".
|
||
|
|
std::string FullTime(std::chrono::system_clock::time_point time);
|
||
|
|
// "2026-11-03", as a date field takes it.
|
||
|
|
std::string DateInput(std::chrono::system_clock::time_point time);
|
||
|
|
|
||
|
|
// What kind of payment the bank says one is ("MASTERCARD/PAYMENT"), in words; the bank's own for one not known.
|
||
|
|
std::string KindLabel(std::string_view kind);
|
||
|
|
// A status as the bank writes it ("PIN_TRIES_EXCEEDED"), in words: "Pin tries exceeded".
|
||
|
|
std::string StatusLabel(std::string_view status);
|
||
|
|
// A card's product ("MASTERCARD_DEBIT"), in words: "Mastercard debit".
|
||
|
|
std::string CardProduct(std::string_view productType);
|
||
|
|
// When a card expires, as its face has it: "11/30" for the bank's "2030-11-30"; anything else as the bank says it.
|
||
|
|
std::string CardExpiry(std::string_view expiry);
|
||
|
|
// When a scheduled payment runs: "Once on 3 Nov", "Every 2 weeks from 3 Nov until 1 Jan 2027".
|
||
|
|
std::string ScheduleLabel(const BunqSchedule& schedule, std::chrono::system_clock::time_point now);
|
||
|
|
|
||
|
|
// A secret said without saying it: how it begins and its last four characters, enough to tell two keys apart.
|
||
|
|
std::string Fingerprint(std::string_view secret);
|
||
|
|
}
|