@@ -3,38 +3,52 @@ import { ComponentType, SVGProps } from 'react'
33import { Control } from 'react-hook-form'
44
55import { SbpIcon } from '../icons/sbp-icon'
6+ import { YoomoneyIcon } from '../icons/yoomoney-icon'
67
78import type { PaymentFormValues } from './premium'
9+ import { InitPaymentRequestMethod } from '@/src/api/generated'
810import { FormControl , FormField , FormItem } from '@/src/components/ui/form'
911import { Label } from '@/src/components/ui/label'
1012import { RadioGroup , RadioGroupItem } from '@/src/components/ui/radio-group'
1113import { cn } from '@/src/lib/utils'
1214
1315interface PaymentMethod {
14- id : string
16+ id : InitPaymentRequestMethod
1517 name : string
1618 description : string
1719 icon : ComponentType < SVGProps < SVGSVGElement > >
1820 textColor : string
1921 bgColor : string
22+ isAllowed ?: boolean
2023}
2124
2225const paymentMethods : PaymentMethod [ ] = [
2326 {
24- id : ' BANK_CARD' ,
27+ id : InitPaymentRequestMethod . BANK_CARD ,
2528 name : 'Банковская карта' ,
2629 description : 'Оплата кредитной или дебетовой карты' ,
2730 icon : CreditCardIcon ,
2831 textColor : 'text-blue-600' ,
29- bgColor : 'bg-blue-100'
32+ bgColor : 'bg-blue-100' ,
33+ isAllowed : true
3034 } ,
3135 {
32- id : ' SBP' ,
36+ id : InitPaymentRequestMethod . SBP ,
3337 name : 'СБП' ,
3438 description : 'Оплата через Систему быстрых платежей' ,
3539 icon : SbpIcon ,
3640 textColor : 'text-blue-600' ,
37- bgColor : 'bg-blue-100'
41+ bgColor : 'bg-blue-100' ,
42+ isAllowed : false
43+ } ,
44+ {
45+ id : InitPaymentRequestMethod . YOOMONEY ,
46+ name : 'ЮMoney' ,
47+ description : 'Оплата через кошелек ЮMoney' ,
48+ icon : YoomoneyIcon ,
49+ textColor : 'text-blue-600' ,
50+ bgColor : 'bg-blue-100' ,
51+ isAllowed : false
3852 }
3953 // {
4054 // id: 'CRYPTO',
@@ -72,9 +86,11 @@ export function PaymentMethods({ control }: PaymentMethodsProps) {
7286 htmlFor = { method . id }
7387 className = { cn (
7488 'flex cursor-pointer items-center gap-3 rounded-xl border p-3.5 transition-all duration-200' ,
75- isSelected
76- ? 'border-blue-500 bg-blue-50 dark:border-border dark:bg-neutral-800'
77- : 'border-gray-200 bg-white hover:border-gray-300 dark:border-gray-700 dark:bg-background'
89+ ! method . isAllowed
90+ ? 'cursor-not-allowed opacity-50'
91+ : isSelected
92+ ? 'border-blue-500 bg-blue-50 dark:border-border dark:bg-neutral-800'
93+ : 'border-gray-200 bg-white hover:border-gray-300 dark:border-gray-700 dark:bg-background'
7894 ) }
7995 >
8096 < div
@@ -119,6 +135,7 @@ export function PaymentMethods({ control }: PaymentMethodsProps) {
119135 < RadioGroupItem
120136 value = { method . id }
121137 id = { method . id }
138+ disabled = { ! method . isAllowed }
122139 className = 'sr-only'
123140 />
124141 </ Label >
0 commit comments