Stundenkonto: Abos ohne bekannten Preis bekommen als Altbestand weiter ihre Stunde
Wie im Abo-Spiegel gelten Rechnungen ohne jeden bekannten Abo-Preis als Wartung. Ein unbekannter Preis neben einem bekannten (z. B. Hosting) bringt weiterhin keine Stunde. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
51fc2434e5
commit
dc61649228
3 files changed
+38
-7
No files matched your search
@@ -93,8 +93,26 @@ test('Preis-Zuordnung wird zwischengespeichert', async () => {
|
||||
assert.equal(st.calls.filter((c) => c.path === '/v1/prices/price_w').length, 1)
|
||||
})
|
||||
|
||||
test('Unbekannte Preis-ID (404): keine Stunde, kein Absturz', async () => {
|
||||
st.invoices.set('in_5', inv('in_5', 'sub_w', [regular('price_weg', 5000)]))
|
||||
assert.deepEqual(await grantCreditForInvoice(payload('in_5', 'sub_w', 5000)), { skipped: 'keine Wartungs-Leistung' })
|
||||
test('Unbekannte Preis-ID (404) neben Hosting: keine Stunde, kein Absturz', async () => {
|
||||
st.invoices.set('in_5', inv('in_5', 'sub_h', [regular('price_h', 1500), regular('price_weg', 800)]))
|
||||
assert.deepEqual(await grantCreditForInvoice(payload('in_5', 'sub_h', 2300)), { skipped: 'keine Wartungs-Leistung' })
|
||||
assert.equal(aw.docs('hourCredits').has('in_5'), false)
|
||||
})
|
||||
|
||||
test('Altbestand: Abo ohne bekannten Preis bekommt weiter seine Stunde, auch bei alter Nutzlast', async () => {
|
||||
st.prices.set('price_alt', price('price_alt', null, 5000))
|
||||
st.subscriptions.set('sub_alt', sub('sub_alt', st.prices.get('price_alt')))
|
||||
st.invoices.set('in_6', inv('in_6', 'sub_alt', [regular('price_alt', 5000)]))
|
||||
const oldPayload = {
|
||||
id: 'in_6',
|
||||
subscription: 'sub_alt',
|
||||
subtotal: 5000,
|
||||
created: 1790000000,
|
||||
status_transitions: { paid_at: 1790000100 },
|
||||
lines: { data: [{ amount: 5000, price: { id: 'price_alt' }, proration: false }] },
|
||||
}
|
||||
const r = await grantCreditForInvoice(oldPayload)
|
||||
assert.equal(r.granted, true)
|
||||
assert.equal(aw.docs('hourCredits').get('in_6').minutes, 60)
|
||||
assert.equal(aw.docs('subscriptions').get('sub_alt').productKey, 'wartung')
|
||||
})
|
||||
Reference in new issue
Block a user