Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore defaultForCurrency variable in the Card #238

Merged
merged 9 commits into from
Nov 3, 2023
13 changes: 13 additions & 0 deletions Sources/StripeKit/Billing/Invoices/Invoice.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ public struct Invoice: Codable {
public var status: InvoiceStatus?
/// The subscription that this invoice was prepared for, if any.
@Expandable<Subscription> public var subscription: String?
/// Details about the subscription that created this invoice.
public var subscriptionDetails: SubscriptionDetails?
Maxim-Inv marked this conversation as resolved.
Show resolved Hide resolved
/// Total after discount.
public var total: Int?
/// String representing the object’s type. Objects of the same type share the same value.
Expand Down Expand Up @@ -178,6 +180,7 @@ public struct Invoice: Codable {
periodStart: Date? = nil,
status: InvoiceStatus? = nil,
subscription: String? = nil,
subscriptionDetails: SubscriptionDetails? = nil,
total: Int? = nil,
object: String,
accountCountry: String? = nil,
Expand Down Expand Up @@ -254,6 +257,7 @@ public struct Invoice: Codable {
self.periodStart = periodStart
self.status = status
self._subscription = Expandable(id: subscription)
self.subscriptionDetails = subscriptionDetails
self.total = total
self.object = object
self.accountCountry = accountCountry
Expand Down Expand Up @@ -318,6 +322,15 @@ public struct Invoice: Codable {
}
}

public struct SubscriptionDetails: Codable {
/// Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
public var metadata: [String: String]?
Maxim-Inv marked this conversation as resolved.
Show resolved Hide resolved

public init(metadata: [String: String]? = nil) {
self.metadata = metadata
}
}

public enum InvoiceCollectionMethod: String, Codable {
case chargeAutomatically = "charge_automatically"
case sendInvoice = "send_invoice"
Expand Down
4 changes: 4 additions & 0 deletions Sources/StripeKit/Payment Methods/Cards/Card.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ public struct Card: Codable {
@Expandable<Customer> public var customer: String?
/// If a CVC was provided, results of the check: `pass`, `fail`, `unavailable`, or `unchecked`.
public var cvcCheck: CardValidationCheck?
/// Whether this card is the default external account for its currency.
public var defaultForCurrency: Bool?
Maxim-Inv marked this conversation as resolved.
Show resolved Hide resolved
/// Two-digit number representing the card’s expiration month.
public var expMonth: Int?
/// Four-digit number representing the card’s expiration year.
Expand Down Expand Up @@ -87,6 +89,7 @@ public struct Card: Codable {
addressLine1Check: CardValidationCheck? = nil,
availablePayoutMethods: [String]? = nil,
currency: Currency? = nil,
defaultForCurrency: Bool? = nil,
dynamicLast4: String? = nil,
tokenizationMethod: CardTokenizedMethod? = nil,
wallet: CardWallet? = nil) {
Expand Down Expand Up @@ -114,6 +117,7 @@ public struct Card: Codable {
self.addressLine1Check = addressLine1Check
self.availablePayoutMethods = availablePayoutMethods
self.currency = currency
self.defaultForCurrency = defaultForCurrency
self.dynamicLast4 = dynamicLast4
self.tokenizationMethod = tokenizationMethod
self.wallet = wallet
Expand Down
Loading