mts-booking-library 3.0.12 → 3.0.14

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/README.md CHANGED
@@ -1,9 +1,37 @@
1
1
  # Publish
2
2
 
3
- 1. `npm i`
4
- 1. `npm version patch`
5
- 1. `git push && git push --tags`
6
- 1. `npm publish`
3
+ To publish a new version of the library, first create a new version with the `npm version` command,
4
+ specifying the semver increment (`patch`, `minor` or `major`, e.g. `npm version patch`).
5
+
6
+ The library will be published to npm by the pipelines every time a new version is detected on the
7
+ `main` branch.
8
+
9
+ For that to work, the `NPM_TOKEN` secret must be kept up-to-date, as it expires **every 90 days**
10
+ and has to be rotated manually.
11
+
12
+ **LAST UPDATE: 2026-05-07**
13
+
14
+ ### How to update the npm token
15
+
16
+ 1. Go to https://www.npmjs.com/login
17
+ 1. Login with the `sviluppatoriinfos` username, and its password
18
+ 1. 2FA will be required, ask Jacopo Gargano (jacopo.gargano@infos.it)
19
+ 1. Once logged in, navigate to https://www.npmjs.com/settings/sviluppatoriinfos/tokens
20
+ 1. On that page, delete the outdated token
21
+ 1. Click on "Generate New Token" (may require a second 2FA code)
22
+ 1. Use the following settings:
23
+ - Token name: `mts-booking-library publishing`
24
+ - Bypass two-factor authentication (2FA): true
25
+ - Packages and scopes
26
+ - Permissions: Read and write
27
+ - Select packages > Only select packages and scopes: `mts-booking-library`
28
+ - Expiration > Expiration Date: 90 days
29
+ 1. Click on "Generate token", and copy the token
30
+ 1. Go to the edit pipeline page in Azure:
31
+ https://dev.azure.com/infoservicesrl/MyTicketSolution%202.0/_apps/hub/ms.vss-build-web.ci-designer-hub?pipelineId=88&branch=main
32
+ 1. Click on Variables > `NPM_TOKEN`
33
+ 1. Paste the new value, then Save > Save
34
+ 1. Update the date above
7
35
 
8
36
  # Test
9
37
 
package/lib/index.d.ts CHANGED
@@ -10,6 +10,7 @@ export { Person, DEFAULT_PERSON, initializePerson } from "./types/common/Person"
10
10
  export { GetBuyerPassengersDetailsResponse, GetPersonRequest, GetPassenger, EditPassengerRequestType, EditPassengersDetailsRequest } from "./types/common/Person";
11
11
  export { Tariff, TariffsMatrix, TariffSummary, TariffType, TermsType, PassengerTariff, ExtraTariff } from "./types/common/Tariffs";
12
12
  export { ReductionType, Reduction, AddReductionRequest } from "./types/common/Reduction";
13
+ export { GetChangeInformationRequest, GetChangeInformationResponse, ChangeTicketInformation } from "./types/common/ChangeInformation";
13
14
  export { Gateway, GetSellerGatewaysResponse, GetPaymentInformationFromGatewayResponse, IssueCartResponse, GatewayTypes, PaymentMethods } from "./types/common/Payment";
14
15
  export { ErrorResponse, objectIsMTSErrorResponse } from "./types/ErrorResponse";
15
16
  export { City } from "./types/common/City";
@@ -70,6 +70,14 @@ export type Cart = {
70
70
  * cart. It is expressed in the currency of the cart.
71
71
  */
72
72
  totalCreditFromChange: number;
73
+ /**
74
+ * Sum of penalty (penale) amounts levied on the original tickets being replaced
75
+ * by this change cart. Positive number, in the same currency as
76
+ * {@link Cart.currency}. Zero when no change is in progress or no penalty rule
77
+ * applies to the changed tickets. Surfaced so the booking summary can render a
78
+ * "Penale cambio" line alongside {@link Cart.totalCreditFromChange}.
79
+ */
80
+ totalChangePenalty: number;
73
81
  /** The total amount to pay by buyer */
74
82
  totalAmountToPayByBuyer: number;
75
83
  /**
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Types for the BE preview endpoint `GET /v3_tickets/change/info`.
3
+ *
4
+ * Fetches the change-penalty (PENALE) for a set of tickets WITHOUT creating a
5
+ * change cart, so the FE can render a confirmation pop-up before the user
6
+ * commits to the change:
7
+ *
8
+ * "Il costo del cambio è di euro xx
9
+ * Vuoi procedere?
10
+ * [si] [indietro]"
11
+ */
12
+ export type GetChangeInformationRequest = {
13
+ /**
14
+ * Convenience single-PNR alternative to {@link ticketsToChange}. Either this
15
+ * or `ticketsToChange` must be set.
16
+ */
17
+ pnr?: string;
18
+ /**
19
+ * The PNRs / ticket codes to preview the change penalty for. Pass when the
20
+ * user is changing more than one ticket at once.
21
+ */
22
+ ticketsToChange?: string[];
23
+ };
24
+ export type GetChangeInformationResponse = {
25
+ /** Per-ticket breakdown of the penalty preview. */
26
+ ticketsToChange: ChangeTicketInformation[];
27
+ /**
28
+ * Sum of {@link ChangeTicketInformation.penalty} across all tickets in the
29
+ * request. Positive value, in {@link GetChangeInformationResponse.currency}.
30
+ * Surfaced so the FE can render a single "Il costo del cambio è di euro xx"
31
+ * line in the pop-up.
32
+ */
33
+ totalChangePenalty: number;
34
+ /**
35
+ * Currency of {@link totalChangePenalty}. Sourced from the first ticket in
36
+ * the request — if the caller passes tickets with different currencies, only
37
+ * the first is reflected here. Mixed-currency requests are unsupported; use
38
+ * the per-ticket {@link ChangeTicketInformation.currency} for authoritative
39
+ * per-ticket display.
40
+ */
41
+ currency: string;
42
+ };
43
+ export type ChangeTicketInformation = {
44
+ pnr: string;
45
+ /**
46
+ * Penalty owed to the seller for changing this ticket. Computed via the
47
+ * tariff's value-date rule, capped at the ticket's actual value to the
48
+ * buyer. Zero when no rule applies.
49
+ */
50
+ penalty: number;
51
+ /** True when the ticket is changeable per its terms-type configuration. */
52
+ isChangeable: boolean;
53
+ currency: string;
54
+ };
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ /**
3
+ * Types for the BE preview endpoint `GET /v3_tickets/change/info`.
4
+ *
5
+ * Fetches the change-penalty (PENALE) for a set of tickets WITHOUT creating a
6
+ * change cart, so the FE can render a confirmation pop-up before the user
7
+ * commits to the change:
8
+ *
9
+ * "Il costo del cambio è di euro xx
10
+ * Vuoi procedere?
11
+ * [si] [indietro]"
12
+ */
13
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mts-booking-library",
3
- "version": "3.0.12",
3
+ "version": "3.0.14",
4
4
  "description": "Library for using MyTicketSolution Booking API",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",