@collctiv/l2s-models 1.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.
Files changed (56) hide show
  1. package/README.md +2 -0
  2. package/dist/entities/giftCard.d.ts +24 -0
  3. package/dist/entities/giftCard.d.ts.map +1 -0
  4. package/dist/entities/giftCard.js +34 -0
  5. package/dist/entities/kyc.d.ts +21 -0
  6. package/dist/entities/kyc.d.ts.map +1 -0
  7. package/dist/entities/kyc.js +19 -0
  8. package/dist/entities/kycEvent.d.ts +37 -0
  9. package/dist/entities/kycEvent.d.ts.map +1 -0
  10. package/dist/entities/kycEvent.js +26 -0
  11. package/dist/entities/kycRequest.d.ts +35 -0
  12. package/dist/entities/kycRequest.d.ts.map +1 -0
  13. package/dist/entities/kycRequest.js +61 -0
  14. package/dist/entities/ledgerItem.d.ts +45 -0
  15. package/dist/entities/ledgerItem.d.ts.map +1 -0
  16. package/dist/entities/ledgerItem.js +56 -0
  17. package/dist/entities/order.d.ts +131 -0
  18. package/dist/entities/order.d.ts.map +1 -0
  19. package/dist/entities/order.js +86 -0
  20. package/dist/entities/payment.d.ts +73 -0
  21. package/dist/entities/payment.d.ts.map +1 -0
  22. package/dist/entities/payment.js +91 -0
  23. package/dist/entities/paymentRequest.d.ts +29 -0
  24. package/dist/entities/paymentRequest.d.ts.map +1 -0
  25. package/dist/entities/paymentRequest.js +55 -0
  26. package/dist/entities/pot.d.ts +33 -0
  27. package/dist/entities/pot.d.ts.map +1 -0
  28. package/dist/entities/pot.js +78 -0
  29. package/dist/entities/setting.d.ts +11 -0
  30. package/dist/entities/setting.d.ts.map +1 -0
  31. package/dist/entities/setting.js +25 -0
  32. package/dist/entities/user.d.ts +45 -0
  33. package/dist/entities/user.d.ts.map +1 -0
  34. package/dist/entities/user.js +130 -0
  35. package/dist/global/balance.d.ts +207 -0
  36. package/dist/global/balance.d.ts.map +1 -0
  37. package/dist/global/balance.js +510 -0
  38. package/dist/global/decorators.d.ts +8 -0
  39. package/dist/global/decorators.d.ts.map +1 -0
  40. package/dist/global/decorators.js +31 -0
  41. package/dist/global/enums.d.ts +16 -0
  42. package/dist/global/enums.d.ts.map +1 -0
  43. package/dist/global/enums.js +20 -0
  44. package/dist/global/errors.d.ts +22 -0
  45. package/dist/global/errors.d.ts.map +1 -0
  46. package/dist/global/errors.js +35 -0
  47. package/dist/global/interfaces.d.ts +14 -0
  48. package/dist/global/interfaces.d.ts.map +1 -0
  49. package/dist/global/interfaces.js +1 -0
  50. package/dist/global/kyc.d.ts +22 -0
  51. package/dist/global/kyc.d.ts.map +1 -0
  52. package/dist/global/kyc.js +22 -0
  53. package/dist/index.d.ts +18 -0
  54. package/dist/index.d.ts.map +1 -0
  55. package/dist/index.js +17 -0
  56. package/package.json +32 -0
