Payment: Show error on invalid link (#5875)
This commit is contained in:
parent
e41619fd23
commit
dc722a9cc2
@ -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.";
|
"PollsStopWarning" = "If you stop this poll now, nobody will be able to vote in it anymore. This action cannot be undone.";
|
||||||
"PollsStopSure" = "Stop";
|
"PollsStopSure" = "Stop";
|
||||||
"PaymentTestInvoice" = "TEST INVOICE";
|
"PaymentTestInvoice" = "TEST INVOICE";
|
||||||
|
"PaymentInvoiceNotFound" = "Invoice not found";
|
||||||
"AttachLiveLocation" = "Live Location";
|
"AttachLiveLocation" = "Live Location";
|
||||||
"NoWordsRecognized" = "No words recognized.";
|
"NoWordsRecognized" = "No words recognized.";
|
||||||
"ViaBot" = "via";
|
"ViaBot" = "via";
|
||||||
|
|||||||
@ -97,6 +97,8 @@ addActionHandler('openInvoice', async (global, actions, payload): Promise<void>
|
|||||||
|
|
||||||
if ('error' in form) {
|
if ('error' in form) {
|
||||||
setGlobal(global);
|
setGlobal(global);
|
||||||
|
|
||||||
|
handlePaymentFormError(form.error, tabId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1099,7 +1101,7 @@ async function payInputStarInvoice<T extends GlobalState>(
|
|||||||
setGlobal(global);
|
setGlobal(global);
|
||||||
|
|
||||||
if ('error' in form) {
|
if ('error' in form) {
|
||||||
actions.showDialog({ data: { message: form.error || 'Error', hasErrorKey: true }, tabId });
|
handlePaymentFormError(form.error, tabId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1179,3 +1181,17 @@ addActionHandler('processStarGiftWithdrawal', async (global, actions, payload):
|
|||||||
actions.openUrl({ url: result.url, shouldSkipModal: true, tabId });
|
actions.openUrl({ url: result.url, shouldSkipModal: true, tabId });
|
||||||
actions.closeGiftWithdrawModal({ 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 });
|
||||||
|
}
|
||||||
|
|||||||
38
src/types/language.d.ts
vendored
38
src/types/language.d.ts
vendored
@ -654,6 +654,7 @@ export interface LangPair {
|
|||||||
'PollsStopWarning': undefined;
|
'PollsStopWarning': undefined;
|
||||||
'PollsStopSure': undefined;
|
'PollsStopSure': undefined;
|
||||||
'PaymentTestInvoice': undefined;
|
'PaymentTestInvoice': undefined;
|
||||||
|
'PaymentInvoiceNotFound': undefined;
|
||||||
'AttachLiveLocation': undefined;
|
'AttachLiveLocation': undefined;
|
||||||
'NoWordsRecognized': undefined;
|
'NoWordsRecognized': undefined;
|
||||||
'ViaBot': undefined;
|
'ViaBot': undefined;
|
||||||
@ -981,7 +982,6 @@ export interface LangPair {
|
|||||||
'ChatListFilterErrorEmpty': undefined;
|
'ChatListFilterErrorEmpty': undefined;
|
||||||
'ChatListFilterErrorTitleEmpty': undefined;
|
'ChatListFilterErrorTitleEmpty': undefined;
|
||||||
'FilterMuted': undefined;
|
'FilterMuted': undefined;
|
||||||
'ReadFolder': undefined;
|
|
||||||
'FilterRead': undefined;
|
'FilterRead': undefined;
|
||||||
'FilterArchived': undefined;
|
'FilterArchived': undefined;
|
||||||
'GroupsAndChannelsLimitTitle': undefined;
|
'GroupsAndChannelsLimitTitle': undefined;
|
||||||
@ -1284,14 +1284,25 @@ export interface LangPair {
|
|||||||
'PrivacyGiftsInfo': undefined;
|
'PrivacyGiftsInfo': undefined;
|
||||||
'PrivacyAcceptedGiftTitle': undefined;
|
'PrivacyAcceptedGiftTitle': undefined;
|
||||||
'PrivacyAcceptedGiftInfo': undefined;
|
'PrivacyAcceptedGiftInfo': undefined;
|
||||||
'PrivacyDisplayGiftsButton': undefined;
|
|
||||||
'PrivacyDisplayGift': undefined;
|
|
||||||
'SendDisallowError': undefined;
|
|
||||||
'PrivacyValueBots': undefined;
|
'PrivacyValueBots': undefined;
|
||||||
'PrivacyGiftLimitedEdition': undefined;
|
'PrivacyGiftLimitedEdition': undefined;
|
||||||
'PrivacyGiftUnlimited': undefined;
|
'PrivacyGiftUnlimited': undefined;
|
||||||
'PrivacyGiftUnique': undefined;
|
'PrivacyGiftUnique': undefined;
|
||||||
'PrivacyGiftPremiumSubscription': 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;
|
'CustomShareGiftsInfo': undefined;
|
||||||
'AllChatsSearchContext': undefined;
|
'AllChatsSearchContext': undefined;
|
||||||
'PrivateChatsSearchContext': undefined;
|
'PrivateChatsSearchContext': undefined;
|
||||||
@ -1479,17 +1490,6 @@ export interface LangPair {
|
|||||||
'GroupMessagesChargePrice': undefined;
|
'GroupMessagesChargePrice': undefined;
|
||||||
'RightsChargeStarsAbout': undefined;
|
'RightsChargeStarsAbout': undefined;
|
||||||
'UnlockButtonTitle': 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;
|
'FrozenAccountModalTitle': undefined;
|
||||||
'FrozenAccountViolationTitle': undefined;
|
'FrozenAccountViolationTitle': undefined;
|
||||||
'FrozenAccountViolationSubtitle': undefined;
|
'FrozenAccountViolationSubtitle': undefined;
|
||||||
@ -1579,10 +1579,6 @@ export interface LangPairWithVariables<V extends unknown = LangVariable> {
|
|||||||
'SpeakingWithVolume': {
|
'SpeakingWithVolume': {
|
||||||
'volume': V;
|
'volume': V;
|
||||||
};
|
};
|
||||||
'PrivacyDisplayGiftIconInChats':{
|
|
||||||
'icon': V;
|
|
||||||
'gift': V;
|
|
||||||
};
|
|
||||||
'CallEmojiKeyTooltip': {
|
'CallEmojiKeyTooltip': {
|
||||||
'user': V;
|
'user': V;
|
||||||
};
|
};
|
||||||
@ -2002,6 +1998,10 @@ export interface LangPairWithVariables<V extends unknown = LangVariable> {
|
|||||||
'bot': V;
|
'bot': V;
|
||||||
'filename': V;
|
'filename': V;
|
||||||
};
|
};
|
||||||
|
'PrivacyDisplayGiftIconInChats': {
|
||||||
|
'icon': V;
|
||||||
|
'gift': V;
|
||||||
|
};
|
||||||
'StarsSubscribeBotButtonMonth': {
|
'StarsSubscribeBotButtonMonth': {
|
||||||
'amount': V;
|
'amount': V;
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user