From de15aeb30515f9894cd61e8755a9de006a9da76e Mon Sep 17 00:00:00 2001 From: YehorKyrylov <> Date: Fri, 21 Oct 2022 13:58:23 +0200 Subject: [PATCH] update decoded payment status --- Sources/PandaSDK/SubsriptionStatus.swift | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Sources/PandaSDK/SubsriptionStatus.swift b/Sources/PandaSDK/SubsriptionStatus.swift index 1e6ed03..a5ec5ef 100644 --- a/Sources/PandaSDK/SubsriptionStatus.swift +++ b/Sources/PandaSDK/SubsriptionStatus.swift @@ -78,7 +78,12 @@ public struct SubscriptionInfo: Codable { self.price = try container.decodeIfPresent(Double.self, forKey: .price) self.state = try container.decode(SubscriptionAPIStatus.self, forKey: .state) self.paymentType = try container.decodeIfPresent(PaymentType.self, forKey: .paymentType) ?? .unknown - self.paymentStatus = try container.decodeIfPresent(PaymentStatus.self, forKey: .paymentStatus) ?? .unknown + + if let decodedString = try container.decodeIfPresent(String.self, forKey: .paymentStatus) { + self.paymentStatus = PaymentStatus(rawValue: decodedString) ?? .unknown + } else { + self.paymentStatus = .unknown + } } }