wedance-shared 1.0.211 → 1.0.213

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"}
@@ -0,0 +1,55 @@
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
+ context: "event" | "school";
49
+ /** Written by the test-mode Stripe webhook. Excluded from revenue. */
50
+ test: boolean;
51
+ description: string | null;
52
+ metadata: Record<string, unknown>;
53
+ createdAt: string;
54
+ updatedAt: string;
55
+ }
@@ -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.211",
3
+ "version": "1.0.213",
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",