From 6b0f33b9893506019ddbea09a191b98da60b4077 Mon Sep 17 00:00:00 2001 From: Andrew Edwards Date: Sun, 12 Nov 2017 12:59:22 -0500 Subject: [PATCH] Made Routes and Models open for easier testability when mocking. --- Sources/Stripe/API/Routes/AccountRoutes.swift | 2 +- Sources/Stripe/API/Routes/BalanceRoutes.swift | 2 +- Sources/Stripe/API/Routes/ChargeRoutes.swift | 2 +- Sources/Stripe/API/Routes/CouponRoutes.swift | 2 +- Sources/Stripe/API/Routes/CustomerRoutes.swift | 2 +- Sources/Stripe/API/Routes/DisputeRoutes.swift | 2 +- Sources/Stripe/API/Routes/EphemeralKeyRoutes.swift | 2 +- Sources/Stripe/API/Routes/InvoiceItemRoutes.swift | 2 +- Sources/Stripe/API/Routes/InvoiceRoutes.swift | 2 +- Sources/Stripe/API/Routes/OrderReturnRoutes.swift | 2 +- Sources/Stripe/API/Routes/OrderRoutes.swift | 2 +- Sources/Stripe/API/Routes/PlanRoutes.swift | 2 +- Sources/Stripe/API/Routes/ProductRoutes.swift | 2 +- Sources/Stripe/API/Routes/RefundRoutes.swift | 2 +- Sources/Stripe/API/Routes/SKURoutes.swift | 2 +- Sources/Stripe/API/Routes/SourceRoutes.swift | 2 +- Sources/Stripe/API/Routes/SubscriptionItemRoutes.swift | 2 +- Sources/Stripe/API/Routes/SubscriptionRoutes.swift | 2 +- Sources/Stripe/API/Routes/TokenRoutes.swift | 2 +- Sources/Stripe/Models/Balance/Balance.swift | 4 ++-- Sources/Stripe/Models/Balance/BalanceHistoryList.swift | 4 ++-- Sources/Stripe/Models/Balance/BalanceTransactionItem.swift | 5 ++--- Sources/Stripe/Models/Balance/BalanceTransfer.swift | 4 +--- Sources/Stripe/Models/Charges/Charge.swift | 6 ++---- Sources/Stripe/Models/Charges/ChargeList.swift | 4 ++-- Sources/Stripe/Models/Charges/FruadDetails.swift | 4 ++-- Sources/Stripe/Models/Charges/Outcome.swift | 4 ++-- Sources/Stripe/Models/Charges/Refund.swift | 4 ++-- Sources/Stripe/Models/Charges/RefundItem.swift | 5 ++--- Sources/Stripe/Models/Connect/Account.swift | 4 ++-- Sources/Stripe/Models/Connect/AccountList.swift | 5 ++--- Sources/Stripe/Models/Connect/AdditionalOwner.swift | 5 ++--- Sources/Stripe/Models/Connect/ConnectLoginLink.swift | 4 ++-- Sources/Stripe/Models/Connect/ExternalAccounts.swift | 5 ++--- Sources/Stripe/Models/Connect/LegalEntity.swift | 5 ++--- Sources/Stripe/Models/Connect/PayoutSchedule.swift | 5 ++--- Sources/Stripe/Models/Connect/TOSAcceptance.swift | 4 ++-- Sources/Stripe/Models/Connect/Verification.swift | 5 ++--- Sources/Stripe/Models/Coupons/Coupon.swift | 5 ++--- Sources/Stripe/Models/Coupons/CouponList.swift | 5 ++--- Sources/Stripe/Models/Customer/Customer.swift | 7 ++----- Sources/Stripe/Models/Customer/CustomerList.swift | 5 ++--- Sources/Stripe/Models/Discount/Discount.swift | 4 ++-- Sources/Stripe/Models/Dispute/Dispute.swift | 5 ++--- Sources/Stripe/Models/Dispute/DisputeList.swift | 4 ++-- Sources/Stripe/Models/EphemeralKey/EphemeralKey.swift | 4 ++-- Sources/Stripe/Models/Fee.swift | 4 ++-- Sources/Stripe/Models/Inventory.swift | 4 ++-- Sources/Stripe/Models/Invoices/Invoice.swift | 4 ++-- Sources/Stripe/Models/Invoices/InvoiceItem.swift | 4 ++-- Sources/Stripe/Models/Invoices/InvoiceLineGroup.swift | 4 ++-- Sources/Stripe/Models/Invoices/InvoiceLineItem.swift | 4 ++-- Sources/Stripe/Models/OrderList.swift | 4 ++-- Sources/Stripe/Models/Orders/OrderItem.swift | 4 ++-- Sources/Stripe/Models/Orders/OrderReturn.swift | 4 ++-- Sources/Stripe/Models/Orders/OrderReturnList.swift | 5 ++--- Sources/Stripe/Models/Orders/Orders.swift | 5 ++--- Sources/Stripe/Models/Other/DeletedObject.swift | 5 ++--- Sources/Stripe/Models/PackageDimensions.swift | 4 ++-- Sources/Stripe/Models/Plans/Plans.swift | 5 ++--- Sources/Stripe/Models/Plans/PlansList.swift | 5 ++--- Sources/Stripe/Models/Products/Products.swift | 5 ++--- Sources/Stripe/Models/Products/ProductsList.swift | 5 ++--- Sources/Stripe/Models/SKU/SKU.swift | 5 ++--- Sources/Stripe/Models/SKU/SKUList.swift | 5 ++--- Sources/Stripe/Models/Shipping/DeliveryEstimate.swift | 5 ++--- Sources/Stripe/Models/Shipping/ShippingAddress.swift | 5 ++--- Sources/Stripe/Models/Shipping/ShippingLabel.swift | 5 ++--- Sources/Stripe/Models/Shipping/ShippingMethod.swift | 5 ++--- Sources/Stripe/Models/Shipping/StatusTransitions.swift | 5 ++--- Sources/Stripe/Models/Sources/BankAccount.swift | 5 ++--- Sources/Stripe/Models/Sources/Card.swift | 5 ++--- Sources/Stripe/Models/Sources/Owner.swift | 5 ++--- Sources/Stripe/Models/Sources/Receiver.swift | 5 ++--- Sources/Stripe/Models/Sources/Source.swift | 5 ++--- Sources/Stripe/Models/Sources/SourceList.swift | 5 ++--- Sources/Stripe/Models/Subscriptions/Subscription.swift | 5 ++--- Sources/Stripe/Models/Subscriptions/SubscriptionItem.swift | 4 ++-- .../Stripe/Models/Subscriptions/SubscriptionItemList.swift | 5 ++--- Sources/Stripe/Models/Subscriptions/SubscriptionList.swift | 5 ++--- Sources/Stripe/Models/Tokens/Token.swift | 4 ++-- 81 files changed, 142 insertions(+), 184 deletions(-) diff --git a/Sources/Stripe/API/Routes/AccountRoutes.swift b/Sources/Stripe/API/Routes/AccountRoutes.swift index e3a7e4a..2a45579 100644 --- a/Sources/Stripe/API/Routes/AccountRoutes.swift +++ b/Sources/Stripe/API/Routes/AccountRoutes.swift @@ -9,7 +9,7 @@ import Node import HTTP -public final class AccountRoutes { +open class AccountRoutes { let client: StripeClient init(client: StripeClient) { diff --git a/Sources/Stripe/API/Routes/BalanceRoutes.swift b/Sources/Stripe/API/Routes/BalanceRoutes.swift index e917750..829de12 100644 --- a/Sources/Stripe/API/Routes/BalanceRoutes.swift +++ b/Sources/Stripe/API/Routes/BalanceRoutes.swift @@ -8,7 +8,7 @@ import Node -public final class BalanceRoutes { +open class BalanceRoutes { let client: StripeClient diff --git a/Sources/Stripe/API/Routes/ChargeRoutes.swift b/Sources/Stripe/API/Routes/ChargeRoutes.swift index cd2f0f4..ef58a79 100644 --- a/Sources/Stripe/API/Routes/ChargeRoutes.swift +++ b/Sources/Stripe/API/Routes/ChargeRoutes.swift @@ -21,7 +21,7 @@ public enum ChargeType { case customer(String) } -public final class ChargeRoutes { +open class ChargeRoutes { let client: StripeClient diff --git a/Sources/Stripe/API/Routes/CouponRoutes.swift b/Sources/Stripe/API/Routes/CouponRoutes.swift index 5a77ae9..6f9cb57 100644 --- a/Sources/Stripe/API/Routes/CouponRoutes.swift +++ b/Sources/Stripe/API/Routes/CouponRoutes.swift @@ -9,7 +9,7 @@ import Node import HTTP -public final class CouponRoutes { +open class CouponRoutes { let client: StripeClient init(client: StripeClient) { diff --git a/Sources/Stripe/API/Routes/CustomerRoutes.swift b/Sources/Stripe/API/Routes/CustomerRoutes.swift index 2175354..f0f6ed5 100644 --- a/Sources/Stripe/API/Routes/CustomerRoutes.swift +++ b/Sources/Stripe/API/Routes/CustomerRoutes.swift @@ -9,7 +9,7 @@ import Node import HTTP -public final class CustomerRoutes { +open class CustomerRoutes { let client: StripeClient diff --git a/Sources/Stripe/API/Routes/DisputeRoutes.swift b/Sources/Stripe/API/Routes/DisputeRoutes.swift index 54beadf..ad4d898 100644 --- a/Sources/Stripe/API/Routes/DisputeRoutes.swift +++ b/Sources/Stripe/API/Routes/DisputeRoutes.swift @@ -9,7 +9,7 @@ import Node import HTTP -public final class DisputeRoutes { +open class DisputeRoutes { let client: StripeClient init(client: StripeClient) { diff --git a/Sources/Stripe/API/Routes/EphemeralKeyRoutes.swift b/Sources/Stripe/API/Routes/EphemeralKeyRoutes.swift index af73954..8dba2ce 100644 --- a/Sources/Stripe/API/Routes/EphemeralKeyRoutes.swift +++ b/Sources/Stripe/API/Routes/EphemeralKeyRoutes.swift @@ -8,7 +8,7 @@ import HTTP import Node -public final class EphemeralKeyRoutes { +open class EphemeralKeyRoutes { let client: StripeClient init(client: StripeClient) { diff --git a/Sources/Stripe/API/Routes/InvoiceItemRoutes.swift b/Sources/Stripe/API/Routes/InvoiceItemRoutes.swift index 2911f59..15f40c6 100644 --- a/Sources/Stripe/API/Routes/InvoiceItemRoutes.swift +++ b/Sources/Stripe/API/Routes/InvoiceItemRoutes.swift @@ -9,7 +9,7 @@ import Node import HTTP -public final class InvoiceItemRoutes { +open class InvoiceItemRoutes { let client: StripeClient diff --git a/Sources/Stripe/API/Routes/InvoiceRoutes.swift b/Sources/Stripe/API/Routes/InvoiceRoutes.swift index cb849e8..2f62baa 100644 --- a/Sources/Stripe/API/Routes/InvoiceRoutes.swift +++ b/Sources/Stripe/API/Routes/InvoiceRoutes.swift @@ -9,7 +9,7 @@ import Node import HTTP -public final class InvoiceRoutes { +open class InvoiceRoutes { let client: StripeClient diff --git a/Sources/Stripe/API/Routes/OrderReturnRoutes.swift b/Sources/Stripe/API/Routes/OrderReturnRoutes.swift index 668cf8e..d076518 100644 --- a/Sources/Stripe/API/Routes/OrderReturnRoutes.swift +++ b/Sources/Stripe/API/Routes/OrderReturnRoutes.swift @@ -8,7 +8,7 @@ import Node -public final class OrderReturnRoutes { +open class OrderReturnRoutes { let client: StripeClient init(client: StripeClient) { diff --git a/Sources/Stripe/API/Routes/OrderRoutes.swift b/Sources/Stripe/API/Routes/OrderRoutes.swift index b600f86..c70f340 100644 --- a/Sources/Stripe/API/Routes/OrderRoutes.swift +++ b/Sources/Stripe/API/Routes/OrderRoutes.swift @@ -9,7 +9,7 @@ import Node import HTTP -public final class OrderRoutes { +open class OrderRoutes { let client: StripeClient init(client: StripeClient) { diff --git a/Sources/Stripe/API/Routes/PlanRoutes.swift b/Sources/Stripe/API/Routes/PlanRoutes.swift index a2dbf21..e559813 100644 --- a/Sources/Stripe/API/Routes/PlanRoutes.swift +++ b/Sources/Stripe/API/Routes/PlanRoutes.swift @@ -9,7 +9,7 @@ import Node import HTTP -public final class PlanRoutes { +open class PlanRoutes { let client: StripeClient init(client: StripeClient) { diff --git a/Sources/Stripe/API/Routes/ProductRoutes.swift b/Sources/Stripe/API/Routes/ProductRoutes.swift index e500552..d9bff56 100644 --- a/Sources/Stripe/API/Routes/ProductRoutes.swift +++ b/Sources/Stripe/API/Routes/ProductRoutes.swift @@ -9,7 +9,7 @@ import Node import HTTP -public final class ProductRoutes { +open class ProductRoutes { let client: StripeClient init(client: StripeClient) { diff --git a/Sources/Stripe/API/Routes/RefundRoutes.swift b/Sources/Stripe/API/Routes/RefundRoutes.swift index 86ba1e4..7f0dc3a 100644 --- a/Sources/Stripe/API/Routes/RefundRoutes.swift +++ b/Sources/Stripe/API/Routes/RefundRoutes.swift @@ -9,7 +9,7 @@ import Node import HTTP -public final class RefundRoutes { +open class RefundRoutes { let client: StripeClient diff --git a/Sources/Stripe/API/Routes/SKURoutes.swift b/Sources/Stripe/API/Routes/SKURoutes.swift index cd2e2a8..507f9c1 100644 --- a/Sources/Stripe/API/Routes/SKURoutes.swift +++ b/Sources/Stripe/API/Routes/SKURoutes.swift @@ -9,7 +9,7 @@ import Node import HTTP -public final class SKURoutes { +open class SKURoutes { let client: StripeClient init(client: StripeClient) { diff --git a/Sources/Stripe/API/Routes/SourceRoutes.swift b/Sources/Stripe/API/Routes/SourceRoutes.swift index 70ac9b6..5bd916b 100644 --- a/Sources/Stripe/API/Routes/SourceRoutes.swift +++ b/Sources/Stripe/API/Routes/SourceRoutes.swift @@ -9,7 +9,7 @@ import Node import HTTP -public final class SourceRoutes { +open class SourceRoutes { let client: StripeClient diff --git a/Sources/Stripe/API/Routes/SubscriptionItemRoutes.swift b/Sources/Stripe/API/Routes/SubscriptionItemRoutes.swift index e3a3a7a..6aa3de3 100644 --- a/Sources/Stripe/API/Routes/SubscriptionItemRoutes.swift +++ b/Sources/Stripe/API/Routes/SubscriptionItemRoutes.swift @@ -9,7 +9,7 @@ import Node import HTTP -public final class SubscriptionItemRoutes { +open class SubscriptionItemRoutes { let client: StripeClient diff --git a/Sources/Stripe/API/Routes/SubscriptionRoutes.swift b/Sources/Stripe/API/Routes/SubscriptionRoutes.swift index b352e01..66ef9b7 100644 --- a/Sources/Stripe/API/Routes/SubscriptionRoutes.swift +++ b/Sources/Stripe/API/Routes/SubscriptionRoutes.swift @@ -9,7 +9,7 @@ import HTTP import Node -public final class SubscriptionRoutes { +open class SubscriptionRoutes { let client: StripeClient diff --git a/Sources/Stripe/API/Routes/TokenRoutes.swift b/Sources/Stripe/API/Routes/TokenRoutes.swift index eef79b3..f91ee29 100644 --- a/Sources/Stripe/API/Routes/TokenRoutes.swift +++ b/Sources/Stripe/API/Routes/TokenRoutes.swift @@ -9,7 +9,7 @@ import Node import HTTP -public final class TokenRoutes { +open class TokenRoutes { let client: StripeClient diff --git a/Sources/Stripe/Models/Balance/Balance.swift b/Sources/Stripe/Models/Balance/Balance.swift index 873d4c3..f44bfe3 100644 --- a/Sources/Stripe/Models/Balance/Balance.swift +++ b/Sources/Stripe/Models/Balance/Balance.swift @@ -8,14 +8,14 @@ import Node -public final class Balance: StripeModelProtocol { +open class Balance: StripeModelProtocol { public private(set) var object: String? public private(set) var isLiveMode: Bool? public private(set) var available: [BalanceTransfer]? public private(set) var pending: [BalanceTransfer]? - public init(node: Node) throws { + public required init(node: Node) throws { self.object = try node.get("object") self.isLiveMode = try node.get("livemode") self.available = try node.get("available") diff --git a/Sources/Stripe/Models/Balance/BalanceHistoryList.swift b/Sources/Stripe/Models/Balance/BalanceHistoryList.swift index 7cdf79d..836740c 100644 --- a/Sources/Stripe/Models/Balance/BalanceHistoryList.swift +++ b/Sources/Stripe/Models/Balance/BalanceHistoryList.swift @@ -9,14 +9,14 @@ import Foundation import Vapor -public final class BalanceHistoryList: StripeModelProtocol { +open class BalanceHistoryList: StripeModelProtocol { public private(set) var object: String? public private(set) var url: String? public private(set) var hasMore: Bool? public private(set) var items: [BalanceTransactionItem]? - public init(node: Node) throws { + public required init(node: Node) throws { self.object = try node.get("object") self.url = try node.get("url") self.hasMore = try node.get("has_more") diff --git a/Sources/Stripe/Models/Balance/BalanceTransactionItem.swift b/Sources/Stripe/Models/Balance/BalanceTransactionItem.swift index 79eec7f..251931d 100644 --- a/Sources/Stripe/Models/Balance/BalanceTransactionItem.swift +++ b/Sources/Stripe/Models/Balance/BalanceTransactionItem.swift @@ -9,8 +9,7 @@ import Foundation import Vapor - -public final class BalanceTransactionItem: StripeModelProtocol { +open class BalanceTransactionItem: StripeModelProtocol { public private(set) var id: String? public private(set) var object: String? @@ -25,7 +24,7 @@ public final class BalanceTransactionItem: StripeModelProtocol { public private(set) var status: StripeStatus? public private(set) var type: ActionType? - public init(node: Node) throws { + public required init(node: Node) throws { self.id = try node.get("id") self.object = try node.get("object") self.amount = try node.get("amount") diff --git a/Sources/Stripe/Models/Balance/BalanceTransfer.swift b/Sources/Stripe/Models/Balance/BalanceTransfer.swift index 5b2f0a7..d0f8f6c 100644 --- a/Sources/Stripe/Models/Balance/BalanceTransfer.swift +++ b/Sources/Stripe/Models/Balance/BalanceTransfer.swift @@ -8,13 +8,11 @@ import Node - - /** Balance transfer is the body object of available array. https://stripe.com/docs/api/curl#balance_object */ -public class BalanceTransfer: StripeModelProtocol { +open class BalanceTransfer: StripeModelProtocol { public private(set) var currency: StripeCurrency? public private(set) var amount: Int? diff --git a/Sources/Stripe/Models/Charges/Charge.swift b/Sources/Stripe/Models/Charges/Charge.swift index c987394..9dcfae0 100644 --- a/Sources/Stripe/Models/Charges/Charge.swift +++ b/Sources/Stripe/Models/Charges/Charge.swift @@ -14,7 +14,7 @@ import Vapor Charge Model https://stripe.com/docs/api/curl#charge_object */ -public final class Charge: StripeModelProtocol { +open class Charge: StripeModelProtocol { public private(set) var id: String? public private(set) var object: String? @@ -60,9 +60,7 @@ public final class Charge: StripeModelProtocol { public private(set) var shippingLabel: ShippingLabel? public private(set) var transferGroup: String? - public init() {} - - public init(node: Node) throws { + public required init(node: Node) throws { self.id = try node.get("id") self.object = try node.get("object") self.amount = try node.get("amount") diff --git a/Sources/Stripe/Models/Charges/ChargeList.swift b/Sources/Stripe/Models/Charges/ChargeList.swift index 7ed03c3..daaf59d 100644 --- a/Sources/Stripe/Models/Charges/ChargeList.swift +++ b/Sources/Stripe/Models/Charges/ChargeList.swift @@ -9,13 +9,13 @@ import Foundation import Vapor -public final class ChargeList: StripeModelProtocol { +open class ChargeList: StripeModelProtocol { public private(set) var object: String? public private(set) var hasMore: Bool? public private(set) var items: [Charge]? - public init(node: Node) throws { + public required init(node: Node) throws { self.object = try node.get("object") self.hasMore = try node.get("has_more") self.items = try node.get("data") diff --git a/Sources/Stripe/Models/Charges/FruadDetails.swift b/Sources/Stripe/Models/Charges/FruadDetails.swift index 63eb5a3..e446ecc 100644 --- a/Sources/Stripe/Models/Charges/FruadDetails.swift +++ b/Sources/Stripe/Models/Charges/FruadDetails.swift @@ -19,12 +19,12 @@ public enum FraudReport: String { case fraudulent = "fraudulent" } -public final class FraudDetails: StripeModelProtocol { +open class FraudDetails: StripeModelProtocol { public private(set) var userReport: FraudReport? public private(set) var stripeReport: FraudReport? - public init(node: Node) throws { + public required init(node: Node) throws { if let value: String? = try node.get("user_report") { if let value = value { self.userReport = FraudReport(rawValue: value) diff --git a/Sources/Stripe/Models/Charges/Outcome.swift b/Sources/Stripe/Models/Charges/Outcome.swift index 67387e7..7d55ea8 100644 --- a/Sources/Stripe/Models/Charges/Outcome.swift +++ b/Sources/Stripe/Models/Charges/Outcome.swift @@ -37,7 +37,7 @@ public enum OutcomeType: String { case invalid = "invalid" } -public final class Outcome: StripeModelProtocol { +open class Outcome: StripeModelProtocol { public private(set) var networkStatus: NetworkStatus? public private(set) var reason: String? @@ -46,7 +46,7 @@ public final class Outcome: StripeModelProtocol { public private(set) var sellerMessage: String? public private(set) var type: OutcomeType? - public init(node: Node) throws { + public required init(node: Node) throws { if let networkStatus = node["network_status"]?.string { self.networkStatus = NetworkStatus(rawValue: networkStatus) } diff --git a/Sources/Stripe/Models/Charges/Refund.swift b/Sources/Stripe/Models/Charges/Refund.swift index 357e50c..2957dd3 100644 --- a/Sources/Stripe/Models/Charges/Refund.swift +++ b/Sources/Stripe/Models/Charges/Refund.swift @@ -15,7 +15,7 @@ import Vapor https://stripe.com/docs/api/curl#charge_object-refunds */ -public final class Refund: StripeModelProtocol { +open class Refund: StripeModelProtocol { public private(set) var object: String? public private(set) var hasMore: Bool @@ -23,7 +23,7 @@ public final class Refund: StripeModelProtocol { public private(set) var url: String? public private(set) var items: [RefundItem]? - public init(node: Node) throws { + public required init(node: Node) throws { self.object = try node.get("object") self.items = try node.get("data") self.hasMore = try node.get("has_more") diff --git a/Sources/Stripe/Models/Charges/RefundItem.swift b/Sources/Stripe/Models/Charges/RefundItem.swift index 06d487a..3f97b48 100644 --- a/Sources/Stripe/Models/Charges/RefundItem.swift +++ b/Sources/Stripe/Models/Charges/RefundItem.swift @@ -9,8 +9,7 @@ import Foundation import Vapor - -public final class RefundItem: StripeModelProtocol { +open class RefundItem: StripeModelProtocol { public private(set) var id: String? public private(set) var object: String? @@ -25,7 +24,7 @@ public final class RefundItem: StripeModelProtocol { public private(set) var receiptNumber: String? public private(set) var status: StripeStatus? - public init(node: Node) throws { + public required init(node: Node) throws { self.id = try node.get("id") self.object = try node.get("object") self.amount = try node.get("amount") diff --git a/Sources/Stripe/Models/Connect/Account.swift b/Sources/Stripe/Models/Connect/Account.swift index fcd92be..713bd46 100644 --- a/Sources/Stripe/Models/Connect/Account.swift +++ b/Sources/Stripe/Models/Connect/Account.swift @@ -15,7 +15,7 @@ import Vapor https://stripe.com/docs/api#account_object */ -public final class ConnectAccount: StripeModelProtocol { +open class ConnectAccount: StripeModelProtocol { public private(set) var id: String? public private(set) var object: String? @@ -46,7 +46,7 @@ public final class ConnectAccount: StripeModelProtocol { public private(set) var verification: Verification? public private(set) var keys: Node? - public init(node: Node) throws { + public required init(node: Node) throws { self.id = try node.get("id") self.object = try node.get("object") self.businessName = try node.get("business_name") diff --git a/Sources/Stripe/Models/Connect/AccountList.swift b/Sources/Stripe/Models/Connect/AccountList.swift index 2d3e2cd..5b4dc4d 100644 --- a/Sources/Stripe/Models/Connect/AccountList.swift +++ b/Sources/Stripe/Models/Connect/AccountList.swift @@ -9,14 +9,13 @@ import Foundation import Vapor - -public final class AccountList: StripeModelProtocol { +open class AccountList: StripeModelProtocol { public private(set) var object: String? public private(set) var url: String? public private(set) var hasMore: Bool? public private(set) var items: [ConnectAccount]? - public init(node: Node) throws { + public required init(node: Node) throws { self.object = try node.get("object") self.url = try node.get("url") self.hasMore = try node.get("has_more") diff --git a/Sources/Stripe/Models/Connect/AdditionalOwner.swift b/Sources/Stripe/Models/Connect/AdditionalOwner.swift index 197c072..6f9339f 100644 --- a/Sources/Stripe/Models/Connect/AdditionalOwner.swift +++ b/Sources/Stripe/Models/Connect/AdditionalOwner.swift @@ -9,8 +9,7 @@ import Foundation import Vapor - -public final class AdditionalOwner: StripeModelProtocol { +open class AdditionalOwner: StripeModelProtocol { public private(set) var firstName: String? public private(set) var lastName: String? @@ -18,7 +17,7 @@ public final class AdditionalOwner: StripeModelProtocol { public private(set) var address: ShippingAddress? public private(set) var verification: Verification? - public init(node: Node) throws { + public required init(node: Node) throws { self.firstName = try node.get("first_name") self.lastName = try node.get("last_name") self.dateOfBirth = try node.get("dob") diff --git a/Sources/Stripe/Models/Connect/ConnectLoginLink.swift b/Sources/Stripe/Models/Connect/ConnectLoginLink.swift index ffd5c1d..f5c00a3 100644 --- a/Sources/Stripe/Models/Connect/ConnectLoginLink.swift +++ b/Sources/Stripe/Models/Connect/ConnectLoginLink.swift @@ -9,13 +9,13 @@ import Foundation import Vapor -public final class ConnectLoginLink: StripeModelProtocol { +open class ConnectLoginLink: StripeModelProtocol { public private(set) var object: String? public private(set) var created: Date? public private(set) var url: String? - public init(node: Node) throws { + public required init(node: Node) throws { self.object = try node.get("object") self.created = try node.get("created") self.url = try node.get("url") diff --git a/Sources/Stripe/Models/Connect/ExternalAccounts.swift b/Sources/Stripe/Models/Connect/ExternalAccounts.swift index 58d3b11..ed24758 100644 --- a/Sources/Stripe/Models/Connect/ExternalAccounts.swift +++ b/Sources/Stripe/Models/Connect/ExternalAccounts.swift @@ -9,8 +9,7 @@ import Foundation import Vapor - -public final class ExternalAccounts: StripeModelProtocol { +open class ExternalAccounts: StripeModelProtocol { public private(set) var object: String? public private(set) var url: String? @@ -19,7 +18,7 @@ public final class ExternalAccounts: StripeModelProtocol { public private(set) var cardAccounts: [Card] = [] public private(set) var bankAccounts: [BankAccount] = [] - public init(node: Node) throws { + public required init(node: Node) throws { self.object = try node.get("object") self.url = try node.get("url") self.hasMore = try node.get("has_more") diff --git a/Sources/Stripe/Models/Connect/LegalEntity.swift b/Sources/Stripe/Models/Connect/LegalEntity.swift index 0357e63..815812a 100644 --- a/Sources/Stripe/Models/Connect/LegalEntity.swift +++ b/Sources/Stripe/Models/Connect/LegalEntity.swift @@ -9,12 +9,11 @@ import Foundation import Vapor - /** Legal Entity */ -public final class LegalEntity: StripeModelProtocol { +open class LegalEntity: StripeModelProtocol { public private(set) var additionalOwners: [AdditionalOwner]? public private(set) var address: ShippingAddress? @@ -33,7 +32,7 @@ public final class LegalEntity: StripeModelProtocol { public private(set) var type: String? public private(set) var verification: Verification? - public init(node: Node) throws { + public required init(node: Node) throws { self.additionalOwners = try node.get("additional_owners") self.address = try node.get("address") self.businessName = try node.get("business_name") diff --git a/Sources/Stripe/Models/Connect/PayoutSchedule.swift b/Sources/Stripe/Models/Connect/PayoutSchedule.swift index 47b542d..7612bfc 100644 --- a/Sources/Stripe/Models/Connect/PayoutSchedule.swift +++ b/Sources/Stripe/Models/Connect/PayoutSchedule.swift @@ -9,15 +9,14 @@ import Foundation import Vapor - -public final class PayoutSchedule: StripeModelProtocol { +open class PayoutSchedule: StripeModelProtocol { public private(set) var delayDays: Int? public private(set) var interval: StripePayoutInterval? public private(set) var monthlyAnchor: Int? public private(set) var weeklyAnchor: StripeWeeklyAnchor? - public init(node: Node) throws { + public required init(node: Node) throws { self.delayDays = try node.get("delay_days") if let interval = node["interval"]?.string { diff --git a/Sources/Stripe/Models/Connect/TOSAcceptance.swift b/Sources/Stripe/Models/Connect/TOSAcceptance.swift index ba42bf3..6d7f077 100644 --- a/Sources/Stripe/Models/Connect/TOSAcceptance.swift +++ b/Sources/Stripe/Models/Connect/TOSAcceptance.swift @@ -9,13 +9,13 @@ import Foundation import Vapor -public final class TOSAcceptance: StripeModelProtocol { +open class TOSAcceptance: StripeModelProtocol { public private(set) var timestamp: Date? public private(set) var ip: String? public private(set) var userAgent: String? - public init(node: Node) throws { + public required init(node: Node) throws { self.timestamp = try node.get("timestamp") self.ip = try node.get("ip") self.userAgent = try node.get("user_agent") diff --git a/Sources/Stripe/Models/Connect/Verification.swift b/Sources/Stripe/Models/Connect/Verification.swift index 8d8c00c..e19fe7e 100644 --- a/Sources/Stripe/Models/Connect/Verification.swift +++ b/Sources/Stripe/Models/Connect/Verification.swift @@ -9,14 +9,13 @@ import Foundation import Vapor - -public final class Verification: StripeModelProtocol { +open class Verification: StripeModelProtocol { public private(set) var details: String? public private(set) var detailsCode: ConnectLegalEntityVerificationState? public private(set) var document: String? public private(set) var status: ConnectLegalEntityVerificationStatus? - public init(node: Node) throws { + public required init(node: Node) throws { self.details = try node.get("details") if let detailsCode = node["details_code"]?.string { self.detailsCode = ConnectLegalEntityVerificationState(rawValue: detailsCode) diff --git a/Sources/Stripe/Models/Coupons/Coupon.swift b/Sources/Stripe/Models/Coupons/Coupon.swift index 04bb0df..6bc189b 100644 --- a/Sources/Stripe/Models/Coupons/Coupon.swift +++ b/Sources/Stripe/Models/Coupons/Coupon.swift @@ -9,12 +9,11 @@ import Foundation import Vapor - /** Coupon Model https://stripe.com/docs/api/curl#coupon_object */ -public final class Coupon: StripeModelProtocol { +open class Coupon: StripeModelProtocol { public private(set) var id: String? public private(set) var amountOff: Int? public private(set) var currency: StripeCurrency? @@ -35,7 +34,7 @@ public final class Coupon: StripeModelProtocol { */ public private(set) var metadata: Node? - public init(node: Node) throws { + public required init(node: Node) throws { self.id = try node.get("id") self.amountOff = try node.get("amount_off") self.created = try node.get("created") diff --git a/Sources/Stripe/Models/Coupons/CouponList.swift b/Sources/Stripe/Models/Coupons/CouponList.swift index 9030605..47d807a 100644 --- a/Sources/Stripe/Models/Coupons/CouponList.swift +++ b/Sources/Stripe/Models/Coupons/CouponList.swift @@ -9,14 +9,13 @@ import Foundation import Vapor - -public final class CouponList: StripeModelProtocol { +open class CouponList: StripeModelProtocol { public private(set) var object: String? public private(set) var url: String? public private(set) var hasMore: Bool? public private(set) var items: [Coupon]? - public init(node: Node) throws { + public required init(node: Node) throws { self.object = try node.get("object") self.url = try node.get("url") self.hasMore = try node.get("has_more") diff --git a/Sources/Stripe/Models/Customer/Customer.swift b/Sources/Stripe/Models/Customer/Customer.swift index 74e1245..b8fdffd 100644 --- a/Sources/Stripe/Models/Customer/Customer.swift +++ b/Sources/Stripe/Models/Customer/Customer.swift @@ -9,12 +9,11 @@ import Foundation import Vapor - /** Customer Model https://stripe.com/docs/api/curl#customer_object */ -public final class Customer: StripeModelProtocol { +open class Customer: StripeModelProtocol { public private(set) var id: String? public private(set) var object: String? @@ -39,9 +38,7 @@ public final class Customer: StripeModelProtocol { public private(set) var metadata: Node? public private(set) var shipping: ShippingLabel? - public init() {} - - public init(node: Node) throws { + public required init(node: Node) throws { self.id = try node.get("id") self.object = try node.get("object") self.accountBalance = try node.get("account_balance") diff --git a/Sources/Stripe/Models/Customer/CustomerList.swift b/Sources/Stripe/Models/Customer/CustomerList.swift index 14b4929..4313636 100644 --- a/Sources/Stripe/Models/Customer/CustomerList.swift +++ b/Sources/Stripe/Models/Customer/CustomerList.swift @@ -9,14 +9,13 @@ import Foundation import Vapor - -public final class CustomerList: StripeModelProtocol { +open class CustomerList: StripeModelProtocol { public private(set) var object: String? public private(set) var url: String? public private(set) var hasMore: Bool? public let items: [Customer]? - public init(node: Node) throws { + public required init(node: Node) throws { self.object = try node.get("object") self.url = try node.get("url") self.hasMore = try node.get("has_more") diff --git a/Sources/Stripe/Models/Discount/Discount.swift b/Sources/Stripe/Models/Discount/Discount.swift index 82dee37..83fcf44 100644 --- a/Sources/Stripe/Models/Discount/Discount.swift +++ b/Sources/Stripe/Models/Discount/Discount.swift @@ -13,7 +13,7 @@ import Vapor Discount Model https://stripe.com/docs/api/curl#discount_object */ -public final class Discount: StripeModelProtocol { +open class Discount: StripeModelProtocol { public private(set) var object: String? public private(set) var coupon: Coupon? @@ -23,7 +23,7 @@ public final class Discount: StripeModelProtocol { public private(set) var subscription: String? - public init(node: Node) throws { + public required init(node: Node) throws { self.object = try node.get("object") self.coupon = try node.get("coupon") diff --git a/Sources/Stripe/Models/Dispute/Dispute.swift b/Sources/Stripe/Models/Dispute/Dispute.swift index 5f0fe64..d75a792 100644 --- a/Sources/Stripe/Models/Dispute/Dispute.swift +++ b/Sources/Stripe/Models/Dispute/Dispute.swift @@ -9,8 +9,7 @@ import Foundation import Vapor - -public final class Dispute: StripeModelProtocol { +open class Dispute: StripeModelProtocol { public private(set) var id: String? public private(set) var object: String? @@ -27,7 +26,7 @@ public final class Dispute: StripeModelProtocol { public private(set) var disputeReason: DisputeReason? public private(set) var disputeStatus: DisputeStatus? - public init(node: Node) throws { + public required init(node: Node) throws { self.id = try node.get("id") self.object = try node.get("object") self.amount = try node.get("amount") diff --git a/Sources/Stripe/Models/Dispute/DisputeList.swift b/Sources/Stripe/Models/Dispute/DisputeList.swift index 34b9086..5a06c6e 100644 --- a/Sources/Stripe/Models/Dispute/DisputeList.swift +++ b/Sources/Stripe/Models/Dispute/DisputeList.swift @@ -9,14 +9,14 @@ import Foundation import Vapor -public final class DisputeList: StripeModelProtocol { +open class DisputeList: StripeModelProtocol { public private(set) var object: String? public private(set) var url: String? public private(set) var hasMore: Bool? public private(set) var items: [Dispute]? - public init(node: Node) throws { + public required init(node: Node) throws { self.object = try node.get("object") self.url = try node.get("url") self.hasMore = try node.get("has_more") diff --git a/Sources/Stripe/Models/EphemeralKey/EphemeralKey.swift b/Sources/Stripe/Models/EphemeralKey/EphemeralKey.swift index a9400d2..7bec945 100644 --- a/Sources/Stripe/Models/EphemeralKey/EphemeralKey.swift +++ b/Sources/Stripe/Models/EphemeralKey/EphemeralKey.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class EphemeralKey: StripeModelProtocol { +open class EphemeralKey: StripeModelProtocol { public private(set) var id: String? public private(set) var object: String? @@ -18,7 +18,7 @@ public final class EphemeralKey: StripeModelProtocol { public private(set) var isLive: Bool? public private(set) var secret: String? - public init(node: Node) throws { + public required init(node: Node) throws { self.id = try node.get("id") self.object = try node.get("object") self.associatedObjects = try node.get("associated_objects") diff --git a/Sources/Stripe/Models/Fee.swift b/Sources/Stripe/Models/Fee.swift index 95d3f7d..51d4b9b 100644 --- a/Sources/Stripe/Models/Fee.swift +++ b/Sources/Stripe/Models/Fee.swift @@ -9,14 +9,14 @@ import Foundation import Vapor -public final class Fee: StripeModelProtocol { +open class Fee: StripeModelProtocol { public private(set) var amount: Int? public private(set) var currency: StripeCurrency? public private(set) var description: String? public private(set) var type: ActionType? - public init(node: Node) throws { + public required init(node: Node) throws { self.amount = try node.get("amount") if let currency = node["currency"]?.string { self.currency = StripeCurrency(rawValue: currency) diff --git a/Sources/Stripe/Models/Inventory.swift b/Sources/Stripe/Models/Inventory.swift index 5a07981..4c6f9dc 100644 --- a/Sources/Stripe/Models/Inventory.swift +++ b/Sources/Stripe/Models/Inventory.swift @@ -9,13 +9,13 @@ import Foundation import Vapor -public final class Inventory: StripeModelProtocol { +open class Inventory: StripeModelProtocol { public private(set) var quantity: Int? public private(set) var type: InventoryType? public private(set) var value: InventoryTypeValue? - public init(node: Node) throws { + public required init(node: Node) throws { self.quantity = try node.get("quantity") if let type = node["type"]?.string { self.type = InventoryType(rawValue: type) diff --git a/Sources/Stripe/Models/Invoices/Invoice.swift b/Sources/Stripe/Models/Invoices/Invoice.swift index 2bb49c0..150d492 100644 --- a/Sources/Stripe/Models/Invoices/Invoice.swift +++ b/Sources/Stripe/Models/Invoices/Invoice.swift @@ -13,7 +13,7 @@ import Vapor Invoice Model https://stripe.com/docs/api#invoice_object */ -public final class Invoice: StripeModelProtocol { +open class Invoice: StripeModelProtocol { public private(set) var id: String? public private(set) var object: String? @@ -55,7 +55,7 @@ public final class Invoice: StripeModelProtocol { public private(set) var lines: [InvoiceLineItem]? public private(set) var currency: StripeCurrency? - public init(node: Node) throws { + public required init(node: Node) throws { self.id = try node.get("id") self.object = try node.get("object") self.amountDue = try node.get("amount_due") diff --git a/Sources/Stripe/Models/Invoices/InvoiceItem.swift b/Sources/Stripe/Models/Invoices/InvoiceItem.swift index 1f61821..e2e650a 100644 --- a/Sources/Stripe/Models/Invoices/InvoiceItem.swift +++ b/Sources/Stripe/Models/Invoices/InvoiceItem.swift @@ -13,7 +13,7 @@ import Vapor Invoice Items https://stripe.com/docs/api#invoiceitems */ -public final class InvoiceItem: StripeModelProtocol { +open class InvoiceItem: StripeModelProtocol { public private(set) var id: String? public private(set) var object: String? @@ -34,7 +34,7 @@ public final class InvoiceItem: StripeModelProtocol { public private(set) var plan: Plan? public private(set) var currency: StripeCurrency? - public init(node: Node) throws { + public required init(node: Node) throws { self.id = try node.get("id") self.object = try node.get("object") self.amount = try node.get("amount") diff --git a/Sources/Stripe/Models/Invoices/InvoiceLineGroup.swift b/Sources/Stripe/Models/Invoices/InvoiceLineGroup.swift index ae93fde..f6d4237 100644 --- a/Sources/Stripe/Models/Invoices/InvoiceLineGroup.swift +++ b/Sources/Stripe/Models/Invoices/InvoiceLineGroup.swift @@ -9,13 +9,13 @@ import Foundation import Vapor -public final class InvoiceLineGroup: StripeModelProtocol { +open class InvoiceLineGroup: StripeModelProtocol { public private(set) var object: String? public private(set) var hasMore: Bool? public private(set) var items: [InvoiceLineItem]? - public init(node: Node) throws { + public required init(node: Node) throws { self.object = try node.get("object") self.hasMore = try node.get("has_more") self.items = try node.get("data") diff --git a/Sources/Stripe/Models/Invoices/InvoiceLineItem.swift b/Sources/Stripe/Models/Invoices/InvoiceLineItem.swift index 933b044..44770ed 100644 --- a/Sources/Stripe/Models/Invoices/InvoiceLineItem.swift +++ b/Sources/Stripe/Models/Invoices/InvoiceLineItem.swift @@ -9,7 +9,7 @@ import Foundation import Vapor -public final class InvoiceLineItem: StripeModelProtocol { +open class InvoiceLineItem: StripeModelProtocol { public private(set) var id: String? public private(set) var object: String? @@ -30,7 +30,7 @@ public final class InvoiceLineItem: StripeModelProtocol { public private(set) var currency: StripeCurrency? - public init(node: Node) throws { + public required init(node: Node) throws { self.id = try node.get("id") self.object = try node.get("object") self.amount = try node.get("amount") diff --git a/Sources/Stripe/Models/OrderList.swift b/Sources/Stripe/Models/OrderList.swift index e3ad2e3..fda2053 100644 --- a/Sources/Stripe/Models/OrderList.swift +++ b/Sources/Stripe/Models/OrderList.swift @@ -9,13 +9,13 @@ import Foundation import Vapor -public final class OrderList: StripeModelProtocol { +open class OrderList: StripeModelProtocol { public private(set) var object: String? public private(set) var url: String? public private(set) var hasMore: Bool? public private(set) var items: [Order]? - public init(node: Node) throws { + public required init(node: Node) throws { self.object = try node.get("object") self.url = try node.get("url") self.hasMore = try node.get("has_more") diff --git a/Sources/Stripe/Models/Orders/OrderItem.swift b/Sources/Stripe/Models/Orders/OrderItem.swift index 3f82141..b0237cf 100644 --- a/Sources/Stripe/Models/Orders/OrderItem.swift +++ b/Sources/Stripe/Models/Orders/OrderItem.swift @@ -15,7 +15,7 @@ import Vapor https://stripe.com/docs/api#order_item_object-object */ -public final class OrderItem: StripeModelProtocol { +open class OrderItem: StripeModelProtocol { public private(set) var object: String? public private(set) var amount: Int? @@ -25,7 +25,7 @@ public final class OrderItem: StripeModelProtocol { public private(set) var quantity: Int? public private(set) var type: OrderItemType? - public init(node: Node) throws { + public required init(node: Node) throws { self.object = try node.get("object") self.amount = try node.get("amount") if let currency = node["currency"]?.string { diff --git a/Sources/Stripe/Models/Orders/OrderReturn.swift b/Sources/Stripe/Models/Orders/OrderReturn.swift index 1b982e5..18f3f2f 100644 --- a/Sources/Stripe/Models/Orders/OrderReturn.swift +++ b/Sources/Stripe/Models/Orders/OrderReturn.swift @@ -15,7 +15,7 @@ import Vapor https://stripe.com/docs/api#order_return_object */ -public final class OrderReturn: StripeModelProtocol { +open class OrderReturn: StripeModelProtocol { public private(set) var id: String? public private(set) var object: String? @@ -27,7 +27,7 @@ public final class OrderReturn: StripeModelProtocol { public private(set) var order: String? public private(set) var refund: String? - public init(node: Node) throws { + public required init(node: Node) throws { self.id = try node.get("id") self.object = try node.get("object") self.amount = try node.get("amount") diff --git a/Sources/Stripe/Models/Orders/OrderReturnList.swift b/Sources/Stripe/Models/Orders/OrderReturnList.swift index 879941d..8bd30ac 100644 --- a/Sources/Stripe/Models/Orders/OrderReturnList.swift +++ b/Sources/Stripe/Models/Orders/OrderReturnList.swift @@ -9,14 +9,13 @@ import Foundation import Vapor - -public final class OrderReturnList: StripeModelProtocol { +open class OrderReturnList: StripeModelProtocol { public private(set) var object: String? public private(set) var url: String? public private(set) var hasMore: Bool? public private(set) var items: [OrderReturn]? - public init(node: Node) throws { + public required init(node: Node) throws { self.object = try node.get("object") self.url = try node.get("url") self.hasMore = try node.get("has_more") diff --git a/Sources/Stripe/Models/Orders/Orders.swift b/Sources/Stripe/Models/Orders/Orders.swift index 1b72853..18bded6 100644 --- a/Sources/Stripe/Models/Orders/Orders.swift +++ b/Sources/Stripe/Models/Orders/Orders.swift @@ -9,13 +9,12 @@ import Foundation import Vapor - /** Order object https://stripe.com/docs/api#order_object */ -public final class Order: StripeModelProtocol { +open class Order: StripeModelProtocol { public private(set) var id: String? public private(set) var object: String? @@ -41,7 +40,7 @@ public final class Order: StripeModelProtocol { public private(set) var updated: Date? public private(set) var upstreamId: String? - public init(node: Node) throws { + public required init(node: Node) throws { self.id = try node.get("id") self.object = try node.get("object") self.amount = try node.get("amount") diff --git a/Sources/Stripe/Models/Other/DeletedObject.swift b/Sources/Stripe/Models/Other/DeletedObject.swift index f1708ad..d2c1ff6 100644 --- a/Sources/Stripe/Models/Other/DeletedObject.swift +++ b/Sources/Stripe/Models/Other/DeletedObject.swift @@ -9,12 +9,11 @@ import Foundation import Vapor - -public final class DeletedObject: StripeModelProtocol { +open class DeletedObject: StripeModelProtocol { public private(set) var deleted: Bool? public private(set) var id: String? - public init(node: Node) throws { + public required init(node: Node) throws { self.deleted = try node.get("deleted") self.id = try node.get("id") } diff --git a/Sources/Stripe/Models/PackageDimensions.swift b/Sources/Stripe/Models/PackageDimensions.swift index a45f90d..001c2fe 100644 --- a/Sources/Stripe/Models/PackageDimensions.swift +++ b/Sources/Stripe/Models/PackageDimensions.swift @@ -9,14 +9,14 @@ import Foundation import Vapor -public final class PackageDimensions: StripeModelProtocol { +open class PackageDimensions: StripeModelProtocol { public private(set) var height: Decimal? public private(set) var length: Decimal? public private(set) var weight: Decimal? public private(set) var width: Decimal? - public init(node: Node) throws { + public required init(node: Node) throws { self.height = try Decimal(node.get("height") as Int) self.length = try Decimal(node.get("length") as Int) diff --git a/Sources/Stripe/Models/Plans/Plans.swift b/Sources/Stripe/Models/Plans/Plans.swift index 693d0f0..054751a 100644 --- a/Sources/Stripe/Models/Plans/Plans.swift +++ b/Sources/Stripe/Models/Plans/Plans.swift @@ -9,12 +9,11 @@ import Foundation import Vapor - /** Plan Model https://stripe.com/docs/api/curl#plan_object */ -public final class Plan: StripeModelProtocol { +open class Plan: StripeModelProtocol { public private(set) var id: String? public private(set) var object: String? public private(set) var amount: Int? @@ -36,7 +35,7 @@ public final class Plan: StripeModelProtocol { public init() {} - public init(node: Node) throws { + public required init(node: Node) throws { self.id = try node.get("id") self.object = try node.get("object") self.amount = try node.get("amount") diff --git a/Sources/Stripe/Models/Plans/PlansList.swift b/Sources/Stripe/Models/Plans/PlansList.swift index 0f88310..1f18fd6 100644 --- a/Sources/Stripe/Models/Plans/PlansList.swift +++ b/Sources/Stripe/Models/Plans/PlansList.swift @@ -9,14 +9,13 @@ import Foundation import Vapor - -public final class PlansList: StripeModelProtocol { +open class PlansList: StripeModelProtocol { public private(set) var object: String? public private(set) var url: String? public private(set) var hasMore: Bool? public private(set) var items: [Plan]? - public init(node: Node) throws { + public required init(node: Node) throws { self.object = try node.get("object") self.url = try node.get("url") self.hasMore = try node.get("has_more") diff --git a/Sources/Stripe/Models/Products/Products.swift b/Sources/Stripe/Models/Products/Products.swift index affe8c8..777fde3 100644 --- a/Sources/Stripe/Models/Products/Products.swift +++ b/Sources/Stripe/Models/Products/Products.swift @@ -9,13 +9,12 @@ import Foundation import Vapor - /** Product object https://stripe.com/docs/api#products */ -public final class Product: StripeModelProtocol { +open class Product: StripeModelProtocol { public private(set) var id: String? public private(set) var object: String? @@ -35,7 +34,7 @@ public final class Product: StripeModelProtocol { public private(set) var updated: Date? public private(set) var url: String? - public init(node: Node) throws { + public required init(node: Node) throws { self.id = try node.get("id") self.object = try node.get("object") self.active = try node.get("active") diff --git a/Sources/Stripe/Models/Products/ProductsList.swift b/Sources/Stripe/Models/Products/ProductsList.swift index 3e030f9..8813f7a 100644 --- a/Sources/Stripe/Models/Products/ProductsList.swift +++ b/Sources/Stripe/Models/Products/ProductsList.swift @@ -9,14 +9,13 @@ import Foundation import Vapor - -public final class ProductsList: StripeModelProtocol { +open class ProductsList: StripeModelProtocol { public private(set) var object: String? public private(set) var url: String? public private(set) var hasMore: Bool? public private(set) var items: [Product]? - public init(node: Node) throws { + public required init(node: Node) throws { self.object = try node.get("object") self.url = try node.get("url") self.hasMore = try node.get("has_more") diff --git a/Sources/Stripe/Models/SKU/SKU.swift b/Sources/Stripe/Models/SKU/SKU.swift index eb1c363..47ac3a9 100644 --- a/Sources/Stripe/Models/SKU/SKU.swift +++ b/Sources/Stripe/Models/SKU/SKU.swift @@ -9,13 +9,12 @@ import Foundation import Vapor - /** SKU object https://stripe.com/docs/api#skus */ -public final class SKU: StripeModelProtocol { +open class SKU: StripeModelProtocol { public private(set) var id: String? public private(set) var object: String? @@ -32,7 +31,7 @@ public final class SKU: StripeModelProtocol { public private(set) var product: String? public private(set) var updated: Date? - public init(node: Node) throws { + public required init(node: Node) throws { self.id = try node.get("id") self.object = try node.get("object") self.active = try node.get("active") diff --git a/Sources/Stripe/Models/SKU/SKUList.swift b/Sources/Stripe/Models/SKU/SKUList.swift index 714c220..bdbf393 100644 --- a/Sources/Stripe/Models/SKU/SKUList.swift +++ b/Sources/Stripe/Models/SKU/SKUList.swift @@ -9,14 +9,13 @@ import Foundation import Vapor - -public final class SKUList: StripeModelProtocol { +open class SKUList: StripeModelProtocol { public private(set) var object: String? public private(set) var url: String? public private(set) var hasMore: Bool? public private(set) var items: [SKU]? - public init(node: Node) throws { + public required init(node: Node) throws { self.object = try node.get("object") self.url = try node.get("url") self.hasMore = try node.get("has_more") diff --git a/Sources/Stripe/Models/Shipping/DeliveryEstimate.swift b/Sources/Stripe/Models/Shipping/DeliveryEstimate.swift index bc08403..175f149 100644 --- a/Sources/Stripe/Models/Shipping/DeliveryEstimate.swift +++ b/Sources/Stripe/Models/Shipping/DeliveryEstimate.swift @@ -9,15 +9,14 @@ import Foundation import Vapor - -public final class DeliveryEstimate: StripeModelProtocol { +open class DeliveryEstimate: StripeModelProtocol { public private(set) var date: String? public private(set) var earliest: String? public private(set) var latest: String? public private(set) var type: DeliveryEstimateType? - public init(node: Node) throws { + public required init(node: Node) throws { self.date = try node.get("date") self.earliest = try node.get("earliest") self.latest = try node.get("latest") diff --git a/Sources/Stripe/Models/Shipping/ShippingAddress.swift b/Sources/Stripe/Models/Shipping/ShippingAddress.swift index 2179f40..abf6d0a 100644 --- a/Sources/Stripe/Models/Shipping/ShippingAddress.swift +++ b/Sources/Stripe/Models/Shipping/ShippingAddress.swift @@ -9,13 +9,12 @@ import Foundation import Vapor - /** Shipping Address https://stripe.com/docs/api/curl#charge_object-shipping-address */ -public final class ShippingAddress: StripeModelProtocol { +open class ShippingAddress: StripeModelProtocol { public var city: String? public var country: String? @@ -26,7 +25,7 @@ public final class ShippingAddress: StripeModelProtocol { public init() { } - public init(node: Node) throws { + public required init(node: Node) throws { self.city = try node.get("city") self.country = try node.get("country") self.addressLine1 = try node.get("line1") diff --git a/Sources/Stripe/Models/Shipping/ShippingLabel.swift b/Sources/Stripe/Models/Shipping/ShippingLabel.swift index 56d4de6..2dd060e 100644 --- a/Sources/Stripe/Models/Shipping/ShippingLabel.swift +++ b/Sources/Stripe/Models/Shipping/ShippingLabel.swift @@ -9,12 +9,11 @@ import Foundation import Vapor - /** Shipping https://stripe.com/docs/api/curl#charge_object-shipping */ -public final class ShippingLabel: StripeModelProtocol { +open class ShippingLabel: StripeModelProtocol { public var address: ShippingAddress? public var carrier: String? @@ -24,7 +23,7 @@ public final class ShippingLabel: StripeModelProtocol { public init() { } - public init(node: Node) throws { + public required init(node: Node) throws { self.address = try node.get("address") self.carrier = try node.get("carrier") self.name = try node.get("name") diff --git a/Sources/Stripe/Models/Shipping/ShippingMethod.swift b/Sources/Stripe/Models/Shipping/ShippingMethod.swift index 26f5734..c7b0542 100644 --- a/Sources/Stripe/Models/Shipping/ShippingMethod.swift +++ b/Sources/Stripe/Models/Shipping/ShippingMethod.swift @@ -9,8 +9,7 @@ import Foundation import Vapor - -public final class ShippingMethod: StripeModelProtocol { +open class ShippingMethod: StripeModelProtocol { public private(set) var id: String? public private(set) var amount: Int? @@ -18,7 +17,7 @@ public final class ShippingMethod: StripeModelProtocol { public private(set) var deliveryEstimate: DeliveryEstimate? public private(set) var description: String? - public init(node: Node) throws { + public required init(node: Node) throws { self.id = try node.get("id") self.amount = try node.get("amount") if let currency = node["currency"]?.string { diff --git a/Sources/Stripe/Models/Shipping/StatusTransitions.swift b/Sources/Stripe/Models/Shipping/StatusTransitions.swift index 014dbc1..2ca87c4 100644 --- a/Sources/Stripe/Models/Shipping/StatusTransitions.swift +++ b/Sources/Stripe/Models/Shipping/StatusTransitions.swift @@ -9,15 +9,14 @@ import Foundation import Vapor - -public final class StatusTransitions: StripeModelProtocol { +open class StatusTransitions: StripeModelProtocol { public private(set) var canceled: Date? public private(set) var fufilled: Date? public private(set) var paid: Date? public private(set) var returned: Date? - public init(node: Node) throws { + public required init(node: Node) throws { self.canceled = try node.get("canceled") self.fufilled = try node.get("fufilled") self.paid = try node.get("paid") diff --git a/Sources/Stripe/Models/Sources/BankAccount.swift b/Sources/Stripe/Models/Sources/BankAccount.swift index 21eb2fc..273feb9 100644 --- a/Sources/Stripe/Models/Sources/BankAccount.swift +++ b/Sources/Stripe/Models/Sources/BankAccount.swift @@ -9,12 +9,11 @@ import Foundation import Vapor - /** Bank Account Model https://stripe.com/docs/api/curl#customer_bank_account_object */ -public final class BankAccount: StripeModelProtocol { +open class BankAccount: StripeModelProtocol { public private(set) var id: String? public private(set) var object: String? @@ -38,7 +37,7 @@ public final class BankAccount: StripeModelProtocol { public private(set) var accountHolderType: String? public private(set) var metadata: Node? - public init(node: Node) throws { + public required init(node: Node) throws { self.id = try node.get("id") self.object = try node.get("object") self.account = try node.get("account") diff --git a/Sources/Stripe/Models/Sources/Card.swift b/Sources/Stripe/Models/Sources/Card.swift index 95b1f2a..a778f7c 100644 --- a/Sources/Stripe/Models/Sources/Card.swift +++ b/Sources/Stripe/Models/Sources/Card.swift @@ -9,12 +9,11 @@ import Foundation import Vapor - /** Card Model https://stripe.com/docs/api/curl#card_object */ -public final class Card: StripeModelProtocol { +open class Card: StripeModelProtocol { public private(set) var id: String? public private(set) var object: String? @@ -50,7 +49,7 @@ public final class Card: StripeModelProtocol { public private(set) var metadata: Node? public private(set) var name: String? - public init(node: Node) throws { + public required init(node: Node) throws { self.id = try node.get("id") self.object = try node.get("object") self.account = try node.get("account") diff --git a/Sources/Stripe/Models/Sources/Owner.swift b/Sources/Stripe/Models/Sources/Owner.swift index 78973b7..46bf076 100644 --- a/Sources/Stripe/Models/Sources/Owner.swift +++ b/Sources/Stripe/Models/Sources/Owner.swift @@ -9,8 +9,7 @@ import Foundation import Vapor - -public final class Owner: StripeModelProtocol { +open class Owner: StripeModelProtocol { public private(set) var address: ShippingAddress? public private(set) var email: String? public private(set) var name: String? @@ -20,7 +19,7 @@ public final class Owner: StripeModelProtocol { public private(set) var verifiedName: String? public private(set) var verifiedPhone: String? - public init(node: Node) throws { + public required init(node: Node) throws { self.address = try node.get("address") self.email = try node.get("email") self.name = try node.get("name") diff --git a/Sources/Stripe/Models/Sources/Receiver.swift b/Sources/Stripe/Models/Sources/Receiver.swift index f23a822..16b4a35 100644 --- a/Sources/Stripe/Models/Sources/Receiver.swift +++ b/Sources/Stripe/Models/Sources/Receiver.swift @@ -9,8 +9,7 @@ import Foundation import Vapor - -public final class Receiver: StripeModelProtocol { +open class Receiver: StripeModelProtocol { public private(set) var address: String? public private(set) var amountCharged: Int? @@ -19,7 +18,7 @@ public final class Receiver: StripeModelProtocol { public private(set) var refundMethod: String? public private(set) var refundStatus: String? - public init(node: Node) throws { + public required init(node: Node) throws { self.address = try node.get("address") self.amountCharged = try node.get("amount_charged") self.amountReceived = try node.get("amount_received") diff --git a/Sources/Stripe/Models/Sources/Source.swift b/Sources/Stripe/Models/Sources/Source.swift index ff37a2b..ee14896 100644 --- a/Sources/Stripe/Models/Sources/Source.swift +++ b/Sources/Stripe/Models/Sources/Source.swift @@ -9,12 +9,11 @@ import Foundation import Vapor - /** Source Model https://stripe.com/docs/api/curl#source_object */ -public final class Source: StripeModelProtocol { +open class Source: StripeModelProtocol { public private(set) var id: String? public private(set) var object: String? @@ -43,7 +42,7 @@ public final class Source: StripeModelProtocol { public private(set) var metadata: Node? public private(set) var owner: Owner? - public init(node: Node) throws { + public required init(node: Node) throws { self.id = try node.get("id") self.object = try node.get("object") self.amount = try node.get("amount") diff --git a/Sources/Stripe/Models/Sources/SourceList.swift b/Sources/Stripe/Models/Sources/SourceList.swift index 9d84000..b8cf829 100644 --- a/Sources/Stripe/Models/Sources/SourceList.swift +++ b/Sources/Stripe/Models/Sources/SourceList.swift @@ -9,8 +9,7 @@ import Foundation import Vapor - -public final class SourceList: StripeModelProtocol { +open class SourceList: StripeModelProtocol { public private(set) var object: String? public private(set) var url: String? @@ -19,7 +18,7 @@ public final class SourceList: StripeModelProtocol { public private(set) var cardSources: [Card] = [] public private(set) var bankSources: [BankAccount] = [] - public init(node: Node) throws { + public required init(node: Node) throws { self.object = try node.get("object") self.url = try node.get("url") self.hasMore = try node.get("has_more") diff --git a/Sources/Stripe/Models/Subscriptions/Subscription.swift b/Sources/Stripe/Models/Subscriptions/Subscription.swift index 017397a..bf9f836 100644 --- a/Sources/Stripe/Models/Subscriptions/Subscription.swift +++ b/Sources/Stripe/Models/Subscriptions/Subscription.swift @@ -9,12 +9,11 @@ import Foundation import Vapor - /** Subscription Model https://stripe.com/docs/api/curl#subscription_object */ -public final class Subscription: StripeModelProtocol { +open class Subscription: StripeModelProtocol { public private(set) var id: String? public private(set) var object: String? @@ -43,7 +42,7 @@ public final class Subscription: StripeModelProtocol { public private(set) var taxPercent: Double? public private(set) var trialEnd: Date? - public init(node: Node) throws { + public required init(node: Node) throws { self.id = try node.get("id") self.object = try node.get("object") self.applicationFeePercent = try node.get("application_fee_percent") diff --git a/Sources/Stripe/Models/Subscriptions/SubscriptionItem.swift b/Sources/Stripe/Models/Subscriptions/SubscriptionItem.swift index 5614012..3105282 100644 --- a/Sources/Stripe/Models/Subscriptions/SubscriptionItem.swift +++ b/Sources/Stripe/Models/Subscriptions/SubscriptionItem.swift @@ -12,7 +12,7 @@ import Vapor SubscriptionItem Model https://stripe.com/docs/api/curl#subscription_items */ -public final class SubscriptionItem: StripeModelProtocol { +open class SubscriptionItem: StripeModelProtocol { public private(set) var id: String? public private(set) var object: String? @@ -26,7 +26,7 @@ public final class SubscriptionItem: StripeModelProtocol { */ public private(set) var deleted: Bool? - public init(node: Node) throws { + public required init(node: Node) throws { self.id = try node.get("id") self.object = try node.get("object") self.created = try node.get("created") diff --git a/Sources/Stripe/Models/Subscriptions/SubscriptionItemList.swift b/Sources/Stripe/Models/Subscriptions/SubscriptionItemList.swift index 49e6eb4..a25dc9f 100644 --- a/Sources/Stripe/Models/Subscriptions/SubscriptionItemList.swift +++ b/Sources/Stripe/Models/Subscriptions/SubscriptionItemList.swift @@ -9,8 +9,7 @@ import Foundation import Vapor - -public final class SubscriptionItemList: StripeModelProtocol { +open class SubscriptionItemList: StripeModelProtocol { public private(set) var object: String? public private(set) var hasMore: Bool? @@ -18,7 +17,7 @@ public final class SubscriptionItemList: StripeModelProtocol { public private(set) var url: String? public private(set) var totalCount: Int? - public init(node: Node) throws { + public required init(node: Node) throws { self.object = try node.get("object") self.hasMore = try node.get("has_more") self.items = try node.get("data") diff --git a/Sources/Stripe/Models/Subscriptions/SubscriptionList.swift b/Sources/Stripe/Models/Subscriptions/SubscriptionList.swift index 204f5bf..736bb77 100644 --- a/Sources/Stripe/Models/Subscriptions/SubscriptionList.swift +++ b/Sources/Stripe/Models/Subscriptions/SubscriptionList.swift @@ -9,15 +9,14 @@ import Foundation import Vapor - -public final class SubscriptionList: StripeModelProtocol { +open class SubscriptionList: StripeModelProtocol { public private(set) var object: String? public private(set) var hasMore: Bool? public private(set) var items: [Subscription]? public private(set) var url: String? - public init(node: Node) throws { + public required init(node: Node) throws { self.object = try node.get("object") self.url = try node.get("url") self.hasMore = try node.get("has_more") diff --git a/Sources/Stripe/Models/Tokens/Token.swift b/Sources/Stripe/Models/Tokens/Token.swift index 32cb693..b511ce5 100644 --- a/Sources/Stripe/Models/Tokens/Token.swift +++ b/Sources/Stripe/Models/Tokens/Token.swift @@ -12,7 +12,7 @@ import Vapor Token Model https://stripe.com/docs/api/curl#token_object */ -public final class Token: StripeModelProtocol { +open class Token: StripeModelProtocol { public private(set) var id: String? public private(set) var object: String? @@ -25,7 +25,7 @@ public final class Token: StripeModelProtocol { public private(set) var card: Card? public private(set) var bankAccount: BankAccount? - public init(node: Node) throws { + public required init(node: Node) throws { self.id = try node.get("id") self.object = try node.get("object") self.type = try node.get("type")