🐛 fix(payment): Update payment information

This commit is contained in:
web@ppanel 2025-03-12 13:43:06 +07:00
parent 5c710e1add
commit 70d6a38a29
63 changed files with 292 additions and 102 deletions

View File

@ -30,6 +30,7 @@ import {
SheetTitle, SheetTitle,
SheetTrigger, SheetTrigger,
} from '@workspace/ui/components/sheet'; } from '@workspace/ui/components/sheet';
import { MarkdownEditor } from '@workspace/ui/custom-components/editor';
import { EnhancedInput } from '@workspace/ui/custom-components/enhanced-input'; import { EnhancedInput } from '@workspace/ui/custom-components/enhanced-input';
import { Icon } from '@workspace/ui/custom-components/icon'; import { Icon } from '@workspace/ui/custom-components/icon';
import { unitConversion } from '@workspace/ui/utils'; import { unitConversion } from '@workspace/ui/utils';
@ -75,6 +76,7 @@ export default function PaymentForm<T>({
fee_mode: z.coerce.number().min(0).max(2), fee_mode: z.coerce.number().min(0).max(2),
fee_percent: z.coerce.number().optional(), fee_percent: z.coerce.number().optional(),
fee_amount: z.coerce.number().optional(), fee_amount: z.coerce.number().optional(),
description: z.string().optional(),
}); });
const form = useForm<z.infer<typeof formSchema>>({ const form = useForm<z.infer<typeof formSchema>>({
@ -376,6 +378,23 @@ export default function PaymentForm<T>({
))} ))}
</div> </div>
)} )}
<FormField
control={form.control}
name='description'
render={({ field }) => (
<FormItem>
<FormLabel>{t('description')}</FormLabel>
<FormControl>
<MarkdownEditor
value={field.value}
onChange={(value) => form.setValue(field.name, value as string)}
/>
</FormControl>
<FormMessage />
</FormItem>
)}
/>
</div> </div>
</form> </form>
</Form> </Form>

View File

@ -63,6 +63,7 @@ export const useGlobalStore = create<GlobalStore>((set) => ({
verify_code_interval: 60, verify_code_interval: 60,
}, },
oauth_methods: [], oauth_methods: [],
web_ad: false,
}, },
user: undefined, user: undefined,
setCommon: (common) => setCommon: (common) =>

View File

@ -19,6 +19,8 @@
"delete": "Smazat", "delete": "Smazat",
"deleteSuccess": "Úspěšně smazáno", "deleteSuccess": "Úspěšně smazáno",
"deleteWarning": "Opravdu chcete smazat tuto platební metodu? Tuto akci nelze vrátit zpět.", "deleteWarning": "Opravdu chcete smazat tuto platební metodu? Tuto akci nelze vrátit zpět.",
"description": "Popis",
"descriptionPlaceholder": "Zadejte popis platební metody",
"domain": "Doména", "domain": "Doména",
"domainPlaceholder": "volitelné, např. {example}", "domainPlaceholder": "volitelné, např. {example}",
"edit": "Upravit", "edit": "Upravit",

View File

@ -19,6 +19,8 @@
"delete": "Löschen", "delete": "Löschen",
"deleteSuccess": "Erfolgreich gelöscht", "deleteSuccess": "Erfolgreich gelöscht",
"deleteWarning": "Sind Sie sicher, dass Sie diese Zahlungsmethode löschen möchten? Diese Aktion kann nicht rückgängig gemacht werden.", "deleteWarning": "Sind Sie sicher, dass Sie diese Zahlungsmethode löschen möchten? Diese Aktion kann nicht rückgängig gemacht werden.",
"description": "Beschreibung",
"descriptionPlaceholder": "Geben Sie die Beschreibung der Zahlungsmethode ein",
"domain": "Domain", "domain": "Domain",
"domainPlaceholder": "optional, z.B. {example}", "domainPlaceholder": "optional, z.B. {example}",
"edit": "Bearbeiten", "edit": "Bearbeiten",

View File

@ -19,6 +19,8 @@
"delete": "Delete", "delete": "Delete",
"deleteSuccess": "Deleted successfully", "deleteSuccess": "Deleted successfully",
"deleteWarning": "Are you sure you want to delete this payment method? This action cannot be undone.", "deleteWarning": "Are you sure you want to delete this payment method? This action cannot be undone.",
"description": "Description",
"descriptionPlaceholder": "Enter payment method description",
"domain": "Domain", "domain": "Domain",
"domainPlaceholder": "optional, e.g. {example}", "domainPlaceholder": "optional, e.g. {example}",
"edit": "Edit", "edit": "Edit",

View File

@ -19,6 +19,8 @@
"delete": "Eliminar", "delete": "Eliminar",
"deleteSuccess": "Eliminado con éxito", "deleteSuccess": "Eliminado con éxito",
"deleteWarning": "¿Está seguro de que desea eliminar este método de pago? Esta acción no se puede deshacer.", "deleteWarning": "¿Está seguro de que desea eliminar este método de pago? Esta acción no se puede deshacer.",
"description": "Descripción",
"descriptionPlaceholder": "Ingrese la descripción del método de pago",
"domain": "Dominio", "domain": "Dominio",
"domainPlaceholder": "opcional, p. ej. {example}", "domainPlaceholder": "opcional, p. ej. {example}",
"edit": "Editar", "edit": "Editar",

View File

@ -19,6 +19,8 @@
"delete": "Eliminar", "delete": "Eliminar",
"deleteSuccess": "Eliminado con éxito", "deleteSuccess": "Eliminado con éxito",
"deleteWarning": "¿Está seguro de que desea eliminar este método de pago? Esta acción no se puede deshacer.", "deleteWarning": "¿Está seguro de que desea eliminar este método de pago? Esta acción no se puede deshacer.",
"description": "Descripción",
"descriptionPlaceholder": "Ingresa la descripción del método de pago",
"domain": "Dominio", "domain": "Dominio",
"domainPlaceholder": "opcional, p. ej. {example}", "domainPlaceholder": "opcional, p. ej. {example}",
"edit": "Editar", "edit": "Editar",

View File

@ -19,6 +19,8 @@
"delete": "حذف", "delete": "حذف",
"deleteSuccess": "با موفقیت حذف شد", "deleteSuccess": "با موفقیت حذف شد",
"deleteWarning": "آیا مطمئن هستید که می‌خواهید این روش پرداخت را حذف کنید؟ این عمل قابل بازگشت نیست.", "deleteWarning": "آیا مطمئن هستید که می‌خواهید این روش پرداخت را حذف کنید؟ این عمل قابل بازگشت نیست.",
"description": "توضیحات",
"descriptionPlaceholder": "توضیحات روش پرداخت را وارد کنید",
"domain": "دامنه", "domain": "دامنه",
"domainPlaceholder": "اختیاری، به عنوان مثال {example}", "domainPlaceholder": "اختیاری، به عنوان مثال {example}",
"edit": "ویرایش", "edit": "ویرایش",

View File

