This commit is contained in:
Jorijn van der Graaf 2026-11-01 18:35:23 +01:00
commit 1ea50c50bc
62 changed files with 9982 additions and 608 deletions

View file

@ -0,0 +1,54 @@
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<!-- SPDX-License-Identifier: LGPL-3.0-only -->
<!-- SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts® -->
<!-- nostro's checkout: how an app has the user's nostro pay an order. The bus name net.catcrafts.Nostro1.Checkout on
the system bus, at /net/catcrafts/Nostro1; a Flatpak app asks for it with the finish-arg
system-talk-name=net.catcrafts.Nostro1.Checkout. C++ programs can use the module Nostro.Checkout (nostro built with
product=checkout) instead. A test in nostro keeps this file the interface nostrod serves.
Pay(payeeIban, payeeName, amount, currency, reference, options) returns (paymentId, results)
payeeIban who is paid: an IBAN, the only payee checkout pays
payeeName their name, as the bank and the prompt show it
amount in the currency's smallest unit (1250 is 12.50), more than zero
currency an ISO code: "EUR"
reference the order's own number, not empty: the payment's description, and what tells orders apart
options none yet; keys nostrod does not know are ignored
paymentId the paying bank's id of the payment
results repeated (b): the order was paid by an earlier call, and nothing was paid now. Later versions may
add keys: ignore the ones you do not know.
nostrod pays the order from the account the user chose for checkouts (nostro checkout account), once the user has
confirmed it at a password prompt that shows the amount, the payee, the reference and that account. The app never
names nor sees the account. Allow interactive authorization on the call, make it asynchronously, and give it a
timeout of minutes: the user may take a while.
An order is paid once. Pay with the same payeeIban and reference again, after a timeout or a crash, answers with
the first payment (repeated is true) without asking the user, or waits for the first call while the user is still
at the prompt; the same reference with another amount is refused. A payment id is not a receipt: confirm the money
arrived with your own bank.
Errors:
net.catcrafts.Nostro1.Error.Cancelled the user did not confirm: nothing was paid
net.catcrafts.Nostro1.Error.NoCheckoutAccount the user has no account chosen to pay checkouts from: nothing was paid
net.catcrafts.Nostro1.Error.InvalidArgument the order was refused before anything was paid
net.catcrafts.Nostro1.Error.Bank the bank refused; its message says when it may have paid all the same
net.catcrafts.Nostro1.Error.Failed anything else, such as an earlier call for this order whose outcome was
lost: it may have been paid
org.freedesktop.DBus.Error.AccessDenied the system's policy refused
org.freedesktop.DBus.Error.InteractiveAuthorizationRequired the call did not allow a password prompt
org.freedesktop.DBus.Error.ServiceUnknown nostro is not installed -->
<node>
<interface name="net.catcrafts.Nostro1.Checkout">
<method name="Pay">
<arg type="s" name="payeeIban" direction="in"/>
<arg type="s" name="payeeName" direction="in"/>
<arg type="x" name="amount" direction="in"/>
<arg type="s" name="currency" direction="in"/>
<arg type="s" name="reference" direction="in"/>
<arg type="a{sv}" name="options" direction="in"/>
<arg type="t" name="paymentId" direction="out"/>
<arg type="a{sv}" name="results" direction="out"/>
</method>
</interface>
</node>

View file

