From 0a9f514e035c7f634ff99c3840aafdd1c33b8c1c Mon Sep 17 00:00:00 2001 From: Mikhail Filimonov Date: Thu, 14 Nov 2024 13:19:53 +0400 Subject: [PATCH] - error --- .../Sources/TelegramEngine/Payments/BotPaymentForm.swift | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Payments/BotPaymentForm.swift b/submodules/TelegramCore/Sources/TelegramEngine/Payments/BotPaymentForm.swift index 1f1bc9463b..a07e409376 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Payments/BotPaymentForm.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Payments/BotPaymentForm.swift @@ -172,6 +172,7 @@ extension BotPaymentMethod { public enum BotPaymentFormRequestError { case generic + case alreadyActive } extension BotPaymentInvoice { @@ -385,8 +386,12 @@ func _internal_fetchBotPaymentInvoice(postbox: Postbox, network: Network, source let flags: Int32 = 0 return network.request(Api.functions.payments.getPaymentForm(flags: flags, invoice: invoice, themeParams: nil)) - |> `catch` { _ -> Signal in - return .fail(.generic) + |> `catch` { error -> Signal in + if error.errorDescription == "SUBSCRIPTION_ALREADY_ACTIVE" { + return .fail(.alreadyActive) + } else { + return .fail(.generic) + } } |> mapToSignal { result -> Signal in return postbox.transaction { transaction -> TelegramMediaInvoice in