@ -19,6 +19,8 @@
"delete": "Poista", "delete": "Poista",
"deleteSuccess": "Poisto onnistui", "deleteSuccess": "Poisto onnistui",
"deleteWarning": "Oletko varma, että haluat poistaa tämän maksutavan? Tätä toimintoa ei voi peruuttaa.", "deleteWarning": "Oletko varma, että haluat poistaa tämän maksutavan? Tätä toimintoa ei voi peruuttaa.",
"description": "Kuvaus",
"descriptionPlaceholder": "Syötä maksutavan kuvaus",
"domain": "Verkkotunnus", "domain": "Verkkotunnus",
"domainPlaceholder": "valinnainen, esim. {esimerkki}", "domainPlaceholder": "valinnainen, esim. {esimerkki}",
"edit": "Muokkaa", "edit": "Muokkaa",

View File

@ -19,6 +19,8 @@
"delete": "Supprimer", "delete": "Supprimer",
"deleteSuccess": "Supprimé avec succès", "deleteSuccess": "Supprimé avec succès",
"deleteWarning": "Êtes-vous sûr de vouloir supprimer ce mode de paiement ? Cette action ne peut pas être annulée.", "deleteWarning": "Êtes-vous sûr de vouloir supprimer ce mode de paiement ? Cette action ne peut pas être annulée.",
"description": "Description",
"descriptionPlaceholder": "Entrez la description du mode de paiement",
"domain": "Domaine", "domain": "Domaine",
"domainPlaceholder": "facultatif, par exemple {exemple}", "domainPlaceholder": "facultatif, par exemple {exemple}",
"edit": "Modifier", "edit": "Modifier",

View File

@ -19,6 +19,8 @@
"delete": "हटाएं", "delete": "हटाएं",
"deleteSuccess": "सफलता से हटाया गया", "deleteSuccess": "सफलता से हटाया गया",
"deleteWarning": "क्या आप वास्तव में इस भुगतान विधि को हटाना चाहते हैं? यह क्रिया पूर्ववत नहीं की जा सकती।", "deleteWarning": "क्या आप वास्तव में इस भुगतान विधि को हटाना चाहते हैं? यह क्रिया पूर्ववत नहीं की जा सकती।",
"description": "विवरण",
"descriptionPlaceholder": "भुगतान विधि का विवरण दर्ज करें",
"domain": "डोमेन", "domain": "डोमेन",
"domainPlaceholder": "वैकल्पिक, जैसे कि {example}", "domainPlaceholder": "वैकल्पिक, जैसे कि {example}",
"edit": "संपादित करें", "edit": "संपादित करें",

View File

@ -19,6 +19,8 @@
"delete": "Törlés", "delete": "Törlés",
"deleteSuccess": "Sikeresen törölve", "deleteSuccess": "Sikeresen törölve",
"deleteWarning": "Biztosan törölni szeretné ezt a fizetési módot? Ez a művelet nem vonható vissza.", "deleteWarning": "Biztosan törölni szeretné ezt a fizetési módot? Ez a művelet nem vonható vissza.",
"description": "Leírás",
"descriptionPlaceholder": "Írja be a fizetési mód leírását",
"domain": "Domain", "domain": "Domain",
"domainPlaceholder": "opcionális, pl. {példa}", "domainPlaceholder": "opcionális, pl. {példa}",
"edit": "Szerkesztés", "edit": "Szerkesztés",

View File

@ -19,6 +19,8 @@
"delete": "削除", "delete": "削除",
"deleteSuccess": "削除成功", "deleteSuccess": "削除成功",
"deleteWarning": "この支払い方法を削除してもよろしいですか?この操作は元に戻せません。", "deleteWarning": "この支払い方法を削除してもよろしいですか?この操作は元に戻せません。",
"description": "説明",
"descriptionPlaceholder": "支払い方法の説明を入力してください",
"domain": "ドメイン", "domain": "ドメイン",
"domainPlaceholder": "任意、例:{example}", "domainPlaceholder": "任意、例:{example}",
"edit": "編集", "edit": "編集",

View File

@ -19,6 +19,8 @@
"delete": "삭제", "delete": "삭제",
"deleteSuccess": "삭제 성공", "deleteSuccess": "삭제 성공",
"deleteWarning": "이 결제 수단을 삭제하시겠습니까? 이 작업은 취소할 수 없습니다.", "deleteWarning": "이 결제 수단을 삭제하시겠습니까? 이 작업은 취소할 수 없습니다.",
"description": "설명",
"descriptionPlaceholder": "결제 수단 설명을 입력하세요",
"domain": "도메인", "domain": "도메인",
"domainPlaceholder": "선택 사항, 예: {example}", "domainPlaceholder": "선택 사항, 예: {example}",
"edit": "편집", "edit": "편집",

View File

@ -19,6 +19,8 @@
"delete": "Slett", "delete": "Slett",
"deleteSuccess": "Slettet med suksess", "deleteSuccess": "Slettet med suksess",
"deleteWarning": "Er du sikker på at du vil slette denne betalingsmetoden? Denne handlingen kan ikke angres.", "deleteWarning": "Er du sikker på at du vil slette denne betalingsmetoden? Denne handlingen kan ikke angres.",
"description": "Beskrivelse",
"descriptionPlaceholder": "Skriv inn beskrivelse av betalingsmetode",
"domain": "Domene", "domain": "Domene",
"domainPlaceholder": "valgfritt, f.eks. {example}", "domainPlaceholder": "valgfritt, f.eks. {example}",
"edit": "Rediger", "edit": "Rediger",

View File

@ -19,6 +19,8 @@
"delete": "Usuń", "delete": "Usuń",
"deleteSuccess": "Usunięto pomyślnie", "deleteSuccess": "Usunięto pomyślnie",
"deleteWarning": "Czy na pewno chcesz usunąć tę metodę płatności? Ta akcja jest nieodwracalna.", "deleteWarning": "Czy na pewno chcesz usunąć tę metodę płatności? Ta akcja jest nieodwracalna.",
"description": "Opis",
"descriptionPlaceholder": "Wprowadź opis metody płatności",
"domain": "Domena", "domain": "Domena",
"domainPlaceholder": "opcjonalnie, np. {example}", "domainPlaceholder": "opcjonalnie, np. {example}",
"edit": "Edytuj", "edit": "Edytuj",

View File

@ -19,6 +19,8 @@
"delete": "Excluir", "delete": "Excluir",
"deleteSuccess": "Excluído com sucesso", "deleteSuccess": "Excluído com sucesso",
"deleteWarning": "Você tem certeza de que deseja excluir este método de pagamento? Esta ação não pode ser desfeita.", "deleteWarning": "Você tem certeza de que deseja excluir este método de pagamento? Esta ação não pode ser desfeita.",
"description": "Descrição",
"descriptionPlaceholder": "Insira a descrição do método de pagamento",
"domain": "Domínio", "domain": "Domínio",
"domainPlaceholder": "opcional, por exemplo, {exemplo}", "domainPlaceholder": "opcional, por exemplo, {exemplo}",
"edit": "Editar", "edit": "Editar",

View File

