const request = require('request');

const options = {
  method: 'POST',
  url: 'https://api.betterez.com/sales/cancellations',
  headers: {
    authorization: 'Bearer {{jwtToken}}',
    'Content-Type': 'application/json;charset=UTF-8',
    Accept: 'application/json, text/plain, */*',
    'x-api-key': '{{x-api-key}}'
  },
  body: {
    cancellation: {
      tickets: ['507f191e810c19729de860ea'],
      flexPasses: [],
      reservations: [],
      fees: [],
      parcels: [],
      redeemableItems: [],
      soldItems: [],
      giftCertificates: [],
      insurances: [],
      trxId: '507f191e810c19729de860ee',
      overrideCancelFees: [],
      channel: 'backoffice',
      penalty: {amount: 0, reason: ''}
    }
  },
  json: true
};

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

	console.log(body);
});