This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

@entur/create-offer-configurations-from-offer-to-buy
TypeScript icon, indicating that this package has built-in type declarations

4.0.0 • Public • Published

@entur/create-offer-configurations-from-offer-to-buy

Create an array of offer configurations exactly as prescribed by the possibleTravellerIds field in an OfferToBuy

Installation

Install with npm

npm install @entur/create-offer-configurations-from-offer-to-buy

Install with yarn

yarn add @entur/create-offer-configurations-from-offer-to-buy

Usage/Examples

The function has an optional second parameter, offerIfUsingOffersApiV1. You have to supply an argument for it if you are using Offers v1. The offer is used to map the items in withUpgradeProducts to selectableProductIds in the output. The second argument is superfluous if you are using Offers v2, because selectableProductIds are already present in the offerToBuy.

import { createOfferConfigurationsFromOfferToBuy } from "@entur/create-offer-configurations-from-offer-to-buy";

createOfferConfigurationsFromOfferToBuy(
  {
    id: "7048884e-2c16-4305-92cc-b56fb4ea779a",
    numberToBuy: 2,
    withUpgradeProducts: [],
    possibleTravellerIds: [["3543283", "3518762"], ["ADULT-0-anonymous"]],
  },
  offerIfUsingOffersApiV1
);

/*
 * [
 *   {
 *     offerId: "7048884e-2c16-4305-92cc-b56fb4ea779a",
 *     selectedTravellerIds: ["3543283", "3518762"],
 *   },
 *   {
 *     offerId: "7048884e-2c16-4305-92cc-b56fb4ea779a",
 *     selectedTravellerIds: ["ADULT-0-anonymous"],
 *   },
 * ];
 */

Running Tests

npm run test

Contributing

Contributions are always welcome!

Fork the repository from and open a PR.

Authors

Readme

Keywords

none

Package Sidebar

Install

npm i @entur/create-offer-configurations-from-offer-to-buy

Weekly Downloads

82

Version

4.0.0

License

EUPL-1.2

Unpacked Size

105 kB

Total Files

8

Last publish

Collaborators

  • phun-ky
  • ceciliehrr
  • tysseng-entur
  • martinbjerkeengen
  • frankwaldal
  • carljoachim
  • oysval
  • magnusrand
  • wfeiring
  • vages
  • enturas
  • kentandersen
  • testower