@ -19,6 +19,8 @@
"delete": "Șterge", "delete": "Șterge",
"deleteSuccess": "Șters cu succes", "deleteSuccess": "Șters cu succes",
"deleteWarning": "Ești sigur că vrei să ștergi această metodă de plată? Această acțiune nu poate fi anulată.", "deleteWarning": "Ești sigur că vrei să ștergi această metodă de plată? Această acțiune nu poate fi anulată.",
"description": "Descriere",
"descriptionPlaceholder": "Introduceți descrierea metodei de plată",
"domain": "Domeniu", "domain": "Domeniu",
"domainPlaceholder": "opțional, de exemplu {example}", "domainPlaceholder": "opțional, de exemplu {example}",
"edit": "Editează", "edit": "Editează",

View File

@ -19,6 +19,8 @@
"delete": "Удалить", "delete": "Удалить",
"deleteSuccess": "Успешно удалено", "deleteSuccess": "Успешно удалено",
"deleteWarning": "Вы уверены, что хотите удалить этот способ оплаты? Это действие нельзя отменить.", "deleteWarning": "Вы уверены, что хотите удалить этот способ оплаты? Это действие нельзя отменить.",
"description": "Описание",
"descriptionPlaceholder": "Введите описание метода оплаты",
"domain": "Домен", "domain": "Домен",
"domainPlaceholder": "необязательно, например, {example}", "domainPlaceholder": "необязательно, например, {example}",
"edit": "Редактировать", "edit": "Редактировать",

View File

@ -19,6 +19,8 @@
"delete": "ลบ", "delete": "ลบ",
"deleteSuccess": "ลบสำเร็จ", "deleteSuccess": "ลบสำเร็จ",
"deleteWarning": "คุณแน่ใจหรือไม่ว่าต้องการลบวิธีการชำระเงินนี้? การกระทำนี้ไม่สามารถย้อนกลับได้", "deleteWarning": "คุณแน่ใจหรือไม่ว่าต้องการลบวิธีการชำระเงินนี้? การกระทำนี้ไม่สามารถย้อนกลับได้",
"description": "คำอธิบาย",
"descriptionPlaceholder": "กรอกคำอธิบายวิธีการชำระเงิน",
"domain": "โดเมน", "domain": "โดเมน",
"domainPlaceholder": "ไม่บังคับ เช่น {example}", "domainPlaceholder": "ไม่บังคับ เช่น {example}",
"edit": "แก้ไข", "edit": "แก้ไข",

View File

@ -19,6 +19,8 @@
"delete": "Sil", "delete": "Sil",
"deleteSuccess": "Başarıyla silindi", "deleteSuccess": "Başarıyla silindi",
"deleteWarning": "Bu ödeme yöntemini silmek istediğinize emin misiniz? Bu işlem geri alınamaz.", "deleteWarning": "Bu ödeme yöntemini silmek istediğinize emin misiniz? Bu işlem geri alınamaz.",
"description": "Açıklama",
"descriptionPlaceholder": "Ödeme yöntemi açıklamasını girin",
"domain": "Alan Adı", "domain": "Alan Adı",
"domainPlaceholder": "isteğe bağlı, örn. {example}", "domainPlaceholder": "isteğe bağlı, örn. {example}",
"edit": "Düzenle", "edit": "Düzenle",

View File

@ -19,6 +19,8 @@
"delete": "Видалити", "delete": "Видалити",
"deleteSuccess": "Успішно видалено", "deleteSuccess": "Успішно видалено",
"deleteWarning": "Ви впевнені, що хочете видалити цей спосіб оплати? Цю дію не можна скасувати.", "deleteWarning": "Ви впевнені, що хочете видалити цей спосіб оплати? Цю дію не можна скасувати.",
"description": "Опис",
"descriptionPlaceholder": "Введіть опис способу оплати",
"domain": "Домен", "domain": "Домен",
"domainPlaceholder": "необов'язково, наприклад, {example}", "domainPlaceholder": "необов'язково, наприклад, {example}",
"edit": "Редагувати", "edit": "Редагувати",

View File

@ -19,6 +19,8 @@
"delete": "Xóa", "delete": "Xóa",
"deleteSuccess": "Xóa thành công", "deleteSuccess": "Xóa thành công",
"deleteWarning": "Bạn có chắc chắn muốn xóa phương thức thanh toán này không? Hành động này không thể hoàn tác.", "deleteWarning": "Bạn có chắc chắn muốn xóa phương thức thanh toán này không? Hành động này không thể hoàn tác.",
"description": "Mô tả",
"descriptionPlaceholder": "Nhập mô tả phương thức thanh toán",
"domain": "Miền", "domain": "Miền",
"domainPlaceholder": "tùy chọn, ví dụ: {example}", "domainPlaceholder": "tùy chọn, ví dụ: {example}",
"edit": "Chỉnh Sửa", "edit": "Chỉnh Sửa",

View File

@ -19,6 +19,8 @@
"delete": "删除", "delete": "删除",
"deleteSuccess": "删除成功", "deleteSuccess": "删除成功",
"deleteWarning": "您确定要删除此支付方式吗?此操作无法撤销。", "deleteWarning": "您确定要删除此支付方式吗?此操作无法撤销。",
"description": "描述",
"descriptionPlaceholder": "输入支付方式描述",
"domain": "域名", "domain": "域名",
"domainPlaceholder": "可选,例如 {example}", "domainPlaceholder": "可选,例如 {example}",
"edit": "编辑", "edit": "编辑",

View File

@ -19,6 +19,8 @@
"delete": "刪除", "delete": "刪除",
"deleteSuccess": "刪除成功", "deleteSuccess": "刪除成功",
"deleteWarning": "您確定要刪除此付款方式嗎?此操作無法撤銷。", "deleteWarning": "您確定要刪除此付款方式嗎?此操作無法撤銷。",
"description": "描述",
"descriptionPlaceholder": "輸入付款方式描述",
"domain": "域名", "domain": "域名",
"domainPlaceholder": "可選,例如 {example}", "domainPlaceholder": "可選,例如 {example}",
"edit": "編輯", "edit": "編輯",

View File

@ -1,5 +1,5 @@
// @ts-ignore // @ts-ignore
// API 更新时间: // API 更新时间:
// API 唯一标识: // API 唯一标识:
import * as ads from './ads'; import * as ads from './ads';

View File

