diff --git a/src/assets/localization/fallback.strings b/src/assets/localization/fallback.strings index b6946da3b..a0614c43e 100644 --- a/src/assets/localization/fallback.strings +++ b/src/assets/localization/fallback.strings @@ -742,6 +742,7 @@ "PollsStopWarning" = "If you stop this poll now, nobody will be able to vote in it anymore. This action cannot be undone."; "PollsStopSure" = "Stop"; "PaymentTestInvoice" = "TEST INVOICE"; +"PaymentInvoiceNotFound" = "Invoice not found"; "AttachLiveLocation" = "Live Location"; "NoWordsRecognized" = "No words recognized."; "ViaBot" = "via"; diff --git a/src/global/actions/api/payments.ts b/src/global/actions/api/payments.ts index 21ec81352..249b65ec8 100644 --- a/src/global/actions/api/payments.ts +++ b/src/global/actions/api/payments.ts @@ -97,6 +97,8 @@ addActionHandler('openInvoice', async (global, actions, payload): Promise if ('error' in form) { setGlobal(global); + + handlePaymentFormError(form.error, tabId); return; } @@ -1099,7 +1101,7 @@ async function payInputStarInvoice( setGlobal(global); if ('error' in form) { - actions.showDialog({ data: { message: form.error || 'Error', hasErrorKey: true }, tabId }); + handlePaymentFormError(form.error, tabId); return; } @@ -1179,3 +1181,17 @@ addActionHandler('processStarGiftWithdrawal', async (global, actions, payload): actions.openUrl({ url: result.url, shouldSkipModal: true, tabId }); actions.closeGiftWithdrawModal({ tabId }); }); + +function handlePaymentFormError(error: string, tabId: number) { + if (error === 'SLUG_INVALID') { + getActions().showNotification({ + message: { + key: 'PaymentInvoiceNotFound', + }, + tabId, + }); + return; + } + + getActions().showDialog({ data: { message: error, hasErrorKey: true }, tabId }); +} diff --git a/src/types/language.d.ts b/src/types/language.d.ts index c4b70fb4b..0287c6cf8 100644 --- a/src/types/language.d.ts +++ b/src/types/language.d.ts @@ -654,6 +654,7 @@ export interface LangPair { 'PollsStopWarning': undefined; 'PollsStopSure': undefined; 'PaymentTestInvoice': undefined; + 'PaymentInvoiceNotFound': undefined; 'AttachLiveLocation': undefined; 'NoWordsRecognized': undefined; 'ViaBot': undefined; @@ -981,7 +982,6 @@ export interface LangPair { 'ChatListFilterErrorEmpty': undefined; 'ChatListFilterErrorTitleEmpty': undefined; 'FilterMuted': undefined; - 'ReadFolder': undefined; 'FilterRead': undefined; 'FilterArchived': undefined; 'GroupsAndChannelsLimitTitle': undefined; @@ -1284,14 +1284,25 @@ export interface LangPair { 'PrivacyGiftsInfo': undefined; 'PrivacyAcceptedGiftTitle': undefined; 'PrivacyAcceptedGiftInfo': undefined; - 'PrivacyDisplayGiftsButton': undefined; - 'PrivacyDisplayGift': undefined; - 'SendDisallowError': undefined; 'PrivacyValueBots': undefined; 'PrivacyGiftLimitedEdition': undefined; 'PrivacyGiftUnlimited': undefined; 'PrivacyGiftUnique': undefined; 'PrivacyGiftPremiumSubscription': undefined; + 'PrivacyDisplayGiftsButton': undefined; + 'PrivacyDisplayGift': undefined; + 'SendDisallowError': undefined; + 'PrivacySubscribeToTelegramPremium': undefined; + 'PrivacyDisableLimitedEditionStarGifts': undefined; + 'PrivacyEnableLimitedEditionStarGifts': undefined; + 'PrivacyDisableUnlimitedStarGifts': undefined; + 'PrivacyEnableUnlimitedStarGifts': undefined; + 'PrivacyDisableUniqueStarGifts': undefined; + 'PrivacyEnableUniqueStarGifts': undefined; + 'PrivacyDisablePremiumGifts': undefined; + 'PrivacyEnablePremiumGifts': undefined; + 'DisplayGiftsButton': undefined; + 'HideGiftsButton': undefined; 'CustomShareGiftsInfo': undefined; 'AllChatsSearchContext': undefined; 'PrivateChatsSearchContext': undefined; @@ -1479,17 +1490,6 @@ export interface LangPair { 'GroupMessagesChargePrice': undefined; 'RightsChargeStarsAbout': undefined; 'UnlockButtonTitle': undefined; - 'PrivacySubscribeToTelegramPremium': undefined; - 'PrivacyDisableLimitedEditionStarGifts': undefined; - 'PrivacyEnableLimitedEditionStarGifts': undefined; - 'PrivacyDisableUnlimitedStarGifts': undefined; - 'PrivacyEnableUnlimitedStarGifts': undefined; - 'PrivacyDisableUniqueStarGifts': undefined; - 'PrivacyEnableUniqueStarGifts': undefined; - 'PrivacyDisablePremiumGifts': undefined; - 'PrivacyEnablePremiumGifts': undefined; - 'DisplayGiftsButton': undefined; - 'HideGiftsButton': undefined; 'FrozenAccountModalTitle': undefined; 'FrozenAccountViolationTitle': undefined; 'FrozenAccountViolationSubtitle': undefined; @@ -1579,10 +1579,6 @@ export interface LangPairWithVariables { 'SpeakingWithVolume': { 'volume': V; }; - 'PrivacyDisplayGiftIconInChats':{ - 'icon': V; - 'gift': V; - }; 'CallEmojiKeyTooltip': { 'user': V; }; @@ -2002,6 +1998,10 @@ export interface LangPairWithVariables { 'bot': V; 'filename': V; }; + 'PrivacyDisplayGiftIconInChats': { + 'icon': V; + 'gift': V; + }; 'StarsSubscribeBotButtonMonth': { 'amount': V; };