Finance parties and verified bank accounts
Vendors and customers in Petawork Finance, the near-duplicate check, bank accounts sealed in the vault and verified by a second person, what is never shown, and how a number is revealed.
A party is someone Finance pays or bills: a vendor, a customer, or both. Every bill, payment run and invoice the
modules add later points at a party, and money only ever goes to a party's verified bank account. Parties live in
Finance > Parties (/finance/parties); one party opens at /finance/parties/view?id=….
Vendors and customers
A party has a kind (vendor, customer or both), a name, and optionally:
| Field | What it is |
|---|---|
legal_name, tax_id |
The registered name and the tax or company registration number. |
country, default_currency |
ISO codes, like SG and SGD. |
payment_terms_days |
Days to pay, 0 to 365 (default 30). |
early_discount_bps, early_discount_days |
An early payment discount in basis points (200 is 2%) and how many days it lasts. The days may not be more than the terms. |
entity_id |
The entity the party belongs to, or none for a party the whole group shares. |
company_id |
A link to a company in Petawork People, when your organisation has People and you can open it. The control is hidden otherwise. |
external_ref |
Its id in your accounting system. |
| contacts | Billing and remittance contacts: a name, an email address and, optionally, the language to write to them in (one of Petawork's seven). |
A party is visible to members whose Finance roles read parties on its entity. A shared party is visible to anyone who reads parties on some entity, and changing it needs a role on every entity. A party on an entity you cannot see answers exactly as an unknown id would.
Status
| Status | Meaning |
|---|---|
draft |
New, not checked yet. |
pending_verification |
Submitted for someone to check. |
verified |
Someone with parties.verify (vendor_admin or controller) checked it. Never the person who created it. |
blocked |
Stopped, with a reason. Unblocking puts it back to draft and needs parties.verify. |
Changing the name, legal name, tax id or country of a verified party sends it back to pending_verification.
Near-duplicates
When you add a party, or rename one, Petawork looks for another party in your organisation with the same normalised
name or the same normalised tax id. If it finds one, nothing is saved: the answer lists the candidates you can see
(and says how many more are on entities you cannot see). Use the existing party, or send confirm_duplicate: true (in
the app, tick "Add even if it looks like an existing party") to add it anyway. The event records that it was confirmed.
A name is normalised by:
- lower case, with accents dropped (
Müllerismuller); - dots removed, so
L.L.C.isllcandPte.ispte;&read asand; - any other punctuation turned into a space, and spaces collapsed;
- these legal forms taken off the end, as often as they appear: Pte Ltd, Pty Ltd, Sdn Bhd, Co Ltd, Private Limited, Public Limited Company, Ltd, Limited, LLC, LLP, LP, Inc, Incorporated, Corp, Corporation, Co, Company, PLC, Pte, Pty, Bhd, Berhad, Tbk, GmbH, AG, KG, UG, SA, SAS, SARL, BV, NV, SRL, SpA, SL, KK, Oy, AB, AS, ApS;
- PT and CV taken off the front.
So Harbour Linen Pte. Ltd., HARBOUR LINEN and harbour-linen are the same. A name that is only a legal form
(Ltd) keeps it. A tax id is normalised to its letters and digits in upper case, so 201912345-k and 201912345K
match.
Bank accounts and two-person verification
A party's bank account has a bank name, a bank code (SWIFT/BIC, sort code or bank and branch code), the name on the
account, the account number and a currency. Adding or changing one needs bank_account.create on the party's entity,
which vendor_admin and controller have.
- A new account starts
pending. - It is verified by a different person, holding
bank_account.verify(vendor_admin or controller) on that entity, after checking the details with the party by a call-back. The person who added or last changed the account can never verify it, and an agent and the member who configured it count as one person. The database refuses it too. - Changing any detail of an account never edits it: the old account is retired and a new pending one points back
at it (
replaces_id), in one step. Leave a detail out and it is kept, the number included. The new one needs verifying again. - Retiring an account is explicit too, and kept with who retired it and when.
- Payments only ever uses a verified account of a party that is not blocked.
If the same account number at the same bank is already on another party, the account is still added, the answer
carries a flag bank_account_reused naming the other parties you can see, and a high severity bank_account_reused
exception about the new account goes on the exceptions queue (module core), in the same step. Adding
it again while that exception is open does not make a second one.
Who changed bank details and when is kept on the account (changed_by, changed_at). The segregation rule for
payments reads it: whoever changed a vendor's bank details may not approve or release a payment to that vendor for 30
days (see Finance roles).
What is sealed
The account number is sealed in the vault (ADR 0028) the moment it arrives, bound to its own account record, so it cannot be moved to another record or opened under another organisation. Petawork keeps two things beside it:
- the last four characters, which is all any page, tool answer, list or event ever shows;
- a fingerprint for the duplicate check: an HMAC-SHA256 of the number and bank code (spaces and dashes removed, upper case) under a key of your organisation's own, itself sealed in the vault. Without that key the fingerprint says nothing about the number, however short the number is.
The full number is never written to a log, the event chain or the audit log, and never returned by any tool but the reveal below.
A cloud with no vault (VENOM_VAULT_KEYS unset) cannot keep bank details: every bank account tool answers 503
vault_not_configured and stores nothing. Parties without bank accounts still work.
Revealing a number
To read the number back to the party during a call-back, a member with bank_account.verify on the party's entity
(vendor_admin or controller) presses Reveal on the account, or calls finance_partybank_reveal. The number shows
for a minute. Every reveal is its own event on the chain and a row in the audit log: who, which account and its last
four characters, never the number. An agent can never reveal, add, change or verify bank details, or verify a party.
For agents
| Tool | Scope | What it does |
|---|---|---|
finance_party_create |
finance:write |
Add a vendor or customer, with contacts. A near-duplicate is refused with the candidates unless confirm_duplicate |
finance_party_get |
finance:read |
One party with its contacts, its bank accounts (last four and status only) and its People company |
finance_party_list |
finance:read |
Parties by name; query, kind, status, entity_id (or "shared") narrow it |
finance_party_update |
finance:write |
Change fields or contacts, submit, block with a reason, unblock |
finance_party_verify |
finance:write |
Verify a party: parties.verify, never its creator, never an agent |
finance_partybank_create |
finance:write |
Add a bank account (pending), or change one with replaces_id |
finance_partybank_verify |
finance:write |
Verify a pending account: another person with vendor_admin, never an agent |
finance_partybank_retire |
finance:write |
Retire an account |
finance_partybank_reveal |
finance:write |
The full number, recorded as an event; vendor_admin or controller, never an agent |
Every tool here is finance:write rather than finance:admin: parties are day-to-day work, and what keeps bank details
safe is who acts (the Finance role on the party's entity, the two-person rule, no agent), checked on every call. The
reveal counts as a write because it is recorded, so a read-only key never reveals.
REST twins: GET/POST /api/v1/finance/parties, GET/PATCH /api/v1/finance/parties/{id},
POST /api/v1/finance/parties/{id}/verify, POST /api/v1/finance/party-bank-accounts, and
POST /api/v1/finance/party-bank-accounts/{id}/verify, …/retire and …/reveal. With no vault the bank account
routes answer 503.