@hualiglobal/kirimel-node-sdk 0.1.4 → 2.0.0
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/README.md +153 -1
- package/dist/client.d.ts +23 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +50 -0
- package/dist/client.js.map +1 -1
- package/dist/loyaltyHttpClient.d.ts +27 -0
- package/dist/loyaltyHttpClient.d.ts.map +1 -0
- package/dist/loyaltyHttpClient.js +122 -0
- package/dist/loyaltyHttpClient.js.map +1 -0
- package/dist/resources/loyalty/Customers.d.ts +36 -0
- package/dist/resources/loyalty/Customers.d.ts.map +1 -0
- package/dist/resources/loyalty/Customers.js +31 -0
- package/dist/resources/loyalty/Customers.js.map +1 -0
- package/dist/resources/loyalty/Points.d.ts +30 -0
- package/dist/resources/loyalty/Points.d.ts.map +1 -0
- package/dist/resources/loyalty/Points.js +22 -0
- package/dist/resources/loyalty/Points.js.map +1 -0
- package/dist/resources/loyalty/Vouchers.d.ts +36 -0
- package/dist/resources/loyalty/Vouchers.d.ts.map +1 -0
- package/dist/resources/loyalty/Vouchers.js +25 -0
- package/dist/resources/loyalty/Vouchers.js.map +1 -0
- package/dist/resources/loyalty/Wallet.d.ts +15 -0
- package/dist/resources/loyalty/Wallet.d.ts.map +1 -0
- package/dist/resources/loyalty/Wallet.js +16 -0
- package/dist/resources/loyalty/Wallet.js.map +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
# KiriMel Node.js SDK
|
|
2
2
|
|
|
3
|
-
Official Node.js SDK for KiriMel Email Marketing API.
|
|
3
|
+
Official Node.js SDK for KiriMel Email Marketing API & Loyalty API.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Email API**: Manage campaigns, subscribers, lists, templates, forms, workflows & more
|
|
8
|
+
- **Loyalty API**: Customer loyalty with points, vouchers, tiers, and wallet management
|
|
9
|
+
- **Unified Client**: Single SDK for both APIs with different authentication methods
|
|
10
|
+
- **TypeScript**: Full type definitions
|
|
11
|
+
- **Retry Logic**: Built-in exponential backoff for failed requests
|
|
4
12
|
|
|
5
13
|
## Installation
|
|
6
14
|
|
|
@@ -421,6 +429,150 @@ const nodeTypes = await client.workflows.nodeTypes();
|
|
|
421
429
|
const data = await client.workflows.getData(id);
|
|
422
430
|
```
|
|
423
431
|
|
|
432
|
+
## Loyalty API
|
|
433
|
+
|
|
434
|
+
The Loyalty API uses HMAC SHA256 signature authentication for secure POS integration. The SDK handles signature calculation automatically.
|
|
435
|
+
|
|
436
|
+
### Authentication
|
|
437
|
+
|
|
438
|
+
```typescript
|
|
439
|
+
// Email API credentials (required)
|
|
440
|
+
const client = new Client({
|
|
441
|
+
apiKey: 'sk_test_xxx'
|
|
442
|
+
});
|
|
443
|
+
|
|
444
|
+
// Loyalty API credentials (optional - only if using loyalty features)
|
|
445
|
+
const client = new Client({
|
|
446
|
+
apiKey: 'sk_test_xxx',
|
|
447
|
+
clientKey: 'cli_test_xxx', // Or KIRIMEL_LOYALTY_CLIENT_KEY env var
|
|
448
|
+
clientSecret: 'your_secret_here' // Or KIRIMEL_LOYALTY_CLIENT_SECRET env var
|
|
449
|
+
});
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
### Customers
|
|
453
|
+
|
|
454
|
+
```typescript
|
|
455
|
+
// Register a new customer
|
|
456
|
+
const customer = await client.loyaltyCustomers.register({
|
|
457
|
+
phone: '+60123456789',
|
|
458
|
+
name: 'John Doe',
|
|
459
|
+
email: 'john@example.com',
|
|
460
|
+
birthDate: '1990-05-15', // Optional
|
|
461
|
+
qrCode: 'CUSTOMER_123' // Optional
|
|
462
|
+
});
|
|
463
|
+
|
|
464
|
+
// Look up customer by phone
|
|
465
|
+
const customer = await client.loyaltyCustomers.lookup({
|
|
466
|
+
phone: '+60123456789'
|
|
467
|
+
});
|
|
468
|
+
|
|
469
|
+
// Get customer profile
|
|
470
|
+
const profile = await client.loyaltyCustomers.get(customerId);
|
|
471
|
+
|
|
472
|
+
// Get customer transactions
|
|
473
|
+
const transactions = await client.loyaltyCustomers.transactions(customerId);
|
|
474
|
+
|
|
475
|
+
// Manually adjust points
|
|
476
|
+
await client.loyaltyCustomers.adjust(customerId, {
|
|
477
|
+
points: 50,
|
|
478
|
+
reference: 'MANUAL_ADJUST_001',
|
|
479
|
+
description: 'Goodwill gesture',
|
|
480
|
+
adjusted_by: 'Admin'
|
|
481
|
+
});
|
|
482
|
+
|
|
483
|
+
// Get customer tier
|
|
484
|
+
const tier = await client.loyaltyCustomers.tier(customerId);
|
|
485
|
+
|
|
486
|
+
// List customers
|
|
487
|
+
const customers = await client.loyaltyCustomers.list({
|
|
488
|
+
page: 1,
|
|
489
|
+
per_page: 50,
|
|
490
|
+
tier: 'gold'
|
|
491
|
+
});
|
|
492
|
+
```
|
|
493
|
+
|
|
494
|
+
### Points & Wallet
|
|
495
|
+
|
|
496
|
+
```typescript
|
|
497
|
+
// Award points
|
|
498
|
+
const earn = await client.loyaltyPoints.earn({
|
|
499
|
+
customer_id: customerId,
|
|
500
|
+
points: 100,
|
|
501
|
+
amount: 50.50,
|
|
502
|
+
reference_id: 'ORDER_123',
|
|
503
|
+
description: 'Purchase reward'
|
|
504
|
+
});
|
|
505
|
+
|
|
506
|
+
// Preview redemption (check before confirming)
|
|
507
|
+
const preview = await client.loyaltyPoints.previewRedeem({
|
|
508
|
+
customer_id: customerId,
|
|
509
|
+
points_to_redeem: 100
|
|
510
|
+
});
|
|
511
|
+
// Returns: points_value, max_redeemable, amount_discount
|
|
512
|
+
|
|
513
|
+
// Confirm redemption
|
|
514
|
+
const redeem = await client.loyaltyPoints.commitRedeem({
|
|
515
|
+
customer_id: customerId,
|
|
516
|
+
points_to_redeem: 100,
|
|
517
|
+
reference_id: 'BILL_456'
|
|
518
|
+
});
|
|
519
|
+
|
|
520
|
+
// Reverse transaction (if needed)
|
|
521
|
+
await client.loyaltyPoints.reverse({
|
|
522
|
+
transaction_id: transactionId,
|
|
523
|
+
reason: 'Customer return',
|
|
524
|
+
reference_id: 'RETURN_123'
|
|
525
|
+
});
|
|
526
|
+
|
|
527
|
+
// Get wallet balance
|
|
528
|
+
const balance = await client.loyaltyWallet.balance({
|
|
529
|
+
customer_id: customerId
|
|
530
|
+
});
|
|
531
|
+
|
|
532
|
+
// Recalculate balance from ledger
|
|
533
|
+
const recalc = await client.loyaltyWallet.recalculate({
|
|
534
|
+
customer_id: customerId
|
|
535
|
+
});
|
|
536
|
+
```
|
|
537
|
+
|
|
538
|
+
### Vouchers
|
|
539
|
+
|
|
540
|
+
```typescript
|
|
541
|
+
// Create voucher batch
|
|
542
|
+
const batch = await client.loyaltyVouchers.createBatch({
|
|
543
|
+
name: 'Grand Opening Promo',
|
|
544
|
+
type: 'PERCENT', // or 'FIXED'
|
|
545
|
+
value: 10,
|
|
546
|
+
quantity: 100,
|
|
547
|
+
valid_from: '2024-06-01',
|
|
548
|
+
valid_until: '2024-12-31',
|
|
549
|
+
min_purchase: 50.00,
|
|
550
|
+
max_discount: 25.00
|
|
551
|
+
});
|
|
552
|
+
|
|
553
|
+
// List voucher batches
|
|
554
|
+
const batches = await client.loyaltyVouchers.listBatches();
|
|
555
|
+
|
|
556
|
+
// Issue voucher to customer
|
|
557
|
+
const issue = await client.loyaltyVouchers.issue({
|
|
558
|
+
voucher_batch_id: batchId,
|
|
559
|
+
customer_id: customerId,
|
|
560
|
+
delivered_via: 'email', // or 'sms'
|
|
561
|
+
reference_id: 'PROMO_001'
|
|
562
|
+
});
|
|
563
|
+
|
|
564
|
+
// Redeem voucher
|
|
565
|
+
const redeem = await client.loyaltyVouchers.redeem({
|
|
566
|
+
code: 'VOUCHER_A1B2C3D4E5F6',
|
|
567
|
+
customer_id: customerId,
|
|
568
|
+
purchase_amount: 75.00,
|
|
569
|
+
reference_id: 'ORDER_789'
|
|
570
|
+
});
|
|
571
|
+
|
|
572
|
+
// Get voucher details
|
|
573
|
+
const voucher = await client.loyaltyVouchers.get('VOUCHER_A1B2C3D4E5F6');
|
|
574
|
+
```
|
|
575
|
+
|
|
424
576
|
## Error Handling
|
|
425
577
|
|
|
426
578
|
```typescript
|
package/dist/client.d.ts
CHANGED
|
@@ -12,11 +12,23 @@ import { Conversions } from './resources/Conversions';
|
|
|
12
12
|
import { LandingPages } from './resources/LandingPages';
|
|
13
13
|
import { Workflows } from './resources/Workflows';
|
|
14
14
|
import { Webhooks } from './resources/Webhooks';
|
|
15
|
-
|
|
15
|
+
import { Customers } from './resources/loyalty/Customers';
|
|
16
|
+
import { Points } from './resources/loyalty/Points';
|
|
17
|
+
import { Vouchers } from './resources/loyalty/Vouchers';
|
|
18
|
+
import { Wallet } from './resources/loyalty/Wallet';
|
|
19
|
+
export interface ClientConfig extends HttpClientConfig {
|
|
16
20
|
logger?: any;
|
|
21
|
+
clientKey?: string;
|
|
22
|
+
clientSecret?: string;
|
|
17
23
|
}
|
|
18
24
|
export declare class Client {
|
|
19
25
|
private readonly httpClient;
|
|
26
|
+
private readonly loyaltyBaseUrl;
|
|
27
|
+
private readonly loyaltyClientKey?;
|
|
28
|
+
private readonly loyaltyClientSecret?;
|
|
29
|
+
private readonly timeout;
|
|
30
|
+
private readonly retries;
|
|
31
|
+
private logger?;
|
|
20
32
|
private _campaigns?;
|
|
21
33
|
private _subscribers?;
|
|
22
34
|
private _lists?;
|
|
@@ -27,7 +39,13 @@ export declare class Client {
|
|
|
27
39
|
private _landingPages?;
|
|
28
40
|
private _workflows?;
|
|
29
41
|
private _webhooks?;
|
|
42
|
+
private _loyaltyHttpClient?;
|
|
43
|
+
private _loyaltyCustomers?;
|
|
44
|
+
private _loyaltyPoints?;
|
|
45
|
+
private _loyaltyVouchers?;
|
|
46
|
+
private _loyaltyWallet?;
|
|
30
47
|
constructor(config?: ClientConfig);
|
|
48
|
+
private initLoyaltyClient;
|
|
31
49
|
get campaigns(): Campaigns;
|
|
32
50
|
get subscribers(): Subscribers;
|
|
33
51
|
get lists(): Lists;
|
|
@@ -38,5 +56,9 @@ export declare class Client {
|
|
|
38
56
|
get landingPages(): LandingPages;
|
|
39
57
|
get workflows(): Workflows;
|
|
40
58
|
get webhooks(): Webhooks;
|
|
59
|
+
get loyaltyCustomers(): Customers;
|
|
60
|
+
get loyaltyPoints(): Points;
|
|
61
|
+
get loyaltyVouchers(): Vouchers;
|
|
62
|
+
get loyaltyWallet(): Wallet;
|
|
41
63
|
}
|
|
42
64
|
//# sourceMappingURL=client.d.ts.map
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAc,gBAAgB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAc,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAE5D,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CA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AI,SAAS,CAKhC;IAED,IAAW,WAAW,IAAI,WAAW,CAKpC;IAED,IAAW,KAAK,IAAI,KAAK,CAKxB;IAED,IAAW,QAAQ,IAAI,QAAQ,CAK9B;IAED,IAAW,SAAS,IAAI,SAAS,CAKhC;IAED,IAAW,KAAK,IAAI,KAAK,CAKxB;IAED,IAAW,WAAW,IAAI,WAAW,CAKpC;IAED,IAAW,YAAY,IAAI,YAAY,CAKtC;IAED,IAAW,SAAS,IAAI,SAAS,CAKhC;IAED,IAAW,QAAQ,IAAI,QAAQ,CAK9B;IAID,IAAW,gBAAgB,IAAI,SAAS,CAKvC;IAED,IAAW,aAAa,IAAI,MAAM,CAKjC;IAED,IAAW,eAAe,IAAI,QAAQ,CAKrC;IAED,IAAW,aAAa,IAAI,MAAM,CAKjC;CACF"}
|
package/dist/client.js
CHANGED
|
@@ -5,6 +5,7 @@ exports.Client = void 0;
|
|
|
5
5
|
* KiriMel Node.js SDK Client
|
|
6
6
|
*/
|
|
7
7
|
const httpClient_1 = require("./httpClient");
|
|
8
|
+
const loyaltyHttpClient_1 = require("./loyaltyHttpClient");
|
|
8
9
|
const Campaigns_1 = require("./resources/Campaigns");
|
|
9
10
|
const Subscribers_1 = require("./resources/Subscribers");
|
|
10
11
|
const Lists_1 = require("./resources/Lists");
|
|
@@ -15,6 +16,10 @@ const Conversions_1 = require("./resources/Conversions");
|
|
|
15
16
|
const LandingPages_1 = require("./resources/LandingPages");
|
|
16
17
|
const Workflows_1 = require("./resources/Workflows");
|
|
17
18
|
const Webhooks_1 = require("./resources/Webhooks");
|
|
19
|
+
const Customers_1 = require("./resources/loyalty/Customers");
|
|
20
|
+
const Points_1 = require("./resources/loyalty/Points");
|
|
21
|
+
const Vouchers_1 = require("./resources/loyalty/Vouchers");
|
|
22
|
+
const Wallet_1 = require("./resources/loyalty/Wallet");
|
|
18
23
|
class Client {
|
|
19
24
|
constructor(config = {}) {
|
|
20
25
|
this.httpClient = new httpClient_1.HttpClient({
|
|
@@ -24,6 +29,26 @@ class Client {
|
|
|
24
29
|
retries: config.retries,
|
|
25
30
|
logger: config.logger,
|
|
26
31
|
});
|
|
32
|
+
// Store loyalty config for lazy initialization
|
|
33
|
+
this.loyaltyBaseUrl = (config.baseUrl || 'https://kirimel.com/api').replace('/api', '');
|
|
34
|
+
this.loyaltyClientKey = config.clientKey || process.env.KIRIMEL_LOYALTY_CLIENT_KEY;
|
|
35
|
+
this.loyaltyClientSecret = config.clientSecret || process.env.KIRIMEL_LOYALTY_CLIENT_SECRET;
|
|
36
|
+
this.timeout = config.timeout || 30000;
|
|
37
|
+
this.retries = config.retries || 3;
|
|
38
|
+
this.logger = config.logger;
|
|
39
|
+
}
|
|
40
|
+
initLoyaltyClient() {
|
|
41
|
+
if (!this._loyaltyHttpClient) {
|
|
42
|
+
this._loyaltyHttpClient = new loyaltyHttpClient_1.LoyaltyHttpClient({
|
|
43
|
+
clientKey: this.loyaltyClientKey,
|
|
44
|
+
clientSecret: this.loyaltyClientSecret,
|
|
45
|
+
baseUrl: this.loyaltyBaseUrl,
|
|
46
|
+
timeout: this.timeout,
|
|
47
|
+
retries: this.retries,
|
|
48
|
+
logger: this.logger,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
return this._loyaltyHttpClient;
|
|
27
52
|
}
|
|
28
53
|
get campaigns() {
|
|
29
54
|
if (!this._campaigns) {
|
|
@@ -85,6 +110,31 @@ class Client {
|
|
|
85
110
|
}
|
|
86
111
|
return this._webhooks;
|
|
87
112
|
}
|
|
113
|
+
// Loyalty API resources
|
|
114
|
+
get loyaltyCustomers() {
|
|
115
|
+
if (!this._loyaltyCustomers) {
|
|
116
|
+
this._loyaltyCustomers = new Customers_1.Customers(this.initLoyaltyClient());
|
|
117
|
+
}
|
|
118
|
+
return this._loyaltyCustomers;
|
|
119
|
+
}
|
|
120
|
+
get loyaltyPoints() {
|
|
121
|
+
if (!this._loyaltyPoints) {
|
|
122
|
+
this._loyaltyPoints = new Points_1.Points(this.initLoyaltyClient());
|
|
123
|
+
}
|
|
124
|
+
return this._loyaltyPoints;
|
|
125
|
+
}
|
|
126
|
+
get loyaltyVouchers() {
|
|
127
|
+
if (!this._loyaltyVouchers) {
|
|
128
|
+
this._loyaltyVouchers = new Vouchers_1.Vouchers(this.initLoyaltyClient());
|
|
129
|
+
}
|
|
130
|
+
return this._loyaltyVouchers;
|
|
131
|
+
}
|
|
132
|
+
get loyaltyWallet() {
|
|
133
|
+
if (!this._loyaltyWallet) {
|
|
134
|
+
this._loyaltyWallet = new Wallet_1.Wallet(this.initLoyaltyClient());
|
|
135
|
+
}
|
|
136
|
+
return this._loyaltyWallet;
|
|
137
|
+
}
|
|
88
138
|
}
|
|
89
139
|
exports.Client = Client;
|
|
90
140
|
//# sourceMappingURL=client.js.map
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,6CAA4D;AAC5D,qDAAkD;AAClD,yDAAsD;AACtD,6CAA0C;AAC1C,mDAAgD;AAChD,qDAAkD;AAClD,6CAA0C;AAC1C,yDAAsD;AACtD,2DAAwD;AACxD,qDAAkD;AAClD,mDAAgD;
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,6CAA4D;AAC5D,2DAAwD;AACxD,qDAAkD;AAClD,yDAAsD;AACtD,6CAA0C;AAC1C,mDAAgD;AAChD,qDAAkD;AAClD,6CAA0C;AAC1C,yDAAsD;AACtD,2DAAwD;AACxD,qDAAkD;AAClD,mDAAgD;AAChD,6DAA0D;AAC1D,uDAAoD;AACpD,2DAAwD;AACxD,uDAAoD;AASpD,MAAa,MAAM;IA4BjB,YAAY,SAAuB,EAAE;QACnC,IAAI,CAAC,UAAU,GAAG,IAAI,uBAAU,CAAC;YAC/B,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,OAAO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AG,IAAI,mBAAQ,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC,CAAC;QACjE,CAAC;QACD,OAAO,IAAI,CAAC,gBAAgB,CAAC;IAC/B,CAAC;IAED,IAAW,aAAa;QACtB,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC;YACzB,IAAI,CAAC,cAAc,GAAG,IAAI,eAAM,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC,CAAC;QAC7D,CAAC;QACD,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;CACF;AA/JD,wBA+JC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export interface LoyaltyHttpClientConfig {
|
|
2
|
+
clientKey?: string;
|
|
3
|
+
clientSecret?: string;
|
|
4
|
+
baseUrl?: string;
|
|
5
|
+
timeout?: number;
|
|
6
|
+
retries?: number;
|
|
7
|
+
logger?: any;
|
|
8
|
+
}
|
|
9
|
+
export declare class LoyaltyHttpClient {
|
|
10
|
+
private readonly baseUrl;
|
|
11
|
+
private readonly clientKey;
|
|
12
|
+
private readonly clientSecret;
|
|
13
|
+
private readonly timeout;
|
|
14
|
+
private readonly retries;
|
|
15
|
+
constructor(config?: LoyaltyHttpClientConfig);
|
|
16
|
+
get(path: string, params?: Record<string, any>): Promise<any>;
|
|
17
|
+
post(path: string, data?: Record<string, any>): Promise<any>;
|
|
18
|
+
put(path: string, data?: Record<string, any>): Promise<any>;
|
|
19
|
+
delete(path: string): Promise<any>;
|
|
20
|
+
private buildUrl;
|
|
21
|
+
private request;
|
|
22
|
+
private getTimestamp;
|
|
23
|
+
private calculateSignature;
|
|
24
|
+
private handleError;
|
|
25
|
+
private sleep;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=loyaltyHttpClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loyaltyHttpClient.d.ts","sourceRoot":"","sources":["../src/loyaltyHttpClient.ts"],"names":[],"mappings":"AAOA,MAAM,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
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.LoyaltyHttpClient = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Loyalty HTTP Client with HMAC SHA256 authentication
|
|
9
|
+
*/
|
|
10
|
+
const node_fetch_1 = __importDefault(require("node-fetch"));
|
|
11
|
+
const crypto_1 = require("crypto");
|
|
12
|
+
const exceptions_1 = require("./exceptions");
|
|
13
|
+
class LoyaltyHttpClient {
|
|
14
|
+
// private logger?: any;
|
|
15
|
+
constructor(config = {}) {
|
|
16
|
+
this.baseUrl = (config.baseUrl || 'https://kirimel.com').replace(/\/$/, '');
|
|
17
|
+
this.clientKey = config.clientKey || process.env.KIRIMEL_LOYALTY_CLIENT_KEY || '';
|
|
18
|
+
this.clientSecret = config.clientSecret || process.env.KIRIMEL_LOYALTY_CLIENT_SECRET || '';
|
|
19
|
+
this.timeout = config.timeout || 30000;
|
|
20
|
+
this.retries = config.retries || 3;
|
|
21
|
+
// this.logger = config.logger;
|
|
22
|
+
if (!this.clientKey || !this.clientSecret) {
|
|
23
|
+
throw new exceptions_1.AuthenticationException('Loyalty API requires both client_key and client_secret. ' +
|
|
24
|
+
'Set KIRIMEL_LOYALTY_CLIENT_KEY and KIRIMEL_LOYALTY_CLIENT_SECRET environment variables.', 401);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
async get(path, params) {
|
|
28
|
+
const url = this.buildUrl(path, params);
|
|
29
|
+
return this.request('GET', url);
|
|
30
|
+
}
|
|
31
|
+
async post(path, data) {
|
|
32
|
+
return this.request('POST', this.buildUrl(path), data);
|
|
33
|
+
}
|
|
34
|
+
async put(path, data) {
|
|
35
|
+
return this.request('PUT', this.buildUrl(path), data);
|
|
36
|
+
}
|
|
37
|
+
async delete(path) {
|
|
38
|
+
return this.request('DELETE', this.buildUrl(path));
|
|
39
|
+
}
|
|
40
|
+
buildUrl(path, params) {
|
|
41
|
+
const cleanPath = path.replace(/^\//, '');
|
|
42
|
+
let url = `${this.baseUrl}/${cleanPath}`;
|
|
43
|
+
if (params && Object.keys(params).length > 0) {
|
|
44
|
+
const searchParams = new URLSearchParams();
|
|
45
|
+
for (const [key, value] of Object.entries(params)) {
|
|
46
|
+
if (value !== undefined && value !== null) {
|
|
47
|
+
searchParams.append(key, String(value));
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
url += `?${searchParams.toString()}`;
|
|
51
|
+
}
|
|
52
|
+
return url;
|
|
53
|
+
}
|
|
54
|
+
async request(method, url, data, attempt = 0) {
|
|
55
|
+
const timestamp = this.getTimestamp();
|
|
56
|
+
const payload = data ? JSON.stringify(data) : '';
|
|
57
|
+
const signature = this.calculateSignature(timestamp, payload);
|
|
58
|
+
const headers = {
|
|
59
|
+
'Content-Type': 'application/json',
|
|
60
|
+
'Accept': 'application/json',
|
|
61
|
+
'User-Agent': 'KiriMel-Node-SDK/2.0.0',
|
|
62
|
+
'X-Client-Key': this.clientKey,
|
|
63
|
+
'X-Timestamp': timestamp,
|
|
64
|
+
'X-Signature': signature,
|
|
65
|
+
};
|
|
66
|
+
const options = {
|
|
67
|
+
method,
|
|
68
|
+
headers,
|
|
69
|
+
timeout: this.timeout,
|
|
70
|
+
};
|
|
71
|
+
if (data) {
|
|
72
|
+
options.body = payload;
|
|
73
|
+
}
|
|
74
|
+
try {
|
|
75
|
+
const response = await (0, node_fetch_1.default)(url, options);
|
|
76
|
+
if (response.status >= 400) {
|
|
77
|
+
await this.handleError(response);
|
|
78
|
+
}
|
|
79
|
+
return await response.json();
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
// Network error - retry if attempts remain
|
|
83
|
+
if (attempt < this.retries - 1 && !error.statusCode) {
|
|
84
|
+
await this.sleep(100 * (attempt + 1)); // Exponential backoff
|
|
85
|
+
return this.request(method, url, data, attempt + 1);
|
|
86
|
+
}
|
|
87
|
+
throw new exceptions_1.ApiException(`Network error: ${error.message}`);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
getTimestamp() {
|
|
91
|
+
const now = new Date();
|
|
92
|
+
return now.toISOString().replace(/\.\d+Z$/, 'Z');
|
|
93
|
+
}
|
|
94
|
+
calculateSignature(timestamp, payload) {
|
|
95
|
+
const signingString = `${timestamp}.${payload}`;
|
|
96
|
+
const signature = (0, crypto_1.createHmac)('sha256', this.clientSecret)
|
|
97
|
+
.update(signingString)
|
|
98
|
+
.digest('hex');
|
|
99
|
+
return signature;
|
|
100
|
+
}
|
|
101
|
+
async handleError(response) {
|
|
102
|
+
let message = 'API request failed';
|
|
103
|
+
let errors;
|
|
104
|
+
try {
|
|
105
|
+
const data = await response.json();
|
|
106
|
+
message = data.message || message;
|
|
107
|
+
errors = data.errors;
|
|
108
|
+
}
|
|
109
|
+
catch {
|
|
110
|
+
// Use default error message
|
|
111
|
+
}
|
|
112
|
+
if (response.status === 401) {
|
|
113
|
+
throw new exceptions_1.AuthenticationException(message, response.status, errors);
|
|
114
|
+
}
|
|
115
|
+
throw new exceptions_1.ApiException(message, response.status, errors);
|
|
116
|
+
}
|
|
117
|
+
sleep(ms) {
|
|
118
|
+
return new Promise(resolve => setTimeout(resolve, ms));
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
exports.LoyaltyHttpClient = LoyaltyHttpClient;
|
|
122
|
+
//# sourceMappingURL=loyaltyHttpClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loyaltyHttpClient.js","sourceRoot":"","sources":["../src/loyaltyHttpClient.ts"],"names":[],"mappings":";;;;;;AAAA;;GAEG;AACH,4DAA6C;AAC7C,mCAAoC;AACpC,6CAAqE;AAkBrE,MAAa,iBAAiB;IAM5B,wBAAwB;IAExB,YAAY,SAAkC,EAAE;QAC9C,IAAI,CAAC,OAAO,GAAG,CAAC,MAAM,CAAC,OAAO,IAAI,qBAAqB,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAC5E,IAAI,CAAC,SAAS,G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AAC,QAAQ,EAAE,IAAI,CAAC,YAAY,CAAC;aACtD,MAAM,CAAC,aAAa,CAAC;aACrB,MAAM,CAAC,KAAK,CAAC,CAAC;QACjB,OAAO,SAAS,CAAC;IACnB,CAAC;IAEO,KAAK,CAAC,WAAW,CAAC,QAAkB;QAC1C,IAAI,OAAO,GAAG,oBAAoB,CAAC;QACnC,IAAI,MAAW,CAAC;QAEhB,IAAI,CAAC;YACH,MAAM,IAAI,GAAQ,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;YACxC,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC;YAClC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QACvB,CAAC;QAAC,MAAM,CAAC;YACP,4BAA4B;QAC9B,CAAC;QAED,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;YAC5B,MAAM,IAAI,oCAAuB,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACtE,CAAC;QAED,MAAM,IAAI,yBAAY,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3D,CAAC;IAEO,KAAK,CAAC,EAAU;QACtB,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;IACzD,CAAC;CACF;AA7ID,8CA6IC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Loyalty Customers resource
|
|
3
|
+
*/
|
|
4
|
+
import { LoyaltyHttpClient } from '../../loyaltyHttpClient';
|
|
5
|
+
export declare class Customers {
|
|
6
|
+
private readonly httpClient;
|
|
7
|
+
constructor(httpClient: LoyaltyHttpClient);
|
|
8
|
+
register(data: {
|
|
9
|
+
phone: string;
|
|
10
|
+
name: string;
|
|
11
|
+
email?: string;
|
|
12
|
+
birth_date?: string;
|
|
13
|
+
qr_code?: string;
|
|
14
|
+
}): Promise<any>;
|
|
15
|
+
lookup(data: {
|
|
16
|
+
phone: string;
|
|
17
|
+
}): Promise<any>;
|
|
18
|
+
get(customerId: string): Promise<any>;
|
|
19
|
+
transactions(customerId: string, params?: {
|
|
20
|
+
page?: number;
|
|
21
|
+
per_page?: number;
|
|
22
|
+
}): Promise<any>;
|
|
23
|
+
adjust(customerId: string, data: {
|
|
24
|
+
points: number;
|
|
25
|
+
reference: string;
|
|
26
|
+
description: string;
|
|
27
|
+
adjusted_by: string;
|
|
28
|
+
}): Promise<any>;
|
|
29
|
+
tier(customerId: string): Promise<any>;
|
|
30
|
+
list(params?: {
|
|
31
|
+
page?: number;
|
|
32
|
+
per_page?: number;
|
|
33
|
+
tier?: string;
|
|
34
|
+
}): Promise<any>;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=Customers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Customers.d.ts","sourceRoot":"","sources":["../../../src/resources/loyalty/Customers.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,qBAAa,SAAS;IACR,OAAO,CAAC,QAAQ,CAAC,UAAU;gBAAV,UAAU,EAAE,iBAAiB;IAE7C,QAAQ,CAAC,IAAI,EAAE;QAC1B,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,GAAG,OAAO,CAAC,GAAG,CAAC;IAIH,MAAM,CAAC,IAAI,EAAE;QACxB,KAAK,EAAE,MAAM,CAAC;KACf,GAAG,OAAO,CAAC,GAAG,CAAC;IAIH,GAAG,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAIrC,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE;QACrD,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,GAAG,OAAO,CAAC,GAAG,CAAC;IAIH,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE;QAC5C,MAAM,EAAE,MAAM,CAAC;QACf,SAAS,EAAE,MAAM,CAAC;QAClB,WAAW,EAAE,MAAM,CAAC;QACpB,WAAW,EAAE,MAAM,CAAC;KACrB,GAAG,OAAO,CAAC,GAAG,CAAC;IAIH,IAAI,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAItC,IAAI,CAAC,MAAM,CAAC,EAAE;QACzB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,GAAG,OAAO,CAAC,GAAG,CAAC;CAGjB"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Customers = void 0;
|
|
4
|
+
class Customers {
|
|
5
|
+
constructor(httpClient) {
|
|
6
|
+
this.httpClient = httpClient;
|
|
7
|
+
}
|
|
8
|
+
async register(data) {
|
|
9
|
+
return this.httpClient.post('/api/loyalty/customers/register', data);
|
|
10
|
+
}
|
|
11
|
+
async lookup(data) {
|
|
12
|
+
return this.httpClient.post('/api/loyalty/customers/lookup', data);
|
|
13
|
+
}
|
|
14
|
+
async get(customerId) {
|
|
15
|
+
return this.httpClient.get(`/api/loyalty/customers/${customerId}`);
|
|
16
|
+
}
|
|
17
|
+
async transactions(customerId, params) {
|
|
18
|
+
return this.httpClient.get(`/api/loyalty/customers/${customerId}/transactions`, params);
|
|
19
|
+
}
|
|
20
|
+
async adjust(customerId, data) {
|
|
21
|
+
return this.httpClient.post(`/api/loyalty/customers/${customerId}/adjust`, data);
|
|
22
|
+
}
|
|
23
|
+
async tier(customerId) {
|
|
24
|
+
return this.httpClient.get(`/api/loyalty/customers/${customerId}/tier`);
|
|
25
|
+
}
|
|
26
|
+
async list(params) {
|
|
27
|
+
return this.httpClient.get('/api/loyalty/customers', params);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.Customers = Customers;
|
|
31
|
+
//# sourceMappingURL=Customers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Customers.js","sourceRoot":"","sources":["../../../src/resources/loyalty/Customers.ts"],"names":[],"mappings":";;;AAKA,MAAa,SAAS;IACpB,YAA6B,UAA6B;QAA7B,eAAU,GAAV,UAAU,CAAmB;IAAG,CAAC;IAEvD,KAAK,CAAC,QAAQ,CAAC,IAMrB;QACC,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,iCAAiC,EAAE,IAAI,CAAC,CAAC;IACvE,CAAC;IAEM,KAAK,CAAC,MAAM,CAAC,IAEnB;QACC,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,+BAA+B,EAAE,IAAI,CAAC,CAAC;IACrE,CAAC;IAEM,KAAK,CAAC,GAAG,CAAC,UAAkB;QACjC,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,0BAA0B,UAAU,EAAE,CAAC,CAAC;IACrE,CAAC;IAEM,KAAK,CAAC,YAAY,CAAC,UAAkB,EAAE,MAG7C;QACC,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,0BAA0B,UAAU,eAAe,EAAE,MAAM,CAAC,CAAC;IAC1F,CAAC;IAEM,KAAK,CAAC,MAAM,CAAC,UAAkB,EAAE,IAKvC;QACC,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,0BAA0B,UAAU,SAAS,EAAE,IAAI,CAAC,CAAC;IACnF,CAAC;IAEM,KAAK,CAAC,IAAI,CAAC,UAAkB;QAClC,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,0BAA0B,UAAU,OAAO,CAAC,CAAC;IAC1E,CAAC;IAEM,KAAK,CAAC,IAAI,CAAC,MAIjB;QACC,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,wBAAwB,EAAE,MAAM,CAAC,CAAC;IAC/D,CAAC;CACF;AAlDD,8BAkDC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Loyalty Points resource
|
|
3
|
+
*/
|
|
4
|
+
import { LoyaltyHttpClient } from '../../loyaltyHttpClient';
|
|
5
|
+
export declare class Points {
|
|
6
|
+
private readonly httpClient;
|
|
7
|
+
constructor(httpClient: LoyaltyHttpClient);
|
|
8
|
+
earn(data: {
|
|
9
|
+
customer_id: string;
|
|
10
|
+
points: number;
|
|
11
|
+
amount?: number;
|
|
12
|
+
reference_id?: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
}): Promise<any>;
|
|
15
|
+
previewRedeem(data: {
|
|
16
|
+
customer_id: string;
|
|
17
|
+
points_to_redeem: number;
|
|
18
|
+
}): Promise<any>;
|
|
19
|
+
commitRedeem(data: {
|
|
20
|
+
customer_id: string;
|
|
21
|
+
points_to_redeem: number;
|
|
22
|
+
reference_id?: string;
|
|
23
|
+
}): Promise<any>;
|
|
24
|
+
reverse(data: {
|
|
25
|
+
transaction_id: string;
|
|
26
|
+
reason: string;
|
|
27
|
+
reference_id?: string;
|
|
28
|
+
}): Promise<any>;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=Points.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Points.d.ts","sourceRoot":"","sources":["../../../src/resources/loyalty/Points.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,qBAAa,MAAM;IACL,OAAO,CAAC,QAAQ,CAAC,UAAU;gBAAV,UAAU,EAAE,iBAAiB;IAE7C,IAAI,CAAC,IAAI,EAAE;QACtB,WAAW,EAAE,MAAM,CAAC;QACpB,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,GAAG,OAAO,CAAC,GAAG,CAAC;IAIH,aAAa,CAAC,IAAI,EAAE;QAC/B,WAAW,EAAE,MAAM,CAAC;QACpB,gBAAgB,EAAE,MAAM,CAAC;KAC1B,GAAG,OAAO,CAAC,GAAG,CAAC;IAIH,YAAY,CAAC,IAAI,EAAE;QAC9B,WAAW,EAAE,MAAM,CAAC;QACpB,gBAAgB,EAAE,MAAM,CAAC;QACzB,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,GAAG,OAAO,CAAC,GAAG,CAAC;IAIH,OAAO,CAAC,IAAI,EAAE;QACzB,cAAc,EAAE,MAAM,CAAC;QACvB,MAAM,EAAE,MAAM,CAAC;QACf,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,GAAG,OAAO,CAAC,GAAG,CAAC;CAGjB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Points = void 0;
|
|
4
|
+
class Points {
|
|
5
|
+
constructor(httpClient) {
|
|
6
|
+
this.httpClient = httpClient;
|
|
7
|
+
}
|
|
8
|
+
async earn(data) {
|
|
9
|
+
return this.httpClient.post('/api/loyalty/points/earn', data);
|
|
10
|
+
}
|
|
11
|
+
async previewRedeem(data) {
|
|
12
|
+
return this.httpClient.post('/api/loyalty/points/preview-redeem', data);
|
|
13
|
+
}
|
|
14
|
+
async commitRedeem(data) {
|
|
15
|
+
return this.httpClient.post('/api/loyalty/points/redeem', data);
|
|
16
|
+
}
|
|
17
|
+
async reverse(data) {
|
|
18
|
+
return this.httpClient.post('/api/loyalty/points/reverse', data);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.Points = Points;
|
|
22
|
+
//# sourceMappingURL=Points.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Points.js","sourceRoot":"","sources":["../../../src/resources/loyalty/Points.ts"],"names":[],"mappings":";;;AAKA,MAAa,MAAM;IACjB,YAA6B,UAA6B;QAA7B,eAAU,GAAV,UAAU,CAAmB;IAAG,CAAC;IAEvD,KAAK,CAAC,IAAI,CAAC,IAMjB;QACC,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,0BAA0B,EAAE,IAAI,CAAC,CAAC;IAChE,CAAC;IAEM,KAAK,CAAC,aAAa,CAAC,IAG1B;QACC,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,oCAAoC,EAAE,IAAI,CAAC,CAAC;IAC1E,CAAC;IAEM,KAAK,CAAC,YAAY,CAAC,IAIzB;QACC,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,4BAA4B,EAAE,IAAI,CAAC,CAAC;IAClE,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,IAIpB;QACC,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,6BAA6B,EAAE,IAAI,CAAC,CAAC;IACnE,CAAC;CACF;AAnCD,wBAmCC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Loyalty Vouchers resource
|
|
3
|
+
*/
|
|
4
|
+
import { LoyaltyHttpClient } from '../../loyaltyHttpClient';
|
|
5
|
+
export declare class Vouchers {
|
|
6
|
+
private readonly httpClient;
|
|
7
|
+
constructor(httpClient: LoyaltyHttpClient);
|
|
8
|
+
createBatch(data: {
|
|
9
|
+
name: string;
|
|
10
|
+
type: 'PERCENT' | 'FIXED';
|
|
11
|
+
value: number;
|
|
12
|
+
quantity: number;
|
|
13
|
+
valid_from: string;
|
|
14
|
+
valid_until: string;
|
|
15
|
+
min_purchase?: number;
|
|
16
|
+
max_discount?: number;
|
|
17
|
+
}): Promise<any>;
|
|
18
|
+
listBatches(params?: {
|
|
19
|
+
page?: number;
|
|
20
|
+
per_page?: number;
|
|
21
|
+
}): Promise<any>;
|
|
22
|
+
issue(data: {
|
|
23
|
+
voucher_batch_id: string;
|
|
24
|
+
customer_id: string;
|
|
25
|
+
delivered_via: 'email' | 'sms';
|
|
26
|
+
reference_id?: string;
|
|
27
|
+
}): Promise<any>;
|
|
28
|
+
redeem(data: {
|
|
29
|
+
code: string;
|
|
30
|
+
customer_id: string;
|
|
31
|
+
purchase_amount: number;
|
|
32
|
+
reference_id?: string;
|
|
33
|
+
}): Promise<any>;
|
|
34
|
+
get(code: string): Promise<any>;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=Vouchers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Vouchers.d.ts","sourceRoot":"","sources":["../../../src/resources/loyalty/Vouchers.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,qBAAa,QAAQ;IACP,OAAO,CAAC,QAAQ,CAAC,UAAU;gBAAV,UAAU,EAAE,iBAAiB;IAE7C,WAAW,CAAC,IAAI,EAAE;QAC7B,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC;QAC1B,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,MAAM,CAAC;QACnB,WAAW,EAAE,MAAM,CAAC;QACpB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,GAAG,OAAO,CAAC,GAAG,CAAC;IAIH,WAAW,CAAC,MAAM,CAAC,EAAE;QAChC,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,GAAG,OAAO,CAAC,GAAG,CAAC;IAIH,KAAK,CAAC,IAAI,EAAE;QACvB,gBAAgB,EAAE,MAAM,CAAC;QACzB,WAAW,EAAE,MAAM,CAAC;QACpB,aAAa,EAAE,OAAO,GAAG,KAAK,CAAC;QAC/B,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,GAAG,OAAO,CAAC,GAAG,CAAC;IAIH,MAAM,CAAC,IAAI,EAAE;QACxB,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,CAAC;QACpB,eAAe,EAAE,MAAM,CAAC;QACxB,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,GAAG,OAAO,CAAC,GAAG,CAAC;IAIH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;CAG7C"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Vouchers = void 0;
|
|
4
|
+
class Vouchers {
|
|
5
|
+
constructor(httpClient) {
|
|
6
|
+
this.httpClient = httpClient;
|
|
7
|
+
}
|
|
8
|
+
async createBatch(data) {
|
|
9
|
+
return this.httpClient.post('/api/loyalty/vouchers/batches', data);
|
|
10
|
+
}
|
|
11
|
+
async listBatches(params) {
|
|
12
|
+
return this.httpClient.get('/api/loyalty/vouchers/batches', params);
|
|
13
|
+
}
|
|
14
|
+
async issue(data) {
|
|
15
|
+
return this.httpClient.post('/api/loyalty/vouchers/issue', data);
|
|
16
|
+
}
|
|
17
|
+
async redeem(data) {
|
|
18
|
+
return this.httpClient.post('/api/loyalty/vouchers/redeem', data);
|
|
19
|
+
}
|
|
20
|
+
async get(code) {
|
|
21
|
+
return this.httpClient.get(`/api/loyalty/vouchers/${code}`);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.Vouchers = Vouchers;
|
|
25
|
+
//# sourceMappingURL=Vouchers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Vouchers.js","sourceRoot":"","sources":["../../../src/resources/loyalty/Vouchers.ts"],"names":[],"mappings":";;;AAKA,MAAa,QAAQ;IACnB,YAA6B,UAA6B;QAA7B,eAAU,GAAV,UAAU,CAAmB;IAAG,CAAC;IAEvD,KAAK,CAAC,WAAW,CAAC,IASxB;QACC,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,+BAA+B,EAAE,IAAI,CAAC,CAAC;IACrE,CAAC;IAEM,KAAK,CAAC,WAAW,CAAC,MAGxB;QACC,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,+BAA+B,EAAE,MAAM,CAAC,CAAC;IACtE,CAAC;IAEM,KAAK,CAAC,KAAK,CAAC,IAKlB;QACC,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,6BAA6B,EAAE,IAAI,CAAC,CAAC;IACnE,CAAC;IAEM,KAAK,CAAC,MAAM,CAAC,IAKnB;QACC,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,8BAA8B,EAAE,IAAI,CAAC,CAAC;IACpE,CAAC;IAEM,KAAK,CAAC,GAAG,CAAC,IAAY;QAC3B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,yBAAyB,IAAI,EAAE,CAAC,CAAC;IAC9D,CAAC;CACF;AA5CD,4BA4CC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Loyalty Wallet resource
|
|
3
|
+
*/
|
|
4
|
+
import { LoyaltyHttpClient } from '../../loyaltyHttpClient';
|
|
5
|
+
export declare class Wallet {
|
|
6
|
+
private readonly httpClient;
|
|
7
|
+
constructor(httpClient: LoyaltyHttpClient);
|
|
8
|
+
balance(data: {
|
|
9
|
+
customer_id: string;
|
|
10
|
+
}): Promise<any>;
|
|
11
|
+
recalculate(data: {
|
|
12
|
+
customer_id: string;
|
|
13
|
+
}): Promise<any>;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=Wallet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Wallet.d.ts","sourceRoot":"","sources":["../../../src/resources/loyalty/Wallet.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,qBAAa,MAAM;IACL,OAAO,CAAC,QAAQ,CAAC,UAAU;gBAAV,UAAU,EAAE,iBAAiB;IAE7C,OAAO,CAAC,IAAI,EAAE;QACzB,WAAW,EAAE,MAAM,CAAC;KACrB,GAAG,OAAO,CAAC,GAAG,CAAC;IAIH,WAAW,CAAC,IAAI,EAAE;QAC7B,WAAW,EAAE,MAAM,CAAC;KACrB,GAAG,OAAO,CAAC,GAAG,CAAC;CAGjB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Wallet = void 0;
|
|
4
|
+
class Wallet {
|
|
5
|
+
constructor(httpClient) {
|
|
6
|
+
this.httpClient = httpClient;
|
|
7
|
+
}
|
|
8
|
+
async balance(data) {
|
|
9
|
+
return this.httpClient.post('/api/loyalty/wallet/balance', data);
|
|
10
|
+
}
|
|
11
|
+
async recalculate(data) {
|
|
12
|
+
return this.httpClient.post('/api/loyalty/wallet/recalculate', data);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.Wallet = Wallet;
|
|
16
|
+
//# sourceMappingURL=Wallet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Wallet.js","sourceRoot":"","sources":["../../../src/resources/loyalty/Wallet.ts"],"names":[],"mappings":";;;AAKA,MAAa,MAAM;IACjB,YAA6B,UAA6B;QAA7B,eAAU,GAAV,UAAU,CAAmB;IAAG,CAAC;IAEvD,KAAK,CAAC,OAAO,CAAC,IAEpB;QACC,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,6BAA6B,EAAE,IAAI,CAAC,CAAC;IACnE,CAAC;IAEM,KAAK,CAAC,WAAW,CAAC,IAExB;QACC,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,iCAAiC,EAAE,IAAI,CAAC,CAAC;IACvE,CAAC;CACF;AAdD,wBAcC"}
|