Skip to content

Commit

Permalink
Merge pull request #32 from vapor-community/2.0.2
Browse files Browse the repository at this point in the history
2.0.2 Minor Fixes
  • Loading branch information
anthonycastelli authored Apr 8, 2018
2 parents 3daee49 + 4eff3bc commit c614801
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
16 changes: 10 additions & 6 deletions Sources/Stripe/API/Routes/SubscriptionRoutes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ public protocol SubscriptionRoutes {
associatedtype L: List
associatedtype DO: DeletedObject

func create(customer: String, applicationFeePercent: Decimal?, billing: String?, billingCycleAnchor: Date?, coupon: String?, daysUntilDue: Int?, items: [String: Any]?, metadata: [String: String]?, source: Any?, taxPercent: Decimal?, trialEnd: Any?, trialPeriodDays: Int?) throws -> Future<SB>
func create(customer: String, applicationFeePercent: Decimal?, billing: String?, billingCycleAnchor: Date?, coupon: String?, daysUntilDue: Int?, items: [[String : Any]]?, metadata: [String: String]?, source: Any?, taxPercent: Decimal?, trialEnd: Any?, trialPeriodDays: Int?) throws -> Future<SB>
func retrieve(id: String) throws -> Future<SB>
func update(subscription: String, applicationFeePercent: Decimal?, billing: String?, billingCycleAnchor: String?, coupon: String?, daysUntilDue: Int?, items: [String: Any]?, metadata: [String: String]?, prorate: Bool?, prorationDate: Date?, source: Any?, taxPercent: Decimal?, trialEnd: Any?) throws -> Future<SB>
func update(subscription: String, applicationFeePercent: Decimal?, billing: String?, billingCycleAnchor: String?, coupon: String?, daysUntilDue: Int?, items: [[String : Any]]?, metadata: [String: String]?, prorate: Bool?, prorationDate: Date?, source: Any?, taxPercent: Decimal?, trialEnd: Any?) throws -> Future<SB>
func cancel(subscription: String, atPeriodEnd: Bool?) throws -> Future<SB>
func listAll(filter: [String: Any]?) throws -> Future<L>
func deleteDiscount(subscription: String) throws -> Future<DO>
Expand All @@ -37,7 +37,7 @@ public struct StripeSubscriptionRoutes: SubscriptionRoutes {
billingCycleAnchor: Date? = nil,
coupon: String? = nil,
daysUntilDue: Int? = nil,
items: [String : Any]? = nil,
items: [[String : Any]]? = nil,
metadata: [String : String]? = nil,
source: Any? = nil,
taxPercent: Decimal? = nil,
Expand Down Expand Up @@ -68,7 +68,9 @@ public struct StripeSubscriptionRoutes: SubscriptionRoutes {
}

if let items = items {
items.forEach { body["items[\($0)]"] = $1 }
for (index, item) in items.enumerated() {
item.forEach { body["items[\(index)][\($0)]"] = $1 }
}
}

if let metadata = metadata {
Expand Down Expand Up @@ -116,7 +118,7 @@ public struct StripeSubscriptionRoutes: SubscriptionRoutes {
billingCycleAnchor: String? = nil,
coupon: String? = nil,
daysUntilDue: Int? = nil,
items: [String : Any]? = nil,
items: [[String : Any]]? = nil,
metadata: [String : String]? = nil,
prorate: Bool? = nil,
prorationDate: Date? = nil,
Expand Down Expand Up @@ -146,7 +148,9 @@ public struct StripeSubscriptionRoutes: SubscriptionRoutes {
}

if let items = items {
items.forEach { body["items[\($0)]"] = $1 }
for (index, item) in items.enumerated() {
item.forEach { body["items[\(index)][\($0)]"] = $1 }
}
}

if let metadata = metadata {
Expand Down
2 changes: 1 addition & 1 deletion Sources/Stripe/Provider/Provider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import Vapor

public struct StripeConfig: Service {
let apiKey: String
public let apiKey: String
public init(apiKey: String) {
self.apiKey = apiKey
}
Expand Down

0 comments on commit c614801

Please sign in to comment.