mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-29 18:13:47 +00:00
fix: auto-select single sub-option and remove unused return_url field
- Auto-select sub-option even when only 1 exists (backend needs suffix) - Remove return_url from public LandingPaymentMethod (backend doesn't send it) - Add else branch in auto-select for defensive null reset
This commit is contained in:
@@ -42,7 +42,6 @@ export interface LandingPaymentMethod {
|
|||||||
min_amount_kopeks: number | null;
|
min_amount_kopeks: number | null;
|
||||||
max_amount_kopeks: number | null;
|
max_amount_kopeks: number | null;
|
||||||
currency: string | null;
|
currency: string | null;
|
||||||
return_url: string | null;
|
|
||||||
sub_options: LandingPaymentMethodSubOption[] | null;
|
sub_options: LandingPaymentMethodSubOption[] | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -631,8 +631,10 @@ export default function QuickPurchase() {
|
|||||||
if (config.payment_methods.length > 0 && selectedMethod === null) {
|
if (config.payment_methods.length > 0 && selectedMethod === null) {
|
||||||
const firstMethod = config.payment_methods[0];
|
const firstMethod = config.payment_methods[0];
|
||||||
setSelectedMethod(firstMethod.method_id);
|
setSelectedMethod(firstMethod.method_id);
|
||||||
if (firstMethod.sub_options && firstMethod.sub_options.length > 1) {
|
if (firstMethod.sub_options && firstMethod.sub_options.length >= 1) {
|
||||||
setSelectedSubOption(firstMethod.sub_options[0].id);
|
setSelectedSubOption(firstMethod.sub_options[0].id);
|
||||||
|
} else {
|
||||||
|
setSelectedSubOption(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [config, allPeriods, visibleTariffs, selectedTariffId, selectedPeriodDays, selectedMethod]);
|
}, [config, allPeriods, visibleTariffs, selectedTariffId, selectedPeriodDays, selectedMethod]);
|
||||||
@@ -899,8 +901,8 @@ export default function QuickPurchase() {
|
|||||||
}
|
}
|
||||||
onSelect={() => {
|
onSelect={() => {
|
||||||
setSelectedMethod(method.method_id);
|
setSelectedMethod(method.method_id);
|
||||||
// Auto-select first sub-option when switching methods
|
// Auto-select first sub-option (even for single — backend needs suffix)
|
||||||
if (method.sub_options && method.sub_options.length > 1) {
|
if (method.sub_options && method.sub_options.length >= 1) {
|
||||||
setSelectedSubOption(method.sub_options[0].id);
|
setSelectedSubOption(method.sub_options[0].id);
|
||||||
} else {
|
} else {
|
||||||
setSelectedSubOption(null);
|
setSelectedSubOption(null);
|
||||||
|
|||||||
Reference in New Issue
Block a user