PricingEngine::get_cost_by_amount only prices VM-backed subscriptions (it looks up the VM's template/custom pricing). Callers that need to turn an arbitrary paid amount into time for a non-VM subscription (e.g. IP range, DNS, ASN line items) have no equivalent.
Current workaround: the on-chain payment watcher (lnvps_api/src/payments/onchain.rs, OnChainPaymentHandler::regenerate) falls back to scaling the payment's original quote by the value received at the current exchange rate when get_vm_by_subscription fails. This works but re-uses stale quote pricing instead of current line-item pricing.
Proposal: add a subscription-level equivalent, e.g.
PricingEngine::get_subscription_cost_by_amount(
subscription_id: u64,
input: CurrencyAmount,
method: PaymentMethod,
) -> Result<CostResult>
priced from the subscription's line-item amounts and billing interval (interval_amount / interval_type), with the same tax determination and processing-fee handling as the VM path. Then:
- the on-chain watcher can drop its quote-scaling fallback and regenerate all payments uniformly
- LNURL-style ad-hoc top-ups become possible for non-VM subscriptions
Related: #109 (on-chain payments, where the fallback was introduced — see PR #180).
PricingEngine::get_cost_by_amountonly prices VM-backed subscriptions (it looks up the VM's template/custom pricing). Callers that need to turn an arbitrary paid amount into time for a non-VM subscription (e.g. IP range, DNS, ASN line items) have no equivalent.Current workaround: the on-chain payment watcher (
lnvps_api/src/payments/onchain.rs,OnChainPaymentHandler::regenerate) falls back to scaling the payment's original quote by the value received at the current exchange rate whenget_vm_by_subscriptionfails. This works but re-uses stale quote pricing instead of current line-item pricing.Proposal: add a subscription-level equivalent, e.g.
priced from the subscription's line-item amounts and billing interval (
interval_amount/interval_type), with the same tax determination and processing-fee handling as the VM path. Then:Related: #109 (on-chain payments, where the fallback was introduced — see PR #180).