Skip to content

Commit 554cbaf

Browse files
committed
feat: add payment success hook
1 parent ce8204b commit 554cbaf

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

env.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ declare module 'nitropack' {
1818
'log:info': (data: { message: string, data?: any }) => void
1919
'log:error': (data: { message: string, data?: any }) => void
2020
'credit:change': (data: { userId: string, amount: number }) => void
21+
'payment:success': (data: { userId: string, transferAmount: number }) => void
2122
}
2223
}
2324

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@thecodeorigin/nuxt",
33
"type": "module",
4-
"version": "2.7.1",
4+
"version": "2.7.2",
55
"publishConfig": {
66
"registry": "https://registry.npmjs.org",
77
"access": "public"

server/api/payments/sepay/webhook.post.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ export default defineEventHandler(async (event) => {
9393

9494
await updatePaymentStatus(paymentTransactionOfProvider.payment.id, transactionStatus)
9595

96+
await useNitroApp().hooks.callHook('payment:success', { userId, transferAmount: body.transferAmount })
97+
9698
if (reference) {
9799
await createReferenceUsage(
98100
userId,

0 commit comments

Comments
 (0)