monime-package 1.0.9 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,24 +1,18 @@
1
- interface AllCheckout {
2
- success: boolean;
3
- messages: string[];
4
- result: Result$5[];
5
- pagination: Pagination$5;
6
- }
7
- interface Pagination$5 {
8
- count: number;
9
- next: string;
1
+ interface ClientConfig {
2
+ monimeSpaceId: string;
3
+ accessToken: string;
4
+ monimeVersion?: string | undefined;
10
5
  }
11
- interface OneCheckout {
12
- success: boolean;
13
- messages: string[];
14
- result: Result$5;
6
+ interface Pagination {
7
+ count?: number;
8
+ next: string | null;
15
9
  }
16
- interface CreateCheckout {
17
- success: boolean;
18
- messages: string[];
19
- result: Result$5;
10
+
11
+ interface AllCheckout {
12
+ result: CheckoutSession[];
13
+ pagination: Pagination;
20
14
  }
21
- interface Result$5 {
15
+ interface CheckoutSession {
22
16
  id: string;
23
17
  status: string;
24
18
  name: string;
@@ -35,7 +29,7 @@ interface Result$5 {
35
29
  createTime: string;
36
30
  ownershipGraph: OwnershipGraph$4;
37
31
  }
38
- interface Result$5 {
32
+ interface OneCheckout {
39
33
  id: string;
40
34
  status: string;
41
35
  name: string;
@@ -52,7 +46,7 @@ interface Result$5 {
52
46
  createTime: string;
53
47
  ownershipGraph: OwnershipGraph$4;
54
48
  }
55
- interface Result$5 {
49
+ interface CreateCheckout {
56
50
  id: string;
57
51
  status: string;
58
52
  name: string;
@@ -166,7 +160,7 @@ interface Price {
166
160
  value: number;
167
161
  }
168
162
 
169
- declare function CheckoutSessionAPI(client: MonimeClient): {
163
+ declare function CheckoutSessionAPI(config: ClientConfig): {
170
164
  create: (name: string, amount: number, quantity: number, successUrl: string, cancelUrl: string, description?: string, financialAccountId?: string, primaryColor?: string, images?: string[]) => Promise<{
171
165
  success: boolean;
172
166
  error?: Error;
@@ -189,26 +183,6 @@ declare function CheckoutSessionAPI(client: MonimeClient): {
189
183
  };
190
184
 
191
185
  interface CreateFinancialAccount {
192
- success: boolean;
193
- messages: string[];
194
- result: Result$4;
195
- }
196
- interface GetFinancialAccount {
197
- success: boolean;
198
- messages: string[];
199
- result: Result$4;
200
- }
201
- interface AllFinancialAccount {
202
- success: boolean;
203
- messages: string[];
204
- result: Result$4[];
205
- pagination: Pagination$4;
206
- }
207
- interface Pagination$4 {
208
- count: number;
209
- next: string;
210
- }
211
- interface Result$4 {
212
186
  id: string;
213
187
  uvan: string;
214
188
  name: string;
@@ -219,7 +193,7 @@ interface Result$4 {
219
193
  createTime: string;
220
194
  updateTime: string;
221
195
  }
222
- interface Result$4 {
196
+ interface GetFinancialAccount {
223
197
  id: string;
224
198
  uvan: string;
225
199
  name: string;
@@ -230,7 +204,11 @@ interface Result$4 {
230
204
  createTime: string;
231
205
  updateTime: string;
232
206
  }
233
- interface Result$4 {
207
+ interface AllFinancialAccount {
208
+ result: FinancialAccount$1[];
209
+ pagination: Pagination;
210
+ }
211
+ interface FinancialAccount$1 {
234
212
  id: string;
235
213
  uvan: string;
236
214
  name: string;
@@ -264,26 +242,6 @@ interface Available {
264
242
  }
265
243
 
266
244
  interface CreateInternalTransfer {
267
- success: boolean;
268
- messages: string[];
269
- result: Result$3;
270
- }
271
- interface AllInternalTransfers {
272
- success: boolean;
273
- messages: string[];
274
- result: Result$3[];
275
- pagination: Pagination$3;
276
- }
277
- interface Pagination$3 {
278
- count: number;
279
- next: string;
280
- }
281
- interface InternalTransfer {
282
- success: boolean;
283
- messages: string[];
284
- result: Result$3;
285
- }
286
- interface Result$3 {
287
245
  id: string;
288
246
  status: string;
289
247
  amount: Amount$3;
@@ -296,7 +254,11 @@ interface Result$3 {
296
254
  createTime: string;
297
255
  updateTime: string;
298
256
  }
299
- interface Result$3 {
257
+ interface AllInternalTransfers {
258
+ result: Transfer[];
259
+ pagination: Pagination;
260
+ }
261
+ interface Transfer {
300
262
  id: string;
301
263
  status: string;
302
264
  amount: Amount$3;
@@ -309,7 +271,7 @@ interface Result$3 {
309
271
  createTime: string;
310
272
  updateTime: string;
311
273
  }
312
- interface Result$3 {
274
+ interface InternalTransfer {
313
275
  id: string;
314
276
  status: string;
315
277
  amount: Amount$3;
@@ -392,27 +354,49 @@ interface Amount$3 {
392
354
  value: number;
393
355
  }
394
356
 
395
- interface CreatePaymentCode {
396
- success: boolean;
397
- messages: string[];
398
- result: Result$2;
357
+ interface Payment {
358
+ id: string;
359
+ status: "pending" | "processing" | "completed" | "failed";
360
+ amount: {
361
+ currency: string;
362
+ value: number;
363
+ };
364
+ channel: {
365
+ type: "bank" | "card" | "momo" | "wallet";
366
+ };
367
+ name: string | null;
368
+ reference: string | null;
369
+ orderNumber: string | null;
370
+ financialAccountId: string | null;
371
+ financialTransactionReference: string | null;
372
+ fees: Array<{
373
+ code: string;
374
+ amount: {
375
+ currency: string;
376
+ value: number;
377
+ };
378
+ }>;
379
+ createTime: string;
380
+ updateTime: string;
381
+ ownershipGraph: {
382
+ owner: {
383
+ id: string;
384
+ type: string;
385
+ metadata: Record<string, unknown> | null;
386
+ };
387
+ };
388
+ metadata: Record<string, unknown> | null;
399
389
  }
400
- interface GetAllPaymentCode {
401
- success: boolean;
402
- messages: string[];
403
- result: Result$2[];
404
- pagination: Pagination$2;
390
+ interface GetPayment extends Payment {
405
391
  }
406
- interface Pagination$2 {
407
- count: number;
408
- next: string;
392
+ interface ListPayments {
393
+ result: Payment[];
394
+ pagination: Pagination;
409
395
  }
410
- interface GetOne {
411
- success: boolean;
412
- messages: string[];
413
- result: Result$2;
396
+ interface PatchPayment extends Payment {
414
397
  }
415
- interface Result$2 {
398
+
399
+ interface CreatePaymentCode {
416
400
  id: string;
417
401
  mode: string;
418
402
  status: string;
@@ -443,7 +427,11 @@ interface Result$2 {
443
427
  updateTime: string;
444
428
  ownershipGraph: OwnershipGraph$2;
445
429
  }
446
- interface Result$2 {
430
+ interface GetAllPaymentCode {
431
+ result: PaymentCode[];
432
+ pagination: Pagination;
433
+ }
434
+ interface PaymentCode {
447
435
  id: string;
448
436
  mode: string;
449
437
  status: string;
@@ -463,7 +451,7 @@ interface Result$2 {
463
451
  updateTime: string;
464
452
  ownershipGraph: OwnershipGraph$2;
465
453
  }
466
- interface Result$2 {
454
+ interface GetOne {
467
455
  id: string;
468
456
  mode: string;
469
457
  status: string;
@@ -595,26 +583,6 @@ type DestinationOption = {
595
583
  walletId: string;
596
584
  };
597
585
  interface CreatePayout {
598
- success: boolean;
599
- messages: string[];
600
- result: Result$1;
601
- }
602
- interface GetAll {
603
- success: boolean;
604
- messages: string[];
605
- result: Result$1[];
606
- pagination: Pagination$1;
607
- }
608
- interface Pagination$1 {
609
- count: number;
610
- next: string;
611
- }
612
- interface GetOnePayout {
613
- success: boolean;
614
- messages: string[];
615
- result: Result$1;
616
- }
617
- interface Result$1 {
618
586
  id: string;
619
587
  status: string;
620
588
  amount: Amount$1;
@@ -626,7 +594,11 @@ interface Result$1 {
626
594
  updateTime: string;
627
595
  ownershipGraph: OwnershipGraph$1;
628
596
  }
629
- interface Result$1 {
597
+ interface GetAll {
598
+ result: Payout[];
599
+ pagination: Pagination;
600
+ }
601
+ interface Payout {
630
602
  id: string;
631
603
  status: string;
632
604
  amount: Amount$1;
@@ -638,7 +610,7 @@ interface Result$1 {
638
610
  updateTime: string;
639
611
  ownershipGraph: OwnershipGraph$1;
640
612
  }
641
- interface Result$1 {
613
+ interface GetOnePayout {
642
614
  id: string;
643
615
  status: string;
644
616
  amount: Amount$1;
@@ -753,56 +725,34 @@ interface Amount$1 {
753
725
  value: number;
754
726
  }
755
727
 
756
- interface Payment {
757
- id: string;
758
- status: "pending" | "processing" | "completed" | "failed";
759
- amount: {
760
- currency: string;
761
- value: number;
762
- };
763
- channel: {
764
- type: "bank" | "card" | "momo" | "wallet";
765
- };
766
- name: string | null;
767
- reference: string | null;
768
- orderNumber: string | null;
769
- financialAccountId: string | null;
770
- financialTransactionReference: string | null;
771
- fees: Array<{
772
- code: string;
773
- amount: {
774
- currency: string;
775
- value: number;
776
- };
777
- }>;
778
- createTime: string;
779
- updateTime: string;
780
- ownershipGraph: {
781
- owner: {
782
- id: string;
783
- type: string;
784
- metadata: Record<string, any> | null;
785
- };
786
- };
787
- metadata: Record<string, any> | null;
728
+ interface ProviderKyc {
729
+ providerId: string;
730
+ [key: string]: unknown;
788
731
  }
789
- interface GetPayment {
790
- success: boolean;
791
- messages: string[];
792
- result: Payment;
732
+ interface GetProviderKycResponse extends ProviderKyc {
793
733
  }
794
- interface ListPayments {
795
- success: boolean;
796
- messages: string[];
797
- result: Payment[];
798
- pagination: {
799
- next: string | null;
800
- };
734
+
735
+ interface Receipt {
736
+ orderNumber: string;
737
+ [key: string]: unknown;
738
+ }
739
+ interface GetReceiptResponse extends Receipt {
801
740
  }
802
- interface PatchPayment {
803
- success: boolean;
804
- messages: string[];
805
- result: Payment;
741
+ interface RedeemReceiptResponse extends Receipt {
742
+ }
743
+
744
+ interface UssdOtp {
745
+ id: string;
746
+ phoneNumber: string;
747
+ otp: string;
748
+ expiresAt: string;
749
+ [key: string]: unknown;
750
+ }
751
+ interface CreateUssdOtpRequest {
752
+ phoneNumber: string;
753
+ [key: string]: unknown;
754
+ }
755
+ interface CreateUssdOtpResponse extends UssdOtp {
806
756
  }
807
757
 
808
758
  interface WebhookVerificationMethod {
@@ -821,7 +771,7 @@ interface Webhook {
821
771
  alertEmails: string[];
822
772
  createTime: string;
823
773
  updateTime: string;
824
- metadata: Record<string, any>;
774
+ metadata: Record<string, unknown>;
825
775
  }
826
776
  interface CreateWebhookRequest {
827
777
  name: string;
@@ -832,25 +782,15 @@ interface CreateWebhookRequest {
832
782
  headers?: Record<string, string>;
833
783
  alertEmails?: string[];
834
784
  verificationMethod?: WebhookVerificationMethod;
835
- metadata?: Record<string, any>;
785
+ metadata?: Record<string, unknown>;
836
786
  }
837
- interface CreateWebhookResponse {
838
- success: boolean;
839
- messages: string[];
840
- result: Webhook;
787
+ interface CreateWebhookResponse extends Webhook {
841
788
  }
842
- interface GetWebhookResponse {
843
- success: boolean;
844
- messages: string[];
845
- result: Webhook;
789
+ interface GetWebhookResponse extends Webhook {
846
790
  }
847
791
  interface ListWebhooksResponse {
848
- success: boolean;
849
- messages: string[];
850
792
  result: Webhook[];
851
- pagination?: {
852
- next: string | null;
853
- };
793
+ pagination?: Pagination;
854
794
  }
855
795
  interface UpdateWebhookRequest {
856
796
  name?: string;
@@ -860,59 +800,14 @@ interface UpdateWebhookRequest {
860
800
  headers?: Record<string, string>;
861
801
  alertEmails?: string[];
862
802
  verificationMethod?: WebhookVerificationMethod;
863
- metadata?: Record<string, any>;
803
+ metadata?: Record<string, unknown>;
864
804
  }
865
- interface UpdateWebhookResponse {
866
- success: boolean;
867
- messages: string[];
868
- result: Webhook;
869
- }
870
-
871
- interface Receipt {
872
- orderNumber: string;
873
- [key: string]: any;
874
- }
875
- interface GetReceiptResponse {
876
- success: boolean;
877
- messages: string[];
878
- result: Receipt;
879
- }
880
- interface RedeemReceiptResponse {
881
- success: boolean;
882
- messages: string[];
883
- result: Receipt;
884
- }
885
-
886
- interface UssdOtp {
887
- id: string;
888
- phoneNumber: string;
889
- otp: string;
890
- expiresAt: string;
891
- [key: string]: any;
892
- }
893
- interface CreateUssdOtpRequest {
894
- phoneNumber: string;
895
- [key: string]: any;
896
- }
897
- interface CreateUssdOtpResponse {
898
- success: boolean;
899
- messages: string[];
900
- result: UssdOtp;
901
- }
902
-
903
- interface ProviderKyc {
904
- providerId: string;
905
- [key: string]: any;
906
- }
907
- interface GetProviderKycResponse {
908
- success: boolean;
909
- messages: string[];
910
- result: ProviderKyc;
805
+ interface UpdateWebhookResponse extends Webhook {
911
806
  }
912
807
 
913
808
  type Currency = "USD" | "SLE";
914
809
 
915
- declare function FinancialAccountAPI(client: MonimeClient): {
810
+ declare function FinancialAccountAPI(config: ClientConfig): {
916
811
  create: (name: string, currency: Currency) => Promise<{
917
812
  success: boolean;
918
813
  data?: CreateFinancialAccount;
@@ -931,21 +826,6 @@ declare function FinancialAccountAPI(client: MonimeClient): {
931
826
  };
932
827
 
933
828
  interface GetTransaction {
934
- success: boolean;
935
- messages: string[];
936
- result: Result;
937
- }
938
- interface AllTransaction {
939
- success: boolean;
940
- messages: string[];
941
- result: Result[];
942
- pagination: Pagination;
943
- }
944
- interface Pagination {
945
- count: number;
946
- next: string;
947
- }
948
- interface Result {
949
829
  id: string;
950
830
  type: string;
951
831
  amount: Amount;
@@ -956,7 +836,11 @@ interface Result {
956
836
  originatingFee: OriginatingFee;
957
837
  ownershipGraph: OwnershipGraph;
958
838
  }
959
- interface Result {
839
+ interface AllTransaction {
840
+ result: Transaction[];
841
+ pagination: Pagination;
842
+ }
843
+ interface Transaction {
960
844
  id: string;
961
845
  type: string;
962
846
  amount: Amount;
@@ -1028,7 +912,7 @@ interface Amount {
1028
912
  value: number;
1029
913
  }
1030
914
 
1031
- declare function FinancialTransactionAPI(client: MonimeClient): {
915
+ declare function FinancialTransactionAPI(config: ClientConfig): {
1032
916
  get: (transactionId: string) => Promise<{
1033
917
  success: boolean;
1034
918
  error?: Error;
@@ -1041,7 +925,7 @@ declare function FinancialTransactionAPI(client: MonimeClient): {
1041
925
  }>;
1042
926
  };
1043
927
 
1044
- declare function InternalTransferAPI(client: MonimeClient): {
928
+ declare function InternalTransferAPI(config: ClientConfig): {
1045
929
  create: (sourceAccount: string, destinationAccount: string, amount: number) => Promise<{
1046
930
  success: boolean;
1047
931
  data?: CreateInternalTransfer;
@@ -1063,25 +947,25 @@ declare function InternalTransferAPI(client: MonimeClient): {
1063
947
  }>;
1064
948
  };
1065
949
 
1066
- declare function PaymentAPI(client: MonimeClient): {
950
+ declare function PaymentAPI(config: ClientConfig): {
1067
951
  get: (paymentId: string) => Promise<{
1068
952
  success: boolean;
1069
953
  data?: GetPayment;
1070
954
  error?: Error;
1071
955
  }>;
1072
- getAll: (params?: Record<string, any>) => Promise<{
956
+ getAll: (params?: Record<string, unknown>) => Promise<{
1073
957
  success: boolean;
1074
958
  data?: ListPayments;
1075
959
  error?: Error;
1076
960
  }>;
1077
- patch: (paymentId: string, body: Record<string, any>) => Promise<{
961
+ patch: (paymentId: string, body: Record<string, unknown>) => Promise<{
1078
962
  success: boolean;
1079
963
  data?: PatchPayment;
1080
964
  error?: Error;
1081
965
  }>;
1082
966
  };
1083
967
 
1084
- declare function PaymentCodeAPI(client: MonimeClient): {
968
+ declare function PaymentCodeAPI(config: ClientConfig): {
1085
969
  create: (paymentName: string, amount: number, financialAccount: string, username: string, phoneNumber: string) => Promise<{
1086
970
  success: boolean;
1087
971
  data?: CreatePaymentCode;
@@ -1103,7 +987,7 @@ declare function PaymentCodeAPI(client: MonimeClient): {
1103
987
  }>;
1104
988
  };
1105
989
 
1106
- declare function PayoutAPI(client: MonimeClient): {
990
+ declare function PayoutAPI(config: ClientConfig): {
1107
991
  create: (amount: number, destination: DestinationOption, sourceAccount: string) => Promise<{
1108
992
  success: boolean;
1109
993
  data?: CreatePayout;
@@ -1125,7 +1009,7 @@ declare function PayoutAPI(client: MonimeClient): {
1125
1009
  }>;
1126
1010
  };
1127
1011
 
1128
- declare function ProviderKycAPI(client: MonimeClient): {
1012
+ declare function ProviderKycAPI(config: ClientConfig): {
1129
1013
  get: (providerId: string) => Promise<{
1130
1014
  success: boolean;
1131
1015
  data?: GetProviderKycResponse;
@@ -1133,20 +1017,20 @@ declare function ProviderKycAPI(client: MonimeClient): {
1133
1017
  }>;
1134
1018
  };
1135
1019
 
1136
- declare function ReceiptAPI(client: MonimeClient): {
1020
+ declare function ReceiptAPI(config: ClientConfig): {
1137
1021
  get: (orderNumber: string) => Promise<{
1138
1022
  success: boolean;
1139
1023
  data?: GetReceiptResponse;
1140
1024
  error?: Error;
1141
1025
  }>;
1142
- redeem: (orderNumber: string, body?: Record<string, any>) => Promise<{
1026
+ redeem: (orderNumber: string, body?: Record<string, unknown>) => Promise<{
1143
1027
  success: boolean;
1144
1028
  data?: RedeemReceiptResponse;
1145
1029
  error?: Error;
1146
1030
  }>;
1147
1031
  };
1148
1032
 
1149
- declare function UssdOtpAPI(client: MonimeClient): {
1033
+ declare function UssdOtpAPI(config: ClientConfig): {
1150
1034
  create: (body: CreateUssdOtpRequest) => Promise<{
1151
1035
  success: boolean;
1152
1036
  data?: CreateUssdOtpResponse;
@@ -1154,7 +1038,7 @@ declare function UssdOtpAPI(client: MonimeClient): {
1154
1038
  }>;
1155
1039
  };
1156
1040
 
1157
- declare function WebhookAPI(client: MonimeClient): {
1041
+ declare function WebhookAPI(config: ClientConfig): {
1158
1042
  create: (body: CreateWebhookRequest) => Promise<{
1159
1043
  success: boolean;
1160
1044
  data?: CreateWebhookResponse;
@@ -1202,11 +1086,6 @@ declare class MonimeClient {
1202
1086
  financialTransaction: ReturnType<typeof FinancialTransactionAPI>;
1203
1087
  checkoutSession: ReturnType<typeof CheckoutSessionAPI>;
1204
1088
  constructor(options: ClientOptions);
1205
- _getConfig(): {
1206
- monimeSpaceId: string;
1207
- accessToken: string;
1208
- monimeVersion: string | undefined;
1209
- };
1210
1089
  }
1211
1090
 
1212
1091
  declare function createClient(options: ClientOptions): MonimeClient;