ti2-ventrata 1.0.38 → 1.0.39

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/index.js CHANGED
@@ -487,7 +487,7 @@ class Plugin {
487
487
  notes,
488
488
  resellerReference: reference,
489
489
  settlementMethod,
490
- ...(emailAddress ? { emailReceipt: true } : {}), // Send email receipt since we have a valid email address
490
+ emailReceipt: true, // always send email to the customer
491
491
  };
492
492
 
493
493
  try {
package/index.test.js CHANGED
@@ -33,7 +33,7 @@ const app = new Plugin({
33
33
  describe('search tests', () => {
34
34
  let products;
35
35
  let testProduct = {
36
- productName: '[ED3D] Edinburgh 3 Day Pass',
36
+ productName: 'Edinburgh 3 Day Pass',
37
37
  };
38
38
  const token = {
39
39
  apiKey: process.env.ti2_ventrata_apiKey,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ti2-ventrata",
3
- "version": "1.0.38",
3
+ "version": "1.0.39",
4
4
  "description": "Ventrata's TI2 Plugin",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -5,15 +5,16 @@ const jwt = require('jsonwebtoken');
5
5
 
6
6
  const resolvers = {
7
7
  Query: {
8
- key: (root, args) => {
8
+ key: (root, args, context) => {
9
9
  const {
10
10
  productId,
11
11
  optionId,
12
12
  currency,
13
13
  unitsWithQuantity,
14
14
  jwtKey,
15
- settlementMethods,
16
15
  } = args;
16
+ // Get settlementMethods from context if not in args
17
+ const settlementMethods = args.settlementMethods || (context && context.settlementMethods) || [];
17
18
  if (!jwtKey) return null;
18
19
  return jwt.sign({
19
20
  productId,
@@ -58,11 +59,16 @@ const translateAvailability = async ({ rootValue, variableValues, typeDefs, quer
58
59
  typeDefs,
59
60
  resolvers,
60
61
  });
62
+ // Extract settlementMethods from variableValues to pass via context
63
+ const settlementMethods = variableValues.settlementMethods || [];
61
64
  const retVal = await graphql({
62
65
  schema,
63
66
  rootValue,
64
67
  source: query,
65
68
  variableValues,
69
+ contextValue: {
70
+ settlementMethods,
71
+ },
66
72
  });
67
73
  if (retVal.errors) throw new Error(retVal.errors);
68
74
  return retVal.data;