Process Payment: Fix gift code payment processing (#5682)
This commit is contained in:
parent
6af0b0eb11
commit
2ed807e209
@ -1813,3 +1813,4 @@
|
|||||||
"PeerPersonalAccount" = "personal account";
|
"PeerPersonalAccount" = "personal account";
|
||||||
"PeerChannel" = "channel";
|
"PeerChannel" = "channel";
|
||||||
"WebAppCollapse" = "Collapse";
|
"WebAppCollapse" = "Collapse";
|
||||||
|
"GiftSent"= "Gift sent!";
|
||||||
|
|||||||
@ -15,16 +15,29 @@ addActionHandler('apiUpdate', (global, actions, update): ActionReturnType => {
|
|||||||
const { invoice } = form;
|
const { invoice } = form;
|
||||||
|
|
||||||
const { totalAmount, currency } = invoice;
|
const { totalAmount, currency } = invoice;
|
||||||
|
const inputInvoice = paymentState.inputInvoice;
|
||||||
if (paymentState.inputInvoice?.type === 'stars') {
|
if (inputInvoice?.type === 'stars') {
|
||||||
actions.closeStarsBalanceModal({ tabId });
|
actions.closeStarsBalanceModal({ tabId });
|
||||||
actions.showNotification({
|
actions.showNotification({
|
||||||
message: langProvider.oldTranslate('StarsAcquiredInfo', paymentState.inputInvoice.stars),
|
message: langProvider.oldTranslate('StarsAcquiredInfo', inputInvoice.stars),
|
||||||
title: langProvider.oldTranslate('StarsAcquired'),
|
title: langProvider.oldTranslate('StarsAcquired'),
|
||||||
icon: 'star',
|
icon: 'star',
|
||||||
tabId,
|
tabId,
|
||||||
});
|
});
|
||||||
actions.requestConfetti({ withStars: true, 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 {
|
} else {
|
||||||
actions.showNotification({
|
actions.showNotification({
|
||||||
tabId,
|
tabId,
|
||||||
|
|||||||
1
src/types/language.d.ts
vendored
1
src/types/language.d.ts
vendored
@ -1403,6 +1403,7 @@ export interface LangPair {
|
|||||||
'PeerPersonalAccount': undefined;
|
'PeerPersonalAccount': undefined;
|
||||||
'PeerChannel': undefined;
|
'PeerChannel': undefined;
|
||||||
'WebAppCollapse': undefined;
|
'WebAppCollapse': undefined;
|
||||||
|
'GiftSent': undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface LangPairWithVariables<V extends unknown = LangVariable> {
|
export interface LangPairWithVariables<V extends unknown = LangVariable> {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user