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 {
|
||||
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<Api.payments.PaymentForm, BotPaymentFormRequestError> in
|
||||
return .fail(.generic)
|
||||
|> `catch` { error -> Signal<Api.payments.PaymentForm, BotPaymentFormRequestError> in
|
||||
if error.errorDescription == "SUBSCRIPTION_ALREADY_ACTIVE" {
|
||||
return .fail(.alreadyActive)
|
||||
} else {
|
||||
return .fail(.generic)
|
||||
}
|
||||
}
|
||||
|> mapToSignal { result -> Signal<TelegramMediaInvoice, BotPaymentFormRequestError> in
|
||||
return postbox.transaction { transaction -> TelegramMediaInvoice in
|
||||
|
Loading…
x
Reference in New Issue
Block a user