@opexa/portal-sdk 0.52.8 → 0.53.1

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 CHANGED
@@ -1,1634 +1,1634 @@
1
- ## Opexa Portal SDK
2
-
3
- A library that provides a set of functions to interact with Opexa Portal API.
4
-
5
- ## Installation
6
-
7
- ```bash
8
- npm install @opexa/portal-sdk
9
- ```
10
-
11
- ## Usage
12
-
13
- - Create sdk instance
14
-
15
- ```ts
16
- // lib/sdk.js
17
- import Sdk from '@opexa/portal-sdk';
18
-
19
- export const sdk = new Sdk({
20
- platform: 'Z892',
21
- environment: 'development',
22
- });
23
- ```
24
-
25
- - Use sdk instance
26
-
27
- ```jsx
28
- import { sdk } from '$lib/sdk';
29
- import * as React from 'react';
30
-
31
- function Page() {
32
- const [account, setAccount] = React.useState();
33
-
34
- React.useEffect(function () {
35
- sdk.account().then(setAccount);
36
- }, []);
37
-
38
- return (
39
- <pre>
40
- <code>{JSON.stringify(account, null, 2)}</code>
41
- </pre>
42
- );
43
- }
44
- ```
45
-
46
- ## API
47
-
48
- ### `Sdk`
49
-
50
- `Sdk` accepts the following options:
51
-
52
- - `*site` - The site ID to be used
53
- - `*sitePlatform` - The site platform ID to be used
54
- - `*platform` - The platform code to be used
55
- - `*environment` - Whether to use production/development api
56
-
57
- , and returns the following methods:
58
-
59
- - `signIn` - Start user session
60
-
61
- ```ts
62
- signIn(input: SignInInput): Promise<SignInReturn>
63
- ```
64
-
65
- ```ts
66
- type SignInInput =
67
- | {
68
- type: 'NAME_AND_PASSWORD';
69
- name: string;
70
- password: string;
71
- }
72
- | {
73
- type: 'MOBILE_NUMBER';
74
- mobileNumber: string;
75
- verificationCode: string;
76
- };
77
-
78
- type SignInReturn =
79
- | {
80
- ok: true;
81
- }
82
- | {
83
- ok: false;
84
- error:
85
- | HttpError
86
- | {
87
- name: 'AccountNotFound';
88
- message: string;
89
- };
90
- };
91
- ```
92
-
93
- - `signOut` - End current user session
94
-
95
- ```ts
96
- signOut(): Promise<void>
97
- ```
98
-
99
- - `site` - Retrieve site details
100
-
101
- ```ts
102
- site(): Promise<SiteReturn>
103
- ```
104
-
105
- ```ts
106
- interface Site {
107
- id: string;
108
- name: string;
109
- logo?: string;
110
- }
111
- ```
112
-
113
- ```ts
114
- type SiteReturn =
115
- | {
116
- ok: true;
117
- data: Site;
118
- }
119
- | {
120
- ok: false;
121
- error: HttpError;
122
- };
123
- ```
124
-
125
- - `platform` - Retrieve current platform details
126
-
127
- ```ts
128
- platform(): Promise<PlatformReturn>
129
- ```
130
-
131
- ```ts
132
- interface Platform {
133
- paymentSettings: {
134
- minimumFirstDepositAmount?: number;
135
- restrictWithdrawalsToVerifiedMembers: boolean;
136
- depositGateway: {
137
- bank: GatewaySettings;
138
- gcash: GatewaySettings;
139
- maya: GatewaySettings;
140
- mayaApp: GatewaySettings;
141
- };
142
- withdrawalGateway: {
143
- bank: GatewaySettings;
144
- gcash: GatewaySettings;
145
- maya: GatewaySettings;
146
- mayaApp: GatewaySettings;
147
- };
148
- };
149
- pointsClubSettings: {
150
- multiplier: number;
151
- };
152
- }
153
-
154
- type PlatformReturn =
155
- | {
156
- ok: true;
157
- data: Platform;
158
- }
159
- | {
160
- ok: false;
161
- error: HttpError;
162
- };
163
- ```
164
-
165
- - `account` - Retrieve current user's details
166
-
167
- ```ts
168
- account(): Promise<AccountReturn>
169
- ```
170
-
171
- ```ts
172
- interface Account {
173
- id: string;
174
- name: string;
175
- status: MemberAccountStatus;
176
- realName?: string;
177
- nickName?: string;
178
- dateOfBirth?: Date;
179
- validId?: string;
180
- emailAddress?: string;
181
- mobileNumber?: string;
182
- verified: boolean;
183
- verificationStatus: MemberAccountVerificationStatus;
184
- mobileNumberVerified: boolean;
185
- mobileNumberVerificationRequired: boolean;
186
- transactionPassword: boolean;
187
- dateTimeLastActive?: Date;
188
- dateTimeCreated: Date;
189
- dateTimeLastUpdated: Date;
190
- }
191
-
192
- type AccountReturn =
193
- | {
194
- ok: true;
195
- data: Account;
196
- }
197
- | {
198
- ok: false;
199
- error: HttpError;
200
- };
201
- ```
202
-
203
- - `createAccount` - Create new user account
204
-
205
- ```ts
206
- createAccount(input: CreateAccountInput): Promise<CreateAccountReturn>
207
- ```
208
-
209
- ```ts
210
- interface CreateAccountInput {
211
- id?: string;
212
- name: string;
213
- password: string;
214
- mobileNumber: string;
215
- dateOfBirth: string;
216
- btag?: string;
217
- domain?: string;
218
- referralCode?: string;
219
- verificationCode?: string;
220
- reCAPTCHAResponse?: string;
221
- }
222
-
223
- type CreateAccountReturn =
224
- | {
225
- ok: true;
226
- error?: never;
227
- data: {
228
- id: string;
229
- };
230
- }
231
- | {
232
- ok: false;
233
- data?: never;
234
- error:
235
- | HttpError
236
- | {
237
- name:
238
- | 'AccountNameNotAvailableError'
239
- | 'InvalidPlatformError'
240
- | 'InvalidReCAPTCHAResponseError'
241
- | 'InvalidSMSVerificationCodeError'
242
- | 'MinimumAgeRequirementError'
243
- | 'MobileNumberNotAvailableError';
244
- message: string;
245
- };
246
- };
247
- ```
248
-
249
- - `updateAccount` - Update current user's details
250
-
251
- ```ts
252
- updateAccount(input: UpdateAccountInput): Promise<UpdateAccountReturn>
253
- ```
254
-
255
- ```ts
256
- type UpdateAccountReturn =
257
- | {
258
- ok: true;
259
- data?: never;
260
- error?: never;
261
- }
262
- | {
263
- ok: false;
264
- data?: never;
265
- error: {
266
- name:
267
- | 'AccountNameNotAvailableError'
268
- | 'EmailAddressNotAvailableError'
269
- | 'InvalidTransactionPasswordError'
270
- | 'MobileNumberNotAvailableError'
271
- | 'NickNameNotAvailableError'
272
- | 'RealNameAlreadySetError'
273
- | 'ValidIdAlreadySetError';
274
- message: string;
275
- };
276
- };
277
- ```
278
-
279
- - `deleteAccount` - Delete current user's account
280
-
281
- ```ts
282
- deleteAccount(id: string): Promise<DeleteAccountReturn>
283
- ```
284
-
285
- ```ts
286
- type DeleteAccountReturn =
287
- | {
288
- ok: true;
289
- }
290
- | {
291
- ok: false;
292
- error: UnknownError | HttpError;
293
- };
294
- ```
295
-
296
- - `resetPassword` - Reset user's password
297
-
298
- ```ts
299
- resetPassword(input: ResetPasswordInput): Promise<ResetPasswordReturn>
300
- ```
301
-
302
- ```ts
303
- interface ResetPasswordInput {
304
- mobileNumber: string;
305
- newPassword: string;
306
- verificationCode: string;
307
- }
308
-
309
- type ResetPasswordReturn =
310
- | {
311
- ok: true;
312
- }
313
- | {
314
- ok: false;
315
- error:
316
- | HttpError
317
- | {
318
- name: 'AccountNotFoundError' | 'InvalidVerificationCodeError';
319
- message: string;
320
- };
321
- };
322
- ```
323
-
324
- - `verificationDetails` - Retrieve user's verification details
325
-
326
- ```ts
327
- verificationDetails(): Promise<VerificationDetailsReturn>
328
- ```
329
-
330
- ```ts
331
- interface VerificationDetails {
332
- id: string;
333
- status: MemberVerificationStatus;
334
- address: string;
335
- sourceOfIncome: string;
336
- natureOfWork: string;
337
- nationality: string;
338
- placeOfBirth: string;
339
- idFrontImage: File;
340
- selfieImage: File;
341
- }
342
-
343
- type VerificationDetailsReturn =
344
- | {
345
- ok: true;
346
- data: VerificationDetails;
347
- }
348
- | {
349
- ok: false;
350
- error: HttpError;
351
- };
352
- ```
353
-
354
- - `submitVerificationDetails` - Submit current user's verification details
355
-
356
- ```ts
357
- submitVerificationDetails(input: SubmitVerificationDetailsInput): Promise<SubmitVerificationDetailsReturn>
358
- ```
359
-
360
- ```ts
361
- interface SubmitVerificationDetailsInput {
362
- id?: string;
363
- idFrontImage: string;
364
- selfieImage: string;
365
- address: string;
366
- sourceOfIncome: string;
367
- natureOfWork: string;
368
- nationality: string;
369
- placeOfBirth: string;
370
- }
371
-
372
- type SubmitVerificationDetailsReturn =
373
- | {
374
- ok: true;
375
- data: {
376
- id: string;
377
- };
378
- }
379
- | {
380
- ok: false;
381
- error:
382
- | HttpError
383
- | {
384
- name:
385
- | 'FileDoesNotExistError'
386
- | 'FileNotReadyError'
387
- | 'MemberVerificationAlreadyExistsError';
388
- message: string;
389
- };
390
- };
391
- ```
392
-
393
- - `updateVerificationDetails` - Update current user's verification details
394
-
395
- ```ts
396
- updateVerificationDetails(input: UpdateVerificationDetailsInput): Promise<UpdateVerificationDetailsReturn>
397
- ```
398
-
399
- ```ts
400
- interface UpdateVerificationDetailsInput {
401
- idFrontImage: string;
402
- selfieImage: string;
403
- address: string;
404
- permanentAddress: string;
405
- sourceOfIncome: string;
406
- natureOfWork: string;
407
- nationality: string;
408
- placeOfBirth: string;
409
- }
410
-
411
- type UpdateVerificationDetailsReturn =
412
- | {
413
- ok: true;
414
- }
415
- | {
416
- ok: false;
417
- error:
418
- | HttpError
419
- | {
420
- name:
421
- | 'FileDoesNotExistError'
422
- | 'FileNotReadyError'
423
- | 'MemberVerificationAlreadyApprovedError'
424
- | 'MemberVerificationDoesNotExistError';
425
- message: string;
426
- };
427
- };
428
- ```
429
-
430
- - `verifyMobileNumber` - Verify current user's mobile number
431
-
432
- ```ts
433
- verifyMobileNumber(verificationCode: string): Promise<VerifyMobileNumberReturn>
434
- ```
435
-
436
- ```ts
437
- type VerifyMobileNumberReturn =
438
- | {
439
- ok: true;
440
- }
441
- | {
442
- ok: false;
443
- error:
444
- | HttpError
445
- | {
446
- name: 'InvalidSMSVerificationCodeError' | 'MobileNumberAlreadyVerifiedError';
447
- message: string;
448
- };
449
- };
450
- ```
451
-
452
- - `profileCompletion` - Retrieve current user's profile completion status
453
-
454
- ```ts
455
- profileCompletion(): Promise<ProfileCompletionReturn>
456
- ```
457
-
458
- ```ts
459
- interface ProfileCompletion {
460
- completionPercentage: number;
461
- personalInformation: boolean;
462
- accountVerification: boolean;
463
- mobileNumberVerification: boolean;
464
- transactionPassword: boolean;
465
- accountPassword: boolean;
466
- }
467
-
468
- type ProfileCompletionReturn =
469
- | {
470
- ok: true;
471
- data: ProfileCompletion;
472
- }
473
- | {
474
- ok: false;
475
- error: HttpError;
476
- };
477
- ```
478
-
479
- - `sendVerificationCode` - Send verification code to mobile number or email address
480
-
481
- ```ts
482
- sendVerificationCode(mobileNumber: string): Promise<SendVerificationCodeReturn>
483
- ```
484
-
485
- ```ts
486
- type SendVerificationCodeReturn =
487
- | {
488
- ok: true;
489
- }
490
- | {
491
- ok: false;
492
- error:
493
- | HttpError
494
- | {
495
- name: 'InvalidPlatformError' | 'NotReadyToSendVerficationCodeError';
496
- message: string;
497
- };
498
- };
499
- ```
500
-
501
- - `wallet` - Retrieve current user's wallet details
502
-
503
- ```ts
504
- wallet(): Promise<WalletReturn>
505
- ```
506
-
507
- ```ts
508
- interface Wallet {
509
- id: string;
510
- balance: number;
511
- currency: Currency;
512
- dateTimeCreated: Date;
513
- dateTimeLastUpdated: Date;
514
- }
515
-
516
- type WalletReturn =
517
- | {
518
- ok: true;
519
- data: Wallet | null;
520
- }
521
- | {
522
- ok: false;
523
- error: HttpError;
524
- };
525
- ```
526
-
527
- - `announcements` - Retrieve announcements for current platform
528
-
529
- ```ts
530
- announcements(input?: AnnouncementsInput): Promise<AnnouncementsReturn>
531
- ```
532
-
533
- ```ts
534
- interface AnnouncementsInput {
535
- first?: number;
536
- after?: string;
537
- }
538
-
539
- interface Announcement {
540
- id: string;
541
- type: 'RELEASE' | 'SCHEDULED_MAINTENANCE';
542
- title: string;
543
- status: 'ACTIVE' | 'INACTIVE';
544
- message: string;
545
- activationStartDateTime: Date;
546
- activationEndDateTime: Date;
547
- dateTimeCreated: Date;
548
- dateTimeLastUpdated: Date;
549
- }
550
-
551
- type AnnouncementsReturn =
552
- | {
553
- ok: true;
554
- data: {
555
- announcements: (Announcement & { cursor: string })[];
556
- totalCount: number;
557
- hasNextPage: boolean;
558
- endCursor?: string;
559
- };
560
- }
561
- | {
562
- ok: false;
563
- error: HttpError;
564
- };
565
- ```
566
-
567
- - `createWithdrawal` - Create new withdrawal request
568
-
569
- ```ts
570
- createWithdrawal(input: CreateWithdrawalInput): Promise<CreateWithdrawalReturn>
571
- ```
572
-
573
- ```ts
574
- interface CreateBankWithdrawalInput {
575
- id?: string;
576
- type: 'BANK';
577
- amount: number;
578
- transactionPassword: string;
579
- }
580
-
581
- interface CreateGCashWithdrawalInput {
582
- id?: string;
583
- type: 'GCASH';
584
- amount: number;
585
- transactionPassword: string;
586
- recipientMobileNumber: string;
587
- }
588
-
589
- interface CreateGCashStandardCashInWithdrawalInput {
590
- id?: string;
591
- type: 'GCASH_STANDARD_CASHIN';
592
- amount: number;
593
- transactionPassword: string;
594
- recipientMobileNumber: string;
595
- }
596
-
597
- interface CreateMayaWithdrawalInput {
598
- id?: string;
599
- type: 'MAYA';
600
- amount: number;
601
- transactionPassword: string;
602
- recipientMobileNumber: string;
603
- }
604
-
605
- interface CreateMayaAppWithdrawalInput {
606
- id?: string;
607
- type: 'MAYA_APP';
608
- amount: number;
609
- transactionPassword: string;
610
- }
611
-
612
- type CreateWithdrawalInput =
613
- | CreateBankWithdrawalInput
614
- | CreateGCashWithdrawalInput
615
- | CreateGCashStandardCashInWithdrawalInput
616
- | CreateMayaWithdrawalInput
617
- | CreateMayaAppWithdrawalInput;
618
-
619
- type CreateWithdrawalReturn =
620
- | {
621
- ok: true;
622
- data: {
623
- id: string;
624
- };
625
- }
626
- | {
627
- ok: false;
628
- error:
629
- | HttpError
630
- | {
631
- name:
632
- | 'MobileNumberNotVerifiedError'
633
- | 'AccountNotVerifiedError'
634
- | 'InvalidWithdrawalAmountError'
635
- | 'WithdrawalDailyLimitExceededError'
636
- | 'InvalidTransactionPasswordError'
637
- | 'NotEnoughBalanceError';
638
- message: string;
639
- };
640
- };
641
- ```
642
-
643
- - `withdrawalRecords` - Retrieve current user's withdrawal records
644
-
645
- ```ts
646
- withdrawalRecords(input?: WithdrawalRecordsInput): Promise<WithdrawalRecordsReturn>
647
- ```
648
-
649
- ```ts
650
- type WithdrawalRecordType = 'MANUAL' | 'BANK' | 'GCASH' | 'MAYA';
651
- type WithdrawalRecordStatus = 'PENDING' | 'APPROVED' | 'REJECTED' | 'CONFIRMED' | 'CANCELLED';
652
-
653
- interface WithdrawalRecordsInput {
654
- first?: number;
655
- after?: string;
656
- filter?: {
657
- type?: {
658
- equal?: WithdrawalRecordType;
659
- notEqual?: WithdrawalRecordType;
660
- in?: WithdrawalRecordType[];
661
- notIn?: WithdrawalRecordType[];
662
- };
663
- status?: {
664
- equal?: WithdrawalRecordStatus;
665
- notEqual?: WithdrawalRecordStatus;
666
- in?: WithdrawalRecordStatus[];
667
- notIn?: WithdrawalRecordStatus[];
668
- };
669
- reference?: {
670
- equal?: string;
671
- notEqual?: string;
672
- in?: string[];
673
- notIn?: string[];
674
- contains?: string;
675
- startsWith?: string;
676
- };
677
- withdrawalNumber?: {
678
- equal?: string;
679
- notEqual?: string;
680
- in?: string[];
681
- notIn?: string[];
682
- contains?: string;
683
- startsWith?: string;
684
- };
685
- dateTimeCreated?: {
686
- equal?: Date | string;
687
- notEqual?: Date | string;
688
- in?: Date | string[];
689
- notIn?: Date | string[];
690
- lesserThan?: Date | string;
691
- lesserThanOrEqual?: Date | string;
692
- greaterThan?: Date | string;
693
- greaterThanOrEqual?: Date | string;
694
- };
695
- dateTimeLastUpdated?: {
696
- equal?: Date | string;
697
- notEqual?: Date | string;
698
- in?: Date | string[];
699
- notIn?: Date | string[];
700
- lesserThan?: Date | string;
701
- lesserThanOrEqual?: Date | string;
702
- greaterThan?: Date | string;
703
- greaterThanOrEqual?: Date | string;
704
- };
705
- };
706
- }
707
-
708
- interface WithdrawalRecord {
709
- id: string;
710
- type: WithdrawalRecordType;
711
- bank?: 'AUBKPHMM' | 'MBTCPHMM' | 'BNORPHMM' | 'MKRUPHM1';
712
- fee: number;
713
- amount: number;
714
- netAmount: number;
715
- status: WithdrawalRecordStatus;
716
- reference?: string;
717
- withdrawalNumber: string;
718
- recipientMobileNumber?: string;
719
- dateTimeConfirmed?: Date;
720
- dateTimeCreated: Date;
721
- dateTimeLastUpdated: Date;
722
- }
723
-
724
- type WithdrawalRecordsReturn =
725
- | {
726
- ok: true;
727
- data: {
728
- withdrawalRecords: (WithdrawalRecord & { cursor: string })[];
729
- totalCount: number;
730
- hasNextPage: boolean;
731
- endCursor?: string;
732
- };
733
- }
734
- | {
735
- ok: false;
736
- error: HttpError;
737
- };
738
- ```
739
-
740
- - `remainingDailyWithdrawalsCount` - Retrieve current user's remaining daily withdrawals count
741
-
742
- ```ts
743
- remainingDailyWithdrawalsCount(): Promise<RemainingDailyWithdrawalsCountReturn>
744
- ```
745
-
746
- ```ts
747
- type RemainingDailyWithdrawalsCountReturn =
748
- | {
749
- ok: true;
750
- data: number;
751
- }
752
- | {
753
- ok: false;
754
- error: HttpError;
755
- };
756
- ```
757
-
758
- - `createDeposit` - Create new deposit request
759
-
760
- ```ts
761
- createDeposit(input: CreateDepositInput): Promise<CreateDepositReturn>
762
- ```
763
-
764
- ```ts
765
- interface CreateMayaDepositInput {
766
- id?: string;
767
- type: 'MAYA';
768
- amount: number;
769
- promo?: string;
770
- }
771
-
772
- interface CreateGCashDepositInput {
773
- id?: string;
774
- type: 'GCASH';
775
- amount: number;
776
- promo?: string;
777
- }
778
-
779
- interface CreateMayaAppDepositInput {
780
- id?: string;
781
- type: 'MAYA_APP';
782
- amount: number;
783
- promo?: string;
784
- }
785
-
786
- type CreateDepositInput =
787
- | CreateMayaDepositInput
788
- | CreateGCashDepositInput
789
- | CreateMayaAppDepositInput;
790
-
791
- type CreateDepositReturn =
792
- | {
793
- ok: true;
794
- data: {
795
- id: string;
796
- };
797
- }
798
- | {
799
- ok: false;
800
- error:
801
- | HttpError
802
- | {
803
- name:
804
- | 'DepositPromoMaximumAmountExceededError'
805
- | 'DepositPromoMinimumAmountNotMetError'
806
- | 'MaximumDepositAmountExceededError'
807
- | 'MinimumDepositAmountNotMetError'
808
- | 'MinimumFirstDepositAmountNotMetError'
809
- | 'PromoNotEnabledError'
810
- | 'WalletDoesNotExistError';
811
- message: string;
812
- };
813
- };
814
- ```
815
-
816
- - `deposit` - Retrieve deposit details
817
-
818
- ```ts
819
- deposit(id: string): Promise<DepositReturn>
820
- ```
821
-
822
- ```ts
823
- interface Deposit {
824
- id: string;
825
- type: 'BANK' | 'GCASH' | 'MANUAL' | 'MAYA' | 'MAYA_APP';
826
- status: 'PENDING' | 'ACCEPTED' | 'APPROVED' | 'REJECTED' | 'CONFIRMED' | 'CANCELLED';
827
- amount: number;
828
- netAmount: number;
829
- fee: number;
830
- reference?: string;
831
- checkoutUrl?: string;
832
- dateTimeCreated: Date;
833
- dateTimeLastUpdated: Date;
834
- }
835
-
836
- type DepositReturn =
837
- | {
838
- ok: true;
839
- data: Deposit | null;
840
- }
841
- | {
842
- ok: false;
843
- error: HttpError;
844
- };
845
- ```
846
-
847
- - `depositRecords` - Retrieve current user's deposit records
848
-
849
- ```ts
850
- depositRecords(input?: DepositRecordsInput): Promise<DepositRecordsReturn>
851
- ```
852
-
853
- ```ts
854
- type DepositRecordType = 'BANK' | 'GCASH' | 'MANUAL' | 'MAYA' | 'MAYA_APP';
855
- type DepositRecordStatus =
856
- | 'PENDING'
857
- | 'ACCEPTED'
858
- | 'APPROVED'
859
- | 'REJECTED'
860
- | 'CONFIRMED'
861
- | 'CANCELLED';
862
-
863
- interface DepositRecordsInput {
864
- first?: number;
865
- after?: string;
866
- filter?: {
867
- type?: {
868
- equal?: DepositRecordType;
869
- notEqual?: DepositRecordType;
870
- in?: DepositRecordType[];
871
- notIn?: DepositRecordType[];
872
- };
873
- status?: {
874
- equal?: DepositRecordStatus;
875
- notEqual?: DepositRecordStatus;
876
- in?: DepositRecordStatus[];
877
- notIn?: DepositRecordStatus[];
878
- };
879
- reference?: {
880
- equal?: string;
881
- notEqual?: string;
882
- in?: string[];
883
- notIn?: string[];
884
- contains?: string;
885
- startsWith?: string;
886
- };
887
- depositNumber?: {
888
- equal?: string;
889
- notEqual?: string;
890
- in?: string[];
891
- notIn?: string[];
892
- contains?: string;
893
- startsWith?: string;
894
- };
895
- dateTimeCreated?: {
896
- equal?: Date | string;
897
- notEqual?: Date | string;
898
- in?: Date | string[];
899
- notIn?: Date | string[];
900
- lesserThan?: Date | string;
901
- lesserThanOrEqual?: Date | string;
902
- greaterThan?: Date | string;
903
- greaterThanOrEqual?: Date | string;
904
- };
905
- dateTimeLastUpdated?: {
906
- equal?: Date | string;
907
- notEqual?: Date | string;
908
- in?: Date | string[];
909
- notIn?: Date | string[];
910
- lesserThan?: Date | string;
911
- lesserThanOrEqual?: Date | string;
912
- greaterThan?: Date | string;
913
- greaterThanOrEqual?: Date | string;
914
- };
915
- };
916
- }
917
-
918
- interface DepositRecord {
919
- id: string;
920
- type: DepositRecordType;
921
- status: DepositRecordStatus;
922
- amount: number;
923
- netAmount: number;
924
- fee: number;
925
- reference?: string;
926
- depositNumber: string;
927
- dateTimeCreated: Date;
928
- dateTimeLastUpdated: Date;
929
- }
930
-
931
- type DepositRecordsReturn =
932
- | {
933
- ok: true;
934
- data: {
935
- depositRecords: (DepositRecord & { cursor: string })[];
936
- totalCount: number;
937
- hasNextPage: boolean;
938
- endCursor?: string;
939
- };
940
- }
941
- | {
942
- ok: false;
943
- error: HttpError;
944
- };
945
- ```
946
-
947
- - `depositsCount` - Retrieve current user's deposits count
948
-
949
- ```ts
950
- depositsCount(): Promise<DepositsCountReturn>
951
- ```
952
-
953
- ```ts
954
- type DepositsCountReturn =
955
- | {
956
- ok: true;
957
- data: number;
958
- }
959
- | {
960
- ok: false;
961
- error: HttpError;
962
- };
963
- ```
964
-
965
- - `betRecords` - Retrieve current user's bet records
966
-
967
- ```ts
968
- betRecords(input?: BetRecordsInput): Promise<BetRecordsReturn>
969
- ```
970
-
971
- ```ts
972
- type BetRecordStatus = 'STARTED' | 'SETTLED' | 'CANCELLED';
973
-
974
- interface BetRecordsInput {
975
- first?: number;
976
- after?: string;
977
- sort?: SortOrder;
978
- filter?: {
979
- serialCode?: {
980
- equal?: string;
981
- notEqual?: string;
982
- in?: string[];
983
- notIn?: string[];
984
- contains?: string;
985
- startsWith?: string;
986
- };
987
- game?: {
988
- equal?: string;
989
- notEqual?: string;
990
- in?: string[];
991
- notIn?: string[];
992
- };
993
- game__externalId?: {
994
- equal?: string;
995
- notEqual?: string;
996
- in?: string[];
997
- notIn?: string[];
998
- contains?: string;
999
- startsWith?: string;
1000
- };
1001
- game__type?: {
1002
- equal?: GameType;
1003
- notEqual?: GameType;
1004
- in?: GameType[];
1005
- notIn?: GameType[];
1006
- };
1007
- game__provider?: {
1008
- equal?: GameProvider;
1009
- notEqual?: GameProvider;
1010
- in?: GameProvider[];
1011
- notIn?: GameProvider[];
1012
- };
1013
- dateTimeCreated?: {
1014
- equal?: Date | string;
1015
- notEqual?: Date | string;
1016
- in?: Date | string[];
1017
- notIn?: Date | string[];
1018
- lesserThan?: Date | string;
1019
- lesserThanOrEqual?: Date | string;
1020
- greaterThan?: Date | string;
1021
- greaterThanOrEqual?: Date | string;
1022
- };
1023
- vendorRoundId?: {
1024
- equal?: string;
1025
- notEqual?: string;
1026
- in?: string[];
1027
- notIn?: string[];
1028
- contains?: string;
1029
- startsWith?: string;
1030
- };
1031
- status?: {
1032
- equal?: BetRecordStatus;
1033
- notEqual?: BetRecordStatus;
1034
- in?: BetRecordStatus[];
1035
- notIn?: BetRecordStatus[];
1036
- };
1037
- };
1038
- startDateTime?: {
1039
- equal?: Date | string;
1040
- notEqual?: Date | string;
1041
- in?: Date | string[];
1042
- notIn?: Date | string[];
1043
- lesserThan?: Date | string;
1044
- lesserThanOrEqual?: Date | string;
1045
- greaterThan?: Date | string;
1046
- greaterThanOrEqual?: Date | string;
1047
- };
1048
- endDateTime?: {
1049
- equal?: Date | string;
1050
- notEqual?: Date | string;
1051
- in?: Date | string[];
1052
- notIn?: Date | string[];
1053
- lesserThan?: Date | string;
1054
- lesserThanOrEqual?: Date | string;
1055
- greaterThan?: Date | string;
1056
- greaterThanOrEqual?: Date | string;
1057
- };
1058
- }
1059
-
1060
- interface BetRecord {
1061
- id: string;
1062
- game: Game;
1063
- status: BetRecordStatus;
1064
- serialCode: string;
1065
- vendorRoundId?: string;
1066
- bet: number;
1067
- payout: number;
1068
- validBet: number;
1069
- jackpotContribution: number;
1070
- jackpotPayout: number;
1071
- winloss?: number;
1072
- betContent?: string;
1073
- contestName?: string;
1074
- externalCategory?: string;
1075
- dateTimeSettled?: Date;
1076
- dateTimeCreated: Date;
1077
- dateTimeLastUpdated: Date;
1078
- metadata: {
1079
- odds?: string;
1080
- validBet?: number;
1081
- };
1082
- }
1083
-
1084
- type BetRecordsReturn =
1085
- | {
1086
- ok: true;
1087
- data: {
1088
- betRecords: (BetRecord & { cursor: string })[];
1089
- totalCount: number;
1090
- hasNextPage: boolean;
1091
- endCursor?: string;
1092
- };
1093
- }
1094
- | {
1095
- ok: false;
1096
- error: HttpError;
1097
- };
1098
- ```
1099
-
1100
- - `transactionRecords` - Retrieve current user's transaction records
1101
-
1102
- ```ts
1103
- transactionRecords(input?: TransactionRecordsInput): Promise<TransactionRecordsReturn>
1104
- ```
1105
-
1106
- ```ts
1107
- type TransactionRecordType =
1108
- | 'DEPOSIT'
1109
- | 'PAYOUT'
1110
- | 'WITHDRAWAL_REFUND'
1111
- | 'TRANSFER_IN'
1112
- | 'WITHDRAWAL'
1113
- | 'BET'
1114
- | 'TRANSFER_OUT'
1115
- | 'ROLLBACK'
1116
- | 'BET_REFUND'
1117
- | 'PAYOUT_REFUND'
1118
- | 'CASHBACK_BONUS'
1119
- | 'BONUS'
1120
- | 'RESERVE'
1121
- | 'REJECT_WITHDRAWAL'
1122
- | 'MANUAL_DEPOSIT'
1123
- | 'GCASH_DEPOSIT'
1124
- | 'MANUAL_WITHDRAWAL'
1125
- | 'BANK_WITHDRAWAL'
1126
- | 'GCASH_WITHDRAWAL'
1127
- | 'COMMIT_RESERVE'
1128
- | 'ROLLBACK_PAYOUT'
1129
- | 'ROLLBACK_RESERVE';
1130
-
1131
- interface TransactionRecordsInput {
1132
- first?: number;
1133
- after?: string;
1134
- filter?: {
1135
- type?: {
1136
- equal?: TransactionRecordType;
1137
- notEqual?: TransactionRecordType;
1138
- in?: TransactionRecordType[];
1139
- notIn?: TransactionRecordType[];
1140
- };
1141
- referenceNumber?: {
1142
- equal?: string;
1143
- notEqual?: string;
1144
- in?: string[];
1145
- notIn?: string[];
1146
- contains?: string;
1147
- startsWith?: string;
1148
- };
1149
- dateTimeCreated?: {
1150
- equal?: Date | string;
1151
- notEqual?: Date | string;
1152
- in?: Date | string[];
1153
- notIn?: Date | string[];
1154
- lesserThan?: Date | string;
1155
- lesserThanOrEqual?: Date | string;
1156
- greaterThan?: Date | string;
1157
- greaterThanOrEqual?: Date | string;
1158
- };
1159
- };
1160
- }
1161
-
1162
- interface TransactionRecord {
1163
- id: string;
1164
- type: TransactionRecordType;
1165
- amount: number;
1166
- content?: string;
1167
- currentBalance: number;
1168
- referenceNumber: string;
1169
- dateTimeCreated: Date;
1170
- dateTimeLastUpdated: Date;
1171
- }
1172
-
1173
- type TransactionRecordsReturn =
1174
- | {
1175
- ok: true;
1176
- data: {
1177
- transactionRecords: (TransactionRecord & { cursor: string })[];
1178
- totalCount: number;
1179
- hasNextPage: boolean;
1180
- endCursor?: string;
1181
- };
1182
- }
1183
- | {
1184
- ok: false;
1185
- error: HttpError;
1186
- };
1187
- ```
1188
-
1189
- - `promos` - Retrieve promos for current platform
1190
-
1191
- ```ts
1192
- promos(): Promise<PromosReturn>
1193
- ```
1194
-
1195
- ```ts
1196
- interface Promo {
1197
- id: string;
1198
- type: 'DEPOSIT';
1199
- name: string;
1200
- banner: {
1201
- id: string;
1202
- url: string;
1203
- status: 'READY';
1204
- dateTimeCreated: Date;
1205
- };
1206
- status: 'ACTIVE' | 'INACTIVE' | 'DISABLED' | 'EXPIRED';
1207
- description: string;
1208
- minimumBonusAmount?: number;
1209
- maximumBonusAmount?: number;
1210
- minimumDepositAmount?: number;
1211
- turnoverRequirementContributionPercentagePerGameProvider?: JSON;
1212
- maximumDepositAmount?: number;
1213
- activationStartDateTime: Date;
1214
- activationEndDateTime: Date;
1215
- dateTimeCreated: Date;
1216
- dateTimeLastUpdated: Date;
1217
- }
1218
-
1219
- type PromosReturn =
1220
- | {
1221
- ok: true;
1222
- data: Promo[];
1223
- }
1224
- | {
1225
- ok: false;
1226
- error: HttpError;
1227
- };
1228
- ```
1229
-
1230
- - `availablePromos` - Retrieve available promos for current user
1231
-
1232
- ```ts
1233
- availablePromos(): Promise<PromosReturn>
1234
- ```
1235
-
1236
- - `bonus` - Retrieve current user's bonus details
1237
-
1238
- ```ts
1239
- bonus(): Promise<BonusReturn>
1240
- ```
1241
-
1242
- ```ts
1243
- interface Bonus {
1244
- id: string;
1245
- promo: Promo;
1246
- deposit?: {
1247
- type: DepositRecordType;
1248
- status: DepositRecordStatus;
1249
- amount: number;
1250
- netAmount: number;
1251
- fee: number;
1252
- reference?: string;
1253
- dateTimeCreated: Date;
1254
- dateTimeLastUpdated: Date;
1255
- };
1256
- amount: number;
1257
- balance: number;
1258
- turnoverRequirement: number;
1259
- currentTurnoverRequirementContribution: number;
1260
- currentTurnoverRequirementContributionPercentage: number;
1261
- expiration: Date;
1262
- dateTimeCreated: Date;
1263
- dateTimeLastUpdated: Date;
1264
- }
1265
-
1266
- type BonusReturn =
1267
- | {
1268
- ok: true;
1269
- data: Bonus | null;
1270
- }
1271
- | {
1272
- ok: false;
1273
- error: HttpError;
1274
- };
1275
- ```
1276
-
1277
- - `cashbacks` - Retrieve cashbacks for current platform
1278
-
1279
- ```ts
1280
- cashbacks(): Promise<CashbackReturn>
1281
- ```
1282
-
1283
- ```ts
1284
- interface Cashback {
1285
- id: string;
1286
- name: string;
1287
- banner: {
1288
- id: string;
1289
- url: string;
1290
- status: 'READY';
1291
- dateTimeCreated: Date;
1292
- };
1293
- status: CashbackStatus;
1294
- description: string;
1295
- activationStartDateTime: Date;
1296
- activationEndDateTime: Date;
1297
- dateTimeCreated: Date;
1298
- dateTimeLastUpdated: Date;
1299
- }
1300
-
1301
- type CashbackReturn =
1302
- | {
1303
- ok: true;
1304
- data: Cashback[];
1305
- }
1306
- | {
1307
- ok: false;
1308
- error: HttpError;
1309
- };
1310
- ```
1311
-
1312
- - `cashbackBonuses` - Retrieve current user's cashback bonuses
1313
-
1314
- ```ts
1315
- cashbackBonuses(): Promise<CashbackBonusesReturn>
1316
- ```
1317
-
1318
- ```ts
1319
- interface CashbackBonus {
1320
- id: string;
1321
- balance: number;
1322
- cashback: Cashback;
1323
- dateTimeCreated: Date;
1324
- dateTimeLastUpdated: Date;
1325
- }
1326
-
1327
- type CashbackBonusesReturn =
1328
- | {
1329
- ok: true;
1330
- data: CashbackBonus[];
1331
- }
1332
- | {
1333
- ok: false;
1334
- error: HttpError;
1335
- };
1336
- ```
1337
-
1338
- - `claimCashbackBonus` - Claim cashback bonus
1339
-
1340
- ```ts
1341
- claimCashbackBonus(id: string): Promise<ClaimCashbackBonusReturn>
1342
- ```
1343
-
1344
- ```ts
1345
- type ClaimCashbackBonusReturn =
1346
- | {
1347
- ok: true;
1348
- }
1349
- | {
1350
- ok: false;
1351
- error:
1352
- | HttpError
1353
- | {
1354
- name: 'CashbackBonusDoesNotExistError';
1355
- message: string;
1356
- };
1357
- };
1358
- ```
1359
-
1360
- - `games` - Retrieve games
1361
-
1362
- ```ts
1363
- games(input?: GamesInput): Promise<GamesReturn>
1364
- ```
1365
-
1366
- ```ts
1367
- type GameType = 'SLOTS' | 'SPORTS' | 'BINGO' | 'FISHING' | 'LIVE' | 'GAMES';
1368
- type GameProvider =
1369
- | 'JILI'
1370
- | 'PGSOFT'
1371
- | 'FACHAI'
1372
- | 'PLAYTECH'
1373
- | 'CQ9'
1374
- | 'JDB'
1375
- | 'BOOONGO'
1376
- | 'HABANERO'
1377
- | 'DIGITAIN'
1378
- | 'RELAXGAMING'
1379
- | 'DG'
1380
- | 'E2E'
1381
- | 'BTI'
1382
- | 'DARWIN'
1383
- | 'MEGABALL'
1384
- | 'DRBINGO'
1385
- | 'RTG';
1386
-
1387
- interface GamesInput {
1388
- after?: string;
1389
- first?: number;
1390
- filter?: {
1391
- id?: {
1392
- equal?: string;
1393
- notEqual?: string;
1394
- in?: string[];
1395
- notIn?: string[];
1396
- };
1397
- name?: {
1398
- equal?: string;
1399
- notEqual?: string;
1400
- in?: string[];
1401
- notIn?: string[];
1402
- contains?: string;
1403
- startsWith?: string;
1404
- };
1405
- type?: {
1406
- equal?: GameType;
1407
- notEqual?: GameType;
1408
- in?: GameType[];
1409
- notIn?: GameType[];
1410
- };
1411
- provider?: {
1412
- equal?: GameProvider;
1413
- notEqual?: GameProvider;
1414
- in?: GameProvider[];
1415
- notIn?: GameProvider[];
1416
- };
1417
- };
1418
- }
1419
-
1420
- interface Game {
1421
- id: string;
1422
- type: GameType;
1423
- name: string;
1424
- image: string;
1425
- provider: GameProvider;
1426
- }
1427
-
1428
- type GamesReturn =
1429
- | {
1430
- ok: true;
1431
- data: {
1432
- games: (Game & { cursor: string })[];
1433
- totalCount: number;
1434
- hasNextPage: boolean;
1435
- endCursor?: string;
1436
- };
1437
- }
1438
- | {
1439
- ok: false;
1440
- error: HttpError;
1441
- };
1442
- ```
1443
-
1444
- - `gameSession` - Retrieve game session details
1445
-
1446
- ```ts
1447
- gameSession(id: string): Promise<GameSessionReturn>
1448
- ```
1449
-
1450
- ```ts
1451
- type GameSession =
1452
- | {
1453
- id: string;
1454
- game: Game;
1455
- status: 'READY';
1456
- launchUrl: string;
1457
- dateTimeCreated: Date;
1458
- dateTimeLastUpdated: Date;
1459
- }
1460
- | {
1461
- id: string;
1462
- game: Game;
1463
- status: 'PENDING' | 'STARTING' | 'ENDED' | 'CANCELLED';
1464
- dateTimeCreated: Date;
1465
- dateTimeLastUpdated: Date;
1466
- };
1467
-
1468
- type GameSessionReturn =
1469
- | {
1470
- ok: true;
1471
- data: GameSession | null;
1472
- }
1473
- | {
1474
- ok: false;
1475
- error: HttpError;
1476
- };
1477
- ```
1478
-
1479
- - `createGameSession` - Create new game session
1480
-
1481
- ```ts
1482
- createGameSession(input:CreateGameSessionInput): Promise<CreateGameSessionReturn>
1483
- ```
1484
-
1485
- ```ts
1486
- interface CreateGameSessionInput {
1487
- id?: string;
1488
- game: string;
1489
- }
1490
-
1491
- type CreateGameSessionReturn =
1492
- | {
1493
- ok: true;
1494
- data: {
1495
- id: string;
1496
- };
1497
- }
1498
- | {
1499
- ok: false;
1500
- error:
1501
- | HttpError
1502
- | {
1503
- name: 'GameDoesNotExistError';
1504
- message: string;
1505
- };
1506
- };
1507
- ```
1508
-
1509
- - `endGameSession` - End game session
1510
-
1511
- ```ts
1512
- endGameSession(id: string): Promise<EndGameSessionReturn>
1513
- ```
1514
-
1515
- ```ts
1516
- type EndGameSessionReturn =
1517
- | {
1518
- ok: true;
1519
- }
1520
- | {
1521
- ok: false;
1522
- error: HttpError | UnknownError;
1523
- };
1524
- ```
1525
-
1526
- - `file` - Retrieve file details
1527
-
1528
- ```ts
1529
- file(id: string): Promise<FileReturn>
1530
- ```
1531
-
1532
- ```ts
1533
- type File =
1534
- | {
1535
- id: string;
1536
- url?: never;
1537
- status: 'UPLOADING' | 'FAILED';
1538
- dateTimeCreated: Date;
1539
- }
1540
- | {
1541
- id: string;
1542
- url: string;
1543
- status: 'READY';
1544
- dateTimeCreated: Date;
1545
- }
1546
- | {
1547
- id: string;
1548
- url?: string;
1549
- status: 'DELETED';
1550
- dateTimeCreated: Date;
1551
- };
1552
-
1553
- type FileReturn =
1554
- | {
1555
- ok: true;
1556
- data: File | null;
1557
- }
1558
- | {
1559
- ok: false;
1560
- error: HttpError;
1561
- };
1562
- ```
1563
-
1564
- - `uploadImageFile` - Upload image file
1565
-
1566
- ```ts
1567
- uploadImageFile(input: globalThis.File): Promise<UploadImageFileReturn>
1568
- ```
1569
-
1570
- ```ts
1571
- type UploadImageFileReturn =
1572
- | {
1573
- ok: true;
1574
- data: {
1575
- id: string;
1576
- };
1577
- }
1578
- | {
1579
- ok: false;
1580
- error:
1581
- | HttpError
1582
- | {
1583
- name: 'FileFormatNotSupportedError' | 'FileNameTooLongError' | 'FileSizeTooBigError';
1584
- message: string;
1585
- };
1586
- };
1587
- ```
1588
-
1589
- - `pointsWallet` - Retrieve current user's points wallet details
1590
-
1591
- ```ts
1592
- pointsWallet(): Promise<PointsWalletReturn>
1593
- ```
1594
-
1595
- ```ts
1596
- interface PointsWallet {
1597
- id: string;
1598
- points: number;
1599
- account: string;
1600
- dateTimeCreated: Date;
1601
- }
1602
-
1603
- type PointsWalletReturn =
1604
- | {
1605
- ok: true;
1606
- data: PointsWallet | null;
1607
- }
1608
- | {
1609
- ok: false;
1610
- error: HttpError;
1611
- };
1612
- ```
1613
-
1614
- - `pointsToCashConversion` - Convert points to cash
1615
-
1616
- ```ts
1617
- pointsToCashConversion(amount: number): Promise<PointsToCashConversionReturn>
1618
- ```
1619
-
1620
- ```ts
1621
- type PointsToCashConversionReturn =
1622
- | {
1623
- ok: true;
1624
- }
1625
- | {
1626
- ok: false;
1627
- error:
1628
- | HttpError
1629
- | {
1630
- name: 'InsufficientPointsError';
1631
- message: string;
1632
- };
1633
- };
1634
- ```
1
+ ## Opexa Portal SDK
2
+
3
+ A library that provides a set of functions to interact with Opexa Portal API.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @opexa/portal-sdk
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ - Create sdk instance
14
+
15
+ ```ts
16
+ // lib/sdk.js
17
+ import Sdk from '@opexa/portal-sdk';
18
+
19
+ export const sdk = new Sdk({
20
+ platform: 'Z892',
21
+ environment: 'development',
22
+ });
23
+ ```
24
+
25
+ - Use sdk instance
26
+
27
+ ```jsx
28
+ import { sdk } from '$lib/sdk';
29
+ import * as React from 'react';
30
+
31
+ function Page() {
32
+ const [account, setAccount] = React.useState();
33
+
34
+ React.useEffect(function () {
35
+ sdk.account().then(setAccount);
36
+ }, []);
37
+
38
+ return (
39
+ <pre>
40
+ <code>{JSON.stringify(account, null, 2)}</code>
41
+ </pre>
42
+ );
43
+ }
44
+ ```
45
+
46
+ ## API
47
+
48
+ ### `Sdk`
49
+
50
+ `Sdk` accepts the following options:
51
+
52
+ - `*site` - The site ID to be used
53
+ - `*sitePlatform` - The site platform ID to be used
54
+ - `*platform` - The platform code to be used
55
+ - `*environment` - Whether to use production/development api
56
+
57
+ , and returns the following methods:
58
+
59
+ - `signIn` - Start user session
60
+
61
+ ```ts
62
+ signIn(input: SignInInput): Promise<SignInReturn>
63
+ ```
64
+
65
+ ```ts
66
+ type SignInInput =
67
+ | {
68
+ type: 'NAME_AND_PASSWORD';
69
+ name: string;
70
+ password: string;
71
+ }
72
+ | {
73
+ type: 'MOBILE_NUMBER';
74
+ mobileNumber: string;
75
+ verificationCode: string;
76
+ };
77
+
78
+ type SignInReturn =
79
+ | {
80
+ ok: true;
81
+ }
82
+ | {
83
+ ok: false;
84
+ error:
85
+ | HttpError
86
+ | {
87
+ name: 'AccountNotFound';
88
+ message: string;
89
+ };
90
+ };
91
+ ```
92
+
93
+ - `signOut` - End current user session
94
+
95
+ ```ts
96
+ signOut(): Promise<void>
97
+ ```
98
+
99
+ - `site` - Retrieve site details
100
+
101
+ ```ts
102
+ site(): Promise<SiteReturn>
103
+ ```
104
+
105
+ ```ts
106
+ interface Site {
107
+ id: string;
108
+ name: string;
109
+ logo?: string;
110
+ }
111
+ ```
112
+
113
+ ```ts
114
+ type SiteReturn =
115
+ | {
116
+ ok: true;
117
+ data: Site;
118
+ }
119
+ | {
120
+ ok: false;
121
+ error: HttpError;
122
+ };
123
+ ```
124
+
125
+ - `platform` - Retrieve current platform details
126
+
127
+ ```ts
128
+ platform(): Promise<PlatformReturn>
129
+ ```
130
+
131
+ ```ts
132
+ interface Platform {
133
+ paymentSettings: {
134
+ minimumFirstDepositAmount?: number;
135
+ restrictWithdrawalsToVerifiedMembers: boolean;
136
+ depositGateway: {
137
+ bank: GatewaySettings;
138
+ gcash: GatewaySettings;
139
+ maya: GatewaySettings;
140
+ mayaApp: GatewaySettings;
141
+ };
142
+ withdrawalGateway: {
143
+ bank: GatewaySettings;
144
+ gcash: GatewaySettings;
145
+ maya: GatewaySettings;
146
+ mayaApp: GatewaySettings;
147
+ };
148
+ };
149
+ pointsClubSettings: {
150
+ multiplier: number;
151
+ };
152
+ }
153
+
154
+ type PlatformReturn =
155
+ | {
156
+ ok: true;
157
+ data: Platform;
158
+ }
159
+ | {
160
+ ok: false;
161
+ error: HttpError;
162
+ };
163
+ ```
164
+
165
+ - `account` - Retrieve current user's details
166
+
167
+ ```ts
168
+ account(): Promise<AccountReturn>
169
+ ```
170
+
171
+ ```ts
172
+ interface Account {
173
+ id: string;
174
+ name: string;
175
+ status: MemberAccountStatus;
176
+ realName?: string;
177
+ nickName?: string;
178
+ dateOfBirth?: Date;
179
+ validId?: string;
180
+ emailAddress?: string;
181
+ mobileNumber?: string;
182
+ verified: boolean;
183
+ verificationStatus: MemberAccountVerificationStatus;
184
+ mobileNumberVerified: boolean;
185
+ mobileNumberVerificationRequired: boolean;
186
+ transactionPassword: boolean;
187
+ dateTimeLastActive?: Date;
188
+ dateTimeCreated: Date;
189
+ dateTimeLastUpdated: Date;
190
+ }
191
+
192
+ type AccountReturn =
193
+ | {
194
+ ok: true;
195
+ data: Account;
196
+ }
197
+ | {
198
+ ok: false;
199
+ error: HttpError;
200
+ };
201
+ ```
202
+
203
+ - `createAccount` - Create new user account
204
+
205
+ ```ts
206
+ createAccount(input: CreateAccountInput): Promise<CreateAccountReturn>
207
+ ```
208
+
209
+ ```ts
210
+ interface CreateAccountInput {
211
+ id?: string;
212
+ name: string;
213
+ password: string;
214
+ mobileNumber: string;
215
+ dateOfBirth: string;
216
+ btag?: string;
217
+ domain?: string;
218
+ referralCode?: string;
219
+ verificationCode?: string;
220
+ reCAPTCHAResponse?: string;
221
+ }
222
+
223
+ type CreateAccountReturn =
224
+ | {
225
+ ok: true;
226
+ error?: never;
227
+ data: {
228
+ id: string;
229
+ };
230
+ }
231
+ | {
232
+ ok: false;
233
+ data?: never;
234
+ error:
235
+ | HttpError
236
+ | {
237
+ name:
238
+ | 'AccountNameNotAvailableError'
239
+ | 'InvalidPlatformError'
240
+ | 'InvalidReCAPTCHAResponseError'
241
+ | 'InvalidSMSVerificationCodeError'
242
+ | 'MinimumAgeRequirementError'
243
+ | 'MobileNumberNotAvailableError';
244
+ message: string;
245
+ };
246
+ };
247
+ ```
248
+
249
+ - `updateAccount` - Update current user's details
250
+
251
+ ```ts
252
+ updateAccount(input: UpdateAccountInput): Promise<UpdateAccountReturn>
253
+ ```
254
+
255
+ ```ts
256
+ type UpdateAccountReturn =
257
+ | {
258
+ ok: true;
259
+ data?: never;
260
+ error?: never;
261
+ }
262
+ | {
263
+ ok: false;
264
+ data?: never;
265
+ error: {
266
+ name:
267
+ | 'AccountNameNotAvailableError'
268
+ | 'EmailAddressNotAvailableError'
269
+ | 'InvalidTransactionPasswordError'
270
+ | 'MobileNumberNotAvailableError'
271
+ | 'NickNameNotAvailableError'
272
+ | 'RealNameAlreadySetError'
273
+ | 'ValidIdAlreadySetError';
274
+ message: string;
275
+ };
276
+ };
277
+ ```
278
+
279
+ - `deleteAccount` - Delete current user's account
280
+
281
+ ```ts
282
+ deleteAccount(id: string): Promise<DeleteAccountReturn>
283
+ ```
284
+
285
+ ```ts
286
+ type DeleteAccountReturn =
287
+ | {
288
+ ok: true;
289
+ }
290
+ | {
291
+ ok: false;
292
+ error: UnknownError | HttpError;
293
+ };
294
+ ```
295
+
296
+ - `resetPassword` - Reset user's password
297
+
298
+ ```ts
299
+ resetPassword(input: ResetPasswordInput): Promise<ResetPasswordReturn>
300
+ ```
301
+
302
+ ```ts
303
+ interface ResetPasswordInput {
304
+ mobileNumber: string;
305
+ newPassword: string;
306
+ verificationCode: string;
307
+ }
308
+
309
+ type ResetPasswordReturn =
310
+ | {
311
+ ok: true;
312
+ }
313
+ | {
314
+ ok: false;
315
+ error:
316
+ | HttpError
317
+ | {
318
+ name: 'AccountNotFoundError' | 'InvalidVerificationCodeError';
319
+ message: string;
320
+ };
321
+ };
322
+ ```
323
+
324
+ - `verificationDetails` - Retrieve user's verification details
325
+
326
+ ```ts
327
+ verificationDetails(): Promise<VerificationDetailsReturn>
328
+ ```
329
+
330
+ ```ts
331
+ interface VerificationDetails {
332
+ id: string;
333
+ status: MemberVerificationStatus;
334
+ address: string;
335
+ sourceOfIncome: string;
336
+ natureOfWork: string;
337
+ nationality: string;
338
+ placeOfBirth: string;
339
+ idFrontImage: File;
340
+ selfieImage: File;
341
+ }
342
+
343
+ type VerificationDetailsReturn =
344
+ | {
345
+ ok: true;
346
+ data: VerificationDetails;
347
+ }
348
+ | {
349
+ ok: false;
350
+ error: HttpError;
351
+ };
352
+ ```
353
+
354
+ - `submitVerificationDetails` - Submit current user's verification details
355
+
356
+ ```ts
357
+ submitVerificationDetails(input: SubmitVerificationDetailsInput): Promise<SubmitVerificationDetailsReturn>
358
+ ```
359
+
360
+ ```ts
361
+ interface SubmitVerificationDetailsInput {
362
+ id?: string;
363
+ idFrontImage: string;
364
+ selfieImage: string;
365
+ address: string;
366
+ sourceOfIncome: string;
367
+ natureOfWork: string;
368
+ nationality: string;
369
+ placeOfBirth: string;
370
+ }
371
+
372
+ type SubmitVerificationDetailsReturn =
373
+ | {
374
+ ok: true;
375
+ data: {
376
+ id: string;
377
+ };
378
+ }
379
+ | {
380
+ ok: false;
381
+ error:
382
+ | HttpError
383
+ | {
384
+ name:
385
+ | 'FileDoesNotExistError'
386
+ | 'FileNotReadyError'
387
+ | 'MemberVerificationAlreadyExistsError';
388
+ message: string;
389
+ };
390
+ };
391
+ ```
392
+
393
+ - `updateVerificationDetails` - Update current user's verification details
394
+
395
+ ```ts
396
+ updateVerificationDetails(input: UpdateVerificationDetailsInput): Promise<UpdateVerificationDetailsReturn>
397
+ ```
398
+
399
+ ```ts
400
+ interface UpdateVerificationDetailsInput {
401
+ idFrontImage: string;
402
+ selfieImage: string;
403
+ address: string;
404
+ permanentAddress: string;
405
+ sourceOfIncome: string;
406
+ natureOfWork: string;
407
+ nationality: string;
408
+ placeOfBirth: string;
409
+ }
410
+
411
+ type UpdateVerificationDetailsReturn =
412
+ | {
413
+ ok: true;
414
+ }
415
+ | {
416
+ ok: false;
417
+ error:
418
+ | HttpError
419
+ | {
420
+ name:
421
+ | 'FileDoesNotExistError'
422
+ | 'FileNotReadyError'
423
+ | 'MemberVerificationAlreadyApprovedError'
424
+ | 'MemberVerificationDoesNotExistError';
425
+ message: string;
426
+ };
427
+ };
428
+ ```
429
+
430
+ - `verifyMobileNumber` - Verify current user's mobile number
431
+
432
+ ```ts
433
+ verifyMobileNumber(verificationCode: string): Promise<VerifyMobileNumberReturn>
434
+ ```
435
+
436
+ ```ts
437
+ type VerifyMobileNumberReturn =
438
+ | {
439
+ ok: true;
440
+ }
441
+ | {
442
+ ok: false;
443
+ error:
444
+ | HttpError
445
+ | {
446
+ name: 'InvalidSMSVerificationCodeError' | 'MobileNumberAlreadyVerifiedError';
447
+ message: string;
448
+ };
449
+ };
450
+ ```
451
+
452
+ - `profileCompletion` - Retrieve current user's profile completion status
453
+
454
+ ```ts
455
+ profileCompletion(): Promise<ProfileCompletionReturn>
456
+ ```
457
+
458
+ ```ts
459
+ interface ProfileCompletion {
460
+ completionPercentage: number;
461
+ personalInformation: boolean;
462
+ accountVerification: boolean;
463
+ mobileNumberVerification: boolean;
464
+ transactionPassword: boolean;
465
+ accountPassword: boolean;
466
+ }
467
+
468
+ type ProfileCompletionReturn =
469
+ | {
470
+ ok: true;
471
+ data: ProfileCompletion;
472
+ }
473
+ | {
474
+ ok: false;
475
+ error: HttpError;
476
+ };
477
+ ```
478
+
479
+ - `sendVerificationCode` - Send verification code to mobile number or email address
480
+
481
+ ```ts
482
+ sendVerificationCode(mobileNumber: string): Promise<SendVerificationCodeReturn>
483
+ ```
484
+
485
+ ```ts
486
+ type SendVerificationCodeReturn =
487
+ | {
488
+ ok: true;
489
+ }
490
+ | {
491
+ ok: false;
492
+ error:
493
+ | HttpError
494
+ | {
495
+ name: 'InvalidPlatformError' | 'NotReadyToSendVerficationCodeError';
496
+ message: string;
497
+ };
498
+ };
499
+ ```
500
+
501
+ - `wallet` - Retrieve current user's wallet details
502
+
503
+ ```ts
504
+ wallet(): Promise<WalletReturn>
505
+ ```
506
+
507
+ ```ts
508
+ interface Wallet {
509
+ id: string;
510
+ balance: number;
511
+ currency: Currency;
512
+ dateTimeCreated: Date;
513
+ dateTimeLastUpdated: Date;
514
+ }
515
+
516
+ type WalletReturn =
517
+ | {
518
+ ok: true;
519
+ data: Wallet | null;
520
+ }
521
+ | {
522
+ ok: false;
523
+ error: HttpError;
524
+ };
525
+ ```
526
+
527
+ - `announcements` - Retrieve announcements for current platform
528
+
529
+ ```ts
530
+ announcements(input?: AnnouncementsInput): Promise<AnnouncementsReturn>
531
+ ```
532
+
533
+ ```ts
534
+ interface AnnouncementsInput {
535
+ first?: number;
536
+ after?: string;
537
+ }
538
+
539
+ interface Announcement {
540
+ id: string;
541
+ type: 'RELEASE' | 'SCHEDULED_MAINTENANCE';
542
+ title: string;
543
+ status: 'ACTIVE' | 'INACTIVE';
544
+ message: string;
545
+ activationStartDateTime: Date;
546
+ activationEndDateTime: Date;
547
+ dateTimeCreated: Date;
548
+ dateTimeLastUpdated: Date;
549
+ }
550
+
551
+ type AnnouncementsReturn =
552
+ | {
553
+ ok: true;
554
+ data: {
555
+ announcements: (Announcement & { cursor: string })[];
556
+ totalCount: number;
557
+ hasNextPage: boolean;
558
+ endCursor?: string;
559
+ };
560
+ }
561
+ | {
562
+ ok: false;
563
+ error: HttpError;
564
+ };
565
+ ```
566
+
567
+ - `createWithdrawal` - Create new withdrawal request
568
+
569
+ ```ts
570
+ createWithdrawal(input: CreateWithdrawalInput): Promise<CreateWithdrawalReturn>
571
+ ```
572
+
573
+ ```ts
574
+ interface CreateBankWithdrawalInput {
575
+ id?: string;
576
+ type: 'BANK';
577
+ amount: number;
578
+ transactionPassword: string;
579
+ }
580
+
581
+ interface CreateGCashWithdrawalInput {
582
+ id?: string;
583
+ type: 'GCASH';
584
+ amount: number;
585
+ transactionPassword: string;
586
+ recipientMobileNumber: string;
587
+ }
588
+
589
+ interface CreateGCashStandardCashInWithdrawalInput {
590
+ id?: string;
591
+ type: 'GCASH_STANDARD_CASHIN';
592
+ amount: number;
593
+ transactionPassword: string;
594
+ recipientMobileNumber: string;
595
+ }
596
+
597
+ interface CreateMayaWithdrawalInput {
598
+ id?: string;
599
+ type: 'MAYA';
600
+ amount: number;
601
+ transactionPassword: string;
602
+ recipientMobileNumber: string;
603
+ }
604
+
605
+ interface CreateMayaAppWithdrawalInput {
606
+ id?: string;
607
+ type: 'MAYA_APP';
608
+ amount: number;
609
+ transactionPassword: string;
610
+ }
611
+
612
+ type CreateWithdrawalInput =
613
+ | CreateBankWithdrawalInput
614
+ | CreateGCashWithdrawalInput
615
+ | CreateGCashStandardCashInWithdrawalInput
616
+ | CreateMayaWithdrawalInput
617
+ | CreateMayaAppWithdrawalInput;
618
+
619
+ type CreateWithdrawalReturn =
620
+ | {
621
+ ok: true;
622
+ data: {
623
+ id: string;
624
+ };
625
+ }
626
+ | {
627
+ ok: false;
628
+ error:
629
+ | HttpError
630
+ | {
631
+ name:
632
+ | 'MobileNumberNotVerifiedError'
633
+ | 'AccountNotVerifiedError'
634
+ | 'InvalidWithdrawalAmountError'
635
+ | 'WithdrawalDailyLimitExceededError'
636
+ | 'InvalidTransactionPasswordError'
637
+ | 'NotEnoughBalanceError';
638
+ message: string;
639
+ };
640
+ };
641
+ ```
642
+
643
+ - `withdrawalRecords` - Retrieve current user's withdrawal records
644
+
645
+ ```ts
646
+ withdrawalRecords(input?: WithdrawalRecordsInput): Promise<WithdrawalRecordsReturn>
647
+ ```
648
+
649
+ ```ts
650
+ type WithdrawalRecordType = 'MANUAL' | 'BANK' | 'GCASH' | 'MAYA';
651
+ type WithdrawalRecordStatus = 'PENDING' | 'APPROVED' | 'REJECTED' | 'CONFIRMED' | 'CANCELLED';
652
+
653
+ interface WithdrawalRecordsInput {
654
+ first?: number;
655
+ after?: string;
656
+ filter?: {
657
+ type?: {
658
+ equal?: WithdrawalRecordType;
659
+ notEqual?: WithdrawalRecordType;
660
+ in?: WithdrawalRecordType[];
661
+ notIn?: WithdrawalRecordType[];
662
+ };
663
+ status?: {
664
+ equal?: WithdrawalRecordStatus;
665
+ notEqual?: WithdrawalRecordStatus;
666
+ in?: WithdrawalRecordStatus[];
667
+ notIn?: WithdrawalRecordStatus[];
668
+ };
669
+ reference?: {
670
+ equal?: string;
671
+ notEqual?: string;
672
+ in?: string[];
673
+ notIn?: string[];
674
+ contains?: string;
675
+ startsWith?: string;
676
+ };
677
+ withdrawalNumber?: {
678
+ equal?: string;
679
+ notEqual?: string;
680
+ in?: string[];
681
+ notIn?: string[];
682
+ contains?: string;
683
+ startsWith?: string;
684
+ };
685
+ dateTimeCreated?: {
686
+ equal?: Date | string;
687
+ notEqual?: Date | string;
688
+ in?: Date | string[];
689
+ notIn?: Date | string[];
690
+ lesserThan?: Date | string;
691
+ lesserThanOrEqual?: Date | string;
692
+ greaterThan?: Date | string;
693
+ greaterThanOrEqual?: Date | string;
694
+ };
695
+ dateTimeLastUpdated?: {
696
+ equal?: Date | string;
697
+ notEqual?: Date | string;
698
+ in?: Date | string[];
699
+ notIn?: Date | string[];
700
+ lesserThan?: Date | string;
701
+ lesserThanOrEqual?: Date | string;
702
+ greaterThan?: Date | string;
703
+ greaterThanOrEqual?: Date | string;
704
+ };
705
+ };
706
+ }
707
+
708
+ interface WithdrawalRecord {
709
+ id: string;
710
+ type: WithdrawalRecordType;
711
+ bank?: 'AUBKPHMM' | 'MBTCPHMM' | 'BNORPHMM' | 'MKRUPHM1';
712
+ fee: number;
713
+ amount: number;
714
+ netAmount: number;
715
+ status: WithdrawalRecordStatus;
716
+ reference?: string;
717
+ withdrawalNumber: string;
718
+ recipientMobileNumber?: string;
719
+ dateTimeConfirmed?: Date;
720
+ dateTimeCreated: Date;
721
+ dateTimeLastUpdated: Date;
722
+ }
723
+
724
+ type WithdrawalRecordsReturn =
725
+ | {
726
+ ok: true;
727
+ data: {
728
+ withdrawalRecords: (WithdrawalRecord & { cursor: string })[];
729
+ totalCount: number;
730
+ hasNextPage: boolean;
731
+ endCursor?: string;
732
+ };
733
+ }
734
+ | {
735
+ ok: false;
736
+ error: HttpError;
737
+ };
738
+ ```
739
+
740
+ - `remainingDailyWithdrawalsCount` - Retrieve current user's remaining daily withdrawals count
741
+
742
+ ```ts
743
+ remainingDailyWithdrawalsCount(): Promise<RemainingDailyWithdrawalsCountReturn>
744
+ ```
745
+
746
+ ```ts
747
+ type RemainingDailyWithdrawalsCountReturn =
748
+ | {
749
+ ok: true;
750
+ data: number;
751
+ }
752
+ | {
753
+ ok: false;
754
+ error: HttpError;
755
+ };
756
+ ```
757
+
758
+ - `createDeposit` - Create new deposit request
759
+
760
+ ```ts
761
+ createDeposit(input: CreateDepositInput): Promise<CreateDepositReturn>
762
+ ```
763
+
764
+ ```ts
765
+ interface CreateMayaDepositInput {
766
+ id?: string;
767
+ type: 'MAYA';
768
+ amount: number;
769
+ promo?: string;
770
+ }
771
+
772
+ interface CreateGCashDepositInput {
773
+ id?: string;
774
+ type: 'GCASH';
775
+ amount: number;
776
+ promo?: string;
777
+ }
778
+
779
+ interface CreateMayaAppDepositInput {
780
+ id?: string;
781
+ type: 'MAYA_APP';
782
+ amount: number;
783
+ promo?: string;
784
+ }
785
+
786
+ type CreateDepositInput =
787
+ | CreateMayaDepositInput
788
+ | CreateGCashDepositInput
789
+ | CreateMayaAppDepositInput;
790
+
791
+ type CreateDepositReturn =
792
+ | {
793
+ ok: true;
794
+ data: {
795
+ id: string;
796
+ };
797
+ }
798
+ | {
799
+ ok: false;
800
+ error:
801
+ | HttpError
802
+ | {
803
+ name:
804
+ | 'DepositPromoMaximumAmountExceededError'
805
+ | 'DepositPromoMinimumAmountNotMetError'
806
+ | 'MaximumDepositAmountExceededError'
807
+ | 'MinimumDepositAmountNotMetError'
808
+ | 'MinimumFirstDepositAmountNotMetError'
809
+ | 'PromoNotEnabledError'
810
+ | 'WalletDoesNotExistError';
811
+ message: string;
812
+ };
813
+ };
814
+ ```
815
+
816
+ - `deposit` - Retrieve deposit details
817
+
818
+ ```ts
819
+ deposit(id: string): Promise<DepositReturn>
820
+ ```
821
+
822
+ ```ts
823
+ interface Deposit {
824
+ id: string;
825
+ type: 'BANK' | 'GCASH' | 'MANUAL' | 'MAYA' | 'MAYA_APP';
826
+ status: 'PENDING' | 'ACCEPTED' | 'APPROVED' | 'REJECTED' | 'CONFIRMED' | 'CANCELLED';
827
+ amount: number;
828
+ netAmount: number;
829
+ fee: number;
830
+ reference?: string;
831
+ checkoutUrl?: string;
832
+ dateTimeCreated: Date;
833
+ dateTimeLastUpdated: Date;
834
+ }
835
+
836
+ type DepositReturn =
837
+ | {
838
+ ok: true;
839
+ data: Deposit | null;
840
+ }
841
+ | {
842
+ ok: false;
843
+ error: HttpError;
844
+ };
845
+ ```
846
+
847
+ - `depositRecords` - Retrieve current user's deposit records
848
+
849
+ ```ts
850
+ depositRecords(input?: DepositRecordsInput): Promise<DepositRecordsReturn>
851
+ ```
852
+
853
+ ```ts
854
+ type DepositRecordType = 'BANK' | 'GCASH' | 'MANUAL' | 'MAYA' | 'MAYA_APP';
855
+ type DepositRecordStatus =
856
+ | 'PENDING'
857
+ | 'ACCEPTED'
858
+ | 'APPROVED'
859
+ | 'REJECTED'
860
+ | 'CONFIRMED'
861
+ | 'CANCELLED';
862
+
863
+ interface DepositRecordsInput {
864
+ first?: number;
865
+ after?: string;
866
+ filter?: {
867
+ type?: {
868
+ equal?: DepositRecordType;
869
+ notEqual?: DepositRecordType;
870
+ in?: DepositRecordType[];
871
+ notIn?: DepositRecordType[];
872
+ };
873
+ status?: {
874
+ equal?: DepositRecordStatus;
875
+ notEqual?: DepositRecordStatus;
876
+ in?: DepositRecordStatus[];
877
+ notIn?: DepositRecordStatus[];
878
+ };
879
+ reference?: {
880
+ equal?: string;
881
+ notEqual?: string;
882
+ in?: string[];
883
+ notIn?: string[];
884
+ contains?: string;
885
+ startsWith?: string;
886
+ };
887
+ depositNumber?: {
888
+ equal?: string;
889
+ notEqual?: string;
890
+ in?: string[];
891
+ notIn?: string[];
892
+ contains?: string;
893
+ startsWith?: string;
894
+ };
895
+ dateTimeCreated?: {
896
+ equal?: Date | string;
897
+ notEqual?: Date | string;
898
+ in?: Date | string[];
899
+ notIn?: Date | string[];
900
+ lesserThan?: Date | string;
901
+ lesserThanOrEqual?: Date | string;
902
+ greaterThan?: Date | string;
903
+ greaterThanOrEqual?: Date | string;
904
+ };
905
+ dateTimeLastUpdated?: {
906
+ equal?: Date | string;
907
+ notEqual?: Date | string;
908
+ in?: Date | string[];
909
+ notIn?: Date | string[];
910
+ lesserThan?: Date | string;
911
+ lesserThanOrEqual?: Date | string;
912
+ greaterThan?: Date | string;
913
+ greaterThanOrEqual?: Date | string;
914
+ };
915
+ };
916
+ }
917
+
918
+ interface DepositRecord {
919
+ id: string;
920
+ type: DepositRecordType;
921
+ status: DepositRecordStatus;
922
+ amount: number;
923
+ netAmount: number;
924
+ fee: number;
925
+ reference?: string;
926
+ depositNumber: string;
927
+ dateTimeCreated: Date;
928
+ dateTimeLastUpdated: Date;
929
+ }
930
+
931
+ type DepositRecordsReturn =
932
+ | {
933
+ ok: true;
934
+ data: {
935
+ depositRecords: (DepositRecord & { cursor: string })[];
936
+ totalCount: number;
937
+ hasNextPage: boolean;
938
+ endCursor?: string;
939
+ };
940
+ }
941
+ | {
942
+ ok: false;
943
+ error: HttpError;
944
+ };
945
+ ```
946
+
947
+ - `depositsCount` - Retrieve current user's deposits count
948
+
949
+ ```ts
950
+ depositsCount(): Promise<DepositsCountReturn>
951
+ ```
952
+
953
+ ```ts
954
+ type DepositsCountReturn =
955
+ | {
956
+ ok: true;
957
+ data: number;
958
+ }
959
+ | {
960
+ ok: false;
961
+ error: HttpError;
962
+ };
963
+ ```
964
+
965
+ - `betRecords` - Retrieve current user's bet records
966
+
967
+ ```ts
968
+ betRecords(input?: BetRecordsInput): Promise<BetRecordsReturn>
969
+ ```
970
+
971
+ ```ts
972
+ type BetRecordStatus = 'STARTED' | 'SETTLED' | 'CANCELLED';
973
+
974
+ interface BetRecordsInput {
975
+ first?: number;
976
+ after?: string;
977
+ sort?: SortOrder;
978
+ filter?: {
979
+ serialCode?: {
980
+ equal?: string;
981
+ notEqual?: string;
982
+ in?: string[];
983
+ notIn?: string[];
984
+ contains?: string;
985
+ startsWith?: string;
986
+ };
987
+ game?: {
988
+ equal?: string;
989
+ notEqual?: string;
990
+ in?: string[];
991
+ notIn?: string[];
992
+ };
993
+ game__externalId?: {
994
+ equal?: string;
995
+ notEqual?: string;
996
+ in?: string[];
997
+ notIn?: string[];
998
+ contains?: string;
999
+ startsWith?: string;
1000
+ };
1001
+ game__type?: {
1002
+ equal?: GameType;
1003
+ notEqual?: GameType;
1004
+ in?: GameType[];
1005
+ notIn?: GameType[];
1006
+ };
1007
+ game__provider?: {
1008
+ equal?: GameProvider;
1009
+ notEqual?: GameProvider;
1010
+ in?: GameProvider[];
1011
+ notIn?: GameProvider[];
1012
+ };
1013
+ dateTimeCreated?: {
1014
+ equal?: Date | string;
1015
+ notEqual?: Date | string;
1016
+ in?: Date | string[];
1017
+ notIn?: Date | string[];
1018
+ lesserThan?: Date | string;
1019
+ lesserThanOrEqual?: Date | string;
1020
+ greaterThan?: Date | string;
1021
+ greaterThanOrEqual?: Date | string;
1022
+ };
1023
+ vendorRoundId?: {
1024
+ equal?: string;
1025
+ notEqual?: string;
1026
+ in?: string[];
1027
+ notIn?: string[];
1028
+ contains?: string;
1029
+ startsWith?: string;
1030
+ };
1031
+ status?: {
1032
+ equal?: BetRecordStatus;
1033
+ notEqual?: BetRecordStatus;
1034
+ in?: BetRecordStatus[];
1035
+ notIn?: BetRecordStatus[];
1036
+ };
1037
+ };
1038
+ startDateTime?: {
1039
+ equal?: Date | string;
1040
+ notEqual?: Date | string;
1041
+ in?: Date | string[];
1042
+ notIn?: Date | string[];
1043
+ lesserThan?: Date | string;
1044
+ lesserThanOrEqual?: Date | string;
1045
+ greaterThan?: Date | string;
1046
+ greaterThanOrEqual?: Date | string;
1047
+ };
1048
+ endDateTime?: {
1049
+ equal?: Date | string;
1050
+ notEqual?: Date | string;
1051
+ in?: Date | string[];
1052
+ notIn?: Date | string[];
1053
+ lesserThan?: Date | string;
1054
+ lesserThanOrEqual?: Date | string;
1055
+ greaterThan?: Date | string;
1056
+ greaterThanOrEqual?: Date | string;
1057
+ };
1058
+ }
1059
+
1060
+ interface BetRecord {
1061
+ id: string;
1062
+ game: Game;
1063
+ status: BetRecordStatus;
1064
+ serialCode: string;
1065
+ vendorRoundId?: string;
1066
+ bet: number;
1067
+ payout: number;
1068
+ validBet: number;
1069
+ jackpotContribution: number;
1070
+ jackpotPayout: number;
1071
+ winloss?: number;
1072
+ betContent?: string;
1073
+ contestName?: string;
1074
+ externalCategory?: string;
1075
+ dateTimeSettled?: Date;
1076
+ dateTimeCreated: Date;
1077
+ dateTimeLastUpdated: Date;
1078
+ metadata: {
1079
+ odds?: string;
1080
+ validBet?: number;
1081
+ };
1082
+ }
1083
+
1084
+ type BetRecordsReturn =
1085
+ | {
1086
+ ok: true;
1087
+ data: {
1088
+ betRecords: (BetRecord & { cursor: string })[];
1089
+ totalCount: number;
1090
+ hasNextPage: boolean;
1091
+ endCursor?: string;
1092
+ };
1093
+ }
1094
+ | {
1095
+ ok: false;
1096
+ error: HttpError;
1097
+ };
1098
+ ```
1099
+
1100
+ - `transactionRecords` - Retrieve current user's transaction records
1101
+
1102
+ ```ts
1103
+ transactionRecords(input?: TransactionRecordsInput): Promise<TransactionRecordsReturn>
1104
+ ```
1105
+
1106
+ ```ts
1107
+ type TransactionRecordType =
1108
+ | 'DEPOSIT'
1109
+ | 'PAYOUT'
1110
+ | 'WITHDRAWAL_REFUND'
1111
+ | 'TRANSFER_IN'
1112
+ | 'WITHDRAWAL'
1113
+ | 'BET'
1114
+ | 'TRANSFER_OUT'
1115
+ | 'ROLLBACK'
1116
+ | 'BET_REFUND'
1117
+ | 'PAYOUT_REFUND'
1118
+ | 'CASHBACK_BONUS'
1119
+ | 'BONUS'
1120
+ | 'RESERVE'
1121
+ | 'REJECT_WITHDRAWAL'
1122
+ | 'MANUAL_DEPOSIT'
1123
+ | 'GCASH_DEPOSIT'
1124
+ | 'MANUAL_WITHDRAWAL'
1125
+ | 'BANK_WITHDRAWAL'
1126
+ | 'GCASH_WITHDRAWAL'
1127
+ | 'COMMIT_RESERVE'
1128
+ | 'ROLLBACK_PAYOUT'
1129
+ | 'ROLLBACK_RESERVE';
1130
+
1131
+ interface TransactionRecordsInput {
1132
+ first?: number;
1133
+ after?: string;
1134
+ filter?: {
1135
+ type?: {
1136
+ equal?: TransactionRecordType;
1137
+ notEqual?: TransactionRecordType;
1138
+ in?: TransactionRecordType[];
1139
+ notIn?: TransactionRecordType[];
1140
+ };
1141
+ referenceNumber?: {
1142
+ equal?: string;
1143
+ notEqual?: string;
1144
+ in?: string[];
1145
+ notIn?: string[];
1146
+ contains?: string;
1147
+ startsWith?: string;
1148
+ };
1149
+ dateTimeCreated?: {
1150
+ equal?: Date | string;
1151
+ notEqual?: Date | string;
1152
+ in?: Date | string[];
1153
+ notIn?: Date | string[];
1154
+ lesserThan?: Date | string;
1155
+ lesserThanOrEqual?: Date | string;
1156
+ greaterThan?: Date | string;
1157
+ greaterThanOrEqual?: Date | string;
1158
+ };
1159
+ };
1160
+ }
1161
+
1162
+ interface TransactionRecord {
1163
+ id: string;
1164
+ type: TransactionRecordType;
1165
+ amount: number;
1166
+ content?: string;
1167
+ currentBalance: number;
1168
+ referenceNumber: string;
1169
+ dateTimeCreated: Date;
1170
+ dateTimeLastUpdated: Date;
1171
+ }
1172
+
1173
+ type TransactionRecordsReturn =
1174
+ | {
1175
+ ok: true;
1176
+ data: {
1177
+ transactionRecords: (TransactionRecord & { cursor: string })[];
1178
+ totalCount: number;
1179
+ hasNextPage: boolean;
1180
+ endCursor?: string;
1181
+ };
1182
+ }
1183
+ | {
1184
+ ok: false;
1185
+ error: HttpError;
1186
+ };
1187
+ ```
1188
+
1189
+ - `promos` - Retrieve promos for current platform
1190
+
1191
+ ```ts
1192
+ promos(): Promise<PromosReturn>
1193
+ ```
1194
+
1195
+ ```ts
1196
+ interface Promo {
1197
+ id: string;
1198
+ type: 'DEPOSIT';
1199
+ name: string;
1200
+ banner: {
1201
+ id: string;
1202
+ url: string;
1203
+ status: 'READY';
1204
+ dateTimeCreated: Date;
1205
+ };
1206
+ status: 'ACTIVE' | 'INACTIVE' | 'DISABLED' | 'EXPIRED';
1207
+ description: string;
1208
+ minimumBonusAmount?: number;
1209
+ maximumBonusAmount?: number;
1210
+ minimumDepositAmount?: number;
1211
+ turnoverRequirementContributionPercentagePerGameProvider?: JSON;
1212
+ maximumDepositAmount?: number;
1213
+ activationStartDateTime: Date;
1214
+ activationEndDateTime: Date;
1215
+ dateTimeCreated: Date;
1216
+ dateTimeLastUpdated: Date;
1217
+ }
1218
+
1219
+ type PromosReturn =
1220
+ | {
1221
+ ok: true;
1222
+ data: Promo[];
1223
+ }
1224
+ | {
1225
+ ok: false;
1226
+ error: HttpError;
1227
+ };
1228
+ ```
1229
+
1230
+ - `availablePromos` - Retrieve available promos for current user
1231
+
1232
+ ```ts
1233
+ availablePromos(): Promise<PromosReturn>
1234
+ ```
1235
+
1236
+ - `bonus` - Retrieve current user's bonus details
1237
+
1238
+ ```ts
1239
+ bonus(): Promise<BonusReturn>
1240
+ ```
1241
+
1242
+ ```ts
1243
+ interface Bonus {
1244
+ id: string;
1245
+ promo: Promo;
1246
+ deposit?: {
1247
+ type: DepositRecordType;
1248
+ status: DepositRecordStatus;
1249
+ amount: number;
1250
+ netAmount: number;
1251
+ fee: number;
1252
+ reference?: string;
1253
+ dateTimeCreated: Date;
1254
+ dateTimeLastUpdated: Date;
1255
+ };
1256
+ amount: number;
1257
+ balance: number;
1258
+ turnoverRequirement: number;
1259
+ currentTurnoverRequirementContribution: number;
1260
+ currentTurnoverRequirementContributionPercentage: number;
1261
+ expiration: Date;
1262
+ dateTimeCreated: Date;
1263
+ dateTimeLastUpdated: Date;
1264
+ }
1265
+
1266
+ type BonusReturn =
1267
+ | {
1268
+ ok: true;
1269
+ data: Bonus | null;
1270
+ }
1271
+ | {
1272
+ ok: false;
1273
+ error: HttpError;
1274
+ };
1275
+ ```
1276
+
1277
+ - `cashbacks` - Retrieve cashbacks for current platform
1278
+
1279
+ ```ts
1280
+ cashbacks(): Promise<CashbackReturn>
1281
+ ```
1282
+
1283
+ ```ts
1284
+ interface Cashback {
1285
+ id: string;
1286
+ name: string;
1287
+ banner: {
1288
+ id: string;
1289
+ url: string;
1290
+ status: 'READY';
1291
+ dateTimeCreated: Date;
1292
+ };
1293
+ status: CashbackStatus;
1294
+ description: string;
1295
+ activationStartDateTime: Date;
1296
+ activationEndDateTime: Date;
1297
+ dateTimeCreated: Date;
1298
+ dateTimeLastUpdated: Date;
1299
+ }
1300
+
1301
+ type CashbackReturn =
1302
+ | {
1303
+ ok: true;
1304
+ data: Cashback[];
1305
+ }
1306
+ | {
1307
+ ok: false;
1308
+ error: HttpError;
1309
+ };
1310
+ ```
1311
+
1312
+ - `cashbackBonuses` - Retrieve current user's cashback bonuses
1313
+
1314
+ ```ts
1315
+ cashbackBonuses(): Promise<CashbackBonusesReturn>
1316
+ ```
1317
+
1318
+ ```ts
1319
+ interface CashbackBonus {
1320
+ id: string;
1321
+ balance: number;
1322
+ cashback: Cashback;
1323
+ dateTimeCreated: Date;
1324
+ dateTimeLastUpdated: Date;
1325
+ }
1326
+
1327
+ type CashbackBonusesReturn =
1328
+ | {
1329
+ ok: true;
1330
+ data: CashbackBonus[];
1331
+ }
1332
+ | {
1333
+ ok: false;
1334
+ error: HttpError;
1335
+ };
1336
+ ```
1337
+
1338
+ - `claimCashbackBonus` - Claim cashback bonus
1339
+
1340
+ ```ts
1341
+ claimCashbackBonus(id: string): Promise<ClaimCashbackBonusReturn>
1342
+ ```
1343
+
1344
+ ```ts
1345
+ type ClaimCashbackBonusReturn =
1346
+ | {
1347
+ ok: true;
1348
+ }
1349
+ | {
1350
+ ok: false;
1351
+ error:
1352
+ | HttpError
1353
+ | {
1354
+ name: 'CashbackBonusDoesNotExistError';
1355
+ message: string;
1356
+ };
1357
+ };
1358
+ ```
1359
+
1360
+ - `games` - Retrieve games
1361
+
1362
+ ```ts
1363
+ games(input?: GamesInput): Promise<GamesReturn>
1364
+ ```
1365
+
1366
+ ```ts
1367
+ type GameType = 'SLOTS' | 'SPORTS' | 'BINGO' | 'FISHING' | 'LIVE' | 'GAMES';
1368
+ type GameProvider =
1369
+ | 'JILI'
1370
+ | 'PGSOFT'
1371
+ | 'FACHAI'
1372
+ | 'PLAYTECH'
1373
+ | 'CQ9'
1374
+ | 'JDB'
1375
+ | 'BOOONGO'
1376
+ | 'HABANERO'
1377
+ | 'DIGITAIN'
1378
+ | 'RELAXGAMING'
1379
+ | 'DG'
1380
+ | 'E2E'
1381
+ | 'BTI'
1382
+ | 'DARWIN'
1383
+ | 'MEGABALL'
1384
+ | 'DRBINGO'
1385
+ | 'RTG';
1386
+
1387
+ interface GamesInput {
1388
+ after?: string;
1389
+ first?: number;
1390
+ filter?: {
1391
+ id?: {
1392
+ equal?: string;
1393
+ notEqual?: string;
1394
+ in?: string[];
1395
+ notIn?: string[];
1396
+ };
1397
+ name?: {
1398
+ equal?: string;
1399
+ notEqual?: string;
1400
+ in?: string[];
1401
+ notIn?: string[];
1402
+ contains?: string;
1403
+ startsWith?: string;
1404
+ };
1405
+ type?: {
1406
+ equal?: GameType;
1407
+ notEqual?: GameType;
1408
+ in?: GameType[];
1409
+ notIn?: GameType[];
1410
+ };
1411
+ provider?: {
1412
+ equal?: GameProvider;
1413
+ notEqual?: GameProvider;
1414
+ in?: GameProvider[];
1415
+ notIn?: GameProvider[];
1416
+ };
1417
+ };
1418
+ }
1419
+
1420
+ interface Game {
1421
+ id: string;
1422
+ type: GameType;
1423
+ name: string;
1424
+ image: string;
1425
+ provider: GameProvider;
1426
+ }
1427
+
1428
+ type GamesReturn =
1429
+ | {
1430
+ ok: true;
1431
+ data: {
1432
+ games: (Game & { cursor: string })[];
1433
+ totalCount: number;
1434
+ hasNextPage: boolean;
1435
+ endCursor?: string;
1436
+ };
1437
+ }
1438
+ | {
1439
+ ok: false;
1440
+ error: HttpError;
1441
+ };
1442
+ ```
1443
+
1444
+ - `gameSession` - Retrieve game session details
1445
+
1446
+ ```ts
1447
+ gameSession(id: string): Promise<GameSessionReturn>
1448
+ ```
1449
+
1450
+ ```ts
1451
+ type GameSession =
1452
+ | {
1453
+ id: string;
1454
+ game: Game;
1455
+ status: 'READY';
1456
+ launchUrl: string;
1457
+ dateTimeCreated: Date;
1458
+ dateTimeLastUpdated: Date;
1459
+ }
1460
+ | {
1461
+ id: string;
1462
+ game: Game;
1463
+ status: 'PENDING' | 'STARTING' | 'ENDED' | 'CANCELLED';
1464
+ dateTimeCreated: Date;
1465
+ dateTimeLastUpdated: Date;
1466
+ };
1467
+
1468
+ type GameSessionReturn =
1469
+ | {
1470
+ ok: true;
1471
+ data: GameSession | null;
1472
+ }
1473
+ | {
1474
+ ok: false;
1475
+ error: HttpError;
1476
+ };
1477
+ ```
1478
+
1479
+ - `createGameSession` - Create new game session
1480
+
1481
+ ```ts
1482
+ createGameSession(input:CreateGameSessionInput): Promise<CreateGameSessionReturn>
1483
+ ```
1484
+
1485
+ ```ts
1486
+ interface CreateGameSessionInput {
1487
+ id?: string;
1488
+ game: string;
1489
+ }
1490
+
1491
+ type CreateGameSessionReturn =
1492
+ | {
1493
+ ok: true;
1494
+ data: {
1495
+ id: string;
1496
+ };
1497
+ }
1498
+ | {
1499
+ ok: false;
1500
+ error:
1501
+ | HttpError
1502
+ | {
1503
+ name: 'GameDoesNotExistError';
1504
+ message: string;
1505
+ };
1506
+ };
1507
+ ```
1508
+
1509
+ - `endGameSession` - End game session
1510
+
1511
+ ```ts
1512
+ endGameSession(id: string): Promise<EndGameSessionReturn>
1513
+ ```
1514
+
1515
+ ```ts
1516
+ type EndGameSessionReturn =
1517
+ | {
1518
+ ok: true;
1519
+ }
1520
+ | {
1521
+ ok: false;
1522
+ error: HttpError | UnknownError;
1523
+ };
1524
+ ```
1525
+
1526
+ - `file` - Retrieve file details
1527
+
1528
+ ```ts
1529
+ file(id: string): Promise<FileReturn>
1530
+ ```
1531
+
1532
+ ```ts
1533
+ type File =
1534
+ | {
1535
+ id: string;
1536
+ url?: never;
1537
+ status: 'UPLOADING' | 'FAILED';
1538
+ dateTimeCreated: Date;
1539
+ }
1540
+ | {
1541
+ id: string;
1542
+ url: string;
1543
+ status: 'READY';
1544
+ dateTimeCreated: Date;
1545
+ }
1546
+ | {
1547
+ id: string;
1548
+ url?: string;
1549
+ status: 'DELETED';
1550
+ dateTimeCreated: Date;
1551
+ };
1552
+
1553
+ type FileReturn =
1554
+ | {
1555
+ ok: true;
1556
+ data: File | null;
1557
+ }
1558
+ | {
1559
+ ok: false;
1560
+ error: HttpError;
1561
+ };
1562
+ ```
1563
+
1564
+ - `uploadImageFile` - Upload image file
1565
+
1566
+ ```ts
1567
+ uploadImageFile(input: globalThis.File): Promise<UploadImageFileReturn>
1568
+ ```
1569
+
1570
+ ```ts
1571
+ type UploadImageFileReturn =
1572
+ | {
1573
+ ok: true;
1574
+ data: {
1575
+ id: string;
1576
+ };
1577
+ }
1578
+ | {
1579
+ ok: false;
1580
+ error:
1581
+ | HttpError
1582
+ | {
1583
+ name: 'FileFormatNotSupportedError' | 'FileNameTooLongError' | 'FileSizeTooBigError';
1584
+ message: string;
1585
+ };
1586
+ };
1587
+ ```
1588
+
1589
+ - `pointsWallet` - Retrieve current user's points wallet details
1590
+
1591
+ ```ts
1592
+ pointsWallet(): Promise<PointsWalletReturn>
1593
+ ```
1594
+
1595
+ ```ts
1596
+ interface PointsWallet {
1597
+ id: string;
1598
+ points: number;
1599
+ account: string;
1600
+ dateTimeCreated: Date;
1601
+ }
1602
+
1603
+ type PointsWalletReturn =
1604
+ | {
1605
+ ok: true;
1606
+ data: PointsWallet | null;
1607
+ }
1608
+ | {
1609
+ ok: false;
1610
+ error: HttpError;
1611
+ };
1612
+ ```
1613
+
1614
+ - `pointsToCashConversion` - Convert points to cash
1615
+
1616
+ ```ts
1617
+ pointsToCashConversion(amount: number): Promise<PointsToCashConversionReturn>
1618
+ ```
1619
+
1620
+ ```ts
1621
+ type PointsToCashConversionReturn =
1622
+ | {
1623
+ ok: true;
1624
+ }
1625
+ | {
1626
+ ok: false;
1627
+ error:
1628
+ | HttpError
1629
+ | {
1630
+ name: 'InsufficientPointsError';
1631
+ message: string;
1632
+ };
1633
+ };
1634
+ ```