aboutsummaryrefslogtreecommitdiffstats
path: root/names/server.js
diff options
context:
space:
mode:
Diffstat (limited to 'names/server.js')
-rw-r--r--names/server.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/names/server.js b/names/server.js
index 9b57ce7..6cd82a1 100644
--- a/names/server.js
+++ b/names/server.js
@@ -938,7 +938,12 @@ Bun.serve({
return json({ ok: true, revoked: n });
}
const token = posMintToken(key, body.currency);
- return json({ token, name, domain, currency: posTokens()[token].currency });
+ // Currency is the merchant's, not the token's: a new token in CAD moves
+ // the terminals already paired to this name to CAD as well.
+ const { currency } = posTokens()[token];
+ for (const v of Object.values(posTokens())) if (v.key === key) v.currency = currency;
+ persist();
+ return json({ token, name, domain, currency });
}
// Operator bootstrap: mint a terminal token for any name.
if (url.pathname === '/admin/pos/token' && req.method === 'POST') {