@managemint-solutions/entities 1.1.21 → 1.1.22

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.
@@ -1,4 +1,14 @@
1
- import { BillingTransactionStatus } from "./enum";
1
+ import { BillingTransactionStatus, BillingTransactionType } from "./enum";
2
+ /**
3
+ * Day of the month every billing period is anchored on. The period containing a
4
+ * given date runs from the most recent 25th (inclusive) to the next 25th
5
+ * (exclusive) — the anchor day itself belongs to the new period.
6
+ */
7
+ export declare const BILLING_ANCHOR_DAY = 25;
8
+ export type BillingPeriod = {
9
+ start: Date;
10
+ end: Date;
11
+ };
2
12
  export type CreateBillingEventDto = {
3
13
  organization_id: string;
4
14
  billing_transaction_id: string | null;
@@ -8,12 +18,68 @@ export type CreateBillingEventDto = {
8
18
  idempotency_key: string | null;
9
19
  details: object;
10
20
  };
21
+ export type CreateTransactionInput = {
22
+ transactionType: BillingTransactionType;
23
+ amountMinor: number;
24
+ activeSeatCount: number;
25
+ paidSeatCount: number;
26
+ modules: string[];
27
+ userId: string | null;
28
+ idempotencyKey: string;
29
+ modulePriceSnapshot?: Record<string, number>;
30
+ prorationStartAt?: Date | null;
31
+ prorationEndAt?: Date | null;
32
+ /**
33
+ * Defaults to INITIALIZED. Pass PAID (with paidAt) for transactions recorded
34
+ * after the fact, e.g. subscription renewals reported by webhook — inserting
35
+ * them directly as paid keeps them out of the one-open-transaction-per-
36
+ * organization unique index.
37
+ */
38
+ transactionStatus?: BillingTransactionStatus;
39
+ paidAt?: Date | string | null;
40
+ paystackReference?: string | null;
41
+ };
42
+ export type BillingTransactionRow = {
43
+ mms_id: string;
44
+ transaction_type: BillingTransactionType;
45
+ transaction_status: BillingTransactionStatus;
46
+ amount_minor: number;
47
+ active_seat_count: number;
48
+ paid_seat_count: number;
49
+ };
11
50
  export type InitializeTransactionResponse = {
12
51
  mms_id: string;
13
52
  paystack_authorization_url: string;
14
53
  paystack_access_code: string;
15
54
  transaction_status: BillingTransactionStatus;
16
55
  };
56
+ /**
57
+ * Result of the reserve_organization_seat SQL function: a seat atomically claimed
58
+ * for the caller. active_seat_count is the reserved seat's number; seat_already_paid
59
+ * says whether paid_seat_count already covers it (no charge needed).
60
+ */
61
+ export type SeatReservation = {
62
+ active_seat_count: number;
63
+ paid_seat_count: number;
64
+ billing_status: string;
65
+ seat_already_paid: boolean;
66
+ };
67
+ export type ReinstateSubscriptionResponse = {
68
+ message: string;
69
+ /**
70
+ * Present when reinstating requires a pro-rata payment (the paid period has
71
+ * ended): the checkout the user must complete before the subscription is
72
+ * re-created.
73
+ */
74
+ transaction?: InitializeTransactionResponse;
75
+ };
76
+ export type PurchaseModuleResponse = {
77
+ message: string;
78
+ module_id: string;
79
+ module_key: string;
80
+ /** Pro-rata amount charged now for the new module across all active seats. */
81
+ amount_minor: number;
82
+ };
17
83
  export type UpdateCardDetails = {
18
84
  link: string;
19
85
  };
@@ -1,2 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BILLING_ANCHOR_DAY = void 0;
4
+ /**
5
+ * Day of the month every billing period is anchored on. The period containing a
6
+ * given date runs from the most recent 25th (inclusive) to the next 25th
7
+ * (exclusive) — the anchor day itself belongs to the new period.
8
+ */
9
+ exports.BILLING_ANCHOR_DAY = 25;
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Module keys the API gates features on. These MUST match billing_modules.module_key
3
+ * rows in the database — the database decides which modules exist and what they cost;
4
+ * this only declares which of them unlock which features.
5
+ *
6
+ * Module selection is never validated against this: requests carry module ids, which
7
+ * are checked against the active pricebook.
8
+ */
9
+ export declare const MODULE_KEYS: {
10
+ readonly CRM: 'CRM';
11
+ };
12
+ /**
13
+ * A row of the billing_modules catalog: one row per sellable module, no pricing.
14
+ * Prices live per pricebook (PricedModule).
15
+ */
16
+ export type BillingModule = {
17
+ mms_id: string;
18
+ module_key: string;
19
+ active: boolean;
20
+ };
21
+ /**
22
+ * A module priced by a specific pricebook (a pricebook_modules row joined with
23
+ * its catalog entry).
24
+ */
25
+ export type PricedModule = {
26
+ module_id: string;
27
+ module_key: string;
28
+ unit_amount_minor: number;
29
+ currency: string;
30
+ };
31
+ /**
32
+ * A frozen price list version. Exactly one pricebook is active at a time — the
33
+ * one new organizations are pinned to and the one an organization moves to when
34
+ * it buys a module. Organizations on older pricebooks keep paying those prices
35
+ * until they change something (grandfathering).
36
+ */
37
+ export type Pricebook = {
38
+ mms_id: string;
39
+ name: string;
40
+ active: boolean;
41
+ description: string | null;
42
+ };
43
+ export type PricebookWithModules = Pricebook & {
44
+ modules: PricedModule[];
45
+ };
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MODULE_KEYS = void 0;
4
+ /**
5
+ * Module keys the API gates features on. These MUST match billing_modules.module_key
6
+ * rows in the database — the database decides which modules exist and what they cost;
7
+ * this only declares which of them unlock which features.
8
+ *
9
+ * Module selection is never validated against this: requests carry module ids, which
10
+ * are checked against the active pricebook.
11
+ */
12
+ exports.MODULE_KEYS = {
13
+ CRM: 'CRM',
14
+ };
@@ -1,4 +1,3 @@
1
- import { Modules } from "../../modules/enum";
2
1
  import { OrganizationTypes } from "../enum";
3
2
  export type CreateOrganizationDto = {
4
3
  org_type: OrganizationTypes;
@@ -33,8 +32,8 @@ export type CreateOrganizationDto = {
33
32
  owner_country_code: string;
34
33
  owner_phone: string;
35
34
  owner_profile_image?: string | null;
36
- modules: Modules[];
37
- seats_needed: number;
35
+ /** Ids of the modules to subscribe to, validated against the active pricebook. */
36
+ module_ids: string[];
38
37
  };
39
38
  export type UpdateOrganizationDto = {
40
39
  type?: OrganizationTypes;
@@ -1,5 +1,5 @@
1
1
  import { UUID } from 'crypto';
2
- import { Modules } from '../modules/enum/index';
2
+ import { PricebookWithModules, PricedModule } from '../modules/index';
3
3
  import { UserIdentity } from '../users';
4
4
  import { BillingStatus } from '../billing/enum';
5
5
  export type OrganizationEntity = {
@@ -37,7 +37,13 @@ export type OrganizationEntity = {
37
37
  };
38
38
  leave_calendar_start_month: number;
39
39
  billing_cycle_locked: boolean;
40
- modules: Modules[];
40
+ /**
41
+ * The modules the organization subscribes to, priced at ITS pricebook's rates —
42
+ * i.e. what it actually pays, which may be an older pricebook than the active one.
43
+ */
44
+ modules: PricedModule[];
45
+ /** The price list the organization pays, with its per-module prices. */
46
+ pricebook: PricebookWithModules | null;
41
47
  payment_frequency: string;
42
48
  last_payment_date: Date;
43
49
  next_payment_date: Date;
@@ -0,0 +1,20 @@
1
+ export declare enum PaystackWebhookEvent {
2
+ INVOICE_CREATED = "invoice.create",
3
+ INVOICE_FAILED = "invoice.payment_failed",
4
+ INVOICE_UPDATED = "invoice.update",
5
+ REFUND_PENDING = "refund.pending",
6
+ REFUND_PROCESSING = "refund.processing",
7
+ REFUND_PROCESSED = "refund.processed",
8
+ REFUND_FAILED = "refund.failed",
9
+ SUBSCRIPTION_CREATED = "subscription.create",
10
+ SUBSCRIPTION_DISABLED = "subscription.disable",
11
+ SUBSCRIPTION_NOT_RENEWED = "subscription.not_renew",
12
+ SUBSCRIPTIONS_WITH_EXPIRING_CARDS = "subscription.expiring_cards",
13
+ TRANSACTION_SUCCESSFUL = "charge.success"
14
+ }
15
+ export declare enum PaystackWebhookProcessingStatus {
16
+ PROCESSING = "processing",
17
+ PROCESSED = "processed",
18
+ FAILED = "failed",
19
+ DUPLICATE = "ignored_duplicate"
20
+ }
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PaystackWebhookProcessingStatus = exports.PaystackWebhookEvent = void 0;
4
+ var PaystackWebhookEvent;
5
+ (function (PaystackWebhookEvent) {
6
+ PaystackWebhookEvent["INVOICE_CREATED"] = "invoice.create";
7
+ PaystackWebhookEvent["INVOICE_FAILED"] = "invoice.payment_failed";
8
+ PaystackWebhookEvent["INVOICE_UPDATED"] = "invoice.update";
9
+ PaystackWebhookEvent["REFUND_PENDING"] = "refund.pending";
10
+ PaystackWebhookEvent["REFUND_PROCESSING"] = "refund.processing";
11
+ PaystackWebhookEvent["REFUND_PROCESSED"] = "refund.processed";
12
+ PaystackWebhookEvent["REFUND_FAILED"] = "refund.failed";
13
+ PaystackWebhookEvent["SUBSCRIPTION_CREATED"] = "subscription.create";
14
+ PaystackWebhookEvent["SUBSCRIPTION_DISABLED"] = "subscription.disable";
15
+ PaystackWebhookEvent["SUBSCRIPTION_NOT_RENEWED"] = "subscription.not_renew";
16
+ PaystackWebhookEvent["SUBSCRIPTIONS_WITH_EXPIRING_CARDS"] = "subscription.expiring_cards";
17
+ PaystackWebhookEvent["TRANSACTION_SUCCESSFUL"] = "charge.success";
18
+ })(PaystackWebhookEvent || (exports.PaystackWebhookEvent = PaystackWebhookEvent = {}));
19
+ ;
20
+ var PaystackWebhookProcessingStatus;
21
+ (function (PaystackWebhookProcessingStatus) {
22
+ PaystackWebhookProcessingStatus["PROCESSING"] = "processing";
23
+ PaystackWebhookProcessingStatus["PROCESSED"] = "processed";
24
+ PaystackWebhookProcessingStatus["FAILED"] = "failed";
25
+ PaystackWebhookProcessingStatus["DUPLICATE"] = "ignored_duplicate";
26
+ })(PaystackWebhookProcessingStatus || (exports.PaystackWebhookProcessingStatus = PaystackWebhookProcessingStatus = {}));
@@ -0,0 +1,163 @@
1
+ export type PaystackReturn<T = any> = {
2
+ status: false;
3
+ message: string;
4
+ data: null;
5
+ } | {
6
+ status: true;
7
+ message: string;
8
+ data: T;
9
+ };
10
+ export type PaystackCustomerCreate = {
11
+ email: string;
12
+ first_name: string;
13
+ last_name: string;
14
+ metadata: {
15
+ organization_id: string;
16
+ };
17
+ phone?: string;
18
+ };
19
+ export type PaystackCustomerCreateResponse = {
20
+ email: string;
21
+ integration: number;
22
+ domain: string;
23
+ customer_code: string;
24
+ id: number;
25
+ identified: boolean;
26
+ identifications: null;
27
+ createdAt: string;
28
+ updatedAt: string;
29
+ };
30
+ export type PaystackPlanCreate = {
31
+ name: string;
32
+ amount: number;
33
+ interval: 'monthly';
34
+ description?: string;
35
+ send_invoices: boolean;
36
+ send_sms: boolean;
37
+ currency: string;
38
+ invoice_limit?: number;
39
+ };
40
+ export type PaystackPlanCreateResponse = {
41
+ name: string;
42
+ amount: number;
43
+ interval: string;
44
+ integration: string;
45
+ domain: string;
46
+ plan_code: string;
47
+ send_invoices: boolean;
48
+ send_sms: boolean;
49
+ hosted_page: boolean;
50
+ currency: string;
51
+ id: number;
52
+ createdAt: string;
53
+ updatedAt: string;
54
+ };
55
+ export type PaystackPlanUpdate = {
56
+ name?: string;
57
+ amount?: number;
58
+ interval?: 'monthly';
59
+ description?: string;
60
+ send_invoices?: boolean;
61
+ send_sms?: boolean;
62
+ currency?: string;
63
+ /**
64
+ * Paystack defaults this to true. When true the new amount is applied to
65
+ * subscriptions already on the plan, taking effect on their next billing cycle.
66
+ */
67
+ update_existing_subscriptions?: boolean;
68
+ };
69
+ export type PaystackSubscriptionCreate = {
70
+ customer: string;
71
+ plan: string;
72
+ authorization: string;
73
+ start_date: string;
74
+ };
75
+ export type PaystackSubscriptionCreateResponse = {
76
+ customer: number;
77
+ plan: string;
78
+ integration: number;
79
+ domain: string;
80
+ start: number;
81
+ status: string;
82
+ quantity: number;
83
+ amount: number;
84
+ authorization: {
85
+ authorization_code: string;
86
+ bin: string;
87
+ last4: string;
88
+ exp_month: string;
89
+ exp_year: string;
90
+ channel: string;
91
+ card_type: string;
92
+ bank: string;
93
+ country_code: string;
94
+ brand: string;
95
+ reusable: boolean;
96
+ signature: string;
97
+ account_name: string;
98
+ };
99
+ subscription_code: string;
100
+ email_token: string;
101
+ id: number;
102
+ createdAt: string;
103
+ updatedAt: string;
104
+ };
105
+ export type PaystackTransactionInitialize = {
106
+ amount: number;
107
+ email: string;
108
+ channels?: string[];
109
+ currency?: string;
110
+ reference?: string;
111
+ callback_url?: string;
112
+ plan?: string;
113
+ invoice_limit?: number;
114
+ metadata: {
115
+ organization_id: string;
116
+ idempotencyKey: string;
117
+ transactionId: string;
118
+ };
119
+ split_code?: string;
120
+ subaccount?: string;
121
+ transaction_charge?: number;
122
+ bearer?: string;
123
+ };
124
+ export type PaystackTransactionInitializeResponse = {
125
+ authorization_url: string;
126
+ access_code: string;
127
+ reference: string;
128
+ };
129
+ export type PaystackChargeAuthorization = {
130
+ email: string;
131
+ amount: number;
132
+ authorization_code: string;
133
+ currency?: string;
134
+ reference?: string;
135
+ metadata?: {
136
+ organization_id: string;
137
+ idempotencyKey: string;
138
+ transactionId: string;
139
+ };
140
+ };
141
+ export type PaystackChargeAuthorizationResponse = {
142
+ id: number;
143
+ /**
144
+ * A 2xx from Paystack only means the request was accepted. The money has only
145
+ * moved when this is 'success' — it can also be 'failed', 'pending', or a
146
+ * challenge state such as 'send_otp' when the authorization is not reusable.
147
+ */
148
+ status: string;
149
+ reference: string;
150
+ amount: number;
151
+ currency: string;
152
+ gateway_response: string;
153
+ paid_at: string | null;
154
+ channel: string;
155
+ authorization: {
156
+ authorization_code: string;
157
+ last4: string;
158
+ exp_month: string;
159
+ exp_year: string;
160
+ brand: string;
161
+ reusable: boolean;
162
+ };
163
+ };
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ // Types for the Paystack REST API as consumed by the api's Paystack wrapper.
3
+ // Kept separate from ./webhook, which describes the event payloads Paystack
4
+ // pushes to us.
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,326 @@
1
+ import { PaystackWebhookEvent } from '../enum';
2
+ export type PaystackAuthorization = {
3
+ authorization_code: string;
4
+ bin: number;
5
+ last4: number;
6
+ exp_month: number;
7
+ exp_year: number;
8
+ channel: string;
9
+ card_type: string;
10
+ bank: string;
11
+ country_code: string;
12
+ brand: string;
13
+ reusable: boolean;
14
+ signature: string;
15
+ account_name: string;
16
+ };
17
+ export type PaystackPlan = {
18
+ name: string;
19
+ plan_code: string;
20
+ description: string | null;
21
+ amount: number;
22
+ interval: string;
23
+ send_invoices: boolean;
24
+ send_sms: boolean;
25
+ currency: string;
26
+ };
27
+ export type PaystackSubscription = {
28
+ status: string;
29
+ subscription_code: string;
30
+ email_token: string;
31
+ amount: number;
32
+ cron_expression: string;
33
+ next_payment_date: string;
34
+ open_invoice: null;
35
+ };
36
+ export type PaystackCustomer = {
37
+ id: number;
38
+ first_name: string;
39
+ last_name: string;
40
+ email: string;
41
+ customer_code: string;
42
+ phone: string;
43
+ metadata: {
44
+ organization_id: string;
45
+ };
46
+ risk_action: string;
47
+ };
48
+ export type PaystackTransaction = {
49
+ reference: string;
50
+ status: string;
51
+ amount: number;
52
+ currency: string;
53
+ };
54
+ export type PaystackInvoiceCreatedEvent = {
55
+ event: PaystackWebhookEvent.INVOICE_CREATED;
56
+ data: {
57
+ domain: string;
58
+ invoice_code: string;
59
+ amount: number;
60
+ period_start: string;
61
+ period_end: string;
62
+ status: string;
63
+ paid: boolean;
64
+ paid_at: string;
65
+ description: string | null;
66
+ authorization: PaystackAuthorization;
67
+ subscription: PaystackSubscription;
68
+ customer: PaystackCustomer;
69
+ transaction: PaystackTransaction;
70
+ created_at: string;
71
+ };
72
+ };
73
+ export type PaystackInvoiceFailedEvent = {
74
+ event: PaystackWebhookEvent.INVOICE_FAILED;
75
+ data: {
76
+ domain: string;
77
+ invoice_code: string;
78
+ amount: number;
79
+ period_start: string;
80
+ period_end: string;
81
+ status: string;
82
+ paid: boolean;
83
+ paid_at: string | null;
84
+ description: string | null;
85
+ authorization: PaystackAuthorization;
86
+ subscription: PaystackSubscription;
87
+ customer: PaystackCustomer;
88
+ transaction: PaystackTransaction;
89
+ created_at: string;
90
+ };
91
+ };
92
+ export type PaystackInvoiceUpdatedEvent = {
93
+ event: PaystackWebhookEvent.INVOICE_UPDATED;
94
+ data: {
95
+ domain: string;
96
+ invoice_code: string;
97
+ amount: number;
98
+ period_start: string;
99
+ period_end: string;
100
+ status: string;
101
+ paid: boolean;
102
+ paid_at: string | null;
103
+ description: string | null;
104
+ authorization: PaystackAuthorization;
105
+ subscription: PaystackSubscription;
106
+ customer: PaystackCustomer;
107
+ transaction: PaystackTransaction;
108
+ created_at: string;
109
+ };
110
+ };
111
+ export type PaystackRefundPendingEvent = {
112
+ event: PaystackWebhookEvent.REFUND_PENDING;
113
+ data: {
114
+ status: string;
115
+ transaction_reference: string;
116
+ refund_reference: string | null;
117
+ amount: string;
118
+ currency: string;
119
+ processor: string;
120
+ customer: PaystackCustomer;
121
+ integration: number;
122
+ domain: string;
123
+ };
124
+ };
125
+ export type PaystackRefundProcessingEvent = {
126
+ event: PaystackWebhookEvent.REFUND_PROCESSING;
127
+ data: {
128
+ status: string;
129
+ transaction_reference: string;
130
+ refund_reference: string | null;
131
+ amount: number;
132
+ currency: string;
133
+ processor: string;
134
+ customer: PaystackCustomer;
135
+ integration: number;
136
+ domain: string;
137
+ };
138
+ };
139
+ export type PaystackRefundProcessedEvent = {
140
+ event: PaystackWebhookEvent.REFUND_PROCESSED;
141
+ data: {
142
+ status: string;
143
+ transaction_reference: string;
144
+ refund_reference: string | null;
145
+ amount: number;
146
+ currency: string;
147
+ processor: string;
148
+ customer: PaystackCustomer;
149
+ integration: number;
150
+ domain: string;
151
+ };
152
+ };
153
+ export type PaystackRefundFailedEvent = {
154
+ event: PaystackWebhookEvent.REFUND_FAILED;
155
+ data: {
156
+ status: string;
157
+ transaction_reference: string;
158
+ refund_reference: string | null;
159
+ amount: number;
160
+ currency: string;
161
+ processor: string;
162
+ customer: PaystackCustomer;
163
+ integration: number;
164
+ domain: string;
165
+ };
166
+ };
167
+ export type PaystackSubscriptionCreatedEvent = {
168
+ event: PaystackWebhookEvent.SUBSCRIPTION_CREATED;
169
+ data: {
170
+ id: number;
171
+ domain: string;
172
+ status: string;
173
+ subscription_code: string;
174
+ amount: number;
175
+ cron_expression: string;
176
+ next_payment_date: string;
177
+ open_invoice: string | null;
178
+ createdAt: string;
179
+ plan: PaystackPlan;
180
+ authorization: PaystackAuthorization;
181
+ customer: PaystackCustomer;
182
+ created_at: string;
183
+ email_token: string;
184
+ };
185
+ };
186
+ export type PaystackSubscriptionDisabledEvent = {
187
+ event: PaystackWebhookEvent.SUBSCRIPTION_DISABLED;
188
+ data: {
189
+ domain: string;
190
+ status: string;
191
+ subscription_code: string;
192
+ email_token: string;
193
+ amount: number;
194
+ cron_expression: string;
195
+ next_payment_date: string;
196
+ open_invoice: string | null;
197
+ plan: PaystackPlan;
198
+ authorization: PaystackAuthorization;
199
+ customer: PaystackCustomer;
200
+ created_at: string;
201
+ };
202
+ };
203
+ export type PaystackSubscriptionNotRenewedEvent = {
204
+ event: PaystackWebhookEvent.SUBSCRIPTION_NOT_RENEWED;
205
+ data: {
206
+ id: number;
207
+ domain: string;
208
+ status: string;
209
+ subscription_code: string;
210
+ email_token: string;
211
+ amount: number;
212
+ cron_expression: string;
213
+ next_payment_date: string | null;
214
+ open_invoice: string | null;
215
+ integration: number;
216
+ plan: PaystackPlan;
217
+ authorization: PaystackAuthorization;
218
+ customer: PaystackCustomer;
219
+ invoices: [];
220
+ invoices_history: [];
221
+ invoice_limit: 0;
222
+ split_code: null;
223
+ most_recent_invoice: null;
224
+ created_at: string;
225
+ };
226
+ };
227
+ export type PaystackSubscriptionsWithExpiringCardsEvent = {
228
+ event: PaystackWebhookEvent.SUBSCRIPTIONS_WITH_EXPIRING_CARDS;
229
+ data: [
230
+ {
231
+ expiry_date: string;
232
+ description: string;
233
+ brand: string;
234
+ subscription: {
235
+ id: number;
236
+ subscription_code: string;
237
+ amount: number;
238
+ next_payment_date: string;
239
+ plan: PaystackPlan;
240
+ };
241
+ customer: PaystackCustomer;
242
+ }
243
+ ];
244
+ };
245
+ export type PaystackTransactionSuccessfulEvent = {
246
+ event: PaystackWebhookEvent.TRANSACTION_SUCCESSFUL;
247
+ data: {
248
+ id: number;
249
+ domain: string;
250
+ status: string;
251
+ reference: string;
252
+ amount: number;
253
+ message: string | null;
254
+ gateway_response: string;
255
+ paid_at: string;
256
+ created_at: string;
257
+ channel: string;
258
+ currency: string;
259
+ ip_address: string;
260
+ /**
261
+ * Only present on transactions we initialize ourselves. Paystack raises
262
+ * charge.success for subscription renewals too, and those carry no metadata.
263
+ */
264
+ metadata?: {
265
+ organization_id: string;
266
+ idempotencyKey: string;
267
+ transactionId: string;
268
+ };
269
+ log: {
270
+ time_spent: number;
271
+ attempts: number;
272
+ authentication: string;
273
+ errors: number;
274
+ success: boolean;
275
+ mobile: boolean;
276
+ input: unknown[];
277
+ channel: string | null;
278
+ history: {
279
+ type: string;
280
+ message: string;
281
+ time: number;
282
+ }[];
283
+ };
284
+ fees: null;
285
+ customer: PaystackCustomer;
286
+ authorization: PaystackAuthorization;
287
+ plan: PaystackPlan;
288
+ };
289
+ };
290
+ export type PaystackWebhookEventPayload = {
291
+ event: PaystackWebhookEvent.INVOICE_CREATED;
292
+ data: PaystackInvoiceCreatedEvent['data'];
293
+ } | {
294
+ event: PaystackWebhookEvent.INVOICE_FAILED;
295
+ data: PaystackInvoiceFailedEvent['data'];
296
+ } | {
297
+ event: PaystackWebhookEvent.INVOICE_UPDATED;
298
+ data: PaystackInvoiceUpdatedEvent['data'];
299
+ } | {
300
+ event: PaystackWebhookEvent.REFUND_PENDING;
301
+ data: PaystackRefundPendingEvent['data'];
302
+ } | {
303
+ event: PaystackWebhookEvent.REFUND_PROCESSING;
304
+ data: PaystackRefundProcessingEvent['data'];
305
+ } | {
306
+ event: PaystackWebhookEvent.REFUND_PROCESSED;
307
+ data: PaystackRefundProcessedEvent['data'];
308
+ } | {
309
+ event: PaystackWebhookEvent.REFUND_FAILED;
310
+ data: PaystackRefundFailedEvent['data'];
311
+ } | {
312
+ event: PaystackWebhookEvent.SUBSCRIPTION_CREATED;
313
+ data: PaystackSubscriptionCreatedEvent['data'];
314
+ } | {
315
+ event: PaystackWebhookEvent.SUBSCRIPTION_DISABLED;
316
+ data: PaystackSubscriptionDisabledEvent['data'];
317
+ } | {
318
+ event: PaystackWebhookEvent.SUBSCRIPTION_NOT_RENEWED;
319
+ data: PaystackSubscriptionNotRenewedEvent['data'];
320
+ } | {
321
+ event: PaystackWebhookEvent.SUBSCRIPTIONS_WITH_EXPIRING_CARDS;
322
+ data: PaystackSubscriptionsWithExpiringCardsEvent['data'];
323
+ } | {
324
+ event: PaystackWebhookEvent.TRANSACTION_SUCCESSFUL;
325
+ data: PaystackTransactionSuccessfulEvent['data'];
326
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@managemint-solutions/entities",
3
- "version": "1.1.21",
3
+ "version": "1.1.22",
4
4
  "description": "Entity types used by both the api and portal",
5
5
  "homepage": "https://github.com/ManageMint-Solutions/managemint-solutions-entities#readme",
6
6
  "bugs": {
@@ -1,3 +0,0 @@
1
- export declare enum Modules {
2
- CRM = "CRM"
3
- }
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Modules = void 0;
4
- var Modules;
5
- (function (Modules) {
6
- Modules["CRM"] = "CRM";
7
- })(Modules || (exports.Modules = Modules = {}));
8
- ;