From c42ac4e386dfb3da1001166d88462c0a222cc30d Mon Sep 17 00:00:00 2001 From: Robinson Presotto Date: Thu, 11 Oct 2018 11:09:46 +0200 Subject: [PATCH] invoice: add invoice url model --- Sources/Stripe/Models/Invoices/Invoice.swift | 4 ++++ Tests/StripeTests/InvoiceTests.swift | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/Sources/Stripe/Models/Invoices/Invoice.swift b/Sources/Stripe/Models/Invoices/Invoice.swift index 6f5c92d..97698ac 100644 --- a/Sources/Stripe/Models/Invoices/Invoice.swift +++ b/Sources/Stripe/Models/Invoices/Invoice.swift @@ -31,6 +31,8 @@ public struct StripeInvoice: StripeModel { public var dueDate: Date? public var endingBalance: Int? public var forgiven: Bool? + public var hostedInvoiceUrl: String? + public var invoicePdf: String? public var lines: InvoiceLineGroup? public var livemode: Bool? public var metadata: [String: String] @@ -68,6 +70,8 @@ public struct StripeInvoice: StripeModel { case dueDate = "due_date" case endingBalance = "ending_balance" case forgiven + case hostedInvoiceUrl = "hosted_invoice_url" + case invoicePdf = "invoice_pdf" case lines case livemode case metadata diff --git a/Tests/StripeTests/InvoiceTests.swift b/Tests/StripeTests/InvoiceTests.swift index be35d43..f128a33 100644 --- a/Tests/StripeTests/InvoiceTests.swift +++ b/Tests/StripeTests/InvoiceTests.swift @@ -23,6 +23,8 @@ class InvoiceTests: XCTestCase { "date": 1234567890, "due_date": 1234567890, "forgiven": false, + "hosted_invoice_url": "https://pay.stripe.com/invoice/invst_zw7Gf743ihdarScjrVuMTtctoT", + "invoice_pdf": "https://pay.stripe.com/invoice/invst_zw7Gf743ihdarScjrVuMTtctoT/pdf", "id": "in_1BoJ2NKrZ43eBVAbQ8jb0Xfj", "lines": { "data": [ @@ -88,6 +90,8 @@ class InvoiceTests: XCTestCase { XCTAssertEqual(invoice.date, Date(timeIntervalSince1970: 1234567890)) XCTAssertEqual(invoice.dueDate, Date(timeIntervalSince1970: 1234567890)) XCTAssertEqual(invoice.forgiven, false) + XCTAssertEqual(invoice.hostedInvoiceUrl, "https://pay.stripe.com/invoice/invst_zw7Gf743ihdarScjrVuMTtctoT") + XCTAssertEqual(invoice.invoicePdf, "https://pay.stripe.com/invoice/invst_zw7Gf743ihdarScjrVuMTtctoT/pdf") XCTAssertEqual(invoice.livemode, false) XCTAssertEqual(invoice.nextPaymentAttempt, Date(timeIntervalSince1970: 1234567890)) XCTAssertEqual(invoice.number, "fe61cc956c-0001")