@ -233,6 +233,7 @@ declare namespace API {
type CreatePaymentMethodRequest = { type CreatePaymentMethodRequest = {
name: string; name: string;
platform: string; platform: string;
description: string;
icon?: string; icon?: string;
domain?: string; domain?: string;
config: Record<string, any>; config: Record<string, any>;
@ -964,6 +965,7 @@ declare namespace API {
id: number; id: number;
name: string; name: string;
platform: string; platform: string;
description: string;
icon: string; icon: string;
fee_mode: number; fee_mode: number;
fee_percent: number; fee_percent: number;
@ -974,6 +976,7 @@ declare namespace API {
id: number; id: number;
name: string; name: string;
platform: string; platform: string;
description: string;
icon?: string; icon?: string;
domain?: string; domain?: string;
config: Record<string, any>; config: Record<string, any>;
@ -987,6 +990,7 @@ declare namespace API {
id: number; id: number;
name: string; name: string;
platform: string; platform: string;
description: string;
icon: string; icon: string;
domain: string; domain: string;
config: Record<string, any>; config: Record<string, any>;
@ -1524,6 +1528,7 @@ declare namespace API {
id: number; id: number;
name: string; name: string;
platform: string; platform: string;
description: string;
icon?: string; icon?: string;
domain?: string; domain?: string;
config: Record<string, any>; config: Record<string, any>;

View File

@ -1,5 +1,5 @@
// @ts-ignore // @ts-ignore
// API 更新时间: // API 更新时间:
// API 唯一标识: // API 唯一标识:
import * as auth from './auth'; import * as auth from './auth';

View File

@ -364,6 +364,7 @@ declare namespace API {
id: number; id: number;
name: string; name: string;
platform: string; platform: string;
description: string;
icon: string; icon: string;
fee_mode: number; fee_mode: number;
fee_percent: number; fee_percent: number;
@ -374,6 +375,7 @@ declare namespace API {
id: number; id: number;
name: string; name: string;
platform: string; platform: string;
description: string;
icon?: string; icon?: string;
domain?: string; domain?: string;
config: Record<string, any>; config: Record<string, any>;
@ -387,6 +389,7 @@ declare namespace API {
id: number; id: number;
name: string; name: string;
platform: string; platform: string;
description: string;
icon: string; icon: string;
domain: string; domain: string;
config: Record<string, any>; config: Record<string, any>;

View File

@ -25,7 +25,7 @@ export default function Content({ subscription }: { subscription?: API.Subscribe
const [params, setParams] = useState<API.PortalPurchaseRequest>({ const [params, setParams] = useState<API.PortalPurchaseRequest>({
quantity: 1, quantity: 1,
subscribe_id: 0, subscribe_id: 0,
payment: '', payment: -1,
coupon: '', coupon: '',
platform: 'email', platform: 'email',
identifier: '', identifier: '',

View File

@ -27,11 +27,7 @@ const DurationSelector: React.FC<DurationSelectorProps> = ({
[onChange], [onChange],
); );
const DurationOption: React.FC<{ value: string; label: string; discount?: number }> = ({ const DurationOption: React.FC<{ value: string; label: string }> = ({ value, label }) => (
value,
label,
discount,
}) => (
<div className='relative'> <div className='relative'>
<RadioGroupItem value={value} id={value} className='peer sr-only' /> <RadioGroupItem value={value} id={value} className='peer sr-only' />
<Label <Label
@ -39,11 +35,14 @@ const DurationSelector: React.FC<DurationSelectorProps> = ({
className='border-muted bg-popover hover:bg-accent hover:text-accent-foreground peer-data-[state=checked]:border-primary relative flex h-full flex-col items-center justify-center gap-2 rounded-md border-2 p-2' className='border-muted bg-popover hover:bg-accent hover:text-accent-foreground peer-data-[state=checked]:border-primary relative flex h-full flex-col items-center justify-center gap-2 rounded-md border-2 p-2'
> >
{label} {label}
{discount && <Badge variant='destructive'>-{discount}%</Badge>}
</Label> </Label>
</div> </div>
); );
// 查找当前选中项的折扣信息
const currentDiscount = discounts.find((item) => item.quantity === quantity)?.discount;
const discountPercentage = currentDiscount ? 100 - currentDiscount : 0;
return ( return (
<> <>
<div className='font-semibold'>{t('purchaseDuration')}</div> <div className='font-semibold'>{t('purchaseDuration')}</div>
@ -58,10 +57,19 @@ const DurationSelector: React.FC<DurationSelectorProps> = ({
key={item.quantity} key={item.quantity}
value={String(item.quantity)} value={String(item.quantity)}
label={`${item.quantity} / ${t(unitTime)}`} label={`${item.quantity} / ${t(unitTime)}`}
discount={100 - item.discount}
/> />
))} ))}
</RadioGroup> </RadioGroup>
<div className='flex items-center justify-between'>
<span className='text-muted-foreground text-sm'>{t('discountInfo')}:</span>
{discountPercentage > 0 ? (
<Badge variant='destructive' className='h-6 text-sm'>
-{discountPercentage}% {t('discount')}
</Badge>
) : (
<span className='text-muted-foreground h-6 text-sm'>--</span>
)}
</div>
</> </>
); );
}; };

View File

@ -1,8 +1,6 @@
'use client'; 'use client';
import { getAvailablePaymentMethods } from '@/services/user/portal'; import { getAvailablePaymentMethods } from '@/services/user/portal';
// import { getAvailablePaymentMethods } from '@/services/user/payment';
// import { getAvailablePaymentMethods } from '@/services/user/payment';
import { useQuery } from '@tanstack/react-query'; import { useQuery } from '@tanstack/react-query';
import { Label } from '@workspace/ui/components/label'; import { Label } from '@workspace/ui/components/label';
import { RadioGroup, RadioGroupItem } from '@workspace/ui/components/radio-group'; import { RadioGroup, RadioGroupItem } from '@workspace/ui/components/radio-group';
@ -11,8 +9,8 @@ import Image from 'next/image';
import React, { memo } from 'react'; import React, { memo } from 'react';
interface PaymentMethodsProps { interface PaymentMethodsProps {
value: string; value: number;
onChange: (value: string) => void; onChange: (value: number) => void;
balance?: boolean; balance?: boolean;
} }
@ -24,9 +22,9 @@ const PaymentMethods: React.FC<PaymentMethodsProps> = ({ value, onChange, balanc
queryFn: async () => { queryFn: async () => {
const { data } = await getAvailablePaymentMethods(); const { data } = await getAvailablePaymentMethods();
const methods = data.data?.list || []; const methods = data.data?.list || [];
if (!value && methods[0]?.mark) onChange(methods[0]?.mark); if (!value && methods[0]?.id) onChange(methods[0]?.id);
if (balance) return methods; if (balance) return methods;
return methods.filter((item) => item.mark !== 'balance'); return methods.filter((item) => item.id !== -1);
}, },
}); });
return ( return (
@ -34,26 +32,26 @@ const PaymentMethods: React.FC<PaymentMethodsProps> = ({ value, onChange, balanc
<div className='font-semibold'>{t('paymentMethod')}</div> <div className='font-semibold'>{t('paymentMethod')}</div>
<RadioGroup <RadioGroup
className='grid grid-cols-2 gap-2 md:grid-cols-5' className='grid grid-cols-2 gap-2 md:grid-cols-5'
value={value} value={String(value)}
onValueChange={onChange} onValueChange={(val) => onChange(Number(val))}
> >
{data?.map((item) => ( {data?.map((item) => (
<div key={item.mark}> <div key={item.id}>
<RadioGroupItem value={item.mark} id={item.mark} className='peer sr-only' /> <RadioGroupItem value={String(item.id)} id={String(item.id)} className='peer sr-only' />
<Label <Label
htmlFor={item.mark} htmlFor={String(item.id)}
className='border-muted bg-popover hover:bg-accent hover:text-accent-foreground peer-data-[state=checked]:border-primary flex flex-col items-center justify-between rounded-md border-2 py-2' className='border-muted bg-popover hover:bg-accent hover:text-accent-foreground peer-data-[state=checked]:border-primary flex flex-col items-center justify-between rounded-md border-2 py-2'
> >
<div className='mb-3 size-12'> <div className='mb-3 size-12'>
<Image <Image
src={item.icon || `/payment/${item.mark}.svg`} src={item.icon || `/payment/balance.svg`}
width={48} width={48}
height={48} height={48}
alt={item.name || t(`methods.${item.mark}`)} alt={item.name}
/> />
</div> </div>
<span className='w-full overflow-hidden text-ellipsis whitespace-nowrap text-center'> <span className='w-full overflow-hidden text-ellipsis whitespace-nowrap text-center'>
{item.name || t(`methods.${item.mark}`)} {item.name}
</span> </span>
</Label> </Label>
</div> </div>

View File

@ -29,7 +29,7 @@ export default function Purchase({ subscribe, setSubscribe }: Readonly<PurchaseP
const [params, setParams] = useState<Partial<API.PurchaseOrderRequest>>({ const [params, setParams] = useState<Partial<API.PurchaseOrderRequest>>({
quantity: 1, quantity: 1,
subscribe_id: 0, subscribe_id: 0,
payment: 'balance', payment: -1,
coupon: '', coupon: '',
}); });
const [loading, startTransition] = useTransition(); const [loading, startTransition] = useTransition();

View File

@ -2,8 +2,6 @@
import useGlobalStore from '@/config/use-global'; import useGlobalStore from '@/config/use-global';
import { recharge } from '@/services/user/order'; import { recharge } from '@/services/user/order';
import { getAvailablePaymentMethods } from '@/services/user/payment';
import { useQuery } from '@tanstack/react-query';
import { Button, ButtonProps } from '@workspace/ui/components/button'; import { Button, ButtonProps } from '@workspace/ui/components/button';
import { import {
Dialog, Dialog,
@ -13,15 +11,13 @@ import {
DialogTitle, DialogTitle,
DialogTrigger, DialogTrigger,
} from '@workspace/ui/components/dialog'; } from '@workspace/ui/components/dialog';
import { Label } from '@workspace/ui/components/label';
import { RadioGroup, RadioGroupItem } from '@workspace/ui/components/radio-group';
import { EnhancedInput } from '@workspace/ui/custom-components/enhanced-input'; import { EnhancedInput } from '@workspace/ui/custom-components/enhanced-input';
import { unitConversion } from '@workspace/ui/utils'; import { unitConversion } from '@workspace/ui/utils';
import { LoaderCircle } from 'lucide-react'; import { LoaderCircle } from 'lucide-react';
import { useTranslations } from 'next-intl'; import { useTranslations } from 'next-intl';
import Image from 'next/image';
import { useRouter } from 'next/navigation'; import { useRouter } from 'next/navigation';
import { useEffect, useState, useTransition } from 'react'; import { useState, useTransition } from 'react';
import PaymentMethods from './payment-methods';
export default function Recharge(props: Readonly<ButtonProps>) { export default function Recharge(props: Readonly<ButtonProps>) {
const t = useTranslations('subscribe'); const t = useTranslations('subscribe');
@ -34,27 +30,9 @@ export default function Recharge(props: Readonly<ButtonProps>) {
const [params, setParams] = useState<API.RechargeOrderRequest>({ const [params, setParams] = useState<API.RechargeOrderRequest>({
amount: 0, amount: 0,
payment: '', payment: 1,
}); });
const { data: paymentMethods } = useQuery({
enabled: open,
queryKey: ['getAvailablePaymentMethods'],
queryFn: async () => {
const { data } = await getAvailablePaymentMethods();
return data.data?.list || [];
},
});
useEffect(() => {
if (paymentMethods?.length) {
setParams((prev) => ({
...prev,
payment: paymentMethods.find((item) => item.mark !== 'balance')?.mark as string,
}));
}
}, [paymentMethods]);
return ( return (
<Dialog open={open} onOpenChange={setOpen}> <Dialog open={open} onOpenChange={setOpen}>
<DialogTrigger asChild> <DialogTrigger asChild>
@ -86,43 +64,10 @@ export default function Recharge(props: Readonly<ButtonProps>) {
suffix={currency.currency_unit} suffix={currency.currency_unit}
/> />
</div> </div>
<div className='font-semibold'>{t('paymentMethod')}</div> <PaymentMethods
<RadioGroup
className='grid grid-cols-5 gap-2'
value={params.payment} value={params.payment}
onValueChange={(value) => { onChange={(value) => setParams({ ...params, payment: value })}
setParams({ />
...params,
payment: value,
});
}}
>
{paymentMethods
?.filter((item) => item.mark !== 'balance')
?.map((item) => {
return (
<div key={item.mark}>
<RadioGroupItem value={item.mark} id={item.mark} className='peer sr-only' />
<Label
htmlFor={item.mark}
className='border-muted bg-popover hover:bg-accent hover:text-accent-foreground peer-data-[state=checked]:border-primary [&:has([data-state=checked])]:border-primary flex flex-col items-center justify-between rounded-md border-2 py-2'
>
<div className='mb-3 size-12'>
<Image
src={item.icon || `/payment/${item.mark}.svg`}
width={48}
height={48}
alt={item.name!}
/>
</div>
<span className='w-full overflow-hidden text-ellipsis whitespace-nowrap text-center'>
{item.name || t(`methods.${item.mark}`)}
</span>
</Label>
</div>
);
})}
</RadioGroup>
</div> </div>
<Button <Button
className='fixed bottom-0 left-0 w-full rounded-none md:relative md:mt-6' className='fixed bottom-0 left-0 w-full rounded-none md:relative md:mt-6'

View File

@ -35,7 +35,7 @@ export default function Renewal({ id, subscribe }: Readonly<RenewalProps>) {
const router = useRouter(); const router = useRouter();
const [params, setParams] = useState<Partial<API.RenewalOrderRequest>>({ const [params, setParams] = useState<Partial<API.RenewalOrderRequest>>({
quantity: 1, quantity: 1,
payment: 'balance', payment: -1,
coupon: '', coupon: '',
user_subscribe_id: id, user_subscribe_id: id,
}); });

View File

@ -28,7 +28,7 @@ export default function ResetTraffic({ id, replacement }: Readonly<ResetTrafficP
const [open, setOpen] = useState<boolean>(false); const [open, setOpen] = useState<boolean>(false);
const router = useRouter(); const router = useRouter();
const [params, setParams] = useState<API.ResetTrafficOrderRequest>({ const [params, setParams] = useState<API.ResetTrafficOrderRequest>({
payment: 'balance', payment: -1,
user_subscribe_id: id, user_subscribe_id: id,
}); });
const [loading, startTransition] = useTransition(); const [loading, startTransition] = useTransition();

View File

@ -69,6 +69,7 @@ export const useGlobalStore = create<GlobalStore>((set, get) => ({
verify_code_interval: 60, verify_code_interval: 60,
}, },
oauth_methods: [], oauth_methods: [],
web_ad: false,
}, },
user: undefined, user: undefined,
setCommon: (common) => setCommon: (common) =>

View File

@ -27,6 +27,8 @@
"connectionSpeed": "Rychlost připojení", "connectionSpeed": "Rychlost připojení",
"productDetail": "Detaily produktu" "productDetail": "Detaily produktu"
}, },
"discount": "Sleva",
"discountInfo": "Informace o slevě",
"enterAmount": "Zadejte částku dobití", "enterAmount": "Zadejte částku dobití",
"enterCoupon": "Zadejte kód kupónu", "enterCoupon": "Zadejte kód kupónu",
"methods": { "methods": {

View File

@ -27,6 +27,8 @@
"connectionSpeed": "Verbindungsgeschwindigkeit", "connectionSpeed": "Verbindungsgeschwindigkeit",
"productDetail": "Produktdetails" "productDetail": "Produktdetails"
}, },
"discount": "Rabatt",
"discountInfo": "Rabattinformationen",
"enterAmount": "Geben Sie den Aufladebetrag ein", "enterAmount": "Geben Sie den Aufladebetrag ein",
"enterCoupon": "Gutscheincode eingeben", "enterCoupon": "Gutscheincode eingeben",
"methods": { "methods": {

View File

@ -27,6 +27,8 @@
"connectionSpeed": "Connection Speed", "connectionSpeed": "Connection Speed",
"productDetail": "Product Details" "productDetail": "Product Details"
}, },
"discount": "Discount",
"discountInfo": "Discount Info",
"enterAmount": "Enter recharge amount", "enterAmount": "Enter recharge amount",
"enterCoupon": "Enter Coupon Code", "enterCoupon": "Enter Coupon Code",
"methods": { "methods": {

View File

@ -27,6 +27,8 @@
"connectionSpeed": "Velocidad de conexión", "connectionSpeed": "Velocidad de conexión",
"productDetail": "Detalles del producto" "productDetail": "Detalles del producto"
}, },
"discount": "Descuento",
"discountInfo": "Información del Descuento",
"enterAmount": "Ingrese el monto de recarga", "enterAmount": "Ingrese el monto de recarga",
"enterCoupon": "Introduce el código de cupón", "enterCoupon": "Introduce el código de cupón",
"methods": { "methods": {

View File

@ -27,6 +27,8 @@
"connectionSpeed": "Velocidad de conexión", "connectionSpeed": "Velocidad de conexión",
"productDetail": "Detalles del producto" "productDetail": "Detalles del producto"
}, },
"discount": "Descuento",
"discountInfo": "Información del Descuento",
"enterAmount": "Ingresa el monto de recarga", "enterAmount": "Ingresa el monto de recarga",
"enterCoupon": "Ingresa el código de cupón", "enterCoupon": "Ingresa el código de cupón",
"methods": { "methods": {

View File

@ -27,6 +27,8 @@
"connectionSpeed": "سرعت اتصال", "connectionSpeed": "سرعت اتصال",
"productDetail": "جزئیات محصول" "productDetail": "جزئیات محصول"
}, },
"discount": "تخفیف",
"discountInfo": "اطلاعات تخفیف",
"enterAmount": "مبلغ شارژ را وارد کنید", "enterAmount": "مبلغ شارژ را وارد کنید",
"enterCoupon": "کد تخفیف را وارد کنید", "enterCoupon": "کد تخفیف را وارد کنید",
"methods": { "methods": {

View File

@ -27,6 +27,8 @@
"connectionSpeed": "Yhteysnopeus", "connectionSpeed": "Yhteysnopeus",
"productDetail": "Tuotteen tiedot" "productDetail": "Tuotteen tiedot"
}, },
"discount": "Alennus",
"discountInfo": "Alennustiedot",
"enterAmount": "Syötä latausmäärä", "enterAmount": "Syötä latausmäärä",
"enterCoupon": "Syötä alennuskoodi", "enterCoupon": "Syötä alennuskoodi",
"methods": { "methods": {

View File

@ -27,6 +27,8 @@
"connectionSpeed": "Vitesse de connexion", "connectionSpeed": "Vitesse de connexion",
"productDetail": "Détails du produit" "productDetail": "Détails du produit"
}, },
"discount": "Remise",
"discountInfo": "Informations sur la remise",
"enterAmount": "Entrez le montant de la recharge", "enterAmount": "Entrez le montant de la recharge",
"enterCoupon": "Entrez le code promo", "enterCoupon": "Entrez le code promo",
"methods": { "methods": {

View File

@ -27,6 +27,8 @@
"connectionSpeed": "कनेक्शन गति", "connectionSpeed": "कनेक्शन गति",
"productDetail": "उत्पाद विवरण" "productDetail": "उत्पाद विवरण"
}, },
"discount": "छूट",
"discountInfo": "छूट जानकारी",
"enterAmount": "रिचार्ज राशि दर्ज करें", "enterAmount": "रिचार्ज राशि दर्ज करें",
"enterCoupon": "कूपन कोड दर्ज करें", "enterCoupon": "कूपन कोड दर्ज करें",
"methods": { "methods": {

View File

@ -27,6 +27,8 @@
"connectionSpeed": "Kapcsolati sebesség", "connectionSpeed": "Kapcsolati sebesség",
"productDetail": "Termék részletei" "productDetail": "Termék részletei"
}, },
"discount": "Kedvezmény",
"discountInfo": "Kedvezmény Információ",
"enterAmount": "Adja meg a feltöltési összeget", "enterAmount": "Adja meg a feltöltési összeget",
"enterCoupon": "Adja meg a kuponkódot", "enterCoupon": "Adja meg a kuponkódot",
"methods": { "methods": {

View File

@ -27,6 +27,8 @@
"connectionSpeed": "接続速度", "connectionSpeed": "接続速度",
"productDetail": "商品詳細" "productDetail": "商品詳細"
}, },
"discount": "割引",
"discountInfo": "割引情報",
"enterAmount": "リチャージ金額を入力してください", "enterAmount": "リチャージ金額を入力してください",
"enterCoupon": "クーポンコードを入力", "enterCoupon": "クーポンコードを入力",
"methods": { "methods": {

View File

@ -27,6 +27,8 @@
"connectionSpeed": "연결 속도", "connectionSpeed": "연결 속도",
"productDetail": "제품 세부 정보" "productDetail": "제품 세부 정보"
}, },
"discount": "할인",
"discountInfo": "할인 정보",
"enterAmount": "충전 금액을 입력하세요", "enterAmount": "충전 금액을 입력하세요",
"enterCoupon": "쿠폰 코드 입력", "enterCoupon": "쿠폰 코드 입력",
"methods": { "methods": {

View File

@ -27,6 +27,8 @@
"connectionSpeed": "Tilkoblingshastighet", "connectionSpeed": "Tilkoblingshastighet",
"productDetail": "Produktdetaljer" "productDetail": "Produktdetaljer"
}, },
"discount": "Rabatt",
"discountInfo": "Rabattinformasjon",
"enterAmount": "Skriv inn påfyllingsbeløp", "enterAmount": "Skriv inn påfyllingsbeløp",
"enterCoupon": "Skriv inn kupongkode", "enterCoupon": "Skriv inn kupongkode",
"methods": { "methods": {

View File

@ -27,6 +27,8 @@
"connectionSpeed": "Prędkość połączenia", "connectionSpeed": "Prędkość połączenia",
"productDetail": "Szczegóły produktu" "productDetail": "Szczegóły produktu"
}, },
"discount": "Zniżka",
"discountInfo": "Informacje o zniżce",
"enterAmount": "Wprowadź kwotę doładowania", "enterAmount": "Wprowadź kwotę doładowania",
"enterCoupon": "Wprowadź kod kuponu", "enterCoupon": "Wprowadź kod kuponu",
"methods": { "methods": {

View File

@ -27,6 +27,8 @@
"connectionSpeed": "Velocidade de conexão", "connectionSpeed": "Velocidade de conexão",
"productDetail": "Detalhes do produto" "productDetail": "Detalhes do produto"
}, },
"discount": "Desconto",
"discountInfo": "Informações sobre o Desconto",
"enterAmount": "Digite o valor da recarga", "enterAmount": "Digite o valor da recarga",
"enterCoupon": "Insira o Código do Cupom", "enterCoupon": "Insira o Código do Cupom",
"methods": { "methods": {

View File

@ -27,6 +27,8 @@
"connectionSpeed": "Viteza de conectare", "connectionSpeed": "Viteza de conectare",
"productDetail": "Detalii produs" "productDetail": "Detalii produs"
}, },
"discount": "Reducere",
"discountInfo": "Informații despre reducere",
"enterAmount": "Introduceți suma de reîncărcare", "enterAmount": "Introduceți suma de reîncărcare",
"enterCoupon": "Introduceți codul cuponului", "enterCoupon": "Introduceți codul cuponului",
"methods": { "methods": {

View File

@ -27,6 +27,8 @@
"connectionSpeed": "Скорость соединения", "connectionSpeed": "Скорость соединения",
"productDetail": "Детали продукта" "productDetail": "Детали продукта"
}, },
"discount": "Скидка",
"discountInfo": "Информация о скидке",
"enterAmount": "Введите сумму пополнения", "enterAmount": "Введите сумму пополнения",
"enterCoupon": "Введите промокод", "enterCoupon": "Введите промокод",
"methods": { "methods": {

View File

@ -27,6 +27,8 @@
"connectionSpeed": "ความเร็วในการเชื่อมต่อ", "connectionSpeed": "ความเร็วในการเชื่อมต่อ",
"productDetail": "รายละเอียดสินค้า" "productDetail": "รายละเอียดสินค้า"
}, },
"discount": "ส่วนลด",
"discountInfo": "ข้อมูลส่วนลด",
"enterAmount": "กรอกจำนวนเงินที่ต้องการเติม", "enterAmount": "กรอกจำนวนเงินที่ต้องการเติม",
"enterCoupon": "กรอกรหัสคูปอง", "enterCoupon": "กรอกรหัสคูปอง",
"methods": { "methods": {

View File

@ -27,6 +27,8 @@
"connectionSpeed": "Bağlantı Hızı", "connectionSpeed": "Bağlantı Hızı",
"productDetail": "Ürün Detayları" "productDetail": "Ürün Detayları"
}, },
"discount": "İndirim",
"discountInfo": "İndirim Bilgisi",
"enterAmount": "Yükleme tutarını girin", "enterAmount": "Yükleme tutarını girin",
"enterCoupon": "Kupon Kodunu Girin", "enterCoupon": "Kupon Kodunu Girin",
"methods": { "methods": {

View File

@ -27,6 +27,8 @@
"connectionSpeed": "Швидкість з'єднання", "connectionSpeed": "Швидкість з'єднання",
"productDetail": "Деталі товару" "productDetail": "Деталі товару"
}, },
"discount": "Знижка",
"discountInfo": "Інформація про знижку",
"enterAmount": "Введіть суму поповнення", "enterAmount": "Введіть суму поповнення",
"enterCoupon": "Введіть код купона", "enterCoupon": "Введіть код купона",
"methods": { "methods": {

View File

@ -27,6 +27,8 @@
"connectionSpeed": "Tốc độ kết nối", "connectionSpeed": "Tốc độ kết nối",
"productDetail": "Chi tiết sản phẩm" "productDetail": "Chi tiết sản phẩm"
}, },
"discount": "Giảm giá",
"discountInfo": "Thông tin giảm giá",
"enterAmount": "Nhập số tiền nạp", "enterAmount": "Nhập số tiền nạp",
"enterCoupon": "Nhập Mã Phiếu Giảm Giá", "enterCoupon": "Nhập Mã Phiếu Giảm Giá",
"methods": { "methods": {

View File

@ -27,6 +27,8 @@
"connectionSpeed": "连接速度", "connectionSpeed": "连接速度",
"productDetail": "商品详情" "productDetail": "商品详情"
}, },
"discount": "折扣",
"discountInfo": "折扣信息",
"enterAmount": "输入充值金额", "enterAmount": "输入充值金额",
"enterCoupon": "输入优惠券代码", "enterCoupon": "输入优惠券代码",
"methods": { "methods": {

View File

@ -27,6 +27,8 @@
"connectionSpeed": "連接速度", "connectionSpeed": "連接速度",
"productDetail": "商品詳情" "productDetail": "商品詳情"
}, },
"discount": "折扣",
"discountInfo": "折扣資訊",
"enterAmount": "輸入充值金額", "enterAmount": "輸入充值金額",
"enterCoupon": "輸入優惠券代碼", "enterCoupon": "輸入優惠券代碼",
"methods": { "methods": {

View File

@ -2,6 +2,21 @@
/* eslint-disable */ /* eslint-disable */
import request from '@/utils/request'; import request from '@/utils/request';
/** Get Ads GET /v1/common/ads */
export async function getAds(
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
params: API.GetAdsParams,
options?: { [key: string]: any },
) {
return request<API.Response & { data?: API.GetAdsResponse }>('/v1/common/ads', {
method: 'GET',
params: {
...params,
},
...(options || {}),
});
}
/** Get Tos Content GET /v1/common/application */ /** Get Tos Content GET /v1/common/application */
export async function getApplication(options?: { [key: string]: any }) { export async function getApplication(options?: { [key: string]: any }) {
return request<API.Response & { data?: API.GetAppcationResponse }>('/v1/common/application', { return request<API.Response & { data?: API.GetAppcationResponse }>('/v1/common/application', {

View File

@ -13,6 +13,10 @@ declare namespace API {
updated_at: number; updated_at: number;
}; };
type AlipayNotifyResponse = {
return_code: string;
};
type Announcement = { type Announcement = {
id: number; id: number;
title: string; title: string;
@ -149,6 +153,19 @@ declare namespace API {
domain_suffix_list: string; domain_suffix_list: string;
}; };
type EPayNotifyRequest = {
pid: number;
trade_no: string;
out_trade_no: string;
type: string;
name: string;
money: string;
trade_status: string;
param: string;
sign: string;
sign_type: string;
};
type Follow = { type Follow = {
id: number; id: number;
ticket_id: number; ticket_id: number;
@ -158,6 +175,20 @@ declare namespace API {
created_at: number; created_at: number;
}; };
type GetAdsParams = {
device: string;
position: string;
};
type GetAdsRequest = {
device: string;
position: string;
};
type GetAdsResponse = {
list: Ads[];
};
type GetAppcationResponse = { type GetAppcationResponse = {
config: ApplicationConfig; config: ApplicationConfig;
applications: ApplicationResponseInfo[]; applications: ApplicationResponseInfo[];
@ -176,6 +207,7 @@ declare namespace API {
subscribe: SubscribeConfig; subscribe: SubscribeConfig;
verify_code: PubilcVerifyCodeConfig; verify_code: PubilcVerifyCodeConfig;
oauth_methods: string[]; oauth_methods: string[];
web_ad: boolean;
}; };
type GetStatResponse = { type GetStatResponse = {
@ -331,7 +363,8 @@ declare namespace API {
type PaymenMethod = { type PaymenMethod = {
id: number; id: number;
name: string; name: string;
mark: string; platform: string;
description: string;
icon: string; icon: string;
fee_mode: number; fee_mode: number;
fee_percent: number; fee_percent: number;
@ -341,7 +374,8 @@ declare namespace API {
type PaymentConfig = { type PaymentConfig = {
id: number; id: number;
name: string; name: string;
mark: string; platform: string;
description: string;
icon?: string; icon?: string;
domain?: string; domain?: string;
config: Record<string, any>; config: Record<string, any>;
@ -351,6 +385,31 @@ declare namespace API {
enable: boolean; enable: boolean;
}; };
type PaymentMethodDetail = {
id: number;
name: string;
platform: string;
description: string;
icon: string;
domain: string;
config: Record<string, any>;
fee_mode: number;
fee_percent: number;
fee_amount: number;
enable: boolean;
notify_url: string;
};
type PlatformInfo = {
platform: string;
platform_url: string;
platform_field_description: Record<string, any>;
};
type PlatformResponse = {
list: PlatformInfo[];
};
type PreOrderResponse = { type PreOrderResponse = {
price: number; price: number;
amount: number; amount: number;
@ -383,7 +442,7 @@ declare namespace API {
type PurchaseOrderRequest = { type PurchaseOrderRequest = {
subscribe_id: number; subscribe_id: number;
quantity: number; quantity: number;
payment: string; payment: number;
coupon?: string; coupon?: string;
}; };
@ -443,7 +502,7 @@ declare namespace API {
type RechargeOrderRequest = { type RechargeOrderRequest = {
amount: number; amount: number;
payment: string; payment: number;
}; };
type RechargeOrderResponse = { type RechargeOrderResponse = {
@ -464,7 +523,7 @@ declare namespace API {
type RenewalOrderRequest = { type RenewalOrderRequest = {
user_subscribe_id: number; user_subscribe_id: number;
quantity: number; quantity: number;
payment: string; payment: number;
coupon?: string; coupon?: string;
}; };
@ -481,7 +540,7 @@ declare namespace API {
type ResetTrafficOrderRequest = { type ResetTrafficOrderRequest = {
user_subscribe_id: number; user_subscribe_id: number;
payment: string; payment: number;
}; };
type ResetTrafficOrderResponse = { type ResetTrafficOrderResponse = {

View File

@ -13,6 +13,10 @@ declare namespace API {
updated_at: number; updated_at: number;
}; };
type AlipayNotifyResponse = {
return_code: string;
};
type Announcement = { type Announcement = {
id: number; id: number;
title: string; title: string;
@ -177,6 +181,19 @@ declare namespace API {
domain_suffix_list: string; domain_suffix_list: string;
}; };
type EPayNotifyRequest = {
pid: number;
trade_no: string;
out_trade_no: string;
type: string;
name: string;
money: string;
trade_status: string;
param: string;
sign: string;
sign_type: string;
};
type Follow = { type Follow = {
id: number; id: number;
ticket_id: number; ticket_id: number;
@ -372,7 +389,8 @@ declare namespace API {
type PaymenMethod = { type PaymenMethod = {
id: number; id: number;
name: string; name: string;
mark: string; platform: string;
description: string;
icon: string; icon: string;
fee_mode: number; fee_mode: number;
fee_percent: number; fee_percent: number;
@ -382,7 +400,8 @@ declare namespace API {
type PaymentConfig = { type PaymentConfig = {
id: number; id: number;
name: string; name: string;
mark: string; platform: string;
description: string;
icon?: string; icon?: string;
domain?: string; domain?: string;
config: Record<string, any>; config: Record<string, any>;
@ -392,11 +411,36 @@ declare namespace API {
enable: boolean; enable: boolean;
}; };
type PaymentMethodDetail = {
id: number;
name: string;
platform: string;
description: string;
icon: string;
domain: string;
config: Record<string, any>;
fee_mode: number;
fee_percent: number;
fee_amount: number;
enable: boolean;
notify_url: string;
};
type PlatformInfo = {
platform: string;
platform_url: string;
platform_field_description: Record<string, any>;
};
type PlatformResponse = {
list: PlatformInfo[];
};
type PortalPurchaseRequest = { type PortalPurchaseRequest = {
identifier: string; identifier: string;
platform: string; platform: string;
password?: string; password?: string;
payment: string; payment: number;
subscribe_id: number; subscribe_id: number;
quantity: number; quantity: number;
coupon?: string; coupon?: string;
@ -418,7 +462,7 @@ declare namespace API {
}; };
type PrePurchaseOrderRequest = { type PrePurchaseOrderRequest = {
payment: string; payment: number;
subscribe_id: number; subscribe_id: number;
quantity: number; quantity: number;
coupon?: string; coupon?: string;
@ -463,7 +507,7 @@ declare namespace API {
type PurchaseOrderRequest = { type PurchaseOrderRequest = {
subscribe_id: number; subscribe_id: number;
quantity: number; quantity: number;
payment: string; payment: number;
coupon?: string; coupon?: string;
}; };
@ -607,7 +651,7 @@ declare namespace API {
type RechargeOrderRequest = { type RechargeOrderRequest = {
amount: number; amount: number;
payment: string; payment: number;
}; };
type RechargeOrderResponse = { type RechargeOrderResponse = {
@ -628,7 +672,7 @@ declare namespace API {
type RenewalOrderRequest = { type RenewalOrderRequest = {
user_subscribe_id: number; user_subscribe_id: number;
quantity: number; quantity: number;
payment: string; payment: number;
coupon?: string; coupon?: string;
}; };
@ -638,7 +682,7 @@ declare namespace API {
type ResetTrafficOrderRequest = { type ResetTrafficOrderRequest = {
user_subscribe_id: number; user_subscribe_id: number;
payment: string; payment: number;
}; };
type ResetTrafficOrderResponse = { type ResetTrafficOrderResponse = {