Add optional payment choice for admin grant and extend subscriptions.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
d73e928de6
commit
de9766be7b
|
|
@ -55,6 +55,8 @@ function mutationResult(res: { data: unknown; status?: number }) {
|
||||||
* POST /admin/users/:user_id/subscriptions/extend
|
* POST /admin/users/:user_id/subscriptions/extend
|
||||||
* Unified grant-or-extend: no active sub in plan category → grant (201);
|
* Unified grant-or-extend: no active sub in plan category → grant (201);
|
||||||
* active in category → extend one period of selected plan (200).
|
* active in category → extend one period of selected plan (200).
|
||||||
|
* Optional body.record_payment (default true) controls whether a SUCCESS
|
||||||
|
* payment at the plan price is recorded.
|
||||||
*/
|
*/
|
||||||
export const adminApplySubscription = (userId: number, body: AdminApplySubscriptionBody) =>
|
export const adminApplySubscription = (userId: number, body: AdminApplySubscriptionBody) =>
|
||||||
http
|
http
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,20 @@
|
||||||
import { useEffect, useState } from "react"
|
import { useEffect, useState } from "react"
|
||||||
|
import { RefreshCw } from "lucide-react"
|
||||||
import { toast } from "sonner"
|
import { toast } from "sonner"
|
||||||
import { adminApplySubscription } from "../../../api/admin-subscriptions.api"
|
import { adminApplySubscription } from "../../../api/admin-subscriptions.api"
|
||||||
|
import { Button } from "../../../components/ui/button"
|
||||||
|
import {
|
||||||
|
Dialog,
|
||||||
|
DialogContent,
|
||||||
|
DialogDescription,
|
||||||
|
DialogFooter,
|
||||||
|
DialogHeader,
|
||||||
|
DialogTitle,
|
||||||
|
} from "../../../components/ui/dialog"
|
||||||
import { notifyApiError } from "../../../lib/apiErrors"
|
import { notifyApiError } from "../../../lib/apiErrors"
|
||||||
import { formatPlanCategory } from "../../../lib/subscriptionPlans"
|
import { formatPlanCategory, formatPlanPrice } from "../../../lib/subscriptionPlans"
|
||||||
import { TypeToConfirmDialog } from "../../../lib/typeToConfirm"
|
import { TypeToConfirmDialog } from "../../../lib/typeToConfirm"
|
||||||
|
import { cn } from "../../../lib/utils"
|
||||||
import type { UserSubscriptionRecord } from "../../../types/userAdmin.types"
|
import type { UserSubscriptionRecord } from "../../../types/userAdmin.types"
|
||||||
|
|
||||||
const CONFIRM_WORD = "EXTEND"
|
const CONFIRM_WORD = "EXTEND"
|
||||||
|
|
@ -36,12 +47,24 @@ export function ExtendSubscriptionDialog({
|
||||||
subscription,
|
subscription,
|
||||||
onExtended,
|
onExtended,
|
||||||
}: ExtendSubscriptionDialogProps) {
|
}: ExtendSubscriptionDialogProps) {
|
||||||
|
const [recordPayment, setRecordPayment] = useState(true)
|
||||||
|
const [confirmOpen, setConfirmOpen] = useState(false)
|
||||||
const [saving, setSaving] = useState(false)
|
const [saving, setSaving] = useState(false)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!open) setSaving(false)
|
if (!open) {
|
||||||
|
setSaving(false)
|
||||||
|
setConfirmOpen(false)
|
||||||
|
setRecordPayment(true)
|
||||||
|
}
|
||||||
}, [open, subscription?.id])
|
}, [open, subscription?.id])
|
||||||
|
|
||||||
|
const handleContinue = (e: React.FormEvent) => {
|
||||||
|
e.preventDefault()
|
||||||
|
if (!subscription) return
|
||||||
|
setConfirmOpen(true)
|
||||||
|
}
|
||||||
|
|
||||||
const handleConfirmExtend = async () => {
|
const handleConfirmExtend = async () => {
|
||||||
if (!subscription) return
|
if (!subscription) return
|
||||||
|
|
||||||
|
|
@ -49,6 +72,7 @@ export function ExtendSubscriptionDialog({
|
||||||
try {
|
try {
|
||||||
const res = await adminApplySubscription(userId, {
|
const res = await adminApplySubscription(userId, {
|
||||||
plan_id: subscription.plan_id,
|
plan_id: subscription.plan_id,
|
||||||
|
record_payment: recordPayment,
|
||||||
})
|
})
|
||||||
const expiresLabel = res.data?.expires_at
|
const expiresLabel = res.data?.expires_at
|
||||||
? formatDateTime(res.data.expires_at)
|
? formatDateTime(res.data.expires_at)
|
||||||
|
|
@ -58,6 +82,7 @@ export function ExtendSubscriptionDialog({
|
||||||
? `Subscription extended to ${expiresLabel}`
|
? `Subscription extended to ${expiresLabel}`
|
||||||
: res.message || "Subscription extended",
|
: res.message || "Subscription extended",
|
||||||
)
|
)
|
||||||
|
setConfirmOpen(false)
|
||||||
onExtended()
|
onExtended()
|
||||||
onOpenChange(false)
|
onOpenChange(false)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|
@ -67,33 +92,173 @@ export function ExtendSubscriptionDialog({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const priceLabel = subscription
|
||||||
|
? formatPlanPrice({
|
||||||
|
price: subscription.price,
|
||||||
|
currency: subscription.currency || "ETB",
|
||||||
|
})
|
||||||
|
: "the plan price"
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TypeToConfirmDialog
|
<>
|
||||||
open={open && subscription != null}
|
<Dialog
|
||||||
onOpenChange={(next) => {
|
open={open && subscription != null && !confirmOpen}
|
||||||
if (saving) return
|
onOpenChange={(next) => {
|
||||||
if (!next) onOpenChange(false)
|
if (saving) return
|
||||||
}}
|
if (!next) {
|
||||||
title="Are you sure?"
|
setConfirmOpen(false)
|
||||||
description={
|
onOpenChange(false)
|
||||||
subscription ? (
|
}
|
||||||
<>
|
}}
|
||||||
Extend <strong>{subscription.plan_name}</strong> (#
|
>
|
||||||
{subscription.id}) by one plan period? Current expiry:{" "}
|
<DialogContent className="h-auto max-h-[90vh] w-full max-w-lg overflow-y-auto rounded-[12px] border border-grayScale-100 p-0 sm:max-w-xl">
|
||||||
<strong>{formatDateTime(subscription.expires_at)}</strong>
|
<form onSubmit={handleContinue}>
|
||||||
{subscription.plan_category
|
<DialogHeader className="border-b border-grayScale-100 px-4 py-4 sm:px-6">
|
||||||
? ` · ${formatPlanCategory(subscription.plan_category)}`
|
<DialogTitle className="flex items-center gap-2 text-lg font-bold text-grayScale-900">
|
||||||
: ""}
|
<RefreshCw className="h-5 w-5 text-brand-600" aria-hidden />
|
||||||
.
|
Extend subscription
|
||||||
</>
|
</DialogTitle>
|
||||||
) : (
|
<DialogDescription className="text-sm text-grayScale-500">
|
||||||
"Extend this subscription by one plan period?"
|
Extend by one plan period. Choose whether to record a payment at the plan
|
||||||
)
|
price.
|
||||||
}
|
</DialogDescription>
|
||||||
confirmWord={CONFIRM_WORD}
|
</DialogHeader>
|
||||||
confirmLabel="Extend subscription"
|
|
||||||
confirming={saving}
|
<div className="space-y-4 px-6 py-5">
|
||||||
onConfirm={handleConfirmExtend}
|
{subscription ? (
|
||||||
/>
|
<div className="rounded-xl border border-grayScale-100 bg-grayScale-50 px-4 py-3 text-sm text-grayScale-700">
|
||||||
|
<p>
|
||||||
|
<span className="font-semibold">{subscription.plan_name}</span>
|
||||||
|
{subscription.plan_category
|
||||||
|
? ` · ${formatPlanCategory(subscription.plan_category)}`
|
||||||
|
: ""}
|
||||||
|
</p>
|
||||||
|
<p className="mt-1 text-xs text-grayScale-500">
|
||||||
|
Current expiry: {formatDateTime(subscription.expires_at)}
|
||||||
|
{" · Plan price: "}
|
||||||
|
{formatPlanPrice({
|
||||||
|
price: subscription.price,
|
||||||
|
currency: subscription.currency || "ETB",
|
||||||
|
})}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
<div className="space-y-2">
|
||||||
|
<p className="text-[11px] font-bold uppercase tracking-wider text-grayScale-400">
|
||||||
|
Payment <span className="text-destructive">*</span>
|
||||||
|
</p>
|
||||||
|
<div
|
||||||
|
className="flex flex-col gap-2 sm:flex-row"
|
||||||
|
role="radiogroup"
|
||||||
|
aria-label="Payment recording"
|
||||||
|
>
|
||||||
|
<label
|
||||||
|
className={cn(
|
||||||
|
"flex flex-1 cursor-pointer flex-col rounded-xl border px-4 py-3 transition-colors",
|
||||||
|
recordPayment
|
||||||
|
? "border-brand-500 bg-brand-50/60 ring-1 ring-brand-500/30"
|
||||||
|
: "border-grayScale-200 bg-white hover:border-grayScale-300",
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
<span className="flex items-center gap-2">
|
||||||
|
<input
|
||||||
|
type="radio"
|
||||||
|
name="extend_record_payment"
|
||||||
|
checked={recordPayment}
|
||||||
|
onChange={() => setRecordPayment(true)}
|
||||||
|
className="h-4 w-4 border-grayScale-300 text-brand-600 focus:ring-brand-500"
|
||||||
|
/>
|
||||||
|
<span className="text-sm font-semibold text-grayScale-800">
|
||||||
|
Record payment
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
<span className="mt-1 pl-6 text-xs text-grayScale-500">
|
||||||
|
Commit a SUCCESS payment of {priceLabel}.
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
|
<label
|
||||||
|
className={cn(
|
||||||
|
"flex flex-1 cursor-pointer flex-col rounded-xl border px-4 py-3 transition-colors",
|
||||||
|
!recordPayment
|
||||||
|
? "border-brand-500 bg-brand-50/60 ring-1 ring-brand-500/30"
|
||||||
|
: "border-grayScale-200 bg-white hover:border-grayScale-300",
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
<span className="flex items-center gap-2">
|
||||||
|
<input
|
||||||
|
type="radio"
|
||||||
|
name="extend_record_payment"
|
||||||
|
checked={!recordPayment}
|
||||||
|
onChange={() => setRecordPayment(false)}
|
||||||
|
className="h-4 w-4 border-grayScale-300 text-brand-600 focus:ring-brand-500"
|
||||||
|
/>
|
||||||
|
<span className="text-sm font-semibold text-grayScale-800">
|
||||||
|
No payment
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
<span className="mt-1 pl-6 text-xs text-grayScale-500">
|
||||||
|
Extend access only — no payments row or revenue.
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<DialogFooter className="gap-2 border-t border-grayScale-100 px-6 py-4 sm:justify-end">
|
||||||
|
<Button
|
||||||
|
type="button"
|
||||||
|
variant="outline"
|
||||||
|
className="rounded-[6px]"
|
||||||
|
disabled={saving}
|
||||||
|
onClick={() => onOpenChange(false)}
|
||||||
|
>
|
||||||
|
Cancel
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
type="submit"
|
||||||
|
disabled={saving || !subscription}
|
||||||
|
className="rounded-[6px] bg-brand-500 font-semibold text-white hover:bg-brand-600"
|
||||||
|
>
|
||||||
|
Continue
|
||||||
|
</Button>
|
||||||
|
</DialogFooter>
|
||||||
|
</form>
|
||||||
|
</DialogContent>
|
||||||
|
</Dialog>
|
||||||
|
|
||||||
|
<TypeToConfirmDialog
|
||||||
|
open={confirmOpen && subscription != null}
|
||||||
|
onOpenChange={setConfirmOpen}
|
||||||
|
title="Are you sure?"
|
||||||
|
description={
|
||||||
|
subscription ? (
|
||||||
|
<>
|
||||||
|
Extend <strong>{subscription.plan_name}</strong> (#{subscription.id}) by one
|
||||||
|
plan period? Current expiry:{" "}
|
||||||
|
<strong>{formatDateTime(subscription.expires_at)}</strong>
|
||||||
|
{subscription.plan_category
|
||||||
|
? ` · ${formatPlanCategory(subscription.plan_category)}`
|
||||||
|
: ""}
|
||||||
|
.
|
||||||
|
{recordPayment ? (
|
||||||
|
<>
|
||||||
|
{" "}
|
||||||
|
A payment of <strong>{priceLabel}</strong> will be recorded.
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
" No payment will be recorded."
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
"Extend this subscription by one plan period?"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
confirmWord={CONFIRM_WORD}
|
||||||
|
confirmLabel={recordPayment ? "Extend and record payment" : "Extend without payment"}
|
||||||
|
confirming={saving}
|
||||||
|
onConfirm={handleConfirmExtend}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,7 @@ export function GrantSubscriptionDialog({
|
||||||
const [planId, setPlanId] = useState("")
|
const [planId, setPlanId] = useState("")
|
||||||
const [planSearch, setPlanSearch] = useState("")
|
const [planSearch, setPlanSearch] = useState("")
|
||||||
const [planMenuOpen, setPlanMenuOpen] = useState(false)
|
const [planMenuOpen, setPlanMenuOpen] = useState(false)
|
||||||
|
const [recordPayment, setRecordPayment] = useState(true)
|
||||||
const [confirmOpen, setConfirmOpen] = useState(false)
|
const [confirmOpen, setConfirmOpen] = useState(false)
|
||||||
const [saving, setSaving] = useState(false)
|
const [saving, setSaving] = useState(false)
|
||||||
const [formError, setFormError] = useState<string | null>(null)
|
const [formError, setFormError] = useState<string | null>(null)
|
||||||
|
|
@ -61,6 +62,7 @@ export function GrantSubscriptionDialog({
|
||||||
setPlanId("")
|
setPlanId("")
|
||||||
setPlanSearch("")
|
setPlanSearch("")
|
||||||
setPlanMenuOpen(false)
|
setPlanMenuOpen(false)
|
||||||
|
setRecordPayment(true)
|
||||||
setConfirmOpen(false)
|
setConfirmOpen(false)
|
||||||
setFormError(null)
|
setFormError(null)
|
||||||
setSaving(false)
|
setSaving(false)
|
||||||
|
|
@ -131,7 +133,10 @@ export function GrantSubscriptionDialog({
|
||||||
|
|
||||||
setSaving(true)
|
setSaving(true)
|
||||||
try {
|
try {
|
||||||
const res = await adminApplySubscription(userId, { plan_id: id })
|
const res = await adminApplySubscription(userId, {
|
||||||
|
plan_id: id,
|
||||||
|
record_payment: recordPayment,
|
||||||
|
})
|
||||||
toast.success(res.message || "Subscription granted")
|
toast.success(res.message || "Subscription granted")
|
||||||
setConfirmOpen(false)
|
setConfirmOpen(false)
|
||||||
onGranted()
|
onGranted()
|
||||||
|
|
@ -163,12 +168,12 @@ export function GrantSubscriptionDialog({
|
||||||
<DialogHeader className="border-b border-grayScale-100 px-4 py-4 sm:px-6">
|
<DialogHeader className="border-b border-grayScale-100 px-4 py-4 sm:px-6">
|
||||||
<DialogTitle className="flex items-center gap-2 text-lg font-bold text-grayScale-900">
|
<DialogTitle className="flex items-center gap-2 text-lg font-bold text-grayScale-900">
|
||||||
<Gift className="h-5 w-5 text-brand-600" aria-hidden />
|
<Gift className="h-5 w-5 text-brand-600" aria-hidden />
|
||||||
Mark as paid
|
Grant subscription
|
||||||
</DialogTitle>
|
</DialogTitle>
|
||||||
<DialogDescription className="text-sm text-grayScale-500">
|
<DialogDescription className="text-sm text-grayScale-500">
|
||||||
Grant plan access
|
Grant plan access
|
||||||
{userName ? ` to ${userName}` : ""}. A payment is recorded at the
|
{userName ? ` to ${userName}` : ""}. Choose whether to record a
|
||||||
plan price.
|
payment at the plan price.
|
||||||
</DialogDescription>
|
</DialogDescription>
|
||||||
</DialogHeader>
|
</DialogHeader>
|
||||||
|
|
||||||
|
|
@ -270,13 +275,70 @@ export function GrantSubscriptionDialog({
|
||||||
An active {formatPlanCategory(selectedPlan.category)} subscription already
|
An active {formatPlanCategory(selectedPlan.category)} subscription already
|
||||||
exists. Extend or cancel it instead.
|
exists. Extend or cancel it instead.
|
||||||
</p>
|
</p>
|
||||||
) : selectedPlan ? (
|
|
||||||
<p className="text-xs text-grayScale-500">
|
|
||||||
Payment recorded: {formatPlanPrice(selectedPlan)}.
|
|
||||||
</p>
|
|
||||||
) : null}
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div className="space-y-2">
|
||||||
|
<p className="text-[11px] font-bold uppercase tracking-wider text-grayScale-400">
|
||||||
|
Payment <span className="text-destructive">*</span>
|
||||||
|
</p>
|
||||||
|
<div
|
||||||
|
className="flex flex-col gap-2 sm:flex-row"
|
||||||
|
role="radiogroup"
|
||||||
|
aria-label="Payment recording"
|
||||||
|
>
|
||||||
|
<label
|
||||||
|
className={cn(
|
||||||
|
"flex flex-1 cursor-pointer flex-col rounded-xl border px-4 py-3 transition-colors",
|
||||||
|
recordPayment
|
||||||
|
? "border-brand-500 bg-brand-50/60 ring-1 ring-brand-500/30"
|
||||||
|
: "border-grayScale-200 bg-white hover:border-grayScale-300",
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
<span className="flex items-center gap-2">
|
||||||
|
<input
|
||||||
|
type="radio"
|
||||||
|
name="grant_record_payment"
|
||||||
|
checked={recordPayment}
|
||||||
|
onChange={() => setRecordPayment(true)}
|
||||||
|
className="h-4 w-4 border-grayScale-300 text-brand-600 focus:ring-brand-500"
|
||||||
|
/>
|
||||||
|
<span className="text-sm font-semibold text-grayScale-800">
|
||||||
|
Record payment
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
<span className="mt-1 pl-6 text-xs text-grayScale-500">
|
||||||
|
Commit a SUCCESS payment
|
||||||
|
{selectedPlan ? ` of ${formatPlanPrice(selectedPlan)}` : " at the plan price"}.
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
|
<label
|
||||||
|
className={cn(
|
||||||
|
"flex flex-1 cursor-pointer flex-col rounded-xl border px-4 py-3 transition-colors",
|
||||||
|
!recordPayment
|
||||||
|
? "border-brand-500 bg-brand-50/60 ring-1 ring-brand-500/30"
|
||||||
|
: "border-grayScale-200 bg-white hover:border-grayScale-300",
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
<span className="flex items-center gap-2">
|
||||||
|
<input
|
||||||
|
type="radio"
|
||||||
|
name="grant_record_payment"
|
||||||
|
checked={!recordPayment}
|
||||||
|
onChange={() => setRecordPayment(false)}
|
||||||
|
className="h-4 w-4 border-grayScale-300 text-brand-600 focus:ring-brand-500"
|
||||||
|
/>
|
||||||
|
<span className="text-sm font-semibold text-grayScale-800">
|
||||||
|
No payment
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
<span className="mt-1 pl-6 text-xs text-grayScale-500">
|
||||||
|
Grant access only — no payments row or revenue.
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
{formError ? <p className="text-sm text-destructive">{formError}</p> : null}
|
{formError ? <p className="text-sm text-destructive">{formError}</p> : null}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -319,15 +381,21 @@ export function GrantSubscriptionDialog({
|
||||||
) : (
|
) : (
|
||||||
" to this learner"
|
" to this learner"
|
||||||
)}
|
)}
|
||||||
? A payment of <strong>{formatPlanPrice(selectedPlan)}</strong> will be
|
{recordPayment ? (
|
||||||
recorded.
|
<>
|
||||||
|
? A payment of <strong>{formatPlanPrice(selectedPlan)}</strong> will be
|
||||||
|
recorded.
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
"? No payment will be recorded."
|
||||||
|
)}
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
"Grant this subscription?"
|
"Grant this subscription?"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
confirmWord={CONFIRM_WORD}
|
confirmWord={CONFIRM_WORD}
|
||||||
confirmLabel="Mark as paid"
|
confirmLabel={recordPayment ? "Grant and record payment" : "Grant without payment"}
|
||||||
confirming={saving}
|
confirming={saving}
|
||||||
onConfirm={handleConfirmGrant}
|
onConfirm={handleConfirmGrant}
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
|
|
@ -230,12 +230,12 @@ function SubscriptionManageCard({
|
||||||
disabled={!markAsPaidEnabled}
|
disabled={!markAsPaidEnabled}
|
||||||
title={
|
title={
|
||||||
!markAsPaidEnabled
|
!markAsPaidEnabled
|
||||||
? "Mark as paid is unavailable while this learner already has an active subscription."
|
? "Grant is unavailable while this learner already has an active subscription."
|
||||||
: undefined
|
: undefined
|
||||||
}
|
}
|
||||||
onClick={onGrant}
|
onClick={onGrant}
|
||||||
>
|
>
|
||||||
Mark as Paid
|
Grant Subscription
|
||||||
</Button>
|
</Button>
|
||||||
) : null}
|
) : null}
|
||||||
{canCancel ? (
|
{canCancel ? (
|
||||||
|
|
@ -310,7 +310,7 @@ function EmptySubscriptionCard({
|
||||||
className="h-10 min-w-0 flex-1 rounded-xl bg-brand-500 text-sm font-semibold text-white hover:bg-brand-600"
|
className="h-10 min-w-0 flex-1 rounded-xl bg-brand-500 text-sm font-semibold text-white hover:bg-brand-600"
|
||||||
onClick={onGrant}
|
onClick={onGrant}
|
||||||
>
|
>
|
||||||
Mark as Paid
|
Grant Subscription
|
||||||
</Button>
|
</Button>
|
||||||
) : null}
|
) : null}
|
||||||
{canCancel ? (
|
{canCancel ? (
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,11 @@ export interface AdminSubscriptionRes {
|
||||||
/** Body for unified grant-or-extend. */
|
/** Body for unified grant-or-extend. */
|
||||||
export interface AdminApplySubscriptionBody {
|
export interface AdminApplySubscriptionBody {
|
||||||
plan_id: number
|
plan_id: number
|
||||||
|
/**
|
||||||
|
* When true (default if omitted), records a SUCCESS payment at the plan price.
|
||||||
|
* When false, grants/extends access with no payments row.
|
||||||
|
*/
|
||||||
|
record_payment?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated Prefer AdminApplySubscriptionBody */
|
/** @deprecated Prefer AdminApplySubscriptionBody */
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user