@deiondz/better-auth-razorpay 2.0.3 → 2.0.4
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/client/hooks.ts +15 -15
- package/lib/types.ts +1 -0
- package/package.json +1 -1
package/client/hooks.ts
CHANGED
|
@@ -63,13 +63,13 @@ async function fetchSubscriptions(
|
|
|
63
63
|
const res = client.razorpay
|
|
64
64
|
? await client.razorpay.listSubscriptions(input)
|
|
65
65
|
: (() => {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
66
|
+
const query: Record<string, string> = {}
|
|
67
|
+
if (input?.referenceId) query.referenceId = input.referenceId
|
|
68
|
+
const path = `${BASE}/subscription/list`
|
|
69
|
+
return Object.keys(query).length > 0
|
|
70
|
+
? client.api.get(path, { query })
|
|
71
|
+
: client.api.get(path)
|
|
72
|
+
})()
|
|
73
73
|
assertSuccess<ListSubscriptionsResponse['data']>(res)
|
|
74
74
|
return res.data
|
|
75
75
|
}
|
|
@@ -82,8 +82,8 @@ async function createOrUpdateSubscription(
|
|
|
82
82
|
const res = client.razorpay
|
|
83
83
|
? await client.razorpay.createOrUpdateSubscription(input)
|
|
84
84
|
: await client.api.post(`${BASE}/subscription/create-or-update`, {
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
body: input as unknown as Record<string, unknown>,
|
|
86
|
+
})
|
|
87
87
|
assertSuccess<CreateOrUpdateSubscriptionResponse['data']>(res)
|
|
88
88
|
return res.data
|
|
89
89
|
}
|
|
@@ -96,8 +96,8 @@ async function cancelSubscription(
|
|
|
96
96
|
const res = client.razorpay
|
|
97
97
|
? await client.razorpay.cancelSubscription(input)
|
|
98
98
|
: await client.api.post(`${BASE}/subscription/cancel`, {
|
|
99
|
-
|
|
100
|
-
|
|
99
|
+
body: input as unknown as Record<string, unknown>,
|
|
100
|
+
})
|
|
101
101
|
assertSuccess<CancelSubscriptionResponse['data']>(res)
|
|
102
102
|
return res.data
|
|
103
103
|
}
|
|
@@ -110,8 +110,8 @@ async function restoreSubscription(
|
|
|
110
110
|
const res = client.razorpay
|
|
111
111
|
? await client.razorpay.restoreSubscription(input)
|
|
112
112
|
: await client.api.post(`${BASE}/subscription/restore`, {
|
|
113
|
-
|
|
114
|
-
|
|
113
|
+
body: input as unknown as Record<string, unknown>,
|
|
114
|
+
})
|
|
115
115
|
assertSuccess<RestoreSubscriptionResponse['data']>(res)
|
|
116
116
|
return res.data
|
|
117
117
|
}
|
|
@@ -124,8 +124,8 @@ async function verifyPayment(
|
|
|
124
124
|
const res = client.razorpay
|
|
125
125
|
? await client.razorpay.verifyPayment(input)
|
|
126
126
|
: await client.api.post(`${BASE}/verify-payment`, {
|
|
127
|
-
|
|
128
|
-
|
|
127
|
+
body: input as unknown as Record<string, unknown>,
|
|
128
|
+
})
|
|
129
129
|
assertSuccess<VerifyPaymentResponse['data']>(res)
|
|
130
130
|
return res.data
|
|
131
131
|
}
|
package/lib/types.ts
CHANGED