Socket
Socket
Sign inDemoInstall

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

Package Overview
Dependencies
0
Maintainers
13
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

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

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


Version published
Weekly downloads
100
decreased by-12.28%
Maintainers
13
Install size
102 kB
Created
Weekly downloads
 

Changelog

Source

4.0.0 (2023-05-15)

Breaking

  • Remove support for Offers v1: The function createOfferConfigurationsFromOfferToBuy now only supports Offers v2. If you are using Offers v1, you must upgrade to Offers v2 (or continue to use the old version of this package).

Readme

Source

@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

FAQs

Last updated on 15 May 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc