@mnpay/bonum 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/@types/api.d.ts +225 -0
  2. package/@types/constants/apiUrls.d.ts +26 -0
  3. package/@types/constants/index.d.ts +1 -0
  4. package/@types/definitions/index.d.ts +1 -0
  5. package/@types/definitions/store.d.ts +11 -0
  6. package/@types/index.d.ts +6 -0
  7. package/@types/lib/api.d.ts +4 -0
  8. package/@types/lib/index.d.ts +1 -0
  9. package/@types/requests/auth.d.ts +11 -0
  10. package/@types/requests/card.d.ts +49 -0
  11. package/@types/requests/index.d.ts +6 -0
  12. package/@types/requests/invoice.d.ts +33 -0
  13. package/@types/requests/neo.d.ts +10 -0
  14. package/@types/requests/qr.d.ts +28 -0
  15. package/@types/requests/subscription.d.ts +96 -0
  16. package/@types/schemas/auth.d.ts +12 -0
  17. package/@types/schemas/card.d.ts +64 -0
  18. package/@types/schemas/common.d.ts +11 -0
  19. package/@types/schemas/config.d.ts +17 -0
  20. package/@types/schemas/index.d.ts +9 -0
  21. package/@types/schemas/invoice.d.ts +79 -0
  22. package/@types/schemas/neo.d.ts +5 -0
  23. package/@types/schemas/qr.d.ts +46 -0
  24. package/@types/schemas/subscription.d.ts +92 -0
  25. package/@types/schemas/webhook.d.ts +140 -0
  26. package/@types/test/_lib/liveTokenCache.d.ts +19 -0
  27. package/@types/test/_mocks/api.d.ts +241 -0
  28. package/@types/test/api.live.test.d.ts +1 -0
  29. package/@types/test/api.test.d.ts +1 -0
  30. package/@types/test/headers.test.d.ts +1 -0
  31. package/@types/test/setup.d.ts +1 -0
  32. package/@types/test/webhook.test.d.ts +1 -0
  33. package/@types/types/auth.d.ts +4 -0
  34. package/@types/types/card.d.ts +9 -0
  35. package/@types/types/common.d.ts +5 -0
  36. package/@types/types/config.d.ts +3 -0
  37. package/@types/types/index.d.ts +9 -0
  38. package/@types/types/invoice.d.ts +9 -0
  39. package/@types/types/neo.d.ts +3 -0
  40. package/@types/types/qr.d.ts +6 -0
  41. package/@types/types/subscription.d.ts +8 -0
  42. package/@types/types/webhook.d.ts +13 -0
  43. package/@types/utils/headers.d.ts +9 -0
  44. package/@types/utils/index.d.ts +2 -0
  45. package/@types/utils/webhook.d.ts +11 -0
  46. package/@types/vite.config.d.ts +2 -0
  47. package/@types/vitest.config.d.ts +2 -0
  48. package/CHANGELOG.md +57 -0
  49. package/README.md +486 -0
  50. package/dist/index.js +314 -0
  51. package/dist/index.umd.cjs +1 -0
  52. package/package.json +56 -0
@@ -0,0 +1,225 @@
1
+ import { type BonumConfig } from './types/index.js';
2
+ /**
3
+ * Gateway factory to initialize the Bonum client.
4
+ */
5
+ export declare const useBonum: (config: BonumConfig & {
6
+ isTestEnv?: boolean;
7
+ }) => {
8
+ api: import("axios").AxiosInstance;
9
+ getToken: (options?: import("axios").AxiosRequestConfig) => Promise<import("axios").AxiosResponse<{
10
+ tokenType: "Bearer";
11
+ accessToken: string;
12
+ expiresIn: number;
13
+ refreshToken: string;
14
+ refreshExpiresIn: number;
15
+ unit: "SECONDS";
16
+ }, any, {}>>;
17
+ refreshToken: (options?: import("axios").AxiosRequestConfig) => Promise<import("axios").AxiosResponse<{
18
+ accessToken: string;
19
+ }, any, {}>>;
20
+ getPaymentProviders: (options?: import("axios").AxiosRequestConfig) => Promise<import("axios").AxiosResponse<{
21
+ provider: "QPAY" | "E_COMMERCE" | "WE_CHAT" | "SONO_SHOP";
22
+ enabled: boolean;
23
+ }[], any, {}>>;
24
+ createInvoice: (data: {
25
+ amount: number;
26
+ callback: string;
27
+ transactionId: string;
28
+ expiresIn: number;
29
+ providers?: ("QPAY" | "E_COMMERCE" | "WE_CHAT" | "SONO_SHOP")[] | undefined;
30
+ items?: {
31
+ title: string;
32
+ amount: number;
33
+ count: number;
34
+ image?: string | undefined;
35
+ remark?: string | undefined;
36
+ }[] | undefined;
37
+ extras?: {
38
+ placeholder: string;
39
+ type: "NUMBER" | "PHONE" | "EMAIL" | "TEXT" | "ALL";
40
+ required: boolean;
41
+ }[] | undefined;
42
+ language?: "mn" | "en" | undefined;
43
+ }, options?: import("axios").AxiosRequestConfig) => Promise<import("axios").AxiosResponse<{
44
+ invoiceId: string;
45
+ followUpLink: string;
46
+ }, any, {}>>;
47
+ getInvoiceStatus: (data: {
48
+ invoiceId: string;
49
+ }, options?: import("axios").AxiosRequestConfig) => Promise<import("axios").AxiosResponse<unknown, any, {}>>;
50
+ setInvoicePaid: (data: {
51
+ invoiceId: string;
52
+ }, options?: import("axios").AxiosRequestConfig) => Promise<import("axios").AxiosResponse<unknown, any, {}>>;
53
+ createQrCode: (data: {
54
+ amount: number;
55
+ transactionId: string;
56
+ expiresIn: number;
57
+ }, options?: import("axios").AxiosRequestConfig) => Promise<import("axios").AxiosResponse<{
58
+ data: {
59
+ invoiceId: string;
60
+ qrCode: string;
61
+ qrImage: string;
62
+ links: {
63
+ name: string;
64
+ description: string;
65
+ logo: string;
66
+ link: string;
67
+ appStoreId: string;
68
+ androidPackageName: string;
69
+ }[];
70
+ };
71
+ }, any, {}>>;
72
+ invoiceByQrCode: (data: {
73
+ qrCode: string;
74
+ }, options?: import("axios").AxiosRequestConfig) => Promise<import("axios").AxiosResponse<unknown, any, {}>>;
75
+ payByCardTokenQr: (data: {
76
+ qrCode: string;
77
+ transactionId: string;
78
+ } & {
79
+ cardToken: string;
80
+ }, options?: import("axios").AxiosRequestConfig) => Promise<import("axios").AxiosResponse<unknown, any, {}>>;
81
+ createCardToken: (data: {
82
+ callback: string;
83
+ transactionId: string;
84
+ payment?: {
85
+ amount: number;
86
+ } | undefined;
87
+ subscription?: {
88
+ planId: number;
89
+ cycleValue: string;
90
+ cycles?: number | null | undefined;
91
+ payNow?: boolean | undefined;
92
+ custEmail?: string | undefined;
93
+ } | undefined;
94
+ items?: {
95
+ title: string;
96
+ amount: number;
97
+ count: number;
98
+ image?: string | undefined;
99
+ remark?: string | undefined;
100
+ }[] | undefined;
101
+ }, options?: import("axios").AxiosRequestConfig) => Promise<import("axios").AxiosResponse<{
102
+ followUpLink: string;
103
+ id: string;
104
+ }, any, {}>>;
105
+ purchaseWithCardToken: (data: {
106
+ amount: number;
107
+ currency: string;
108
+ transactionId: string;
109
+ } & {
110
+ cardToken: string;
111
+ }, options?: import("axios").AxiosRequestConfig) => Promise<import("axios").AxiosResponse<{
112
+ id: number;
113
+ status: "SUCCESS" | "FAILED" | "QUEUED";
114
+ completedAt?: string | undefined;
115
+ description?: string | undefined;
116
+ cardStatus?: "ACTIVE" | "INACTIVE" | null | undefined;
117
+ respCode?: string | null | undefined;
118
+ }, any, {}>>;
119
+ rollbackPurchase: (data: {
120
+ id: string;
121
+ cardToken: string;
122
+ }, options?: import("axios").AxiosRequestConfig) => Promise<import("axios").AxiosResponse<unknown, any, {}>>;
123
+ listPaymentPlans: (options?: import("axios").AxiosRequestConfig) => Promise<import("axios").AxiosResponse<{
124
+ data: {
125
+ planId: number;
126
+ name: string;
127
+ remark: string;
128
+ createdAt: string;
129
+ recurringType: "WEEKLY" | "MONTHLY" | "YEARLY";
130
+ amount: number;
131
+ status: "ACTIVE" | "INACTIVE";
132
+ cardCount: number;
133
+ retryCount: number;
134
+ }[];
135
+ }, any, {}>>;
136
+ subscribe: (data: {
137
+ planId: number;
138
+ cycleValue: string | number;
139
+ cycles?: number | null | undefined;
140
+ payNow?: boolean | undefined;
141
+ custEmail?: string | undefined;
142
+ } & {
143
+ cardToken: string;
144
+ }, options?: import("axios").AxiosRequestConfig) => Promise<import("axios").AxiosResponse<{
145
+ subscriptionId: number;
146
+ subscribedAt: string;
147
+ cardMask: string;
148
+ plan: {
149
+ planId: number;
150
+ name: string;
151
+ remark: string;
152
+ createdAt: string;
153
+ recurringType: "WEEKLY" | "MONTHLY" | "YEARLY";
154
+ amount: number;
155
+ status: "ACTIVE" | "INACTIVE";
156
+ cardCount: number;
157
+ retryCount: number;
158
+ };
159
+ nextBillAt: string;
160
+ lastBilledAt: string;
161
+ status: "ACTIVE" | "INACTIVE" | "CANCELLED";
162
+ }, any, {}>>;
163
+ getSubscriptions: (data: {
164
+ cardToken: string;
165
+ }, options?: import("axios").AxiosRequestConfig) => Promise<import("axios").AxiosResponse<{
166
+ subscriptionId: number;
167
+ subscribedAt: string;
168
+ cardMask: string;
169
+ plan: {
170
+ planId: number;
171
+ name: string;
172
+ remark: string;
173
+ createdAt: string;
174
+ recurringType: "WEEKLY" | "MONTHLY" | "YEARLY";
175
+ amount: number;
176
+ status: "ACTIVE" | "INACTIVE";
177
+ cardCount: number;
178
+ retryCount: number;
179
+ };
180
+ nextBillAt: string;
181
+ lastBilledAt: string;
182
+ status: "ACTIVE" | "INACTIVE" | "CANCELLED";
183
+ }[], any, {}>>;
184
+ unsubscribe: (data: {
185
+ subscriptionId: string;
186
+ planId?: string;
187
+ }, options?: import("axios").AxiosRequestConfig) => Promise<import("axios").AxiosResponse<unknown, any, {}>>;
188
+ deleteSubscription: (data: {
189
+ subscriptionId: string;
190
+ planId?: string;
191
+ }, options?: import("axios").AxiosRequestConfig) => Promise<import("axios").AxiosResponse<unknown, any, {}>>;
192
+ changeSubscriptionTokenNewCard: (data: {
193
+ callback: string;
194
+ transactionId: string;
195
+ items?: {
196
+ title: string;
197
+ amount: number;
198
+ count: number;
199
+ image?: string | undefined;
200
+ remark?: string | undefined;
201
+ }[] | undefined;
202
+ } & {
203
+ subscriptionId: string;
204
+ }, options?: import("axios").AxiosRequestConfig) => Promise<import("axios").AxiosResponse<{
205
+ followUpLink: string;
206
+ }, any, {}>>;
207
+ changeSubscriptionTokenExisting: (data: {
208
+ subscriptionId: string;
209
+ newCardToken: string;
210
+ }, options?: import("axios").AxiosRequestConfig) => Promise<import("axios").AxiosResponse<unknown, any, {}>>;
211
+ executeSubscriptionPayment: (data: {
212
+ subscriptionId: string;
213
+ }, options?: import("axios").AxiosRequestConfig) => Promise<import("axios").AxiosResponse<unknown, any, {}>>;
214
+ getNeoUserData: (data: {
215
+ requestId: string;
216
+ mChatBaseUrl: string;
217
+ }, options?: import("axios").AxiosRequestConfig) => Promise<import("axios").AxiosResponse<unknown, any, {}>>;
218
+ sendNeoMessage: (data: {
219
+ phoneNumber: string;
220
+ message: string;
221
+ } & {
222
+ neoBaseUrl: string;
223
+ }, options?: import("axios").AxiosRequestConfig) => Promise<import("axios").AxiosResponse<unknown, any, {}>>;
224
+ verifyWebhookChecksum: (rawBody: string, headerChecksum: string) => boolean;
225
+ };
@@ -0,0 +1,26 @@
1
+ export declare const testApiBaseUrl = "https://testapi.bonum.mn";
2
+ export declare const apiBaseUrl = "https://apis.bonum.mn";
3
+ export declare enum BonumRequestPath {
4
+ authenticate = "/bonum-gateway/ecommerce/auth/create",
5
+ refresh = "/bonum-gateway/ecommerce/auth/refresh",
6
+ paymentProviders = "/bonum-gateway/ecommerce/invoices/payment-providers",
7
+ createInvoice = "/bonum-gateway/ecommerce/invoices",
8
+ getInvoiceStatus = "/bonum-gateway/ecommerce/invoices/:invoiceId",
9
+ setInvoicePaid = "/bonum-gateway/ecommerce/invoices/paid",// ?invoiceId=
10
+ createQrCode = "/mpay-service/merchant/transaction/qr/create",
11
+ invoiceByQrCode = "/mpay-service/merchant/transaction/qr",
12
+ payByCardTokenQr = "/mpay-service/merchant/transaction/qr/pay",
13
+ createCardToken = "/mpay-service/merchant/cards/tokenize/request",
14
+ purchaseWithCardToken = "/mpay-service/merchant/transaction/purchase",
15
+ rollbackPurchase = "/mpay-service/merchant/transaction/rollback/:id",
16
+ listPaymentPlans = "/mpay-service/merchant/values/payment-plans",
17
+ subscribe = "/mpay-service/merchant/subscriptions/subscribe",
18
+ getSubscriptions = "/mpay-service/merchant/subscriptions",
19
+ unsubscribe = "/mpay-service/merchant/subscriptions/:subscriptionId",
20
+ deleteSubscription = "/mpay-service/merchant/subscriptions/:subscriptionId/delete",
21
+ changeTokenNewCard = "/mpay-service/merchant/subscriptions/:subscriptionId/change/create-new-token",
22
+ changeTokenExisting = "/mpay-service/merchant/subscriptions/:subscriptionId/change",
23
+ executePayment = "/mpay-service/merchant/subscriptions/:subscriptionId/execute",
24
+ getNeoUserData = "/users/apps/share/requests",// requires M_CHAT_BASE_URL override
25
+ sendNeoMessage = "/messages/send"
26
+ }
@@ -0,0 +1 @@
1
+ export * from './apiUrls.js';
@@ -0,0 +1 @@
1
+ export * from './store.js';
@@ -0,0 +1,11 @@
1
+ import { type BonumConfig } from '../types/index.js';
2
+ export interface Store extends BonumConfig {
3
+ accessToken?: string;
4
+ refreshToken?: string;
5
+ expiresIn?: Date;
6
+ refreshExpiresIn?: Date;
7
+ }
8
+ export type StoreConfig = {
9
+ store: Store;
10
+ setStore: (value: Partial<Store>) => void;
11
+ };
@@ -0,0 +1,6 @@
1
+ export * from './constants/index.js';
2
+ export * from './schemas/index.js';
3
+ export * from './types/index.js';
4
+ export * from './definitions/index.js';
5
+ export * from './utils/index.js';
6
+ export * from './api.js';
@@ -0,0 +1,4 @@
1
+ import { type StoreConfig } from '../definitions/index.js';
2
+ import type { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios';
3
+ export declare const useBonumApi: <Res, Req = undefined, R extends (api: AxiosInstance, storeConfig: StoreConfig) => any = (api: AxiosInstance, storeConfig: StoreConfig) => (data: Req, options?: AxiosRequestConfig) => Promise<AxiosResponse<Res>>>(requestHandler: R) => R;
4
+ export declare const useBonumApiWithoutData: <Res, R extends (api: AxiosInstance, storeConfig: StoreConfig) => any = (api: AxiosInstance, storeConfig: StoreConfig) => (options?: AxiosRequestConfig) => Promise<AxiosResponse<Res>>>(requestHandler: R) => R;
@@ -0,0 +1 @@
1
+ export * from './api.js';
@@ -0,0 +1,11 @@
1
+ export declare const makeGetToken: (api: import("axios").AxiosInstance, storeConfig: import("../index.js").StoreConfig) => (options?: import("axios").AxiosRequestConfig) => Promise<import("axios").AxiosResponse<{
2
+ tokenType: "Bearer";
3
+ accessToken: string;
4
+ expiresIn: number;
5
+ refreshToken: string;
6
+ refreshExpiresIn: number;
7
+ unit: "SECONDS";
8
+ }, any, {}>>;
9
+ export declare const makeRefreshToken: (api: import("axios").AxiosInstance, storeConfig: import("../index.js").StoreConfig) => (options?: import("axios").AxiosRequestConfig) => Promise<import("axios").AxiosResponse<{
10
+ accessToken: string;
11
+ }, any, {}>>;
@@ -0,0 +1,49 @@
1
+ export declare const makeCreateCardToken: (api: import("axios").AxiosInstance, storeConfig: import("../index.js").StoreConfig) => (data: {
2
+ callback: string;
3
+ transactionId: string;
4
+ payment?: {
5
+ amount: number;
6
+ } | undefined;
7
+ subscription?: {
8
+ planId: number;
9
+ cycleValue: string;
10
+ cycles?: number | null | undefined;
11
+ payNow?: boolean | undefined;
12
+ custEmail?: string | undefined;
13
+ } | undefined;
14
+ items?: {
15
+ title: string;
16
+ amount: number;
17
+ count: number;
18
+ image?: string | undefined;
19
+ remark?: string | undefined;
20
+ }[] | undefined;
21
+ }, options?: import("axios").AxiosRequestConfig) => Promise<import("axios").AxiosResponse<{
22
+ followUpLink: string;
23
+ id: string;
24
+ }, any, {}>>;
25
+ export declare const makePurchaseWithCardToken: (api: import("axios").AxiosInstance, storeConfig: import("../index.js").StoreConfig) => (data: {
26
+ amount: number;
27
+ currency: string;
28
+ transactionId: string;
29
+ } & {
30
+ cardToken: string;
31
+ }, options?: import("axios").AxiosRequestConfig) => Promise<import("axios").AxiosResponse<{
32
+ id: number;
33
+ status: "SUCCESS" | "FAILED" | "QUEUED";
34
+ completedAt?: string | undefined;
35
+ description?: string | undefined;
36
+ cardStatus?: "ACTIVE" | "INACTIVE" | null | undefined;
37
+ respCode?: string | null | undefined;
38
+ }, any, {}>>;
39
+ /**
40
+ * Аль хэдийн амжилттай дууссан худалдан авалтын гүйлгээг бүтнээр нь буцаах (refund).
41
+ *
42
+ * PDF §4.3: `GET /mpay-service/merchant/transaction/rollback/{id}` — `Authorization`
43
+ * болон `X-CARD-TOKEN` header-тэй, биетгүй. Буцаалт нь `id`-аар тодорхойлогдох анхны
44
+ * худалдан авалтын бүтэн дүнд хийгдэх тул `amount` дамжуулахгүй.
45
+ */
46
+ export declare const makeRollbackPurchase: (api: import("axios").AxiosInstance, storeConfig: import("../index.js").StoreConfig) => (data: {
47
+ id: string;
48
+ cardToken: string;
49
+ }, options?: import("axios").AxiosRequestConfig) => Promise<import("axios").AxiosResponse<unknown, any, {}>>;
@@ -0,0 +1,6 @@
1
+ export * from './auth.js';
2
+ export * from './invoice.js';
3
+ export * from './qr.js';
4
+ export * from './card.js';
5
+ export * from './subscription.js';
6
+ export * from './neo.js';
@@ -0,0 +1,33 @@
1
+ export declare const makeGetPaymentProviders: (api: import("axios").AxiosInstance, storeConfig: import("../index.js").StoreConfig) => (options?: import("axios").AxiosRequestConfig) => Promise<import("axios").AxiosResponse<{
2
+ provider: "QPAY" | "E_COMMERCE" | "WE_CHAT" | "SONO_SHOP";
3
+ enabled: boolean;
4
+ }[], any, {}>>;
5
+ export declare const makeCreateInvoice: (api: import("axios").AxiosInstance, storeConfig: import("../index.js").StoreConfig) => (data: {
6
+ amount: number;
7
+ callback: string;
8
+ transactionId: string;
9
+ expiresIn: number;
10
+ providers?: ("QPAY" | "E_COMMERCE" | "WE_CHAT" | "SONO_SHOP")[] | undefined;
11
+ items?: {
12
+ title: string;
13
+ amount: number;
14
+ count: number;
15
+ image?: string | undefined;
16
+ remark?: string | undefined;
17
+ }[] | undefined;
18
+ extras?: {
19
+ placeholder: string;
20
+ type: "NUMBER" | "PHONE" | "EMAIL" | "TEXT" | "ALL";
21
+ required: boolean;
22
+ }[] | undefined;
23
+ language?: "mn" | "en" | undefined;
24
+ }, options?: import("axios").AxiosRequestConfig) => Promise<import("axios").AxiosResponse<{
25
+ invoiceId: string;
26
+ followUpLink: string;
27
+ }, any, {}>>;
28
+ export declare const makeGetInvoiceStatus: (api: import("axios").AxiosInstance, storeConfig: import("../index.js").StoreConfig) => (data: {
29
+ invoiceId: string;
30
+ }, options?: import("axios").AxiosRequestConfig) => Promise<import("axios").AxiosResponse<unknown, any, {}>>;
31
+ export declare const makeSetInvoicePaid: (api: import("axios").AxiosInstance, storeConfig: import("../index.js").StoreConfig) => (data: {
32
+ invoiceId: string;
33
+ }, options?: import("axios").AxiosRequestConfig) => Promise<import("axios").AxiosResponse<unknown, any, {}>>;
@@ -0,0 +1,10 @@
1
+ export declare const makeGetNeoUserData: (api: import("axios").AxiosInstance, storeConfig: import("../index.js").StoreConfig) => (data: {
2
+ requestId: string;
3
+ mChatBaseUrl: string;
4
+ }, options?: import("axios").AxiosRequestConfig) => Promise<import("axios").AxiosResponse<unknown, any, {}>>;
5
+ export declare const makeSendNeoMessage: (api: import("axios").AxiosInstance, storeConfig: import("../index.js").StoreConfig) => (data: {
6
+ phoneNumber: string;
7
+ message: string;
8
+ } & {
9
+ neoBaseUrl: string;
10
+ }, options?: import("axios").AxiosRequestConfig) => Promise<import("axios").AxiosResponse<unknown, any, {}>>;
@@ -0,0 +1,28 @@
1
+ export declare const makeCreateQrCode: (api: import("axios").AxiosInstance, storeConfig: import("../index.js").StoreConfig) => (data: {
2
+ amount: number;
3
+ transactionId: string;
4
+ expiresIn: number;
5
+ }, options?: import("axios").AxiosRequestConfig) => Promise<import("axios").AxiosResponse<{
6
+ data: {
7
+ invoiceId: string;
8
+ qrCode: string;
9
+ qrImage: string;
10
+ links: {
11
+ name: string;
12
+ description: string;
13
+ logo: string;
14
+ link: string;
15
+ appStoreId: string;
16
+ androidPackageName: string;
17
+ }[];
18
+ };
19
+ }, any, {}>>;
20
+ export declare const makeInvoiceByQrCode: (api: import("axios").AxiosInstance, storeConfig: import("../index.js").StoreConfig) => (data: {
21
+ qrCode: string;
22
+ }, options?: import("axios").AxiosRequestConfig) => Promise<import("axios").AxiosResponse<unknown, any, {}>>;
23
+ export declare const makePayByCardTokenQr: (api: import("axios").AxiosInstance, storeConfig: import("../index.js").StoreConfig) => (data: {
24
+ qrCode: string;
25
+ transactionId: string;
26
+ } & {
27
+ cardToken: string;
28
+ }, options?: import("axios").AxiosRequestConfig) => Promise<import("axios").AxiosResponse<unknown, any, {}>>;
@@ -0,0 +1,96 @@
1
+ export declare const makeListPaymentPlans: (api: import("axios").AxiosInstance, storeConfig: import("../index.js").StoreConfig) => (options?: import("axios").AxiosRequestConfig) => Promise<import("axios").AxiosResponse<{
2
+ data: {
3
+ planId: number;
4
+ name: string;
5
+ remark: string;
6
+ createdAt: string;
7
+ recurringType: "WEEKLY" | "MONTHLY" | "YEARLY";
8
+ amount: number;
9
+ status: "ACTIVE" | "INACTIVE";
10
+ cardCount: number;
11
+ retryCount: number;
12
+ }[];
13
+ }, any, {}>>;
14
+ export declare const makeSubscribe: (api: import("axios").AxiosInstance, storeConfig: import("../index.js").StoreConfig) => (data: {
15
+ planId: number;
16
+ cycleValue: string | number;
17
+ cycles?: number | null | undefined;
18
+ payNow?: boolean | undefined;
19
+ custEmail?: string | undefined;
20
+ } & {
21
+ cardToken: string;
22
+ }, options?: import("axios").AxiosRequestConfig) => Promise<import("axios").AxiosResponse<{
23
+ subscriptionId: number;
24
+ subscribedAt: string;
25
+ cardMask: string;
26
+ plan: {
27
+ planId: number;
28
+ name: string;
29
+ remark: string;
30
+ createdAt: string;
31
+ recurringType: "WEEKLY" | "MONTHLY" | "YEARLY";
32
+ amount: number;
33
+ status: "ACTIVE" | "INACTIVE";
34
+ cardCount: number;
35
+ retryCount: number;
36
+ };
37
+ nextBillAt: string;
38
+ lastBilledAt: string;
39
+ status: "ACTIVE" | "INACTIVE" | "CANCELLED";
40
+ }, any, {}>>;
41
+ export declare const makeGetSubscriptions: (api: import("axios").AxiosInstance, storeConfig: import("../index.js").StoreConfig) => (data: {
42
+ cardToken: string;
43
+ }, options?: import("axios").AxiosRequestConfig) => Promise<import("axios").AxiosResponse<{
44
+ subscriptionId: number;
45
+ subscribedAt: string;
46
+ cardMask: string;
47
+ plan: {
48
+ planId: number;
49
+ name: string;
50
+ remark: string;
51
+ createdAt: string;
52
+ recurringType: "WEEKLY" | "MONTHLY" | "YEARLY";
53
+ amount: number;
54
+ status: "ACTIVE" | "INACTIVE";
55
+ cardCount: number;
56
+ retryCount: number;
57
+ };
58
+ nextBillAt: string;
59
+ lastBilledAt: string;
60
+ status: "ACTIVE" | "INACTIVE" | "CANCELLED";
61
+ }[], any, {}>>;
62
+ export declare const makeUnsubscribe: (api: import("axios").AxiosInstance, storeConfig: import("../index.js").StoreConfig) => (data: {
63
+ subscriptionId: string;
64
+ planId?: string;
65
+ }, options?: import("axios").AxiosRequestConfig) => Promise<import("axios").AxiosResponse<unknown, any, {}>>;
66
+ export declare const makeDeleteSubscription: (api: import("axios").AxiosInstance, storeConfig: import("../index.js").StoreConfig) => (data: {
67
+ subscriptionId: string;
68
+ planId?: string;
69
+ }, options?: import("axios").AxiosRequestConfig) => Promise<import("axios").AxiosResponse<unknown, any, {}>>;
70
+ export declare const makeChangeSubscriptionTokenNewCard: (api: import("axios").AxiosInstance, storeConfig: import("../index.js").StoreConfig) => (data: {
71
+ callback: string;
72
+ transactionId: string;
73
+ items?: {
74
+ title: string;
75
+ amount: number;
76
+ count: number;
77
+ image?: string | undefined;
78
+ remark?: string | undefined;
79
+ }[] | undefined;
80
+ } & {
81
+ subscriptionId: string;
82
+ }, options?: import("axios").AxiosRequestConfig) => Promise<import("axios").AxiosResponse<{
83
+ followUpLink: string;
84
+ }, any, {}>>;
85
+ export declare const makeChangeSubscriptionTokenExisting: (api: import("axios").AxiosInstance, storeConfig: import("../index.js").StoreConfig) => (data: {
86
+ subscriptionId: string;
87
+ newCardToken: string;
88
+ }, options?: import("axios").AxiosRequestConfig) => Promise<import("axios").AxiosResponse<unknown, any, {}>>;
89
+ /**
90
+ * @internal Not in the public Bonum PDF (§5/§9). Subscription charges are automatic
91
+ * (Bonum fires the SUBSCRIPTION-PAYMENT webhook); do not expose via the gateway.
92
+ * Kept as a possibly-real-but-undocumented ops endpoint pending Bonum confirmation.
93
+ */
94
+ export declare const makeExecuteSubscriptionPayment: (api: import("axios").AxiosInstance, storeConfig: import("../index.js").StoreConfig) => (data: {
95
+ subscriptionId: string;
96
+ }, options?: import("axios").AxiosRequestConfig) => Promise<import("axios").AxiosResponse<unknown, any, {}>>;
@@ -0,0 +1,12 @@
1
+ import { z } from 'zod';
2
+ export declare const GetTokenResponseSchema: z.ZodObject<{
3
+ tokenType: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodLiteral<"Bearer">>;
4
+ accessToken: z.ZodString;
5
+ expiresIn: z.ZodNumber;
6
+ refreshToken: z.ZodString;
7
+ refreshExpiresIn: z.ZodNumber;
8
+ unit: z.ZodLiteral<"SECONDS">;
9
+ }, z.core.$strip>;
10
+ export declare const RefreshTokenResponseSchema: z.ZodObject<{
11
+ accessToken: z.ZodString;
12
+ }, z.core.$strip>;
@@ -0,0 +1,64 @@
1
+ import { z } from 'zod';
2
+ export declare const CardTokenPaymentSchema: z.ZodObject<{
3
+ amount: z.ZodNumber;
4
+ }, z.core.$strip>;
5
+ export declare const CardTokenSubscriptionSchema: z.ZodObject<{
6
+ planId: z.ZodNumber;
7
+ cycleValue: z.ZodString;
8
+ cycles: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
9
+ payNow: z.ZodOptional<z.ZodBoolean>;
10
+ custEmail: z.ZodOptional<z.ZodString>;
11
+ }, z.core.$strip>;
12
+ export declare const CreateCardTokenRequestSchema: z.ZodObject<{
13
+ callback: z.ZodString;
14
+ transactionId: z.ZodString;
15
+ payment: z.ZodOptional<z.ZodObject<{
16
+ amount: z.ZodNumber;
17
+ }, z.core.$strip>>;
18
+ subscription: z.ZodOptional<z.ZodObject<{
19
+ planId: z.ZodNumber;
20
+ cycleValue: z.ZodString;
21
+ cycles: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
22
+ payNow: z.ZodOptional<z.ZodBoolean>;
23
+ custEmail: z.ZodOptional<z.ZodString>;
24
+ }, z.core.$strip>>;
25
+ items: z.ZodOptional<z.ZodArray<z.ZodObject<{
26
+ image: z.ZodOptional<z.ZodString>;
27
+ title: z.ZodString;
28
+ remark: z.ZodOptional<z.ZodString>;
29
+ amount: z.ZodNumber;
30
+ count: z.ZodNumber;
31
+ }, z.core.$strip>>>;
32
+ }, z.core.$strip>;
33
+ export declare const CreateCardTokenResponseSchema: z.ZodObject<{
34
+ followUpLink: z.ZodString;
35
+ id: z.ZodString;
36
+ }, z.core.$strip>;
37
+ export declare const BankInfoSchema: z.ZodObject<{
38
+ id: z.ZodNumber;
39
+ code: z.ZodString;
40
+ name: z.ZodString;
41
+ icon: z.ZodString;
42
+ iBanCode: z.ZodString;
43
+ transferCode: z.ZodString;
44
+ }, z.core.$strip>;
45
+ export declare const PurchaseRequestSchema: z.ZodObject<{
46
+ amount: z.ZodNumber;
47
+ currency: z.ZodString;
48
+ transactionId: z.ZodString;
49
+ }, z.core.$strip>;
50
+ export declare const PurchaseTransactionDataSchema: z.ZodObject<{
51
+ id: z.ZodNumber;
52
+ completedAt: z.ZodOptional<z.ZodString>;
53
+ status: z.ZodEnum<{
54
+ SUCCESS: "SUCCESS";
55
+ FAILED: "FAILED";
56
+ QUEUED: "QUEUED";
57
+ }>;
58
+ description: z.ZodOptional<z.ZodString>;
59
+ cardStatus: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
60
+ ACTIVE: "ACTIVE";
61
+ INACTIVE: "INACTIVE";
62
+ }>>>;
63
+ respCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
64
+ }, z.core.$strip>;
@@ -0,0 +1,11 @@
1
+ import { z } from 'zod';
2
+ export declare const BonumApiResponseSchema: z.ZodObject<{
3
+ traceId: z.ZodString;
4
+ errorCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
5
+ error: z.ZodOptional<z.ZodNullable<z.ZodString>>;
6
+ message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
7
+ data: z.ZodOptional<z.ZodNullable<z.ZodAny>>;
8
+ detail: z.ZodOptional<z.ZodNullable<z.ZodString>>;
9
+ duration: z.ZodNumber;
10
+ status: z.ZodNumber;
11
+ }, z.core.$strip>;
@@ -0,0 +1,17 @@
1
+ import { z } from 'zod';
2
+ export declare const BonumConfigSchema: z.ZodObject<{
3
+ baseUrl: z.ZodOptional<z.ZodString>;
4
+ appSecret: z.ZodString;
5
+ terminalId: z.ZodString;
6
+ checksumKey: z.ZodOptional<z.ZodString>;
7
+ language: z.ZodOptional<z.ZodEnum<{
8
+ mn: "mn";
9
+ en: "en";
10
+ }>>;
11
+ initialTokens: z.ZodOptional<z.ZodObject<{
12
+ accessToken: z.ZodString;
13
+ refreshToken: z.ZodString;
14
+ expiresIn: z.ZodNumber;
15
+ refreshExpiresIn: z.ZodNumber;
16
+ }, z.core.$strip>>;
17
+ }, z.core.$strip>;
@@ -0,0 +1,9 @@
1
+ export * from './config.js';
2
+ export * from './auth.js';
3
+ export * from './invoice.js';
4
+ export * from './qr.js';
5
+ export * from './card.js';
6
+ export * from './subscription.js';
7
+ export * from './neo.js';
8
+ export * from './common.js';
9
+ export * from './webhook.js';