Hosting-Abo: Preis 15 € -> 20 € pro Monat (Vertragsbedingungen v4, Katalog, Leitfaden)
- server/config.js: amountCents 2000, lookup_key webklar_hosting_monatlich_2000 - ensurePrice haengt einen neuen Preis an das vorhandene Stripe-Produkt (metadata.webklar), statt ein zweites "WEBklar Hosting-Abo" anzulegen - abo-bedingungen.html (Uebersicht, Preise, Leistungsbeschreibung) + PDF, Leitfaden + PDF - Tests auf 20 € umgestellt (399/399) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
78b4d7b7fe
commit
e4efdac226
18 files changed
+79
-59
No files matched your search
@@ -51,12 +51,12 @@ test('Setup-Skript legt productKey an', () => {
|
||||
test('Spiegel: Hosting-Abo, Zusatzspeicher steht vorne', async () => {
|
||||
st.subscriptions.set(
|
||||
'sub_h',
|
||||
sub('sub_h', [item('s', 'webklar_mailspeicher_5gb_monatlich_100', 100, 2), item('h', 'webklar_hosting_monatlich_1500', 1500)])
|
||||
sub('sub_h', [item('s', 'webklar_mailspeicher_5gb_monatlich_100', 100, 2), item('h', 'webklar_hosting_monatlich_2000', 2000)])
|
||||
)
|
||||
const doc = await syncSubscription('sub_h')
|
||||
assert.equal(doc.productKey, 'hosting')
|
||||
assert.equal(doc.planKey, 'webklar_hosting_monatlich_1500')
|
||||
assert.equal(doc.priceAmount, 1500)
|
||||
assert.equal(doc.planKey, 'webklar_hosting_monatlich_2000')
|
||||
assert.equal(doc.priceAmount, 2000)
|
||||
})
|
||||
|
||||
test('Spiegel: Wartungs-Abo wie bisher', async () => {
|
||||
@@ -105,8 +105,8 @@ test('ensurePrice legt Hosting einmal an: Preis- und Produktfelder, Bild', async
|
||||
const calls = st.calls.slice(before)
|
||||
const createdPrices = calls.filter((c) => c.method === 'POST' && c.path === '/v1/prices')
|
||||
assert.equal(createdPrices.length, 1)
|
||||
assert.equal(createdPrices[0].body['lookup_key'], 'webklar_hosting_monatlich_1500')
|
||||
assert.equal(createdPrices[0].body['unit_amount'], '1500')
|
||||
assert.equal(createdPrices[0].body['lookup_key'], 'webklar_hosting_monatlich_2000')
|
||||
assert.equal(createdPrices[0].body['unit_amount'], '2000')
|
||||
assert.equal(createdPrices[0].body['tax_behavior'], 'inclusive')
|
||||
assert.equal(createdPrices[0].body['recurring[interval]'], 'month')
|
||||
const createdProducts = calls.filter((c) => c.method === 'POST' && c.path === '/v1/products')
|
||||
@@ -116,6 +116,18 @@ test('ensurePrice legt Hosting einmal an: Preis- und Produktfelder, Bild', async
|
||||
assert.equal(createdProducts[0].body['images[0]'], config.stripe.productImage)
|
||||
})
|
||||
|
||||
// Preisaenderung (Hosting 15 -> 20 EUR): neuer Preis haengt am vorhandenen Produkt, kein zweites Produkt
|
||||
test('ensurePrice: neuer Preis fuer vorhandenes Produkt legt kein zweites Produkt an', async () => {
|
||||
st.products.set('prod_alt_speicher', { id: 'prod_alt_speicher', object: 'product', active: true, name: 'WEBklar E-Mail-Zusatzspeicher 5 GB', images: [], metadata: { webklar: 'mail-speicher' } })
|
||||
const before = st.calls.length
|
||||
await ensurePrice('mailStorage')
|
||||
const calls = st.calls.slice(before)
|
||||
assert.equal(calls.filter((c) => c.method === 'POST' && c.path === '/v1/products').length, 0)
|
||||
const created = calls.filter((c) => c.method === 'POST' && c.path === '/v1/prices')
|
||||
assert.equal(created.length, 1)
|
||||
assert.equal(created[0].body['product'], 'prod_alt_speicher')
|
||||
})
|
||||
|
||||
// Important 4: ein bereits vorhandener aktiver Preis wird gefunden, nichts wird bei Stripe angelegt
|
||||
test('ensurePrice: vorhandener aktiver Preis wird gefunden, nichts wird angelegt', async () => {
|
||||
st.prices.set('price_seeded_wartung', {
|
||||
@@ -157,11 +169,11 @@ test('Stripe-Nachbau: Grenzen bei Preisen und Coupons (400)', async () => {
|
||||
})
|
||||
|
||||
// Important 1: Namen ≤ 40 Zeichen (Stripe-Limit; die alten Namen mit dem vollen Produktnamen waren 49/50)
|
||||
test('Testrabatt Hosting: 14,50 € Nachlass, Name ≤ 40 Zeichen', async () => {
|
||||
test('Testrabatt Hosting: 19,50 € Nachlass, Name ≤ 40 Zeichen', async () => {
|
||||
const before = st.calls.length
|
||||
assert.equal(await ensureTestCoupon('hosting'), 'WEBKLAR-TEST-050-HOSTING')
|
||||
const call = st.calls.slice(before).find((c) => c.path === '/v1/coupons' && c.method === 'POST')
|
||||
assert.equal(call.body['amount_off'], '1450')
|
||||
assert.equal(call.body['amount_off'], '1950')
|
||||
assert.equal(call.body['name'], 'Testzugang Hosting (0,50 €)')
|
||||
assert.ok(call.body['name'].length <= 40)
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user