refactor invoice required confirmations resolver to be more scalable for future confirmations based coins

This commit is contained in:
2026-09-03 11:45:30 +02:00
parent 932cbf64c1
commit 5c888551db
7 changed files with 89 additions and 21 deletions
@@ -17,14 +17,32 @@ describe('resolveInvoiceRequiredConfirmations', () => {
paymentMethod: PaymentMethod.Xmr,
moneroDetails: null
})
).toThrow('Invoice is missing Monero required confirmations');
).toThrow('Invoice is missing xmr required confirmations');
});
it('returns required confirmations for BTC invoices', () => {
expect(
resolveInvoiceRequiredConfirmations({
paymentMethod: PaymentMethod.Btc,
btcDetails: { requiredConfirmations: 6 }
})
).toBe(6);
});
it('throws when bitcoin details are missing', () => {
expect(() =>
resolveInvoiceRequiredConfirmations({
paymentMethod: PaymentMethod.Btc,
btcDetails: null
})
).toThrow('Invoice is missing btc required confirmations');
});
it('throws for unsupported payment methods', () => {
expect(() =>
resolveInvoiceRequiredConfirmations({
paymentMethod: 'btc' as PaymentMethod
paymentMethod: 'eth' as PaymentMethod
})
).toThrow('Unsupported payment method: btc');
).toThrow('Invoice is missing eth required confirmations');
});
});