wedance-shared 1.0.210 → 1.0.212

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,4 +15,5 @@ export * from "./poll.js";
15
15
  export * from "./privateClass.js";
16
16
  export * from "./revenue.js";
17
17
  export * from "./school.js";
18
+ export * from "./transaction.js";
18
19
  export * from "./festivals/index.js";
@@ -16,6 +16,7 @@ export * from "./poll.js";
16
16
  export * from "./privateClass.js";
17
17
  export * from "./revenue.js";
18
18
  export * from "./school.js";
19
+ export * from "./transaction.js";
19
20
  // Re-export from subdirectories
20
21
  export * from "./festivals/index.js";
21
22
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAC5C,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAE5B,gCAAgC;AAChC,cAAc,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAC5C,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AAEjC,gCAAgC;AAChC,cAAc,sBAAsB,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { EventSummary } from "./event.js";
2
- import { MonetaryAmount, ProductType, TicketStatus, TicketTypeSummary } from "./ticket.js";
2
+ import { MonetaryAmount, PassAccessScope, ProductType, TicketStatus, TicketTypeSummary } from "./ticket.js";
3
3
  type PaymentMethod = "stripe" | "cash" | "card_in_person" | "bank_transfer" | "comp";
4
4
  export interface Pass {
5
5
  id: string;
@@ -37,6 +37,7 @@ export interface Pass {
37
37
  partnerFullName: string | null;
38
38
  createdAt: string;
39
39
  updatedAt: string;
40
+ accessScope: PassAccessScope;
40
41
  /**
41
42
  * For users without an account, the guest email and full name are stored here.
42
43
  */
@@ -127,6 +127,7 @@ export type TicketTypeBase = {
127
127
  * For the school classes, the id of the class
128
128
  */
129
129
  classId?: string | null;
130
+ accessScope: PassAccessScope;
130
131
  };
131
132
  /**
132
133
  * A ticket sold for one specific event. The only variant currently written in
@@ -139,6 +140,7 @@ export type EventTicketType = TicketTypeBase & {
139
140
  validityDays?: never;
140
141
  validFrom?: never;
141
142
  validUntil?: never;
143
+ accessScope: "event";
142
144
  /**
143
145
  * @deprecated Replaced by name
144
146
  */
@@ -215,6 +217,7 @@ export type TicketType = EventTicketType | DropInTicketType | PassTicketType | M
215
217
  */
216
218
  export type EventTicket = EventTicketType;
217
219
  export type ProductType = "event" | "drop_in" | "pass" | "membership" | "course";
220
+ export type PassAccessScope = "event" | "event_series" | "specific_class" | "school_classes";
218
221
  /**
219
222
  * Lightweight ticket-type projection for joins (e.g. on a Pass) where the full
220
223
  * {@link TicketType} is not needed.
@@ -0,0 +1,54 @@
1
+ import type { Pass } from "./pass.js";
2
+ /**
3
+ * A row in the money ledger. One per movement of money, never updated in place
4
+ * except to settle `status`. Every amount is in MINOR units (cents), in the
5
+ * transaction's own `currency`.
6
+ */
7
+ export type TransactionType = "payment" | "refund";
8
+ export type TransactionStatus = "pending" | "succeeded" | "failed";
9
+ /** Where the record came from: Stripe's API, or a staff member keying it in. */
10
+ export type TransactionSource = "stripe" | "manual";
11
+ /**
12
+ * The pass payment methods plus `mobilepay`, which Stripe offers at checkout but
13
+ * `passes.payment_method` has never been able to represent.
14
+ */
15
+ export type TransactionPaymentMethod = Pass["paymentMethod"] | "mobilepay";
16
+ export interface Transaction {
17
+ id: string;
18
+ organizerId: string;
19
+ /** Firebase uid of the payer, when they have an account. */
20
+ userId: string | null;
21
+ studentId: string | null;
22
+ passId: string | null;
23
+ /**
24
+ * The payment a refund reverses. Always set on a refund, always null on a
25
+ * payment.
26
+ */
27
+ parentTransactionId: string | null;
28
+ recordedByStaffId: string | null;
29
+ /** Firebase uid of whoever recorded it, for admins who are not school staff. */
30
+ recordedByUserId: string | null;
31
+ type: TransactionType;
32
+ status: TransactionStatus;
33
+ /** MINOR units, always positive. Direction comes from `type`. */
34
+ amount: number;
35
+ /**
36
+ * On a payment, the WeDance fee charged. On a refund, the fee returned to the
37
+ * payer — 0 in both refund modes, because WeDance always keeps its fee.
38
+ */
39
+ applicationFeeAmount: number;
40
+ /** `amount - applicationFeeAmount`. Derived in the database. */
41
+ netAmount: number;
42
+ currency: string;
43
+ source: TransactionSource;
44
+ paymentMethod: TransactionPaymentMethod;
45
+ paymentIntentId: string | null;
46
+ refundId: string | null;
47
+ checkoutSessionId: string | null;
48
+ /** Written by the test-mode Stripe webhook. Excluded from revenue. */
49
+ test: boolean;
50
+ description: string | null;
51
+ metadata: Record<string, unknown>;
52
+ createdAt: string;
53
+ updatedAt: string;
54
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=transaction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transaction.js","sourceRoot":"","sources":["../../src/types/transaction.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wedance-shared",
3
- "version": "1.0.210",
3
+ "version": "1.0.212",
4
4
  "description": "This repository contains shared TypeScript types and interfaces used across multiple WeDance applications:",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",