@managemint-solutions/entities 1.1.26 → 1.1.27

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.
@@ -39,3 +39,44 @@ export declare enum BillingEventSource {
39
39
  WEBHOOK = "webhook",
40
40
  SCHEDULER = "scheduler"
41
41
  }
42
+ /**
43
+ * Billing ledger event names — the values written to billing_events.event_type.
44
+ * Distinct from BillingStatus (which is the organization's current billing state)
45
+ * even though a couple of values coincide, e.g. cancellation_requested.
46
+ */
47
+ export declare enum BillingEventType {
48
+ CHECKOUT_RESUMED = "checkout_resumed",
49
+ CHECKOUT_FAILED = "checkout_failed",
50
+ CHECKOUT_CREATED = "checkout_created",
51
+ IDEMPOTENCY_KEY_REPLAYED = "idempotency_key_replayed",
52
+ TRANSACTION_INITIALIZED = "transaction_initialized",
53
+ SEAT_CHARGE_FAILED = "seat_charge_failed",
54
+ SEAT_CHARGED = "seat_charged",
55
+ MODULE_PURCHASE_FAILED = "module_purchase_failed",
56
+ MODULE_PURCHASED = "module_purchased",
57
+ PLAN_RESIZED = "plan_resized",
58
+ CANCELLATION_REQUESTED = "cancellation_requested",
59
+ CANCELLATION_REQUEST_FAILED = "cancellation_request_failed",
60
+ PAYSTACK_SUBSCRIPTION_DISABLE_REQUESTED = "paystack_subscription_disable_requested",
61
+ REINSTATEMENT_REQUESTED = "reinstatement_requested",
62
+ CARD_UPDATE_LINK_ISSUED = "card_update_link_issued",
63
+ REINSTATEMENT_SUBSCRIPTION_CREATE_FAILED = "reinstatement_subscription_create_failed",
64
+ PAYSTACK_SUBSCRIPTION_REQUESTED = "paystack_subscription_requested",
65
+ PAYSTACK_SUBSCRIPTION_ADOPTED = "paystack_subscription_adopted",
66
+ PAYSTACK_CUSTOMER_CREATED = "paystack_customer_created",
67
+ PAYSTACK_CUSTOMER_ADOPTED = "paystack_customer_adopted",
68
+ PAYSTACK_PLAN_CREATED = "paystack_plan_created",
69
+ PROVISIONING_STEP_FAILED = "provisioning_step_failed",
70
+ CHARGE_SUCCESS_PROCESSED = "charge_success_processed",
71
+ RENEWAL_RECORDED_STALE_SUBSCRIPTION = "renewal_recorded_stale_subscription",
72
+ RENEWAL_RECORDED = "renewal_recorded",
73
+ SUBSCRIPTION_CREATE_IGNORED_STALE = "subscription_create_ignored_stale",
74
+ SUBSCRIPTION_ACTIVATED = "subscription_activated",
75
+ INVOICE_PAYMENT_FAILED = "invoice_payment_failed",
76
+ CANCELLATION_SCHEDULED = "cancellation_scheduled",
77
+ WEBHOOK_IGNORED_UNEXPECTED_STATUS = "webhook_ignored_unexpected_status",
78
+ SUBSCRIPTION_CANCELLED = "subscription_cancelled",
79
+ CARD_EXPIRING_SOON = "card_expiring_soon",
80
+ WEBHOOK_IGNORED_STALE_SUBSCRIPTION = "webhook_ignored_stale_subscription",
81
+ SEAT_RELEASED = "seat_released"
82
+ }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BillingEventSource = exports.PaystackWebhookProcessingStatus = exports.BillingTransactionStatus = exports.BillingTransactionType = exports.BillingStatus = void 0;
3
+ exports.BillingEventType = exports.BillingEventSource = exports.PaystackWebhookProcessingStatus = exports.BillingTransactionStatus = exports.BillingTransactionType = exports.BillingStatus = void 0;
4
4
  var BillingStatus;
5
5
  (function (BillingStatus) {
6
6
  BillingStatus["PENDING_CUSTOMER_CREATION"] = "pending_customer_creation";
@@ -52,3 +52,46 @@ var BillingEventSource;
52
52
  BillingEventSource["SCHEDULER"] = "scheduler";
53
53
  })(BillingEventSource || (exports.BillingEventSource = BillingEventSource = {}));
