@como/como-client
Advanced tools
Comparing version 0.1.44 to 0.1.45
@@ -664,5 +664,5 @@ 'use strict'; | ||
exports.QueryPurchases = function (service) { | ||
exports.knowYourData = function (service) { | ||
return function () { | ||
var _ref33 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee20(baseUrl, locationId, token, membershipKey) { | ||
var _ref33 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee20(baseUrl, locationId, token, email) { | ||
var url, _ref34, data; | ||
@@ -674,5 +674,7 @@ | ||
case 0: | ||
url = baseUrl + '/alpha/api/QueryPurchases?BusinessID=' + locationId + '&Token=' + token + '&UserKey=' + membershipKey; | ||
url = baseUrl + '/memberships/requestData?locationId=' + locationId + '&token=' + token; | ||
_context20.next = 3; | ||
return service.get(url, {}, { | ||
return service.post(url, { | ||
email: email | ||
}, { | ||
headers: { 'Content-Type': 'application/json' } | ||
@@ -700,7 +702,5 @@ }); | ||
exports.knowYourData = function (service) { | ||
exports.addPaymentMethod = function (service) { | ||
return function () { | ||
var _ref35 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee21(baseUrl, locationId, token, email) { | ||
var url, _ref36, data; | ||
var _ref35 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee21(baseUrl, locationId, token, cardToken) { | ||
return _regenerator2.default.wrap(function _callee21$(_context21) { | ||
@@ -710,16 +710,9 @@ while (1) { | ||
case 0: | ||
url = baseUrl + '/memberships/requestData?locationId=' + locationId + '&token=' + token; | ||
_context21.next = 3; | ||
return service.post(url, { | ||
email: email | ||
}, { | ||
headers: { 'Content-Type': 'application/json' } | ||
}); | ||
return _context21.abrupt('return', service({ | ||
method: 'post', | ||
url: baseUrl + '/payments/v2/methods/' + cardToken + '?locationId=' + locationId, | ||
timeout: 5000 // Wait for 5 seconds | ||
})); | ||
case 3: | ||
_ref36 = _context21.sent; | ||
data = _ref36.data; | ||
return _context21.abrupt('return', data); | ||
case 6: | ||
case 1: | ||
case 'end': | ||
@@ -738,5 +731,5 @@ return _context21.stop(); | ||
exports.addPaymentMethod = function (service) { | ||
exports.getPaymentMethods = function (service) { | ||
return function () { | ||
var _ref37 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee22(baseUrl, locationId, token, cardToken) { | ||
var _ref36 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee22(baseUrl, locationId) { | ||
return _regenerator2.default.wrap(function _callee22$(_context22) { | ||
@@ -747,4 +740,4 @@ while (1) { | ||
return _context22.abrupt('return', service({ | ||
method: 'post', | ||
url: baseUrl + '/payments/v2/methods/' + cardToken + '?locationId=' + locationId, | ||
method: 'get', | ||
url: baseUrl + '/payments/v2/methods?locationId=' + locationId + '&InputType=json&MimeType=application/json', | ||
timeout: 5000 // Wait for 5 seconds | ||
@@ -761,4 +754,4 @@ })); | ||
return function (_x72, _x73, _x74, _x75) { | ||
return _ref37.apply(this, arguments); | ||
return function (_x72, _x73) { | ||
return _ref36.apply(this, arguments); | ||
}; | ||
@@ -768,5 +761,5 @@ }(); | ||
exports.getPaymentMethods = function (service) { | ||
exports.payInApp = function (service) { | ||
return function () { | ||
var _ref38 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee23(baseUrl, locationId) { | ||
var _ref37 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee23(baseUrl, locationId, token, amount, creditCardToken, itemName, itemNumber, membershipKey) { | ||
return _regenerator2.default.wrap(function _callee23$(_context23) { | ||
@@ -777,29 +770,2 @@ while (1) { | ||
return _context23.abrupt('return', service({ | ||
method: 'get', | ||
url: baseUrl + '/payments/v2/methods?locationId=' + locationId + '&InputType=json&MimeType=application/json', | ||
timeout: 5000 // Wait for 5 seconds | ||
})); | ||
case 1: | ||
case 'end': | ||
return _context23.stop(); | ||
} | ||
} | ||
}, _callee23, undefined); | ||
})); | ||
return function (_x76, _x77) { | ||
return _ref38.apply(this, arguments); | ||
}; | ||
}(); | ||
}; | ||
exports.payInApp = function (service) { | ||
return function () { | ||
var _ref39 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee24(baseUrl, locationId, token, amount, creditCardToken, itemName, itemNumber, membershipKey) { | ||
return _regenerator2.default.wrap(function _callee24$(_context24) { | ||
while (1) { | ||
switch (_context24.prev = _context24.next) { | ||
case 0: | ||
return _context24.abrupt('return', service({ | ||
method: 'post', | ||
@@ -826,10 +792,10 @@ url: baseUrl + '/payments/v2/payments/charge?locationId=' + locationId, | ||
case 'end': | ||
return _context24.stop(); | ||
return _context23.stop(); | ||
} | ||
} | ||
}, _callee24, undefined); | ||
}, _callee23, undefined); | ||
})); | ||
return function (_x78, _x79, _x80, _x81, _x82, _x83, _x84, _x85) { | ||
return _ref39.apply(this, arguments); | ||
return function (_x74, _x75, _x76, _x77, _x78, _x79, _x80, _x81) { | ||
return _ref37.apply(this, arguments); | ||
}; | ||
@@ -841,26 +807,26 @@ }(); | ||
return function () { | ||
var _ref40 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee25(baseUrl, locationId, token, creditCardToken) { | ||
var _ref38 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee24(baseUrl, locationId, token, creditCardToken) { | ||
var url, response; | ||
return _regenerator2.default.wrap(function _callee25$(_context25) { | ||
return _regenerator2.default.wrap(function _callee24$(_context24) { | ||
while (1) { | ||
switch (_context25.prev = _context25.next) { | ||
switch (_context24.prev = _context24.next) { | ||
case 0: | ||
url = baseUrl + '/payments/v2/methods/' + creditCardToken + '?locationId=' + locationId; | ||
_context25.next = 3; | ||
_context24.next = 3; | ||
return service.delete(url); | ||
case 3: | ||
response = _context25.sent; | ||
return _context25.abrupt('return', response); | ||
response = _context24.sent; | ||
return _context24.abrupt('return', response); | ||
case 5: | ||
case 'end': | ||
return _context25.stop(); | ||
return _context24.stop(); | ||
} | ||
} | ||
}, _callee25, undefined); | ||
}, _callee24, undefined); | ||
})); | ||
return function (_x86, _x87, _x88, _x89) { | ||
return _ref40.apply(this, arguments); | ||
return function (_x82, _x83, _x84, _x85) { | ||
return _ref38.apply(this, arguments); | ||
}; | ||
@@ -872,7 +838,7 @@ }(); | ||
return function () { | ||
var _ref41 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee26(baseUrl, locationId, tag, limit, offset) { | ||
var _ref39 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee25(baseUrl, locationId, tag, limit, offset) { | ||
var query, url; | ||
return _regenerator2.default.wrap(function _callee26$(_context26) { | ||
return _regenerator2.default.wrap(function _callee25$(_context25) { | ||
while (1) { | ||
switch (_context26.prev = _context26.next) { | ||
switch (_context25.prev = _context25.next) { | ||
case 0: | ||
@@ -887,14 +853,14 @@ query = { | ||
url = urlsUtils.appendQuery(baseUrl + '/memberMessages', query); | ||
return _context26.abrupt('return', service.get(url)); | ||
return _context25.abrupt('return', service.get(url)); | ||
case 3: | ||
case 'end': | ||
return _context26.stop(); | ||
return _context25.stop(); | ||
} | ||
} | ||
}, _callee26, undefined); | ||
}, _callee25, undefined); | ||
})); | ||
return function (_x90, _x91, _x92, _x93, _x94) { | ||
return _ref41.apply(this, arguments); | ||
return function (_x86, _x87, _x88, _x89, _x90) { | ||
return _ref39.apply(this, arguments); | ||
}; | ||
@@ -906,10 +872,10 @@ }(); | ||
return function () { | ||
var _ref42 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee27(baseUrl, locationId, keysList) { | ||
var _ref40 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee26(baseUrl, locationId, keysList) { | ||
var url, response; | ||
return _regenerator2.default.wrap(function _callee27$(_context27) { | ||
return _regenerator2.default.wrap(function _callee26$(_context26) { | ||
while (1) { | ||
switch (_context27.prev = _context27.next) { | ||
switch (_context26.prev = _context26.next) { | ||
case 0: | ||
url = baseUrl + '/memberMessages/markAsRead/v2?locationId=' + locationId; | ||
_context27.next = 3; | ||
_context26.next = 3; | ||
return service.put(url, { | ||
@@ -920,15 +886,15 @@ keys: keysList | ||
case 3: | ||
response = _context27.sent; | ||
return _context27.abrupt('return', response); | ||
response = _context26.sent; | ||
return _context26.abrupt('return', response); | ||
case 5: | ||
case 'end': | ||
return _context27.stop(); | ||
return _context26.stop(); | ||
} | ||
} | ||
}, _callee27, undefined); | ||
}, _callee26, undefined); | ||
})); | ||
return function (_x95, _x96, _x97) { | ||
return _ref42.apply(this, arguments); | ||
return function (_x91, _x92, _x93) { | ||
return _ref40.apply(this, arguments); | ||
}; | ||
@@ -940,8 +906,8 @@ }(); | ||
return function () { | ||
var _ref43 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee28(baseUrl, locationId, receiver, sender, amount, wallet) { | ||
return _regenerator2.default.wrap(function _callee28$(_context28) { | ||
var _ref41 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee27(baseUrl, locationId, receiver, sender, amount, wallet) { | ||
return _regenerator2.default.wrap(function _callee27$(_context27) { | ||
while (1) { | ||
switch (_context28.prev = _context28.next) { | ||
switch (_context27.prev = _context27.next) { | ||
case 0: | ||
return _context28.abrupt('return', service({ | ||
return _context27.abrupt('return', service({ | ||
method: 'post', | ||
@@ -960,10 +926,10 @@ url: baseUrl + '/budgetTransfer?locationId=' + locationId, | ||
case 'end': | ||
return _context28.stop(); | ||
return _context27.stop(); | ||
} | ||
} | ||
}, _callee28, undefined); | ||
}, _callee27, undefined); | ||
})); | ||
return function (_x98, _x99, _x100, _x101, _x102, _x103) { | ||
return _ref43.apply(this, arguments); | ||
return function (_x94, _x95, _x96, _x97, _x98, _x99) { | ||
return _ref41.apply(this, arguments); | ||
}; | ||
@@ -974,8 +940,8 @@ }(); | ||
return function () { | ||
var _ref44 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee29(baseUrl, locationId, claimCode) { | ||
return _regenerator2.default.wrap(function _callee29$(_context29) { | ||
var _ref42 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee28(baseUrl, locationId, claimCode) { | ||
return _regenerator2.default.wrap(function _callee28$(_context28) { | ||
while (1) { | ||
switch (_context29.prev = _context29.next) { | ||
switch (_context28.prev = _context28.next) { | ||
case 0: | ||
return _context29.abrupt('return', service({ | ||
return _context28.abrupt('return', service({ | ||
method: 'post', | ||
@@ -988,10 +954,10 @@ url: baseUrl + '/budgetTransfer/' + claimCode + '/claim?locationId=' + locationId, | ||
case 'end': | ||
return _context29.stop(); | ||
return _context28.stop(); | ||
} | ||
} | ||
}, _callee29, undefined); | ||
}, _callee28, undefined); | ||
})); | ||
return function (_x104, _x105, _x106) { | ||
return _ref44.apply(this, arguments); | ||
return function (_x100, _x101, _x102) { | ||
return _ref42.apply(this, arguments); | ||
}; | ||
@@ -1003,26 +969,26 @@ }(); | ||
return function () { | ||
var _ref45 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee30(baseUrl, claimId) { | ||
var _ref43 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee29(baseUrl, claimId) { | ||
var url, response; | ||
return _regenerator2.default.wrap(function _callee30$(_context30) { | ||
return _regenerator2.default.wrap(function _callee29$(_context29) { | ||
while (1) { | ||
switch (_context30.prev = _context30.next) { | ||
switch (_context29.prev = _context29.next) { | ||
case 0: | ||
url = baseUrl + '/budgetTransfer/' + claimId; | ||
_context30.next = 3; | ||
_context29.next = 3; | ||
return service.get(url); | ||
case 3: | ||
response = _context30.sent; | ||
return _context30.abrupt('return', response); | ||
response = _context29.sent; | ||
return _context29.abrupt('return', response); | ||
case 5: | ||
case 'end': | ||
return _context30.stop(); | ||
return _context29.stop(); | ||
} | ||
} | ||
}, _callee30, undefined); | ||
}, _callee29, undefined); | ||
})); | ||
return function (_x107, _x108) { | ||
return _ref45.apply(this, arguments); | ||
return function (_x103, _x104) { | ||
return _ref43.apply(this, arguments); | ||
}; | ||
@@ -1034,10 +1000,10 @@ }(); | ||
return function () { | ||
var _ref46 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee31(baseUrl, locationId, token, AssetKey, ItemID, Tag) { | ||
var _ref44 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee30(baseUrl, locationId, token, AssetKey, ItemID, Tag) { | ||
var url; | ||
return _regenerator2.default.wrap(function _callee31$(_context31) { | ||
return _regenerator2.default.wrap(function _callee30$(_context30) { | ||
while (1) { | ||
switch (_context31.prev = _context31.next) { | ||
switch (_context30.prev = _context30.next) { | ||
case 0: | ||
url = baseUrl + '/alpha/api/Claim?Token=' + token + '&LocationID=' + locationId + '&InputType=JSON&MimeType=application/json'; | ||
return _context31.abrupt('return', service.post(url, { | ||
return _context30.abrupt('return', service.post(url, { | ||
Data: { | ||
@@ -1052,12 +1018,12 @@ AssetKey: AssetKey, | ||
case 'end': | ||
return _context31.stop(); | ||
return _context30.stop(); | ||
} | ||
} | ||
}, _callee31, undefined); | ||
}, _callee30, undefined); | ||
})); | ||
return function (_x109, _x110, _x111, _x112, _x113, _x114) { | ||
return _ref46.apply(this, arguments); | ||
return function (_x105, _x106, _x107, _x108, _x109, _x110) { | ||
return _ref44.apply(this, arguments); | ||
}; | ||
}(); | ||
}; |
{ | ||
"name": "@como/como-client", | ||
"version": "0.1.44", | ||
"version": "0.1.45", | ||
"description": "Client module for Como's loaylty API", | ||
@@ -5,0 +5,0 @@ "main": "src/como.js", |
@@ -174,3 +174,3 @@ const moment = require('moment-timezone'); | ||
} | ||
}; | ||
} | ||
@@ -183,3 +183,3 @@ /** | ||
*/ | ||
async registerVerify(verification, type, form){ | ||
async registerVerify(verification, type, form) { | ||
const { api } = this.comoData; | ||
@@ -196,3 +196,3 @@ try { | ||
} | ||
}; | ||
} | ||
@@ -771,17 +771,2 @@ /** | ||
/** | ||
* @param {Integer} amount to charge | ||
* @param {String} creditCardToken to charge from | ||
* @param {String} itemName for submit purchase | ||
* @param {String} itemNumber for submit purchase | ||
* @param {String} membershipKey for user identification | ||
*/ | ||
async purchaseHistory(membershipKey) { | ||
const { | ||
api, locationId, token, env_params: env, | ||
} = this.comoData; | ||
const responseJson = await api.QueryPurchases(env.zapp_root, locationId, token, membershipKey); | ||
return responseJson; | ||
} | ||
async knowYourData(email) { | ||
@@ -797,5 +782,5 @@ const { | ||
api, locationId, token, env_params: env, | ||
} = this.comoData; | ||
} = this.comoData; | ||
return api.consentWithdraw(env.services_root, locationId, token, consentData); | ||
}; | ||
} | ||
@@ -825,4 +810,2 @@ async getPaymentMethods() { | ||
/** | ||
@@ -829,0 +812,0 @@ * @param {string} creditCardToken which card to delete |
Sorry, the diff of this file is too big to display
193640
4212