@managemint-solutions/entities 1.23.0 → 1.24.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.
@@ -15,7 +15,19 @@ export declare enum BillingTransactionType {
15
15
  INITIAL = "initial",
16
16
  PRORATA = "prorata",
17
17
  RENEWAL = "renewal",
18
- REINSTATEMENT = "reinstatement"
18
+ REINSTATEMENT = "reinstatement",
19
+ /**
20
+ * The small charge Paystack's hosted card-update page makes to tokenise a new
21
+ * card (metadata.transaction_type = 'update_card'). Paystack refunds it at once;
22
+ * the row exists so the refund has something to land on. Never an invoice.
23
+ */
24
+ CARD_VERIFICATION = "card_verification",
25
+ /**
26
+ * Money that landed but matched nothing we recognise: no tag of ours, no Paystack
27
+ * hosted-page tag, no plan matching the organization's. Recorded ledger-first with an
28
+ * alert; it never moves billing status, seats or modules.
29
+ */
30
+ UNCLASSIFIED = "unclassified"
19
31
  }
20
32
  export declare enum BillingTransactionStatus {
21
33
  INITIALIZED = "initialized",
@@ -24,7 +36,16 @@ export declare enum BillingTransactionStatus {
24
36
  PAID = "paid",
25
37
  FAILED = "failed",
26
38
  CANCELLED = "cancelled",
27
- EXPIRED = "expired"
39
+ EXPIRED = "expired",
40
+ /** Paystack has accepted a refund of a paid row (refund.pending / refund.processing). */
41
+ REFUND_PENDING = "refund_pending",
42
+ /** The refund settled (refund.processed); refunded_at and refund_amount_minor are set. */
43
+ REFUNDED = "refunded",
44
+ /**
45
+ * A renewal Paystack has announced (invoice.create) but not yet charged. Not an open
46
+ * transaction: it never holds the one-open-transaction slot.
47
+ */
48
+ SCHEDULED = "scheduled"
28
49
  }
29
50
  export declare enum PaystackWebhookProcessingStatus {
30
51
  RECEIVED = "received",
@@ -78,5 +99,23 @@ export declare enum BillingEventType {
78
99
  SUBSCRIPTION_CANCELLED = "subscription_cancelled",
79
100
  CARD_EXPIRING_SOON = "card_expiring_soon",
80
101
  WEBHOOK_IGNORED_STALE_SUBSCRIPTION = "webhook_ignored_stale_subscription",
81
- SEAT_RELEASED = "seat_released"
102
+ SEAT_RELEASED = "seat_released",
103
+ /** invoice.payment_failed wrote the failed renewal to the ledger and issued its invoice as failed. */
104
+ RENEWAL_FAILED_RECORDED = "renewal_failed_recorded",
105
+ /** A charge.success from Paystack's card-update page was recorded as a card verification, not a renewal. */
106
+ CARD_VERIFICATION_RECORDED = "card_verification_recorded",
107
+ /** A refund event moved a ledger row; details carry the Paystack refund status. */
108
+ REFUND_RECORDED = "refund_recorded",
109
+ REFUND_FAILED = "refund_failed",
110
+ /** The api charged the saved card for a failed renewal invoice (after a card update or on request). */
111
+ RENEWAL_RETRY_CHARGED = "renewal_retry_charged",
112
+ RENEWAL_RETRY_FAILED = "renewal_retry_failed",
113
+ /** invoice.create opened a scheduled renewal row and invoice for the coming charge. */
114
+ RENEWAL_SCHEDULED = "renewal_scheduled",
115
+ /** invoice.update linked Paystack's invoice code and period onto a renewal the charge had already settled. */
116
+ RENEWAL_INVOICE_LINKED = "renewal_invoice_linked",
117
+ /** A charge.success matched nothing we recognise and was recorded as unclassified. */
118
+ UNCLASSIFIED_CHARGE_RECORDED = "unclassified_charge_recorded",
119
+ /** A retry found a row stuck in pending_payment and settled it from Paystack's verify answer. */
120
+ RENEWAL_RETRY_RECONCILED = "renewal_retry_reconciled"
82
121
  }
@@ -22,6 +22,18 @@ var BillingTransactionType;
22
22
  BillingTransactionType["PRORATA"] = "prorata";
23
23
  BillingTransactionType["RENEWAL"] = "renewal";
24
24
  BillingTransactionType["REINSTATEMENT"] = "reinstatement";
25
+ /**
26
+ * The small charge Paystack's hosted card-update page makes to tokenise a new
27
+ * card (metadata.transaction_type = 'update_card'). Paystack refunds it at once;
28
+ * the row exists so the refund has something to land on. Never an invoice.
29
+ */
30
+ BillingTransactionType["CARD_VERIFICATION"] = "card_verification";
31
+ /**
32
+ * Money that landed but matched nothing we recognise: no tag of ours, no Paystack
33
+ * hosted-page tag, no plan matching the organization's. Recorded ledger-first with an
34
+ * alert; it never moves billing status, seats or modules.
35
+ */
36
+ BillingTransactionType["UNCLASSIFIED"] = "unclassified";
25
37
  })(BillingTransactionType || (exports.BillingTransactionType = BillingTransactionType = {}));
