Skip to content

Commit 0a9f514

Browse files
committed
- error
1 parent 572f45b commit 0a9f514

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

submodules/TelegramCore/Sources/TelegramEngine/Payments/BotPaymentForm.swift

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ extension BotPaymentMethod {
172172

173173
public enum BotPaymentFormRequestError {
174174
case generic
175+
case alreadyActive
175176
}
176177

177178
extension BotPaymentInvoice {
@@ -385,8 +386,12 @@ func _internal_fetchBotPaymentInvoice(postbox: Postbox, network: Network, source
385386
let flags: Int32 = 0
386387

387388
return network.request(Api.functions.payments.getPaymentForm(flags: flags, invoice: invoice, themeParams: nil))
388-
|> `catch` { _ -> Signal<Api.payments.PaymentForm, BotPaymentFormRequestError> in
389-
return .fail(.generic)
389+
|> `catch` { error -> Signal<Api.payments.PaymentForm, BotPaymentFormRequestError> in
390+
if error.errorDescription == "SUBSCRIPTION_ALREADY_ACTIVE" {
391+
return .fail(.alreadyActive)
392+
} else {
393+
return .fail(.generic)
394+
}
390395
}
391396
|> mapToSignal { result -> Signal<TelegramMediaInvoice, BotPaymentFormRequestError> in
392397
return postbox.transaction { transaction -> TelegramMediaInvoice in

0 commit comments

Comments
 (0)