convex-paystack 0.0.1
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/LICENSE +201 -0
- package/README.md +490 -0
- package/dist/client/_generated/_ignore.d.ts +1 -0
- package/dist/client/_generated/_ignore.d.ts.map +1 -0
- package/dist/client/_generated/_ignore.js +3 -0
- package/dist/client/_generated/_ignore.js.map +1 -0
- package/dist/client/index.d.ts +201 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +383 -0
- package/dist/client/index.js.map +1 -0
- package/dist/component/_generated/api.d.ts +34 -0
- package/dist/component/_generated/api.d.ts.map +1 -0
- package/dist/component/_generated/api.js +31 -0
- package/dist/component/_generated/api.js.map +1 -0
- package/dist/component/_generated/component.d.ts +147 -0
- package/dist/component/_generated/component.d.ts.map +1 -0
- package/dist/component/_generated/component.js +11 -0
- package/dist/component/_generated/component.js.map +1 -0
- package/dist/component/_generated/dataModel.d.ts +46 -0
- package/dist/component/_generated/dataModel.d.ts.map +1 -0
- package/dist/component/_generated/dataModel.js +11 -0
- package/dist/component/_generated/dataModel.js.map +1 -0
- package/dist/component/_generated/server.d.ts +133 -0
- package/dist/component/_generated/server.d.ts.map +1 -0
- package/dist/component/_generated/server.js +80 -0
- package/dist/component/_generated/server.js.map +1 -0
- package/dist/component/convex.config.d.ts +3 -0
- package/dist/component/convex.config.d.ts.map +1 -0
- package/dist/component/convex.config.js +4 -0
- package/dist/component/convex.config.js.map +1 -0
- package/dist/component/lib.d.ts +137 -0
- package/dist/component/lib.d.ts.map +1 -0
- package/dist/component/lib.js +241 -0
- package/dist/component/lib.js.map +1 -0
- package/dist/component/schema.d.ts +77 -0
- package/dist/component/schema.d.ts.map +1 -0
- package/dist/component/schema.js +45 -0
- package/dist/component/schema.js.map +1 -0
- package/package.json +106 -0
- package/src/client/_generated/_ignore.ts +1 -0
- package/src/client/index.ts +570 -0
- package/src/client/setup.test.ts +26 -0
- package/src/component/_generated/api.ts +50 -0
- package/src/component/_generated/component.ts +217 -0
- package/src/component/_generated/dataModel.ts +60 -0
- package/src/component/_generated/server.ts +169 -0
- package/src/component/convex.config.ts +5 -0
- package/src/component/lib.test.ts +110 -0
- package/src/component/lib.ts +278 -0
- package/src/component/schema.ts +58 -0
- package/src/component/setup.test.ts +11 -0
- package/src/test.ts +18 -0
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import { v } from "convex/values";
|
|
2
|
+
import { mutation, query } from "./_generated/server.js";
|
|
3
|
+
const transactionStatusValidator = v.union(v.literal("pending"), v.literal("success"), v.literal("failed"), v.literal("abandoned"));
|
|
4
|
+
const subscriptionStatusValidator = v.union(v.literal("active"), v.literal("non-renewing"), v.literal("attention"), v.literal("completed"), v.literal("cancelled"));
|
|
5
|
+
const transactionValidator = v.object({
|
|
6
|
+
_id: v.id("transactions"),
|
|
7
|
+
_creationTime: v.number(),
|
|
8
|
+
reference: v.string(),
|
|
9
|
+
customerEmail: v.string(),
|
|
10
|
+
amount: v.number(),
|
|
11
|
+
currency: v.string(),
|
|
12
|
+
status: transactionStatusValidator,
|
|
13
|
+
channel: v.optional(v.string()),
|
|
14
|
+
gatewayResponse: v.optional(v.string()),
|
|
15
|
+
authorizationCode: v.optional(v.string()),
|
|
16
|
+
paidAt: v.optional(v.number()),
|
|
17
|
+
metadata: v.optional(v.string()),
|
|
18
|
+
createdAt: v.number(),
|
|
19
|
+
updatedAt: v.number(),
|
|
20
|
+
});
|
|
21
|
+
const subscriptionValidator = v.object({
|
|
22
|
+
_id: v.id("subscriptions"),
|
|
23
|
+
_creationTime: v.number(),
|
|
24
|
+
subscriptionCode: v.string(),
|
|
25
|
+
emailToken: v.optional(v.string()),
|
|
26
|
+
customerEmail: v.string(),
|
|
27
|
+
customerCode: v.optional(v.string()),
|
|
28
|
+
planCode: v.string(),
|
|
29
|
+
status: subscriptionStatusValidator,
|
|
30
|
+
amount: v.optional(v.number()),
|
|
31
|
+
nextPaymentDate: v.optional(v.number()),
|
|
32
|
+
createdAt: v.number(),
|
|
33
|
+
updatedAt: v.number(),
|
|
34
|
+
});
|
|
35
|
+
const webhookEventValidator = v.object({
|
|
36
|
+
_id: v.id("webhookEvents"),
|
|
37
|
+
_creationTime: v.number(),
|
|
38
|
+
eventId: v.string(),
|
|
39
|
+
eventType: v.string(),
|
|
40
|
+
reference: v.optional(v.string()),
|
|
41
|
+
payload: v.string(),
|
|
42
|
+
receivedAt: v.number(),
|
|
43
|
+
});
|
|
44
|
+
// ─── Queries ────────────────────────────────────────────────────────────────
|
|
45
|
+
export const getTransaction = query({
|
|
46
|
+
args: { reference: v.string() },
|
|
47
|
+
returns: v.union(v.null(), transactionValidator),
|
|
48
|
+
handler: async (ctx, args) => {
|
|
49
|
+
return await ctx.db
|
|
50
|
+
.query("transactions")
|
|
51
|
+
.withIndex("by_reference", (q) => q.eq("reference", args.reference))
|
|
52
|
+
.first();
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
export const listTransactions = query({
|
|
56
|
+
args: { customerEmail: v.string(), limit: v.optional(v.number()) },
|
|
57
|
+
returns: v.array(transactionValidator),
|
|
58
|
+
handler: async (ctx, args) => {
|
|
59
|
+
return await ctx.db
|
|
60
|
+
.query("transactions")
|
|
61
|
+
.withIndex("by_customerEmail", (q) => q.eq("customerEmail", args.customerEmail))
|
|
62
|
+
.order("desc")
|
|
63
|
+
.take(args.limit ?? 50);
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
export const getSubscription = query({
|
|
67
|
+
args: { subscriptionCode: v.string() },
|
|
68
|
+
returns: v.union(v.null(), subscriptionValidator),
|
|
69
|
+
handler: async (ctx, args) => {
|
|
70
|
+
return await ctx.db
|
|
71
|
+
.query("subscriptions")
|
|
72
|
+
.withIndex("by_subscriptionCode", (q) => q.eq("subscriptionCode", args.subscriptionCode))
|
|
73
|
+
.first();
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
export const listSubscriptions = query({
|
|
77
|
+
args: { customerEmail: v.string() },
|
|
78
|
+
returns: v.array(subscriptionValidator),
|
|
79
|
+
handler: async (ctx, args) => {
|
|
80
|
+
return await ctx.db
|
|
81
|
+
.query("subscriptions")
|
|
82
|
+
.withIndex("by_customerEmail", (q) => q.eq("customerEmail", args.customerEmail))
|
|
83
|
+
.order("desc")
|
|
84
|
+
.collect();
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
export const hasActiveSubscription = query({
|
|
88
|
+
args: { customerEmail: v.string() },
|
|
89
|
+
returns: v.boolean(),
|
|
90
|
+
handler: async (ctx, args) => {
|
|
91
|
+
const sub = await ctx.db
|
|
92
|
+
.query("subscriptions")
|
|
93
|
+
.withIndex("by_customerEmail", (q) => q.eq("customerEmail", args.customerEmail))
|
|
94
|
+
.order("desc")
|
|
95
|
+
.first();
|
|
96
|
+
return sub?.status === "active" || sub?.status === "non-renewing";
|
|
97
|
+
},
|
|
98
|
+
});
|
|
99
|
+
/**
|
|
100
|
+
* Reads the raw webhook event log, newest first — useful for an audit
|
|
101
|
+
* trail or a live "what just happened" console in your own app. Every
|
|
102
|
+
* event Paystack has ever sent to this component's webhook handler is
|
|
103
|
+
* recorded here for idempotency, whether or not it triggered a state
|
|
104
|
+
* change.
|
|
105
|
+
*/
|
|
106
|
+
export const listRecentEvents = query({
|
|
107
|
+
args: { limit: v.optional(v.number()) },
|
|
108
|
+
returns: v.array(webhookEventValidator),
|
|
109
|
+
handler: async (ctx, args) => {
|
|
110
|
+
return await ctx.db
|
|
111
|
+
.query("webhookEvents")
|
|
112
|
+
.order("desc")
|
|
113
|
+
.take(args.limit ?? 50);
|
|
114
|
+
},
|
|
115
|
+
});
|
|
116
|
+
/**
|
|
117
|
+
* Aggregate row counts across all three tables — enough for a small
|
|
118
|
+
* dashboard stat row. This does a full table scan, so it's fine for the
|
|
119
|
+
* data volumes a demo or small integration produces; a high-volume
|
|
120
|
+
* production app should track its own counters instead of calling this
|
|
121
|
+
* on every render.
|
|
122
|
+
*/
|
|
123
|
+
export const getStats = query({
|
|
124
|
+
args: {},
|
|
125
|
+
returns: v.object({
|
|
126
|
+
transactions: v.number(),
|
|
127
|
+
subscriptions: v.number(),
|
|
128
|
+
events: v.number(),
|
|
129
|
+
}),
|
|
130
|
+
handler: async (ctx) => {
|
|
131
|
+
const [transactions, subscriptions, events] = await Promise.all([
|
|
132
|
+
ctx.db.query("transactions").collect(),
|
|
133
|
+
ctx.db.query("subscriptions").collect(),
|
|
134
|
+
ctx.db.query("webhookEvents").collect(),
|
|
135
|
+
]);
|
|
136
|
+
return {
|
|
137
|
+
transactions: transactions.length,
|
|
138
|
+
subscriptions: subscriptions.length,
|
|
139
|
+
events: events.length,
|
|
140
|
+
};
|
|
141
|
+
},
|
|
142
|
+
});
|
|
143
|
+
// ─── Mutations ──────────────────────────────────────────────────────────────
|
|
144
|
+
export const recordTransaction = mutation({
|
|
145
|
+
args: {
|
|
146
|
+
reference: v.string(),
|
|
147
|
+
customerEmail: v.string(),
|
|
148
|
+
amount: v.number(),
|
|
149
|
+
currency: v.string(),
|
|
150
|
+
status: transactionStatusValidator,
|
|
151
|
+
channel: v.optional(v.string()),
|
|
152
|
+
gatewayResponse: v.optional(v.string()),
|
|
153
|
+
authorizationCode: v.optional(v.string()),
|
|
154
|
+
paidAt: v.optional(v.number()),
|
|
155
|
+
metadata: v.optional(v.string()),
|
|
156
|
+
},
|
|
157
|
+
returns: v.id("transactions"),
|
|
158
|
+
handler: async (ctx, args) => {
|
|
159
|
+
const now = Date.now();
|
|
160
|
+
const existing = await ctx.db
|
|
161
|
+
.query("transactions")
|
|
162
|
+
.withIndex("by_reference", (q) => q.eq("reference", args.reference))
|
|
163
|
+
.first();
|
|
164
|
+
if (existing) {
|
|
165
|
+
await ctx.db.patch(existing._id, { ...args, updatedAt: now });
|
|
166
|
+
return existing._id;
|
|
167
|
+
}
|
|
168
|
+
return await ctx.db.insert("transactions", {
|
|
169
|
+
...args,
|
|
170
|
+
createdAt: now,
|
|
171
|
+
updatedAt: now,
|
|
172
|
+
});
|
|
173
|
+
},
|
|
174
|
+
});
|
|
175
|
+
export const recordSubscriptionEvent = mutation({
|
|
176
|
+
args: {
|
|
177
|
+
subscriptionCode: v.string(),
|
|
178
|
+
emailToken: v.optional(v.string()),
|
|
179
|
+
customerEmail: v.string(),
|
|
180
|
+
customerCode: v.optional(v.string()),
|
|
181
|
+
planCode: v.string(),
|
|
182
|
+
status: subscriptionStatusValidator,
|
|
183
|
+
amount: v.optional(v.number()),
|
|
184
|
+
nextPaymentDate: v.optional(v.number()),
|
|
185
|
+
},
|
|
186
|
+
returns: v.id("subscriptions"),
|
|
187
|
+
handler: async (ctx, args) => {
|
|
188
|
+
const now = Date.now();
|
|
189
|
+
const existing = await ctx.db
|
|
190
|
+
.query("subscriptions")
|
|
191
|
+
.withIndex("by_subscriptionCode", (q) => q.eq("subscriptionCode", args.subscriptionCode))
|
|
192
|
+
.first();
|
|
193
|
+
if (existing) {
|
|
194
|
+
await ctx.db.patch(existing._id, { ...args, updatedAt: now });
|
|
195
|
+
return existing._id;
|
|
196
|
+
}
|
|
197
|
+
return await ctx.db.insert("subscriptions", {
|
|
198
|
+
...args,
|
|
199
|
+
createdAt: now,
|
|
200
|
+
updatedAt: now,
|
|
201
|
+
});
|
|
202
|
+
},
|
|
203
|
+
});
|
|
204
|
+
export const updateSubscriptionStatus = mutation({
|
|
205
|
+
args: {
|
|
206
|
+
subscriptionCode: v.string(),
|
|
207
|
+
status: subscriptionStatusValidator,
|
|
208
|
+
},
|
|
209
|
+
returns: v.null(),
|
|
210
|
+
handler: async (ctx, args) => {
|
|
211
|
+
const existing = await ctx.db
|
|
212
|
+
.query("subscriptions")
|
|
213
|
+
.withIndex("by_subscriptionCode", (q) => q.eq("subscriptionCode", args.subscriptionCode))
|
|
214
|
+
.first();
|
|
215
|
+
if (!existing)
|
|
216
|
+
return null;
|
|
217
|
+
await ctx.db.patch(existing._id, { status: args.status, updatedAt: Date.now() });
|
|
218
|
+
return null;
|
|
219
|
+
},
|
|
220
|
+
});
|
|
221
|
+
export const checkAndRecordEvent = mutation({
|
|
222
|
+
args: {
|
|
223
|
+
eventId: v.string(),
|
|
224
|
+
eventType: v.string(),
|
|
225
|
+
reference: v.optional(v.string()),
|
|
226
|
+
payload: v.string(),
|
|
227
|
+
},
|
|
228
|
+
returns: v.object({ alreadyProcessed: v.boolean() }),
|
|
229
|
+
handler: async (ctx, args) => {
|
|
230
|
+
const existing = await ctx.db
|
|
231
|
+
.query("webhookEvents")
|
|
232
|
+
.withIndex("by_eventId", (q) => q.eq("eventId", args.eventId))
|
|
233
|
+
.first();
|
|
234
|
+
if (existing) {
|
|
235
|
+
return { alreadyProcessed: true };
|
|
236
|
+
}
|
|
237
|
+
await ctx.db.insert("webhookEvents", { ...args, receivedAt: Date.now() });
|
|
238
|
+
return { alreadyProcessed: false };
|
|
239
|
+
},
|
|
240
|
+
});
|
|
241
|
+
//# sourceMappingURL=lib.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lib.js","sourceRoot":"","sources":["../../src/component/lib.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAEzD,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CACxC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,EACpB,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,EACpB,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,EACnB,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,CACvB,CAAC;AAEF,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CACzC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,EACnB,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC,EACzB,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,EACtB,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,EACtB,CAAC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AC,EAAE,gBAAgB,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC;IACpD,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;QAC3B,MAAM,QAAQ,GAAG,MAAM,GAAG,CAAC,EAAE;aAC1B,KAAK,CAAC,eAAe,CAAC;aACtB,SAAS,CAAC,YAAY,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;aAC7D,KAAK,EAAE,CAAC;QACX,IAAI,QAAQ,EAAE,CAAC;YACb,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAE,CAAC;QACpC,CAAC;QACD,MAAM,GAAG,CAAC,EAAE,CAAC,MAAM,CAAC,eAAe,EAAE,EAAE,GAAG,IAAI,EAAE,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;QAC1E,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,CAAC;IACrC,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
declare const _default: import("convex/server").SchemaDefinition<{
|
|
2
|
+
transactions: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
3
|
+
authorizationCode?: string | undefined;
|
|
4
|
+
channel?: string | undefined;
|
|
5
|
+
gatewayResponse?: string | undefined;
|
|
6
|
+
metadata?: string | undefined;
|
|
7
|
+
paidAt?: number | undefined;
|
|
8
|
+
reference: string;
|
|
9
|
+
customerEmail: string;
|
|
10
|
+
amount: number;
|
|
11
|
+
status: "pending" | "success" | "failed" | "abandoned";
|
|
12
|
+
currency: string;
|
|
13
|
+
createdAt: number;
|
|
14
|
+
updatedAt: number;
|
|
15
|
+
}, {
|
|
16
|
+
reference: import("convex/values").VString<string, "required">;
|
|
17
|
+
customerEmail: import("convex/values").VString<string, "required">;
|
|
18
|
+
amount: import("convex/values").VFloat64<number, "required">;
|
|
19
|
+
currency: import("convex/values").VString<string, "required">;
|
|
20
|
+
status: import("convex/values").VUnion<"pending" | "success" | "failed" | "abandoned", [import("convex/values").VLiteral<"pending", "required">, import("convex/values").VLiteral<"success", "required">, import("convex/values").VLiteral<"failed", "required">, import("convex/values").VLiteral<"abandoned", "required">], "required", never>;
|
|
21
|
+
channel: import("convex/values").VString<string | undefined, "optional">;
|
|
22
|
+
gatewayResponse: import("convex/values").VString<string | undefined, "optional">;
|
|
23
|
+
authorizationCode: import("convex/values").VString<string | undefined, "optional">;
|
|
24
|
+
paidAt: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
25
|
+
metadata: import("convex/values").VString<string | undefined, "optional">;
|
|
26
|
+
createdAt: import("convex/values").VFloat64<number, "required">;
|
|
27
|
+
updatedAt: import("convex/values").VFloat64<number, "required">;
|
|
28
|
+
}, "required", "reference" | "customerEmail" | "amount" | "status" | "authorizationCode" | "channel" | "currency" | "gatewayResponse" | "metadata" | "paidAt" | "createdAt" | "updatedAt">, {
|
|
29
|
+
by_reference: ["reference", "_creationTime"];
|
|
30
|
+
by_customerEmail: ["customerEmail", "_creationTime"];
|
|
31
|
+
}, {}, {}>;
|
|
32
|
+
subscriptions: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
33
|
+
amount?: number | undefined;
|
|
34
|
+
customerCode?: string | undefined;
|
|
35
|
+
emailToken?: string | undefined;
|
|
36
|
+
nextPaymentDate?: number | undefined;
|
|
37
|
+
subscriptionCode: string;
|
|
38
|
+
customerEmail: string;
|
|
39
|
+
planCode: string;
|
|
40
|
+
status: "active" | "non-renewing" | "attention" | "completed" | "cancelled";
|
|
41
|
+
createdAt: number;
|
|
42
|
+
updatedAt: number;
|
|
43
|
+
}, {
|
|
44
|
+
subscriptionCode: import("convex/values").VString<string, "required">;
|
|
45
|
+
emailToken: import("convex/values").VString<string | undefined, "optional">;
|
|
46
|
+
customerEmail: import("convex/values").VString<string, "required">;
|
|
47
|
+
customerCode: import("convex/values").VString<string | undefined, "optional">;
|
|
48
|
+
planCode: import("convex/values").VString<string, "required">;
|
|
49
|
+
status: import("convex/values").VUnion<"active" | "non-renewing" | "attention" | "completed" | "cancelled", [import("convex/values").VLiteral<"active", "required">, import("convex/values").VLiteral<"non-renewing", "required">, import("convex/values").VLiteral<"attention", "required">, import("convex/values").VLiteral<"completed", "required">, import("convex/values").VLiteral<"cancelled", "required">], "required", never>;
|
|
50
|
+
amount: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
51
|
+
nextPaymentDate: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
52
|
+
createdAt: import("convex/values").VFloat64<number, "required">;
|
|
53
|
+
updatedAt: import("convex/values").VFloat64<number, "required">;
|
|
54
|
+
}, "required", "subscriptionCode" | "customerEmail" | "amount" | "customerCode" | "emailToken" | "nextPaymentDate" | "planCode" | "status" | "createdAt" | "updatedAt">, {
|
|
55
|
+
by_subscriptionCode: ["subscriptionCode", "_creationTime"];
|
|
56
|
+
by_customerEmail: ["customerEmail", "_creationTime"];
|
|
57
|
+
by_status: ["status", "_creationTime"];
|
|
58
|
+
}, {}, {}>;
|
|
59
|
+
webhookEvents: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
60
|
+
reference?: string | undefined;
|
|
61
|
+
eventId: string;
|
|
62
|
+
eventType: string;
|
|
63
|
+
payload: string;
|
|
64
|
+
receivedAt: number;
|
|
65
|
+
}, {
|
|
66
|
+
eventId: import("convex/values").VString<string, "required">;
|
|
67
|
+
eventType: import("convex/values").VString<string, "required">;
|
|
68
|
+
reference: import("convex/values").VString<string | undefined, "optional">;
|
|
69
|
+
payload: import("convex/values").VString<string, "required">;
|
|
70
|
+
receivedAt: import("convex/values").VFloat64<number, "required">;
|
|
71
|
+
}, "required", "eventId" | "eventType" | "payload" | "reference" | "receivedAt">, {
|
|
72
|
+
by_eventId: ["eventId", "_creationTime"];
|
|
73
|
+
by_eventType: ["eventType", "_creationTime"];
|
|
74
|
+
}, {}, {}>;
|
|
75
|
+
}, true>;
|
|
76
|
+
export default _default;
|
|
77
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/component/schema.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,wBAsDG"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { defineSchema, defineTable } from "convex/server";
|
|
2
|
+
import { v } from "convex/values";
|
|
3
|
+
export default defineSchema({
|
|
4
|
+
transactions: defineTable({
|
|
5
|
+
reference: v.string(),
|
|
6
|
+
customerEmail: v.string(),
|
|
7
|
+
amount: v.number(),
|
|
8
|
+
currency: v.string(),
|
|
9
|
+
status: v.union(v.literal("pending"), v.literal("success"), v.literal("failed"), v.literal("abandoned")),
|
|
10
|
+
channel: v.optional(v.string()),
|
|
11
|
+
gatewayResponse: v.optional(v.string()),
|
|
12
|
+
authorizationCode: v.optional(v.string()),
|
|
13
|
+
paidAt: v.optional(v.number()),
|
|
14
|
+
metadata: v.optional(v.string()),
|
|
15
|
+
createdAt: v.number(),
|
|
16
|
+
updatedAt: v.number(),
|
|
17
|
+
})
|
|
18
|
+
.index("by_reference", ["reference"])
|
|
19
|
+
.index("by_customerEmail", ["customerEmail"]),
|
|
20
|
+
subscriptions: defineTable({
|
|
21
|
+
subscriptionCode: v.string(),
|
|
22
|
+
emailToken: v.optional(v.string()),
|
|
23
|
+
customerEmail: v.string(),
|
|
24
|
+
customerCode: v.optional(v.string()),
|
|
25
|
+
planCode: v.string(),
|
|
26
|
+
status: v.union(v.literal("active"), v.literal("non-renewing"), v.literal("attention"), v.literal("completed"), v.literal("cancelled")),
|
|
27
|
+
amount: v.optional(v.number()),
|
|
28
|
+
nextPaymentDate: v.optional(v.number()),
|
|
29
|
+
createdAt: v.number(),
|
|
30
|
+
updatedAt: v.number(),
|
|
31
|
+
})
|
|
32
|
+
.index("by_subscriptionCode", ["subscriptionCode"])
|
|
33
|
+
.index("by_customerEmail", ["customerEmail"])
|
|
34
|
+
.index("by_status", ["status"]),
|
|
35
|
+
webhookEvents: defineTable({
|
|
36
|
+
eventId: v.string(),
|
|
37
|
+
eventType: v.string(),
|
|
38
|
+
reference: v.optional(v.string()),
|
|
39
|
+
payload: v.string(),
|
|
40
|
+
receivedAt: v.number(),
|
|
41
|
+
})
|
|
42
|
+
.index("by_eventId", ["eventId"])
|
|
43
|
+
.index("by_eventType", ["eventType"]),
|
|
44
|
+
});
|
|
45
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/component/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAElC,eAAe,YAAY,CAAC;IAC1B,YAAY,EAAE,WAAW,CAAC;QACxB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;QACrB,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE;QACzB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;QAClB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;QACpB,MAAM,EAAE,CAAC,CAAC,KAAK,CACb,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,EACpB,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,EACpB,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,EACnB,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,CACvB;QACD,OAAO,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;QAC/B,eAAe,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;QACvC,iBAAiB,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC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AAC,CAAC;SAClD,KAAK,CAAC,kBAAkB,EAAE,CAAC,eAAe,CAAC,CAAC;SAC5C,KAAK,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,CAAC;IAEjC,aAAa,EAAE,WAAW,CAAC;QACzB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;QACnB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;QACrB,SAAS,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;QACjC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;QACnB,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;KACvB,CAAC;SACC,KAAK,CAAC,YAAY,EAAE,CAAC,SAAS,CAAC,CAAC;SAChC,KAAK,CAAC,cAAc,EAAE,CAAC,WAAW,CAAC,CAAC;CACxC,CAAC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "convex-paystack",
|
|
3
|
+
"description": "Accept payments and subscriptions with Paystack in your Convex app. Reactive transactions, subscription state, and webhook ingestion.",
|
|
4
|
+
"repository": {
|
|
5
|
+
"type": "git",
|
|
6
|
+
"url": "git+https://github.com/sholajegede/convex-paystack.git"
|
|
7
|
+
},
|
|
8
|
+
"homepage": "https://github.com/sholajegede/convex-paystack#readme",
|
|
9
|
+
"bugs": {
|
|
10
|
+
"url": "https://github.com/sholajegede/convex-paystack/issues"
|
|
11
|
+
},
|
|
12
|
+
"version": "0.0.1",
|
|
13
|
+
"license": "Apache-2.0",
|
|
14
|
+
"keywords": [
|
|
15
|
+
"convex",
|
|
16
|
+
"component",
|
|
17
|
+
"paystack",
|
|
18
|
+
"payments",
|
|
19
|
+
"billing",
|
|
20
|
+
"subscriptions",
|
|
21
|
+
"webhooks",
|
|
22
|
+
"africa"
|
|
23
|
+
],
|
|
24
|
+
"type": "module",
|
|
25
|
+
"scripts": {
|
|
26
|
+
"dev": "run-p -r 'dev:*'",
|
|
27
|
+
"dev:backend": "convex dev --typecheck-components",
|
|
28
|
+
"dev:frontend": "cd example && vite --clearScreen false",
|
|
29
|
+
"dev:build": "chokidar 'tsconfig*.json' 'src/**/*.ts' -i '**/*.test.ts' -c 'npm run build:codegen' --initial",
|
|
30
|
+
"predev": "path-exists .env.local dist || (npm run build && convex dev --once)",
|
|
31
|
+
"build": "tsc --project ./tsconfig.build.json",
|
|
32
|
+
"build:codegen": "npx convex codegen --component-dir ./src/component && npm run build",
|
|
33
|
+
"build:clean": "rm -rf dist *.tsbuildinfo && npm run build:codegen",
|
|
34
|
+
"typecheck": "tsc --noEmit && tsc -p example && tsc -p example/convex",
|
|
35
|
+
"lint": "eslint .",
|
|
36
|
+
"all": "run-p -r 'dev:*' 'test:watch'",
|
|
37
|
+
"test": "vitest run --typecheck",
|
|
38
|
+
"test:watch": "vitest --typecheck --clearScreen false",
|
|
39
|
+
"test:debug": "vitest --inspect-brk --no-file-parallelism",
|
|
40
|
+
"test:coverage": "vitest run --coverage --coverage.reporter=text",
|
|
41
|
+
"preversion": "npm install --legacy-peer-deps && npm run build:clean && run-p test lint typecheck",
|
|
42
|
+
"prepublishOnly": "npm whoami || npm login",
|
|
43
|
+
"alpha": "npm version prerelease --preid alpha && npm publish --tag alpha && git push --follow-tags",
|
|
44
|
+
"release": "npm version patch && npm publish && git push --follow-tags",
|
|
45
|
+
"version": "vim -c 'normal o' -c 'normal o## '$npm_package_version CHANGELOG.md && prettier -w CHANGELOG.md && git add CHANGELOG.md"
|
|
46
|
+
},
|
|
47
|
+
"files": [
|
|
48
|
+
"dist",
|
|
49
|
+
"src"
|
|
50
|
+
],
|
|
51
|
+
"exports": {
|
|
52
|
+
"./package.json": "./package.json",
|
|
53
|
+
".": {
|
|
54
|
+
"types": "./dist/client/index.d.ts",
|
|
55
|
+
"default": "./dist/client/index.js"
|
|
56
|
+
},
|
|
57
|
+
"./test": "./src/test.ts",
|
|
58
|
+
"./_generated/component.js": {
|
|
59
|
+
"types": "./dist/component/_generated/component.d.ts"
|
|
60
|
+
},
|
|
61
|
+
"./_generated/component": {
|
|
62
|
+
"types": "./dist/component/_generated/component.d.ts"
|
|
63
|
+
},
|
|
64
|
+
"./convex.config.js": {
|
|
65
|
+
"types": "./dist/component/convex.config.d.ts",
|
|
66
|
+
"default": "./dist/component/convex.config.js"
|
|
67
|
+
},
|
|
68
|
+
"./convex.config": {
|
|
69
|
+
"types": "./dist/component/convex.config.d.ts",
|
|
70
|
+
"default": "./dist/component/convex.config.js"
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
"peerDependencies": {
|
|
74
|
+
"convex": "^1.34.1"
|
|
75
|
+
},
|
|
76
|
+
"devDependencies": {
|
|
77
|
+
"@convex-dev/eslint-plugin": "^1.2.0",
|
|
78
|
+
"@edge-runtime/vm": "^5.0.0",
|
|
79
|
+
"@eslint/eslintrc": "^3.3.5",
|
|
80
|
+
"@eslint/js": "9.39.4",
|
|
81
|
+
"@types/node": "^24.12.0",
|
|
82
|
+
"@types/react": "^19.2.14",
|
|
83
|
+
"@types/react-dom": "^19.2.3",
|
|
84
|
+
"@vitejs/plugin-react": "^5.2.0",
|
|
85
|
+
"chokidar-cli": "3.0.0",
|
|
86
|
+
"convex": "1.45.0",
|
|
87
|
+
"convex-test": "0.0.41",
|
|
88
|
+
"eslint": "9.39.4",
|
|
89
|
+
"eslint-plugin-react": "^7.37.5",
|
|
90
|
+
"eslint-plugin-react-hooks": "^7.0.1",
|
|
91
|
+
"eslint-plugin-react-refresh": "^0.5.2",
|
|
92
|
+
"globals": "^17.4.0",
|
|
93
|
+
"npm-run-all2": "8.0.4",
|
|
94
|
+
"path-exists-cli": "2.0.0",
|
|
95
|
+
"pkg-pr-new": "^0.0.66",
|
|
96
|
+
"prettier": "3.8.1",
|
|
97
|
+
"react": "^19.2.4",
|
|
98
|
+
"react-dom": "^19.2.4",
|
|
99
|
+
"typescript": "5.9.3",
|
|
100
|
+
"typescript-eslint": "8.57.1",
|
|
101
|
+
"vite": "7.3.1",
|
|
102
|
+
"vitest": "4.1.0"
|
|
103
|
+
},
|
|
104
|
+
"types": "./dist/client/index.d.ts",
|
|
105
|
+
"module": "./dist/client/index.js"
|
|
106
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// This is only here so convex-test can detect a _generated folder
|