26
38
  ;
27
39
  var BillingTransactionStatus;
@@ -33,6 +45,15 @@ var BillingTransactionStatus;
33
45
  BillingTransactionStatus["FAILED"] = "failed";
34
46
  BillingTransactionStatus["CANCELLED"] = "cancelled";
35
47
  BillingTransactionStatus["EXPIRED"] = "expired";
48
+ /** Paystack has accepted a refund of a paid row (refund.pending / refund.processing). */
49
+ BillingTransactionStatus["REFUND_PENDING"] = "refund_pending";
50
+ /** The refund settled (refund.processed); refunded_at and refund_amount_minor are set. */
51
+ BillingTransactionStatus["REFUNDED"] = "refunded";
52
+ /**
53
+ * A renewal Paystack has announced (invoice.create) but not yet charged. Not an open
54
+ * transaction: it never holds the one-open-transaction slot.
55
+ */
56
+ BillingTransactionStatus["SCHEDULED"] = "scheduled";
36
57
  })(BillingTransactionStatus || (exports.BillingTransactionStatus = BillingTransactionStatus = {}));
37
58
  ;
38
59
  var PaystackWebhookProcessingStatus;
@@ -93,5 +114,23 @@ var BillingEventType;
93
114
  BillingEventType["CARD_EXPIRING_SOON"] = "card_expiring_soon";
94
115
  BillingEventType["WEBHOOK_IGNORED_STALE_SUBSCRIPTION"] = "webhook_ignored_stale_subscription";
95
116
  BillingEventType["SEAT_RELEASED"] = "seat_released";
117
+ /** invoice.payment_failed wrote the failed renewal to the ledger and issued its invoice as failed. */
118
+ BillingEventType["RENEWAL_FAILED_RECORDED"] = "renewal_failed_recorded";
119
+ /** A charge.success from Paystack's card-update page was recorded as a card verification, not a renewal. */
120
+ BillingEventType["CARD_VERIFICATION_RECORDED"] = "card_verification_recorded";
121
+ /** A refund event moved a ledger row; details carry the Paystack refund status. */
122
+ BillingEventType["REFUND_RECORDED"] = "refund_recorded";
123
+ BillingEventType["REFUND_FAILED"] = "refund_failed";
124
+ /** The api charged the saved card for a failed renewal invoice (after a card update or on request). */
125
+ BillingEventType["RENEWAL_RETRY_CHARGED"] = "renewal_retry_charged";
126
+ BillingEventType["RENEWAL_RETRY_FAILED"] = "renewal_retry_failed";
127
+ /** invoice.create opened a scheduled renewal row and invoice for the coming charge. */
128
+ BillingEventType["RENEWAL_SCHEDULED"] = "renewal_scheduled";
129
+ /** invoice.update linked Paystack's invoice code and period onto a renewal the charge had already settled. */
130
+ BillingEventType["RENEWAL_INVOICE_LINKED"] = "renewal_invoice_linked";
131
+ /** A charge.success matched nothing we recognise and was recorded as unclassified. */
132
+ BillingEventType["UNCLASSIFIED_CHARGE_RECORDED"] = "unclassified_charge_recorded";
133
+ /** A retry found a row stuck in pending_payment and settled it from Paystack's verify answer. */
134
+ BillingEventType["RENEWAL_RETRY_RECONCILED"] = "renewal_retry_reconciled";
96
135
  })(BillingEventType || (exports.BillingEventType = BillingEventType = {}));
