Process Payment: Fix gift code payment processing (#5682)

This commit is contained in:
Alexander Zinchuk 2025-03-01 17:59:56 +01:00
parent 6af0b0eb11
commit 2ed807e209
3 changed files with 18 additions and 3 deletions

View File

@ -1813,3 +1813,4 @@
"PeerPersonalAccount" = "personal account";
"PeerChannel" = "channel";
"WebAppCollapse" = "Collapse";
"GiftSent"= "Gift sent!";

View File

@ -15,16 +15,29 @@ addActionHandler('apiUpdate', (global, actions, update): ActionReturnType => {
const { invoice } = form;
const { totalAmount, currency } = invoice;
if (paymentState.inputInvoice?.type === 'stars') {
const inputInvoice = paymentState.inputInvoice;
if (inputInvoice?.type === 'stars') {
actions.closeStarsBalanceModal({ tabId });
actions.showNotification({
message: langProvider.oldTranslate('StarsAcquiredInfo', paymentState.inputInvoice.stars),
message: langProvider.oldTranslate('StarsAcquiredInfo', inputInvoice.stars),
title: langProvider.oldTranslate('StarsAcquired'),
icon: 'star',
tabId,
});
actions.requestConfetti({ withStars: true, tabId });
} else if (inputInvoice?.type === 'giftcode') {
const giftModalState = selectTabState(global, tabId).giftModal;
if (giftModalState && inputInvoice?.userIds[0] === giftModalState.forPeerId) {
actions.showNotification({
message: {
key: 'GiftSent',
},
tabId,
});
actions.requestConfetti({ withStars: true, tabId });
actions.closeGiftModal({ tabId });
}
} else {
actions.showNotification({
tabId,

View File

@ -1403,6 +1403,7 @@ export interface LangPair {
'PeerPersonalAccount': undefined;
'PeerChannel': undefined;
'WebAppCollapse': undefined;
'GiftSent': undefined;
}
export interface LangPairWithVariables<V extends unknown = LangVariable> {