const request = require('request');

const options = {
  method: 'POST',
  url: 'https://api.betterez.com/sales/cart',
  headers: {
    authorization: 'Bearer {{jwtToken}}',
    'Content-Type': 'application/json;charset=UTF-8',
    Accept: 'application/json, text/plain, */*',
    'x-api-key': '{{x-api-key}}'
  },
  body: {
    operationId: '{{uuid.v4}}',
    channel: '{{use-proper-channel-here}}',
    providerId: '{{providerId}}',
    items: {
      bundle: [
        {
          bundleId: '{{bundleId}}',
          items: [
            {
              productId: '{{productId}}',
              origin: '{{origin-station-name}}',
              originId: '{{originId}}',
              destination: '{{destination-station-name}}',
              destinationId: '{{destinationId}}',
              fareId: '{{fareId}}',
              tripType: 'oneway'
            }
          ]
        }
      ]
    },
    currency: {buy: 1, sell: 1, isocode: 'USD', symbol: '$'},
    language: 'en'
  },
  json: true
};

request(options, function (error, response, body) {
	if (error) throw new Error(error);

	console.log(body);
});