feat: configurable fee rates via VITE_CASH_IN_FEE and VITE_CASH_OUT_FEE
Accepts percentage (5.55) or decimal (0.0555) — auto-detected by whether the value is >= 1. Defaults to 3.33% cash-in, 7.77% cash-out. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
cc109b2958
commit
2a2faf41ef
4 changed files with 31 additions and 3 deletions
|
|
@ -20,7 +20,7 @@ import {
|
|||
*/
|
||||
export function createATMMachine(
|
||||
services: Partial<ATMServices> = {},
|
||||
options?: { currency?: string }
|
||||
options?: { currency?: string; cashInFeeRate?: number; cashOutFeeRate?: number }
|
||||
) {
|
||||
return setup({
|
||||
types: {
|
||||
|
|
@ -401,7 +401,14 @@ export function createATMMachine(
|
|||
}).createMachine({
|
||||
id: 'atm',
|
||||
initial: 'idle',
|
||||
context: { ...initialContext, ...(options?.currency ? { currency: options.currency } : {}) },
|
||||
context: {
|
||||
...initialContext,
|
||||
...(options?.currency ? { currency: options.currency } : {}),
|
||||
...(options?.cashInFeeRate !== undefined ? { cashInFeePercent: options.cashInFeeRate } : {}),
|
||||
...(options?.cashOutFeeRate !== undefined
|
||||
? { cashOutFeePercent: options.cashOutFeeRate }
|
||||
: {}),
|
||||
},
|
||||
states: {
|
||||
idle: {
|
||||
entry: 'resetContext',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue