kron in the stack: the money service, Vipps ePayment for Medlemskap
Under the pay profile: kron.env from the Medlemskap sales unit's keys, PAY_URL for portal once the profile is on, betaling.tomtervel.no in DNS and kasse's Caddy, and vipps-webhook.sh for the one-time webhook registration whose secret must never reach a public log. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
7 files changed
+171
-1
No files matched your search
@@ -124,6 +124,10 @@ Run workflow**. Set them with `gt` (`gt variable set NAME --body ...`,
|
||||
| `RAUTHY_BOOTSTRAP_API_KEY`, `RAUTHY_BOOTSTRAP_API_KEY_SECRET` | secret | repo | optional, Rauthy's first start only: a short-lived key (base64 of `{"name","exp","access"}`, secret 64+ alphanumerics) that makes the OIDC clients through the API; read into an empty database, ignored after |
|
||||
| `RAUTHY_API_KEY`, `RAUTHY_LANGUAGE` | secret, variable | repo | portal makes accounts in Rauthy (`<name>$<secret>`, made in Rauthy's admin), in `nb` |
|
||||
| `VIPPS_LOGIN_CLIENT_ID`, `VIPPS_LOGIN_CLIENT_SECRET` | variable, secret | repo | Vipps Login (the login sales unit's keys from portal.vippsmobilepay.no): the deploy keeps Vipps as a sign-in provider in Rauthy with them (`rauthy-providers.sh`) |
|
||||
| `PAY_HOST` | variable | repo | where the money service answers: `betaling.tomtervel.no` (DNS in `dns/`, a kasse Caddy block) |
|
||||
| `VIPPS_MSN` | variable | repo | the Medlemskap sales unit's merchant serial number, `1192072` |
|
||||
| `VIPPS_CLIENT_ID`, `VIPPS_CLIENT_SECRET`, `VIPPS_SUBSCRIPTION_KEY` | secret | repo | the Medlemskap sales unit's ePayment keys (For developers, API keys, production), read by kron alone |
|
||||
| `VIPPS_WEBHOOK_SECRET` | secret | repo | what Vipps signs its webhooks with, from `vipps-webhook.sh register`; unset, kron refuses webhooks and asks Vipps about each open payment every minute instead |
|
||||
|
||||
A variable is printed wherever a workflow echoes it, and this repo's run
|
||||
logs are public: a value that must not be read is a secret.
|
||||
@@ -131,6 +135,44 @@ logs are public: a value that must not be read is a secret.
|
||||
What is not a value stays on the host, made there once: Garage's node
|
||||
secret.
|
||||
|
||||
## Payments
|
||||
|
||||
The money service is [kron](https://project.uhhm.no/uhhm/kron), in the
|
||||
stack under the `pay` profile (`COMPOSE_PROFILES=chat,pay`). Portal
|
||||
decides when money is owed: a household entering `open` or `fornyes` in
|
||||
the content's aggregates owes the fee, and portal publishes one request
|
||||
on this stack's NATS. kron answers at once with a link of its own,
|
||||
`https://betaling.tomtervel.no/pay/<reference>`, which portal shows on
|
||||
the person's own page and mails; opening it makes a Vipps payment for
|
||||
the Medlemskap sales unit and sends the person into Vipps, and a fresh
|
||||
one each time the last ran out (Vipps's own expire after ten minutes).
|
||||
Once they have paid, kron captures the reserved amount and says `paid`
|
||||
on the bus; portal moves the household to `betalt`, grants `medlemmer`,
|
||||
and mails them. Vipps's keys live in `kron.env` and nowhere else; portal
|
||||
never calls Vipps. `PAY_URL` in `portal.env` is what lets the content
|
||||
leave `by_hand: true` out of a `payment:`; portal never calls that
|
||||
address either.
|
||||
|
||||
Going live, in order:
|
||||
|
||||
1. Set `PAY_HOST`, `VIPPS_MSN` and the three key secrets (table above).
|
||||
The keys are in `pass` as `tomtervel/vipps/medlemskap`.
|
||||
2. Merge the DNS record (`dns/dnsconfig.js`, `betaling`) and run the DNS
|
||||
workflow; add the `betaling.tomtervel.no` block from
|
||||
`host-caddy/tomtervel.no` to kasse's Caddy.
|
||||
3. Set `COMPOSE_PROFILES=chat,pay` and `KRON_RELEASE` (a bendik/kron
|
||||
tag), then Run workflow. `https://betaling.tomtervel.no/healthz`
|
||||
answers `ok`.
|
||||
4. Register the webhook: `./vipps-webhook.sh register` on a machine with
|
||||
`pass` (it puts the secret in pass), then `gt secret set
|
||||
VIPPS_WEBHOOK_SECRET` as it says, and Run workflow once more. Until
|
||||
then kron settles by polling, a minute behind.
|
||||
5. Drop `by_hand: true` from the content's `payment:` states (the
|
||||
content repo's lint reads `PAY_URL` the same way).
|
||||
|
||||
Nothing here touches the Vippsnummer (500396): people may keep paying
|
||||
there, and the treasurer marks those by hand as before.
|
||||
|
||||
## Rauthy
|
||||
|
||||
[Rauthy](https://github.com/sebadob/rauthy) at `RAUTHY_HOST`
|
||||
|
||||
Reference in new issue
Block a user