Skip to content

Commit

Permalink
customer: Switch to a node
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonycastelli committed May 16, 2017
1 parent df172d5 commit fdddc03
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
10 changes: 3 additions & 7 deletions Sources/API/Routes/CustomerRoutes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,9 @@ public final class CustomerRoutes {
body["currency"] = Node(currency.rawValue)
}

if let metadata = customer.metadata {
if let metadata = customer.metadata?.object {
for (key, value) in metadata {
if let value = value {
body["metadata[\(key)]"] = try Node(node: "\(value)")
} else {
body["metadata[\(key)]"] = nil
}
body["metadata[\(key)]"] = value
}
}

Expand Down Expand Up @@ -157,7 +153,7 @@ public final class CustomerRoutes {
body["source"] = Node(defaultSourceId)
}

if let metadata = customer.metadata {
if let metadata = customer.metadata?.object {
for (key, value) in metadata {
body["metadata[\(key)]"] = try Node(node: "\(String(describing: value))")
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/Models/Customer/Customer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public final class Customer: StripeModelProtocol {
public private(set) var delinquent: Bool?
public private(set) var isLive: Bool?

public var metadata: [String : Any?]?
public var metadata: Node?

public var currency: StripeCurrency?
public private(set) var shipping: ShippingLabel?
Expand Down

0 comments on commit fdddc03

Please sign in to comment.