@como/como-client 0.1.292 → 0.1.991

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/.babelrc DELETED
@@ -1,15 +0,0 @@
1
- {
2
- "presets": [
3
- "es2015",
4
- "stage-2"
5
- ],
6
- "plugins": [
7
- [
8
- "transform-runtime",
9
- {
10
- "polyfill": true,
11
- "regenerator": true
12
- }
13
- ]
14
- ]
15
- }
package/.eslintignore DELETED
@@ -1 +0,0 @@
1
- lib
package/.eslintrc DELETED
@@ -1,46 +0,0 @@
1
- {
2
- "rules": {
3
- "no-console": 0,
4
- "no-underscore-dangle": 0,
5
- "no-unused-vars": [
6
- "error",
7
- {
8
- "argsIgnorePattern": "next"
9
- }
10
- ],
11
- "no-use-before-define": [
12
- "error",
13
- {
14
- "variables": false
15
- }
16
- ],
17
- "no-multi-str": 0,
18
- "no-mixed-spaces-and-tabs": "warn",
19
- "indent": [
20
- "warn",
21
- 4
22
- ],
23
- "max-len": [
24
- "warn",
25
- 120
26
- ],
27
- "arrow-parens": [
28
- "warn",
29
- "as-needed"
30
- ],
31
- "semi": [
32
- "warn",
33
- "always"
34
- ]
35
- },
36
- "env": {
37
- "node": true,
38
- "mocha": true
39
- },
40
- "parserOptions": {
41
- "ecmaVersion": 8
42
- },
43
- "extends": [
44
- "airbnb-base"
45
- ]
46
- }
@@ -1,14 +0,0 @@
1
- {
2
- // Use IntelliSense to learn about possible attributes.
3
- // Hover to view descriptions of existing attributes.
4
- // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5
- "version": "0.2.0",
6
- "configurations": [
7
- {
8
- "type": "node",
9
- "request": "launch",
10
- "name": "Launch Program",
11
- "program": "${workspaceFolder}/test.js"
12
- }
13
- ]
14
- }
package/.whitesource DELETED
@@ -1,7 +0,0 @@
1
- ##########################################################
2
- #### WhiteSource "Bolt for Github" configuration file ####
3
- ##########################################################
4
-
5
- # Configuration #
6
- #---------------#
7
- ws.repo.scan=true
@@ -1,84 +0,0 @@
1
- const expect = require('expect');
2
- const comoExternalUrlTranslator = require('../src/utils/comoExternalUrlTranslator');
3
-
4
- const api = null;
5
- const assetID = '9B1jENJz9BN3jrXsM3lsv9CNGyg2RFDeKviFEl9DuO48';
6
- const accessibilityData = null;
7
- const locationId = 'qa_5373';
8
- const token = 'eab04cc5-4b65-41ab-a39a-9fe77545a6d7';
9
- const gpsData = {
10
- latitude: 37.12321,
11
- longitude: 45.4123,
12
- };
13
- const servicesRoot = 'loyalty-services';
14
- const membership = {
15
- CommonExtID: '69bc64f9-5baa-47c2-b49f-1314ebf2ed3d',
16
- Tag: [
17
- 'TempFromScratch1',
18
- 'stambdika',
19
- 'asdasdasdasda',
20
- '*Behavior|Days Since Last Visit|0-6*',
21
- '*Personal|Preferred Location|Ness Ziona*',
22
- '*Personal|2nd Preferred Location|Ilan Ramon Street*',
23
- 'asd',
24
- 'viki060820182',
25
- 'kkkkk2018',
26
- 'Tag1',
27
- 'Tag2',
28
- '*Behavior|Spend Level|Heavy*',
29
- ],
30
- };
31
- const assets = [
32
- {
33
- Key: '9B1jENJz9BN3jrXsM3lsv9CNGyg2RFDeKviFEl9DuO48',
34
- Description: 'Mini Burger',
35
- },
36
- ];
37
- const locationData = null;
38
-
39
- const apiObjects = { api, servicesRoot };
40
-
41
- const dataToUse = {
42
- locationId, token, membership, locationData, assets, gpsData, assetID, accessibilityData,
43
- };
44
-
45
- const url = 'https://www.test.com?locationId=_#Local#LocationID#_&gpsLat=_#GetLatLong#Lat#_&gpsLong=_#GetLatLong#Long#_&extId=_#UserAtLocation#CommonExtID#_&assetData=_#Asset#Description#_&tag=_#UserAtLocation#Tag#_&test=true';
46
-
47
- describe('Translate url', async () => {
48
- it('Translate url ', async () => {
49
- const data = await comoExternalUrlTranslator.translateUrl(url, apiObjects, dataToUse);
50
- expect(data).toEqual('https://www.test.com?locationId=qa_5373&gpsLat=37.12321&gpsLong=45.4123&extId=69bc64f9-5baa-47c2-b49f-1314ebf2ed3d&assetData=Mini%20Burger&tag=TempFromScratch1,stambdika,asdasdasdasda,*Behavior%7CDays%20Since%20Last%20Visit%7C0-6*,*Personal%7CPreferred%20Location%7CNess%20Ziona*,*Personal%7C2nd%20Preferred%20Location%7CIlan%20Ramon%20Street*,asd,viki060820182,kkkkk2018,Tag1,Tag2,*Behavior%7CSpend%20Level%7CHeavy*&test=true');
51
- });
52
- });
53
-
54
- describe('Translate url, NO gps', async () => {
55
- it('Translate url, NO gps', async () => {
56
- dataToUse.gpsData = null;
57
- const data = await comoExternalUrlTranslator.translateUrl(url, apiObjects, dataToUse);
58
- expect(data).toEqual('https://www.test.com?locationId=qa_5373&gpsLat=&gpsLong=&extId=69bc64f9-5baa-47c2-b49f-1314ebf2ed3d&assetData=Mini%20Burger&tag=TempFromScratch1,stambdika,asdasdasdasda,*Behavior%7CDays%20Since%20Last%20Visit%7C0-6*,*Personal%7CPreferred%20Location%7CNess%20Ziona*,*Personal%7C2nd%20Preferred%20Location%7CIlan%20Ramon%20Street*,asd,viki060820182,kkkkk2018,Tag1,Tag2,*Behavior%7CSpend%20Level%7CHeavy*&test=true');
59
- });
60
- });
61
-
62
- describe('Translate url, NO gps, No membership', async () => {
63
- it('Translate url, NO gps, NO membership', async () => {
64
- dataToUse.membership = null;
65
- const data = await comoExternalUrlTranslator.translateUrl(url, apiObjects, dataToUse);
66
- expect(data).toEqual('https://www.test.com?locationId=qa_5373&gpsLat=&gpsLong=&extId=&assetData=Mini%20Burger&tag=&test=true');
67
- });
68
- });
69
-
70
- describe('Translate url, NO gps, No membership, No assetID', async () => {
71
- it('Translate url, NO gps, No membership, No assetID', async () => {
72
- dataToUse.assetID = null;
73
- const data = await comoExternalUrlTranslator.translateUrl(url, apiObjects, dataToUse);
74
- expect(data).toEqual('https://www.test.com?locationId=qa_5373&gpsLat=&gpsLong=&extId=&assetData=&tag=&test=true');
75
- });
76
- });
77
-
78
- describe('Translate url, NO gps, No membership, No assetID, No LocationID', async () => {
79
- it('Translate url, NO gps, No membership, No assetID, No LocationID', async () => {
80
- dataToUse.locationId = null;
81
- const data = await comoExternalUrlTranslator.translateUrl(url, apiObjects, dataToUse);
82
- expect(data).toEqual('https://www.test.com?locationId=null&gpsLat=&gpsLong=&extId=&assetData=&tag=&test=true');
83
- });
84
- });
package/src/config/env.js DELETED
@@ -1,33 +0,0 @@
1
- module.exports = {
2
- hotfix: {
3
- gateway: 'https://janua-env.como.com',
4
- zapp_root: 'loyalty-zapp',
5
- services_root: 'loyalty-services',
6
- app_modules_root: 'https://janua-env.como.com/app-modules',
7
- app_modules_legacy_root: 'https://appmodules-hotfix.como.com',
8
- },
9
- qa: {
10
- gateway: 'https://janua-dev.como.com',
11
- zapp_root: 'loyalty-zapp',
12
- services_root: 'loyalty-services',
13
- services_root_temp: 'https://services.comoqa.bcomo.com',
14
- app_modules_root: 'https://janua-dev.como.com/app-modules',
15
- app_modules_legacy_root: 'https://appmodules-qa.como.com',
16
- },
17
- prod: {
18
- gateway: 'https://janua.como.com',
19
- zapp_root: 'loyalty-zapp',
20
- services_root: 'loyalty-services',
21
- services_root_temp: 'https://services.prod.bcomo.com',
22
- app_modules_root: 'https://janua.como.com/app-modules',
23
- app_modules_legacy_root: 'https://appmodules-prod.como.com',
24
- },
25
- test: {
26
- gateway: 'https://janua-env.como.com',
27
- zapp_root: 'loyalty-zapp',
28
- services_root: 'loyalty-services',
29
- services_root_temp: 'https://services.comoqa.bcomo.com',
30
- app_modules_root: 'https://janua-env.como.com/app-modules',
31
- app_modules_legacy_root: 'https://appmodules-qa.como.com',
32
- },
33
- };
@@ -1,2 +0,0 @@
1
-
2
- exports.LOCATION_DATA = 'LocationData';
@@ -1,75 +0,0 @@
1
- const moment = require('moment-timezone');
2
-
3
- /**
4
- * Checks if the given date format is before current date.
5
- *
6
- * @param {string} expires date format
7
- */
8
- const isExpired = expires => moment(expires).isBefore(moment());
9
-
10
- /**
11
- * Returns a bearer token http request header
12
- *
13
- * @param {string} token
14
- */
15
- const authHeader = token => ({ Authorization: `Bearer ${token}` });
16
-
17
-
18
- /**
19
- * Request interceptor which handles token expiry, and token header is present.
20
- *
21
- * @param {func} getCredentials a callback returning the current active session credentials
22
- * @param {func} refresher an api call to use the refresh token and get new credentials
23
- */
24
- /* eslint-disable no-param-reassign */
25
- exports.tokenInterceptor = (getCredentials, refresher) => async config => {
26
- const { expiresIn } = getCredentials();
27
- if (expiresIn && isExpired(expiresIn)) {
28
- try {
29
- await refresher();
30
- } catch (err) {
31
- console.log(err);
32
- throw new Error('Could not refresh token');
33
- }
34
- }
35
-
36
- const { accessToken } = getCredentials();
37
- if (accessToken) {
38
- config.headers = {
39
- ...config.headers,
40
- ...authHeader(accessToken),
41
- };
42
- } else if (config.headers.Authorization) {
43
- delete config.headers.Authorization;
44
- }
45
-
46
- return config;
47
- };
48
-
49
- /**
50
- * Response failed interceptor handles token expiry and refreshes it
51
- *
52
- * @param {func} refresher an api call to use the refresh token and get new credentials
53
- * @param {Object} service request handler
54
- */
55
- /* eslint-disable no-param-reassign */
56
- exports.refreshInterceptor = (refresher, service) => async error => {
57
- if (error.response) {
58
- if (!error.response.headers['janua-token-expired']) {
59
- throw error;
60
- }
61
- } else {
62
- throw error;
63
- }
64
-
65
- const { config } = error;
66
- try {
67
- await refresher();
68
- } catch (err) {
69
- console.log(err);
70
- throw new Error('Could not refresh token');
71
- }
72
-
73
- const res = await service.request(config);
74
- return res;
75
- };
@@ -1,12 +0,0 @@
1
- /**
2
- * Response success interceptor which handles refresh session credentials
3
- *
4
- * @param {func} credentialsRefresh a callback which refreshes the current session credentials
5
- */
6
- exports.responseInterceptor = credentialsRefresh => async response => {
7
- if (response.headers['janua-token-modified']) {
8
- const { accessToken, refreshToken, expiresIn } = response.data;
9
- credentialsRefresh({ accessToken, refreshToken, expiresIn }, true);
10
- }
11
- return response;
12
- };
@@ -1,54 +0,0 @@
1
- exports.signOn = service => async (deviceId, locationId) => {
2
- const params = { deviceId, locationId };
3
- const { data } = await service.post('/auth/v1/auth/signOn', params);
4
- return data;
5
- };
6
-
7
- exports.register = service => async form => {
8
- const { data } = await service.post('/auth/v1/registration', { form });
9
- return data;
10
- };
11
-
12
- exports.registerVerify = service => async (code, type, form) => {
13
- const body = { code, type, form };
14
- const { data } = await service.post('/auth/v1/registration/verify', body);
15
- return data;
16
- };
17
-
18
- exports.updateProfile = service => async form => {
19
- const { data } = await service.post('/auth/v1/update-profile', { form });
20
- return data;
21
- };
22
-
23
- exports.updateProfileVerify = service => async (code, type, form) => {
24
- const body = { code, type, form };
25
- const { data } = await service.post('/auth/v1/update-profile/verify', body);
26
- return data;
27
- };
28
-
29
- exports.logIn = service => async (type, identifier) => {
30
- const params = { type, identifier };
31
- const { data } = await service.post('/auth/v1/auth/logIn', params);
32
- return data;
33
- };
34
-
35
- exports.logInVerify = service => async (code, type, identifier) => {
36
- const params = {
37
- identifier,
38
- code,
39
- type,
40
- };
41
- const { data } = await service.post('/auth/v1/auth/logInVerify', params);
42
- return data;
43
- };
44
-
45
- exports.logOut = service => async () => {
46
- const { data } = await service.post('/auth/v1/auth/logOut');
47
- return data;
48
- };
49
-
50
- exports.refreshToken = service => async (uid, token) => {
51
- const params = { uid, refreshToken: token };
52
- const { data } = await service.post('/auth/v1/auth/refresh-token', params);
53
- return data;
54
- };
@@ -1,17 +0,0 @@
1
- exports.getForm = service => async (type, locationId) => {
2
- const url = `/v1/form/${type}/${locationId}`;
3
- const { data } = await service.get(url);
4
- return data;
5
- };
6
-
7
- exports.getConfiguration = service => async (type, locationId) => {
8
- const url = `/v1/config/${type}/${locationId}`;
9
- const { data } = await service.get(url);
10
- return data;
11
- };
12
-
13
- exports.getResource = service => async (type, locationId, token) => {
14
- const url = `/v1/resource/${type}/?tags=${locationId},v1.0,GA`;
15
- const { data } = await service.get(url);
16
- return data;
17
- };
@@ -1,54 +0,0 @@
1
- const axios = require('axios');
2
- const { tokenInterceptor, refreshInterceptor } = require('../interceptors/refresh');
3
- const { responseInterceptor } = require('../interceptors/response');
4
- const auth = require('./auth.service');
5
- const loyalty = require('./loyalty.service');
6
- const form = require('./form.service');
7
-
8
- exports.getService = (baseURL, uid, getCredentials, credentialsRefresh) => {
9
- const httpClient = axios.create({ baseURL });
10
-
11
- /**
12
- * TODO: Make refresher prettier.
13
- * Locks the refresh-token api call.
14
- * If multiple consumers gets 401 Unauthorized it makes sure to refresh only once.
15
- */
16
- let refreshPromise = null;
17
- const refresher = () => {
18
- if (refreshPromise) { return refreshPromise; }
19
-
20
- const { refreshToken } = getCredentials();
21
-
22
- credentialsRefresh({ accessToken: false });
23
- const refreshService = auth.refreshToken(httpClient);
24
- refreshPromise = refreshService(uid, refreshToken)
25
- .then(creds => {
26
- refreshPromise = null;
27
- return creds;
28
- });
29
- return refreshPromise;
30
- };
31
-
32
- httpClient.interceptors.request.use(
33
- tokenInterceptor(getCredentials, refresher),
34
- err => Promise.reject(err),
35
- );
36
- httpClient.interceptors.response.use(
37
- responseInterceptor(credentialsRefresh),
38
- refreshInterceptor(refresher, httpClient),
39
- );
40
- const apiCalls = {
41
- ...auth,
42
- ...loyalty,
43
- ...form,
44
- };
45
-
46
- // Inject service instance to all service calls
47
- const service = Object.keys(apiCalls)
48
- .reduce((prev, curr) => {
49
- prev[curr] = apiCalls[curr](httpClient); // eslint-disable-line no-param-reassign
50
- return prev;
51
- }, {});
52
-
53
- return { service, refresher };
54
- };
@@ -1,240 +0,0 @@
1
- const moment = require('moment-timezone');
2
- const axios = require('axios');
3
- const urlsUtils = require('../utils/urls');
4
-
5
- const buildResourceUrl = (baseUrl, resourceId, namespace, version) =>
6
- `${baseUrl}/GetResource?namespace=${namespace}&resourceId=${resourceId}&version=${version}`;
7
-
8
- exports.legacySignOn = service => async (baseUrl, deviceId) => {
9
- const url = `${baseUrl}/alpha/api/SignOn?InputType=json&MimeType=application/json`;
10
- const response = await service.post(url, {
11
- DeviceID: deviceId,
12
- InstallationID: deviceId,
13
- });
14
-
15
- return response.data;
16
- };
17
-
18
- exports.getLocationState = service => async (baseUrl, locationId) => {
19
- const url = `${baseUrl}/alpha/api/GetLocationState?InputType=json&MimeType=application/json`;
20
- const response = await service.post(url, { LocationID: locationId });
21
- return response.data;
22
- };
23
-
24
- exports.getUserAtLocation = service => async (baseUrl, locationId, onlyAssetKeys = false) => {
25
- const url = `${baseUrl}/alpha/api/GetUserAtLocation?MimeType=application/json&InputType=json&OnlyAssetKeys=${onlyAssetKeys}`;
26
- const { data } = await service.post(url, {
27
- LocationID: locationId,
28
- });
29
- if (data && data.Error) {
30
- return null;
31
- }
32
- return data;
33
- };
34
-
35
- exports.memberAssets = service => async (baseUrl, locationId, archived = false) => {
36
- const archivedText = archived ? 'OnlyArchived' : 'OnlyUnarchived';
37
- const url = `${baseUrl}/memberAssets?requestKind=${archivedText}&locationId=${locationId}`;
38
- const { data } = await service.get(url);
39
- return data;
40
- };
41
-
42
- exports.redeemAsset = service => async (baseUrl, locationId, assetKey) => {
43
- const url = `${baseUrl}/alpha/api/RedeemAsset?InputType=json&MimeType=application/json`;
44
- const { data } = await service.post(url, {
45
- LocationID: locationId,
46
- AssetKey: assetKey,
47
- });
48
- return data;
49
- };
50
-
51
- exports.getShortUserId = service => async (baseUrl, locationId) => {
52
- const url = `${baseUrl}/alpha/api/GetShortUserID?InputType=json&MimeType=application/json`;
53
- const { data } = await service.post(url, {
54
- Namespace: locationId,
55
- });
56
- return data;
57
- };
58
-
59
- exports.getPaymentCode = service => async (baseUrl, locationId) => {
60
- const url = `${baseUrl}/alpha/api/GetClientVerificationCode?InputType=json&MimeType=application/json`;
61
- const { data } = await service.post(url, {
62
- LocationID: locationId,
63
- });
64
- return data;
65
- };
66
-
67
- exports.purchaseAsset = service => async (baseUrl, locationId, token, itemId) => {
68
- const url = `${baseUrl}/alpha/api/PurchaseAsset?InputType=json&MimeType=application/json&Token=${token}`;
69
- const { data } = await service.post(url, {
70
- LocationID: locationId,
71
- ItemID: itemId,
72
- });
73
- return data;
74
- };
75
-
76
- exports.getResourceUrl = service => (baseUrl, resourceId, namespace, version) =>
77
- `${buildResourceUrl(baseUrl, resourceId, namespace, version)}`;
78
-
79
- exports.getLoyaltyResource = service => async (baseUrl, resourceId, namespace, version) => {
80
- const url = buildResourceUrl(baseUrl, resourceId, namespace, version);
81
- const { data } = await axios.get(url);
82
- return data;
83
- };
84
-
85
- exports.generateReferralCode = service => async (baseUrl, token, locationId) => {
86
- const url = `${baseUrl}/referralCode/generate?locationId=${locationId}&token=${token}`;
87
- const { data } = await service.post(url);
88
-
89
- return data;
90
- };
91
-
92
- exports.openApp = service => async (baseUrl, token, locationId, data) => {
93
- const dateNow = moment();
94
- const url = `${baseUrl}/alpha/api/OpenApp?InputType=json&locationId=${locationId}&token=${token}&Action=openedclub&TimeStamp=${dateNow}`;
95
- const response = await service.post(url, { LocationID: locationId, Data: data });
96
- return response;
97
- };
98
-
99
- exports.clientUpdateMembership = service => async (baseUrl, token, locationId, pushEnable, locationEnable) => {
100
- const url = `${baseUrl}/memberships/clientUpdateMembership?locationId=${locationId}&token=${token}`;
101
- const response = await service.put(url, { PushNotificationEnabled: pushEnable, LocationEnabled: locationEnable });
102
- return response;
103
- };
104
-
105
- exports.generateTemporaryToken = service => async (baseUrl, locationId, token, timeToLive) => {
106
- const url = `${baseUrl}/memberships/generateToken?locationId=${locationId}&token=${token}`;
107
- const { data } = await service.post(url, {
108
- timeToLive,
109
- }, {
110
- headers: { 'Content-Type': 'application/json' },
111
- });
112
-
113
- return data;
114
- };
115
-
116
- exports.getFeedbackFormData = service => async (baseUrl, locationId, token) => {
117
- const url = `${baseUrl}/alpha/api/SendFeedback?LocationID=${locationId}&Token=${token}&MimeType=application/json`;
118
- const { data } = await service.get(url);
119
- return data;
120
- };
121
-
122
- exports.sendPushChannel = service => async (baseUrl, locationId, token, identifier) => {
123
- const url = `${baseUrl}/push_channels?locationId=${locationId}&token=${token}`;
124
- const response = await service.post(url, {
125
- type: 'fcm',
126
- identifier,
127
- });
128
- return response;
129
- };
130
-
131
- exports.getClientBusinessBackend = service => async (baseUrl, token, locationId) => {
132
- const url = `${baseUrl}/alpha/api/ClientGetBusinessBackend?LocationID=${locationId}&Token=${token}&MimeType=application/json`;
133
- const { data } = await service.post(url);
134
- return data;
135
- };
136
-
137
-
138
- exports.sendCouponCode = service => async (baseUrl, locationId, token, code) => {
139
- const url = `${baseUrl}/alpha/api/DoCodeBasedAction?LocationID=${locationId}&Token=${token}&Code=${code}&InputType=json&MimeType=application/json`;
140
- const response = await service.post(url);
141
- return response;
142
- };
143
-
144
- exports.addPaymentMethod = service => async (baseUrl, locationId, token, cardToken) => service({
145
- method: 'post',
146
- url: `${baseUrl}/payments/v2/methods/${cardToken}?locationId=${locationId}`,
147
- timeout: 5000, // Wait for 5 seconds
148
- });
149
-
150
- exports.getPaymentMethods = service => async (baseUrl, locationId) => service({
151
- method: 'get',
152
- url: `${baseUrl}/payments/v2/methods?locationId=${locationId}&InputType=json&MimeType=application/json`,
153
- timeout: 5000, // Wait for 5 seconds
154
- });
155
-
156
- exports.payInApp = service => async (baseUrl, locationId, token, amount, creditCardToken, itemName, itemNumber, membershipKey) => service({
157
- method: 'post',
158
- url: `${baseUrl}/payments/v2/payments/charge?locationId=${locationId}`,
159
- timeout: 5000, // Wait for 5 seconds
160
- data: {
161
- amount,
162
- payment_method: {
163
- type: 'tokenized',
164
- token: creditCardToken,
165
- },
166
- additional_details: {
167
- paymentFlow: 'PayInApp',
168
- quantity: '1',
169
- itemNumber,
170
- itemName,
171
- membershipKey,
172
- },
173
- },
174
- });
175
-
176
- exports.deletePayment = service => async (baseUrl, locationId, token, creditCardToken) => {
177
- const url = `${baseUrl}/payments/v2/methods/${creditCardToken}?locationId=${locationId}`;
178
- const response = await service.delete(url);
179
- return response;
180
- };
181
-
182
- exports.getMemberMessages = service => async (baseUrl, locationId, tag, limit, offset) => {
183
- const query = {
184
- locationId,
185
- MimeType: 'application/json',
186
- tag,
187
- limit,
188
- offset,
189
- };
190
- const url = urlsUtils.appendQuery(`${baseUrl}/memberMessages`, query);
191
- return service.get(url);
192
- };
193
-
194
-
195
- exports.markAsReadMemberMessages = service => async (baseUrl, locationId, keysList) => {
196
- const url = `${baseUrl}/memberMessages/markAsRead/v2?locationId=${locationId}`;
197
- const response = await service.put(url, {
198
- keys: keysList,
199
- });
200
- return response;
201
- };
202
-
203
- exports.budgetTransfer = service => async (baseUrl, locationId, receiver, sender, amount, wallet) => {
204
- return service({
205
- method: 'post',
206
- url: `${baseUrl}/budgetTransfer?locationId=${locationId}`,
207
- timeout: 5000, // Wait for 5 seconds
208
- data: {
209
- receiver,
210
- sender,
211
- amount,
212
- wallet,
213
- },
214
- });
215
- };
216
- exports.budgetTransferClaim = service => async (baseUrl, locationId, claimCode) => {
217
- return service({
218
- method: 'post',
219
- url: `${baseUrl}/budgetTransfer/${claimCode}/claim?locationId=${locationId}`,
220
- timeout: 5000, // Wait for 5 seconds
221
- });
222
- };
223
-
224
- exports.getCreditClaimData = service => async (baseUrl, claimId) => {
225
- const url = `${baseUrl}/budgetTransfer/${claimId}`;
226
- const response = await service.get(url);
227
- return response;
228
- };
229
-
230
- exports.claim = service => async (baseUrl, locationId, token, AssetKey, ItemID, Tag) => {
231
- const url = `${baseUrl}/alpha/api/Claim?Token=${token}&LocationID=${locationId}&InputType=JSON&MimeType=application/json`;
232
- return service.post(url, {
233
- Data: {
234
- AssetKey,
235
- ItemID,
236
- Tag,
237
- },
238
- });
239
- };
240
-