@ -0,0 +1,196 @@
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<!-- SPDX-License-Identifier: LGPL-3.0-only -->
<!-- SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts® -->
<!-- nostrod's interface: net.catcrafts.Nostro1 on the system bus, at /net/catcrafts/Nostro1. Generate a proxy from
this file (gdbus-codegen, qdbusxml2cpp, zbus-xmlgen); C++ programs can use Nostro::Client instead. A test in nostro
keeps this file the interface nostrod serves.
Every call is answered for the calling user only, and authorised with polkit first
(packaging/system/net.catcrafts.Nostro1.policy): allow interactive authorization on your calls, so the user can be
asked for their password, and give them a timeout of minutes. Every reply ends with `notes`, the warnings the
library gave during the call, to show the user.
Conventions:
account an account's name or IBAN
to, from an IBAN, an e-mail address, or a phone number starting with +
amount in the currency's smallest unit (1250 is 12.50), positive; balances and transactions are negative
when money goes out
currency an ISO code: "EUR"
times x: microseconds since 1970-01-01 00:00 UTC
optionals an array of zero or one element (ax)
Types:
connectors (Connectors) a(ssssb): name, bank ("bunq"), environment ("production" or "sandbox"),
auth ("api key" or "oauth"), whether a call to the bank works now
connectors (Accounts) a(ssa(ssssx)): connector name, bank, accounts: name, BIC, IBAN, currency, balance
query (Transactions) a{sv}, each key optional: search s, amount x, from x, to x, limit t (100)
transactions a(sssssxxss): name, BIC, IBAN, description, currency, amount, time, the bank's
id, the bank's kind ("MASTERCARD/PAYMENT")
schedule (xaxsusax): start, end, unit (ONCE, HOURLY, DAILY, WEEKLY, MONTHLY, YEARLY),
every n units, status (ACTIVE, FINISHED, CANCELLED), next run
request (sent) (ts(ss)sxaxsxs): id, status, counterparty (name, IBAN), currency, amount asked,
amount paid, description, created, bunq.me link
requests (incoming) a(tss(ss)sxsx): id, status, type (INTERNAL, DIRECT_DEBIT, ...), counterparty,
currency, amount, description, created
scheduled a(t(ss)sxs(xaxsusax)): id, counterparty, currency, amount, description, schedule
drafts a(tssa((ss)sxs)s): id, status, created by, entries (counterparty, currency,
amount, description), bunq's time of its last change
cards / updated (tsssssssss): id, kind, product type, status, order status, name on card,
second line, last four digits, expiry, IBAN it pays from
account / chosen (ssssx): the account apps' checkouts pay from (net.catcrafts.Nostro1.Checkout),
as in Accounts; DefaultCheckoutAccount has none until one is chosen, or once
it is gone. An account reached through OAuth cannot pay a shop, and is refused.
Errors, besides org.freedesktop.DBus.Error.AccessDenied (refused, or polkit did not answer) and
org.freedesktop.DBus.Error.InteractiveAuthorizationRequired:
net.catcrafts.Nostro1.Error.InvalidArgument refused before anything was sent
net.catcrafts.Nostro1.Error.Cancelled the user did not authenticate: nothing was done
net.catcrafts.Nostro1.Error.Bank the bank's own refusal
net.catcrafts.Nostro1.Error.OAuthCannotPay an OAuth connection may only pay the user's own accounts
net.catcrafts.Nostro1.Error.NoCheckoutAccount (checkout) no account is chosen to pay checkouts from
net.catcrafts.Nostro1.Error.Failed anything else; a payment that failed this way may have been made -->
<node>
<interface name="net.catcrafts.Nostro1">
<method name="Connectors">
<arg type="a(ssssb)" name="connectors" direction="out"/>
<arg type="as" name="notes" direction="out"/>
</method>
<method name="AddBunq">
<arg type="s" name="apiKey" direction="in"/>
<arg type="s" name="allowedIps" direction="in"/>
<arg type="s" name="environment" direction="in"/>
<arg type="s" name="name" direction="out"/>
<arg type="s" name="addedEnvironment" direction="out"/>
<arg type="u" name="accounts" direction="out"/>
<arg type="as" name="notes" direction="out"/>
</method>
<method name="AddBunqOAuth">
<arg type="s" name="environment" direction="in"/>
<arg type="s" name="clientId" direction="in"/>
<arg type="s" name="clientSecret" direction="in"/>
<arg type="s" name="redirectUri" direction="in"/>
<arg type="s" name="code" direction="in"/>
<arg type="s" name="name" direction="out"/>
<arg type="s" name="addedEnvironment" direction="out"/>
<arg type="u" name="accounts" direction="out"/>
<arg type="as" name="notes" direction="out"/>
</method>
<method name="RemoveConnector">
<arg type="s" name="connector" direction="in"/>
<arg type="s" name="name" direction="out"/>
<arg type="as" name="notes" direction="out"/>
</method>
<method name="Accounts">
<arg type="a(ssa(ssssx))" name="connectors" direction="out"/>
<arg type="as" name="notes" direction="out"/>
</method>
<method name="Transactions">
<arg type="s" name="account" direction="in"/>
<arg type="a{sv}" name="query" direction="in"/>
<arg type="a(sssssxxss)" name="transactions" direction="out"/>
<arg type="as" name="notes" direction="out"/>
</method>
<method name="Send">
<arg type="s" name="account" direction="in"/>
<arg type="s" name="to" direction="in"/>
<arg type="s" name="name" direction="in"/>
<arg type="x" name="amount" direction="in"/>
<arg type="s" name="description" direction="in"/>
<arg type="t" name="id" direction="out"/>
<arg type="s" name="currency" direction="out"/>
<arg type="as" name="notes" direction="out"/>
</method>
<method name="Schedule">
<arg type="s" name="account" direction="in"/>
<arg type="s" name="to" direction="in"/>
<arg type="s" name="name" direction="in"/>
<arg type="x" name="amount" direction="in"/>
<arg type="s" name="description" direction="in"/>
<arg type="(xaxsusax)" name="schedule" direction="in"/>
<arg type="t" name="id" direction="out"/>
<arg type="s" name="currency" direction="out"/>
<arg type="as" name="notes" direction="out"/>
</method>
<method name="Request">
<arg type="s" name="account" direction="in"/>
<arg type="s" name="from" direction="in"/>
<arg type="s" name="name" direction="in"/>
<arg type="x" name="amount" direction="in"/>
<arg type="s" name="description" direction="in"/>
<arg type="(ts(ss)sxaxsxs)" name="request" direction="out"/>
<arg type="as" name="notes" direction="out"/>
</method>
<method name="Requests">
<arg type="s" name="account" direction="in"/>
<arg type="a(ts(ss)sxaxsxs)" name="requests" direction="out"/>
<arg type="as" name="notes" direction="out"/>
</method>
<method name="RevokeRequest">
<arg type="s" name="account" direction="in"/>
<arg type="t" name="id" direction="in"/>
<arg type="as" name="notes" direction="out"/>
</method>
<method name="IncomingRequests">
<arg type="s" name="account" direction="in"/>
<arg type="a(tss(ss)sxsx)" name="requests" direction="out"/>
<arg type="as" name="notes" direction="out"/>
</method>
<method name="RespondToRequest">
<arg type="s" name="account" direction="in"/>
<arg type="t" name="id" direction="in"/>
<arg type="b" name="accept" direction="in"/>
<arg type="as" name="notes" direction="out"/>
</method>
<method name="ScheduledPayments">
<arg type="s" name="account" direction="in"/>
<arg type="a(t(ss)sxs(xaxsusax))" name="scheduled" direction="out"/>
<arg type="as" name="notes" direction="out"/>
</method>
<method name="CancelScheduledPayment">
<arg type="s" name="account" direction="in"/>
<arg type="t" name="id" direction="in"/>
<arg type="as" name="notes" direction="out"/>
</method>
<method name="Draft">
<arg type="s" name="account" direction="in"/>
<arg type="s" name="to" direction="in"/>
<arg type="s" name="name" direction="in"/>
<arg type="x" name="amount" direction="in"/>
<arg type="s" name="description" direction="in"/>
<arg type="t" name="id" direction="out"/>
<arg type="s" name="currency" direction="out"/>
<arg type="as" name="notes" direction="out"/>
</method>
<method name="DraftPayments">
<arg type="s" name="account" direction="in"/>
<arg type="a(tssa((ss)sxs)s)" name="drafts" direction="out"/>
<arg type="as" name="notes" direction="out"/>
</method>
<method name="RespondToDraftPayment">
<arg type="s" name="account" direction="in"/>
<arg type="t" name="id" direction="in"/>
<arg type="b" name="accept" direction="in"/>
<arg type="as" name="notes" direction="out"/>
</method>
<method name="Cards">
<arg type="a(ssa(tsssssssss))" name="connectors" direction="out"/>
<arg type="as" name="notes" direction="out"/>
</method>
<method name="SetCardStatus">
<arg type="t" name="card" direction="in"/>
<arg type="s" name="status" direction="in"/>
<arg type="(tsssssssss)" name="updated" direction="out"/>
<arg type="as" name="notes" direction="out"/>
</method>
<method name="DefaultCheckoutAccount">
<arg type="a(ssssx)" name="account" direction="out"/>
<arg type="as" name="notes" direction="out"/>
</method>
<method name="SetDefaultCheckoutAccount">
<arg type="s" name="account" direction="in"/>
<arg type="(ssssx)" name="chosen" direction="out"/>
<arg type="as" name="notes" direction="out"/>
</method>
</interface>
</node>