heartraite 1.0.222 → 1.0.224
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.
- package/dist/types/request.types.d.ts +2 -1
- package/dist/types/response.types.d.ts +2 -1
- package/dist/types/ticket.types.d.ts +36 -2
- package/dist/types/ticket.types.test.d.ts +1 -0
- package/dist/types/ticket.types.test.js +37 -0
- package/package.json +1 -1
- package/src/types/request.types.ts +2 -1
- package/src/types/response.types.ts +2 -1
- package/src/types/ticket.types.test.ts +66 -0
- package/src/types/ticket.types.ts +56 -2
|
@@ -64,9 +64,10 @@ export type SetEventInterestRequest = {
|
|
|
64
64
|
};
|
|
65
65
|
export type CreateCheckoutRequest = {
|
|
66
66
|
eventId: string;
|
|
67
|
+
termsVersion: string;
|
|
67
68
|
};
|
|
68
69
|
export type ConfirmOrderRequest = {
|
|
69
|
-
|
|
70
|
+
eventId: string;
|
|
70
71
|
};
|
|
71
72
|
export type AbandonOrderRequest = {
|
|
72
73
|
eventId: string;
|
|
@@ -52,8 +52,9 @@ export type GetPublicEventsResponse = EventOffer[];
|
|
|
52
52
|
export type SetEventInterestResponse = EventInterestView | null;
|
|
53
53
|
export type CreateCheckoutResponse = {
|
|
54
54
|
orderId: string;
|
|
55
|
-
checkoutUrl: string;
|
|
56
55
|
expiresAt: string;
|
|
56
|
+
clientSecret: string;
|
|
57
|
+
publishableKey: string;
|
|
57
58
|
};
|
|
58
59
|
export type ConfirmOrderResponse = EventOrderView;
|
|
59
60
|
export type AbandonOrderResponse = void;
|
|
@@ -17,6 +17,10 @@ export type EventOrderBuyerSnapshot = {
|
|
|
17
17
|
firstName: string;
|
|
18
18
|
email: string;
|
|
19
19
|
};
|
|
20
|
+
export type EventOrderTerms = {
|
|
21
|
+
version: string;
|
|
22
|
+
acceptedAt: string;
|
|
23
|
+
};
|
|
20
24
|
export type EventOrder = {
|
|
21
25
|
id: string;
|
|
22
26
|
eventId: string;
|
|
@@ -27,8 +31,6 @@ export type EventOrder = {
|
|
|
27
31
|
amountOre: number;
|
|
28
32
|
currency: EventCurrency;
|
|
29
33
|
priceSnapshotOre: number;
|
|
30
|
-
stripeProductId?: string;
|
|
31
|
-
stripeCheckoutSessionId?: string;
|
|
32
34
|
stripePaymentIntentId?: string;
|
|
33
35
|
createdAt: string;
|
|
34
36
|
expiresAt?: string;
|
|
@@ -37,9 +39,41 @@ export type EventOrder = {
|
|
|
37
39
|
refund?: EventOrderRefund;
|
|
38
40
|
messages?: Record<string, Partial<Record<EventOrderMessageChannel, string>>>;
|
|
39
41
|
buyerSnapshot: EventOrderBuyerSnapshot;
|
|
42
|
+
terms?: EventOrderTerms;
|
|
40
43
|
deletedUser?: boolean;
|
|
41
44
|
};
|
|
42
45
|
export type EventOrderRefundView = Pick<EventOrderRefund, "amountOre" | "status" | "requestedAt">;
|
|
43
46
|
export type EventOrderView = Pick<EventOrder, "id" | "eventId" | "kind" | "status" | "amountOre" | "currency" | "createdAt" | "expiresAt" | "paidAt" | "cancelledAt"> & {
|
|
44
47
|
refund?: EventOrderRefundView;
|
|
45
48
|
};
|
|
49
|
+
export type TicketErrorReason = "sold_out" | "checkout_expired" | "already_ticketed" | "sales_closed" | "sales_not_open" | "refund_on_record" | "event_cancelled" | "payment_incomplete" | "payment_mismatch" | "quota_exceeded";
|
|
50
|
+
export type AdminRefundReason = Extract<EventOrderRefundReason, "user_cancel" | "admin">;
|
|
51
|
+
export type EventOrderAdminRow = {
|
|
52
|
+
orderId: string;
|
|
53
|
+
userId: string;
|
|
54
|
+
firstName: string;
|
|
55
|
+
email: string;
|
|
56
|
+
gender: Gender;
|
|
57
|
+
kind: EventOrderKind;
|
|
58
|
+
status: EventOrderStatus;
|
|
59
|
+
amountOre: number;
|
|
60
|
+
createdAt: string;
|
|
61
|
+
paidAt?: string;
|
|
62
|
+
refund?: EventOrderRefundView;
|
|
63
|
+
stripePaymentIntentId?: string;
|
|
64
|
+
checkedInAt?: string;
|
|
65
|
+
};
|
|
66
|
+
export type EventCancellationSummary = {
|
|
67
|
+
refunded: number;
|
|
68
|
+
released: number;
|
|
69
|
+
failed: number;
|
|
70
|
+
skipped: number;
|
|
71
|
+
};
|
|
72
|
+
export type TicketCheckIn = {
|
|
73
|
+
eventId: string;
|
|
74
|
+
userId: string;
|
|
75
|
+
checkedInAt?: string;
|
|
76
|
+
};
|
|
77
|
+
export type TicketingConfig = {
|
|
78
|
+
enabled: boolean;
|
|
79
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const assertType = (_value) => undefined;
|
|
4
|
+
describe("paymentsheet ticket types", () => {
|
|
5
|
+
it("CreateCheckoutRequest carries eventId and termsVersion", () => {
|
|
6
|
+
assertType();
|
|
7
|
+
const request = {
|
|
8
|
+
eventId: "e1",
|
|
9
|
+
termsVersion: "2026-11-01",
|
|
10
|
+
};
|
|
11
|
+
expect(Object.keys(request).sort()).toEqual(["eventId", "termsVersion"]);
|
|
12
|
+
});
|
|
13
|
+
it("CreateCheckoutResponse exposes the sheet secrets and no checkoutUrl", () => {
|
|
14
|
+
assertType();
|
|
15
|
+
const freeClaim = {
|
|
16
|
+
orderId: "e1_u1",
|
|
17
|
+
expiresAt: "2026-11-01T10:00:00.000Z",
|
|
18
|
+
clientSecret: "",
|
|
19
|
+
publishableKey: "",
|
|
20
|
+
};
|
|
21
|
+
expect(freeClaim.clientSecret).toBe("");
|
|
22
|
+
});
|
|
23
|
+
it("ConfirmOrderRequest is keyed by eventId", () => {
|
|
24
|
+
assertType();
|
|
25
|
+
expect({ eventId: "e1" }).toEqual({
|
|
26
|
+
eventId: "e1",
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
it("EventOrder records optional terms and drops the Checkout Session fields", () => {
|
|
30
|
+
assertType();
|
|
31
|
+
assertType();
|
|
32
|
+
assertType();
|
|
33
|
+
assertType();
|
|
34
|
+
assertType();
|
|
35
|
+
expect(true).toBe(true);
|
|
36
|
+
});
|
|
37
|
+
});
|
package/package.json
CHANGED
|
@@ -90,9 +90,10 @@ export type SetEventInterestRequest = {
|
|
|
90
90
|
};
|
|
91
91
|
export type CreateCheckoutRequest = {
|
|
92
92
|
eventId: string;
|
|
93
|
+
termsVersion: string;
|
|
93
94
|
};
|
|
94
95
|
export type ConfirmOrderRequest = {
|
|
95
|
-
|
|
96
|
+
eventId: string;
|
|
96
97
|
};
|
|
97
98
|
export type AbandonOrderRequest = {
|
|
98
99
|
eventId: string;
|
|
@@ -71,8 +71,9 @@ export type GetPublicEventsResponse = EventOffer[];
|
|
|
71
71
|
export type SetEventInterestResponse = EventInterestView | null;
|
|
72
72
|
export type CreateCheckoutResponse = {
|
|
73
73
|
orderId: string;
|
|
74
|
-
checkoutUrl: string;
|
|
75
74
|
expiresAt: string;
|
|
75
|
+
clientSecret: string;
|
|
76
|
+
publishableKey: string;
|
|
76
77
|
};
|
|
77
78
|
export type ConfirmOrderResponse = EventOrderView;
|
|
78
79
|
export type AbandonOrderResponse = void;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ConfirmOrderRequest,
|
|
3
|
+
CreateCheckoutRequest,
|
|
4
|
+
} from "./request.types";
|
|
5
|
+
import { CreateCheckoutResponse } from "./response.types";
|
|
6
|
+
import { EventOrder, EventOrderTerms } from "./ticket.types";
|
|
7
|
+
|
|
8
|
+
type Equal<A, B> =
|
|
9
|
+
(<T>() => T extends A ? 1 : 2) extends <T>() => T extends B ? 1 : 2
|
|
10
|
+
? true
|
|
11
|
+
: false;
|
|
12
|
+
const assertType = <T extends true>(_value?: T) => undefined;
|
|
13
|
+
|
|
14
|
+
describe("paymentsheet ticket types", () => {
|
|
15
|
+
it("CreateCheckoutRequest carries eventId and termsVersion", () => {
|
|
16
|
+
assertType<
|
|
17
|
+
Equal<CreateCheckoutRequest, { eventId: string; termsVersion: string }>
|
|
18
|
+
>();
|
|
19
|
+
const request: CreateCheckoutRequest = {
|
|
20
|
+
eventId: "e1",
|
|
21
|
+
termsVersion: "2026-11-01",
|
|
22
|
+
};
|
|
23
|
+
expect(Object.keys(request).sort()).toEqual(["eventId", "termsVersion"]);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it("CreateCheckoutResponse exposes the sheet secrets and no checkoutUrl", () => {
|
|
27
|
+
assertType<
|
|
28
|
+
Equal<
|
|
29
|
+
CreateCheckoutResponse,
|
|
30
|
+
{
|
|
31
|
+
orderId: string;
|
|
32
|
+
expiresAt: string;
|
|
33
|
+
clientSecret: string;
|
|
34
|
+
publishableKey: string;
|
|
35
|
+
}
|
|
36
|
+
>
|
|
37
|
+
>();
|
|
38
|
+
const freeClaim: CreateCheckoutResponse = {
|
|
39
|
+
orderId: "e1_u1",
|
|
40
|
+
expiresAt: "2026-11-01T10:00:00.000Z",
|
|
41
|
+
clientSecret: "",
|
|
42
|
+
publishableKey: "",
|
|
43
|
+
};
|
|
44
|
+
expect(freeClaim.clientSecret).toBe("");
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it("ConfirmOrderRequest is keyed by eventId", () => {
|
|
48
|
+
assertType<Equal<ConfirmOrderRequest, { eventId: string }>>();
|
|
49
|
+
expect({ eventId: "e1" } satisfies ConfirmOrderRequest).toEqual({
|
|
50
|
+
eventId: "e1",
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it("EventOrder records optional terms and drops the Checkout Session fields", () => {
|
|
55
|
+
assertType<
|
|
56
|
+
Equal<EventOrder["terms"], EventOrderTerms | undefined>
|
|
57
|
+
>();
|
|
58
|
+
assertType<
|
|
59
|
+
Equal<EventOrderTerms, { version: string; acceptedAt: string }>
|
|
60
|
+
>();
|
|
61
|
+
assertType<Equal<"stripeCheckoutSessionId" extends keyof EventOrder ? 1 : 0, 0>>();
|
|
62
|
+
assertType<Equal<"stripeProductId" extends keyof EventOrder ? 1 : 0, 0>>();
|
|
63
|
+
assertType<Equal<"stripePaymentIntentId" extends keyof EventOrder ? 1 : 0, 1>>();
|
|
64
|
+
expect(true).toBe(true);
|
|
65
|
+
});
|
|
66
|
+
});
|
|
@@ -38,6 +38,11 @@ export type EventOrderBuyerSnapshot = {
|
|
|
38
38
|
email: string;
|
|
39
39
|
};
|
|
40
40
|
|
|
41
|
+
export type EventOrderTerms = {
|
|
42
|
+
version: string;
|
|
43
|
+
acceptedAt: string;
|
|
44
|
+
};
|
|
45
|
+
|
|
41
46
|
export type EventOrder = {
|
|
42
47
|
id: string;
|
|
43
48
|
eventId: string;
|
|
@@ -48,8 +53,6 @@ export type EventOrder = {
|
|
|
48
53
|
amountOre: number;
|
|
49
54
|
currency: EventCurrency;
|
|
50
55
|
priceSnapshotOre: number;
|
|
51
|
-
stripeProductId?: string;
|
|
52
|
-
stripeCheckoutSessionId?: string;
|
|
53
56
|
stripePaymentIntentId?: string;
|
|
54
57
|
createdAt: string;
|
|
55
58
|
expiresAt?: string;
|
|
@@ -58,6 +61,7 @@ export type EventOrder = {
|
|
|
58
61
|
refund?: EventOrderRefund;
|
|
59
62
|
messages?: Record<string, Partial<Record<EventOrderMessageChannel, string>>>;
|
|
60
63
|
buyerSnapshot: EventOrderBuyerSnapshot;
|
|
64
|
+
terms?: EventOrderTerms;
|
|
61
65
|
deletedUser?: boolean;
|
|
62
66
|
};
|
|
63
67
|
|
|
@@ -81,3 +85,53 @@ export type EventOrderView = Pick<
|
|
|
81
85
|
> & {
|
|
82
86
|
refund?: EventOrderRefundView;
|
|
83
87
|
};
|
|
88
|
+
|
|
89
|
+
export type TicketErrorReason =
|
|
90
|
+
| "sold_out"
|
|
91
|
+
| "checkout_expired"
|
|
92
|
+
| "already_ticketed"
|
|
93
|
+
| "sales_closed"
|
|
94
|
+
| "sales_not_open"
|
|
95
|
+
| "refund_on_record"
|
|
96
|
+
| "event_cancelled"
|
|
97
|
+
| "payment_incomplete"
|
|
98
|
+
| "payment_mismatch"
|
|
99
|
+
| "quota_exceeded";
|
|
100
|
+
|
|
101
|
+
export type AdminRefundReason = Extract<
|
|
102
|
+
EventOrderRefundReason,
|
|
103
|
+
"user_cancel" | "admin"
|
|
104
|
+
>;
|
|
105
|
+
|
|
106
|
+
export type EventOrderAdminRow = {
|
|
107
|
+
orderId: string;
|
|
108
|
+
userId: string;
|
|
109
|
+
firstName: string;
|
|
110
|
+
email: string;
|
|
111
|
+
gender: Gender;
|
|
112
|
+
kind: EventOrderKind;
|
|
113
|
+
status: EventOrderStatus;
|
|
114
|
+
amountOre: number;
|
|
115
|
+
createdAt: string;
|
|
116
|
+
paidAt?: string;
|
|
117
|
+
refund?: EventOrderRefundView;
|
|
118
|
+
stripePaymentIntentId?: string;
|
|
119
|
+
checkedInAt?: string;
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
export type EventCancellationSummary = {
|
|
123
|
+
refunded: number;
|
|
124
|
+
released: number;
|
|
125
|
+
failed: number;
|
|
126
|
+
skipped: number;
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
export type TicketCheckIn = {
|
|
130
|
+
eventId: string;
|
|
131
|
+
userId: string;
|
|
132
|
+
checkedInAt?: string;
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
export type TicketingConfig = {
|
|
136
|
+
enabled: boolean;
|
|
137
|
+
};
|