( recordedCost: number, incomingCost: number )
| 390 | * over-billing, independent of arrival order. |
| 391 | */ |
| 392 | export function resolveCumulativeTopUp( |
| 393 | recordedCost: number, |
| 394 | incomingCost: number |
| 395 | ): { shouldBill: boolean; delta: number; newTotal: number } { |
| 396 | if (incomingCost <= recordedCost + CUMULATIVE_COST_EPSILON) { |
| 397 | return { shouldBill: false, delta: 0, newTotal: recordedCost } |
| 398 | } |
| 399 | return { shouldBill: true, delta: incomingCost - recordedCost, newTotal: incomingCost } |
| 400 | } |
| 401 | |
| 402 | export interface RecordCumulativeUsageParams { |
| 403 | userId: string |
no outgoing calls
no test coverage detected