54
54
  ;
55
+ /**
56
+ * Billing ledger event names — the values written to billing_events.event_type.
57
+ * Distinct from BillingStatus (which is the organization's current billing state)
58
+ * even though a couple of values coincide, e.g. cancellation_requested.
59
+ */
60
+ var BillingEventType;
61
+ (function (BillingEventType) {
62
+ BillingEventType["CHECKOUT_RESUMED"] = "checkout_resumed";
63
+ BillingEventType["CHECKOUT_FAILED"] = "checkout_failed";
64
+ BillingEventType["CHECKOUT_CREATED"] = "checkout_created";
65
+ BillingEventType["IDEMPOTENCY_KEY_REPLAYED"] = "idempotency_key_replayed";
66
+ BillingEventType["TRANSACTION_INITIALIZED"] = "transaction_initialized";
67
+ BillingEventType["SEAT_CHARGE_FAILED"] = "seat_charge_failed";
68
+ BillingEventType["SEAT_CHARGED"] = "seat_charged";
69
+ BillingEventType["MODULE_PURCHASE_FAILED"] = "module_purchase_failed";
70
+ BillingEventType["MODULE_PURCHASED"] = "module_purchased";
71
+ BillingEventType["PLAN_RESIZED"] = "plan_resized";
72
+ BillingEventType["CANCELLATION_REQUESTED"] = "cancellation_requested";
73
+ BillingEventType["CANCELLATION_REQUEST_FAILED"] = "cancellation_request_failed";
74
+ BillingEventType["PAYSTACK_SUBSCRIPTION_DISABLE_REQUESTED"] = "paystack_subscription_disable_requested";
75
+ BillingEventType["REINSTATEMENT_REQUESTED"] = "reinstatement_requested";
76
+ BillingEventType["CARD_UPDATE_LINK_ISSUED"] = "card_update_link_issued";
77
+ BillingEventType["REINSTATEMENT_SUBSCRIPTION_CREATE_FAILED"] = "reinstatement_subscription_create_failed";
78
+ BillingEventType["PAYSTACK_SUBSCRIPTION_REQUESTED"] = "paystack_subscription_requested";
79
+ BillingEventType["PAYSTACK_SUBSCRIPTION_ADOPTED"] = "paystack_subscription_adopted";
80
+ BillingEventType["PAYSTACK_CUSTOMER_CREATED"] = "paystack_customer_created";
81
+ BillingEventType["PAYSTACK_CUSTOMER_ADOPTED"] = "paystack_customer_adopted";
82
+ BillingEventType["PAYSTACK_PLAN_CREATED"] = "paystack_plan_created";
83
+ BillingEventType["PROVISIONING_STEP_FAILED"] = "provisioning_step_failed";
84
+ BillingEventType["CHARGE_SUCCESS_PROCESSED"] = "charge_success_processed";
85
+ BillingEventType["RENEWAL_RECORDED_STALE_SUBSCRIPTION"] = "renewal_recorded_stale_subscription";
86
+ BillingEventType["RENEWAL_RECORDED"] = "renewal_recorded";
87
+ BillingEventType["SUBSCRIPTION_CREATE_IGNORED_STALE"] = "subscription_create_ignored_stale";
88
+ BillingEventType["SUBSCRIPTION_ACTIVATED"] = "subscription_activated";
89
+ BillingEventType["INVOICE_PAYMENT_FAILED"] = "invoice_payment_failed";
90
+ BillingEventType["CANCELLATION_SCHEDULED"] = "cancellation_scheduled";
91
+ BillingEventType["WEBHOOK_IGNORED_UNEXPECTED_STATUS"] = "webhook_ignored_unexpected_status";
92
+ BillingEventType["SUBSCRIPTION_CANCELLED"] = "subscription_cancelled";
93
+ BillingEventType["CARD_EXPIRING_SOON"] = "card_expiring_soon";
94
+ BillingEventType["WEBHOOK_IGNORED_STALE_SUBSCRIPTION"] = "webhook_ignored_stale_subscription";
95
+ BillingEventType["SEAT_RELEASED"] = "seat_released";
96
+ })(BillingEventType || (exports.BillingEventType = BillingEventType = {}));
97
+ ;
@@ -1,4 +1,4 @@
1
- import { BillingTransactionStatus, BillingTransactionType } from "./enum";
1
+ import { BillingEventSource, BillingEventType, BillingTransactionStatus, BillingTransactionType } from "./enum";
2
2
  /**
3
3
  * Day of the month every billing period is anchored on. The period containing a
4
4
  * given date runs from the most recent 25th (inclusive) to the next 25th
@@ -12,8 +12,8 @@ export type BillingPeriod = {
12
12
  export type CreateBillingEventDto = {
13
13
  organization_id: string;
14
14
  billing_transaction_id: string | null;
15
- event_type: string;
16
- event_source: string;
15
+ event_type: BillingEventType;
16
+ event_source: BillingEventSource;
17
17
  created_by: string | null;
18
18
  idempotency_key: string | null;
19
19
  details: object;
@@ -2,3 +2,10 @@ export declare enum OrganizationTypes {
2
2
  COMPANY = "Company",
3
3
  SOLE_TRADER = "Sole-Trader"
4
4
  }
5
+ /**
6
+ * How often an organization is billed. Only monthly billing exists today — add
7
+ * members when the product supports more.
8
+ */
9
+ export declare enum PaymentFrequency {
10
+ MONTHLY = "monthly"
11
+ }
@@ -1,9 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.OrganizationTypes = void 0;
3
+ exports.PaymentFrequency = exports.OrganizationTypes = void 0;
4
4
  var OrganizationTypes;