@@ -0,0 +1,510 @@
1
+ import { Currency } from "./enums.js";
2
+ import { InvalidOperationError } from "./errors.js";
3
+ // TODO: need to go through this and confirm all the ledger types for L2S
4
+ export var BalanceClient;
5
+ (function (BalanceClient) {
6
+ BalanceClient["Api"] = "api";
7
+ })(BalanceClient || (BalanceClient = {}));
8
+ export var LedgerOperation;
9
+ (function (LedgerOperation) {
10
+ LedgerOperation["Credit"] = "credit";
11
+ LedgerOperation["Debit"] = "debit";
12
+ })(LedgerOperation || (LedgerOperation = {}));
13
+ export var LedgerTypeInternal;
14
+ (function (LedgerTypeInternal) {
15
+ // Ledger types
16
+ LedgerTypeInternal["PaymentReceived"] = "payment_received";
17
+ LedgerTypeInternal["PaymentRefunded"] = "payment_refunded";
18
+ LedgerTypeInternal["PaymentRefundFailed"] = "payment_refund_failed";
19
+ LedgerTypeInternal["PaymentDisputed"] = "payment_disputed";
20
+ LedgerTypeInternal["WithdrawalPlaced"] = "withdrawal_placed";
21
+ LedgerTypeInternal["WithdrawalPlacedPriority"] = "withdrawal_placed_priority";
22
+ LedgerTypeInternal["WithdrawalPlacedNextDay"] = "withdrawal_placed_next_day";
23
+ LedgerTypeInternal["WithdrawalFailed"] = "withdrawal_failed";
24
+ LedgerTypeInternal["WithdrawalFailedPriority"] = "withdrawal_failed_priority";
25
+ LedgerTypeInternal["WithdrawalFailedNextDay"] = "withdrawal_failed_next_day";
26
+ LedgerTypeInternal["WithdrawalCancelled"] = "withdrawal_cancelled";
27
+ LedgerTypeInternal["WithdrawalCancelledPriority"] = "withdrawal_cancelled_priority";
28
+ LedgerTypeInternal["WithdrawalCancelledNextDay"] = "withdrawal_cancelled_next_day";
29
+ LedgerTypeInternal["SendToAccepted"] = "send_to_accepted";
30
+ LedgerTypeInternal["SendToReceived"] = "send_to_received";
31
+ LedgerTypeInternal["GiftCardOrderPlaced"] = "giftcard_order_placed";
32
+ LedgerTypeInternal["GiftCardOrderFailed"] = "giftcard_order_failed";
33
+ LedgerTypeInternal["GiftCardOrderRejected"] = "giftcard_order_rejected";
34
+ LedgerTypeInternal["GiftCardOrderCancelled"] = "giftcard_order_cancelled";
35
+ LedgerTypeInternal["OrderPlaced"] = "order_placed";
36
+ LedgerTypeInternal["OrderCancelled"] = "order_cancelled";
37
+ LedgerTypeInternal["PotCredit"] = "pot_credit";
38
+ LedgerTypeInternal["PotDebit"] = "pot_debit";
39
+ LedgerTypeInternal["FundsTransferOut"] = "funds_transfer_out";
40
+ LedgerTypeInternal["FundsTransferIn"] = "funds_transfer_in";
41
+ LedgerTypeInternal["PotTransferOut"] = "pot_transfer_out";
42
+ LedgerTypeInternal["PotTransferIn"] = "pot_transfer_in";
43
+ // Revenue types
44
+ LedgerTypeInternal["PaymentReceivedTip"] = "payment_received_tip";
45
+ LedgerTypeInternal["PaymentRefundedTip"] = "payment_refunded_tip";
46
+ LedgerTypeInternal["PaymentRefundFailedTip"] = "payment_refund_failed_tip";
47
+ LedgerTypeInternal["PaymentDisputedTip"] = "payment_disputed_tip";
48
+ LedgerTypeInternal["PaymentDisputedFee"] = "payment_disputed_fee";
49
+ LedgerTypeInternal["WithdrawalPlacedTip"] = "withdrawal_placed_tip";
50
+ LedgerTypeInternal["WithdrawalPlacedPriorityFee"] = "withdrawal_placed_priority_fee";
51
+ LedgerTypeInternal["WithdrawalPlacedNextDayFee"] = "withdrawal_placed_next_day_fee";
52
+ LedgerTypeInternal["WithdrawalCancelledTip"] = "withdrawal_cancelled_tip";
53
+ LedgerTypeInternal["WithdrawalCancelledPriorityFee"] = "withdrawal_cancelled_priority_fee";
54
+ LedgerTypeInternal["WithdrawalCancelledNextDayFee"] = "withdrawal_cancelled_next_day_fee";
55
+ LedgerTypeInternal["WithdrawalFailedTip"] = "withdrawal_failed_tip";
56
+ LedgerTypeInternal["WithdrawalFailedPriorityFee"] = "withdrawal_failed_priority_fee";
57
+ LedgerTypeInternal["WithdrawalFailedNextDayFee"] = "withdrawal_failed_next_day_fee";
58
+ LedgerTypeInternal["WithdrawalTipRefunded"] = "withdrawal_tip_refunded";
59
+ LedgerTypeInternal["WithdrawalPriorityFeeRefunded"] = "withdrawal_priority_fee_refunded";
60
+ LedgerTypeInternal["WithdrawalNextDayFeeRefunded"] = "withdrawal_next_day_fee_refunded";
61
+ LedgerTypeInternal["InactivePotFee"] = "ipf";
62
+ LedgerTypeInternal["InactivePotFeeRefunded"] = "ipf_refunded";
63
+ LedgerTypeInternal["RevenueCredit"] = "revenue_credit";
64
+ LedgerTypeInternal["RevenueDebit"] = "revenue_debit";
65
+ /** @deprecated should be used in initial migration only */
66
+ LedgerTypeInternal["StartingBalance"] = "starting_balance";
67
+ })(LedgerTypeInternal || (LedgerTypeInternal = {}));
68
+ export var LedgerStatus;
69
+ (function (LedgerStatus) {
70
+ LedgerStatus["New"] = "new";
71
+ LedgerStatus["Processed"] = "processed";
72
+ LedgerStatus["Failed"] = "failed";
73
+ })(LedgerStatus || (LedgerStatus = {}));
74
+ export class LedgerTransaction {
75
+ operation;
76
+ type;
77
+ currency;
78
+ amount;
79
+ entity;
80
+ metadata = {};
81
+ constructor(transaction) {
82
+ Object.assign(this, transaction);
83
+ }
84
+ }
85
+ export class PaymentReceivedTransaction extends LedgerTransaction {
86
+ constructor(amount, currency = Currency.GBP) {
87
+ super({
88
+ operation: LedgerOperation.Credit,
89
+ type: LedgerTypeInternal.PaymentReceived,
90
+ amount, currency
91
+ });
92
+ }
93
+ }
94
+ export class PaymentRefundedTransaction extends LedgerTransaction {
95
+ constructor(amount, currency = Currency.GBP) {
96
+ super({
97
+ operation: LedgerOperation.Debit,
98
+ type: LedgerTypeInternal.PaymentRefunded,
99
+ amount, currency
100
+ });
101
+ }
102
+ }
103
+ export class PaymentRefundFailedTransaction extends LedgerTransaction {
104
+ constructor(amount, currency = Currency.GBP) {
105
+ super({
106
+ operation: LedgerOperation.Credit,
107
+ type: LedgerTypeInternal.PaymentRefundFailed,
108
+ amount, currency
109
+ });
110
+ }
111
+ }
112
+ export class PaymentDisputedTransaction extends LedgerTransaction {
113
+ constructor(amount, currency = Currency.GBP) {
114
+ super({
115
+ operation: LedgerOperation.Debit,
116
+ type: LedgerTypeInternal.PaymentDisputed,
117
+ amount, currency
118
+ });
119
+ }
120
+ }
121
+ export class PaymentDisputedFeeTransaction extends LedgerTransaction {
122
+ constructor(amount, currency = Currency.GBP) {
123
+ super({
124
+ operation: LedgerOperation.Debit,
125
+ type: LedgerTypeInternal.PaymentDisputedFee,
126
+ amount, currency
127
+ });
128
+ }
129
+ }
130
+ export class PaymentTipRefundedTransaction extends LedgerTransaction {
131
+ constructor(amount, currency = Currency.GBP, reason = null) {
132
+ super({
133
+ operation: LedgerOperation.Debit,
134
+ type: LedgerTypeInternal.PaymentRefundedTip,
135
+ metadata: {
136
+ reason: reason ?? "Customer requested"
137
+ },
138
+ amount, currency
139
+ });
140
+ }
141
+ }
142
+ export class PaymentRefundFailedTipTransaction extends LedgerTransaction {
143
+ constructor(amount, currency = Currency.GBP, reason = null) {
144
+ super({
145
+ operation: LedgerOperation.Credit,
146
+ type: LedgerTypeInternal.PaymentRefundFailedTip,
147
+ metadata: {
148
+ reason: reason ?? "Refund failed to be processed. See the payment provider for more information"
149
+ },
150
+ amount, currency
151
+ });
152
+ }
153
+ }
154
+ export class WithdrawalPlacedTransaction extends LedgerTransaction {
155
+ constructor(amount, currency = Currency.GBP) {
156
+ super({
157
+ operation: LedgerOperation.Debit,
158
+ type: LedgerTypeInternal.WithdrawalPlaced,
159
+ amount, currency
160
+ });
161
+ }
162
+ }
163
+ export class WithdrawalPlacedPriorityTransaction extends LedgerTransaction {
164
+ constructor(amount, currency = Currency.GBP) {
165
+ super({
166
+ operation: LedgerOperation.Debit,
167
+ type: LedgerTypeInternal.WithdrawalPlacedPriority,
168
+ amount, currency
169
+ });
170
+ }
171
+ }
172
+ export class WithdrawalPlacedNextDayTransaction extends LedgerTransaction {
173
+ constructor(amount, currency = Currency.GBP) {
174
+ super({
175
+ operation: LedgerOperation.Debit,
176
+ type: LedgerTypeInternal.WithdrawalPlacedNextDay,
177
+ amount, currency
178
+ });
179
+ }
180
+ }
181
+ export class WithdrawalFailedTransaction extends LedgerTransaction {
182
+ constructor(amount, currency = Currency.GBP, errorMessage = null) {
183
+ super({
184
+ operation: LedgerOperation.Credit,
185
+ type: LedgerTypeInternal.WithdrawalFailed,
186
+ metadata: {
187
+ error_message: errorMessage ?? "",
188
+ },
189
+ amount, currency
190
+ });
191
+ }
192
+ }
193
+ export class WithdrawalFailedPriorityTransaction extends LedgerTransaction {
194
+ constructor(amount, currency = Currency.GBP, errorMessage = null) {
195
+ super({
196
+ operation: LedgerOperation.Credit,
197
+ type: LedgerTypeInternal.WithdrawalFailedPriority,
198
+ metadata: {
199
+ error_message: errorMessage ?? "",
200
+ },
201
+ amount, currency
202
+ });
203
+ }
204
+ }
205
+ export class WithdrawalFailedNextDayTransaction extends LedgerTransaction {
206
+ constructor(amount, currency = Currency.GBP, errorMessage = null) {
207
+ super({
208
+ operation: LedgerOperation.Credit,
209
+ type: LedgerTypeInternal.WithdrawalFailedNextDay,
210
+ metadata: {
211
+ error_message: errorMessage ?? "",
212
+ },
213
+ amount, currency
214
+ });
215
+ }
216
+ }
217
+ export class WithdrawalCancelledTransaction extends LedgerTransaction {
218
+ constructor(amount, currency = Currency.GBP, reason = null) {
219
+ super({
220
+ operation: LedgerOperation.Credit,
221
+ type: LedgerTypeInternal.WithdrawalCancelled,
222
+ metadata: {
223
+ reason: reason ?? ""
224
+ },
225
+ amount, currency
226
+ });
227
+ }
228
+ }
229
+ export class WithdrawalCancelledPriorityTransaction extends LedgerTransaction {
230
+ constructor(amount, currency = Currency.GBP, reason = null) {
231
+ super({
232
+ operation: LedgerOperation.Credit,
233
+ type: LedgerTypeInternal.WithdrawalCancelledPriority,
234
+ metadata: {
235
+ reason: reason ?? ""
236
+ },
237
+ amount, currency
238
+ });
239
+ }
240
+ }
241
+ export class WithdrawalCancelledNextDayTransaction extends LedgerTransaction {
242
+ constructor(amount, currency = Currency.GBP, reason = null) {
243
+ super({
244
+ operation: LedgerOperation.Credit,
245
+ type: LedgerTypeInternal.WithdrawalCancelledNextDay,
246
+ metadata: {
247
+ reason: reason ?? ""
248
+ },
249
+ amount, currency
250
+ });
251
+ }
252
+ }
253
+ // Should only be used when the withdrawal has already been paid out
254
+ // If the withdrawal is scheduled then send a withdrawal_cancelled and a new withdrawal_placed
255
+ export class WithdrawalTipRefundTransaction extends LedgerTransaction {
256
+ constructor(amount, currency = Currency.GBP, reason = null) {
257
+ super({
258
+ operation: LedgerOperation.Credit,
259
+ type: LedgerTypeInternal.WithdrawalTipRefunded,
260
+ metadata: {
261
+ reason: reason ?? "Customer requested"
262
+ },
263
+ amount, currency
264
+ });
265
+ }
266
+ }
267
+ // Should only be used when the withdrawal has already been paid out and where the withdrawal is priority
268
+ // If the withdrawal is scheduled then send a withdrawal_cancelled and a new withdrawal_placed
269
+ export class WithdrawalPriorityFeeRefundTransaction extends LedgerTransaction {
270
+ constructor(amount, currency = Currency.GBP, reason = null) {
271
+ super({
272
+ operation: LedgerOperation.Credit,
273
+ type: LedgerTypeInternal.WithdrawalPriorityFeeRefunded,
274
+ metadata: {
275
+ reason: reason ?? "Customer requested"
276
+ },
277
+ amount, currency
278
+ });
279
+ }
280
+ }
281
+ // Should only be used when the withdrawal has already been paid out and where the withdrawal is next_day
282
+ // If the withdrawal is scheduled then send a withdrawal_cancelled and a new withdrawal_placed
283
+ export class WithdrawalNextDayFeeRefundTransaction extends LedgerTransaction {
284
+ constructor(amount, currency = Currency.GBP, reason = null) {
285
+ super({
286
+ operation: LedgerOperation.Credit,
287
+ type: LedgerTypeInternal.WithdrawalNextDayFeeRefunded,
288
+ metadata: {
289
+ reason: reason ?? "Customer requested"
290
+ },
291
+ amount, currency
292
+ });
293
+ }
294
+ }
295
+ export class SendToDebitTransaction extends LedgerTransaction {
296
+ constructor(amount, currency = Currency.GBP) {
297
+ super({
298
+ operation: LedgerOperation.Debit,
299
+ type: LedgerTypeInternal.SendToAccepted,
300
+ amount, currency
301
+ });
302
+ }
303
+ }
304
+ export class SendToCreditTransaction extends LedgerTransaction {
305
+ constructor(amount, sourcePot, currency = Currency.GBP) {
306
+ super({
307
+ operation: LedgerOperation.Credit,
308
+ type: LedgerTypeInternal.SendToReceived,
309
+ metadata: {
310
+ source_pot: sourcePot
311
+ },
312
+ amount, currency
313
+ });
314
+ }
315
+ }
316
+ // Legacy consumer orders
317
+ export class GiftCardOrderPlacedTransaction extends LedgerTransaction {
318
+ constructor(amount, productId, currency = Currency.GBP) {
319
+ super({
320
+ operation: LedgerOperation.Debit,
321
+ type: LedgerTypeInternal.GiftCardOrderPlaced,
322
+ metadata: {
323
+ product_id: productId
324
+ },
325
+ amount, currency
326
+ });
327
+ }
328
+ }
329
+ // Legacy consumer orders
330
+ export class GiftCardOrderFailedTransaction extends LedgerTransaction {
331
+ constructor(amount, currency = Currency.GBP, errorMessage = null) {
332
+ super({
333
+ operation: LedgerOperation.Credit,
334
+ type: LedgerTypeInternal.GiftCardOrderFailed,
335
+ metadata: {
336
+ error_message: errorMessage ?? ""
337
+ },
338
+ amount, currency
339
+ });
340
+ }
341
+ }
342
+ // Legacy consumer orders
343
+ export class GiftCardOrderRejectedTransaction extends LedgerTransaction {
344
+ constructor(amount, currency = Currency.GBP, reason = null) {
345
+ super({
346
+ operation: LedgerOperation.Credit,
347
+ type: LedgerTypeInternal.GiftCardOrderRejected,
348
+ metadata: {
349
+ reason: reason ?? ""
350
+ },
351
+ amount, currency
352
+ });
353
+ }
354
+ }
355
+ // Legacy consumer orders
356
+ export class GiftCardOrderCancelledTransaction extends LedgerTransaction {
357
+ constructor(amount, currency = Currency.GBP, reason = null) {
358
+ super({
359
+ operation: LedgerOperation.Credit,
360
+ type: LedgerTypeInternal.GiftCardOrderCancelled,
361
+ metadata: {
362
+ reason: reason ?? ""
363
+ },
364
+ amount, currency
365
+ });
366
+ }
367
+ }
368
+ // New HAPI orders
369
+ export class OrderPlacedTransaction extends LedgerTransaction {
370
+ constructor(amount, currency = Currency.GBP) {
371
+ super({
372
+ operation: LedgerOperation.Debit,
373
+ type: LedgerTypeInternal.OrderPlaced,
374
+ amount, currency
375
+ });
376
+ }
377
+ }
378
+ // New HAPI orders
379
+ export class OrderCancelledTransaction extends LedgerTransaction {
380
+ constructor(amount, currency = Currency.GBP, reason = null) {
381
+ super({
382
+ operation: LedgerOperation.Credit,
383
+ type: LedgerTypeInternal.OrderCancelled,
384
+ amount, currency
385
+ });
386
+ }
387
+ }
388
+ export class PotCreditTransaction extends LedgerTransaction {
389
+ constructor(amount, reason, person, currency = Currency.GBP) {
390
+ if (!reason || !person) {
391
+ throw new InvalidOperationError();
392
+ }
393
+ super({
394
+ operation: LedgerOperation.Credit,
395
+ type: LedgerTypeInternal.PotCredit,
396
+ metadata: {
397
+ reason,
398
+ person
399
+ },
400
+ amount, currency
401
+ });
402
+ }
403
+ }
404
+ export class PotDebitTransaction extends LedgerTransaction {
405
+ constructor(amount, reason, person, currency = Currency.GBP) {
406
+ if (!reason || !person) {
407
+ throw new InvalidOperationError();
408
+ }
409
+ super({
410
+ operation: LedgerOperation.Debit,
411
+ type: LedgerTypeInternal.PotDebit,
412
+ metadata: {
413
+ reason,
414
+ person
415
+ },
416
+ amount, currency
417
+ });
418
+ }
419
+ }
420
+ export class FundsTransferOutTransaction extends LedgerTransaction {
421
+ constructor(amount, destinationPotId, currency = Currency.GBP) {
422
+ super({
423
+ operation: LedgerOperation.Debit,
424
+ type: LedgerTypeInternal.FundsTransferOut,
425
+ metadata: { destination_pot: destinationPotId },
426
+ amount, currency
427
+ });
428
+ }
429
+ }
430
+ export class FundsTransferInTransaction extends LedgerTransaction {
431
+ constructor(amount, sourcePotId, currency = Currency.GBP) {
432
+ super({
433
+ operation: LedgerOperation.Credit,
434
+ type: LedgerTypeInternal.FundsTransferIn,
435
+ metadata: { source_pot: sourcePotId },
436
+ amount, currency
437
+ });
438
+ }
439
+ }
440
+ export class PotTransferOutTransaction extends LedgerTransaction {
441
+ constructor(amount, currency = Currency.GBP) {
442
+ super({
443
+ operation: LedgerOperation.Debit,
444
+ type: LedgerTypeInternal.PotTransferOut,
445
+ amount, currency
446
+ });
447
+ }
448
+ }
449
+ export class PotTransferInTransaction extends LedgerTransaction {
450
+ constructor(amount, sourcePotId, currency = Currency.GBP) {
451
+ super({
452
+ operation: LedgerOperation.Credit,
453
+ type: LedgerTypeInternal.PotTransferIn,
454
+ metadata: { source_pot: sourcePotId },
455
+ amount, currency
456
+ });
457
+ }
458
+ }
459
+ export class InactivePotFeeTransaction extends LedgerTransaction {
460
+ constructor(amount, transactionId, currency = Currency.GBP) {
461
+ super({
462
+ operation: LedgerOperation.Debit,
463
+ type: LedgerTypeInternal.InactivePotFee,
464
+ metadata: { transaction_id: transactionId },
465
+ amount, currency
466
+ });
467
+ }
468
+ }
469
+ export class InactivePotFeeRefundedTransaction extends LedgerTransaction {
470
+ constructor(amount, transactionId, currency = Currency.GBP, reason = null) {
471
+ super({
472
+ operation: LedgerOperation.Credit,
473
+ type: LedgerTypeInternal.InactivePotFeeRefunded,
474
+ metadata: { transaction_id: transactionId, reason: reason ?? "Customer requested" },
475
+ amount, currency
476
+ });
477
+ }
478
+ }
479
+ export class RevenueCreditTransaction extends LedgerTransaction {
480
+ constructor(amount, reason, person, currency = Currency.GBP) {
481
+ if (!reason || !person) {
482
+ throw new InvalidOperationError();
483
+ }
484
+ super({
485
+ operation: LedgerOperation.Credit,
486
+ type: LedgerTypeInternal.RevenueCredit,
487
+ metadata: {
488
+ reason,
489
+ person
490
+ },
491
+ amount, currency
492
+ });
493
+ }
494
+ }
495
+ export class RevenueDebitTransaction extends LedgerTransaction {
496
+ constructor(amount, reason, person, currency = Currency.GBP) {
497
+ if (!reason || !person) {
498
+ throw new InvalidOperationError();
499
+ }
500
+ super({
501
+ operation: LedgerOperation.Debit,
502
+ type: LedgerTypeInternal.RevenueDebit,
503
+ metadata: {
504
+ reason,
505
+ person
506
+ },
507
+ amount, currency
508
+ });
509
+ }
510
+ }
@@ -0,0 +1,8 @@
1
+ import "reflect-metadata";
2
+ export declare const Collection: (value: string) => (target: any) => void;
3
+ export declare const Topic: (value: string) => (target: any) => void;
4
+ export declare const TransactionId: (property: string) => (target: any) => void;
5
+ export declare const Updatable: () => (target: any, propertyKey: string) => void;
6
+ export declare const Attribute: () => (target: any, propertyKey: string) => void;
7
+ export declare const ObjectId: () => (target: any, propertyKey: string) => void;
8
+ //# sourceMappingURL=decorators.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decorators.d.ts","sourceRoot":"","sources":["../../global/decorators.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAE1B,eAAO,MAAM,UAAU,GAAI,OAAO,MAAM,MAC5B,QAAQ,GAAG,SAOtB,CAAA;AAED,eAAO,MAAM,KAAK,GAAI,OAAO,MAAM,MACvB,QAAQ,GAAG,SAOtB,CAAA;AAED,eAAO,MAAM,aAAa,GAAI,UAAU,MAAM,MAClC,QAAQ,GAAG,SAOtB,CAAA;AAED,eAAO,MAAM,SAAS,SACV,QAAQ,GAAG,EAAE,aAAa,MAAM,SAQ3C,CAAA;AAED,eAAO,MAAM,SAAS,SACV,QAAQ,GAAG,EAAE,aAAa,MAAM,SAQ3C,CAAA;AAED,eAAO,MAAM,QAAQ,SACT,QAAQ,GAAG,EAAE,aAAa,MAAM,SAQ3C,CAAA"}
@@ -0,0 +1,31 @@
1
+ import "reflect-metadata";
2
+ export const Collection = (value) => {
3
+ return (target) => {
4
+ Reflect.defineMetadata(`Collection`, value, target);
5
+ };
6
+ };
7
+ export const Topic = (value) => {
8
+ return (target) => {
9
+ Reflect.defineMetadata(`Topic`, value, target);
10
+ };
11
+ };
12
+ export const TransactionId = (property) => {
13
+ return (target) => {
14
+ Reflect.defineMetadata(`TransactionId`, property, target);
15
+ };
16
+ };
17
+ export const Updatable = () => {
18
+ return (target, propertyKey) => {
19
+ Reflect.defineMetadata(`Updatable`, true, target, propertyKey);
20
+ };
21
+ };
22
+ export const Attribute = () => {
23
+ return (target, propertyKey) => {
24
+ Reflect.defineMetadata(`Attribute`, true, target, propertyKey);
25
+ };
26
+ };
27
+ export const ObjectId = () => {
28
+ return (target, propertyKey) => {
29
+ Reflect.defineMetadata(`ObjectId`, true, target, propertyKey);
30
+ };
31
+ };
@@ -0,0 +1,16 @@
1
+ export declare enum Country {
2
+ GB = "GB"
3
+ }
4
+ export declare enum Currency {
5
+ GBP = "gbp"
6
+ }
7
+ export declare enum KycProviderType {
8
+ PersonaUK = "persona:UK"
9
+ }
10
+ export declare enum PayoutAccountProvider {
11
+ PayPointUK = "paypoint:UK"
12
+ }
13
+ export declare enum PaymentProviderType {
14
+ NuveiUK = "nuvei:UK"
15
+ }
16
+ //# sourceMappingURL=enums.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enums.d.ts","sourceRoot":"","sources":["../../global/enums.ts"],"names":[],"mappings":"AACA,oBAAY,OAAO;IACf,EAAE,OAAO;CACZ;AAED,oBAAY,QAAQ;IAChB,GAAG,QAAQ;CACd;AAED,oBAAY,eAAe;IACvB,SAAS,eAAe;CAC3B;AAED,oBAAY,qBAAqB;IAC7B,UAAU,gBAAgB;CAC7B;AAED,oBAAY,mBAAmB;IAC3B,OAAO,aAAa;CACvB"}
@@ -0,0 +1,20 @@
1
+ export var Country;
2
+ (function (Country) {
3
+ Country["GB"] = "GB";
4
+ })(Country || (Country = {}));
5
+ export var Currency;
6
+ (function (Currency) {
7
+ Currency["GBP"] = "gbp";
8
+ })(Currency || (Currency = {}));
9
+ export var KycProviderType;
10
+ (function (KycProviderType) {
11
+ KycProviderType["PersonaUK"] = "persona:UK";
12
+ })(KycProviderType || (KycProviderType = {}));
13
+ export var PayoutAccountProvider;
14
+ (function (PayoutAccountProvider) {
15
+ PayoutAccountProvider["PayPointUK"] = "paypoint:UK";
16
+ })(PayoutAccountProvider || (PayoutAccountProvider = {}));
17
+ export var PaymentProviderType;
18
+ (function (PaymentProviderType) {
19
+ PaymentProviderType["NuveiUK"] = "nuvei:UK";
20
+ })(PaymentProviderType || (PaymentProviderType = {}));
@@ -0,0 +1,22 @@
1
+ export declare class NotImplementedError extends Error {
2
+ constructor(message?: string);
3
+ }
4
+ export declare class ResourceNotFoundError extends Error {
5
+ constructor();
6
+ }
7
+ export declare class InvalidOperationError extends Error {
8
+ constructor();
9
+ }
10
+ export declare class UnrecognisedOperatorError extends Error {
11
+ constructor(message?: string);
12
+ }
13
+ export declare class MissingCallbackError extends Error {
14
+ constructor();
15
+ }
16
+ export declare class MissingArgumentError extends Error {
17
+ constructor(argument: string);
18
+ }
19
+ export declare class InsufficientBalanceError extends Error {
20
+ constructor();
21
+ }
22
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../global/errors.ts"],"names":[],"mappings":"AACA,qBAAa,mBAAoB,SAAQ,KAAK;gBACvB,OAAO,GAAE,MAAa;CAG5C;AAED,qBAAa,qBAAsB,SAAQ,KAAK;;CAI/C;AAED,qBAAa,qBAAsB,SAAQ,KAAK;;CAI/C;AAED,qBAAa,yBAA0B,SAAQ,KAAK;gBAC7B,OAAO,GAAE,MAAa;CAG5C;AAED,qBAAa,oBAAqB,SAAQ,KAAK;;CAI9C;AAED,qBAAa,oBAAqB,SAAQ,KAAK;gBACxB,QAAQ,EAAE,MAAM;CAGtC;AAED,qBAAa,wBAAyB,SAAQ,KAAK;;CAIlD"}
@@ -0,0 +1,35 @@
1
+ export class NotImplementedError extends Error {
2
+ constructor(message = null) {
3
+ super(message);
4
+ }
5
+ }
6
+ export class ResourceNotFoundError extends Error {
7
+ constructor() {
8
+ super();
9
+ }
10
+ }
11
+ export class InvalidOperationError extends Error {
12
+ constructor() {
13
+ super();
14
+ }
15
+ }
16
+ export class UnrecognisedOperatorError extends Error {
17
+ constructor(message = null) {
18
+ super(message);
19
+ }
20
+ }
21
+ export class MissingCallbackError extends Error {
22
+ constructor() {
23
+ super();
24
+ }
25
+ }
26
+ export class MissingArgumentError extends Error {
27
+ constructor(argument) {
28
+ super(`Missing argument: ${argument}`);
29
+ }
30
+ }
31
+ export class InsufficientBalanceError extends Error {
32
+ constructor() {
33
+ super("Insufficient balance");
34
+ }
35
+ }
@@ -0,0 +1,14 @@
1
+ export interface IDataEntity {
2
+ id?: string;
3
+ }
4
+ export interface ICreatable {
5
+ create_date: Date;
6
+ }
7
+ export interface IModifiable {
8
+ modified_date: Date | null;
9
+ }
10
+ export interface IUpsertable {
11
+ create_date: Date;
12
+ modified_date: Date | null;
13
+ }
14
+ //# sourceMappingURL=interfaces.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../global/interfaces.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,WAAW;IACxB,EAAE,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,UAAU;IACvB,WAAW,EAAE,IAAI,CAAC;CACrB;AAED,MAAM,WAAW,WAAW;IACxB,aAAa,EAAE,IAAI,GAAG,IAAI,CAAC;CAC9B;AAED,MAAM,WAAW,WAAW;IACxB,WAAW,EAAE,IAAI,CAAC;IAClB,aAAa,EAAE,IAAI,GAAG,IAAI,CAAC;CAC9B"}
@@ -0,0 +1 @@
1
+ export {};