@crmcom/self-service-sdk 3.0.0-build.13 → 3.0.0-build.17

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.
Files changed (3) hide show
  1. package/index.d.ts +1 -0
  2. package/package.json +2 -2
  3. package/rewards.js +38 -0
package/index.d.ts CHANGED
@@ -383,6 +383,7 @@ export declare const rewards: {
383
383
  searchRewardSchemes(params?: PaginationParams & { is_signed?: boolean; name?: string }): Promise<SDKResult>;
384
384
  verifyClosedLoopScheme(params: { sign_up_code: string }): Promise<SDKResult>;
385
385
  sendRefferals(params?: { recipients?: any[]; action?: string }): Promise<SDKResult>;
386
+ listRefferals(params?: PaginationParams & { date?: string; date_gt?: string; date_gte?: string; date_lt?: string; date_lte?: string; reference_number?: string; referred_by_contact_id?: string; referred_contact_id?: string; state?: string; organisations?: string }): Promise<SDKResult>;
386
387
  redeemPass(params?: { code?: string; pin?: string; wallet_id?: string }): Promise<SDKResult>;
387
388
  reclaimPurchase(params?: { purchase_id?: string; merchant_tap?: string; venue_tap?: string; net_amount?: number; tax_amount?: number; discount_amount?: number; total_amount?: number; transaction_code?: string }): Promise<SDKResult>;
388
389
  signUpRewardScheme(params: { reward_scheme_id: string; email_address?: string; sign_up_code?: string }): Promise<SDKResult>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crmcom/self-service-sdk",
3
- "version": "3.0.0-build.13",
3
+ "version": "3.0.0-build.17",
4
4
  "description": "Official CRM.COM Self-Service JavaScript SDK for consumer-facing API integration",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -58,6 +58,6 @@
58
58
  },
59
59
  "repository": {
60
60
  "type": "git",
61
- "url": "https://bitbucket.org/nicostella/shared_libs_v2.git"
61
+ "url": "https://bitbucket.org/crmcom5/shared_libs_v2.git"
62
62
  }
63
63
  }
package/rewards.js CHANGED
@@ -10,6 +10,7 @@ export const rewards = {
10
10
  searchRewardSchemes,
11
11
  verifyClosedLoopScheme,
12
12
  sendRefferals,
13
+ listRefferals,
13
14
  redeemPass,
14
15
  reclaimPurchase,
15
16
  signUpRewardScheme,
@@ -232,6 +233,43 @@ async function sendRefferals({
232
233
  }
233
234
  }
234
235
 
236
+ async function listRefferals({
237
+ page = 1,
238
+ size = 20,
239
+ date,
240
+ date_gt,
241
+ date_gte,
242
+ date_lt,
243
+ date_lte,
244
+ include_total,
245
+ order,
246
+ state,
247
+ sort,
248
+ } = {}) {
249
+ try {
250
+ let response = await httpUtil.get({
251
+ resourcePath: '/v2/referrals',
252
+ queryParams: {
253
+ page,
254
+ size,
255
+ date,
256
+ date_gt,
257
+ date_gte,
258
+ date_lt,
259
+ date_lte,
260
+ include_total,
261
+ order,
262
+ state,
263
+ sort
264
+ }
265
+ });
266
+ return createCommonResult(response);
267
+ } catch (e) {
268
+ logger.error('Exception listRefferals:', e);
269
+ return createResult(ErrorCodes.UNKNOWN, e);
270
+ }
271
+ }
272
+
235
273
  async function redeemPass({
236
274
  code,
237
275
  pin,