5
5
  (function (OrganizationTypes) {
6
6
  OrganizationTypes["COMPANY"] = "Company";
7
7
  OrganizationTypes["SOLE_TRADER"] = "Sole-Trader";
8
8
  })(OrganizationTypes || (exports.OrganizationTypes = OrganizationTypes = {}));
9
9
  ;
10
+ /**
11
+ * How often an organization is billed. Only monthly billing exists today — add
12
+ * members when the product supports more.
13
+ */
14
+ var PaymentFrequency;
15
+ (function (PaymentFrequency) {
16
+ PaymentFrequency["MONTHLY"] = "monthly";
17
+ })(PaymentFrequency || (exports.PaymentFrequency = PaymentFrequency = {}));
18
+ ;
@@ -2,6 +2,7 @@ import { UUID } from 'crypto';
2
2
  import { PricebookWithModules, PricedModule } from '../modules/index';
3
3
  import { UserIdentity } from '../users';
4
4
  import { BillingStatus } from '../billing/enum';
5
+ import { PaymentFrequency } from './enum';
5
6
  export type OrganizationEntity = {
6
7
  mms_id: UUID;
7
8
  created_at: Date;
@@ -44,7 +45,7 @@ export type OrganizationEntity = {
44
45
  modules: PricedModule[];
45
46
  /** The price list the organization pays, with its per-module prices. */
46
47
  pricebook: PricebookWithModules | null;
47
- payment_frequency: string;
48
+ payment_frequency: PaymentFrequency;
48
49
  last_payment_date: Date;
49
50
  next_payment_date: Date;
50
51
  payment_status: BillingStatus;
@@ -12,3 +12,28 @@ export declare enum PaystackWebhookEvent {
12
12
  SUBSCRIPTIONS_WITH_EXPIRING_CARDS = "subscription.expiring_cards",
13
13
  TRANSACTION_SUCCESSFUL = "charge.success"
14
14
  }
15
+ /**
16
+ * Paystack's own subscription vocabulary — an external contract we do not own, so
17
+ * this is not necessarily exhaustive. Provided for comparison sites only; the
18
+ * `status` fields on the payload interfaces deliberately stay `string`.
19
+ */
20
+ export declare enum PaystackSubscriptionStatus {
21
+ ACTIVE = "active",
22
+ NON_RENEWING = "non-renewing",
23
+ ATTENTION = "attention",
24
+ COMPLETED = "completed",
25
+ CANCELLED = "cancelled"
26
+ }
27
+ /**
28
+ * Paystack's own transaction vocabulary — an external contract we do not own, so
29
+ * this is not necessarily exhaustive. Provided for comparison sites only; the
30
+ * `status` fields on the payload interfaces deliberately stay `string`.
31
+ * Only SUCCESS means the charge completed and the money moved.
32
+ */
33
+ export declare enum PaystackTransactionStatus {
34
+ SUCCESS = "success",
35
+ FAILED = "failed",
36
+ PENDING = "pending",
37
+ SEND_OTP = "send_otp",
38
+ ABANDONED = "abandoned"
39
+ }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PaystackWebhookEvent = void 0;
3
+ exports.PaystackTransactionStatus = exports.PaystackSubscriptionStatus = exports.PaystackWebhookEvent = void 0;
4
4
  var PaystackWebhookEvent;
5
5
  (function (PaystackWebhookEvent) {
6
6
  PaystackWebhookEvent["INVOICE_CREATED"] = "invoice.create";
@@ -17,3 +17,32 @@ var PaystackWebhookEvent;
17
17
  PaystackWebhookEvent["TRANSACTION_SUCCESSFUL"] = "charge.success";
18
18
  })(PaystackWebhookEvent || (exports.PaystackWebhookEvent = PaystackWebhookEvent = {}));
19
19
  ;
20
+ /**
21
+ * Paystack's own subscription vocabulary — an external contract we do not own, so
22
+ * this is not necessarily exhaustive. Provided for comparison sites only; the
23
+ * `status` fields on the payload interfaces deliberately stay `string`.
24
+ */
25
+ var PaystackSubscriptionStatus;
26
+ (function (PaystackSubscriptionStatus) {
27
+ PaystackSubscriptionStatus["ACTIVE"] = "active";
28
+ PaystackSubscriptionStatus["NON_RENEWING"] = "non-renewing";
29
+ PaystackSubscriptionStatus["ATTENTION"] = "attention";
30
+ PaystackSubscriptionStatus["COMPLETED"] = "completed";
31
+ PaystackSubscriptionStatus["CANCELLED"] = "cancelled";
32
+ })(PaystackSubscriptionStatus || (exports.PaystackSubscriptionStatus = PaystackSubscriptionStatus = {}));
33
+ ;
34
+ /**
35
+ * Paystack's own transaction vocabulary — an external contract we do not own, so
36
+ * this is not necessarily exhaustive. Provided for comparison sites only; the
37
+ * `status` fields on the payload interfaces deliberately stay `string`.
38
+ * Only SUCCESS means the charge completed and the money moved.
39
+ */
40
+ var PaystackTransactionStatus;
41
+ (function (PaystackTransactionStatus) {
42
+ PaystackTransactionStatus["SUCCESS"] = "success";
43
+ PaystackTransactionStatus["FAILED"] = "failed";
44
+ PaystackTransactionStatus["PENDING"] = "pending";
45
+ PaystackTransactionStatus["SEND_OTP"] = "send_otp";
46
+ PaystackTransactionStatus["ABANDONED"] = "abandoned";
47
+ })(PaystackTransactionStatus || (exports.PaystackTransactionStatus = PaystackTransactionStatus = {}));
48
+ ;
@@ -141,9 +141,10 @@ export type PaystackChargeAuthorization = {
141
141
  export type PaystackChargeAuthorizationResponse = {
142
142
  id: number;
143
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.
144
+ * A 2xx from Paystack only means the request was accepted. See
145
+ * PaystackTransactionStatus; only PaystackTransactionStatus.SUCCESS means the
146
+ * charge completed and the money moved the rest are failure, pending, or
147
+ * challenge states such as SEND_OTP when the authorization is not reusable.
147
148
  */
148
149
  status: string;
149
150
  reference: string;
@@ -0,0 +1,5 @@
1
+ export declare enum TimesheetStatus {
2
+ SUBMITTED = "submitted",
3
+ APPROVED = "approved",
4
+ REJECTED = "rejected"
5
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TimesheetStatus = void 0;
4
+ var TimesheetStatus;
5
+ (function (TimesheetStatus) {
6
+ TimesheetStatus["SUBMITTED"] = "submitted";
7
+ TimesheetStatus["APPROVED"] = "approved";
8
+ TimesheetStatus["REJECTED"] = "rejected";
9
+ })(TimesheetStatus || (exports.TimesheetStatus = TimesheetStatus = {}));
10
+ ;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@managemint-solutions/entities",
3
- "version": "1.1.26",
3
+ "version": "1.1.27",
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": {