mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-08 08:31:13 +00:00
- error
This commit is contained in:
parent
572f45bcaa
commit
0a9f514e03
@ -172,6 +172,7 @@ extension BotPaymentMethod {
|
|||||||
|
|
||||||
public enum BotPaymentFormRequestError {
|
public enum BotPaymentFormRequestError {
|
||||||
case generic
|
case generic
|
||||||
|
case alreadyActive
|
||||||
}
|
}
|
||||||
|
|
||||||
extension BotPaymentInvoice {
|
extension BotPaymentInvoice {
|
||||||
@ -385,8 +386,12 @@ func _internal_fetchBotPaymentInvoice(postbox: Postbox, network: Network, source
|
|||||||
let flags: Int32 = 0
|
let flags: Int32 = 0
|
||||||
|
|
||||||
return network.request(Api.functions.payments.getPaymentForm(flags: flags, invoice: invoice, themeParams: nil))
|
return network.request(Api.functions.payments.getPaymentForm(flags: flags, invoice: invoice, themeParams: nil))
|
||||||
|> `catch` { _ -> Signal<Api.payments.PaymentForm, BotPaymentFormRequestError> in
|
|> `catch` { error -> Signal<Api.payments.PaymentForm, BotPaymentFormRequestError> in
|
||||||
return .fail(.generic)
|
if error.errorDescription == "SUBSCRIPTION_ALREADY_ACTIVE" {
|
||||||
|
return .fail(.alreadyActive)
|
||||||
|
} else {
|
||||||
|
return .fail(.generic)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|> mapToSignal { result -> Signal<TelegramMediaInvoice, BotPaymentFormRequestError> in
|
|> mapToSignal { result -> Signal<TelegramMediaInvoice, BotPaymentFormRequestError> in
|
||||||
return postbox.transaction { transaction -> TelegramMediaInvoice in
|
return postbox.transaction { transaction -> TelegramMediaInvoice in
|
||||||
|
Loading…
x
Reference in New Issue
Block a user