fix: separate platega buttons not showed up in webapp

This commit is contained in:
3252a8
2026-04-27 14:57:49 +03:00
parent 9f556f3e04
commit fa5f1460ab
3 changed files with 103 additions and 87 deletions
+24 -8
View File
@@ -48,7 +48,8 @@ window.__WEBAPP_DEV_MOCK__ = {
], ],
payment_methods: [ payment_methods: [
{id: 'cryptopay', name: 'CryptoPay'}, {id: 'cryptopay', name: 'CryptoPay'},
{id: 'platega', name: 'Platega'}, {id: 'platega_sbp', name: 'Platega · СБП'},
{id: 'platega_crypto', name: 'Platega · Crypto'},
{id: 'freekassa', name: 'FreeKassa / СБП'} {id: 'freekassa', name: 'FreeKassa / СБП'}
], ],
referral: { referral: {
@@ -154,6 +155,8 @@ const MOCK = (() => {
planPrice: 'plan-price', planPrice: 'plan-price',
paymentMethodCard: 'payment-method-card', paymentMethodCard: 'payment-method-card',
paymentMethodCardPlatega: 'payment-method-card--platega', paymentMethodCardPlatega: 'payment-method-card--platega',
paymentMethodCardPlategaSbp: 'payment-method-card--platega payment-method-card--platega-sbp',
paymentMethodCardPlategaCrypto: 'payment-method-card--platega payment-method-card--platega-crypto',
paymentMethodCardCryptopay: 'payment-method-card--cryptopay', paymentMethodCardCryptopay: 'payment-method-card--cryptopay',
notice: 'notice', notice: 'notice',
stepNum: 'step-num', stepNum: 'step-num',
@@ -192,6 +195,8 @@ const MOCK = (() => {
check_payment: 'Проверить оплату', check_payment: 'Проверить оплату',
choose_other_method: 'Выбрать другой способ', choose_other_method: 'Выбрать другой способ',
pay_with_platega_button: 'Оплатить картой (СБП)', pay_with_platega_button: 'Оплатить картой (СБП)',
pay_with_platega_sbp_button: 'Оплата через СБП',
pay_with_platega_crypto_button: 'Оплата криптой',
pay_with_cryptopay_button: 'Оплатить криптой', pay_with_cryptopay_button: 'Оплатить криптой',
support: 'Поддержка', support: 'Поддержка',
account_title: 'Аккаунт', account_title: 'Аккаунт',
@@ -329,6 +334,8 @@ const MOCK = (() => {
check_payment: 'Check payment', check_payment: 'Check payment',
choose_other_method: 'Choose another method', choose_other_method: 'Choose another method',
pay_with_platega_button: 'Pay by card (SBP)', pay_with_platega_button: 'Pay by card (SBP)',
pay_with_platega_sbp_button: 'Pay via SBP',
pay_with_platega_crypto_button: 'Pay with crypto',
pay_with_cryptopay_button: 'Pay with crypto', pay_with_cryptopay_button: 'Pay with crypto',
support: 'Support', support: 'Support',
account_title: 'Account', account_title: 'Account',
@@ -1982,12 +1989,21 @@ const MOCK = (() => {
} }
methods.innerHTML = available.map(method => { methods.innerHTML = available.map(method => {
const labelKey = method.id === 'platega' let labelKey;
? 'pay_with_platega_button' let variantClass;
: 'pay_with_cryptopay_button'; if (method.id === 'platega_sbp') {
const variantClass = method.id === 'platega' labelKey = 'pay_with_platega_sbp_button';
? TW.paymentMethodCardPlatega variantClass = TW.paymentMethodCardPlategaSbp;
: TW.paymentMethodCardCryptopay; } else if (method.id === 'platega_crypto') {
labelKey = 'pay_with_platega_crypto_button';
variantClass = TW.paymentMethodCardPlategaCrypto;
} else if (method.id === 'platega') {
labelKey = 'pay_with_platega_button';
variantClass = TW.paymentMethodCardPlatega;
} else {
labelKey = 'pay_with_cryptopay_button';
variantClass = TW.paymentMethodCardCryptopay;
}
return ` return `
<button class="${TW.paymentMethodCard} ${variantClass}" type="button" data-action="create-payment" data-method="${escapeAttr(method.id)}" data-i18n="${labelKey}" ${state.creatingPayment ? 'disabled' : ''}> <button class="${TW.paymentMethodCard} ${variantClass}" type="button" data-action="create-payment" data-method="${escapeAttr(method.id)}" data-i18n="${labelKey}" ${state.creatingPayment ? 'disabled' : ''}>
${escapeHtml(t(labelKey))} ${escapeHtml(t(labelKey))}
@@ -2044,7 +2060,7 @@ const MOCK = (() => {
const methodsById = new Map( const methodsById = new Map(
(state.data.payment_methods || []).map(method => [String(method.id || '').toLowerCase(), method]) (state.data.payment_methods || []).map(method => [String(method.id || '').toLowerCase(), method])
); );
return ['platega', 'cryptopay'] return ['platega_sbp', 'platega_crypto', 'platega', 'cryptopay']
.map(methodId => methodsById.get(methodId)) .map(methodId => methodsById.get(methodId))
.filter(Boolean); .filter(Boolean);
} }
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long