btrz-api-client 8.41.0 → 8.43.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.
@@ -72,6 +72,9 @@ function pdfDataFactory(_ref) {
72
72
  }
73
73
  }
74
74
 
75
+ if (query.type === "pre_trip_notification" || query.type === "post_trip_notification") {
76
+ url = "/manifest-notification-data/" + itemId;
77
+ }
75
78
  if (query.type === "parcel_confirmation") {
76
79
  url = "/pdf-parcels/" + itemId;
77
80
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "btrz-api-client",
3
- "version": "8.41.0",
3
+ "version": "8.43.0",
4
4
  "description": "Api client for Betterez endpoints",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -68,6 +68,9 @@ function pdfDataFactory({
68
68
  }
69
69
  }
70
70
 
71
+ if (query.type === "pre_trip_notification" || query.type === "post_trip_notification") {
72
+ url = `/manifest-notification-data/${itemId}`;
73
+ }
71
74
  if (query.type === "parcel_confirmation") {
72
75
  url = `/pdf-parcels/${itemId}`;
73
76
  }
@@ -6,6 +6,7 @@ const api = require("./../../../src/client.js").createApiClient({
6
6
  baseURL: "http://test.com"
7
7
  });
8
8
 
9
+ // eslint-disable-next-line max-statements
9
10
  describe("notifications/pdf-data", () => {
10
11
  const token = "my-api-key";
11
12
 
@@ -301,18 +302,212 @@ describe("notifications/pdf-data", () => {
301
302
  });
302
303
  });
303
304
 
304
- it("should return the proper data for a voucher", () => {
305
+ it("should return the proper data for pre_trip_notification (manifest notification data)", () => {
305
306
  const itemId = "12345";
306
- const query = {
307
- type: "voucher"
308
- };
307
+ const query = {type: "pre_trip_notification"};
308
+ axiosMock.onGet(new RegExp(`^/manifest-notification-data/${itemId}`))
309
+ .reply(expectRequest({statusCode: 200, token}));
310
+ return api.notifications.pdfData.get({token, query, itemId});
311
+ });
312
+
313
+ it("should return the proper data for post_trip_notification (manifest notification data)", () => {
314
+ const itemId = "12345";
315
+ const query = {type: "post_trip_notification"};
316
+ axiosMock.onGet(new RegExp(`^/manifest-notification-data/${itemId}`))
317
+ .reply(expectRequest({statusCode: 200, token}));
318
+ return api.notifications.pdfData.get({token, query, itemId});
319
+ });
320
+
321
+ it("should return the proper data for parcel_confirmation", () => {
322
+ const itemId = "12345";
323
+ const query = {type: "parcel_confirmation"};
324
+ axiosMock.onGet(`/pdf-parcels/${itemId}`)
325
+ .reply(expectRequest({statusCode: 200, token}));
326
+ return api.notifications.pdfData.get({token, query, itemId});
327
+ });
328
+
329
+ it("should return the proper data for redeemable_items_confirmation", () => {
330
+ const itemId = "12345";
331
+ const query = {type: "redeemable_items_confirmation"};
332
+ axiosMock.onGet(`/pdf-redeemable-items/${itemId}`)
333
+ .reply(expectRequest({statusCode: 200, token}));
334
+ return api.notifications.pdfData.get({token, query, itemId});
335
+ });
336
+
337
+ it("should return the proper data for sold_item_confirmation", () => {
338
+ const itemId = "12345";
339
+ const query = {type: "sold_item_confirmation"};
340
+ axiosMock.onGet(`/pdf-sold-items/${itemId}`)
341
+ .reply(expectRequest({statusCode: 200, token}));
342
+ return api.notifications.pdfData.get({token, query, itemId});
343
+ });
344
+
345
+ it("should return the proper data for customer_card_membership (pdf-customer)", () => {
346
+ const itemId = "12345";
347
+ const query = {type: "customer_card_membership"};
348
+ axiosMock.onGet(`/pdf-customer/${itemId}`)
349
+ .reply(expectRequest({statusCode: 200, token}));
350
+ return api.notifications.pdfData.get({token, query, itemId});
351
+ });
352
+
353
+ it("should return the proper data for scanning_badge (pdf-customer)", () => {
354
+ const itemId = "12345";
355
+ const query = {type: "scanning_badge"};
356
+ axiosMock.onGet(`/pdf-customer/${itemId}`)
357
+ .reply(expectRequest({statusCode: 200, token}));
358
+ return api.notifications.pdfData.get({token, query, itemId});
359
+ });
360
+
361
+ it("should return the proper data for customer_activation (pdf-customer)", () => {
362
+ const itemId = "12345";
363
+ const query = {type: "customer_activation"};
364
+ axiosMock.onGet(`/pdf-customer/${itemId}`)
365
+ .reply(expectRequest({statusCode: 200, token}));
366
+ return api.notifications.pdfData.get({token, query, itemId});
367
+ });
368
+
369
+ it("should return the proper data for customer_activation_mobile (pdf-customer)", () => {
370
+ const itemId = "12345";
371
+ const query = {type: "customer_activation_mobile"};
372
+ axiosMock.onGet(`/pdf-customer/${itemId}`)
373
+ .reply(expectRequest({statusCode: 200, token}));
374
+ return api.notifications.pdfData.get({token, query, itemId});
375
+ });
376
+
377
+ it("should return the proper data for customer_password_reset (pdf-customer)", () => {
378
+ const itemId = "12345";
379
+ const query = {type: "customer_password_reset"};
380
+ axiosMock.onGet(`/pdf-customer/${itemId}`)
381
+ .reply(expectRequest({statusCode: 200, token}));
382
+ return api.notifications.pdfData.get({token, query, itemId});
383
+ });
384
+
385
+ it("should return the proper data for customer_password_reset_mobile (pdf-customer)", () => {
386
+ const itemId = "12345";
387
+ const query = {type: "customer_password_reset_mobile"};
388
+ axiosMock.onGet(`/pdf-customer/${itemId}`)
389
+ .reply(expectRequest({statusCode: 200, token}));
390
+ return api.notifications.pdfData.get({token, query, itemId});
391
+ });
392
+
393
+ it("should return the proper data for gift_certificate_notification", () => {
394
+ const itemId = "12345";
395
+ const query = {type: "gift_certificate_notification"};
396
+ axiosMock.onGet(`/pdf-gift-certificates/${itemId}`)
397
+ .reply(expectRequest({statusCode: 200, token}));
398
+ return api.notifications.pdfData.get({token, query, itemId});
399
+ });
400
+
401
+ it("should return the proper data for user_password_reset", () => {
402
+ const itemId = "12345";
403
+ const query = {type: "user_password_reset"};
404
+ axiosMock.onGet(`/pdf-users/${itemId}`)
405
+ .reply(expectRequest({statusCode: 200, token}));
406
+ return api.notifications.pdfData.get({token, query, itemId});
407
+ });
408
+
409
+ it("should return the proper data for voucher_notification", () => {
410
+ const itemId = "12345";
411
+ const query = {type: "voucher_notification"};
309
412
  axiosMock.onGet(`/pdf-vouchers/${itemId}`)
310
- .reply(expectRequest({
311
- statusCode: 200, token
312
- }));
313
- return api.notifications.pdfData.get({
314
- token, query, itemId
315
- });
413
+ .reply(expectRequest({statusCode: 200, token}));
414
+ return api.notifications.pdfData.get({token, query, itemId});
415
+ });
416
+
417
+ it("should return the proper data for compensation_voucher", () => {
418
+ const itemId = "12345";
419
+ const query = {type: "compensation_voucher"};
420
+ axiosMock.onGet(`/pdf-vouchers/${itemId}`)
421
+ .reply(expectRequest({statusCode: 200, token}));
422
+ return api.notifications.pdfData.get({token, query, itemId});
423
+ });
424
+
425
+ it("should return the proper data for new_account (pdf-accounts)", () => {
426
+ const itemId = "12345";
427
+ const query = {type: "new_account"};
428
+ axiosMock.onGet(`/pdf-accounts/${itemId}`)
429
+ .reply(expectRequest({statusCode: 200, token}));
430
+ return api.notifications.pdfData.get({token, query, itemId});
431
+ });
432
+
433
+ it("should return the proper data for new_seller_account (pdf-accounts)", () => {
434
+ const itemId = "12345";
435
+ const query = {type: "new_seller_account"};
436
+ axiosMock.onGet(`/pdf-accounts/${itemId}`)
437
+ .reply(expectRequest({statusCode: 200, token}));
438
+ return api.notifications.pdfData.get({token, query, itemId});
439
+ });
440
+
441
+ it("should return the proper data for interline_provider_invite (pdf-accounts)", () => {
442
+ const itemId = "12345";
443
+ const query = {type: "interline_provider_invite"};
444
+ axiosMock.onGet(`/pdf-accounts/${itemId}`)
445
+ .reply(expectRequest({statusCode: 200, token}));
446
+ return api.notifications.pdfData.get({token, query, itemId});
447
+ });
448
+
449
+ it("should return the proper data for operator_purchase (pdf-transactions)", () => {
450
+ const itemId = "12345";
451
+ const query = {type: "operator_purchase"};
452
+ axiosMock.onGet(`/pdf-transactions/${itemId}`)
453
+ .reply(expectRequest({statusCode: 200, token}));
454
+ return api.notifications.pdfData.get({token, query, itemId});
455
+ });
456
+
457
+ it("should return the proper data for operator_ssr (pdf-transactions)", () => {
458
+ const itemId = "12345";
459
+ const query = {type: "operator_ssr"};
460
+ axiosMock.onGet(`/pdf-transactions/${itemId}`)
461
+ .reply(expectRequest({statusCode: 200, token}));
462
+ return api.notifications.pdfData.get({token, query, itemId});
463
+ });
464
+
465
+ it("should return the proper data for operator_manifest_capacity", () => {
466
+ const itemId = "12345";
467
+ const query = {type: "operator_manifest_capacity"};
468
+ axiosMock.onGet(`/pdf-operator-manifest-capacities/${itemId}`)
469
+ .reply(expectRequest({statusCode: 200, token}));
470
+ return api.notifications.pdfData.get({token, query, itemId});
471
+ });
472
+
473
+ it("should return the proper data for reaccomodation", () => {
474
+ const itemId = "12345";
475
+ const query = {type: "reaccomodation"};
476
+ axiosMock.onGet(`/pdf-reaccomodation/${itemId}`)
477
+ .reply(expectRequest({statusCode: 200, token}));
478
+ return api.notifications.pdfData.get({token, query, itemId});
479
+ });
480
+
481
+ it("should return the proper data for ticket_movement (pdf-reaccomodation)", () => {
482
+ const itemId = "12345";
483
+ const query = {type: "ticket_movement"};
484
+ axiosMock.onGet(`/pdf-reaccomodation/${itemId}`)
485
+ .reply(expectRequest({statusCode: 200, token}));
486
+ return api.notifications.pdfData.get({token, query, itemId});
487
+ });
488
+
489
+ it("should return the proper data for manifest_notification", () => {
490
+ const itemId = "12345";
491
+ const query = {type: "manifest_notification"};
492
+ axiosMock.onGet(`/pdf-manifests/${itemId}`)
493
+ .reply(expectRequest({statusCode: 200, token}));
494
+ return api.notifications.pdfData.get({token, query, itemId});
495
+ });
496
+
497
+ it("should return the proper data for startingBalance", () => {
498
+ const itemId = "12345";
499
+ const query = {type: "startingBalance"};
500
+ axiosMock.onGet(`/pdf-starting-balance/${itemId}`)
501
+ .reply(expectRequest({statusCode: 200, token}));
502
+ return api.notifications.pdfData.get({token, query, itemId});
503
+ });
504
+
505
+ it("should return the proper data for partialShiftDeposits", () => {
506
+ const itemId = "12345";
507
+ const query = {type: "partialShiftDeposits"};
508
+ axiosMock.onGet(`/pdf-partial-shift-deposits/${itemId}`)
509
+ .reply(expectRequest({statusCode: 200, token}));
510
+ return api.notifications.pdfData.get({token, query, itemId});
316
511
  });
317
512
 
318
513
  it("should return the proper data for a passengersManifest", () => {