From 04fd3db13f613fb75cbe89b9f9adedf61d881072 Mon Sep 17 00:00:00 2001 From: Andrew Edwards Date: Sun, 6 Jan 2019 20:59:59 -0600 Subject: [PATCH] Make TOS send epoch time for Date. --- Sources/Stripe/API/Routes/AccountRoutes.swift | 10 +++++++++- Sources/Stripe/Errors/StripeError.swift | 2 -- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Sources/Stripe/API/Routes/AccountRoutes.swift b/Sources/Stripe/API/Routes/AccountRoutes.swift index f494dd6..6e0c2b3 100644 --- a/Sources/Stripe/API/Routes/AccountRoutes.swift +++ b/Sources/Stripe/API/Routes/AccountRoutes.swift @@ -245,7 +245,15 @@ public struct StripeConnectAccountRoutes: AccountRoutes { } if let tos = tosAcceptance { - try tos.toEncodedDictionary().forEach { body["tos_acceptance[\($0)]"] = $1 } + if let tosDate = tos.date { + body["tos_acceptance[date]"] = Int(tosDate.timeIntervalSince1970) + } + if let tosIp = tos.ip { + body["tos_acceptance[ip]"] = tosIp + } + if let tosUserAgent = tos.userAgent { + body["tos_acceptance[user_agent]"] = tosUserAgent + } } return try request.send(method: .POST, path: StripeAPIEndpoint.account.endpoint, body: body.queryParameters) diff --git a/Sources/Stripe/Errors/StripeError.swift b/Sources/Stripe/Errors/StripeError.swift index 0d5667e..d790811 100644 --- a/Sources/Stripe/Errors/StripeError.swift +++ b/Sources/Stripe/Errors/StripeError.swift @@ -215,5 +215,3 @@ public enum StripeDeclineCode: String, StripeModel { case tryAgainLater = "try_again_later" case withdrawalCountLimitExceeded = "withdrawal_count_limit_exceeded" } - -