@opexa/portal-sdk 0.34.2 → 0.34.3

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,1624 +1,1624 @@
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 CreateMayaWithdrawalInput {
590
- id?: string;
591
- type: 'MAYA';
592
- amount: number;
593
- transactionPassword: string;
594
- recipientMobileNumber: string;
595
- }
596
-
597
- interface CreateMayaAppWithdrawalInput {
598
- id?: string;
599
- type: 'MAYA_APP';
600
- amount: number;
601
- transactionPassword: string;
602
- }
603
-
604
- type CreateWithdrawalInput =
605
- | CreateBankWithdrawalInput
606
- | CreateGCashWithdrawalInput
607
- | CreateMayaWithdrawalInput
608
- | CreateMayaAppWithdrawalInput;
609
-
610
- type CreateWithdrawalReturn =
611
- | {
612
- ok: true;
613
- data: {
614
- id: string;
615
- };
616
- }
617
- | {
618
- ok: false;
619
- error:
620
- | HttpError
621
- | {
622
- name:
623
- | 'MobileNumberNotVerifiedError'
624
- | 'AccountNotVerifiedError'
625
- | 'InvalidWithdrawalAmountError'
626
- | 'WithdrawalDailyLimitExceededError'
627
- | 'InvalidTransactionPasswordError'
628
- | 'NotEnoughBalanceError';
629
- message: string;
630
- };
631
- };
632
- ```
633
-
634
- - `withdrawalRecords` - Retrieve current user's withdrawal records
635
-
636
- ```ts
637
- withdrawalRecords(input?: WithdrawalRecordsInput): Promise<WithdrawalRecordsReturn>
638
- ```
639
-
640
- ```ts
641
- type WithdrawalRecordType = 'MANUAL' | 'BANK' | 'GCASH' | 'MAYA';
642
- type WithdrawalRecordStatus = 'PENDING' | 'APPROVED' | 'REJECTED' | 'CONFIRMED' | 'CANCELLED';
643
-
644
- interface WithdrawalRecordsInput {
645
- first?: number;
646
- after?: string;
647
- filter?: {
648
- type?: {
649
- equal?: WithdrawalRecordType;
650
- notEqual?: WithdrawalRecordType;
651
- in?: WithdrawalRecordType[];
652
- notIn?: WithdrawalRecordType[];
653
- };
654
- status?: {
655
- equal?: WithdrawalRecordStatus;
656
- notEqual?: WithdrawalRecordStatus;
657
- in?: WithdrawalRecordStatus[];
658
- notIn?: WithdrawalRecordStatus[];
659
- };
660
- reference?: {
661
- equal?: string;
662
- notEqual?: string;
663
- in?: string[];
664
- notIn?: string[];
665
- contains?: string;
666
- startsWith?: string;
667
- };
668
- withdrawalNumber?: {
669
- equal?: string;
670
- notEqual?: string;
671
- in?: string[];
672
- notIn?: string[];
673
- contains?: string;
674
- startsWith?: string;
675
- };
676
- dateTimeCreated?: {
677
- equal?: Date | string;
678
- notEqual?: Date | string;
679
- in?: Date | string[];
680
- notIn?: Date | string[];
681
- lesserThan?: Date | string;
682
- lesserThanOrEqual?: Date | string;
683
- greaterThan?: Date | string;
684
- greaterThanOrEqual?: Date | string;
685
- };
686
- dateTimeLastUpdated?: {
687
- equal?: Date | string;
688
- notEqual?: Date | string;
689
- in?: Date | string[];
690
- notIn?: Date | string[];
691
- lesserThan?: Date | string;
692
- lesserThanOrEqual?: Date | string;
693
- greaterThan?: Date | string;
694
- greaterThanOrEqual?: Date | string;
695
- };
696
- };
697
- }
698
-
699
- interface WithdrawalRecord {
700
- id: string;
701
- type: WithdrawalRecordType;
702
- bank?: 'AUBKPHMM' | 'MBTCPHMM' | 'BNORPHMM' | 'MKRUPHM1';
703
- fee: number;
704
- amount: number;
705
- netAmount: number;
706
- status: WithdrawalRecordStatus;
707
- reference?: string;
708
- withdrawalNumber: string;
709
- recipientMobileNumber?: string;
710
- dateTimeConfirmed?: Date;
711
- dateTimeCreated: Date;
712
- dateTimeLastUpdated: Date;
713
- }
714
-
715
- type WithdrawalRecordsReturn =
716
- | {
717
- ok: true;
718
- data: {
719
- withdrawalRecords: (WithdrawalRecord & { cursor: string })[];
720
- totalCount: number;
721
- hasNextPage: boolean;
722
- endCursor?: string;
723
- };
724
- }
725
- | {
726
- ok: false;
727
- error: HttpError;
728
- };
729
- ```
730
-
731
- - `remainingDailyWithdrawalsCount` - Retrieve current user's remaining daily withdrawals count
732
-
733
- ```ts
734
- remainingDailyWithdrawalsCount(): Promise<RemainingDailyWithdrawalsCountReturn>
735
- ```
736
-
737
- ```ts
738
- type RemainingDailyWithdrawalsCountReturn =
739
- | {
740
- ok: true;
741
- data: number;
742
- }
743
- | {
744
- ok: false;
745
- error: HttpError;
746
- };
747
- ```
748
-
749
- - `createDeposit` - Create new deposit request
750
-
751
- ```ts
752
- createDeposit(input: CreateDepositInput): Promise<CreateDepositReturn>
753
- ```
754
-
755
- ```ts
756
- interface CreateMayaDepositInput {
757
- id?: string;
758
- type: 'MAYA';
759
- amount: number;
760
- promo?: string;
761
- }
762
-
763
- interface CreateGCashDepositInput {
764
- id?: string;
765
- type: 'GCASH';
766
- amount: number;
767
- promo?: string;
768
- }
769
-
770
- interface CreateMayaAppDepositInput {
771
- id?: string;
772
- type: 'MAYA_APP';
773
- amount: number;
774
- promo?: string;
775
- }
776
-
777
- type CreateDepositInput =
778
- | CreateMayaDepositInput
779
- | CreateGCashDepositInput
780
- | CreateMayaAppDepositInput;
781
-
782
- type CreateDepositReturn =
783
- | {
784
- ok: true;
785
- data: {
786
- id: string;
787
- };
788
- }
789
- | {
790
- ok: false;
791
- error:
792
- | HttpError
793
- | {
794
- name:
795
- | 'DepositPromoMaximumAmountExceededError'
796
- | 'DepositPromoMinimumAmountNotMetError'
797
- | 'MaximumDepositAmountExceededError'
798
- | 'MinimumDepositAmountNotMetError'
799
- | 'MinimumFirstDepositAmountNotMetError'
800
- | 'PromoNotEnabledError'
801
- | 'WalletDoesNotExistError';
802
- message: string;
803
- };
804
- };
805
- ```
806
-
807
- - `deposit` - Retrieve deposit details
808
-
809
- ```ts
810
- deposit(id: string): Promise<DepositReturn>
811
- ```
812
-
813
- ```ts
814
- interface Deposit {
815
- id: string;
816
- type: 'BANK' | 'GCASH' | 'MANUAL' | 'MAYA' | 'MAYA_APP';
817
- status: 'PENDING' | 'ACCEPTED' | 'APPROVED' | 'REJECTED' | 'CONFIRMED' | 'CANCELLED';
818
- amount: number;
819
- netAmount: number;
820
- fee: number;
821
- reference?: string;
822
- checkoutUrl?: string;
823
- dateTimeCreated: Date;
824
- dateTimeLastUpdated: Date;
825
- }
826
-
827
- type DepositReturn =
828
- | {
829
- ok: true;
830
- data: Deposit | null;
831
- }
832
- | {
833
- ok: false;
834
- error: HttpError;
835
- };
836
- ```
837
-
838
- - `depositRecords` - Retrieve current user's deposit records
839
-
840
- ```ts
841
- depositRecords(input?: DepositRecordsInput): Promise<DepositRecordsReturn>
842
- ```
843
-
844
- ```ts
845
- type DepositRecordType = 'BANK' | 'GCASH' | 'MANUAL' | 'MAYA' | 'MAYA_APP';
846
- type DepositRecordStatus =
847
- | 'PENDING'
848
- | 'ACCEPTED'
849
- | 'APPROVED'
850
- | 'REJECTED'
851
- | 'CONFIRMED'
852
- | 'CANCELLED';
853
-
854
- interface DepositRecordsInput {
855
- first?: number;
856
- after?: string;
857
- filter?: {
858
- type?: {
859
- equal?: DepositRecordType;
860
- notEqual?: DepositRecordType;
861
- in?: DepositRecordType[];
862
- notIn?: DepositRecordType[];
863
- };
864
- status?: {
865
- equal?: DepositRecordStatus;
866
- notEqual?: DepositRecordStatus;
867
- in?: DepositRecordStatus[];
868
- notIn?: DepositRecordStatus[];
869
- };
870
- reference?: {
871
- equal?: string;
872
- notEqual?: string;
873
- in?: string[];
874
- notIn?: string[];
875
- contains?: string;
876
- startsWith?: string;
877
- };
878
- depositNumber?: {
879
- equal?: string;
880
- notEqual?: string;
881
- in?: string[];
882
- notIn?: string[];
883
- contains?: string;
884
- startsWith?: string;
885
- };
886
- dateTimeCreated?: {
887
- equal?: Date | string;
888
- notEqual?: Date | string;
889
- in?: Date | string[];
890
- notIn?: Date | string[];
891
- lesserThan?: Date | string;
892
- lesserThanOrEqual?: Date | string;
893
- greaterThan?: Date | string;
894
- greaterThanOrEqual?: Date | string;
895
- };
896
- dateTimeLastUpdated?: {
897
- equal?: Date | string;
898
- notEqual?: Date | string;
899
- in?: Date | string[];
900
- notIn?: Date | string[];
901
- lesserThan?: Date | string;
902
- lesserThanOrEqual?: Date | string;
903
- greaterThan?: Date | string;
904
- greaterThanOrEqual?: Date | string;
905
- };
906
- };
907
- }
908
-
909
- interface DepositRecord {
910
- id: string;
911
- type: DepositRecordType;
912
- status: DepositRecordStatus;
913
- amount: number;
914
- netAmount: number;
915
- fee: number;
916
- reference?: string;
917
- depositNumber: string;
918
- dateTimeCreated: Date;
919
- dateTimeLastUpdated: Date;
920
- }
921
-
922
- type DepositRecordsReturn =
923
- | {
924
- ok: true;
925
- data: {
926
- depositRecords: (DepositRecord & { cursor: string })[];
927
- totalCount: number;
928
- hasNextPage: boolean;
929
- endCursor?: string;
930
- };
931
- }
932
- | {
933
- ok: false;
934
- error: HttpError;
935
- };
936
- ```
937
-
938
- - `depositsCount` - Retrieve current user's deposits count
939
-
940
- ```ts
941
- depositsCount(): Promise<DepositsCountReturn>
942
- ```
943
-
944
- ```ts
945
- type DepositsCountReturn =
946
- | {
947
- ok: true;
948
- data: number;
949
- }
950
- | {
951
- ok: false;
952
- error: HttpError;
953
- };
954
- ```
955
-
956
- - `betRecords` - Retrieve current user's bet records
957
-
958
- ```ts
959
- betRecords(input?: BetRecordsInput): Promise<BetRecordsReturn>
960
- ```
961
-
962
- ```ts
963
- type BetRecordStatus = 'STARTED' | 'SETTLED' | 'CANCELLED';
964
-
965
- interface BetRecordsInput {
966
- first?: number;
967
- after?: string;
968
- sort?: SortOrder;
969
- filter?: {
970
- serialCode?: {
971
- equal?: string;
972
- notEqual?: string;
973
- in?: string[];
974
- notIn?: string[];
975
- contains?: string;
976
- startsWith?: string;
977
- };
978
- game?: {
979
- equal?: string;
980
- notEqual?: string;
981
- in?: string[];
982
- notIn?: string[];
983
- };
984
- game__externalId?: {
985
- equal?: string;
986
- notEqual?: string;
987
- in?: string[];
988
- notIn?: string[];
989
- contains?: string;
990
- startsWith?: string;
991
- };
992
- game__type?: {
993
- equal?: GameType;
994
- notEqual?: GameType;
995
- in?: GameType[];
996
- notIn?: GameType[];
997
- };
998
- game__provider?: {
999
- equal?: GameProvider;
1000
- notEqual?: GameProvider;
1001
- in?: GameProvider[];
1002
- notIn?: GameProvider[];
1003
- };
1004
- dateTimeCreated?: {
1005
- equal?: Date | string;
1006
- notEqual?: Date | string;
1007
- in?: Date | string[];
1008
- notIn?: Date | string[];
1009
- lesserThan?: Date | string;
1010
- lesserThanOrEqual?: Date | string;
1011
- greaterThan?: Date | string;
1012
- greaterThanOrEqual?: Date | string;
1013
- };
1014
- vendorRoundId?: {
1015
- equal?: string;
1016
- notEqual?: string;
1017
- in?: string[];
1018
- notIn?: string[];
1019
- contains?: string;
1020
- startsWith?: string;
1021
- };
1022
- status?: {
1023
- equal?: BetRecordStatus;
1024
- notEqual?: BetRecordStatus;
1025
- in?: BetRecordStatus[];
1026
- notIn?: BetRecordStatus[];
1027
- };
1028
- };
1029
- startDateTime?: {
1030
- equal?: Date | string;
1031
- notEqual?: Date | string;
1032
- in?: Date | string[];
1033
- notIn?: Date | string[];
1034
- lesserThan?: Date | string;
1035
- lesserThanOrEqual?: Date | string;
1036
- greaterThan?: Date | string;
1037
- greaterThanOrEqual?: Date | string;
1038
- };
1039
- endDateTime?: {
1040
- equal?: Date | string;
1041
- notEqual?: Date | string;
1042
- in?: Date | string[];
1043
- notIn?: Date | string[];
1044
- lesserThan?: Date | string;
1045
- lesserThanOrEqual?: Date | string;
1046
- greaterThan?: Date | string;
1047
- greaterThanOrEqual?: Date | string;
1048
- };
1049
- }
1050
-
1051
- interface BetRecord {
1052
- id: string;
1053
- game: Game;
1054
- status: BetRecordStatus;
1055
- serialCode: string;
1056
- vendorRoundId?: string;
1057
- bet: number;
1058
- payout: number;
1059
- validBet: number;
1060
- jackpotContribution: number;
1061
- jackpotPayout: number;
1062
- winloss?: number;
1063
- betContent?: string;
1064
- contestName?: string;
1065
- externalCategory?: string;
1066
- dateTimeSettled?: Date;
1067
- dateTimeCreated: Date;
1068
- dateTimeLastUpdated: Date;
1069
- metadata: {
1070
- odds?: string;
1071
- validBet?: number;
1072
- };
1073
- }
1074
-
1075
- type BetRecordsReturn =
1076
- | {
1077
- ok: true;
1078
- data: {
1079
- betRecords: (BetRecord & { cursor: string })[];
1080
- totalCount: number;
1081
- hasNextPage: boolean;
1082
- endCursor?: string;
1083
- };
1084
- }
1085
- | {
1086
- ok: false;
1087
- error: HttpError;
1088
- };
1089
- ```
1090
-
1091
- - `transactionRecords` - Retrieve current user's transaction records
1092
-
1093
- ```ts
1094
- transactionRecords(input?: TransactionRecordsInput): Promise<TransactionRecordsReturn>
1095
- ```
1096
-
1097
- ```ts
1098
- type TransactionRecordType =
1099
- | 'DEPOSIT'
1100
- | 'PAYOUT'
1101
- | 'WITHDRAWAL_REFUND'
1102
- | 'TRANSFER_IN'
1103
- | 'WITHDRAWAL'
1104
- | 'BET'
1105
- | 'TRANSFER_OUT'
1106
- | 'ROLLBACK'
1107
- | 'BET_REFUND'
1108
- | 'PAYOUT_REFUND'
1109
- | 'CASHBACK_BONUS'
1110
- | 'BONUS'
1111
- | 'RESERVE'
1112
- | 'REJECT_WITHDRAWAL'
1113
- | 'MANUAL_DEPOSIT'
1114
- | 'GCASH_DEPOSIT'
1115
- | 'MANUAL_WITHDRAWAL'
1116
- | 'BANK_WITHDRAWAL'
1117
- | 'GCASH_WITHDRAWAL'
1118
- | 'COMMIT_RESERVE'
1119
- | 'ROLLBACK_PAYOUT'
1120
- | 'ROLLBACK_RESERVE';
1121
-
1122
- interface TransactionRecordsInput {
1123
- first?: number;
1124
- after?: string;
1125
- filter?: {
1126
- type?: {
1127
- equal?: TransactionRecordType;
1128
- notEqual?: TransactionRecordType;
1129
- in?: TransactionRecordType[];
1130
- notIn?: TransactionRecordType[];
1131
- };
1132
- referenceNumber?: {
1133
- equal?: string;
1134
- notEqual?: string;
1135
- in?: string[];
1136
- notIn?: string[];
1137
- contains?: string;
1138
- startsWith?: string;
1139
- };
1140
- dateTimeCreated?: {
1141
- equal?: Date | string;
1142
- notEqual?: Date | string;
1143
- in?: Date | string[];
1144
- notIn?: Date | string[];
1145
- lesserThan?: Date | string;
1146
- lesserThanOrEqual?: Date | string;
1147
- greaterThan?: Date | string;
1148
- greaterThanOrEqual?: Date | string;
1149
- };
1150
- };
1151
- }
1152
-
1153
- interface TransactionRecord {
1154
- id: string;
1155
- type: TransactionRecordType;
1156
- amount: number;
1157
- content?: string;
1158
- currentBalance: number;
1159
- referenceNumber: string;
1160
- dateTimeCreated: Date;
1161
- dateTimeLastUpdated: Date;
1162
- }
1163
-
1164
- type TransactionRecordsReturn =
1165
- | {
1166
- ok: true;
1167
- data: {
1168
- transactionRecords: (TransactionRecord & { cursor: string })[];
1169
- totalCount: number;
1170
- hasNextPage: boolean;
1171
- endCursor?: string;
1172
- };
1173
- }
1174
- | {
1175
- ok: false;
1176
- error: HttpError;
1177
- };
1178
- ```
1179
-
1180
- - `promos` - Retrieve promos for current platform
1181
-
1182
- ```ts
1183
- promos(): Promise<PromosReturn>
1184
- ```
1185
-
1186
- ```ts
1187
- interface Promo {
1188
- id: string;
1189
- type: 'DEPOSIT';
1190
- name: string;
1191
- banner: {
1192
- id: string;
1193
- url: string;
1194
- status: 'READY';
1195
- dateTimeCreated: Date;
1196
- };
1197
- status: 'ACTIVE' | 'INACTIVE' | 'DISABLED' | 'EXPIRED';
1198
- description: string;
1199
- minimumBonusAmount?: number;
1200
- maximumBonusAmount?: number;
1201
- minimumDepositAmount?: number;
1202
- turnoverRequirementContributionPercentagePerGameProvider?: JSON;
1203
- maximumDepositAmount?: number;
1204
- activationStartDateTime: Date;
1205
- activationEndDateTime: Date;
1206
- dateTimeCreated: Date;
1207
- dateTimeLastUpdated: Date;
1208
- }
1209
-
1210
- type PromosReturn =
1211
- | {
1212
- ok: true;
1213
- data: Promo[];
1214
- }
1215
- | {
1216
- ok: false;
1217
- error: HttpError;
1218
- };
1219
- ```
1220
-
1221
- - `availablePromos` - Retrieve available promos for current user
1222
-
1223
- ```ts
1224
- availablePromos(): Promise<PromosReturn>
1225
- ```
1226
-
1227
- - `bonus` - Retrieve current user's bonus details
1228
-
1229
- ```ts
1230
- bonus(): Promise<BonusReturn>
1231
- ```
1232
-
1233
- ```ts
1234
- interface Bonus {
1235
- id: string;
1236
- promo: Promo;
1237
- deposit?: {
1238
- type: DepositRecordType;
1239
- status: DepositRecordStatus;
1240
- amount: number;
1241
- netAmount: number;
1242
- fee: number;
1243
- reference?: string;
1244
- dateTimeCreated: Date;
1245
- dateTimeLastUpdated: Date;
1246
- };
1247
- amount: number;
1248
- balance: number;
1249
- turnoverRequirement: number;
1250
- currentTurnoverRequirementContribution: number;
1251
- currentTurnoverRequirementContributionPercentage: number;
1252
- expiration: Date;
1253
- dateTimeCreated: Date;
1254
- dateTimeLastUpdated: Date;
1255
- }
1256
-
1257
- type BonusReturn =
1258
- | {
1259
- ok: true;
1260
- data: Bonus | null;
1261
- }
1262
- | {
1263
- ok: false;
1264
- error: HttpError;
1265
- };
1266
- ```
1267
-
1268
- - `cashbacks` - Retrieve cashbacks for current platform
1269
-
1270
- ```ts
1271
- cashbacks(): Promise<CashbackReturn>
1272
- ```
1273
-
1274
- ```ts
1275
- interface Cashback {
1276
- id: string;
1277
- name: string;
1278
- banner: {
1279
- id: string;
1280
- url: string;
1281
- status: 'READY';
1282
- dateTimeCreated: Date;
1283
- };
1284
- status: CashbackStatus;
1285
- description: string;
1286
- activationStartDateTime: Date;
1287
- activationEndDateTime: Date;
1288
- dateTimeCreated: Date;
1289
- dateTimeLastUpdated: Date;
1290
- }
1291
-
1292
- type CashbackReturn =
1293
- | {
1294
- ok: true;
1295
- data: Cashback[];
1296
- }
1297
- | {
1298
- ok: false;
1299
- error: HttpError;
1300
- };
1301
- ```
1302
-
1303
- - `cashbackBonuses` - Retrieve current user's cashback bonuses
1304
-
1305
- ```ts
1306
- cashbackBonuses(): Promise<CashbackBonusesReturn>
1307
- ```
1308
-
1309
- ```ts
1310
- interface CashbackBonus {
1311
- id: string;
1312
- balance: number;
1313
- cashback: Cashback;
1314
- dateTimeCreated: Date;
1315
- dateTimeLastUpdated: Date;
1316
- }
1317
-
1318
- type CashbackBonusesReturn =
1319
- | {
1320
- ok: true;
1321
- data: CashbackBonus[];
1322
- }
1323
- | {
1324
- ok: false;
1325
- error: HttpError;
1326
- };
1327
- ```
1328
-
1329
- - `claimCashbackBonus` - Claim cashback bonus
1330
-
1331
- ```ts
1332
- claimCashbackBonus(id: string): Promise<ClaimCashbackBonusReturn>
1333
- ```
1334
-
1335
- ```ts
1336
- type ClaimCashbackBonusReturn =
1337
- | {
1338
- ok: true;
1339
- }
1340
- | {
1341
- ok: false;
1342
- error:
1343
- | HttpError
1344
- | {
1345
- name: 'CashbackBonusDoesNotExistError';
1346
- message: string;
1347
- };
1348
- };
1349
- ```
1350
-
1351
- - `games` - Retrieve games
1352
-
1353
- ```ts
1354
- games(input?: GamesInput): Promise<GamesReturn>
1355
- ```
1356
-
1357
- ```ts
1358
- type GameType = 'SLOTS' | 'SPORTS' | 'BINGO' | 'FISHING' | 'LIVE' | 'GAMES';
1359
- type GameProvider =
1360
- | 'JILI'
1361
- | 'PGSOFT'
1362
- | 'FACHAI'
1363
- | 'PLAYTECH'
1364
- | 'CQ9'
1365
- | 'JDB'
1366
- | 'BOOONGO'
1367
- | 'HABANERO'
1368
- | 'RELAXGAMING'
1369
- | 'DG'
1370
- | 'E2E'
1371
- | 'BTI'
1372
- | 'DARWIN'
1373
- | 'MEGABALL'
1374
- | 'DRBINGO'
1375
- | 'RTG';
1376
-
1377
- interface GamesInput {
1378
- after?: string;
1379
- first?: number;
1380
- filter?: {
1381
- id?: {
1382
- equal?: string;
1383
- notEqual?: string;
1384
- in?: string[];
1385
- notIn?: string[];
1386
- };
1387
- name?: {
1388
- equal?: string;
1389
- notEqual?: string;
1390
- in?: string[];
1391
- notIn?: string[];
1392
- contains?: string;
1393
- startsWith?: string;
1394
- };
1395
- type?: {
1396
- equal?: GameType;
1397
- notEqual?: GameType;
1398
- in?: GameType[];
1399
- notIn?: GameType[];
1400
- };
1401
- provider?: {
1402
- equal?: GameProvider;
1403
- notEqual?: GameProvider;
1404
- in?: GameProvider[];
1405
- notIn?: GameProvider[];
1406
- };
1407
- };
1408
- }
1409
-
1410
- interface Game {
1411
- id: string;
1412
- type: GameType;
1413
- name: string;
1414
- image: string;
1415
- provider: GameProvider;
1416
- }
1417
-
1418
- type GamesReturn =
1419
- | {
1420
- ok: true;
1421
- data: {
1422
- games: (Game & { cursor: string })[];
1423
- totalCount: number;
1424
- hasNextPage: boolean;
1425
- endCursor?: string;
1426
- };
1427
- }
1428
- | {
1429
- ok: false;
1430
- error: HttpError;
1431
- };
1432
- ```
1433
-
1434
- - `gameSession` - Retrieve game session details
1435
-
1436
- ```ts
1437
- gameSession(id: string): Promise<GameSessionReturn>
1438
- ```
1439
-
1440
- ```ts
1441
- type GameSession =
1442
- | {
1443
- id: string;
1444
- game: Game;
1445
- status: 'READY';
1446
- launchUrl: string;
1447
- dateTimeCreated: Date;
1448
- dateTimeLastUpdated: Date;
1449
- }
1450
- | {
1451
- id: string;
1452
- game: Game;
1453
- status: 'PENDING' | 'STARTING' | 'ENDED' | 'CANCELLED';
1454
- dateTimeCreated: Date;
1455
- dateTimeLastUpdated: Date;
1456
- };
1457
-
1458
- type GameSessionReturn =
1459
- | {
1460
- ok: true;
1461
- data: GameSession | null;
1462
- }
1463
- | {
1464
- ok: false;
1465
- error: HttpError;
1466
- };
1467
- ```
1468
-
1469
- - `createGameSession` - Create new game session
1470
-
1471
- ```ts
1472
- createGameSession(input:CreateGameSessionInput): Promise<CreateGameSessionReturn>
1473
- ```
1474
-
1475
- ```ts
1476
- interface CreateGameSessionInput {
1477
- id?: string;
1478
- game: string;
1479
- }
1480
-
1481
- type CreateGameSessionReturn =
1482
- | {
1483
- ok: true;
1484
- data: {
1485
- id: string;
1486
- };
1487
- }
1488
- | {
1489
- ok: false;
1490
- error:
1491
- | HttpError
1492
- | {
1493
- name: 'GameDoesNotExistError';
1494
- message: string;
1495
- };
1496
- };
1497
- ```
1498
-
1499
- - `endGameSession` - End game session
1500
-
1501
- ```ts
1502
- endGameSession(id: string): Promise<EndGameSessionReturn>
1503
- ```
1504
-
1505
- ```ts
1506
- type EndGameSessionReturn =
1507
- | {
1508
- ok: true;
1509
- }
1510
- | {
1511
- ok: false;
1512
- error: HttpError | UnknownError;
1513
- };
1514
- ```
1515
-
1516
- - `file` - Retrieve file details
1517
-
1518
- ```ts
1519
- file(id: string): Promise<FileReturn>
1520
- ```
1521
-
1522
- ```ts
1523
- type File =
1524
- | {
1525
- id: string;
1526
- url?: never;
1527
- status: 'UPLOADING' | 'FAILED';
1528
- dateTimeCreated: Date;
1529
- }
1530
- | {
1531
- id: string;
1532
- url: string;
1533
- status: 'READY';
1534
- dateTimeCreated: Date;
1535
- }
1536
- | {
1537
- id: string;
1538
- url?: string;
1539
- status: 'DELETED';
1540
- dateTimeCreated: Date;
1541
- };
1542
-
1543
- type FileReturn =
1544
- | {
1545
- ok: true;
1546
- data: File | null;
1547
- }
1548
- | {
1549
- ok: false;
1550
- error: HttpError;
1551
- };
1552
- ```
1553
-
1554
- - `uploadImageFile` - Upload image file
1555
-
1556
- ```ts
1557
- uploadImageFile(input: globalThis.File): Promise<UploadImageFileReturn>
1558
- ```
1559
-
1560
- ```ts
1561
- type UploadImageFileReturn =
1562
- | {
1563
- ok: true;
1564
- data: {
1565
- id: string;
1566
- };
1567
- }
1568
- | {
1569
- ok: false;
1570
- error:
1571
- | HttpError
1572
- | {
1573
- name: 'FileFormatNotSupportedError' | 'FileNameTooLongError' | 'FileSizeTooBigError';
1574
- message: string;
1575
- };
1576
- };
1577
- ```
1578
-
1579
- - `pointsWallet` - Retrieve current user's points wallet details
1580
-
1581
- ```ts
1582
- pointsWallet(): Promise<PointsWalletReturn>
1583
- ```
1584
-
1585
- ```ts
1586
- interface PointsWallet {
1587
- id: string;
1588
- points: number;
1589
- account: string;
1590
- dateTimeCreated: Date;
1591
- }
1592
-
1593
- type PointsWalletReturn =
1594
- | {
1595
- ok: true;
1596
- data: PointsWallet | null;
1597
- }
1598
- | {
1599
- ok: false;
1600
- error: HttpError;
1601
- };
1602
- ```
1603
-
1604
- - `pointsToCashConversion` - Convert points to cash
1605
-
1606
- ```ts
1607
- pointsToCashConversion(amount: number): Promise<PointsToCashConversionReturn>
1608
- ```
1609
-
1610
- ```ts
1611
- type PointsToCashConversionReturn =
1612
- | {
1613
- ok: true;
1614
- }
1615
- | {
1616
- ok: false;
1617
- error:
1618
- | HttpError
1619
- | {
1620
- name: 'InsufficientPointsError';
1621
- message: string;
1622
- };
1623
- };
1624
- ```
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 CreateMayaWithdrawalInput {
590
+ id?: string;
591
+ type: 'MAYA';
592
+ amount: number;
593
+ transactionPassword: string;
594
+ recipientMobileNumber: string;
595
+ }
596
+
597
+ interface CreateMayaAppWithdrawalInput {
598
+ id?: string;
599
+ type: 'MAYA_APP';
600
+ amount: number;
601
+ transactionPassword: string;
602
+ }
603
+
604
+ type CreateWithdrawalInput =
605
+ | CreateBankWithdrawalInput
606
+ | CreateGCashWithdrawalInput
607
+ | CreateMayaWithdrawalInput
608
+ | CreateMayaAppWithdrawalInput;
609
+
610
+ type CreateWithdrawalReturn =
611
+ | {
612
+ ok: true;
613
+ data: {
614
+ id: string;
615
+ };
616
+ }
617
+ | {
618
+ ok: false;
619
+ error:
620
+ | HttpError
621
+ | {
622
+ name:
623
+ | 'MobileNumberNotVerifiedError'
624
+ | 'AccountNotVerifiedError'
625
+ | 'InvalidWithdrawalAmountError'
626
+ | 'WithdrawalDailyLimitExceededError'
627
+ | 'InvalidTransactionPasswordError'
628
+ | 'NotEnoughBalanceError';
629
+ message: string;
630
+ };
631
+ };
632
+ ```
633
+
634
+ - `withdrawalRecords` - Retrieve current user's withdrawal records
635
+
636
+ ```ts
637
+ withdrawalRecords(input?: WithdrawalRecordsInput): Promise<WithdrawalRecordsReturn>
638
+ ```
639
+
640
+ ```ts
641
+ type WithdrawalRecordType = 'MANUAL' | 'BANK' | 'GCASH' | 'MAYA';
642
+ type WithdrawalRecordStatus = 'PENDING' | 'APPROVED' | 'REJECTED' | 'CONFIRMED' | 'CANCELLED';
643
+
644
+ interface WithdrawalRecordsInput {
645
+ first?: number;
646
+ after?: string;
647
+ filter?: {
648
+ type?: {
649
+ equal?: WithdrawalRecordType;
650
+ notEqual?: WithdrawalRecordType;
651
+ in?: WithdrawalRecordType[];
652
+ notIn?: WithdrawalRecordType[];
653
+ };
654
+ status?: {
655
+ equal?: WithdrawalRecordStatus;
656
+ notEqual?: WithdrawalRecordStatus;
657
+ in?: WithdrawalRecordStatus[];
658
+ notIn?: WithdrawalRecordStatus[];
659
+ };
660
+ reference?: {
661
+ equal?: string;
662
+ notEqual?: string;
663
+ in?: string[];
664
+ notIn?: string[];
665
+ contains?: string;
666
+ startsWith?: string;
667
+ };
668
+ withdrawalNumber?: {
669
+ equal?: string;
670
+ notEqual?: string;
671
+ in?: string[];
672
+ notIn?: string[];
673
+ contains?: string;
674
+ startsWith?: string;
675
+ };
676
+ dateTimeCreated?: {
677
+ equal?: Date | string;
678
+ notEqual?: Date | string;
679
+ in?: Date | string[];
680
+ notIn?: Date | string[];
681
+ lesserThan?: Date | string;
682
+ lesserThanOrEqual?: Date | string;
683
+ greaterThan?: Date | string;
684
+ greaterThanOrEqual?: Date | string;
685
+ };
686
+ dateTimeLastUpdated?: {
687
+ equal?: Date | string;
688
+ notEqual?: Date | string;
689
+ in?: Date | string[];
690
+ notIn?: Date | string[];
691
+ lesserThan?: Date | string;
692
+ lesserThanOrEqual?: Date | string;
693
+ greaterThan?: Date | string;
694
+ greaterThanOrEqual?: Date | string;
695
+ };
696
+ };
697
+ }
698
+
699
+ interface WithdrawalRecord {
700
+ id: string;
701
+ type: WithdrawalRecordType;
702
+ bank?: 'AUBKPHMM' | 'MBTCPHMM' | 'BNORPHMM' | 'MKRUPHM1';
703
+ fee: number;
704
+ amount: number;
705
+ netAmount: number;
706
+ status: WithdrawalRecordStatus;
707
+ reference?: string;
708
+ withdrawalNumber: string;
709
+ recipientMobileNumber?: string;
710
+ dateTimeConfirmed?: Date;
711
+ dateTimeCreated: Date;
712
+ dateTimeLastUpdated: Date;
713
+ }
714
+
715
+ type WithdrawalRecordsReturn =
716
+ | {
717
+ ok: true;
718
+ data: {
719
+ withdrawalRecords: (WithdrawalRecord & { cursor: string })[];
720
+ totalCount: number;
721
+ hasNextPage: boolean;
722
+ endCursor?: string;
723
+ };
724
+ }
725
+ | {
726
+ ok: false;
727
+ error: HttpError;
728
+ };
729
+ ```
730
+
731
+ - `remainingDailyWithdrawalsCount` - Retrieve current user's remaining daily withdrawals count
732
+
733
+ ```ts
734
+ remainingDailyWithdrawalsCount(): Promise<RemainingDailyWithdrawalsCountReturn>
735
+ ```
736
+
737
+ ```ts
738
+ type RemainingDailyWithdrawalsCountReturn =
739
+ | {
740
+ ok: true;
741
+ data: number;
742
+ }
743
+ | {
744
+ ok: false;
745
+ error: HttpError;
746
+ };
747
+ ```
748
+
749
+ - `createDeposit` - Create new deposit request
750
+
751
+ ```ts
752
+ createDeposit(input: CreateDepositInput): Promise<CreateDepositReturn>
753
+ ```
754
+
755
+ ```ts
756
+ interface CreateMayaDepositInput {
757
+ id?: string;
758
+ type: 'MAYA';
759
+ amount: number;
760
+ promo?: string;
761
+ }
762
+
763
+ interface CreateGCashDepositInput {
764
+ id?: string;
765
+ type: 'GCASH';
766
+ amount: number;
767
+ promo?: string;
768
+ }
769
+
770
+ interface CreateMayaAppDepositInput {
771
+ id?: string;
772
+ type: 'MAYA_APP';
773
+ amount: number;
774
+ promo?: string;
775
+ }
776
+
777
+ type CreateDepositInput =
778
+ | CreateMayaDepositInput
779
+ | CreateGCashDepositInput
780
+ | CreateMayaAppDepositInput;
781
+
782
+ type CreateDepositReturn =
783
+ | {
784
+ ok: true;
785
+ data: {
786
+ id: string;
787
+ };
788
+ }
789
+ | {
790
+ ok: false;
791
+ error:
792
+ | HttpError
793
+ | {
794
+ name:
795
+ | 'DepositPromoMaximumAmountExceededError'
796
+ | 'DepositPromoMinimumAmountNotMetError'
797
+ | 'MaximumDepositAmountExceededError'
798
+ | 'MinimumDepositAmountNotMetError'
799
+ | 'MinimumFirstDepositAmountNotMetError'
800
+ | 'PromoNotEnabledError'
801
+ | 'WalletDoesNotExistError';
802
+ message: string;
803
+ };
804
+ };
805
+ ```
806
+
807
+ - `deposit` - Retrieve deposit details
808
+
809
+ ```ts
810
+ deposit(id: string): Promise<DepositReturn>
811
+ ```
812
+
813
+ ```ts
814
+ interface Deposit {
815
+ id: string;
816
+ type: 'BANK' | 'GCASH' | 'MANUAL' | 'MAYA' | 'MAYA_APP';
817
+ status: 'PENDING' | 'ACCEPTED' | 'APPROVED' | 'REJECTED' | 'CONFIRMED' | 'CANCELLED';
818
+ amount: number;
819
+ netAmount: number;
820
+ fee: number;
821
+ reference?: string;
822
+ checkoutUrl?: string;
823
+ dateTimeCreated: Date;
824
+ dateTimeLastUpdated: Date;
825
+ }
826
+
827
+ type DepositReturn =
828
+ | {
829
+ ok: true;
830
+ data: Deposit | null;
831
+ }
832
+ | {
833
+ ok: false;
834
+ error: HttpError;
835
+ };
836
+ ```
837
+
838
+ - `depositRecords` - Retrieve current user's deposit records
839
+
840
+ ```ts
841
+ depositRecords(input?: DepositRecordsInput): Promise<DepositRecordsReturn>
842
+ ```
843
+
844
+ ```ts
845
+ type DepositRecordType = 'BANK' | 'GCASH' | 'MANUAL' | 'MAYA' | 'MAYA_APP';
846
+ type DepositRecordStatus =
847
+ | 'PENDING'
848
+ | 'ACCEPTED'
849
+ | 'APPROVED'
850
+ | 'REJECTED'
851
+ | 'CONFIRMED'
852
+ | 'CANCELLED';
853
+
854
+ interface DepositRecordsInput {
855
+ first?: number;
856
+ after?: string;
857
+ filter?: {
858
+ type?: {
859
+ equal?: DepositRecordType;
860
+ notEqual?: DepositRecordType;
861
+ in?: DepositRecordType[];
862
+ notIn?: DepositRecordType[];
863
+ };
864
+ status?: {
865
+ equal?: DepositRecordStatus;
866
+ notEqual?: DepositRecordStatus;
867
+ in?: DepositRecordStatus[];
868
+ notIn?: DepositRecordStatus[];
869
+ };
870
+ reference?: {
871
+ equal?: string;
872
+ notEqual?: string;
873
+ in?: string[];
874
+ notIn?: string[];
875
+ contains?: string;
876
+ startsWith?: string;
877
+ };
878
+ depositNumber?: {
879
+ equal?: string;
880
+ notEqual?: string;
881
+ in?: string[];
882
+ notIn?: string[];
883
+ contains?: string;
884
+ startsWith?: string;
885
+ };
886
+ dateTimeCreated?: {
887
+ equal?: Date | string;
888
+ notEqual?: Date | string;
889
+ in?: Date | string[];
890
+ notIn?: Date | string[];
891
+ lesserThan?: Date | string;
892
+ lesserThanOrEqual?: Date | string;
893
+ greaterThan?: Date | string;
894
+ greaterThanOrEqual?: Date | string;
895
+ };
896
+ dateTimeLastUpdated?: {
897
+ equal?: Date | string;
898
+ notEqual?: Date | string;
899
+ in?: Date | string[];
900
+ notIn?: Date | string[];
901
+ lesserThan?: Date | string;
902
+ lesserThanOrEqual?: Date | string;
903
+ greaterThan?: Date | string;
904
+ greaterThanOrEqual?: Date | string;
905
+ };
906
+ };
907
+ }
908
+
909
+ interface DepositRecord {
910
+ id: string;
911
+ type: DepositRecordType;
912
+ status: DepositRecordStatus;
913
+ amount: number;
914
+ netAmount: number;
915
+ fee: number;
916
+ reference?: string;
917
+ depositNumber: string;
918
+ dateTimeCreated: Date;
919
+ dateTimeLastUpdated: Date;
920
+ }
921
+
922
+ type DepositRecordsReturn =
923
+ | {
924
+ ok: true;
925
+ data: {
926
+ depositRecords: (DepositRecord & { cursor: string })[];
927
+ totalCount: number;
928
+ hasNextPage: boolean;
929
+ endCursor?: string;
930
+ };
931
+ }
932
+ | {
933
+ ok: false;
934
+ error: HttpError;
935
+ };
936
+ ```
937
+
938
+ - `depositsCount` - Retrieve current user's deposits count
939
+
940
+ ```ts
941
+ depositsCount(): Promise<DepositsCountReturn>
942
+ ```
943
+
944
+ ```ts
945
+ type DepositsCountReturn =
946
+ | {
947
+ ok: true;
948
+ data: number;
949
+ }
950
+ | {
951
+ ok: false;
952
+ error: HttpError;
953
+ };
954
+ ```
955
+
956
+ - `betRecords` - Retrieve current user's bet records
957
+
958
+ ```ts
959
+ betRecords(input?: BetRecordsInput): Promise<BetRecordsReturn>
960
+ ```
961
+
962
+ ```ts
963
+ type BetRecordStatus = 'STARTED' | 'SETTLED' | 'CANCELLED';
964
+
965
+ interface BetRecordsInput {
966
+ first?: number;
967
+ after?: string;
968
+ sort?: SortOrder;
969
+ filter?: {
970
+ serialCode?: {
971
+ equal?: string;
972
+ notEqual?: string;
973
+ in?: string[];
974
+ notIn?: string[];
975
+ contains?: string;
976
+ startsWith?: string;
977
+ };
978
+ game?: {
979
+ equal?: string;
980
+ notEqual?: string;
981
+ in?: string[];
982
+ notIn?: string[];
983
+ };
984
+ game__externalId?: {
985
+ equal?: string;
986
+ notEqual?: string;
987
+ in?: string[];
988
+ notIn?: string[];
989
+ contains?: string;
990
+ startsWith?: string;
991
+ };
992
+ game__type?: {
993
+ equal?: GameType;
994
+ notEqual?: GameType;
995
+ in?: GameType[];
996
+ notIn?: GameType[];
997
+ };
998
+ game__provider?: {
999
+ equal?: GameProvider;
1000
+ notEqual?: GameProvider;
1001
+ in?: GameProvider[];
1002
+ notIn?: GameProvider[];
1003
+ };
1004
+ dateTimeCreated?: {
1005
+ equal?: Date | string;
1006
+ notEqual?: Date | string;
1007
+ in?: Date | string[];
1008
+ notIn?: Date | string[];
1009
+ lesserThan?: Date | string;
1010
+ lesserThanOrEqual?: Date | string;
1011
+ greaterThan?: Date | string;
1012
+ greaterThanOrEqual?: Date | string;
1013
+ };
1014
+ vendorRoundId?: {
1015
+ equal?: string;
1016
+ notEqual?: string;
1017
+ in?: string[];
1018
+ notIn?: string[];
1019
+ contains?: string;
1020
+ startsWith?: string;
1021
+ };
1022
+ status?: {
1023
+ equal?: BetRecordStatus;
1024
+ notEqual?: BetRecordStatus;
1025
+ in?: BetRecordStatus[];
1026
+ notIn?: BetRecordStatus[];
1027
+ };
1028
+ };
1029
+ startDateTime?: {
1030
+ equal?: Date | string;
1031
+ notEqual?: Date | string;
1032
+ in?: Date | string[];
1033
+ notIn?: Date | string[];
1034
+ lesserThan?: Date | string;
1035
+ lesserThanOrEqual?: Date | string;
1036
+ greaterThan?: Date | string;
1037
+ greaterThanOrEqual?: Date | string;
1038
+ };
1039
+ endDateTime?: {
1040
+ equal?: Date | string;
1041
+ notEqual?: Date | string;
1042
+ in?: Date | string[];
1043
+ notIn?: Date | string[];
1044
+ lesserThan?: Date | string;
1045
+ lesserThanOrEqual?: Date | string;
1046
+ greaterThan?: Date | string;
1047
+ greaterThanOrEqual?: Date | string;
1048
+ };
1049
+ }
1050
+
1051
+ interface BetRecord {
1052
+ id: string;
1053
+ game: Game;
1054
+ status: BetRecordStatus;
1055
+ serialCode: string;
1056
+ vendorRoundId?: string;
1057
+ bet: number;
1058
+ payout: number;
1059
+ validBet: number;
1060
+ jackpotContribution: number;
1061
+ jackpotPayout: number;
1062
+ winloss?: number;
1063
+ betContent?: string;
1064
+ contestName?: string;
1065
+ externalCategory?: string;
1066
+ dateTimeSettled?: Date;
1067
+ dateTimeCreated: Date;
1068
+ dateTimeLastUpdated: Date;
1069
+ metadata: {
1070
+ odds?: string;
1071
+ validBet?: number;
1072
+ };
1073
+ }
1074
+
1075
+ type BetRecordsReturn =
1076
+ | {
1077
+ ok: true;
1078
+ data: {
1079
+ betRecords: (BetRecord & { cursor: string })[];
1080
+ totalCount: number;
1081
+ hasNextPage: boolean;
1082
+ endCursor?: string;
1083
+ };
1084
+ }
1085
+ | {
1086
+ ok: false;
1087
+ error: HttpError;
1088
+ };
1089
+ ```
1090
+
1091
+ - `transactionRecords` - Retrieve current user's transaction records
1092
+
1093
+ ```ts
1094
+ transactionRecords(input?: TransactionRecordsInput): Promise<TransactionRecordsReturn>
1095
+ ```
1096
+
1097
+ ```ts
1098
+ type TransactionRecordType =
1099
+ | 'DEPOSIT'
1100
+ | 'PAYOUT'
1101
+ | 'WITHDRAWAL_REFUND'
1102
+ | 'TRANSFER_IN'
1103
+ | 'WITHDRAWAL'
1104
+ | 'BET'
1105
+ | 'TRANSFER_OUT'
1106
+ | 'ROLLBACK'
1107
+ | 'BET_REFUND'
1108
+ | 'PAYOUT_REFUND'
1109
+ | 'CASHBACK_BONUS'
1110
+ | 'BONUS'
1111
+ | 'RESERVE'
1112
+ | 'REJECT_WITHDRAWAL'
1113
+ | 'MANUAL_DEPOSIT'
1114
+ | 'GCASH_DEPOSIT'
1115
+ | 'MANUAL_WITHDRAWAL'
1116
+ | 'BANK_WITHDRAWAL'
1117
+ | 'GCASH_WITHDRAWAL'
1118
+ | 'COMMIT_RESERVE'
1119
+ | 'ROLLBACK_PAYOUT'
1120
+ | 'ROLLBACK_RESERVE';
1121
+
1122
+ interface TransactionRecordsInput {
1123
+ first?: number;
1124
+ after?: string;
1125
+ filter?: {
1126
+ type?: {
1127
+ equal?: TransactionRecordType;
1128
+ notEqual?: TransactionRecordType;
1129
+ in?: TransactionRecordType[];
1130
+ notIn?: TransactionRecordType[];
1131
+ };
1132
+ referenceNumber?: {
1133
+ equal?: string;
1134
+ notEqual?: string;
1135
+ in?: string[];
1136
+ notIn?: string[];
1137
+ contains?: string;
1138
+ startsWith?: string;
1139
+ };
1140
+ dateTimeCreated?: {
1141
+ equal?: Date | string;
1142
+ notEqual?: Date | string;
1143
+ in?: Date | string[];
1144
+ notIn?: Date | string[];
1145
+ lesserThan?: Date | string;
1146
+ lesserThanOrEqual?: Date | string;
1147
+ greaterThan?: Date | string;
1148
+ greaterThanOrEqual?: Date | string;
1149
+ };
1150
+ };
1151
+ }
1152
+
1153
+ interface TransactionRecord {
1154
+ id: string;
1155
+ type: TransactionRecordType;
1156
+ amount: number;
1157
+ content?: string;
1158
+ currentBalance: number;
1159
+ referenceNumber: string;
1160
+ dateTimeCreated: Date;
1161
+ dateTimeLastUpdated: Date;
1162
+ }
1163
+
1164
+ type TransactionRecordsReturn =
1165
+ | {
1166
+ ok: true;
1167
+ data: {
1168
+ transactionRecords: (TransactionRecord & { cursor: string })[];
1169
+ totalCount: number;
1170
+ hasNextPage: boolean;
1171
+ endCursor?: string;
1172
+ };
1173
+ }
1174
+ | {
1175
+ ok: false;
1176
+ error: HttpError;
1177
+ };
1178
+ ```
1179
+
1180
+ - `promos` - Retrieve promos for current platform
1181
+
1182
+ ```ts
1183
+ promos(): Promise<PromosReturn>
1184
+ ```
1185
+
1186
+ ```ts
1187
+ interface Promo {
1188
+ id: string;
1189
+ type: 'DEPOSIT';
1190
+ name: string;
1191
+ banner: {
1192
+ id: string;
1193
+ url: string;
1194
+ status: 'READY';
1195
+ dateTimeCreated: Date;
1196
+ };
1197
+ status: 'ACTIVE' | 'INACTIVE' | 'DISABLED' | 'EXPIRED';
1198
+ description: string;
1199
+ minimumBonusAmount?: number;
1200
+ maximumBonusAmount?: number;
1201
+ minimumDepositAmount?: number;
1202
+ turnoverRequirementContributionPercentagePerGameProvider?: JSON;
1203
+ maximumDepositAmount?: number;
1204
+ activationStartDateTime: Date;
1205
+ activationEndDateTime: Date;
1206
+ dateTimeCreated: Date;
1207
+ dateTimeLastUpdated: Date;
1208
+ }
1209
+
1210
+ type PromosReturn =
1211
+ | {
1212
+ ok: true;
1213
+ data: Promo[];
1214
+ }
1215
+ | {
1216
+ ok: false;
1217
+ error: HttpError;
1218
+ };
1219
+ ```
1220
+
1221
+ - `availablePromos` - Retrieve available promos for current user
1222
+
1223
+ ```ts
1224
+ availablePromos(): Promise<PromosReturn>
1225
+ ```
1226
+
1227
+ - `bonus` - Retrieve current user's bonus details
1228
+
1229
+ ```ts
1230
+ bonus(): Promise<BonusReturn>
1231
+ ```
1232
+
1233
+ ```ts
1234
+ interface Bonus {
1235
+ id: string;
1236
+ promo: Promo;
1237
+ deposit?: {
1238
+ type: DepositRecordType;
1239
+ status: DepositRecordStatus;
1240
+ amount: number;
1241
+ netAmount: number;
1242
+ fee: number;
1243
+ reference?: string;
1244
+ dateTimeCreated: Date;
1245
+ dateTimeLastUpdated: Date;
1246
+ };
1247
+ amount: number;
1248
+ balance: number;
1249
+ turnoverRequirement: number;
1250
+ currentTurnoverRequirementContribution: number;
1251
+ currentTurnoverRequirementContributionPercentage: number;
1252
+ expiration: Date;
1253
+ dateTimeCreated: Date;
1254
+ dateTimeLastUpdated: Date;
1255
+ }
1256
+
1257
+ type BonusReturn =
1258
+ | {
1259
+ ok: true;
1260
+ data: Bonus | null;
1261
+ }
1262
+ | {
1263
+ ok: false;
1264
+ error: HttpError;
1265
+ };
1266
+ ```
1267
+
1268
+ - `cashbacks` - Retrieve cashbacks for current platform
1269
+
1270
+ ```ts
1271
+ cashbacks(): Promise<CashbackReturn>
1272
+ ```
1273
+
1274
+ ```ts
1275
+ interface Cashback {
1276
+ id: string;
1277
+ name: string;
1278
+ banner: {
1279
+ id: string;
1280
+ url: string;
1281
+ status: 'READY';
1282
+ dateTimeCreated: Date;
1283
+ };
1284
+ status: CashbackStatus;
1285
+ description: string;
1286
+ activationStartDateTime: Date;
1287
+ activationEndDateTime: Date;
1288
+ dateTimeCreated: Date;
1289
+ dateTimeLastUpdated: Date;
1290
+ }
1291
+
1292
+ type CashbackReturn =
1293
+ | {
1294
+ ok: true;
1295
+ data: Cashback[];
1296
+ }
1297
+ | {
1298
+ ok: false;
1299
+ error: HttpError;
1300
+ };
1301
+ ```
1302
+
1303
+ - `cashbackBonuses` - Retrieve current user's cashback bonuses
1304
+
1305
+ ```ts
1306
+ cashbackBonuses(): Promise<CashbackBonusesReturn>
1307
+ ```
1308
+
1309
+ ```ts
1310
+ interface CashbackBonus {
1311
+ id: string;
1312
+ balance: number;
1313
+ cashback: Cashback;
1314
+ dateTimeCreated: Date;
1315
+ dateTimeLastUpdated: Date;
1316
+ }
1317
+
1318
+ type CashbackBonusesReturn =
1319
+ | {
1320
+ ok: true;
1321
+ data: CashbackBonus[];
1322
+ }
1323
+ | {
1324
+ ok: false;
1325
+ error: HttpError;
1326
+ };
1327
+ ```
1328
+
1329
+ - `claimCashbackBonus` - Claim cashback bonus
1330
+
1331
+ ```ts
1332
+ claimCashbackBonus(id: string): Promise<ClaimCashbackBonusReturn>
1333
+ ```
1334
+
1335
+ ```ts
1336
+ type ClaimCashbackBonusReturn =
1337
+ | {
1338
+ ok: true;
1339
+ }
1340
+ | {
1341
+ ok: false;
1342
+ error:
1343
+ | HttpError
1344
+ | {
1345
+ name: 'CashbackBonusDoesNotExistError';
1346
+ message: string;
1347
+ };
1348
+ };
1349
+ ```
1350
+
1351
+ - `games` - Retrieve games
1352
+
1353
+ ```ts
1354
+ games(input?: GamesInput): Promise<GamesReturn>
1355
+ ```
1356
+
1357
+ ```ts
1358
+ type GameType = 'SLOTS' | 'SPORTS' | 'BINGO' | 'FISHING' | 'LIVE' | 'GAMES';
1359
+ type GameProvider =
1360
+ | 'JILI'
1361
+ | 'PGSOFT'
1362
+ | 'FACHAI'
1363
+ | 'PLAYTECH'
1364
+ | 'CQ9'
1365
+ | 'JDB'
1366
+ | 'BOOONGO'
1367
+ | 'HABANERO'
1368
+ | 'RELAXGAMING'
1369
+ | 'DG'
1370
+ | 'E2E'
1371
+ | 'BTI'
1372
+ | 'DARWIN'
1373
+ | 'MEGABALL'
1374
+ | 'DRBINGO'
1375
+ | 'RTG';
1376
+
1377
+ interface GamesInput {
1378
+ after?: string;
1379
+ first?: number;
1380
+ filter?: {
1381
+ id?: {
1382
+ equal?: string;
1383
+ notEqual?: string;
1384
+ in?: string[];
1385
+ notIn?: string[];
1386
+ };
1387
+ name?: {
1388
+ equal?: string;
1389
+ notEqual?: string;
1390
+ in?: string[];
1391
+ notIn?: string[];
1392
+ contains?: string;
1393
+ startsWith?: string;
1394
+ };
1395
+ type?: {
1396
+ equal?: GameType;
1397
+ notEqual?: GameType;
1398
+ in?: GameType[];
1399
+ notIn?: GameType[];
1400
+ };
1401
+ provider?: {
1402
+ equal?: GameProvider;
1403
+ notEqual?: GameProvider;
1404
+ in?: GameProvider[];
1405
+ notIn?: GameProvider[];
1406
+ };
1407
+ };
1408
+ }
1409
+
1410
+ interface Game {
1411
+ id: string;
1412
+ type: GameType;
1413
+ name: string;
1414
+ image: string;
1415
+ provider: GameProvider;
1416
+ }
1417
+
1418
+ type GamesReturn =
1419
+ | {
1420
+ ok: true;
1421
+ data: {
1422
+ games: (Game & { cursor: string })[];
1423
+ totalCount: number;
1424
+ hasNextPage: boolean;
1425
+ endCursor?: string;
1426
+ };
1427
+ }
1428
+ | {
1429
+ ok: false;
1430
+ error: HttpError;
1431
+ };
1432
+ ```
1433
+
1434
+ - `gameSession` - Retrieve game session details
1435
+
1436
+ ```ts
1437
+ gameSession(id: string): Promise<GameSessionReturn>
1438
+ ```
1439
+
1440
+ ```ts
1441
+ type GameSession =
1442
+ | {
1443
+ id: string;
1444
+ game: Game;
1445
+ status: 'READY';
1446
+ launchUrl: string;
1447
+ dateTimeCreated: Date;
1448
+ dateTimeLastUpdated: Date;
1449
+ }
1450
+ | {
1451
+ id: string;
1452
+ game: Game;
1453
+ status: 'PENDING' | 'STARTING' | 'ENDED' | 'CANCELLED';
1454
+ dateTimeCreated: Date;
1455
+ dateTimeLastUpdated: Date;
1456
+ };
1457
+
1458
+ type GameSessionReturn =
1459
+ | {
1460
+ ok: true;
1461
+ data: GameSession | null;
1462
+ }
1463
+ | {
1464
+ ok: false;
1465
+ error: HttpError;
1466
+ };
1467
+ ```
1468
+
1469
+ - `createGameSession` - Create new game session
1470
+
1471
+ ```ts
1472
+ createGameSession(input:CreateGameSessionInput): Promise<CreateGameSessionReturn>
1473
+ ```
1474
+
1475
+ ```ts
1476
+ interface CreateGameSessionInput {
1477
+ id?: string;
1478
+ game: string;
1479
+ }
1480
+
1481
+ type CreateGameSessionReturn =
1482
+ | {
1483
+ ok: true;
1484
+ data: {
1485
+ id: string;
1486
+ };
1487
+ }
1488
+ | {
1489
+ ok: false;
1490
+ error:
1491
+ | HttpError
1492
+ | {
1493
+ name: 'GameDoesNotExistError';
1494
+ message: string;
1495
+ };
1496
+ };
1497
+ ```
1498
+
1499
+ - `endGameSession` - End game session
1500
+
1501
+ ```ts
1502
+ endGameSession(id: string): Promise<EndGameSessionReturn>
1503
+ ```
1504
+
1505
+ ```ts
1506
+ type EndGameSessionReturn =
1507
+ | {
1508
+ ok: true;
1509
+ }
1510
+ | {
1511
+ ok: false;
1512
+ error: HttpError | UnknownError;
1513
+ };
1514
+ ```
1515
+
1516
+ - `file` - Retrieve file details
1517
+
1518
+ ```ts
1519
+ file(id: string): Promise<FileReturn>
1520
+ ```
1521
+
1522
+ ```ts
1523
+ type File =
1524
+ | {
1525
+ id: string;
1526
+ url?: never;
1527
+ status: 'UPLOADING' | 'FAILED';
1528
+ dateTimeCreated: Date;
1529
+ }
1530
+ | {
1531
+ id: string;
1532
+ url: string;
1533
+ status: 'READY';
1534
+ dateTimeCreated: Date;
1535
+ }
1536
+ | {
1537
+ id: string;
1538
+ url?: string;
1539
+ status: 'DELETED';
1540
+ dateTimeCreated: Date;
1541
+ };
1542
+
1543
+ type FileReturn =
1544
+ | {
1545
+ ok: true;
1546
+ data: File | null;
1547
+ }
1548
+ | {
1549
+ ok: false;
1550
+ error: HttpError;
1551
+ };
1552
+ ```
1553
+
1554
+ - `uploadImageFile` - Upload image file
1555
+
1556
+ ```ts
1557
+ uploadImageFile(input: globalThis.File): Promise<UploadImageFileReturn>
1558
+ ```
1559
+
1560
+ ```ts
1561
+ type UploadImageFileReturn =
1562
+ | {
1563
+ ok: true;
1564
+ data: {
1565
+ id: string;
1566
+ };
1567
+ }
1568
+ | {
1569
+ ok: false;
1570
+ error:
1571
+ | HttpError
1572
+ | {
1573
+ name: 'FileFormatNotSupportedError' | 'FileNameTooLongError' | 'FileSizeTooBigError';
1574
+ message: string;
1575
+ };
1576
+ };
1577
+ ```
1578
+
1579
+ - `pointsWallet` - Retrieve current user's points wallet details
1580
+
1581
+ ```ts
1582
+ pointsWallet(): Promise<PointsWalletReturn>
1583
+ ```
1584
+
1585
+ ```ts
1586
+ interface PointsWallet {
1587
+ id: string;
1588
+ points: number;
1589
+ account: string;
1590
+ dateTimeCreated: Date;
1591
+ }
1592
+
1593
+ type PointsWalletReturn =
1594
+ | {
1595
+ ok: true;
1596
+ data: PointsWallet | null;
1597
+ }
1598
+ | {
1599
+ ok: false;
1600
+ error: HttpError;
1601
+ };
1602
+ ```
1603
+
1604
+ - `pointsToCashConversion` - Convert points to cash
1605
+
1606
+ ```ts
1607
+ pointsToCashConversion(amount: number): Promise<PointsToCashConversionReturn>
1608
+ ```
1609
+
1610
+ ```ts
1611
+ type PointsToCashConversionReturn =
1612
+ | {
1613
+ ok: true;
1614
+ }
1615
+ | {
1616
+ ok: false;
1617
+ error:
1618
+ | HttpError
1619
+ | {
1620
+ name: 'InsufficientPointsError';
1621
+ message: string;
1622
+ };
1623
+ };
1624
+ ```