@opexa/portal-sdk 0.59.134 → 0.59.136

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