diff --git a/CHANGELOG.md b/CHANGELOG.md index b4acd2b1..0e8e6a5c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 13.2.0 - 2021-08-27 +* [#136](https://github.com/vapor-community/stripe-kit/pull/136) + * Added expand parameter for cloning a payment method. + ## 13.1.0 - 2021-08-17 * [#134](https://github.com/vapor-community/stripe-kit/pull/134) * Added support for cloning a payment method. diff --git a/Sources/StripeKit/Payment Methods/PaymentMethods/PaymentMethodRoutes.swift b/Sources/StripeKit/Payment Methods/PaymentMethods/PaymentMethodRoutes.swift index 9f485be1..a026f24a 100644 --- a/Sources/StripeKit/Payment Methods/PaymentMethods/PaymentMethodRoutes.swift +++ b/Sources/StripeKit/Payment Methods/PaymentMethods/PaymentMethodRoutes.swift @@ -64,8 +64,9 @@ public protocol PaymentMethodRoutes { /// - Parameters: /// - paymentMethod: The id of the payment method to clone. /// - customer: The id of trhe customer this payment method beelongs to. You must provide the Customer ID in the request when cloning PaymentMethods that are attached to Customers for security purposes + /// - expand: An array of properties to expand. /// - Returns: A `StripePaymentMethod`. - func clone(paymentMethod: String, customer: String?) -> EventLoopFuture + func clone(paymentMethod: String, customer: String?, expand: [String]?) -> EventLoopFuture /// Retrieves a PaymentMethod object. /// @@ -169,8 +170,8 @@ extension PaymentMethodRoutes { expand: expand) } - public func clone(paymentMethod: String, customer: String? = nil) -> EventLoopFuture { - clone(paymentMethod: paymentMethod, customer: customer) + public func clone(paymentMethod: String, customer: String? = nil, expand: [String]? = nil) -> EventLoopFuture { + clone(paymentMethod: paymentMethod, customer: customer, expand: expand) } public func retrieve(paymentMethod: String, expand: [String]? = nil) -> EventLoopFuture { @@ -325,12 +326,16 @@ public struct StripePaymentMethodRoutes: PaymentMethodRoutes { return apiHandler.send(method: .POST, path: paymentmethods, body: .string(body.queryParameters), headers: headers) } - public func clone(paymentMethod: String, customer: String?) -> EventLoopFuture { + public func clone(paymentMethod: String, customer: String?, expand: [String]?) -> EventLoopFuture { var body: [String: Any] = ["payment_method": paymentMethod] if let customer = customer { body["customer"] = customer } + if let expand = expand { + body["expand"] = expand + } + return apiHandler.send(method: .POST, path: paymentmethods, body: .string(body.queryParameters), headers: headers) }