Process Payment: Fix gift code payment processing (#5682)
This commit is contained in:
parent
6af0b0eb11
commit
2ed807e209
@ -1813,3 +1813,4 @@
|
||||
"PeerPersonalAccount" = "personal account";
|
||||
"PeerChannel" = "channel";
|
||||
"WebAppCollapse" = "Collapse";
|
||||
"GiftSent"= "Gift sent!";
|
||||
|
||||
@ -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,
|
||||
|
||||
1
src/types/language.d.ts
vendored
1
src/types/language.d.ts
vendored
@ -1403,6 +1403,7 @@ export interface LangPair {
|
||||
'PeerPersonalAccount': undefined;
|
||||
'PeerChannel': undefined;
|
||||
'WebAppCollapse': undefined;
|
||||
'GiftSent': undefined;
|
||||
}
|
||||
|
||||
export interface LangPairWithVariables<V extends unknown = LangVariable> {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user