97
136
  ;
@@ -33,6 +33,8 @@ export type InvoiceSummary = {
33
33
  export type InvoiceEntity = InvoiceSummary & {
34
34
  billing_transaction_id: string;
35
35
  paystack_reference: string | null;
36
+ /** Paystack's INV_… code for a subscription renewal; null for an invoice Paystack never named. */
37
+ paystack_invoice_code: string | null;
36
38
  period_start: string | null;
37
39
  period_end: string | null;
38
40
  line_items: InvoiceLineItem[];
@@ -14,6 +14,10 @@ export type PaymentSummary = {
14
14
  currency: string;
15
15
  paid_at: string | null;
16
16
  failure_reason: string | null;
17
+ /** Set when the row is `refunded`; null otherwise. */
18
+ refunded_at: string | null;
19
+ /** Minor units Paystack refunded; null until a refund settles. */
20
+ refund_amount_minor: number | null;
17
21
  };
18
22
  /** The full payment record behind GET /billing/payments/:paymentId. */
19
23
  export type PaymentEntity = PaymentSummary & {
@@ -242,6 +242,22 @@ export type PaystackSubscriptionsWithExpiringCardsEvent = {
242
242
  }
243
243
  ];
244
244
  };
245
+ /** The metadata block on a charge the api initialized (principle 4's round trip). */
246
+ export type PaystackOwnChargeMetadata = {
247
+ organization_id: string;
248
+ idempotencyKey: string;
249
+ transactionId: string;
250
+ };
251
+ /** The metadata block Paystack's own hosted pages attach, e.g. the card-update page. */
252
+ export type PaystackHostedPageChargeMetadata = {
253
+ /** 'update_card' on the card-update page's tokenising charge. */
254
+ transaction_type?: string;
255
+ custom_fields?: {
256
+ display_name: string;
257
+ variable_name: string;
258
+ value: string;
259
+ }[];
260
+ };
245
261
  export type PaystackTransactionSuccessfulEvent = {
246
262
  event: PaystackWebhookEvent.TRANSACTION_SUCCESSFUL;
247
263
  data: {
@@ -258,14 +274,16 @@ export type PaystackTransactionSuccessfulEvent = {
258
274
  currency: string;
259
275
  ip_address: string;
260
276
  /**
261
- * Only present on transactions we initialize ourselves. Paystack raises
262
- * charge.success for subscription renewals too, and those carry no metadata.
277
+ * Who raised the charge, read from what the metadata carries:
278
+ * - `transactionId` and friends: a transaction we initialized ourselves.
279
+ * - `transaction_type: 'update_card'`: the tokenising charge from Paystack's
280
+ * hosted card-update page, which Paystack refunds at once. It also carries
281
+ * `custom_fields` naming the subscription code.
282
+ * - Absent or empty: not ours. A subscription renewal is recognised by `plan`
283
+ * naming the organization's plan code, never by the missing metadata alone;
284
+ * anything else is recorded as unclassified.
263
285
  */
264
- metadata?: {
265
- organization_id: string;
266
- idempotencyKey: string;
267
- transactionId: string;
268
- };
286
+ metadata?: PaystackOwnChargeMetadata | PaystackHostedPageChargeMetadata;
269
287
  log: {
270
288
  time_spent: number;
271
289
  attempts: number;
@@ -16,6 +16,8 @@ export type TaskSummary = {
16
16
  status: StatusEntity | null;
17
17
  priority: number;
18
18
  assigned_to: UserIdentity | null;
19
+ project: ProjectIdentity | null;
20
+ client: ClientIdentity | null;
19
21
  };
20
22
  export type TaskEntity = {
21
23
  mms_id: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@managemint-solutions/entities",
3
- "version": "1.23.0",
3
+ "version": "1.24.0",
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": {