@wopr-network/platform-core 1.44.1 → 1.45.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/billing/payment-processor.d.ts +2 -0
- package/dist/billing/stripe/stripe-payment-processor.js +1 -0
- package/dist/billing/stripe/stripe-payment-processor.test.js +15 -1
- package/dist/monetization/stripe/stripe-payment-processor.js +1 -0
- package/dist/monetization/stripe/stripe-payment-processor.test.js +15 -1
- package/package.json +1 -1
- package/src/billing/payment-processor.ts +2 -0
- package/src/billing/stripe/stripe-payment-processor.test.ts +15 -1
- package/src/billing/stripe/stripe-payment-processor.ts +1 -0
- package/src/monetization/stripe/stripe-payment-processor.test.ts +15 -1
- package/src/monetization/stripe/stripe-payment-processor.ts +1 -0
|
@@ -210,6 +210,7 @@ describe("StripePaymentProcessor", () => {
|
|
|
210
210
|
amount_due: 500,
|
|
211
211
|
status: "paid",
|
|
212
212
|
invoice_pdf: "https://stripe.com/invoice.pdf",
|
|
213
|
+
hosted_invoice_url: "https://invoice.stripe.com/i/in_1",
|
|
213
214
|
},
|
|
214
215
|
{
|
|
215
216
|
id: "in_2",
|
|
@@ -217,6 +218,7 @@ describe("StripePaymentProcessor", () => {
|
|
|
217
218
|
amount_due: 1000,
|
|
218
219
|
status: "open",
|
|
219
220
|
invoice_pdf: null,
|
|
221
|
+
hosted_invoice_url: "https://invoice.stripe.com/i/in_2",
|
|
220
222
|
},
|
|
221
223
|
],
|
|
222
224
|
});
|
|
@@ -228,6 +230,7 @@ describe("StripePaymentProcessor", () => {
|
|
|
228
230
|
amountCents: 500,
|
|
229
231
|
status: "paid",
|
|
230
232
|
downloadUrl: "https://stripe.com/invoice.pdf",
|
|
233
|
+
hostedUrl: "https://invoice.stripe.com/i/in_1",
|
|
231
234
|
},
|
|
232
235
|
{
|
|
233
236
|
id: "in_2",
|
|
@@ -235,6 +238,7 @@ describe("StripePaymentProcessor", () => {
|
|
|
235
238
|
amountCents: 1000,
|
|
236
239
|
status: "open",
|
|
237
240
|
downloadUrl: "",
|
|
241
|
+
hostedUrl: "https://invoice.stripe.com/i/in_2",
|
|
238
242
|
},
|
|
239
243
|
]);
|
|
240
244
|
expect(mocks.stripe.invoices.list).toHaveBeenCalledWith({
|
|
@@ -245,10 +249,20 @@ describe("StripePaymentProcessor", () => {
|
|
|
245
249
|
it("uses 'unknown' when invoice status is null", async () => {
|
|
246
250
|
vi.mocked(mocks.tenantRepo.getByTenant).mockResolvedValue(makeTenantRow());
|
|
247
251
|
vi.mocked(mocks.stripe.invoices.list).mockResolvedValue({
|
|
248
|
-
data: [
|
|
252
|
+
data: [
|
|
253
|
+
{
|
|
254
|
+
id: "in_3",
|
|
255
|
+
created: 1700000000,
|
|
256
|
+
amount_due: 100,
|
|
257
|
+
status: null,
|
|
258
|
+
invoice_pdf: null,
|
|
259
|
+
hosted_invoice_url: null,
|
|
260
|
+
},
|
|
261
|
+
],
|
|
249
262
|
});
|
|
250
263
|
const result = await processor.listInvoices("tenant-1");
|
|
251
264
|
expect(result[0].status).toBe("unknown");
|
|
265
|
+
expect(result[0].hostedUrl).toBe("");
|
|
252
266
|
});
|
|
253
267
|
});
|
|
254
268
|
// --- charge ---
|
|
@@ -216,6 +216,7 @@ describe("StripePaymentProcessor", () => {
|
|
|
216
216
|
amount_due: 500,
|
|
217
217
|
status: "paid",
|
|
218
218
|
invoice_pdf: "https://stripe.com/invoice.pdf",
|
|
219
|
+
hosted_invoice_url: "https://invoice.stripe.com/i/in_1",
|
|
219
220
|
},
|
|
220
221
|
{
|
|
221
222
|
id: "in_2",
|
|
@@ -223,6 +224,7 @@ describe("StripePaymentProcessor", () => {
|
|
|
223
224
|
amount_due: 1000,
|
|
224
225
|
status: "open",
|
|
225
226
|
invoice_pdf: null,
|
|
227
|
+
hosted_invoice_url: "https://invoice.stripe.com/i/in_2",
|
|
226
228
|
},
|
|
227
229
|
],
|
|
228
230
|
});
|
|
@@ -234,6 +236,7 @@ describe("StripePaymentProcessor", () => {
|
|
|
234
236
|
amountCents: 500,
|
|
235
237
|
status: "paid",
|
|
236
238
|
downloadUrl: "https://stripe.com/invoice.pdf",
|
|
239
|
+
hostedUrl: "https://invoice.stripe.com/i/in_1",
|
|
237
240
|
},
|
|
238
241
|
{
|
|
239
242
|
id: "in_2",
|
|
@@ -241,6 +244,7 @@ describe("StripePaymentProcessor", () => {
|
|
|
241
244
|
amountCents: 1000,
|
|
242
245
|
status: "open",
|
|
243
246
|
downloadUrl: "",
|
|
247
|
+
hostedUrl: "https://invoice.stripe.com/i/in_2",
|
|
244
248
|
},
|
|
245
249
|
]);
|
|
246
250
|
expect(mocks.stripe.invoices.list).toHaveBeenCalledWith({
|
|
@@ -251,10 +255,20 @@ describe("StripePaymentProcessor", () => {
|
|
|
251
255
|
it("uses 'unknown' when invoice status is null", async () => {
|
|
252
256
|
vi.mocked(mocks.tenantRepo.getByTenant).mockResolvedValue(makeTenantRow());
|
|
253
257
|
vi.mocked(mocks.stripe.invoices.list).mockResolvedValue({
|
|
254
|
-
data: [
|
|
258
|
+
data: [
|
|
259
|
+
{
|
|
260
|
+
id: "in_3",
|
|
261
|
+
created: 1700000000,
|
|
262
|
+
amount_due: 100,
|
|
263
|
+
status: null,
|
|
264
|
+
invoice_pdf: null,
|
|
265
|
+
hosted_invoice_url: null,
|
|
266
|
+
},
|
|
267
|
+
],
|
|
255
268
|
});
|
|
256
269
|
const result = await processor.listInvoices("tenant-1");
|
|
257
270
|
expect(result[0].status).toBe("unknown");
|
|
271
|
+
expect(result[0].hostedUrl).toBe("");
|
|
258
272
|
});
|
|
259
273
|
});
|
|
260
274
|
// --- charge ---
|
package/package.json
CHANGED
|
@@ -263,6 +263,7 @@ describe("StripePaymentProcessor", () => {
|
|
|
263
263
|
amount_due: 500,
|
|
264
264
|
status: "paid",
|
|
265
265
|
invoice_pdf: "https://stripe.com/invoice.pdf",
|
|
266
|
+
hosted_invoice_url: "https://invoice.stripe.com/i/in_1",
|
|
266
267
|
},
|
|
267
268
|
{
|
|
268
269
|
id: "in_2",
|
|
@@ -270,6 +271,7 @@ describe("StripePaymentProcessor", () => {
|
|
|
270
271
|
amount_due: 1000,
|
|
271
272
|
status: "open",
|
|
272
273
|
invoice_pdf: null,
|
|
274
|
+
hosted_invoice_url: "https://invoice.stripe.com/i/in_2",
|
|
273
275
|
},
|
|
274
276
|
],
|
|
275
277
|
} as unknown as Stripe.Response<Stripe.ApiList<Stripe.Invoice>>);
|
|
@@ -282,6 +284,7 @@ describe("StripePaymentProcessor", () => {
|
|
|
282
284
|
amountCents: 500,
|
|
283
285
|
status: "paid",
|
|
284
286
|
downloadUrl: "https://stripe.com/invoice.pdf",
|
|
287
|
+
hostedUrl: "https://invoice.stripe.com/i/in_1",
|
|
285
288
|
},
|
|
286
289
|
{
|
|
287
290
|
id: "in_2",
|
|
@@ -289,6 +292,7 @@ describe("StripePaymentProcessor", () => {
|
|
|
289
292
|
amountCents: 1000,
|
|
290
293
|
status: "open",
|
|
291
294
|
downloadUrl: "",
|
|
295
|
+
hostedUrl: "https://invoice.stripe.com/i/in_2",
|
|
292
296
|
},
|
|
293
297
|
]);
|
|
294
298
|
expect(mocks.stripe.invoices.list).toHaveBeenCalledWith({
|
|
@@ -300,11 +304,21 @@ describe("StripePaymentProcessor", () => {
|
|
|
300
304
|
it("uses 'unknown' when invoice status is null", async () => {
|
|
301
305
|
vi.mocked(mocks.tenantRepo.getByTenant).mockResolvedValue(makeTenantRow());
|
|
302
306
|
vi.mocked(mocks.stripe.invoices.list).mockResolvedValue({
|
|
303
|
-
data: [
|
|
307
|
+
data: [
|
|
308
|
+
{
|
|
309
|
+
id: "in_3",
|
|
310
|
+
created: 1700000000,
|
|
311
|
+
amount_due: 100,
|
|
312
|
+
status: null,
|
|
313
|
+
invoice_pdf: null,
|
|
314
|
+
hosted_invoice_url: null,
|
|
315
|
+
},
|
|
316
|
+
],
|
|
304
317
|
} as unknown as Stripe.Response<Stripe.ApiList<Stripe.Invoice>>);
|
|
305
318
|
|
|
306
319
|
const result = await processor.listInvoices("tenant-1");
|
|
307
320
|
expect(result[0].status).toBe("unknown");
|
|
321
|
+
expect(result[0].hostedUrl).toBe("");
|
|
308
322
|
});
|
|
309
323
|
});
|
|
310
324
|
|
|
@@ -272,6 +272,7 @@ describe("StripePaymentProcessor", () => {
|
|
|
272
272
|
amount_due: 500,
|
|
273
273
|
status: "paid",
|
|
274
274
|
invoice_pdf: "https://stripe.com/invoice.pdf",
|
|
275
|
+
hosted_invoice_url: "https://invoice.stripe.com/i/in_1",
|
|
275
276
|
},
|
|
276
277
|
{
|
|
277
278
|
id: "in_2",
|
|
@@ -279,6 +280,7 @@ describe("StripePaymentProcessor", () => {
|
|
|
279
280
|
amount_due: 1000,
|
|
280
281
|
status: "open",
|
|
281
282
|
invoice_pdf: null,
|
|
283
|
+
hosted_invoice_url: "https://invoice.stripe.com/i/in_2",
|
|
282
284
|
},
|
|
283
285
|
],
|
|
284
286
|
} as unknown as Stripe.Response<Stripe.ApiList<Stripe.Invoice>>);
|
|
@@ -291,6 +293,7 @@ describe("StripePaymentProcessor", () => {
|
|
|
291
293
|
amountCents: 500,
|
|
292
294
|
status: "paid",
|
|
293
295
|
downloadUrl: "https://stripe.com/invoice.pdf",
|
|
296
|
+
hostedUrl: "https://invoice.stripe.com/i/in_1",
|
|
294
297
|
},
|
|
295
298
|
{
|
|
296
299
|
id: "in_2",
|
|
@@ -298,6 +301,7 @@ describe("StripePaymentProcessor", () => {
|
|
|
298
301
|
amountCents: 1000,
|
|
299
302
|
status: "open",
|
|
300
303
|
downloadUrl: "",
|
|
304
|
+
hostedUrl: "https://invoice.stripe.com/i/in_2",
|
|
301
305
|
},
|
|
302
306
|
]);
|
|
303
307
|
expect(mocks.stripe.invoices.list).toHaveBeenCalledWith({
|
|
@@ -309,11 +313,21 @@ describe("StripePaymentProcessor", () => {
|
|
|
309
313
|
it("uses 'unknown' when invoice status is null", async () => {
|
|
310
314
|
vi.mocked(mocks.tenantRepo.getByTenant).mockResolvedValue(makeTenantRow());
|
|
311
315
|
vi.mocked(mocks.stripe.invoices.list).mockResolvedValue({
|
|
312
|
-
data: [
|
|
316
|
+
data: [
|
|
317
|
+
{
|
|
318
|
+
id: "in_3",
|
|
319
|
+
created: 1700000000,
|
|
320
|
+
amount_due: 100,
|
|
321
|
+
status: null,
|
|
322
|
+
invoice_pdf: null,
|
|
323
|
+
hosted_invoice_url: null,
|
|
324
|
+
},
|
|
325
|
+
],
|
|
313
326
|
} as unknown as Stripe.Response<Stripe.ApiList<Stripe.Invoice>>);
|
|
314
327
|
|
|
315
328
|
const result = await processor.listInvoices("tenant-1");
|
|
316
329
|
expect(result[0].status).toBe("unknown");
|
|
330
|
+
expect(result[0].hostedUrl).toBe("");
|
|
317
331
|
});
|
|
318
332
|
});
|
|
319
333
|
|