diff --git a/Package.swift b/Package.swift index 21547f6..d3053b7 100644 --- a/Package.swift +++ b/Package.swift @@ -28,10 +28,25 @@ let package = Package( dependencies: ["VeryfiSDK"], resources: [ .copy("Resources/receipt.jpeg"), + .copy("Resources/driver_license.png"), + .copy("Resources/bankstatement.pdf"), + .copy("Resources/w2.png"), .copy("Resources/deleteDocument.json"), .copy("Resources/getDocument.json"), .copy("Resources/getDocuments.json"), .copy("Resources/processDocument.json"), + .copy("Resources/getAnyDocument.json"), + .copy("Resources/getAnyDocuments.json"), + .copy("Resources/processAnyDocument.json"), + .copy("Resources/getBankStatement.json"), + .copy("Resources/getBankStatements.json"), + .copy("Resources/processBankStatement.json"), + .copy("Resources/getW2.json"), + .copy("Resources/getW2s.json"), + .copy("Resources/processW2.json"), + .copy("Resources/addTag.json"), + .copy("Resources/addTags.json"), + .copy("Resources/replaceTags.json"), .copy("Resources/updateDocument.json"), .copy("Resources/addLineItem.json"), .copy("Resources/deleteDocumentLineItems.json"), diff --git a/Sources/VeryfiSDK/Client.swift b/Sources/VeryfiSDK/Client.swift deleted file mode 100644 index 3a2c982..0000000 --- a/Sources/VeryfiSDK/Client.swift +++ /dev/null @@ -1,191 +0,0 @@ -import Foundation -#if canImport(FoundationNetworking) -import FoundationNetworking -#endif - -struct VeryfiCredentials { - let clientId: String - let clientSecret: String - let username: String - let apiKey: String -} - -public class Client: NetworkManager { - - /// Init Client. - /// - Parameters: - /// - clientId: Your client id from veryfi-hub. - /// - clientSecret: Your client secret from veryfi-hub. - /// - username: Your username from veryfi-hub. - /// - apiKey: Your api key from veryfi-hub. - /// - apiVersion: Api version to use, by default "v8". - public init(clientId: String, clientSecret: String, username: String, apiKey: String, apiVersion: String = "v8") { - let credentials = VeryfiCredentials(clientId: clientId, clientSecret: clientSecret, username: username, apiKey: apiKey) - super.init(credentials: credentials, apiVersion: apiVersion) - } - - /// Get all documents from Veryfi inbox. - /// - Parameters: - /// - queryItems: Query items to apply to the get request. - /// - completion: Block executed after request. - /// - detail: Response from server. - /// - error: Error from server. - public func getDocuments(queryItems: [URLQueryItem]? = nil, withCompletion completion: @escaping (Result) -> Void) { - self.request(method: .GET, route: .documents, queryItems: queryItems, completion: completion) - } - - /// Get single document by ID from Veryfi inbox. - /// - Parameters: - /// - documentId: ID of document to retreive - /// - completion: Block executed after request. - /// - detail: Response from server. - /// - error: Error from server. - public func getDocument(documentId: String, withCompletion completion: @escaping (Result) -> Void) { - self.request(method: .GET, route: .documents, queryItem: documentId, completion: completion) - } - - /// Upload an image for the Veryfi API to process. - /// - Parameters: - /// - fileName: Name of the file to upload to the Veryfi API. - /// - fileData: UTF8 encoded file data - /// - categories: List of document categories. - /// - deleteAfterProcessing: Do not store file in Veryfi's inbox. - /// - params: Additional parameters. - /// - completion: Function called after request completes. - /// - detail: Response from server. - /// - error: Error from server. - public func processDocument(fileName: String, - fileData: Data, - categories: [String]? = nil, - deleteAfterProcessing: Bool = false, - params: [String: Any]? = nil, - withCompletion completion: @escaping (Result) -> Void) { - let requestCats = categories ?? [] - var requestParams = params ?? [String: Any]() - requestParams["categories"] = requestCats - requestParams["auto_delete"] = deleteAfterProcessing - requestParams["file_data"] = fileData.base64EncodedString() - requestParams["file_name"] = fileName - - guard let jsonData = try? JSONSerialization.data(withJSONObject: requestParams, options: .prettyPrinted) else { - completion(.failure(.parsingError)) - return - } - - self.request(method: .POST, route: .documents, uploadData: jsonData, completion: completion) - } - - /// Upload document to Veryfi API with URL. - /// - Parameters: - /// - fileUrl: Publicly available URL. - /// - fileUrls: List of publicly available URLs. - /// - categories: List of document categories. - /// - deleteAfterProcessing: Do not store file in Veryfi's inbox. - /// - boostMode: Skip data enrichment but process document faster. - /// - externalId: Existing ID to assign to document. - /// - maxPagesToProcess: Number of pages to process. - /// - completion: Block executed after request. - /// - detail: Response from server. - /// - error: Error from server. - public func processDocumentURL(fileUrl: String? = nil, - fileUrls: [String]? = nil, - categories: [String]? = nil, - deleteAfterProcessing: Bool = false, - boostMode: Int = 0, - externalId: String? = nil, - maxPagesToProcess: Int? = 1, - withCompletion completion: @escaping (Result) -> Void) { - let params: [String: Any] = ["auto_delete": deleteAfterProcessing, - "boost_mode": boostMode, - "categories": categories ?? [], - "external_id": externalId as Any, //implicit coerce - "file_url": fileUrl as Any, //implicit coerce - "file_urls": fileUrls as Any, //implicit coerce - "max_pages_to_process": maxPagesToProcess as Any] //implicit coerce - let jsonData = try? JSONSerialization.data(withJSONObject: params) - self.request(method: .POST, route: .documents, body: jsonData, completion: completion) - } - - /// Update information of document in Veryfi inbox. - /// - Parameters: - /// - documentId: ID of document to modify. - /// - params: Names and values to modify. - /// - completion: A block to execute - /// - detail: Response from server. - /// - error: Error from server. - public func updateDocument(documentId: String, params: [String: Any], withCompletion completion: @escaping (Result) -> Void) { - let jsonData = try? JSONSerialization.data(withJSONObject: params) - self.request(method: .PUT, route: .documents, body: jsonData, queryItem: documentId, completion: completion) - } - - /// Delete document from Veryfi inbox. - /// - Parameters: - /// - documentId: ID of document to delete. - /// - completion: completion description - public func deleteDocument(documentId: String, withCompletion completion: @escaping (Result) -> Void) { - self.request(method: .DELETE, route: .documents, queryItem: documentId, completion: completion) - } - - /// Get all line items from document. - /// - Parameters: - /// - documentId: ID of document to get line items. - /// - completion: Block executed after request. - /// - detail: Response from server. - /// - error: Error from server. - public func getDocumentLineItems(documentId: String, withCompletion completion: @escaping (Result) -> Void) { - self.request(method: .GET, route: .documents, queryItem: String(format: "%@/line-items", documentId), completion: completion) - } - - /// Get single line item by document from Veryfi inbox. - /// - Parameters: - /// - documentId: ID of document. - /// - lineItemId: ID of line item. - /// - completion: Block executed after request. - /// - detail: Response from server. - /// - error: Error from server. - public func getLineItem(documentId: String, lineItemId: String, withCompletion completion: @escaping (Result) -> Void) { - self.request(method: .GET, route: .documents, queryItem: String(format: "%@/line-items/%@", documentId, lineItemId), completion: completion) - } - - /// Create line item for document in Veryfi inbox. - /// - Parameters: - /// - documentId: ID of document to modify. - /// - params: Line item data. - /// - completion: A block to execute - /// - detail: Response from server. - /// - error: Error from server. - public func addLineItem(documentId: String, params: AddLineItem, withCompletion completion: @escaping (Result) -> Void) { - let jsonData = try? JSONSerialization.data(withJSONObject: params.dictionary) - self.request(method: .POST, route: .documents, body: jsonData, queryItem: String(format: "%@/line-items", documentId), completion: completion) - } - - /// Update line item for document in Veryfi inbox. - /// - Parameters: - /// - documentId: ID of document. - /// - lineItemId: ID of line item to modify. - /// - params: Line item data. - /// - completion: A block to execute - /// - detail: Response from server. - /// - error: Error from server. - public func updateLineItem(documentId: String, lineItemId: String, params: UpdateLineItem, withCompletion completion: @escaping (Result) -> Void) { - let jsonData = try? JSONSerialization.data(withJSONObject: params.dictionary) - self.request(method: .PUT, route: .documents, body: jsonData, queryItem: String(format: "%@/line-items/%@", documentId, lineItemId), completion: completion) - } - - /// Delete all line items from document from Veryfi inbox. - /// - Parameters: - /// - documentId: ID of document - /// - completion: completion description - public func deleteDocumentLineItems(documentId: String, withCompletion completion: @escaping (Result) -> Void) { - self.request(method: .DELETE, route: .documents, queryItem: String(format: "%@/line-items", documentId), completion: completion) - } - - /// Delete line item from document from Veryfi inbox. - /// - Parameters: - /// - documentId: ID of document - /// - lineItemId: ID of line item to delete. - /// - completion: completion description - public func deleteLineItem(documentId: String, lineItemId: String, withCompletion completion: @escaping (Result) -> Void) { - self.request(method: .DELETE, route: .documents, queryItem: String(format: "%@/line-items/%@", documentId, lineItemId), completion: completion) - } -} diff --git a/Sources/VeryfiSDK/Client/AddLineItem.swift b/Sources/VeryfiSDK/Client/AddLineItem.swift new file mode 100644 index 0000000..9e18a3a --- /dev/null +++ b/Sources/VeryfiSDK/Client/AddLineItem.swift @@ -0,0 +1,21 @@ +// +// AddLineItem.swift +// VeryfiSDK +// +// Created by Veryfi on 25/10/24. +// +import Foundation + +extension Client { + /// Create line item for document in Veryfi inbox. + /// - Parameters: + /// - documentId: ID of document to modify. + /// - params: Line item data. + /// - completion: A block to execute + /// - detail: Response from server. + /// - error: Error from server. + public func addLineItem(documentId: String, params: AddLineItem, withCompletion completion: @escaping (Result) -> Void) { + let jsonData = try? JSONSerialization.data(withJSONObject: params.dictionary) + self.request(method: .POST, route: .documents, body: jsonData, queryItem: String(format: "%@/line-items", documentId), completion: completion) + } +} diff --git a/Sources/VeryfiSDK/Client/AddTag.swift b/Sources/VeryfiSDK/Client/AddTag.swift new file mode 100644 index 0000000..2121ccc --- /dev/null +++ b/Sources/VeryfiSDK/Client/AddTag.swift @@ -0,0 +1,21 @@ +// +// AddTag.swift +// VeryfiSDK +// +// Created by Veryfi on 25/10/24. +// +import Foundation + +extension Client { + /// Add tag to document. + /// - Parameters: + /// - documentId: ID of document to add tag. + /// - params: Tag data. + /// - completion: Block executed after request. + /// - detail: Response from server. + /// - error: Error from server. + public func addTag(documentId: String, params: AddTag, withCompletion completion: @escaping (Result) -> Void) { + let jsonData = try? JSONSerialization.data(withJSONObject: params.dictionary) + self.request(method: .PUT, route: .documents, body: jsonData, queryItem: String(format: "%@/tags", documentId), completion: completion) + } +} diff --git a/Sources/VeryfiSDK/Client/AddTags.swift b/Sources/VeryfiSDK/Client/AddTags.swift new file mode 100644 index 0000000..d521538 --- /dev/null +++ b/Sources/VeryfiSDK/Client/AddTags.swift @@ -0,0 +1,21 @@ +// +// AddTags.swift +// VeryfiSDK +// +// Created by Veryfi on 25/10/24. +// +import Foundation + +extension Client { + /// Add multiple tags in document. + /// - Parameters: + /// - documentId: ID of document to replace tags. + /// - params: Tags data. + /// - completion: Block executed after request. + /// - detail: Response from server. + /// - error: Error from server. + public func addTags(documentId: String, params: AddTags, withCompletion completion: @escaping (Result) -> Void) { + let jsonData = try? JSONSerialization.data(withJSONObject: params.dictionary) + self.request(method: .POST, route: .documents, body: jsonData, queryItem: String(format: "%@/tags", documentId), completion: completion) + } +} diff --git a/Sources/VeryfiSDK/Client/Client.swift b/Sources/VeryfiSDK/Client/Client.swift new file mode 100644 index 0000000..f0fa3a6 --- /dev/null +++ b/Sources/VeryfiSDK/Client/Client.swift @@ -0,0 +1,26 @@ +import Foundation +#if canImport(FoundationNetworking) +import FoundationNetworking +#endif + +struct VeryfiCredentials { + let clientId: String + let clientSecret: String + let username: String + let apiKey: String +} + +public class Client: NetworkManager { + + /// Init Client. + /// - Parameters: + /// - clientId: Your client id from veryfi-hub. + /// - clientSecret: Your client secret from veryfi-hub. + /// - username: Your username from veryfi-hub. + /// - apiKey: Your api key from veryfi-hub. + /// - apiVersion: Api version to use, by default "v8". + public init(clientId: String, clientSecret: String, username: String, apiKey: String, apiVersion: String = "v8") { + let credentials = VeryfiCredentials(clientId: clientId, clientSecret: clientSecret, username: username, apiKey: apiKey) + super.init(credentials: credentials, apiVersion: apiVersion) + } +} diff --git a/Sources/VeryfiSDK/Client/DeleteDocument.swift b/Sources/VeryfiSDK/Client/DeleteDocument.swift new file mode 100644 index 0000000..9ab57c5 --- /dev/null +++ b/Sources/VeryfiSDK/Client/DeleteDocument.swift @@ -0,0 +1,17 @@ +// +// DeleteDocument.swift +// VeryfiSDK +// +// Created by Veryfi on 25/10/24. +// +import Foundation + +extension Client { + /// Delete document from Veryfi inbox. + /// - Parameters: + /// - documentId: ID of document to delete. + /// - completion: completion description + public func deleteDocument(documentId: String, withCompletion completion: @escaping (Result) -> Void) { + self.request(method: .DELETE, route: .documents, queryItem: documentId, completion: completion) + } +} diff --git a/Sources/VeryfiSDK/Client/DeleteLineItem.swift b/Sources/VeryfiSDK/Client/DeleteLineItem.swift new file mode 100644 index 0000000..9c8425d --- /dev/null +++ b/Sources/VeryfiSDK/Client/DeleteLineItem.swift @@ -0,0 +1,18 @@ +// +// DeleteLineItem.swift +// VeryfiSDK +// +// Created by Veryfi on 25/10/24. +// +import Foundation + +extension Client { + /// Delete line item from document from Veryfi inbox. + /// - Parameters: + /// - documentId: ID of document + /// - lineItemId: ID of line item to delete. + /// - completion: completion description + public func deleteLineItem(documentId: String, lineItemId: String, withCompletion completion: @escaping (Result) -> Void) { + self.request(method: .DELETE, route: .documents, queryItem: String(format: "%@/line-items/%@", documentId, lineItemId), completion: completion) + } +} diff --git a/Sources/VeryfiSDK/Client/DeleteLineItems.swift b/Sources/VeryfiSDK/Client/DeleteLineItems.swift new file mode 100644 index 0000000..06b8556 --- /dev/null +++ b/Sources/VeryfiSDK/Client/DeleteLineItems.swift @@ -0,0 +1,17 @@ +// +// DeleteLineItems.swift +// VeryfiSDK +// +// Created by Veryfi on 25/10/24. +// +import Foundation + +extension Client { + /// Delete all line items from document from Veryfi inbox. + /// - Parameters: + /// - documentId: ID of document + /// - completion: completion description + public func deleteDocumentLineItems(documentId: String, withCompletion completion: @escaping (Result) -> Void) { + self.request(method: .DELETE, route: .documents, queryItem: String(format: "%@/line-items", documentId), completion: completion) + } +} diff --git a/Sources/VeryfiSDK/Client/GetAnyDocument.swift b/Sources/VeryfiSDK/Client/GetAnyDocument.swift new file mode 100644 index 0000000..68ddebb --- /dev/null +++ b/Sources/VeryfiSDK/Client/GetAnyDocument.swift @@ -0,0 +1,19 @@ +// +// GetAnyDocument.swift +// VeryfiSDK +// +// Created by Veryfi on 25/10/24. +// +import Foundation + +extension Client { + /// Get single any document by ID from Veryfi inbox. + /// - Parameters: + /// - documentId: ID of document to retreive + /// - completion: Block executed after request. + /// - detail: Response from server. + /// - error: Error from server. + public func getAnyDocument(documentId: String, withCompletion completion: @escaping (Result) -> Void) { + self.request(method: .GET, route: .anyDocuments, queryItem: documentId, completion: completion) + } +} diff --git a/Sources/VeryfiSDK/Client/GetAnyDocuments.swift b/Sources/VeryfiSDK/Client/GetAnyDocuments.swift new file mode 100644 index 0000000..fd85135 --- /dev/null +++ b/Sources/VeryfiSDK/Client/GetAnyDocuments.swift @@ -0,0 +1,19 @@ +// +// GetAnyDocuments.swift +// VeryfiSDK +// +// Created by Veryfi on 25/10/24. +// +import Foundation + +extension Client { + /// Get all any documents from Veryfi inbox. + /// - Parameters: + /// - queryItems: Query items to apply to the get request. + /// - completion: Block executed after request. + /// - detail: Response from server. + /// - error: Error from server. + public func getAnyDocuments(queryItems: [URLQueryItem]? = nil, withCompletion completion: @escaping (Result) -> Void) { + self.request(method: .GET, route: .anyDocuments, queryItems: queryItems, completion: completion) + } +} diff --git a/Sources/VeryfiSDK/Client/GetBankStatement.swift b/Sources/VeryfiSDK/Client/GetBankStatement.swift new file mode 100644 index 0000000..388c47f --- /dev/null +++ b/Sources/VeryfiSDK/Client/GetBankStatement.swift @@ -0,0 +1,19 @@ +// +// GetBankStatement.swift +// VeryfiSDK +// +// Created by Veryfi on 25/10/24. +// +import Foundation + +extension Client { + /// Get single bank statements by ID from Veryfi inbox. + /// - Parameters: + /// - documentId: ID of document to retreive + /// - completion: Block executed after request. + /// - detail: Response from server. + /// - error: Error from server. + public func getBankStatement(id: String, queryItems: [URLQueryItem]? = nil, withCompletion completion: @escaping (Result) -> Void) { + self.request(method: .GET, route: .bankStatements, queryItems: queryItems, queryItem: id, completion: completion) + } +} diff --git a/Sources/VeryfiSDK/Client/GetBankStatements.swift b/Sources/VeryfiSDK/Client/GetBankStatements.swift new file mode 100644 index 0000000..251c98e --- /dev/null +++ b/Sources/VeryfiSDK/Client/GetBankStatements.swift @@ -0,0 +1,19 @@ +// +// GetBankStatements.swift +// VeryfiSDK +// +// Created by Veryfi on 25/10/24. +// +import Foundation + +extension Client { + /// Get all bank statements from Veryfi inbox. + /// - Parameters: + /// - queryItems: Query items to apply to the get request. + /// - completion: Block executed after request. + /// - detail: Response from server. + /// - error: Error from server. + public func getBankStatements(queryItems: [URLQueryItem]? = nil, withCompletion completion: @escaping (Result) -> Void) { + self.request(method: .GET, route: .bankStatements, queryItems: queryItems, completion: completion) + } +} diff --git a/Sources/VeryfiSDK/Client/GetDocument.swift b/Sources/VeryfiSDK/Client/GetDocument.swift new file mode 100644 index 0000000..fa53d9b --- /dev/null +++ b/Sources/VeryfiSDK/Client/GetDocument.swift @@ -0,0 +1,19 @@ +// +// GetDocument.swift +// VeryfiSDK +// +// Created by Veryfi on 25/10/24. +// +import Foundation + +extension Client { + /// Get single document by ID from Veryfi inbox. + /// - Parameters: + /// - documentId: ID of document to retreive + /// - completion: Block executed after request. + /// - detail: Response from server. + /// - error: Error from server. + public func getDocument(documentId: String, withCompletion completion: @escaping (Result) -> Void) { + self.request(method: .GET, route: .documents, queryItem: documentId, completion: completion) + } +} diff --git a/Sources/VeryfiSDK/Client/GetDocuments.swift b/Sources/VeryfiSDK/Client/GetDocuments.swift new file mode 100644 index 0000000..baf0571 --- /dev/null +++ b/Sources/VeryfiSDK/Client/GetDocuments.swift @@ -0,0 +1,19 @@ +// +// GetDocuments.swift +// VeryfiSDK +// +// Created by Veryfi on 25/10/24. +// +import Foundation + +extension Client { + /// Get all documents from Veryfi inbox. + /// - Parameters: + /// - queryItems: Query items to apply to the get request. + /// - completion: Block executed after request. + /// - detail: Response from server. + /// - error: Error from server. + public func getDocuments(queryItems: [URLQueryItem]? = nil, withCompletion completion: @escaping (Result) -> Void) { + self.request(method: .GET, route: .documents, queryItems: queryItems, completion: completion) + } +} diff --git a/Sources/VeryfiSDK/Client/GetLineItem.swift b/Sources/VeryfiSDK/Client/GetLineItem.swift new file mode 100644 index 0000000..db7570c --- /dev/null +++ b/Sources/VeryfiSDK/Client/GetLineItem.swift @@ -0,0 +1,20 @@ +// +// GetLineItem.swift +// VeryfiSDK +// +// Created by Veryfi on 25/10/24. +// +import Foundation + +extension Client { + /// Get single line item by document from Veryfi inbox. + /// - Parameters: + /// - documentId: ID of document. + /// - lineItemId: ID of line item. + /// - completion: Block executed after request. + /// - detail: Response from server. + /// - error: Error from server. + public func getLineItem(documentId: String, lineItemId: String, withCompletion completion: @escaping (Result) -> Void) { + self.request(method: .GET, route: .documents, queryItem: String(format: "%@/line-items/%@", documentId, lineItemId), completion: completion) + } +} diff --git a/Sources/VeryfiSDK/Client/GetLineItems.swift b/Sources/VeryfiSDK/Client/GetLineItems.swift new file mode 100644 index 0000000..94e67d0 --- /dev/null +++ b/Sources/VeryfiSDK/Client/GetLineItems.swift @@ -0,0 +1,19 @@ +// +// GetLineItems.swift +// VeryfiSDK +// +// Created by Veryfi on 25/10/24. +// +import Foundation + +extension Client { + /// Get all line items from document. + /// - Parameters: + /// - documentId: ID of document to get line items. + /// - completion: Block executed after request. + /// - detail: Response from server. + /// - error: Error from server. + public func getDocumentLineItems(documentId: String, withCompletion completion: @escaping (Result) -> Void) { + self.request(method: .GET, route: .documents, queryItem: String(format: "%@/line-items", documentId), completion: completion) + } +} diff --git a/Sources/VeryfiSDK/Client/GetW2.swift b/Sources/VeryfiSDK/Client/GetW2.swift new file mode 100644 index 0000000..23c4345 --- /dev/null +++ b/Sources/VeryfiSDK/Client/GetW2.swift @@ -0,0 +1,19 @@ +// +// GetW2.swift +// VeryfiSDK +// +// Created by Veryfi on 25/10/24. +// +import Foundation + +extension Client { + /// Get single w2 document by ID from Veryfi inbox. + /// - Parameters: + /// - documentId: ID of document to retreive + /// - completion: Block executed after request. + /// - detail: Response from server. + /// - error: Error from server. + public func getW2(documentId: String, withCompletion completion: @escaping (Result) -> Void) { + self.request(method: .GET, route: .w2s, queryItem: documentId, completion: completion) + } +} diff --git a/Sources/VeryfiSDK/Client/GetW2s.swift b/Sources/VeryfiSDK/Client/GetW2s.swift new file mode 100644 index 0000000..5e27812 --- /dev/null +++ b/Sources/VeryfiSDK/Client/GetW2s.swift @@ -0,0 +1,19 @@ +// +// GetW2s.swift +// VeryfiSDK +// +// Created by Veryfi on 25/10/24. +// +import Foundation + +extension Client { + /// Get all w2 documents from Veryfi inbox. + /// - Parameters: + /// - queryItems: Query items to apply to the get request. + /// - completion: Block executed after request. + /// - detail: Response from server. + /// - error: Error from server. + public func getW2s(queryItems: [URLQueryItem]? = nil, withCompletion completion: @escaping (Result) -> Void) { + self.request(method: .GET, route: .w2s, queryItems: queryItems, completion: completion) + } +} diff --git a/Sources/VeryfiSDK/Client/GetW8BenE.swift b/Sources/VeryfiSDK/Client/GetW8BenE.swift new file mode 100644 index 0000000..42a4aa8 --- /dev/null +++ b/Sources/VeryfiSDK/Client/GetW8BenE.swift @@ -0,0 +1,19 @@ +// +// GetW8BenE.swift +// VeryfiSDK +// +// Created by Veryfi on 25/10/24. +// +import Foundation + +extension Client { + /// Get single w8BenE document by ID from Veryfi inbox. + /// - Parameters: + /// - documentId: ID of document to retreive + /// - completion: Block executed after request. + /// - detail: Response from server. + /// - error: Error from server. + public func getW8BenE(documentId: String, withCompletion completion: @escaping (Result) -> Void) { + self.request(method: .GET, route: .w8BenE, queryItem: documentId, completion: completion) + } +} diff --git a/Sources/VeryfiSDK/Client/GetW8BenEs.swift b/Sources/VeryfiSDK/Client/GetW8BenEs.swift new file mode 100644 index 0000000..62a040a --- /dev/null +++ b/Sources/VeryfiSDK/Client/GetW8BenEs.swift @@ -0,0 +1,19 @@ +// +// GetW8BenEs.swift +// VeryfiSDK +// +// Created by Veryfi on 25/10/24. +// +import Foundation + +extension Client { + /// Get all w8BenE documents from Veryfi inbox. + /// - Parameters: + /// - queryItems: Query items to apply to the get request. + /// - completion: Block executed after request. + /// - detail: Response from server. + /// - error: Error from server. + public func getW8BenEs(queryItems: [URLQueryItem]? = nil, withCompletion completion: @escaping (Result) -> Void) { + self.request(method: .GET, route: .w8BenE, queryItems: queryItems, completion: completion) + } +} diff --git a/Sources/VeryfiSDK/Client/GetW9.swift b/Sources/VeryfiSDK/Client/GetW9.swift new file mode 100644 index 0000000..6b1f4d3 --- /dev/null +++ b/Sources/VeryfiSDK/Client/GetW9.swift @@ -0,0 +1,19 @@ +// +// GetW9.swift +// VeryfiSDK +// +// Created by Veryfi on 25/10/24. +// +import Foundation + +extension Client { + /// Get single w9 document by ID from Veryfi inbox. + /// - Parameters: + /// - documentId: ID of document to retreive + /// - completion: Block executed after request. + /// - detail: Response from server. + /// - error: Error from server. + public func getW9(documentId: String, withCompletion completion: @escaping (Result) -> Void) { + self.request(method: .GET, route: .w9s, queryItem: documentId, completion: completion) + } +} diff --git a/Sources/VeryfiSDK/Client/GetW9s.swift b/Sources/VeryfiSDK/Client/GetW9s.swift new file mode 100644 index 0000000..a7f1864 --- /dev/null +++ b/Sources/VeryfiSDK/Client/GetW9s.swift @@ -0,0 +1,19 @@ +// +// GetW9s.swift +// VeryfiSDK +// +// Created by Veryfi on 25/10/24. +// +import Foundation + +extension Client { + /// Get all w9 documents from Veryfi inbox. + /// - Parameters: + /// - queryItems: Query items to apply to the get request. + /// - completion: Block executed after request. + /// - detail: Response from server. + /// - error: Error from server. + public func getW9s(queryItems: [URLQueryItem]? = nil, withCompletion completion: @escaping (Result) -> Void) { + self.request(method: .GET, route: .w9s, queryItems: queryItems, completion: completion) + } +} diff --git a/Sources/VeryfiSDK/Client/ProcessAnyDocument.swift b/Sources/VeryfiSDK/Client/ProcessAnyDocument.swift new file mode 100644 index 0000000..6c8bb76 --- /dev/null +++ b/Sources/VeryfiSDK/Client/ProcessAnyDocument.swift @@ -0,0 +1,37 @@ +// +// ProcessAnyDocument.swift +// VeryfiSDK +// +// Created by Veryfi on 25/10/24. +// +import Foundation + +extension Client { + /// Upload any document for the Veryfi API to process. + /// - Parameters: + /// - fileName: Name of the file to upload to the Veryfi API. + /// - fileData: UTF8 encoded file data + /// - categories: List of document categories. + /// - deleteAfterProcessing: Do not store file in Veryfi's inbox. + /// - params: Additional parameters. + /// - completion: Function called after request completes. + /// - detail: Response from server. + /// - error: Error from server. + public func processAnyDocument(fileName: String, + fileData: Data, + params: [String: Any]? = nil, + templateName: String, + withCompletion completion: @escaping (Result) -> Void) { + var requestParams = params ?? [String: Any]() + requestParams["file_data"] = fileData.base64EncodedString() + requestParams["file_name"] = fileName + requestParams["template_name"] = templateName + + guard let jsonData = try? JSONSerialization.data(withJSONObject: requestParams, options: .prettyPrinted) else { + completion(.failure(.parsingError)) + return + } + + self.request(method: .POST, route: .anyDocuments, uploadData: jsonData, completion: completion) + } +} diff --git a/Sources/VeryfiSDK/Client/ProcessAnyDocumentUrl.swift b/Sources/VeryfiSDK/Client/ProcessAnyDocumentUrl.swift new file mode 100644 index 0000000..5672370 --- /dev/null +++ b/Sources/VeryfiSDK/Client/ProcessAnyDocumentUrl.swift @@ -0,0 +1,38 @@ +// +// ProcessAnyDocumentUrl.swift +// VeryfiSDK +// +// Created by Veryfi on 25/10/24. +// +import Foundation + +extension Client { + /// Upload any document to Veryfi API with URL. + /// - Parameters: + /// - fileUrl: Publicly available URL. + /// - fileUrls: List of publicly available URLs. + /// - categories: List of document categories. + /// - deleteAfterProcessing: Do not store file in Veryfi's inbox. + /// - boostMode: Skip data enrichment but process document faster. + /// - externalId: Existing ID to assign to document. + /// - maxPagesToProcess: Number of pages to process. + /// - completion: Block executed after request. + /// - detail: Response from server. + /// - error: Error from server. + public func processAnyDocumentURL(fileUrl: String? = nil, + fileUrls: [String]? = nil, + categories: [String]? = nil, + deleteAfterProcessing: Bool = false, + boostMode: Int = 0, + externalId: String? = nil, + maxPagesToProcess: Int? = 1, + templateName: String, + withCompletion completion: @escaping (Result) -> Void) { + let params: [String: Any] = ["file_url": fileUrl as Any, //implicit coerce + "file_urls": fileUrls as Any, //implicit coerce + "template_name": templateName, + "max_pages_to_process": maxPagesToProcess as Any] //implicit coerce + let jsonData = try? JSONSerialization.data(withJSONObject: params) + self.request(method: .POST, route: .anyDocuments, body: jsonData, completion: completion) + } +} diff --git a/Sources/VeryfiSDK/Client/ProcessBankStatement.swift b/Sources/VeryfiSDK/Client/ProcessBankStatement.swift new file mode 100644 index 0000000..2ab3177 --- /dev/null +++ b/Sources/VeryfiSDK/Client/ProcessBankStatement.swift @@ -0,0 +1,36 @@ +// +// ProcessBankStatement.swift +// VeryfiSDK +// +// Created by Veryfi on 25/10/24. +// +import Foundation + +extension Client { + /// Upload a bank statement for the Veryfi API to process. + /// - Parameters: + /// - fileName: Name of the file to upload to the Veryfi API. + /// - fileData: UTF8 encoded file data + /// - confidenceDetails: Confidence details object + /// - params: Additional parameters. + /// - completion: Function called after request completes. + /// - detail: Response from server. + /// - error: Error from server. + public func processBankStatement(fileName: String, + fileData: Data, + params: [String: Any]? = nil, + confidenceDetails: Bool = false, + withCompletion completion: @escaping (Result) -> Void) { + var requestParams = params ?? [String: Any]() + requestParams["confidence_details"] = confidenceDetails + requestParams["file_data"] = fileData.base64EncodedString() + requestParams["file_name"] = fileName + + guard let jsonData = try? JSONSerialization.data(withJSONObject: requestParams, options: .prettyPrinted) else { + completion(.failure(.parsingError)) + return + } + + self.request(method: .POST, route: .bankStatements, uploadData: jsonData, completion: completion) + } +} diff --git a/Sources/VeryfiSDK/Client/ProcessBankStatementUrl.swift b/Sources/VeryfiSDK/Client/ProcessBankStatementUrl.swift new file mode 100644 index 0000000..3e807fb --- /dev/null +++ b/Sources/VeryfiSDK/Client/ProcessBankStatementUrl.swift @@ -0,0 +1,32 @@ +// +// ProcessBankStatementUrl.swift +// VeryfiSDK +// +// Created by Veryfi on 25/10/24. +// +import Foundation + +extension Client { + /// Upload bank statement to Veryfi API with URL. + /// - Parameters: + /// - fileUrl: Publicly available URL. + /// - fileUrls: List of publicly available URLs. + /// - confidenceDetails: Confidence details object + /// - completion: Block executed after request. + /// - detail: Response from server. + /// - error: Error from server. + public func processBankStatementURL(fileUrl: String? = nil, + fileUrls: [String]? = nil, + boundingBoxes: Bool = false, + confidenceDetails: Bool = false, + withCompletion completion: @escaping (Result) -> Void) { + let params: [String: Any] = [ + "bounding_boxes": boundingBoxes, + "confidence_details": confidenceDetails, + "file_url": fileUrl as Any, //implicit coerce + "file_urls": fileUrls as Any, //implicit coerce + ] //implicit coerce + let jsonData = try? JSONSerialization.data(withJSONObject: params) + self.request(method: .POST, route: .bankStatements, body: jsonData, completion: completion) + } +} diff --git a/Sources/VeryfiSDK/Client/ProcessDocument.swift b/Sources/VeryfiSDK/Client/ProcessDocument.swift new file mode 100644 index 0000000..787d51a --- /dev/null +++ b/Sources/VeryfiSDK/Client/ProcessDocument.swift @@ -0,0 +1,40 @@ +// +// ProcessDocument.swift +// VeryfiSDK +// +// Created by Veryfi on 25/10/24. +// +import Foundation + +extension Client { + /// Upload an image for the Veryfi API to process. + /// - Parameters: + /// - fileName: Name of the file to upload to the Veryfi API. + /// - fileData: UTF8 encoded file data + /// - categories: List of document categories. + /// - deleteAfterProcessing: Do not store file in Veryfi's inbox. + /// - params: Additional parameters. + /// - completion: Function called after request completes. + /// - detail: Response from server. + /// - error: Error from server. + public func processDocument(fileName: String, + fileData: Data, + categories: [String]? = nil, + deleteAfterProcessing: Bool = false, + params: [String: Any]? = nil, + withCompletion completion: @escaping (Result) -> Void) { + let requestCats = categories ?? [] + var requestParams = params ?? [String: Any]() + requestParams["categories"] = requestCats + requestParams["auto_delete"] = deleteAfterProcessing + requestParams["file_data"] = fileData.base64EncodedString() + requestParams["file_name"] = fileName + + guard let jsonData = try? JSONSerialization.data(withJSONObject: requestParams, options: .prettyPrinted) else { + completion(.failure(.parsingError)) + return + } + + self.request(method: .POST, route: .documents, uploadData: jsonData, completion: completion) + } +} diff --git a/Sources/VeryfiSDK/Client/ProcessDocumentUrl.swift b/Sources/VeryfiSDK/Client/ProcessDocumentUrl.swift new file mode 100644 index 0000000..e346d5a --- /dev/null +++ b/Sources/VeryfiSDK/Client/ProcessDocumentUrl.swift @@ -0,0 +1,40 @@ +// +// ProcessDocumentUrl.swift +// VeryfiSDK +// +// Created by Veryfi on 25/10/24. +// +import Foundation + +extension Client { + /// Upload document to Veryfi API with URL. + /// - Parameters: + /// - fileUrl: Publicly available URL. + /// - fileUrls: List of publicly available URLs. + /// - categories: List of document categories. + /// - deleteAfterProcessing: Do not store file in Veryfi's inbox. + /// - boostMode: Skip data enrichment but process document faster. + /// - externalId: Existing ID to assign to document. + /// - maxPagesToProcess: Number of pages to process. + /// - completion: Block executed after request. + /// - detail: Response from server. + /// - error: Error from server. + public func processDocumentURL(fileUrl: String? = nil, + fileUrls: [String]? = nil, + categories: [String]? = nil, + deleteAfterProcessing: Bool = false, + boostMode: Int = 0, + externalId: String? = nil, + maxPagesToProcess: Int? = 1, + withCompletion completion: @escaping (Result) -> Void) { + let params: [String: Any] = ["auto_delete": deleteAfterProcessing, + "boost_mode": boostMode, + "categories": categories ?? [], + "external_id": externalId as Any, //implicit coerce + "file_url": fileUrl as Any, //implicit coerce + "file_urls": fileUrls as Any, //implicit coerce + "max_pages_to_process": maxPagesToProcess as Any] //implicit coerce + let jsonData = try? JSONSerialization.data(withJSONObject: params) + self.request(method: .POST, route: .documents, body: jsonData, completion: completion) + } +} diff --git a/Sources/VeryfiSDK/Client/ProcessW2.swift b/Sources/VeryfiSDK/Client/ProcessW2.swift new file mode 100644 index 0000000..7201212 --- /dev/null +++ b/Sources/VeryfiSDK/Client/ProcessW2.swift @@ -0,0 +1,33 @@ +// +// ProcessW2.swift +// VeryfiSDK +// +// Created by Veryfi on 25/10/24. +// +import Foundation + +extension Client { + /// Upload a w2 image for the Veryfi API to process. + /// - Parameters: + /// - fileName: Name of the file to upload to the Veryfi API. + /// - fileData: UTF8 encoded file data + /// - params: Additional parameters. + /// - completion: Function called after request completes. + /// - detail: Response from server. + /// - error: Error from server. + public func processW2(fileName: String, + fileData: Data, + params: [String: Any]? = nil, + withCompletion completion: @escaping (Result) -> Void) { + var requestParams = params ?? [String: Any]() + requestParams["file_data"] = fileData.base64EncodedString() + requestParams["file_name"] = fileName + + guard let jsonData = try? JSONSerialization.data(withJSONObject: requestParams, options: .prettyPrinted) else { + completion(.failure(.parsingError)) + return + } + + self.request(method: .POST, route: .w2s, uploadData: jsonData, completion: completion) + } +} diff --git a/Sources/VeryfiSDK/Client/ProcessW2Url.swift b/Sources/VeryfiSDK/Client/ProcessW2Url.swift new file mode 100644 index 0000000..13fc0c4 --- /dev/null +++ b/Sources/VeryfiSDK/Client/ProcessW2Url.swift @@ -0,0 +1,27 @@ +// +// ProcessW2Url.swift +// VeryfiSDK +// +// Created by Veryfi on 25/10/24. +// +import Foundation + +extension Client { + /// Upload w2 document to Veryfi API with URL. + /// - Parameters: + /// - fileUrl: Publicly available URL. + /// - fileUrls: List of publicly available URLs. + /// - completion: Block executed after request. + /// - detail: Response from server. + /// - error: Error from server. + public func processW2URL(fileUrl: String? = nil, + fileUrls: [String]? = nil, + withCompletion completion: @escaping (Result) -> Void) { + let params: [String: Any] = [ + "file_url": fileUrl as Any, //implicit coerce + "file_urls": fileUrls as Any, //implicit coerce + ] //implicit coerce + let jsonData = try? JSONSerialization.data(withJSONObject: params) + self.request(method: .POST, route: .w2s, body: jsonData, completion: completion) + } +} diff --git a/Sources/VeryfiSDK/Client/ProcessW8BenE.swift b/Sources/VeryfiSDK/Client/ProcessW8BenE.swift new file mode 100644 index 0000000..2bac252 --- /dev/null +++ b/Sources/VeryfiSDK/Client/ProcessW8BenE.swift @@ -0,0 +1,33 @@ +// +// ProcessW8BenE.swift +// VeryfiSDK +// +// Created by Veryfi on 25/10/24. +// +import Foundation + +extension Client { + /// Upload a w8BenE image for the Veryfi API to process. + /// - Parameters: + /// - fileName: Name of the file to upload to the Veryfi API. + /// - fileData: UTF8 encoded file data + /// - params: Additional parameters. + /// - completion: Function called after request completes. + /// - detail: Response from server. + /// - error: Error from server. + public func processW8BenE(fileName: String, + fileData: Data, + params: [String: Any]? = nil, + withCompletion completion: @escaping (Result) -> Void) { + var requestParams = params ?? [String: Any]() + requestParams["file_data"] = fileData.base64EncodedString() + requestParams["file_name"] = fileName + + guard let jsonData = try? JSONSerialization.data(withJSONObject: requestParams, options: .prettyPrinted) else { + completion(.failure(.parsingError)) + return + } + + self.request(method: .POST, route: .w8BenE, uploadData: jsonData, completion: completion) + } +} diff --git a/Sources/VeryfiSDK/Client/ProcessW8BenEUrl.swift b/Sources/VeryfiSDK/Client/ProcessW8BenEUrl.swift new file mode 100644 index 0000000..6ca9736 --- /dev/null +++ b/Sources/VeryfiSDK/Client/ProcessW8BenEUrl.swift @@ -0,0 +1,27 @@ +// +// ProcessW8BenEUrl.swift +// VeryfiSDK +// +// Created by Veryfi on 25/10/24. +// +import Foundation + +extension Client { + /// Upload w8BenE document to Veryfi API with URL. + /// - Parameters: + /// - fileUrl: Publicly available URL. + /// - fileUrls: List of publicly available URLs. + /// - completion: Block executed after request. + /// - detail: Response from server. + /// - error: Error from server. + public func processW8BenEURL(fileUrl: String? = nil, + fileUrls: [String]? = nil, + withCompletion completion: @escaping (Result) -> Void) { + let params: [String: Any] = [ + "file_url": fileUrl as Any, //implicit coerce + "file_urls": fileUrls as Any, //implicit coerce + ] //implicit coerce + let jsonData = try? JSONSerialization.data(withJSONObject: params) + self.request(method: .POST, route: .w8BenE, body: jsonData, completion: completion) + } +} diff --git a/Sources/VeryfiSDK/Client/ProcessW9.swift b/Sources/VeryfiSDK/Client/ProcessW9.swift new file mode 100644 index 0000000..f84b6d5 --- /dev/null +++ b/Sources/VeryfiSDK/Client/ProcessW9.swift @@ -0,0 +1,33 @@ +// +// ProcessW9.swift +// VeryfiSDK +// +// Created by Veryfi on 25/10/24. +// +import Foundation + +extension Client { + /// Upload a w9 image for the Veryfi API to process. + /// - Parameters: + /// - fileName: Name of the file to upload to the Veryfi API. + /// - fileData: UTF8 encoded file data + /// - params: Additional parameters. + /// - completion: Function called after request completes. + /// - detail: Response from server. + /// - error: Error from server. + public func processW9(fileName: String, + fileData: Data, + params: [String: Any]? = nil, + withCompletion completion: @escaping (Result) -> Void) { + var requestParams = params ?? [String: Any]() + requestParams["file_data"] = fileData.base64EncodedString() + requestParams["file_name"] = fileName + + guard let jsonData = try? JSONSerialization.data(withJSONObject: requestParams, options: .prettyPrinted) else { + completion(.failure(.parsingError)) + return + } + + self.request(method: .POST, route: .w9s, uploadData: jsonData, completion: completion) + } +} diff --git a/Sources/VeryfiSDK/Client/ProcessW9Url.swift b/Sources/VeryfiSDK/Client/ProcessW9Url.swift new file mode 100644 index 0000000..8080c1e --- /dev/null +++ b/Sources/VeryfiSDK/Client/ProcessW9Url.swift @@ -0,0 +1,27 @@ +// +// ProcessW9Url.swift +// VeryfiSDK +// +// Created by Veryfi on 25/10/24. +// +import Foundation + +extension Client { + /// Upload w9 document to Veryfi API with URL. + /// - Parameters: + /// - fileUrl: Publicly available URL. + /// - fileUrls: List of publicly available URLs. + /// - completion: Block executed after request. + /// - detail: Response from server. + /// - error: Error from server. + public func processW9URL(fileUrl: String? = nil, + fileUrls: [String]? = nil, + withCompletion completion: @escaping (Result) -> Void) { + let params: [String: Any] = [ + "file_url": fileUrl as Any, //implicit coerce + "file_urls": fileUrls as Any, //implicit coerce + ] //implicit coerce + let jsonData = try? JSONSerialization.data(withJSONObject: params) + self.request(method: .POST, route: .w9s, body: jsonData, completion: completion) + } +} diff --git a/Sources/VeryfiSDK/Client/ReplaceTags.swift b/Sources/VeryfiSDK/Client/ReplaceTags.swift new file mode 100644 index 0000000..3897f64 --- /dev/null +++ b/Sources/VeryfiSDK/Client/ReplaceTags.swift @@ -0,0 +1,21 @@ +// +// ReplaceTags.swift +// VeryfiSDK +// +// Created by Veryfi on 25/10/24. +// +import Foundation + +extension Client { + /// Replace tags in document. + /// - Parameters: + /// - documentId: ID of document to add tag. + /// - params: New tags to replace. + /// - completion: Block executed after request. + /// - detail: Response from server. + /// - error: Error from server. + public func replaceTags(documentId: String, params: [String], withCompletion completion: @escaping (Result) -> Void) { + let jsonData = try? JSONSerialization.data(withJSONObject: ["tags": params]) + self.request(method: .PUT, route: .documents, body: jsonData, queryItem: documentId, completion: completion) + } +} diff --git a/Sources/VeryfiSDK/Client/UpdateDocument.swift b/Sources/VeryfiSDK/Client/UpdateDocument.swift new file mode 100644 index 0000000..0748700 --- /dev/null +++ b/Sources/VeryfiSDK/Client/UpdateDocument.swift @@ -0,0 +1,21 @@ +// +// UpdateDocument.swift +// VeryfiSDK +// +// Created by Veryfi on 25/10/24. +// +import Foundation + +extension Client { + /// Update information of document in Veryfi inbox. + /// - Parameters: + /// - documentId: ID of document to modify. + /// - params: Names and values to modify. + /// - completion: A block to execute + /// - detail: Response from server. + /// - error: Error from server. + public func updateDocument(documentId: String, params: [String: Any], withCompletion completion: @escaping (Result) -> Void) { + let jsonData = try? JSONSerialization.data(withJSONObject: params) + self.request(method: .PUT, route: .documents, body: jsonData, queryItem: documentId, completion: completion) + } +} diff --git a/Sources/VeryfiSDK/Client/UpdateLineItem.swift b/Sources/VeryfiSDK/Client/UpdateLineItem.swift new file mode 100644 index 0000000..2468254 --- /dev/null +++ b/Sources/VeryfiSDK/Client/UpdateLineItem.swift @@ -0,0 +1,22 @@ +// +// UpdateLineItem.swift +// VeryfiSDK +// +// Created by Veryfi on 25/10/24. +// +import Foundation + +extension Client { + /// Update line item for document in Veryfi inbox. + /// - Parameters: + /// - documentId: ID of document. + /// - lineItemId: ID of line item to modify. + /// - params: Line item data. + /// - completion: A block to execute + /// - detail: Response from server. + /// - error: Error from server. + public func updateLineItem(documentId: String, lineItemId: String, params: UpdateLineItem, withCompletion completion: @escaping (Result) -> Void) { + let jsonData = try? JSONSerialization.data(withJSONObject: params.dictionary) + self.request(method: .PUT, route: .documents, body: jsonData, queryItem: String(format: "%@/line-items/%@", documentId, lineItemId), completion: completion) + } +} diff --git a/Sources/VeryfiSDK/Models/AddLineItem.swift b/Sources/VeryfiSDK/Models/AddLineItemModel.swift similarity index 100% rename from Sources/VeryfiSDK/Models/AddLineItem.swift rename to Sources/VeryfiSDK/Models/AddLineItemModel.swift diff --git a/Sources/VeryfiSDK/Models/AddTagModel.swift b/Sources/VeryfiSDK/Models/AddTagModel.swift new file mode 100644 index 0000000..9f0c1bd --- /dev/null +++ b/Sources/VeryfiSDK/Models/AddTagModel.swift @@ -0,0 +1,15 @@ +// +// File.swift +// +// +// Created by Veryfi on 28/09/24. +// + +import Foundation + +public class AddTag: Encodable { + var name: String + init(name: String) { + self.name = name + } +} diff --git a/Sources/VeryfiSDK/Models/AddTagsModel.swift b/Sources/VeryfiSDK/Models/AddTagsModel.swift new file mode 100644 index 0000000..ba91d17 --- /dev/null +++ b/Sources/VeryfiSDK/Models/AddTagsModel.swift @@ -0,0 +1,15 @@ +// +// File.swift +// +// +// Created by Veryfi on 28/09/24. +// + +import Foundation + +public class AddTags: Encodable { + var tags: [String] + init(tags: [String]) { + self.tags = tags + } +} diff --git a/Sources/VeryfiSDK/Models/LineItem.swift b/Sources/VeryfiSDK/Models/LineItemModel.swift similarity index 100% rename from Sources/VeryfiSDK/Models/LineItem.swift rename to Sources/VeryfiSDK/Models/LineItemModel.swift diff --git a/Sources/VeryfiSDK/Models/UpdateLineItem.swift b/Sources/VeryfiSDK/Models/UpdateLineItemModel.swift similarity index 100% rename from Sources/VeryfiSDK/Models/UpdateLineItem.swift rename to Sources/VeryfiSDK/Models/UpdateLineItemModel.swift diff --git a/Sources/VeryfiSDK/NetworkManager.swift b/Sources/VeryfiSDK/NetworkManager.swift index 094c5b3..5e952e4 100644 --- a/Sources/VeryfiSDK/NetworkManager.swift +++ b/Sources/VeryfiSDK/NetworkManager.swift @@ -18,6 +18,11 @@ enum Method: String { enum Endpoint: String { case documents = "/partner/documents/" + case anyDocuments = "/partner/any-documents/" + case bankStatements = "/partner/bank-statements/" + case w2s = "/partner/w2s/" + case w9s = "/partner/w9s/" + case w8BenE = "/partner/w-8ben-e/" } public class NetworkManager { diff --git a/Tests/Main.swift b/Tests/Main.swift index 8a0e842..f208076 100644 --- a/Tests/Main.swift +++ b/Tests/Main.swift @@ -12,8 +12,22 @@ extension VeryfiSDKTests { ("testGetDocuments", testGetDocuments), ("testGetDocument", testGetDocument), ("testProcessDocument", testProcessDocument), - ("testUpdateDocument", testUpdateDocument), ("testProcessDocumentURL", testProcessDocumentURL), + ("testGetAnyDocuments", testGetAnyDocuments), + ("testGetAnyDocument", testGetAnyDocument), + ("testProcessAnyDocument", testProcessAnyDocument), + ("testProcessAnyDocumentURL", testProcessAnyDocumentURL), + ("testGetBankStatements", testGetBankStatements), + ("testGetBankStatement", testGetBankStatement), + ("testProcessBankStatement" testProcessBankStatement), + ("testProcessBankStatementURL", testProcessBankStatementURL), + ("testGetW2s", testGetW2s), + ("testGetW2", testGetW2), + ("testProcessW2", testProcessW2), + ("testProcessW2URL", testProcessW2URL), + ("testAddTag", testAddTag), + ("testAddTags", testAddTags), + ("testUpdateDocument", testUpdateDocument), ("testDeleteDocument", testDeleteDocument), ("testGetDocumentLineItems", testGetDocumentLineItems) ("testGetLineItem", testGetLineItem) diff --git a/Tests/VeryfiSDKTests/AddLineItemTest.swift b/Tests/VeryfiSDKTests/AddLineItemTest.swift new file mode 100644 index 0000000..f9eb57d --- /dev/null +++ b/Tests/VeryfiSDKTests/AddLineItemTest.swift @@ -0,0 +1,36 @@ +import XCTest +#if canImport(FoundationNetworking) +import FoundationNetworking +#endif +@testable import VeryfiSDK + +extension VeryfiSDKTests { + func testAddLineItem() { + if (mockResponses) { + client = ClientSpy(clientId: clientId, clientSecret: clientSecret, username: username, apiKey: apiKey, resource: "addLineItem") + } + + let expectation = XCTestExpectation(description: "Add line item to document") + let documentId = 63480993 + let params = AddLineItem(order: 20, description: "Test", total: 44.0) + params.sku = "testsku" + client.addLineItem(documentId: String(documentId), params: params, withCompletion: { result in + switch result { + case .success(let data): + let jsonResponse = try? JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary + if mockResponses { + XCTAssertGreaterThanOrEqual(jsonResponse!.count, 2) + } else { + XCTAssertEqual(jsonResponse!["total"] as? Float, params.total) + XCTAssertEqual(jsonResponse!["description"] as? String, params.description) + } + case .failure(let error): + print(error) + XCTFail() + } + expectation.fulfill() + }) + + wait(for: [expectation], timeout: 20.0) + } +} diff --git a/Tests/VeryfiSDKTests/AddTagTest.swift b/Tests/VeryfiSDKTests/AddTagTest.swift new file mode 100644 index 0000000..3f2322f --- /dev/null +++ b/Tests/VeryfiSDKTests/AddTagTest.swift @@ -0,0 +1,29 @@ +import XCTest +#if canImport(FoundationNetworking) +import FoundationNetworking +#endif +@testable import VeryfiSDK + +extension VeryfiSDKTests { + func testAddTag() { + if (mockResponses) { + client = ClientSpy(clientId: clientId, clientSecret: clientSecret, username: username, apiKey: apiKey, resource: "addTag") + } + + let expectation = XCTestExpectation(description: "Get a JSON response from add tag") + + client.addTag(documentId: "31727276", params: AddTag(name: "test_tag"), withCompletion: { result in + switch result { + case .success(let data): + let jsonResponse = try? JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary + XCTAssertTrue((jsonResponse?["name"] as? String)?.lowercased() == "test_tag") + case .failure(let error): + print(error) + XCTFail() + } + expectation.fulfill() + }) + + wait(for: [expectation], timeout: 20.0) + } +} diff --git a/Tests/VeryfiSDKTests/AddTagsTest.swift b/Tests/VeryfiSDKTests/AddTagsTest.swift new file mode 100644 index 0000000..8f6734c --- /dev/null +++ b/Tests/VeryfiSDKTests/AddTagsTest.swift @@ -0,0 +1,30 @@ +import XCTest +#if canImport(FoundationNetworking) +import FoundationNetworking +#endif +@testable import VeryfiSDK + +extension VeryfiSDKTests { + func testAddTags() { + if (mockResponses) { + client = ClientSpy(clientId: clientId, clientSecret: clientSecret, username: username, apiKey: apiKey, resource: "addTags") + } + + let expectation = XCTestExpectation(description: "Get a JSON response from add tags") + + client.addTags(documentId: "31727276", params: AddTags(tags: ["tag_1", "tag_2"]), withCompletion: { result in + switch result { + case .success(let data): + let jsonResponse = try? JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary + let results = jsonResponse?["tags"] as? [[String: Any]] + XCTAssertEqual(results?.count ?? 0, 2) + case .failure(let error): + print(error) + XCTFail() + } + expectation.fulfill() + }) + + wait(for: [expectation], timeout: 20.0) + } +} diff --git a/Tests/VeryfiSDKTests/BadCredentialsTest.swift b/Tests/VeryfiSDKTests/BadCredentialsTest.swift new file mode 100644 index 0000000..fa2c9a6 --- /dev/null +++ b/Tests/VeryfiSDKTests/BadCredentialsTest.swift @@ -0,0 +1,29 @@ +import XCTest +#if canImport(FoundationNetworking) +import FoundationNetworking +#endif +@testable import VeryfiSDK + +extension VeryfiSDKTests { + func testBadCredentials() { + let expectation = XCTestExpectation(description: "Get response to a bad credential case") + let badClient = Client(clientId: "badClientId", clientSecret: "badClientSecret", username: "badUsername", apiKey: "badApiKey") + badClient.getDocuments(withCompletion: { result in + switch result{ + case .success(let data): + let jsonResponse = try? JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary + guard let status = jsonResponse?["status"] as? String, let message = jsonResponse?["message"] as? String else { + XCTFail() + return + } + XCTAssertEqual("fail", status) + XCTAssertEqual("Not Authorized", message) + case .failure(let error): + print(error) + } + expectation.fulfill() + }) + + wait(for: [expectation], timeout: 20.0) + } +} diff --git a/Tests/VeryfiSDKTests/DeleteDocumentTest.swift b/Tests/VeryfiSDKTests/DeleteDocumentTest.swift new file mode 100644 index 0000000..5b6162a --- /dev/null +++ b/Tests/VeryfiSDKTests/DeleteDocumentTest.swift @@ -0,0 +1,64 @@ +import XCTest +#if canImport(FoundationNetworking) +import FoundationNetworking +#endif +@testable import VeryfiSDK + +extension VeryfiSDKTests { + func testDeleteDocument() { + let expectationDocuments = XCTestExpectation(description: "Get documents") + let expectationDelete = XCTestExpectation(description: "Get a JSON response from deleted document") + + if (mockResponses) { + client = ClientSpy(clientId: clientId, clientSecret: clientSecret, username: username, apiKey: apiKey, resource: "deleteDocument") + let documentId = 31727276 + expectationDocuments.fulfill() + client.deleteDocument(documentId: String(documentId), withCompletion: { result in + switch result { + case .success(let data): + let jsonStringDeleteResponse = try? JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary + guard let status = jsonStringDeleteResponse?["status"] as? String else { + XCTFail() + return + } + XCTAssertEqual("ok", status) + case .failure(let error): + print(error) + XCTAssertTrue(false) + } + expectationDelete.fulfill() + }) + } else { + client.processDocumentURL(fileUrl: url, withCompletion: { result in + switch result { + case .success(let data): + let jsonResponse = try? JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary + guard let documentId = jsonResponse?["id"] as? Int64 else { + XCTFail() + return + } + client.deleteDocument(documentId: String(documentId), withCompletion: { result in + switch result { + case .success(let data): + let jsonStringDeleteResponse = try? JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary + guard let status = jsonStringDeleteResponse?["status"] as? String else { + XCTFail() + return + } + XCTAssertEqual("ok", status) + case .failure(let error): + print(error) + XCTAssertTrue(false) + } + expectationDelete.fulfill() + }) + case .failure(let error): + print(error) + } + expectationDocuments.fulfill() + }) + } + + wait(for: [expectationDocuments, expectationDelete], timeout: 40.0) + } +} diff --git a/Tests/VeryfiSDKTests/DeleteLineItemTest.swift b/Tests/VeryfiSDKTests/DeleteLineItemTest.swift new file mode 100644 index 0000000..7657e45 --- /dev/null +++ b/Tests/VeryfiSDKTests/DeleteLineItemTest.swift @@ -0,0 +1,68 @@ +import XCTest +#if canImport(FoundationNetworking) +import FoundationNetworking +#endif +@testable import VeryfiSDK + +extension VeryfiSDKTests { + func testDeleteLineItem() { + let expectationDocuments = XCTestExpectation(description: "Get documents") + let expectationDelete = XCTestExpectation(description: "Get a JSON response from deleted document") + + if (mockResponses) { + client = ClientSpy(clientId: clientId, clientSecret: clientSecret, username: username, apiKey: apiKey, resource: "deleteLineItem") + let documentId = 63480993 + let lineItemId = 190399931 + expectationDocuments.fulfill() + client.deleteLineItem(documentId: String(documentId), lineItemId: String(lineItemId), withCompletion: { result in + switch result { + case .success(let data): + let jsonStringDeleteResponse = try? JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary + guard let status = jsonStringDeleteResponse?["status"] as? String else { + XCTFail() + return + } + XCTAssertEqual("ok", status) + case .failure(let error): + print(error) + XCTAssertTrue(false) + } + expectationDelete.fulfill() + }) + } else { + let documentId = 63480993 + let params = AddLineItem(order: 20, description: "Test", total: 44.4) + params.sku = "testsku" + client.addLineItem(documentId: String(documentId), params: params, withCompletion: { result in + switch result { + case .success(let data): + let jsonResponse = try? JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary + guard let lineItemId = jsonResponse?["id"] as? Int64 else { + XCTFail() + return + } + client.deleteLineItem(documentId: String(documentId), lineItemId: String(lineItemId), withCompletion: { result in + switch result { + case .success(let data): + let jsonStringDeleteResponse = try? JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary + guard let status = jsonStringDeleteResponse?["status"] as? String else { + XCTFail() + return + } + XCTAssertEqual("ok", status) + case .failure(let error): + print(error) + XCTAssertTrue(false) + } + expectationDelete.fulfill() + }) + case .failure(let error): + print(error) + } + expectationDocuments.fulfill() + }) + } + + wait(for: [expectationDocuments, expectationDelete], timeout: 40.0) + } +} diff --git a/Tests/VeryfiSDKTests/DeleteLineItemsTest.swift b/Tests/VeryfiSDKTests/DeleteLineItemsTest.swift new file mode 100644 index 0000000..9a011cb --- /dev/null +++ b/Tests/VeryfiSDKTests/DeleteLineItemsTest.swift @@ -0,0 +1,64 @@ +import XCTest +#if canImport(FoundationNetworking) +import FoundationNetworking +#endif +@testable import VeryfiSDK + +extension VeryfiSDKTests { + func testDeleteDocumentLineItems() { + let expectationDocuments = XCTestExpectation(description: "Get documents") + let expectationDelete = XCTestExpectation(description: "Get a JSON response from deleted document") + + if (mockResponses) { + client = ClientSpy(clientId: clientId, clientSecret: clientSecret, username: username, apiKey: apiKey, resource: "deleteDocumentLineItems") + let documentId = 63480993 + expectationDocuments.fulfill() + client.deleteDocumentLineItems(documentId: String(documentId), withCompletion: { result in + switch result { + case .success(let data): + let jsonStringDeleteResponse = try? JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary + guard let status = jsonStringDeleteResponse?["status"] as? String else { + XCTFail() + return + } + XCTAssertEqual("ok", status) + case .failure(let error): + print(error) + XCTAssertTrue(false) + } + expectationDelete.fulfill() + }) + } else { + client.processDocumentURL(fileUrl: url, withCompletion: { result in + switch result { + case .success(let data): + let jsonResponse = try? JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary + guard let documentId = jsonResponse?["id"] as? Int64 else { + XCTFail() + return + } + client.deleteDocumentLineItems(documentId: String(documentId), withCompletion: { result in + switch result { + case .success(let data): + let jsonStringDeleteResponse = try? JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary + guard let status = jsonStringDeleteResponse?["status"] as? String else { + XCTFail() + return + } + XCTAssertEqual("ok", status) + case .failure(let error): + print(error) + XCTAssertTrue(false) + } + expectationDelete.fulfill() + }) + case .failure(let error): + print(error) + } + expectationDocuments.fulfill() + }) + } + + wait(for: [expectationDocuments, expectationDelete], timeout: 40.0) + } +} diff --git a/Tests/VeryfiSDKTests/GetAnyDocumentTest.swift b/Tests/VeryfiSDKTests/GetAnyDocumentTest.swift new file mode 100644 index 0000000..882ee76 --- /dev/null +++ b/Tests/VeryfiSDKTests/GetAnyDocumentTest.swift @@ -0,0 +1,62 @@ +import XCTest +#if canImport(FoundationNetworking) +import FoundationNetworking +#endif +@testable import VeryfiSDK + +extension VeryfiSDKTests { + func testGetAnyDocument() { + let expectation = XCTestExpectation(description: "Get a any document by id in a JSON") + + if (mockResponses) { + client = ClientSpy(clientId: clientId, clientSecret: clientSecret, username: username, apiKey: apiKey, resource: "getAnyDocument") + let id = Int64(4560114) + client.getAnyDocument(documentId: String(id), withCompletion: { result in + switch result { + case .success(let data): + let jsonResponse = try? JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary + guard let getDocumentId = jsonResponse?["id"] as? Int64 else { + XCTFail() + return + } + XCTAssertEqual(getDocumentId, id) + case .failure(let error): + print(error) + XCTAssertTrue(false) + } + expectation.fulfill() + }) + } else { + client.getAnyDocuments(withCompletion: { result in + switch result { + case .success(let data): + let jsonDocuments = try? JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary + guard let id = ((jsonDocuments?["results"] as? NSArray)?[0] as? NSDictionary)?["id"] as? Int64 else { + XCTFail() + return + } + client.getAnyDocument(documentId: String(id), withCompletion: { result in + switch result { + case .success(let data): + let jsonResponse = try? JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary + guard let getDocumentId = jsonResponse?["id"] as? Int64 else { + XCTFail() + return + } + XCTAssertEqual(getDocumentId, id) + case .failure(let error): + print(error) + XCTAssertTrue(false) + } + }) + case .failure(let error): + print(error) + XCTAssertTrue(false) + } + expectation.fulfill() + }) + } + + wait(for: [expectation], timeout: 40.0) + } +} diff --git a/Tests/VeryfiSDKTests/GetAnyDocumentsTest.swift b/Tests/VeryfiSDKTests/GetAnyDocumentsTest.swift new file mode 100644 index 0000000..54f2ecd --- /dev/null +++ b/Tests/VeryfiSDKTests/GetAnyDocumentsTest.swift @@ -0,0 +1,31 @@ +import XCTest +#if canImport(FoundationNetworking) +import FoundationNetworking +#endif +@testable import VeryfiSDK + +extension VeryfiSDKTests { + func testGetAnyDocuments() { + if (mockResponses) { + client = ClientSpy(clientId: clientId, clientSecret: clientSecret, username: username, apiKey: apiKey, resource: "getAnyDocuments") + } + + let expectation = XCTestExpectation(description: "Get all any documents in a JSON array") + + client.getAnyDocuments(withCompletion: { result in + switch result { + case .success(let data): + let jsonResponse = try? JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary + let results = jsonResponse?["results"] as? [[String: Any]] + XCTAssertGreaterThanOrEqual(results?.count ?? 0, 2) + XCTAssertTrue(results?.first?["template_name"] as? String == "us_driver_license") + case .failure(let error): + print(error) + XCTAssertTrue(false) + } + expectation.fulfill() + }) + + wait(for: [expectation], timeout: 20.0) + } +} diff --git a/Tests/VeryfiSDKTests/GetBankStatementTest.swift b/Tests/VeryfiSDKTests/GetBankStatementTest.swift new file mode 100644 index 0000000..ab0e3dc --- /dev/null +++ b/Tests/VeryfiSDKTests/GetBankStatementTest.swift @@ -0,0 +1,62 @@ +import XCTest +#if canImport(FoundationNetworking) +import FoundationNetworking +#endif +@testable import VeryfiSDK + +extension VeryfiSDKTests { + func testGetBankStatement() { + let expectation = XCTestExpectation(description: "Get a bank statement by id in a JSON") + + if (mockResponses) { + client = ClientSpy(clientId: clientId, clientSecret: clientSecret, username: username, apiKey: apiKey, resource: "getBankStatement") + let id = Int64(4560116) + client.getBankStatement(id: String(id), withCompletion: { result in + switch result { + case .success(let data): + let jsonResponse = try? JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary + guard let getDocumentId = jsonResponse?["id"] as? Int64 else { + XCTFail() + return + } + XCTAssertEqual(getDocumentId, id) + case .failure(let error): + print(error) + XCTAssertTrue(false) + } + expectation.fulfill() + }) + } else { + client.getBankStatements(withCompletion: { result in + switch result { + case .success(let data): + let jsonDocuments = try? JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary + guard let id = ((jsonDocuments?["results"] as? NSArray)?[0] as? NSDictionary)?["id"] as? Int64 else { + XCTFail() + return + } + client.getBankStatement(id: String(id), withCompletion: { result in + switch result { + case .success(let data): + let jsonResponse = try? JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary + guard let getDocumentId = jsonResponse?["id"] as? Int64 else { + XCTFail() + return + } + XCTAssertEqual(getDocumentId, id) + case .failure(let error): + print(error) + XCTAssertTrue(false) + } + }) + case .failure(let error): + print(error) + XCTAssertTrue(false) + } + expectation.fulfill() + }) + } + + wait(for: [expectation], timeout: 40.0) + } +} diff --git a/Tests/VeryfiSDKTests/GetBankStatementsTest.swift b/Tests/VeryfiSDKTests/GetBankStatementsTest.swift new file mode 100644 index 0000000..4e7b472 --- /dev/null +++ b/Tests/VeryfiSDKTests/GetBankStatementsTest.swift @@ -0,0 +1,32 @@ +import XCTest +#if canImport(FoundationNetworking) +import FoundationNetworking +#endif +@testable import VeryfiSDK + +extension VeryfiSDKTests { + func testGetBankStatements() { + if (mockResponses) { + client = ClientSpy(clientId: clientId, clientSecret: clientSecret, username: username, apiKey: apiKey, resource: "getBankStatements") + } + + let expectation = XCTestExpectation(description: "Get all bank statements in a JSON array") + + client.getBankStatements(withCompletion: { result in + switch result { + case .success(let data): + let jsonResponse = try? JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary + let results = jsonResponse?["results"] as? [[String: Any]] + XCTAssertGreaterThanOrEqual(results?.count ?? 0, 2) + XCTAssertTrue(results?.first?["bank_vat_number"] as? String == "SC327000") + XCTAssertGreaterThanOrEqual(jsonResponse!.count, 2) + case .failure(let error): + print(error) + XCTAssertTrue(false) + } + expectation.fulfill() + }) + + wait(for: [expectation], timeout: 20.0) + } +} diff --git a/Tests/VeryfiSDKTests/GetDocumentTest.swift b/Tests/VeryfiSDKTests/GetDocumentTest.swift new file mode 100644 index 0000000..56495f2 --- /dev/null +++ b/Tests/VeryfiSDKTests/GetDocumentTest.swift @@ -0,0 +1,62 @@ +import XCTest +#if canImport(FoundationNetworking) +import FoundationNetworking +#endif +@testable import VeryfiSDK + +extension VeryfiSDKTests { + func testGetDocument() { + let expectation = XCTestExpectation(description: "Get a document by id in a JSON") + + if (mockResponses) { + client = ClientSpy(clientId: clientId, clientSecret: clientSecret, username: username, apiKey: apiKey, resource: "getDocument") + let id = Int64(31727276) + client.getDocument(documentId: String(id), withCompletion: { result in + switch result { + case .success(let data): + let jsonResponse = try? JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary + guard let getDocumentId = jsonResponse?["id"] as? Int64 else { + XCTFail() + return + } + XCTAssertEqual(getDocumentId, id) + case .failure(let error): + print(error) + XCTAssertTrue(false) + } + expectation.fulfill() + }) + } else { + client.getDocuments(queryItems: [URLQueryItem(name: "page_size", value: "1")], withCompletion: { result in + switch result { + case .success(let data): + let jsonDocuments = try? JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary + guard let id = ((jsonDocuments?["documents"] as? NSArray)?[0] as? NSDictionary)?["id"] as? Int64 else { + XCTFail() + return + } + client.getDocument(documentId: String(id), withCompletion: { result in + switch result { + case .success(let data): + let jsonResponse = try? JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary + guard let getDocumentId = jsonResponse?["id"] as? Int64 else { + XCTFail() + return + } + XCTAssertEqual(getDocumentId, id) + case .failure(let error): + print(error) + XCTAssertTrue(false) + } + }) + case .failure(let error): + print(error) + XCTAssertTrue(false) + } + expectation.fulfill() + }) + } + + wait(for: [expectation], timeout: 40.0) + } +} diff --git a/Tests/VeryfiSDKTests/GetDocumentWithQueryItemsTest.swift b/Tests/VeryfiSDKTests/GetDocumentWithQueryItemsTest.swift new file mode 100644 index 0000000..ea25605 --- /dev/null +++ b/Tests/VeryfiSDKTests/GetDocumentWithQueryItemsTest.swift @@ -0,0 +1,29 @@ +import XCTest +#if canImport(FoundationNetworking) +import FoundationNetworking +#endif +@testable import VeryfiSDK + +extension VeryfiSDKTests { + func testGetDocumentWithQueryItems() { + if (mockResponses) { + client = ClientSpy(clientId: clientId, clientSecret: clientSecret, username: username, apiKey: apiKey, resource: "getDocuments") + } + + let expectation = XCTestExpectation(description: "Get all documents in a JSON array") + let queryItems = [URLQueryItem(name: "order_by", value: "created")] + client.getDocuments(queryItems: queryItems, withCompletion: { result in + switch result { + case .success(let data): + let jsonResponse = try? JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary + XCTAssertGreaterThanOrEqual(jsonResponse!.count, 2) + case .failure(let error): + print(error) + XCTAssertTrue(false) + } + expectation.fulfill() + }) + + wait(for: [expectation], timeout: 20.0) + } +} diff --git a/Tests/VeryfiSDKTests/GetDocumentsTest.swift b/Tests/VeryfiSDKTests/GetDocumentsTest.swift new file mode 100644 index 0000000..1e33efc --- /dev/null +++ b/Tests/VeryfiSDKTests/GetDocumentsTest.swift @@ -0,0 +1,29 @@ +import XCTest +#if canImport(FoundationNetworking) +import FoundationNetworking +#endif +@testable import VeryfiSDK + +extension VeryfiSDKTests { + func testGetDocuments() { + if (mockResponses) { + client = ClientSpy(clientId: clientId, clientSecret: clientSecret, username: username, apiKey: apiKey, resource: "getDocuments") + } + + let expectation = XCTestExpectation(description: "Get all documents in a JSON array") + + client.getDocuments(withCompletion: { result in + switch result { + case .success(let data): + let jsonResponse = try? JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary + XCTAssertGreaterThanOrEqual(jsonResponse!.count, 2) + case .failure(let error): + print(error) + XCTAssertTrue(false) + } + expectation.fulfill() + }) + + wait(for: [expectation], timeout: 120.0) + } +} diff --git a/Tests/VeryfiSDKTests/GetLineItemTest.swift b/Tests/VeryfiSDKTests/GetLineItemTest.swift new file mode 100644 index 0000000..3785697 --- /dev/null +++ b/Tests/VeryfiSDKTests/GetLineItemTest.swift @@ -0,0 +1,30 @@ +import XCTest +#if canImport(FoundationNetworking) +import FoundationNetworking +#endif +@testable import VeryfiSDK + +extension VeryfiSDKTests { + func testGetLineItem() { + if (mockResponses) { + client = ClientSpy(clientId: clientId, clientSecret: clientSecret, username: username, apiKey: apiKey, resource: "getLineItem") + } + + let expectation = XCTestExpectation(description: "Get line item from document") + let documentId = 63480993 + let lineItemId = 190399931 + client.getLineItem(documentId: String(documentId), lineItemId: String(lineItemId), withCompletion: { result in + switch result { + case .success(let data): + let jsonResponse = try? JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary + XCTAssertGreaterThanOrEqual(jsonResponse!.count, 2) + case .failure(let error): + print(error) + XCTAssertTrue(false) + } + expectation.fulfill() + }) + + wait(for: [expectation], timeout: 20.0) + } +} diff --git a/Tests/VeryfiSDKTests/GetLineItemsTest.swift b/Tests/VeryfiSDKTests/GetLineItemsTest.swift new file mode 100644 index 0000000..3dcb8ef --- /dev/null +++ b/Tests/VeryfiSDKTests/GetLineItemsTest.swift @@ -0,0 +1,29 @@ +import XCTest +#if canImport(FoundationNetworking) +import FoundationNetworking +#endif +@testable import VeryfiSDK + +extension VeryfiSDKTests { + func testGetDocumentLineItems() { + if (mockResponses) { + client = ClientSpy(clientId: clientId, clientSecret: clientSecret, username: username, apiKey: apiKey, resource: "getDocumentLineItems") + } + + let expectation = XCTestExpectation(description: "Get all line items from document") + let documentId = 63480993 + client.getDocumentLineItems(documentId: String(documentId), withCompletion: { result in + switch result { + case .success(let data): + let jsonResponse = try? JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary + XCTAssertNotNil(jsonResponse!["line_items"]) + case .failure(let error): + print(error) + XCTAssertTrue(false) + } + expectation.fulfill() + }) + + wait(for: [expectation], timeout: 20.0) + } +} diff --git a/Tests/VeryfiSDKTests/GetW2Test.swift b/Tests/VeryfiSDKTests/GetW2Test.swift new file mode 100644 index 0000000..b7130cc --- /dev/null +++ b/Tests/VeryfiSDKTests/GetW2Test.swift @@ -0,0 +1,62 @@ +import XCTest +#if canImport(FoundationNetworking) +import FoundationNetworking +#endif +@testable import VeryfiSDK + +extension VeryfiSDKTests { + func testGetW2() { + let expectation = XCTestExpectation(description: "Get a w2 document by id in a JSON") + + if (mockResponses) { + client = ClientSpy(clientId: clientId, clientSecret: clientSecret, username: username, apiKey: apiKey, resource: "getW2") + let id = Int64(4609400) + client.getW2(documentId: String(id), withCompletion: { result in + switch result { + case .success(let data): + let jsonResponse = try? JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary + guard let getDocumentId = jsonResponse?["id"] as? Int64 else { + XCTFail() + return + } + XCTAssertEqual(getDocumentId, id) + case .failure(let error): + print(error) + XCTAssertTrue(false) + } + expectation.fulfill() + }) + } else { + client.getW2s(queryItems: [URLQueryItem(name: "page_size", value: "1")], withCompletion: { result in + switch result { + case .success(let data): + let jsonDocuments = try? JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary + guard let id = ((jsonDocuments?["results"] as? NSArray)?[0] as? NSDictionary)?["id"] as? Int64 else { + XCTFail() + return + } + client.getW2(documentId: String(id), withCompletion: { result in + switch result { + case .success(let data): + let jsonResponse = try? JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary + guard let getDocumentId = jsonResponse?["id"] as? Int64 else { + XCTFail() + return + } + XCTAssertEqual(getDocumentId, id) + case .failure(let error): + print(error) + XCTAssertTrue(false) + } + }) + case .failure(let error): + print(error) + XCTAssertTrue(false) + } + expectation.fulfill() + }) + } + + wait(for: [expectation], timeout: 40.0) + } +} diff --git a/Tests/VeryfiSDKTests/GetW2sTest.swift b/Tests/VeryfiSDKTests/GetW2sTest.swift new file mode 100644 index 0000000..893f48a --- /dev/null +++ b/Tests/VeryfiSDKTests/GetW2sTest.swift @@ -0,0 +1,29 @@ +import XCTest +#if canImport(FoundationNetworking) +import FoundationNetworking +#endif +@testable import VeryfiSDK + +extension VeryfiSDKTests { + func testGetW2s() { + if (mockResponses) { + client = ClientSpy(clientId: clientId, clientSecret: clientSecret, username: username, apiKey: apiKey, resource: "getW2s") + } + + let expectation = XCTestExpectation(description: "Get all w2 documents in a JSON array") + + client.getW2s(withCompletion: { result in + switch result { + case .success(let data): + let jsonResponse = try? JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary + XCTAssertGreaterThanOrEqual(jsonResponse!.count, 2) + case .failure(let error): + print(error) + XCTAssertTrue(false) + } + expectation.fulfill() + }) + + wait(for: [expectation], timeout: 120.0) + } +} diff --git a/Tests/VeryfiSDKTests/ProcessAnyDocumentTest.swift b/Tests/VeryfiSDKTests/ProcessAnyDocumentTest.swift new file mode 100644 index 0000000..c78f3d3 --- /dev/null +++ b/Tests/VeryfiSDKTests/ProcessAnyDocumentTest.swift @@ -0,0 +1,31 @@ +import XCTest +#if canImport(FoundationNetworking) +import FoundationNetworking +#endif +@testable import VeryfiSDK + +extension VeryfiSDKTests { + func testProcessAnyDocument() { + if (mockResponses) { + client = ClientSpy(clientId: clientId, clientSecret: clientSecret, username: username, apiKey: apiKey, resource: "processAnyDocument") + } + + let expectation = XCTestExpectation(description: "Get data from processing any document") + + let url = Bundle.module.url(forResource: "driver_license", withExtension: "png")! + let fileData = try! Data(contentsOf: url) + client.processAnyDocument(fileName: "driver_license.png", fileData: fileData, templateName: "us_driver_license", withCompletion: { result in + switch result { + case .success(let data): + let jsonResponse = try? JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary + XCTAssertTrue(jsonResponse?["last_name"] as? String == "McLovin") + case .failure(let error): + print(error) + XCTFail() + } + expectation.fulfill() + }) + + wait(for: [expectation], timeout: 60.0) + } +} diff --git a/Tests/VeryfiSDKTests/ProcessAnyDocumentUrlTest.swift b/Tests/VeryfiSDKTests/ProcessAnyDocumentUrlTest.swift new file mode 100644 index 0000000..7bd329d --- /dev/null +++ b/Tests/VeryfiSDKTests/ProcessAnyDocumentUrlTest.swift @@ -0,0 +1,29 @@ +import XCTest +#if canImport(FoundationNetworking) +import FoundationNetworking +#endif +@testable import VeryfiSDK + +extension VeryfiSDKTests { + func testProcessAnyDocumentURL() { + if (mockResponses) { + client = ClientSpy(clientId: clientId, clientSecret: clientSecret, username: username, apiKey: apiKey, resource: "processAnyDocument") + } + + let expectation = XCTestExpectation(description: "Get a JSON response from process any document") + + client.processAnyDocumentURL(fileUrl: driverLicenseUrl, templateName: "us_driver_license", withCompletion: { result in + switch result { + case .success(let data): + let jsonResponse = try? JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary + XCTAssertTrue(jsonResponse?["last_name"] as? String == "McLovin") + case .failure(let error): + print(error) + XCTFail() + } + expectation.fulfill() + }) + + wait(for: [expectation], timeout: 20.0) + } +} diff --git a/Tests/VeryfiSDKTests/ProcessBankStatementTest.swift b/Tests/VeryfiSDKTests/ProcessBankStatementTest.swift new file mode 100644 index 0000000..0bd98d5 --- /dev/null +++ b/Tests/VeryfiSDKTests/ProcessBankStatementTest.swift @@ -0,0 +1,31 @@ +import XCTest +#if canImport(FoundationNetworking) +import FoundationNetworking +#endif +@testable import VeryfiSDK + +extension VeryfiSDKTests { + func testProcessBankStatement() { + if (mockResponses) { + client = ClientSpy(clientId: clientId, clientSecret: clientSecret, username: username, apiKey: apiKey, resource: "processBankStatement") + } + + let expectation = XCTestExpectation(description: "Get data from processing bank statement") + + let url = Bundle.module.url(forResource: "bankstatement", withExtension: "pdf")! + let fileData = try? Data(contentsOf: url) + client.processBankStatement(fileName: "bankstatement.pdf", fileData: fileData!, withCompletion: { result in + switch result { + case .success(let data): + let jsonResponse = try? JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary + XCTAssertTrue(jsonResponse?["account_holder_name"] as? String == "Mr Robot Roboto") + case .failure(let error): + print(error) + XCTFail() + } + expectation.fulfill() + }) + + wait(for: [expectation], timeout: 60.0) + } +} diff --git a/Tests/VeryfiSDKTests/ProcessBankStatementUrlTest.swift b/Tests/VeryfiSDKTests/ProcessBankStatementUrlTest.swift new file mode 100644 index 0000000..5be5025 --- /dev/null +++ b/Tests/VeryfiSDKTests/ProcessBankStatementUrlTest.swift @@ -0,0 +1,29 @@ +import XCTest +#if canImport(FoundationNetworking) +import FoundationNetworking +#endif +@testable import VeryfiSDK + +extension VeryfiSDKTests { + func testProcessBankStatementURL() { + if (mockResponses) { + client = ClientSpy(clientId: clientId, clientSecret: clientSecret, username: username, apiKey: apiKey, resource: "processBankStatement") + } + + let expectation = XCTestExpectation(description: "Get a JSON response from process bank statement") + + client.processBankStatementURL(fileUrl: bankStatementUrl, withCompletion: { result in + switch result { + case .success(let data): + let jsonResponse = try? JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary + XCTAssertTrue(jsonResponse?["account_holder_name"] as? String == "Mr Robot Roboto") + case .failure(let error): + print(error) + XCTFail() + } + expectation.fulfill() + }) + + wait(for: [expectation], timeout: 20.0) + } +} diff --git a/Tests/VeryfiSDKTests/ProcessDocumentTest.swift b/Tests/VeryfiSDKTests/ProcessDocumentTest.swift new file mode 100644 index 0000000..17851eb --- /dev/null +++ b/Tests/VeryfiSDKTests/ProcessDocumentTest.swift @@ -0,0 +1,36 @@ +import XCTest +#if canImport(FoundationNetworking) +import FoundationNetworking +#endif +@testable import VeryfiSDK + +extension VeryfiSDKTests { + func testProcessDocument() { + if (mockResponses) { + client = ClientSpy(clientId: clientId, clientSecret: clientSecret, username: username, apiKey: apiKey, resource: "processDocument") + } + + let expectation = XCTestExpectation(description: "Get data from processing document") + + let url = Bundle.module.url(forResource: "receipt", withExtension: "jpeg")! + let fileData = try? Data(contentsOf: url) + let categories = ["Advertising & Marketing", "Automotive"] + client.processDocument(fileName: file, fileData: fileData!, categories: categories, deleteAfterProcessing: true, withCompletion: { result in + switch result { + case .success(let data): + let jsonResponse = try? JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary + guard let vendor = (jsonResponse?["vendor"] as? NSDictionary)?["name"] as? String else { + XCTFail() + break + } + XCTAssertEqual("Walgreens", vendor) + case .failure(let error): + print(error) + XCTFail() + } + expectation.fulfill() + }) + + wait(for: [expectation], timeout: 60.0) + } +} diff --git a/Tests/VeryfiSDKTests/ProcessDocumentUrlTest.swift b/Tests/VeryfiSDKTests/ProcessDocumentUrlTest.swift new file mode 100644 index 0000000..c116bc3 --- /dev/null +++ b/Tests/VeryfiSDKTests/ProcessDocumentUrlTest.swift @@ -0,0 +1,34 @@ +import XCTest +#if canImport(FoundationNetworking) +import FoundationNetworking +#endif +@testable import VeryfiSDK + +extension VeryfiSDKTests { + func testProcessDocumentURL() { + if (mockResponses) { + client = ClientSpy(clientId: clientId, clientSecret: clientSecret, username: username, apiKey: apiKey, resource: "processDocument") + } + + let expectation = XCTestExpectation(description: "Get a JSON response from process document") + + let categories = ["Advertising & Marketing", "Automotive"] + client.processDocumentURL(fileUrl: url, categories: categories, deleteAfterProcessing: true, boostMode: 1, withCompletion: { result in + switch result { + case .success(let data): + let jsonResponse = try? JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary + guard let vendor = (jsonResponse?["vendor"] as? NSDictionary)?["name"] as? String else { + XCTFail() + break + } + XCTAssertEqual("Walgreens", vendor) + case .failure(let error): + print(error) + XCTFail() + } + expectation.fulfill() + }) + + wait(for: [expectation], timeout: 20.0) + } +} diff --git a/Tests/VeryfiSDKTests/ProcessW2Test.swift b/Tests/VeryfiSDKTests/ProcessW2Test.swift new file mode 100644 index 0000000..6aedc77 --- /dev/null +++ b/Tests/VeryfiSDKTests/ProcessW2Test.swift @@ -0,0 +1,36 @@ +import XCTest +#if canImport(FoundationNetworking) +import FoundationNetworking +#endif +@testable import VeryfiSDK + +extension VeryfiSDKTests { + func testProcessW2() { + if (mockResponses) { + client = ClientSpy(clientId: clientId, clientSecret: clientSecret, username: username, apiKey: apiKey, resource: "processW2") + } + + let expectation = XCTestExpectation(description: "Get data from processing a w2 document") + + let url = Bundle.module.url(forResource: "w2", withExtension: "png")! + let fileData = try? Data(contentsOf: url) + client.processW2(fileName: file, fileData: fileData!, withCompletion: { result in + switch result { + case .success(let data): + let jsonResponse = try? JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary + guard let employerName = jsonResponse?["employer_name"] as? String else { + XCTFail() + break + } + + XCTAssertEqual("The Big Company", employerName) + case .failure(let error): + print(error) + XCTFail() + } + expectation.fulfill() + }) + + wait(for: [expectation], timeout: 60.0) + } +} diff --git a/Tests/VeryfiSDKTests/ProcessW2UrlTest.swift b/Tests/VeryfiSDKTests/ProcessW2UrlTest.swift new file mode 100644 index 0000000..d1e5421 --- /dev/null +++ b/Tests/VeryfiSDKTests/ProcessW2UrlTest.swift @@ -0,0 +1,34 @@ +import XCTest +#if canImport(FoundationNetworking) +import FoundationNetworking +#endif +@testable import VeryfiSDK + +extension VeryfiSDKTests { + func testProcessW2URL() { + if (mockResponses) { + client = ClientSpy(clientId: clientId, clientSecret: clientSecret, username: username, apiKey: apiKey, resource: "processW2") + } + + let expectation = XCTestExpectation(description: "Get a JSON response from process a w2 document") + + client.processW2URL(fileUrl: w2Url, withCompletion: { result in + switch result { + case .success(let data): + let jsonResponse = try? JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary + guard let employerName = jsonResponse?["employer_name"] as? String else { + XCTFail() + break + } + + XCTAssertEqual("The Big Company", employerName) + case .failure(let error): + print(error) + XCTFail() + } + expectation.fulfill() + }) + + wait(for: [expectation], timeout: 20.0) + } +} diff --git a/Tests/VeryfiSDKTests/ReplaceTagsTest.swift b/Tests/VeryfiSDKTests/ReplaceTagsTest.swift new file mode 100644 index 0000000..33503a9 --- /dev/null +++ b/Tests/VeryfiSDKTests/ReplaceTagsTest.swift @@ -0,0 +1,30 @@ +import XCTest +#if canImport(FoundationNetworking) +import FoundationNetworking +#endif +@testable import VeryfiSDK + +extension VeryfiSDKTests { + func testReplaceTags() { + if (mockResponses) { + client = ClientSpy(clientId: clientId, clientSecret: clientSecret, username: username, apiKey: apiKey, resource: "replaceTags") + } + + let expectation = XCTestExpectation(description: "Get a JSON response from replace tags") + + client.replaceTags(documentId: "253736946", params: ["replace_tag"], withCompletion: { result in + switch result { + case .success(let data): + let jsonResponse = try? JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary + let tags = jsonResponse?["tags"] as? [[String: Any]] + XCTAssertTrue((tags?.first?["name"] as? String)?.lowercased() == "replace_tag") + case .failure(let error): + print(error) + XCTFail() + } + expectation.fulfill() + }) + + wait(for: [expectation], timeout: 20.0) + } +} diff --git a/Tests/VeryfiSDKTests/Resources/addTag.json b/Tests/VeryfiSDKTests/Resources/addTag.json new file mode 100644 index 0000000..6b44730 --- /dev/null +++ b/Tests/VeryfiSDKTests/Resources/addTag.json @@ -0,0 +1,4 @@ +{ + "id": 6673475, + "name": "TEST_TAG" +} diff --git a/Tests/VeryfiSDKTests/Resources/addTags.json b/Tests/VeryfiSDKTests/Resources/addTags.json new file mode 100644 index 0000000..e3cca59 --- /dev/null +++ b/Tests/VeryfiSDKTests/Resources/addTags.json @@ -0,0 +1,12 @@ +{ + "tags": [ + { + "id": 6862358, + "name": "TAG_1" + }, + { + "id": 6862359, + "name": "TAG_2" + } + ] +} diff --git a/Tests/VeryfiSDKTests/Resources/bankstatement.pdf b/Tests/VeryfiSDKTests/Resources/bankstatement.pdf new file mode 100644 index 0000000..17a2896 Binary files /dev/null and b/Tests/VeryfiSDKTests/Resources/bankstatement.pdf differ diff --git a/Tests/VeryfiSDKTests/Resources/driver_license.png b/Tests/VeryfiSDKTests/Resources/driver_license.png new file mode 100644 index 0000000..260deed Binary files /dev/null and b/Tests/VeryfiSDKTests/Resources/driver_license.png differ diff --git a/Tests/VeryfiSDKTests/Resources/getAnyDocument.json b/Tests/VeryfiSDKTests/Resources/getAnyDocument.json new file mode 100644 index 0000000..afde2d4 --- /dev/null +++ b/Tests/VeryfiSDKTests/Resources/getAnyDocument.json @@ -0,0 +1,23 @@ +{ + "pdf_url": "https://scdn.veryfi.com/other-documents/919ba4778c039560/b010fad9-3b75-4f74-b93e-8fb1af636e78/f0f5244e-6bcd-43d6-8e78-f3b7a2c01bfe.pdf?Expires=1727834317&Signature=XFxyS9P~6ASOkU32PxRAgdYj86oAmGBToQ283yxTaenBKzjZMhwshGauxR6YbWdCw-elTAPBs6Kt~mEWF7BVVBFbFymvztwchsgCQX4bDQxwusv2xJaqMX1A8y-0ALTQ2tt-i7zBKZi4BCkQ35VYyhUf4jVnZaXQOxPfrKh-l0iG5XJHusbdnbZugIAipKeVSA7bYVKIH21Ss0Ebl0axeF0vd3gaV9SymRq7KNEgAFoEioxHDysKMS~TZl7QVkD8eI2NXWlXgq6iZ1Vl5Az80Qyd4CYQEf4c-d2P2RpuSfp5TEz5PXGzPVZ97Karserai8OKzzQl2khlYen26NAsMQ__&Key-Pair-Id=APKAJCILBXEJFZF4DCHQ", + "id": 4560114, + "external_id": null, + "created_date": "2024-09-24 20:35:01", + "updated_date": "2024-09-24 20:35:01", + "img_thumbnail_url": "https://scdn.veryfi.com/other-documents/919ba4778c039560/b010fad9-3b75-4f74-b93e-8fb1af636e78/thumbnail.png?Expires=1727834317&Signature=MKXx~vhDHbU5QWVb5q9qqeMNPtC-LdVVOr43Np7eJ1vDY~BHQZLz6m6qmkh~z80ii90EV2mQq17R13hfI8AySQ~WrpN-Ho4XI9KJpZ-PH5Vbmdi0mZ~Ii1yR-jJJ02JpTu4TQZlYVFs8DeXI2Yrr8X6Rsic9WsWBSOKnpTyyXDakZYgd2-ON4dG88NN4FvKiwGdVTn0O5XtA2pff1tvbI8Z7h3cYPRZ5dEYtrdut~ezpX798GFYD1dMe2a~9DtCj6hWHAB1ZAW253c2asBi0HuAaWNy1J8G02-gnqNc5hwBHZ0E3ze7Q0ewtJR0lZ5JieWYfco6Hjek70QCL6x4teQ__&Key-Pair-Id=APKAJCILBXEJFZF4DCHQ", + "blueprint_name": "us_driver_license", + "template_name": "us_driver_license", + "address": "892 MOMONA ST HONOLULU, HI 96820", + "birth_date": "1981-06-03", + "expiration_date": "2008-06-03", + "eyes_color": "BRO", + "first_name": null, + "height": "5-10", + "issue_date": "1998-06-18", + "last_name": "McLovin", + "license_class": "3", + "license_number": "01-47-87441", + "sex": "M", + "state": "HAWAII", + "weight": "150" +} diff --git a/Tests/VeryfiSDKTests/Resources/getAnyDocuments.json b/Tests/VeryfiSDKTests/Resources/getAnyDocuments.json new file mode 100644 index 0000000..93ec08b --- /dev/null +++ b/Tests/VeryfiSDKTests/Resources/getAnyDocuments.json @@ -0,0 +1,237 @@ +{ + "count": 82, + "next": "", + "previous": "", + "results": [ + { + "pdf_url": "https://scdn.veryfi.com/other-documents/919ba4778c039560/b010fad9-3b75-4f74-b93e-8fb1af636e78/f0f5244e-6bcd-43d6-8e78-f3b7a2c01bfe.pdf?Expires=1727834317&Signature=XFxyS9P~6ASOkU32PxRAgdYj86oAmGBToQ283yxTaenBKzjZMhwshGauxR6YbWdCw-elTAPBs6Kt~mEWF7BVVBFbFymvztwchsgCQX4bDQxwusv2xJaqMX1A8y-0ALTQ2tt-i7zBKZi4BCkQ35VYyhUf4jVnZaXQOxPfrKh-l0iG5XJHusbdnbZugIAipKeVSA7bYVKIH21Ss0Ebl0axeF0vd3gaV9SymRq7KNEgAFoEioxHDysKMS~TZl7QVkD8eI2NXWlXgq6iZ1Vl5Az80Qyd4CYQEf4c-d2P2RpuSfp5TEz5PXGzPVZ97Karserai8OKzzQl2khlYen26NAsMQ__&Key-Pair-Id=APKAJCILBXEJFZF4DCHQ", + "id": 4560114, + "external_id": null, + "created_date": "2024-09-24 20:35:01", + "updated_date": "2024-09-24 20:35:01", + "img_thumbnail_url": "https://scdn.veryfi.com/other-documents/919ba4778c039560/b010fad9-3b75-4f74-b93e-8fb1af636e78/thumbnail.png?Expires=1727834317&Signature=MKXx~vhDHbU5QWVb5q9qqeMNPtC-LdVVOr43Np7eJ1vDY~BHQZLz6m6qmkh~z80ii90EV2mQq17R13hfI8AySQ~WrpN-Ho4XI9KJpZ-PH5Vbmdi0mZ~Ii1yR-jJJ02JpTu4TQZlYVFs8DeXI2Yrr8X6Rsic9WsWBSOKnpTyyXDakZYgd2-ON4dG88NN4FvKiwGdVTn0O5XtA2pff1tvbI8Z7h3cYPRZ5dEYtrdut~ezpX798GFYD1dMe2a~9DtCj6hWHAB1ZAW253c2asBi0HuAaWNy1J8G02-gnqNc5hwBHZ0E3ze7Q0ewtJR0lZ5JieWYfco6Hjek70QCL6x4teQ__&Key-Pair-Id=APKAJCILBXEJFZF4DCHQ", + "blueprint_name": "us_driver_license", + "template_name": "us_driver_license", + "address": "892 MOMONA ST HONOLULU, HI 96820", + "birth_date": "1981-06-03", + "expiration_date": "2008-06-03", + "eyes_color": "BRO", + "first_name": null, + "height": "5-10", + "issue_date": "1998-06-18", + "last_name": "McLovin", + "license_class": "3", + "license_number": "01-47-87441", + "sex": "M", + "state": "HAWAII", + "weight": "150" + }, + { + "pdf_url": "https://scdn.veryfi.com/other-documents/919ba4778c039560/cf1363b8-a38f-47e8-b9ee-8105342121cd/7179c430-eb38-4251-b015-9ceb20129371.pdf?Expires=1727834317&Signature=blFSw1rrEsNnmFM1uPKnRr~7UmfRyRAfZpuY4I6siISj7ugh9zhXGC8IALJ~oH4H1Qerv9N4YTMjTjV29s~1yS6M-YJ85cFK0zMknoc7R2YAHzido1vww4c77aQSKittIl-tHpTM3fX4Nv~44eY8kUne62qpwfiFtKEI1L42lgBYKAEvQPe2lKU5~m5S-Q1FBAWozOw05zPDtgHXDryuv3vNT-qrBIizPYi2IUImIuOsxzzMQjXaTFW4w4gBBane9k-8V1qN~FIEoyJtequGEEHd7foPCoyLtarEC-bHFbWikhwhwjJ3KWDAKgl4tqStbjoGrpYHhOkDqzOm3zBQHw__&Key-Pair-Id=APKAJCILBXEJFZF4DCHQ", + "id": 4559535, + "external_id": null, + "created_date": "2024-09-24 18:31:48", + "updated_date": "2024-09-24 18:31:48", + "img_thumbnail_url": "https://scdn.veryfi.com/other-documents/919ba4778c039560/cf1363b8-a38f-47e8-b9ee-8105342121cd/thumbnail.png?Expires=1727834317&Signature=KCc5mCiCw4NTGmoJDwVJnDRiCm-PkBcoccU-nexGNjVfaswklGyRwx1nrA~RFy60MJDTnw5xvP2t1kxlRR~bHVohyQ4a4r8kXf-P4sd4Aw7nuOSvSi2x9YiDM~cMEBVwLGcUEgIJhnL0hP2FYJO5Ii~FwDgA3p1dfO--0WzO7yD~gwAaTBrBFQYf3JC2FJKaLkFPZHgWE7Q~nfwgBSzATUX6oywjjFPI2Od7v6mZGNrc0~szZcYOaoyTTPrmnUWbgAHAutUdA~2a87Uf7afghsqbRMDvcpf66RDjsi8HAijnNpZq2cQD0dwv0QVj8RwmRRLcbW5iE48C~u~Rk4V~FQ__&Key-Pair-Id=APKAJCILBXEJFZF4DCHQ", + "blueprint_name": "us_driver_license", + "template_name": "us_driver_license", + "address": "892 MOMONA ST HONOLULU, HI 96820", + "birth_date": "1981-06-03", + "expiration_date": "2008-06-03", + "eyes_color": "BRO", + "first_name": null, + "height": "5-10", + "issue_date": "1998-06-18", + "last_name": "McLovin", + "license_class": "3", + "license_number": "01-47-87441", + "sex": "M", + "state": "HAWAII", + "weight": "150" + }, + { + "pdf_url": "https://scdn.veryfi.com/other-documents/919ba4778c039560/11ccb43f-493d-47f0-8a81-a06c59036bf3/e1df79ec-2847-4b5d-b4c4-b2b83b152644.pdf?Expires=1727834317&Signature=T9h1R7puDBRpdKca0P0FJIsWIJqFPH1lPlJQhC8efyz32ZrfLI4uGI~rPSSj-EYXYb-oqN5i-wZoDaTEdQVwK4SZniGRJwcSl0XusmAzCQT~2V~adhVka82P7fcV1vgthqqhA-nFRIZxbUYf0vr8brHs0q03ynWzmXSD15bP~sXdvci1evdja8OjnTPCIDIfY3gIaUTM0ZCWQg6lM-nAgWoz3~yMHFz5Bqyt~B9T2sFH~C6TImKG6EZK9PgR01sjm0NOZdvOIv9AjBeK8XDmC42NvbUXm6~pSyOiyZwGLj4xEeSnykXc7rFKJ6BRiQJUOkkRTd~0cyQC~fcj9P45qA__&Key-Pair-Id=APKAJCILBXEJFZF4DCHQ", + "id": 4249989, + "external_id": null, + "created_date": "2024-06-13 21:27:18", + "updated_date": "2024-06-13 21:27:18", + "img_thumbnail_url": "https://scdn.veryfi.com/other-documents/919ba4778c039560/11ccb43f-493d-47f0-8a81-a06c59036bf3/thumbnail.png?Expires=1727834317&Signature=V7hDKuue-Po2KiUROCFOiG-gw5zRJ38bDijcEm8dBaNZZ5212j~vskzBiutLJeVNthVnDgIcof5PBvM06ZJQHFzLRTO5m3jQGca~bUtcOx4GawAaSF1id0hjOduMcvvZ74rNnKzDVCkMK8jvfsAK9efO0YPwCCqreSylrhzzj5ITUqFRcaHOu6i4TrvlDwqlJyurVSlY7jdHgzekDMk2FMWaoM1C~9VpyJpJ5KlaYc9K9rub6lrJWDWAjsTW~MWb6p0V1vxx2l0okN5b3xg1142RLNwOpMNyiGizR7grVWcu6zCrw5cvj4eUJg9LhbhdyGaReste8x6KsqIzJc~u5w__&Key-Pair-Id=APKAJCILBXEJFZF4DCHQ", + "blueprint_name": "us_driver_license", + "template_name": "us_driver_license", + "address": "892 MOMONA ST HONOLULU, HI 96820", + "birth_date": "1981-06-03", + "expiration_date": "2008-06-03", + "eyes_color": "BRO", + "first_name": "McLovin", + "height": "5-10", + "issue_date": "1998-06-18", + "last_name": "McLovin", + "license_class": "3", + "license_number": "01 - 47 - 87441", + "sex": "M", + "state": "HAWAII", + "weight": "150" + }, + { + "pdf_url": "https://scdn.veryfi.com/other-documents/919ba4778c039560/ab415b2b-c927-44d1-a96f-7271eec06fb2/835bbf98-e4d8-41f5-9c39-fbd48a7d1991.pdf?Expires=1727834317&Signature=YrhGWfUfvuf4XMjGe5ruFhBqo2azQqxfMgqhphOZJ2cYy~64jBmNKK4BewZgmfWUy9wnTJPzEmcENe3YK3Nf-ux4wkOZ0fTyHtMJMj74RZVIHOolGQXLTb9zmPtreqzVst-uRUhFQGfwIVO1Jozeu~oVcu1vV6gy0MuOUPWEsfnxFdrGThc~Jtca3-zxGQjwXtnlV3mLG9H0gX1iXJI2qzuo8uW8Eft~IEDoZHe5Pm-rFlmQLzOkufFPKTDKN-afKNzlujRh1uEWbb-Nqlj8PcYUPXmQm33FZm8KDqMwKw18-lEAwyyhdiE3i7HRH7mQgVeGGyztMMBCpf1i4p8gWA__&Key-Pair-Id=APKAJCILBXEJFZF4DCHQ", + "id": 4249871, + "external_id": null, + "created_date": "2024-06-13 21:03:31", + "updated_date": "2024-06-13 21:03:31", + "img_thumbnail_url": "https://scdn.veryfi.com/other-documents/919ba4778c039560/ab415b2b-c927-44d1-a96f-7271eec06fb2/thumbnail.png?Expires=1727834317&Signature=EMf9nPKCOd9-Bs5sI2Igl5V8TAJ8syIWiZRhmDbRyN1FLE5VBVsGwP-6wyHbDIgYqIA6V5YNNnyITFWdS2GwnNGPlG4Td1cZIBAWnQS~Hr3R2GcLV3IHqSapp79sE~f1Xx1buD4kF~Fpxj3xjofrgEQaQLrlOMuaVKUEpXRjZnGoue5vV9VTGXX8XFhcJpBzsGV4y~jZi6dZ8Y34GvHeJm-~~P7HNFxvaK~0iwb-hmKYkGxjHcr9Cqb3GNCHrjyP0GpTmHCbaWP4r4YhCqZgf8nBQmkUmqES6mvp256KhyenhDiT4F4P7U8KRcqANr5NGpnX0tl0BuPW2-4rprYQ2g__&Key-Pair-Id=APKAJCILBXEJFZF4DCHQ", + "blueprint_name": "us_driver_license", + "template_name": "us_driver_license", + "address": "892 MOMONA ST HONOLULU, HI 96820", + "birth_date": "1981-06-03", + "expiration_date": "2008-06-03", + "eyes_color": "BRO", + "first_name": "fMCLOVIN", + "height": "5-10", + "issue_date": "1998-06-18", + "last_name": "McLovin", + "license_class": "3", + "license_number": "01 - 47 - 87441", + "sex": "M", + "state": "HAWAII", + "weight": "150" + }, + { + "pdf_url": "https://scdn.veryfi.com/other-documents/919ba4778c039560/c486c4e8-199f-4fe3-9de0-c8fc049b1db8/b0a2b762-4fcc-4854-a0f4-4dedd4e5bad5.pdf?Expires=1727834317&Signature=fyizZ2YY5trgkVfqUa-CVBiNoOttiT1CK4DaDdxcI3DBURgkMp2DzUl1QDJOKnrluewQkV8l~WAq7qD1WjqYHb9aWjVkG7bZcLupzrTXYhVk-aEiS0N1bG0upfXKM1UA5Fa8t4i8PVA84Or1eZl90Kd11n3NUd7ulk5ouCofoH62yKPcT1X0B75pDIH3mBlLHl8Q5Z2zfFoIbq34l7QwB2wKL3AI5QoGyEt4mG-CF-~g7rReQhA2xCSW6OS8HpTrCmn9RNjwOvQajlnfLgsd~zxZnDpRODgPknAQMobLGvy6xkMnCaAjpDwbn55hzeyYbpt-uSPbYc0sZ9if8p-b5w__&Key-Pair-Id=APKAJCILBXEJFZF4DCHQ", + "id": 4249868, + "external_id": null, + "created_date": "2024-06-13 21:03:22", + "updated_date": "2024-06-13 21:03:22", + "img_thumbnail_url": "https://scdn.veryfi.com/other-documents/919ba4778c039560/c486c4e8-199f-4fe3-9de0-c8fc049b1db8/thumbnail.png?Expires=1727834317&Signature=EbP1iXoEjSIEn5Lxcd8Kp0fluB6Q5m6FhNJ2iTHe~wWwANuoy4BobPXDq2iKUiTWIi05s79MgecLL7zHXk3fxqReSluONvJ1PiK4LTyFU5JVToCoy3sMxLm~3RMzraAoWiNpHeb1KxZ68qeDktHYFM1~PTMvM6Bj7BN1~Wh40BcVjB-V~gS3ZflnTkvHidWJcHE4OXeSlL9vicf4qNA7x7zS6DJ3U341UxXmdYhh98c1iqFyN3XUWltbwVthE~OEjuLJ7obVmGfWVBKD1KEqNiMtAR3VPs2OjI8cT05nDKLCivF6PnJ-hjfxE6GZBJ2su9S3gPdZW0nd3XPaTHEt3g__&Key-Pair-Id=APKAJCILBXEJFZF4DCHQ", + "blueprint_name": "us_driver_license", + "template_name": "us_driver_license", + "address": "892 MOMONA ST HONOLULU, HI 96820", + "birth_date": "1981-06-03", + "expiration_date": "2008-06-03", + "eyes_color": "BRO", + "first_name": "fMCLOVIN", + "height": "5-10", + "issue_date": "1998-06-18", + "last_name": "McLovin", + "license_class": "3", + "license_number": "01 - 47 - 87441", + "sex": "M", + "state": "HAWAII", + "weight": "150" + }, + { + "pdf_url": "https://scdn.veryfi.com/other-documents/919ba4778c039560/8df5ef03-a2d8-424d-90d2-3b48f0df0820/aae637d2-5e24-4709-a297-4fe7b8015e58.pdf?Expires=1727834317&Signature=U2BhZCylGSkcMSF1KH7zvl3dhhVcNcVEW79IPcjJ1URAeUjx1hOm0UdGlz0VeXBTOjQ1MYRyjpoZeQTOR2rgcgG3FSoKUSK8CSV~c8gQ-SelppjQN-1~8bwpY07mgh1j-lE4-vovDr7KCjXK3vD8PHRiZNMrN6PtBgiDjHLyMbxk5UKYchaX1vLeg572~QchSAZeAfQl7itVKCIy3FuyI1-wAypW86269NFoLEkQaHeH15ymA27Xd83xfwist4xcLULhsj6EeT6-M-FPXTaf9DW8VhkcJ2pNiLpcD4I1~jzrVh1Z4c9NKMsphu5Ubo~jR3eQULyDxtinKlukQDWRpw__&Key-Pair-Id=APKAJCILBXEJFZF4DCHQ", + "id": 4249866, + "external_id": null, + "created_date": "2024-06-13 21:03:21", + "updated_date": "2024-06-13 21:03:21", + "img_thumbnail_url": "https://scdn.veryfi.com/other-documents/919ba4778c039560/8df5ef03-a2d8-424d-90d2-3b48f0df0820/thumbnail.png?Expires=1727834317&Signature=Ks1dcM1Y4UMiNohqym5RX7nvJZeUY0IKtD69uYYWkFapjbkEkmefIJUbgcfRCjT37YOnwj8ZsGVehYKDm-iOOZleW1yfcls49Vrbgueolub~2PGeP-9BR7m~3qrkylyx-Q0gV9ebLnXm2J5uc-4QBU9eUoFTfXkmXdO7ahdDU4R7nZ5T2JcHvihboSU9AAsb~GoBlQQMQAU~jDmJRU7ug6kOlerJSCYGAmPYqRtLMUoNr8EzS9lJM72efbpI3X-D1uZfauVWrt0TCmPKrIDN9zxM0Rj755de3nsv82dOnDqU95SBo7nwDc8MvRScfnAggitTWRZbccGfi1xvQLBEAA__&Key-Pair-Id=APKAJCILBXEJFZF4DCHQ", + "blueprint_name": "us_driver_license", + "template_name": "us_driver_license", + "address": "892 MOMONA ST HONOLULU, HI 96820", + "birth_date": "1981-06-03", + "expiration_date": "2008-06-03", + "eyes_color": "BRO", + "first_name": "fMCLOVIN", + "height": "5-10", + "issue_date": "1998-06-18", + "last_name": "McLovin", + "license_class": "3", + "license_number": "01 - 47 - 87441", + "sex": "M", + "state": "HAWAII", + "weight": "150" + }, + { + "pdf_url": "https://scdn.veryfi.com/other-documents/919ba4778c039560/efbf3758-02a4-4d48-85a7-19849c690217/95a71048-224e-458c-9823-ddaf5ed27a78.pdf?Expires=1727834317&Signature=JjMJHU5H8IlPZvoG3UCThIMRxZ6g522TaOZ9Pi04bGUAlMhHdS9yZY8eqNPplAZ2z09uus7DoXK5ZexCRTlI9U3oEIU4mpFjzR8t7BP6-joldFqyRjttD45Sq~32t5-MHS2zh8h~H6saVizYfgcL2Q8vwIBVdbyobN0~gNFXkay0yay3oJ6oM5rY2XmLATjtwUyL0zLnW8TcCqOoxdKGVPePv5Mw-nDXARkYU9Zpk7jTFyDefri-bo1ggAfP2gDesrw0VDK0xpt3YzsOrqS075ZazxmgkIxTlOTV5~j2YIGqC1K0f4duB-ErGkEjBPdv6HT6qOBxe4mUvCoYtMTWSA__&Key-Pair-Id=APKAJCILBXEJFZF4DCHQ", + "id": 4249865, + "external_id": null, + "created_date": "2024-06-13 21:03:13", + "updated_date": "2024-06-13 21:03:13", + "img_thumbnail_url": "https://scdn.veryfi.com/other-documents/919ba4778c039560/efbf3758-02a4-4d48-85a7-19849c690217/thumbnail.png?Expires=1727834317&Signature=N1TObZycd1iO3uUW2PqpTlgR9aG64g3zJWj8IfOCAaQIc2TzpgQ10XPqp4A4wPVs7aAwfNC2QY-~-wImBTXcms748P2NKjbPjVk1Aw-BsYbiR6xfgWh~eC~ihP7xpd~ymak1ibEwFknE9KiBeKLM0N0GhahuOMvayxCVXPjF0-GEPgucGA9KcesZlCJA7p2PtC9Uopn-dVfJuXWV18Mi3QMKu~Sumk5irSPKuQEVmFKVQXPO1CkcY-NOSUVYVyYrdXy3g1T-YInvz1Y7aExNiB5MVgxaAHUnyLYUA9pts2zJwwcuLRQLYfnNTBLy7HEOiOqdNPE-R75VxFSo51aFaw__&Key-Pair-Id=APKAJCILBXEJFZF4DCHQ", + "blueprint_name": "us_driver_license", + "template_name": "us_driver_license", + "address": "892 MOMONA ST HONOLULU, HI 96820", + "birth_date": "1981-06-03", + "expiration_date": "2008-06-03", + "eyes_color": "BRO", + "first_name": "fMCLOVIN", + "height": "5-10", + "issue_date": "1998-06-18", + "last_name": "McLovin", + "license_class": "3", + "license_number": "01 - 47 - 87441", + "sex": "M", + "state": "HAWAII", + "weight": "150" + }, + { + "pdf_url": "https://scdn.veryfi.com/other-documents/919ba4778c039560/0040fab0-1650-4ade-87b3-6835fd4acf41/afaf1ee3-fd18-471e-b651-fae30e94b7ca.pdf?Expires=1727834317&Signature=LiHKbD96ik0waXQ4NyfEJTdB7onJIhoxJq-Ca8ptzwtDLjVE5SSyVO8tQXs1nVXf0O4~V~tRHiHy561wbEv5ixN5dXOyN9iLGiJRK1ewcrfFheIiLKjON4C9foMlMLnQsm2JAByuRVaqUrjclDEtvvFR655zH148-Sp6yCe0oRCzVTmDtjkbAov1ItQmVst4VlyRf5sqsKshEFmH~e4xkW0jSEJAZR1eMFHE742vO80vQFRfRPZrvHveFGKDLBgNCRulreJaWbFZK9wVIMo1LsD6irZYK7JPK8FaHtIez8fIHEklRi-6KIzXZQWDZCRb99YLG5FsDzYpRvWarFhf2A__&Key-Pair-Id=APKAJCILBXEJFZF4DCHQ", + "id": 4249838, + "external_id": null, + "created_date": "2024-06-13 20:56:52", + "updated_date": "2024-06-13 20:56:52", + "img_thumbnail_url": "https://scdn.veryfi.com/other-documents/919ba4778c039560/0040fab0-1650-4ade-87b3-6835fd4acf41/thumbnail.png?Expires=1727834317&Signature=CLqyJEtI08zBuZaqh~T5-e4CZZCxICjLa6rBsHflqINAF6myZToX2j~zYUjlU-XgKsYmFDER7d6OJefR1lJ92-PpBc62LXCAlV4T0OP7uT0B06uOTz40VABdevxOX2NDTcg7szM16TLvC3y9Yb59946qkhGnv1S3NbzaEL57fTIGLrvFPWNjDo772P72qwYeM6tVtE5R4EVwlpVhpe8QVTp8bCUmnWiVoEjfnaHagz2-ciXiWLHsZc8-8KRguf8S~SmprT9sSHJT2fMWaZLhFvteuxBZDf5PtlBKo7Sb8WVvBGdm5yD6dXMQC8TYcjh4LLpkKcfSRo19lVahoZFOyg__&Key-Pair-Id=APKAJCILBXEJFZF4DCHQ", + "blueprint_name": "us_driver_license", + "template_name": "us_driver_license", + "address": "892 MOMONA ST HONOLULU, HI 96820", + "birth_date": "1981-06-03", + "expiration_date": "2008-06-03", + "eyes_color": "BRO", + "first_name": "fMCLOVIN", + "height": "5-10", + "issue_date": "1998-06-18", + "last_name": "McLovin", + "license_class": "3", + "license_number": "01 - 47 - 87441", + "sex": "M", + "state": "HAWAII", + "weight": "150" + }, + { + "pdf_url": "https://scdn.veryfi.com/other-documents/919ba4778c039560/680d23a2-4928-40de-845f-65d86727daa2/82bd630a-b6cc-45e7-b08a-0d0e19e16265.pdf?Expires=1727834317&Signature=MKKGVHWESa4hJ-UV7MJ319S7sHM4W1NcUBF~iTDOLP6AJo3LEhCICmU2~~CiYuUXYWrSUyO2mKaBdXRVhp3p3GUMzTBjh7~RKWSJ2TgPDFwCs8hNKdVjJayfDIG~zo2eKDXkknUXC9Mde7dNICR8KJiEqVRXzc0YYiEM05vsimssMyUQhEMa2O-ABsJRUz8mVSi5FkNtBXLdeU8sAHiI3d7I4niySoy9m5KmR8xl-Ks84MJrQoSkPiyut7h0f-qNObGV6vyg6bUDK8PC7qO~ub6z31Hw6xPLyElz5Aqv5xAnHEUuz-EN0IPpX~zfYMGvWiuf-bvow8YCO2zeqPOk0Q__&Key-Pair-Id=APKAJCILBXEJFZF4DCHQ", + "id": 4249837, + "external_id": null, + "created_date": "2024-06-13 20:56:43", + "updated_date": "2024-06-13 20:56:43", + "img_thumbnail_url": "https://scdn.veryfi.com/other-documents/919ba4778c039560/680d23a2-4928-40de-845f-65d86727daa2/thumbnail.png?Expires=1727834317&Signature=Shgc9rXFe57o0lnDTOMgEMDFDzSBZtXvRLWTwJyekWTmOMpe4wleJwtQKmalV9wrRrEyYmRIg88~FvLdm5remODZolCrUfZLK5D-wxp0rLZiWMIF5NztAYVZBEFlfrk6SJH-l1BovqAzqtrT~qOvNtlRzEC18M87yiIITQwpYaktDFDGXI1t6igT~BzO2zjRP9acraVDsb-665AdrVvzQ7TrkivlqxdeySAcLJ4ZG2TdE6X1h6QnO~~sAioDMgaKHnBMyKmdp9vTdM9um54meBSIB11bxX8RM5qBJwEQGRXM89hMZwhNsgyOev3l1Bkw3QIqob6Ph7u4R4LDy2Tkiw__&Key-Pair-Id=APKAJCILBXEJFZF4DCHQ", + "blueprint_name": "us_driver_license", + "template_name": "us_driver_license", + "address": "892 MOMONA ST HONOLULU, HI 96820", + "birth_date": "1981-06-03", + "expiration_date": "2008-06-03", + "eyes_color": "BRO", + "first_name": "fMCLOVIN", + "height": "5-10", + "issue_date": "1998-06-18", + "last_name": "McLovin", + "license_class": "3", + "license_number": "01 - 47 - 87441", + "sex": "M", + "state": "HAWAII", + "weight": "150" + }, + { + "pdf_url": "https://scdn.veryfi.com/other-documents/919ba4778c039560/f061ed4a-5795-434e-bdff-b5a403fc2c3d/a67abea2-e4d4-4322-9b80-5d524771bd1c.pdf?Expires=1727834317&Signature=chYTOxE5gHfc8KdCQiI3SeA6mp12VeUrpK2DXWYQhKus7pG8qvuzySeHIMV0yKlLShND8rBW6JB4YPl9YkGWNx8VI9SCeUmmv~SyK9dFEc2uYFNGGbpuQl9s7RKSZvpmkBVpsXlebI~xifzUgSimHLGkrl0JoukLPIHyDTojuHx05LN7jGqls56mo~jxQXRjlCmp-kyc9d154zDb-ZZ4com4eapFfx0MVyrkDEKZqbYxBCEDFgrgjIcTcMKxi3-s2ME2pQ-ytM9eM479ZbSlw-FugrLnryICkXLxZlHYKJs85Ck5b4EiuKBLBuxU9Ddm3c2Gva6~flHyEN2hsH9DXA__&Key-Pair-Id=APKAJCILBXEJFZF4DCHQ", + "id": 4249836, + "external_id": null, + "created_date": "2024-06-13 20:56:41", + "updated_date": "2024-06-13 20:56:41", + "img_thumbnail_url": "https://scdn.veryfi.com/other-documents/919ba4778c039560/f061ed4a-5795-434e-bdff-b5a403fc2c3d/thumbnail.png?Expires=1727834317&Signature=TInra1mg3ulxJNpQJWb6Ry3vXFotr2nsNkB85M9XwyMW6SJImC-TM6DuUb690f56MgHQaR5fByLZvEKLS679w1mpqCH7WqXCltdt76qYI9Gy38aEOGt9yPaqNxfz~NpKu9oBgPAmKCAi7mHZad8IamllVRu7OxqbxScRiP0q5X6nlFaj7ULwKtJjkCE8Iv6a7so~hc5v54y7ri4Vzok8cnblK921bP~BToZjxKkESbqLVfnI-meRbFYKEvkbV3EsRPMyFFWiB5c9cr~s~GresRbmbpdzlSzTf-NKoDjeroCJ2c4-z2vYY83UMrxTGWAkpvxUAt21mgwQS28UeHKFww__&Key-Pair-Id=APKAJCILBXEJFZF4DCHQ", + "blueprint_name": "us_driver_license", + "template_name": "us_driver_license", + "address": "892 MOMONA ST HONOLULU, HI 96820", + "birth_date": "1981-06-03", + "expiration_date": "2008-06-03", + "eyes_color": "BRO", + "first_name": "McLovin", + "height": "5-10", + "issue_date": "1998-06-18", + "last_name": "McLovin", + "license_class": "3", + "license_number": "01 - 47 - 87441", + "sex": "M", + "state": "HAWAII", + "weight": "150" + } + ] +} diff --git a/Tests/VeryfiSDKTests/Resources/getBankStatement.json b/Tests/VeryfiSDKTests/Resources/getBankStatement.json new file mode 100644 index 0000000..0194c5d --- /dev/null +++ b/Tests/VeryfiSDKTests/Resources/getBankStatement.json @@ -0,0 +1,251 @@ +{ + "transactions": [ + { + "order": 0, + "account_number": "1111111", + "balance": 1803.9, + "card_number": null, + "credit_amount": null, + "date": "2013-10-22", + "debit_amount": 190.4, + "description": "AUTOMATED PAY IN 650274051211-CHB\nCALL REF. NO. 3442, FROM", + "transaction_id": null, + "text": "22 Oct 2013 AUTOMATED PAY IN 650274051211-CHB\t\t\t\t190.40\t1803.9\nCALL REF. NO. 3442, FROM" + }, + { + "order": 1, + "account_number": "1111111", + "balance": 1613.5, + "card_number": null, + "credit_amount": null, + "date": "2013-10-22", + "debit_amount": 140, + "description": "DIGITAL BANKING\nA/C 22222222", + "transaction_id": null, + "text": "22 Oct 2013 DIGITAL BANKING\t\t\t\t\t\t140.00\t1613.5\nA/C 22222222" + }, + { + "order": 2, + "account_number": "1111111", + "balance": 1473.5, + "card_number": null, + "credit_amount": null, + "date": "2013-10-24", + "debit_amount": 132.3, + "description": "Amazon", + "transaction_id": null, + "text": "24 Oct 2013 Faster Payment\tAmazon\t\t\t\t\t132.30\t1473.5" + }, + { + "order": 3, + "account_number": "1111111", + "balance": 1341.2, + "card_number": null, + "credit_amount": null, + "date": "2013-10-24", + "debit_amount": 515.22, + "description": "Tebay Trading Co.", + "transaction_id": null, + "text": "24 Oct 2013 BACS\tTebay Trading Co.\t\t\t\t515.22\t1341.2" + }, + { + "order": 4, + "account_number": "1111111", + "balance": 825.98, + "card_number": null, + "credit_amount": null, + "date": "2013-10-25", + "debit_amount": 80, + "description": "Morrisons Petrol", + "transaction_id": null, + "text": "25 Oct 2013 Faster Payment\tMorrisons Petrol\t\t\t\t80.00\t825.98" + }, + { + "order": 5, + "account_number": "1111111", + "balance": 745.98, + "card_number": null, + "credit_amount": 20000, + "date": "2013-10-25", + "debit_amount": null, + "description": "Business Loan", + "transaction_id": null, + "text": "25 Oct 2013 BACS\tBusiness Loan\t\t20,000.00\t\t745.98" + }, + { + "order": 6, + "account_number": "1111111", + "balance": 20745.98, + "card_number": null, + "credit_amount": null, + "date": "2013-10-26", + "debit_amount": 2461.55, + "description": "James White Media", + "transaction_id": null, + "text": "26 Oct 2013 BACS\tJames White Media\t\t\t2,461.55\t20745.98" + }, + { + "order": 7, + "account_number": "1111111", + "balance": 18284.43, + "card_number": null, + "credit_amount": null, + "date": "2013-10-27", + "debit_amount": 100, + "description": "ATM High Street", + "transaction_id": null, + "text": "27 Oct 2013 Faster Payment\tATM High Street\t\t\t\t100.00\t18284.43" + }, + { + "order": 8, + "account_number": "1111111", + "balance": 18184.43, + "card_number": null, + "credit_amount": null, + "date": "2013-11-01", + "debit_amount": 150, + "description": "Acorn Advertising Studies", + "transaction_id": null, + "text": "01 Nov 2013 BACS\tAcorn Advertising Studies\t\t\t150.00\t18184.43" + }, + { + "order": 9, + "account_number": "1111111", + "balance": 18034.43, + "card_number": null, + "credit_amount": null, + "date": "2013-11-01", + "debit_amount": 177, + "description": "Marriott Hotel", + "transaction_id": null, + "text": "01 Nov 2013 BACS\tMarriott Hotel\t\t\t\t177.00\t18034.43" + }, + { + "order": 10, + "account_number": "1111111", + "balance": 17857.43, + "card_number": null, + "credit_amount": null, + "date": "2013-11-01", + "debit_amount": 122.22, + "description": "Abellio Scotrail Ltd", + "transaction_id": null, + "text": "01 Nov 2013 Faster Payment\tAbellio Scotrail Ltd\t\t\t\t122.22\t17857.43" + }, + { + "order": 11, + "account_number": "1111111", + "balance": 17735.21, + "card_number": null, + "credit_amount": null, + "date": "2013-11-01", + "debit_amount": 1200, + "description": "Cheque 0000234", + "transaction_id": null, + "text": "01 Nov 2013 CHQ\tCheque 0000234\t\t\t\t1,200.00\t17735.21" + }, + { + "order": 12, + "account_number": "1111111", + "balance": 16535.21, + "card_number": null, + "credit_amount": 9.33, + "date": "2013-12-01", + "debit_amount": null, + "description": "Interest Paid", + "transaction_id": null, + "text": "01 Dec 2013 Int. Bank\tInterest Paid\t\t\t9.33\t\t16535.21" + }, + { + "order": 13, + "account_number": "1111111", + "balance": 16544.54, + "card_number": null, + "credit_amount": null, + "date": "2013-12-01", + "debit_amount": 2470, + "description": "OVO Energy", + "transaction_id": null, + "text": "01 Dec 2013 DD\t\tOVO Energy\t\t\t\t2470.00\t16544.54" + }, + { + "order": 14, + "account_number": "1111111", + "balance": 14074.54, + "card_number": null, + "credit_amount": null, + "date": "2013-12-21", + "debit_amount": 10526.4, + "description": "Various Payment", + "transaction_id": null, + "text": "21 Dec 2013 BACS\tVarious Payment\t\t\t\t10,526.40\t14074.54" + }, + { + "order": 15, + "account_number": "1111111", + "balance": 3548.14, + "card_number": null, + "credit_amount": null, + "date": "2013-12-21", + "debit_amount": 1000, + "description": "HMRC", + "transaction_id": null, + "text": "21 Dec 2013 BACS\tHMRC\t\t\t\t\t1,000.00\t3548.14" + }, + { + "order": 16, + "account_number": "1111111", + "balance": 2548.14, + "card_number": null, + "credit_amount": null, + "date": "2013-12-21", + "debit_amount": 280, + "description": "DVLA", + "transaction_id": null, + "text": "21 Dec 2013 DD\t\tDVLA\t\t\t\t\t280.00\t2548.14" + } + ], + "summaries": [ + { + "name": "Paid Out", + "total": 2684.1 + }, + { + "name": "Paid In", + "total": 2180.4 + } + ], + "account_numbers": [ + "1111111" + ], + "routing_numbers": [ + "16-10-00" + ], + "pdf_url": "https://scdn.veryfi.com/bank_statements/919ba4778c039560/7cab1444-cfb4-42b6-bb05-c9adb1a7461d/2aa1f127-219d-434b-8f9d-79172e917c74.pdf?Expires=1727836701&Signature=dxcQmBQLNdblNA~sk-UQ0nkQBmSRE-W9i0UP8uftWV3X8a3UfmlK2yKmWxRvZvrlgn~r7x6DKivIjscKe2jeSGFHqMqlenC-PdtFiiLLYB6TyVpXi2odnWL~2OPIQ6Ehdi~NJuC~bDnNlxftVRdCafZ5oKlwau8fuMB-uhuik71kn86Jzj06JtIEsEcl88CSNWNLLTR~hsCwYOPS0gQAznL0MIucVssdk6m1BXijIEQedmqDttgQccCFRAsHa~tNzTMwGG12g0QawVag2pI8Zc9IepUcZn~t~sXJwYu0E3fs98oXZjoMIKTFW7e2sfgMN~PnrmN-adioHazUR~03IA__&Key-Pair-Id=APKAJCILBXEJFZF4DCHQ", + "id": 4560116, + "external_id": null, + "created_date": "2024-09-24 20:35:12", + "updated_date": "2024-09-24 20:35:12", + "img_thumbnail_url": "https://scdn.veryfi.com/bank_statements/919ba4778c039560/7cab1444-cfb4-42b6-bb05-c9adb1a7461d/thumbnail.png?Expires=1727836701&Signature=dF67o51T3iHpG~wwPh1nuiU-IO9QSoPuS9VnOsnbW8TCexlhI5yYLLbUIUC-qkCa-EwIOq20vWf7HPTE6zEVegUUFY3iHo3C7s3PemsEGISI969HB4VPJ95Wm2hOcvWFN4NYhlRdJtzhGp-rYUuappd-HWlXNBXjJUcXJU12kXapB67c7vxho~pJPasyQHRnI3yhwFCth~Wgp8GDAqc~637qrfEvkPAQjA66j0UOeDF6IbagZ~qeZc8gq4L0XOTTjHjGjlXswqWFpswpl1wyYU-IXDFJlG~lHlR0DgYx9kgbKkXalmow1-MmXXbxAmJIPVPwsmDl~s~4ywX~7If5rw__&Key-Pair-Id=APKAJCILBXEJFZF4DCHQ", + "account_holder_address": "San Mateo", + "account_holder_name": "Mr Robot Roboto", + "account_number": "1111111", + "account_type": "CURRENT ACCOUNT", + "bank_address": "The Mound, Edinburgh EH1 1YZ.", + "bank_name": "Royal Bank of Scotland Plc.", + "bank_website": null, + "beginning_balance": 1803.9, + "due_date": null, + "ending_balance": 300.2, + "minimum_due": null, + "period_end_date": "2023-12-21", + "period_start_date": "2023-10-22", + "routing_number": "16-10-00", + "statement_date": null, + "statement_number": null, + "currency_code": "GBP", + "iban_number": "GB11RBOS 1610 0011 1111 11", + "swift": "RBOSGB2L", + "account_vat_number": null, + "bank_vat_number": "SC327000" +} diff --git a/Tests/VeryfiSDKTests/Resources/getBankStatements.json b/Tests/VeryfiSDKTests/Resources/getBankStatements.json new file mode 100644 index 0000000..f9595d1 --- /dev/null +++ b/Tests/VeryfiSDKTests/Resources/getBankStatements.json @@ -0,0 +1,760 @@ +{ + "count": 63, + "next": "", + "previous": "", + "results": [ + { + "transactions": [ + { + "order": 0, + "account_number": "1111111", + "balance": 1803.9, + "card_number": null, + "credit_amount": null, + "date": "2013-10-22", + "debit_amount": 190.4, + "description": "AUTOMATED PAY IN 650274051211-CHB\nCALL REF. NO. 3442, FROM", + "transaction_id": null, + "text": "22 Oct 2013 AUTOMATED PAY IN 650274051211-CHB\t\t\t\t190.40\t1803.9\nCALL REF. NO. 3442, FROM" + }, + { + "order": 1, + "account_number": "1111111", + "balance": 1613.5, + "card_number": null, + "credit_amount": null, + "date": "2013-10-22", + "debit_amount": 140, + "description": "DIGITAL BANKING\nA/C 22222222", + "transaction_id": null, + "text": "22 Oct 2013 DIGITAL BANKING\t\t\t\t\t\t140.00\t1613.5\nA/C 22222222" + }, + { + "order": 2, + "account_number": "1111111", + "balance": 1473.5, + "card_number": null, + "credit_amount": null, + "date": "2013-10-24", + "debit_amount": 132.3, + "description": "Amazon", + "transaction_id": null, + "text": "24 Oct 2013 Faster Payment\tAmazon\t\t\t\t\t132.30\t1473.5" + }, + { + "order": 3, + "account_number": "1111111", + "balance": 1341.2, + "card_number": null, + "credit_amount": null, + "date": "2013-10-24", + "debit_amount": 515.22, + "description": "Tebay Trading Co.", + "transaction_id": null, + "text": "24 Oct 2013 BACS\tTebay Trading Co.\t\t\t\t515.22\t1341.2" + }, + { + "order": 4, + "account_number": "1111111", + "balance": 825.98, + "card_number": null, + "credit_amount": null, + "date": "2013-10-25", + "debit_amount": 80, + "description": "Morrisons Petrol", + "transaction_id": null, + "text": "25 Oct 2013 Faster Payment\tMorrisons Petrol\t\t\t\t80.00\t825.98" + }, + { + "order": 5, + "account_number": "1111111", + "balance": 745.98, + "card_number": null, + "credit_amount": 20000, + "date": "2013-10-25", + "debit_amount": null, + "description": "Business Loan", + "transaction_id": null, + "text": "25 Oct 2013 BACS\tBusiness Loan\t\t20,000.00\t\t745.98" + }, + { + "order": 6, + "account_number": "1111111", + "balance": 20745.98, + "card_number": null, + "credit_amount": null, + "date": "2013-10-26", + "debit_amount": 2461.55, + "description": "James White Media", + "transaction_id": null, + "text": "26 Oct 2013 BACS\tJames White Media\t\t\t2,461.55\t20745.98" + }, + { + "order": 7, + "account_number": "1111111", + "balance": 18284.43, + "card_number": null, + "credit_amount": null, + "date": "2013-10-27", + "debit_amount": 100, + "description": "ATM High Street", + "transaction_id": null, + "text": "27 Oct 2013 Faster Payment\tATM High Street\t\t\t\t100.00\t18284.43" + }, + { + "order": 8, + "account_number": "1111111", + "balance": 18184.43, + "card_number": null, + "credit_amount": null, + "date": "2013-11-01", + "debit_amount": 150, + "description": "Acorn Advertising Studies", + "transaction_id": null, + "text": "01 Nov 2013 BACS\tAcorn Advertising Studies\t\t\t150.00\t18184.43" + }, + { + "order": 9, + "account_number": "1111111", + "balance": 18034.43, + "card_number": null, + "credit_amount": null, + "date": "2013-11-01", + "debit_amount": 177, + "description": "Marriott Hotel", + "transaction_id": null, + "text": "01 Nov 2013 BACS\tMarriott Hotel\t\t\t\t177.00\t18034.43" + }, + { + "order": 10, + "account_number": "1111111", + "balance": 17857.43, + "card_number": null, + "credit_amount": null, + "date": "2013-11-01", + "debit_amount": 122.22, + "description": "Abellio Scotrail Ltd", + "transaction_id": null, + "text": "01 Nov 2013 Faster Payment\tAbellio Scotrail Ltd\t\t\t\t122.22\t17857.43" + }, + { + "order": 11, + "account_number": "1111111", + "balance": 17735.21, + "card_number": null, + "credit_amount": null, + "date": "2013-11-01", + "debit_amount": 1200, + "description": "Cheque 0000234", + "transaction_id": null, + "text": "01 Nov 2013 CHQ\tCheque 0000234\t\t\t\t1,200.00\t17735.21" + }, + { + "order": 12, + "account_number": "1111111", + "balance": 16535.21, + "card_number": null, + "credit_amount": 9.33, + "date": "2013-12-01", + "debit_amount": null, + "description": "Interest Paid", + "transaction_id": null, + "text": "01 Dec 2013 Int. Bank\tInterest Paid\t\t\t9.33\t\t16535.21" + }, + { + "order": 13, + "account_number": "1111111", + "balance": 16544.54, + "card_number": null, + "credit_amount": null, + "date": "2013-12-01", + "debit_amount": 2470, + "description": "OVO Energy", + "transaction_id": null, + "text": "01 Dec 2013 DD\t\tOVO Energy\t\t\t\t2470.00\t16544.54" + }, + { + "order": 14, + "account_number": "1111111", + "balance": 14074.54, + "card_number": null, + "credit_amount": null, + "date": "2013-12-21", + "debit_amount": 10526.4, + "description": "Various Payment", + "transaction_id": null, + "text": "21 Dec 2013 BACS\tVarious Payment\t\t\t\t10,526.40\t14074.54" + }, + { + "order": 15, + "account_number": "1111111", + "balance": 3548.14, + "card_number": null, + "credit_amount": null, + "date": "2013-12-21", + "debit_amount": 1000, + "description": "HMRC", + "transaction_id": null, + "text": "21 Dec 2013 BACS\tHMRC\t\t\t\t\t1,000.00\t3548.14" + }, + { + "order": 16, + "account_number": "1111111", + "balance": 2548.14, + "card_number": null, + "credit_amount": null, + "date": "2013-12-21", + "debit_amount": 280, + "description": "DVLA", + "transaction_id": null, + "text": "21 Dec 2013 DD\t\tDVLA\t\t\t\t\t280.00\t2548.14" + } + ], + "summaries": [ + { + "name": "Paid Out", + "total": 2684.1 + }, + { + "name": "Paid In", + "total": 2180.4 + } + ], + "account_numbers": [ + "1111111" + ], + "routing_numbers": [ + "16-10-00" + ], + "pdf_url": "https://scdn.veryfi.com/bank_statements/919ba4778c039560/7cab1444-cfb4-42b6-bb05-c9adb1a7461d/2aa1f127-219d-434b-8f9d-79172e917c74.pdf?Expires=1727836701&Signature=dxcQmBQLNdblNA~sk-UQ0nkQBmSRE-W9i0UP8uftWV3X8a3UfmlK2yKmWxRvZvrlgn~r7x6DKivIjscKe2jeSGFHqMqlenC-PdtFiiLLYB6TyVpXi2odnWL~2OPIQ6Ehdi~NJuC~bDnNlxftVRdCafZ5oKlwau8fuMB-uhuik71kn86Jzj06JtIEsEcl88CSNWNLLTR~hsCwYOPS0gQAznL0MIucVssdk6m1BXijIEQedmqDttgQccCFRAsHa~tNzTMwGG12g0QawVag2pI8Zc9IepUcZn~t~sXJwYu0E3fs98oXZjoMIKTFW7e2sfgMN~PnrmN-adioHazUR~03IA__&Key-Pair-Id=APKAJCILBXEJFZF4DCHQ", + "id": 4560116, + "external_id": null, + "created_date": "2024-09-24 20:35:12", + "updated_date": "2024-09-24 20:35:12", + "img_thumbnail_url": "https://scdn.veryfi.com/bank_statements/919ba4778c039560/7cab1444-cfb4-42b6-bb05-c9adb1a7461d/thumbnail.png?Expires=1727836701&Signature=dF67o51T3iHpG~wwPh1nuiU-IO9QSoPuS9VnOsnbW8TCexlhI5yYLLbUIUC-qkCa-EwIOq20vWf7HPTE6zEVegUUFY3iHo3C7s3PemsEGISI969HB4VPJ95Wm2hOcvWFN4NYhlRdJtzhGp-rYUuappd-HWlXNBXjJUcXJU12kXapB67c7vxho~pJPasyQHRnI3yhwFCth~Wgp8GDAqc~637qrfEvkPAQjA66j0UOeDF6IbagZ~qeZc8gq4L0XOTTjHjGjlXswqWFpswpl1wyYU-IXDFJlG~lHlR0DgYx9kgbKkXalmow1-MmXXbxAmJIPVPwsmDl~s~4ywX~7If5rw__&Key-Pair-Id=APKAJCILBXEJFZF4DCHQ", + "account_holder_address": "San Mateo", + "account_holder_name": "Mr Robot Roboto", + "account_number": "1111111", + "account_type": "CURRENT ACCOUNT", + "bank_address": "The Mound, Edinburgh EH1 1YZ.", + "bank_name": "Royal Bank of Scotland Plc.", + "bank_website": null, + "beginning_balance": 1803.9, + "due_date": null, + "ending_balance": 300.2, + "minimum_due": null, + "period_end_date": "2023-12-21", + "period_start_date": "2023-10-22", + "routing_number": "16-10-00", + "statement_date": null, + "statement_number": null, + "currency_code": "GBP", + "iban_number": "GB11RBOS 1610 0011 1111 11", + "swift": "RBOSGB2L", + "account_vat_number": null, + "bank_vat_number": "SC327000" + }, + { + "transactions": [ + { + "order": 0, + "account_number": "1111111", + "balance": 1803.9, + "card_number": null, + "credit_amount": null, + "date": "2013-10-22", + "debit_amount": 190.4, + "description": "AUTOMATED PAY IN 650274051211-CHB\nCALL REF. NO. 3442, FROM", + "transaction_id": null, + "text": "22 Oct 2013 AUTOMATED PAY IN 650274051211-CHB\t\t\t\t190.40\t1803.9\nCALL REF. NO. 3442, FROM" + }, + { + "order": 1, + "account_number": "1111111", + "balance": 1613.5, + "card_number": null, + "credit_amount": null, + "date": "2013-10-22", + "debit_amount": 140, + "description": "DIGITAL BANKING\nA/C 22222222", + "transaction_id": null, + "text": "22 Oct 2013 DIGITAL BANKING\t\t\t\t\t\t140.00\t1613.5\nA/C 22222222" + }, + { + "order": 2, + "account_number": "1111111", + "balance": 1473.5, + "card_number": null, + "credit_amount": null, + "date": "2013-10-24", + "debit_amount": 132.3, + "description": "Amazon", + "transaction_id": null, + "text": "24 Oct 2013 Faster Payment\tAmazon\t\t\t\t\t132.30\t1473.5" + }, + { + "order": 3, + "account_number": "1111111", + "balance": 1341.2, + "card_number": null, + "credit_amount": null, + "date": "2013-10-24", + "debit_amount": 515.22, + "description": "Tebay Trading Co.", + "transaction_id": null, + "text": "24 Oct 2013 BACS\tTebay Trading Co.\t\t\t\t515.22\t1341.2" + }, + { + "order": 4, + "account_number": "1111111", + "balance": 825.98, + "card_number": null, + "credit_amount": null, + "date": "2013-10-25", + "debit_amount": 80, + "description": "Morrisons Petrol", + "transaction_id": null, + "text": "25 Oct 2013 Faster Payment\tMorrisons Petrol\t\t\t\t80.00\t825.98" + }, + { + "order": 5, + "account_number": "1111111", + "balance": 745.98, + "card_number": null, + "credit_amount": 20000, + "date": "2013-10-25", + "debit_amount": null, + "description": "Business Loan", + "transaction_id": null, + "text": "25 Oct 2013 BACS\tBusiness Loan\t\t20,000.00\t\t745.98" + }, + { + "order": 6, + "account_number": "1111111", + "balance": 20745.98, + "card_number": null, + "credit_amount": null, + "date": "2013-10-26", + "debit_amount": 2461.55, + "description": "James White Media", + "transaction_id": null, + "text": "26 Oct 2013 BACS\tJames White Media\t\t\t2,461.55\t20745.98" + }, + { + "order": 7, + "account_number": "1111111", + "balance": 18284.43, + "card_number": null, + "credit_amount": null, + "date": "2013-10-27", + "debit_amount": 100, + "description": "ATM High Street", + "transaction_id": null, + "text": "27 Oct 2013 Faster Payment\tATM High Street\t\t\t\t100.00\t18284.43" + }, + { + "order": 8, + "account_number": "1111111", + "balance": 18184.43, + "card_number": null, + "credit_amount": null, + "date": "2013-11-01", + "debit_amount": 150, + "description": "Acorn Advertising Studies", + "transaction_id": null, + "text": "01 Nov 2013 BACS\tAcorn Advertising Studies\t\t\t150.00\t18184.43" + }, + { + "order": 9, + "account_number": "1111111", + "balance": 18034.43, + "card_number": null, + "credit_amount": null, + "date": "2013-11-01", + "debit_amount": 177, + "description": "Marriott Hotel", + "transaction_id": null, + "text": "01 Nov 2013 BACS\tMarriott Hotel\t\t\t\t177.00\t18034.43" + }, + { + "order": 10, + "account_number": "1111111", + "balance": 17857.43, + "card_number": null, + "credit_amount": null, + "date": "2013-11-01", + "debit_amount": 122.22, + "description": "Abellio Scotrail Ltd", + "transaction_id": null, + "text": "01 Nov 2013 Faster Payment\tAbellio Scotrail Ltd\t\t\t\t122.22\t17857.43" + }, + { + "order": 11, + "account_number": "1111111", + "balance": 17735.21, + "card_number": null, + "credit_amount": null, + "date": "2013-11-01", + "debit_amount": 1200, + "description": "Cheque 0000234", + "transaction_id": null, + "text": "01 Nov 2013 CHQ\tCheque 0000234\t\t\t\t1,200.00\t17735.21" + }, + { + "order": 12, + "account_number": "1111111", + "balance": 16535.21, + "card_number": null, + "credit_amount": 9.33, + "date": "2013-12-01", + "debit_amount": null, + "description": "Interest Paid", + "transaction_id": null, + "text": "01 Dec 2013 Int. Bank\tInterest Paid\t\t\t9.33\t\t16535.21" + }, + { + "order": 13, + "account_number": "1111111", + "balance": 16544.54, + "card_number": null, + "credit_amount": null, + "date": "2013-12-01", + "debit_amount": 2470, + "description": "OVO Energy", + "transaction_id": null, + "text": "01 Dec 2013 DD\t\tOVO Energy\t\t\t\t2470.00\t16544.54" + }, + { + "order": 14, + "account_number": "1111111", + "balance": 14074.54, + "card_number": null, + "credit_amount": null, + "date": "2013-12-21", + "debit_amount": 10526.4, + "description": "Various Payment", + "transaction_id": null, + "text": "21 Dec 2013 BACS\tVarious Payment\t\t\t\t10,526.40\t14074.54" + }, + { + "order": 15, + "account_number": "1111111", + "balance": 3548.14, + "card_number": null, + "credit_amount": null, + "date": "2013-12-21", + "debit_amount": 1000, + "description": "HMRC", + "transaction_id": null, + "text": "21 Dec 2013 BACS\tHMRC\t\t\t\t\t1,000.00\t3548.14" + }, + { + "order": 16, + "account_number": "1111111", + "balance": 2548.14, + "card_number": null, + "credit_amount": null, + "date": "2013-12-21", + "debit_amount": 280, + "description": "DVLA", + "transaction_id": null, + "text": "21 Dec 2013 DD\t\tDVLA\t\t\t\t\t280.00\t2548.14" + } + ], + "summaries": [ + { + "name": "Paid Out", + "total": 2684.1 + }, + { + "name": "Paid In", + "total": 2180.4 + } + ], + "account_numbers": [ + "1111111" + ], + "routing_numbers": [ + "16-10-00" + ], + "pdf_url": "https://scdn.veryfi.com/bank_statements/919ba4778c039560/71012cd5-f220-4d21-9e92-9c393841566f/90c21d34-2ca0-472e-b687-8d642357289a.pdf?Expires=1727836701&Signature=XceFB9tCLPkzCWeB4-Hu9qMp2yF64jaPjN1RVIxzVrbL77MpLjqt8rEgOJTXdXRLExQIDAHVSjZPk5iE9lthU3uSYKlLxrOJmwvSBIEnc1aT9-srRSvXIJ8UYQuwma6iuHW27ZmH1cvxLlhLjB2khaRYizZR2ibx2onr9oHtAASnVWgncIXZcKCtO8OF5SHgmtCTppSPQq~Zby335yc1L~MkLfjqJo86qOE21OlImgLMk2BTTS29-EnP8Mjg7zmOGS7~oYmf~Kx2dJ2QCKnRnED4AOaAClFJE325ml0uAF0C-tjQrQ~hGl8SCnMNgT3Qvj21YIEO2kRd-WpMVr9okg__&Key-Pair-Id=APKAJCILBXEJFZF4DCHQ", + "id": 4559573, + "external_id": null, + "created_date": "2024-09-24 18:46:05", + "updated_date": "2024-09-24 18:46:05", + "img_thumbnail_url": "https://scdn.veryfi.com/bank_statements/919ba4778c039560/71012cd5-f220-4d21-9e92-9c393841566f/thumbnail.png?Expires=1727836701&Signature=KnYyEqCFJcYE7hngjf6vC9Zw3UiFNQ3r89FxZ3E2TLaUHV142Hpve~tnmz~oyLP8renq37dQbvxguziwIE0iNmL~mKdivWeosmK~oJ8jllPnksu2whOope5BsxzBydzNGZeRPB9JTtQdi7vZCh3cppitETr9DbfoSAPg~ery07WmUSaEtqgaGvU56x1b297bsh63JIvF4zhe2Os5BEmvwSGP6lQ~BYxdbYWe5yQWaHPKOtQy-ewWCdUuYh44jRdgunZzBOocpZpak6206SY7WF5L7W~38ClxVXFF1rasBK1Ix8Po~gW6DYrrRQ4jZh5MwLlfZ-s2wTu-EHtDuwuybA__&Key-Pair-Id=APKAJCILBXEJFZF4DCHQ", + "account_holder_address": "San Mateo", + "account_holder_name": "Mr Robot Roboto", + "account_number": "1111111", + "account_type": "CURRENT ACCOUNT", + "bank_address": "The Mound, Edinburgh EH1 1YZ.", + "bank_name": "Royal Bank of Scotland Plc.", + "bank_website": null, + "beginning_balance": 1803.9, + "due_date": null, + "ending_balance": 300.2, + "minimum_due": null, + "period_end_date": "2023-12-21", + "period_start_date": "2023-10-22", + "routing_number": "16-10-00", + "statement_date": null, + "statement_number": null, + "currency_code": "GBP", + "iban_number": "GB11RBOS 1610 0011 1111 11", + "swift": "RBOSGB2L", + "account_vat_number": null, + "bank_vat_number": "SC327000" + }, + { + "transactions": [ + { + "order": 0, + "account_number": "1111111", + "balance": 1803.9, + "card_number": null, + "credit_amount": null, + "date": "2013-10-22", + "debit_amount": 190.4, + "description": "AUTOMATED PAY IN 650274051211-CHB\nCALL REF. NO. 3442, FROM", + "transaction_id": null, + "text": "22 Oct 2013 AUTOMATED PAY IN 650274051211-CHB\t\t\t\t190.40\t1803.9\nCALL REF. NO. 3442, FROM" + }, + { + "order": 1, + "account_number": "1111111", + "balance": 1613.5, + "card_number": null, + "credit_amount": null, + "date": "2013-10-22", + "debit_amount": 140, + "description": "DIGITAL BANKING\nA/C 22222222", + "transaction_id": null, + "text": "22 Oct 2013 DIGITAL BANKING\t\t\t\t\t\t140.00\t1613.5\nA/C 22222222" + }, + { + "order": 2, + "account_number": "1111111", + "balance": 1473.5, + "card_number": null, + "credit_amount": null, + "date": "2013-10-24", + "debit_amount": 132.3, + "description": "Amazon", + "transaction_id": null, + "text": "24 Oct 2013 Faster Payment\tAmazon\t\t\t\t\t132.30\t1473.5" + }, + { + "order": 3, + "account_number": "1111111", + "balance": 1341.2, + "card_number": null, + "credit_amount": null, + "date": "2013-10-24", + "debit_amount": 515.22, + "description": "Tebay Trading Co.", + "transaction_id": null, + "text": "24 Oct 2013 BACS\tTebay Trading Co.\t\t\t\t515.22\t1341.2" + }, + { + "order": 4, + "account_number": "1111111", + "balance": 825.98, + "card_number": null, + "credit_amount": null, + "date": "2013-10-25", + "debit_amount": 80, + "description": "Morrisons Petrol", + "transaction_id": null, + "text": "25 Oct 2013 Faster Payment\tMorrisons Petrol\t\t\t\t80.00\t825.98" + }, + { + "order": 5, + "account_number": "1111111", + "balance": 745.98, + "card_number": null, + "credit_amount": 20000, + "date": "2013-10-25", + "debit_amount": null, + "description": "Business Loan", + "transaction_id": null, + "text": "25 Oct 2013 BACS\tBusiness Loan\t\t20,000.00\t\t745.98" + }, + { + "order": 6, + "account_number": "1111111", + "balance": 20745.98, + "card_number": null, + "credit_amount": null, + "date": "2013-10-26", + "debit_amount": 2461.55, + "description": "James White Media", + "transaction_id": null, + "text": "26 Oct 2013 BACS\tJames White Media\t\t\t2,461.55\t20745.98" + }, + { + "order": 7, + "account_number": "1111111", + "balance": 18284.43, + "card_number": null, + "credit_amount": null, + "date": "2013-10-27", + "debit_amount": 100, + "description": "ATM High Street", + "transaction_id": null, + "text": "27 Oct 2013 Faster Payment\tATM High Street\t\t\t\t100.00\t18284.43" + }, + { + "order": 8, + "account_number": "1111111", + "balance": 18184.43, + "card_number": null, + "credit_amount": null, + "date": "2013-11-01", + "debit_amount": 150, + "description": "Acorn Advertising Studies", + "transaction_id": null, + "text": "01 Nov 2013 BACS\tAcorn Advertising Studies\t\t\t150.00\t18184.43" + }, + { + "order": 9, + "account_number": "1111111", + "balance": 18034.43, + "card_number": null, + "credit_amount": null, + "date": "2013-11-01", + "debit_amount": 177, + "description": "Marriott Hotel", + "transaction_id": null, + "text": "01 Nov 2013 BACS\tMarriott Hotel\t\t\t\t177.00\t18034.43" + }, + { + "order": 10, + "account_number": "1111111", + "balance": 17857.43, + "card_number": null, + "credit_amount": null, + "date": "2013-11-01", + "debit_amount": 122.22, + "description": "Abellio Scotrail Ltd", + "transaction_id": null, + "text": "01 Nov 2013 Faster Payment\tAbellio Scotrail Ltd\t\t\t\t122.22\t17857.43" + }, + { + "order": 11, + "account_number": "1111111", + "balance": 17735.21, + "card_number": null, + "credit_amount": null, + "date": "2013-11-01", + "debit_amount": 1200, + "description": "Cheque 0000234", + "transaction_id": null, + "text": "01 Nov 2013 CHQ\tCheque 0000234\t\t\t\t1,200.00\t17735.21" + }, + { + "order": 12, + "account_number": "1111111", + "balance": 16535.21, + "card_number": null, + "credit_amount": 9.33, + "date": "2013-12-01", + "debit_amount": null, + "description": "Interest Paid", + "transaction_id": null, + "text": "01 Dec 2013 Int. Bank\tInterest Paid\t\t\t9.33\t\t16535.21" + }, + { + "order": 13, + "account_number": "1111111", + "balance": 16544.54, + "card_number": null, + "credit_amount": null, + "date": "2013-12-01", + "debit_amount": 2470, + "description": "OVO Energy", + "transaction_id": null, + "text": "01 Dec 2013 DD\t\tOVO Energy\t\t\t\t2470.00\t16544.54" + }, + { + "order": 14, + "account_number": "1111111", + "balance": 14074.54, + "card_number": null, + "credit_amount": null, + "date": "2013-12-21", + "debit_amount": 10526.4, + "description": "Various Payment", + "transaction_id": null, + "text": "21 Dec 2013 BACS\tVarious Payment\t\t\t\t10,526.40\t14074.54" + }, + { + "order": 15, + "account_number": "1111111", + "balance": 3548.14, + "card_number": null, + "credit_amount": null, + "date": "2013-12-21", + "debit_amount": 1000, + "description": "HMRC", + "transaction_id": null, + "text": "21 Dec 2013 BACS\tHMRC\t\t\t\t\t1,000.00\t3548.14" + }, + { + "order": 16, + "account_number": "1111111", + "balance": 2548.14, + "card_number": null, + "credit_amount": null, + "date": "2013-12-21", + "debit_amount": 280, + "description": "DVLA", + "transaction_id": null, + "text": "21 Dec 2013 DD\t\tDVLA\t\t\t\t\t280.00\t2548.14" + } + ], + "summaries": [ + { + "name": "Paid Out", + "total": 2684.1 + }, + { + "name": "Paid In", + "total": 2180.4 + } + ], + "account_numbers": [ + "1111111" + ], + "routing_numbers": [ + "16-10-00" + ], + "pdf_url": "https://scdn.veryfi.com/bank_statements/919ba4778c039560/f02a38ed-e486-4d30-8354-23c25a0a4446/fe286c1b-bbdb-4a10-b9a8-81546f229de8.pdf?Expires=1727836701&Signature=WlABfYnVryU6DKaMkmztdROJP-Tp6f1RqnoauiPZ0LWyb3gab5-V-L1VevYO-qgKUuYwPJtFkmewqfRAE61BYVkrKTWh6-c6J5aLl~KvTpr0Td5hrqHQ5up-vrJxxlL2BVu6ZoCK1NTX7YzP95aM-UQWWxCBF~VfKYrJlk--JApiXo6d-kaYBsMsa3q24s9dXRKXafak6uVs7Db6wb0HlKKKn1jY3lR9LGQWbAxqqcp13R-H95OKnSWUfVJ1Cy147LVszBYGG3w2XGK3Umm1W5eNAY~otjckH2u-gKB1ckbeAxqSNfAnUj6rQbpGqomFCUAWiJUL5J8pBFKLoLEFMg__&Key-Pair-Id=APKAJCILBXEJFZF4DCHQ", + "id": 4559568, + "external_id": null, + "created_date": "2024-09-24 18:43:46", + "updated_date": "2024-09-24 18:43:46", + "img_thumbnail_url": "https://scdn.veryfi.com/bank_statements/919ba4778c039560/f02a38ed-e486-4d30-8354-23c25a0a4446/thumbnail.png?Expires=1727836701&Signature=f7jJEQ0NcCKEhg~sxvL~9isSqim~11mabt94fXSlRHnf1hFTsZMPaBcnCyCcR8nU04wNAdUbimevm6BBu2~KrGEv3FRb5QQfXKPLxj9klQ6Md-wLLPiD9DHF-oj7LcZ8lmGzhrmFTVcdiyVqWmhit7fgsiWaLKvSQCUWR8WTPCxuZf4gO3v3fPPj5VVU68KuzMZrkULpHk~ucRFO15EE~mOV-k7MKaQc~3gn9K6vW3dq3Qg9mIMiYDF-oqEHGm9D8I23iAdvyUD-CGLzQMS53618EwFHZcK6mg3LcTGlT3J8VOYCUncpGFGwnMYr7vvUOijAUKGAGIPj7mjV~XhxTA__&Key-Pair-Id=APKAJCILBXEJFZF4DCHQ", + "account_holder_address": "San Mateo", + "account_holder_name": "Mr Robot Roboto", + "account_number": "1111111", + "account_type": "CURRENT ACCOUNT", + "bank_address": "The Mound, Edinburgh EH1 1YZ.", + "bank_name": "Royal Bank of Scotland Plc.", + "bank_website": null, + "beginning_balance": 1803.9, + "due_date": null, + "ending_balance": 300.2, + "minimum_due": null, + "period_end_date": "2023-12-21", + "period_start_date": "2023-10-22", + "routing_number": "16-10-00", + "statement_date": null, + "statement_number": null, + "currency_code": "GBP", + "iban_number": "GB11RBOS 1610 0011 1111 11", + "swift": "RBOSGB2L", + "account_vat_number": null, + "bank_vat_number": "SC327000" + } + ] +} diff --git a/Tests/VeryfiSDKTests/Resources/getW2.json b/Tests/VeryfiSDKTests/Resources/getW2.json new file mode 100644 index 0000000..be172af --- /dev/null +++ b/Tests/VeryfiSDKTests/Resources/getW2.json @@ -0,0 +1,61 @@ +{ + "pdf_url": "https://scdn.veryfi.com/w2s/919ba4778c039560/431b3596-5734-4b7c-a250-ec953d379a46/514ae5d8-59aa-4d57-92a4-4bea0facd86a.pdf?Expires=1729886718&Signature=W99pSvYLd9DLDCNCZSvcuE-~0VZhMQm~R5yecMpy0WvDSkpNZWd9t3ltQS51S1KIF8YYsZVB-Dz15PZsrQfyOiN3dFQMHJzrgbAgwi~cofMo7QgHa8oML0LAD7LvpXqG5ldKRlpfvsCTqKv99L2nuXM7xFE9NbitwqSCB3BVuwdqFbWGTLRqmdMWDBWs1hOLF~5bpjWt2ssZ7rreWgbhCwyMiLj59GUlI4MN43zd~9T0akSOHvX0AYn70eZ3FF~FWQtydgIyQxwtyKd4CCwSUtPkywFIPnPF57WQ03hDfJbhjgXwBBNPMNGmijEwoVT33Uqnco-6Nq6y3tkea6GSbA__&Key-Pair-Id=APKAJCILBXEJFZF4DCHQ", + "id": 4609400, + "external_id": null, + "created_date": "2024-10-09 21:14:48", + "updated_date": "2024-10-09 21:14:48", + "img_thumbnail_url": "https://scdn.veryfi.com/w2s/919ba4778c039560/431b3596-5734-4b7c-a250-ec953d379a46/thumbnail.jpg?Expires=1729886718&Signature=Fy7ax21F69vBku3HIoW1mjvTaAQ2C-hhxA5vOiFTCrb1BNRkgLKg5N-~-6c5miUWYKt2UoaiLGlLfxxQ~ub-O-T2WdGah6vTf3BITAzgLHPS04HzOdoJMzPKMQ5zTI8SjlYSTRpHRStHjkZ3mEXUp3oQ~XjB~V5T-vpTaLO7HTF2JDdZOuxpgbI88iyJKKPV4WASKM4TAOZBICSVLjEdzd9nS5Jjw4nwV~UYRbRKQ0la0YXmeGh0s3BzVniH1kkzwsFHZLQ9Z3RAzEQY-7etLbjZBJ75SG-PvoGxmuCbnUs7d-vyyJDLxl3Oy3kazJUc0Jev~3ntJWIOA7kgiY1nRw__&Key-Pair-Id=APKAJCILBXEJFZF4DCHQ", + "advance_eic_payment": null, + "employee_ssn": "123-45-6879", + "ein": "46-1234567", + "employer_name": "BESTEST HOSPITAL EVER, INC.", + "employer_address": "123 PAYNE LANE\nPOSTCALL, NY 11111", + "control_number": null, + "employee_name": "DOCTORED B. MONEY", + "employee_address": "80 WORKHOURS WAY\nSLEEPLESS HOLLOW, NY 11222", + "wages_other_comps": 55000.0, + "federal_income_tax": 4000.0, + "ss_wages": 60000.0, + "ss_tax": 3720.0, + "medicare_wages": 60000.0, + "medicare_tax": 870.0, + "ss_tips": null, + "allocated_tips": null, + "dependent_care_benefits": null, + "non_qualified_plans": null, + "state": "NY", + "employer_state_id": null, + "state_wages_tips": 60000.0, + "state_income_tax": 1500.0, + "local_wages_tips": 60000.0, + "local_income_tax": 500.0, + "locality_name": "NYC", + "field_12a_col1": null, + "field_12a_col2": 45.5, + "field_12b_col1": "E", + "field_12b_col2": 5000.0, + "field_12c_col1": "DD", + "field_12c_col2": 9800.57, + "field_12d_col1": null, + "field_12d_col2": null, + "is_13a": false, + "is_13b": true, + "is_13c": false, + "states": [ + { + "state": "NY", + "employer_state_id": null, + "state_wages_tips": 60000.0, + "state_income_tax": 1500.0, + "local_wages_tips": 60000.0, + "local_income_tax": 500.0, + "locality_name": "NYC" + } + ], + "field_14_other": [ + { + "column_1": "NY SDI", + "column_2": 31.2 + } + ] +} diff --git a/Tests/VeryfiSDKTests/Resources/getW2s.json b/Tests/VeryfiSDKTests/Resources/getW2s.json new file mode 100644 index 0000000..793f11b --- /dev/null +++ b/Tests/VeryfiSDKTests/Resources/getW2s.json @@ -0,0 +1,126 @@ +{ + "count": 207, + "next": "", + "previous": "", + "results": [ + { + "pdf_url": "https://scdn.veryfi.com/w2s/919ba4778c039560/431b3596-5734-4b7c-a250-ec953d379a46/514ae5d8-59aa-4d57-92a4-4bea0facd86a.pdf?Expires=1729886718&Signature=W99pSvYLd9DLDCNCZSvcuE-~0VZhMQm~R5yecMpy0WvDSkpNZWd9t3ltQS51S1KIF8YYsZVB-Dz15PZsrQfyOiN3dFQMHJzrgbAgwi~cofMo7QgHa8oML0LAD7LvpXqG5ldKRlpfvsCTqKv99L2nuXM7xFE9NbitwqSCB3BVuwdqFbWGTLRqmdMWDBWs1hOLF~5bpjWt2ssZ7rreWgbhCwyMiLj59GUlI4MN43zd~9T0akSOHvX0AYn70eZ3FF~FWQtydgIyQxwtyKd4CCwSUtPkywFIPnPF57WQ03hDfJbhjgXwBBNPMNGmijEwoVT33Uqnco-6Nq6y3tkea6GSbA__&Key-Pair-Id=APKAJCILBXEJFZF4DCHQ", + "id": 4609400, + "external_id": null, + "created_date": "2024-10-09 21:14:48", + "updated_date": "2024-10-09 21:14:48", + "img_thumbnail_url": "https://scdn.veryfi.com/w2s/919ba4778c039560/431b3596-5734-4b7c-a250-ec953d379a46/thumbnail.jpg?Expires=1729886718&Signature=Fy7ax21F69vBku3HIoW1mjvTaAQ2C-hhxA5vOiFTCrb1BNRkgLKg5N-~-6c5miUWYKt2UoaiLGlLfxxQ~ub-O-T2WdGah6vTf3BITAzgLHPS04HzOdoJMzPKMQ5zTI8SjlYSTRpHRStHjkZ3mEXUp3oQ~XjB~V5T-vpTaLO7HTF2JDdZOuxpgbI88iyJKKPV4WASKM4TAOZBICSVLjEdzd9nS5Jjw4nwV~UYRbRKQ0la0YXmeGh0s3BzVniH1kkzwsFHZLQ9Z3RAzEQY-7etLbjZBJ75SG-PvoGxmuCbnUs7d-vyyJDLxl3Oy3kazJUc0Jev~3ntJWIOA7kgiY1nRw__&Key-Pair-Id=APKAJCILBXEJFZF4DCHQ", + "advance_eic_payment": null, + "employee_ssn": "123-45-6879", + "ein": "46-1234567", + "employer_name": "BESTEST HOSPITAL EVER, INC.", + "employer_address": "123 PAYNE LANE\nPOSTCALL, NY 11111", + "control_number": null, + "employee_name": "DOCTORED B. MONEY", + "employee_address": "80 WORKHOURS WAY\nSLEEPLESS HOLLOW, NY 11222", + "wages_other_comps": 55000.0, + "federal_income_tax": 4000.0, + "ss_wages": 60000.0, + "ss_tax": 3720.0, + "medicare_wages": 60000.0, + "medicare_tax": 870.0, + "ss_tips": null, + "allocated_tips": null, + "dependent_care_benefits": null, + "non_qualified_plans": null, + "state": "NY", + "employer_state_id": null, + "state_wages_tips": 60000.0, + "state_income_tax": 1500.0, + "local_wages_tips": 60000.0, + "local_income_tax": 500.0, + "locality_name": "NYC", + "field_12a_col1": null, + "field_12a_col2": 45.5, + "field_12b_col1": "E", + "field_12b_col2": 5000.0, + "field_12c_col1": "DD", + "field_12c_col2": 9800.57, + "field_12d_col1": null, + "field_12d_col2": null, + "is_13a": false, + "is_13b": true, + "is_13c": false, + "states": [ + { + "state": "NY", + "employer_state_id": null, + "state_wages_tips": 60000.0, + "state_income_tax": 1500.0, + "local_wages_tips": 60000.0, + "local_income_tax": 500.0, + "locality_name": "NYC" + } + ], + "field_14_other": [ + { + "column_1": "NY SDI", + "column_2": 31.2 + } + ] + }, + { + "pdf_url": "https://scdn.veryfi.com/w2s/919ba4778c039560/a3620623-c2ba-461f-a204-3a8cac30567c/8498a62b-08db-45ff-8351-269061e93ac9.pdf?Expires=1729886718&Signature=YJryO1angWiI9hlHn5nEFtjDMqLy0XIntCDz8manMHdwC9Itkfw-O50-YxgNkLB37XxezgcwgnHTzX7t7WE6~YwDWHaFnKFbhqT8i6sbiPKpBx4sFjUOc~LK77QqPjYSwN4zX~Ri0FPfEQRmw4U9qaV4Mrg42HnnAXWcNpMt28keXVUfaIY3DLJigAN1yl-265zlGHeu5nvIFxTv8D9YJQdpsdS5CGovha5tlOaHHzmZcECNHtlmJuqcWyPJMz0PRPiuYEBEzCAP374o2PUWnNW28Qpn-PVRqfZgma5g2Noxgc58hAAJt~pjmsmwKYfgtYS-41vADolj-dq50p8Qgw__&Key-Pair-Id=APKAJCILBXEJFZF4DCHQ", + "id": 4588178, + "external_id": null, + "created_date": "2024-10-02 15:49:58", + "updated_date": "2024-10-02 15:49:58", + "img_thumbnail_url": "https://scdn.veryfi.com/w2s/919ba4778c039560/a3620623-c2ba-461f-a204-3a8cac30567c/thumbnail.jpg?Expires=1729886718&Signature=b6w2b1qYmt6xjz60epo2tKRm3r2cbIWB6LlNLnk7ufv37QSGwiarGFLIBxMQijayhwgzhKxEn~IIrJvW0dQwO5aG8sQeQUCseUh8Lf3bxavYK8LcqbgvjD4j7-QD3jDciJYKVn0JQut8Cm9C75ldRqBXqc3e48zj2TjpQYYdxRZMigV1hH1w6WNpxI6Ev2jgLL1YcQyxtwpizRcM8tEYRT9j6Ib3JKio2IMGwrXtEx5cekRe0H~taLzxQoP-VQRr~AApLyI-SZPOK0jliA2-wcXrsrtqX~6VGgk-SwI-miA~FS7pYhf1pexM-q1Selx1bGaXl9vKlzrO2qj6usYT9A__&Key-Pair-Id=APKAJCILBXEJFZF4DCHQ", + "advance_eic_payment": null, + "employee_ssn": null, + "ein": null, + "employer_name": null, + "employer_address": "600 SHOWERS DR\nMOUNTAIN VIEW CA 94040", + "control_number": null, + "employee_name": null, + "employee_address": null, + "wages_other_comps": null, + "federal_income_tax": null, + "ss_wages": null, + "ss_tax": null, + "medicare_wages": null, + "medicare_tax": null, + "ss_tips": null, + "allocated_tips": null, + "dependent_care_benefits": null, + "non_qualified_plans": null, + "state": null, + "employer_state_id": null, + "state_wages_tips": null, + "state_income_tax": null, + "local_wages_tips": null, + "local_income_tax": null, + "locality_name": null, + "field_12a_col1": null, + "field_12a_col2": null, + "field_12b_col1": "F", + "field_12b_col2": 3.68, + "field_12c_col1": null, + "field_12c_col2": null, + "field_12d_col1": null, + "field_12d_col2": null, + "is_13a": false, + "is_13b": false, + "is_13c": false, + "states": [ + { + "state": null, + "employer_state_id": null, + "state_wages_tips": null, + "state_income_tax": null, + "local_wages_tips": null, + "local_income_tax": null, + "locality_name": null + } + ], + "field_14_other": [ + + ] + } + ] +} diff --git a/Tests/VeryfiSDKTests/Resources/processAnyDocument.json b/Tests/VeryfiSDKTests/Resources/processAnyDocument.json new file mode 100644 index 0000000..8d35c31 --- /dev/null +++ b/Tests/VeryfiSDKTests/Resources/processAnyDocument.json @@ -0,0 +1,23 @@ +{ + "pdf_url": "https://scdn.veryfi.com/other-documents/919ba4778c039560/3fdeaa4a-b107-4679-8a38-1ec3f74ba5c2/f1ed4316-9ef8-4534-8255-13eac6decca4.pdf?Expires=1727835564&Signature=aYukFctZby8apqSVlVQmnNnHnoPGWtyyQxvD15jCxnK5UHSzfyqore3IcxHnGbAK-8d~MZ8UNCJ~GLJdSmW7gIRodd~GsTWi4Dzg3S9p9aiYiTXYmpex8EIGWfdYV2AcUysLPs1R07C8j3G2ubB5L04zQ8rrHL7GR6liCOVUphmgvTPVv1Ed~RBZvEPct2WZvDf5oYaV7EXr51SN9u2WcNBRMbqVO89dPOajW2ynXgNZ9Z05I0Id3EpITMrUXOrr4lOBMxOtYtAjDGsApjERMReRQbrqKpO7xKyDTgdOXfRxFGs6tQRVLR47N~4fH2-RM8-5HDgpQvWw~SZV6UTLdw__&Key-Pair-Id=APKAJCILBXEJFZF4DCHQ", + "id": 4587125, + "external_id": null, + "created_date": "2024-10-02 02:04:24", + "updated_date": "2024-10-02 02:04:24", + "img_thumbnail_url": "https://scdn.veryfi.com/other-documents/919ba4778c039560/3fdeaa4a-b107-4679-8a38-1ec3f74ba5c2/thumbnail.png?Expires=1727835564&Signature=aPNGLyQxA8GUxvocnRFVTcEcMYZO1OqawEQDaeS6l9yGf0Ey-Fl~awlI5SymaYSFHwTEQuNkfksnAAFe-4li49CoyVSSwhHmIgq~oZTAdvFfXJTgI4LAHeSPaqVeKi2gbxX6yqDXs~u7PvoCbwTfzTNgkS0scdKrCbSYIuLAs51FsZwGWPzY8Hy~D1PiXruTlGRyaatrPt8~yb1vuGg~F7Uzg-gC2JrpjJqgusr5FVW9mYoRoETckd6GOr~fty~FncgB96fZUUCRqreR2qBzFXvg7FT3jiHmAVyPu56QWeOF8BGaCRQyChNkV8x6ZBPnEO2zzimjeEVINMp2XH3~dw__&Key-Pair-Id=APKAJCILBXEJFZF4DCHQ", + "blueprint_name": "us_driver_license", + "template_name": "us_driver_license", + "address": "892 MOMONA ST HONOLULU, HI 96820", + "birth_date": "1981-06-03", + "expiration_date": "2008-06-03", + "eyes_color": "BRO", + "first_name": null, + "height": "5-10", + "issue_date": "1998-06-18", + "last_name": "McLovin", + "license_class": "3", + "license_number": "01-47-87441", + "sex": "M", + "state": "HAWAII", + "weight": "150" +} diff --git a/Tests/VeryfiSDKTests/Resources/processBankStatement.json b/Tests/VeryfiSDKTests/Resources/processBankStatement.json new file mode 100644 index 0000000..541121d --- /dev/null +++ b/Tests/VeryfiSDKTests/Resources/processBankStatement.json @@ -0,0 +1,251 @@ +{ + "transactions": [ + { + "order": 0, + "account_number": "1111111", + "balance": 1803.9, + "card_number": null, + "credit_amount": null, + "date": "2013-10-22", + "debit_amount": 190.4, + "description": "PAY IN 650274051211-CHB\nCALL REF. NO. 3442, FROM", + "transaction_id": null, + "text": "22 Oct 2013 AUTOMATED PAY IN 650274051211-CHB\t\t\t\t190.40\t1803.9\nCALL REF. NO. 3442, FROM" + }, + { + "order": 1, + "account_number": "1111111", + "balance": 1613.5, + "card_number": null, + "credit_amount": null, + "date": "2013-10-22", + "debit_amount": 140, + "description": "BANKING\nA/C 22222222", + "transaction_id": null, + "text": "22 Oct 2013 DIGITAL BANKING\t\t\t\t\t\t140.00\t1613.5\nA/C 22222222" + }, + { + "order": 2, + "account_number": "1111111", + "balance": 1473.5, + "card_number": null, + "credit_amount": null, + "date": "2013-10-24", + "debit_amount": 132.3, + "description": "Amazon", + "transaction_id": null, + "text": "24 Oct 2013 Faster Payment\tAmazon\t\t\t\t\t132.30\t1473.5" + }, + { + "order": 3, + "account_number": "1111111", + "balance": 1341.2, + "card_number": null, + "credit_amount": null, + "date": "2013-10-24", + "debit_amount": 515.22, + "description": "Tebay Trading Co.", + "transaction_id": null, + "text": "24 Oct 2013 BACS\tTebay Trading Co.\t\t\t\t515.22\t1341.2" + }, + { + "order": 4, + "account_number": "1111111", + "balance": 825.98, + "card_number": null, + "credit_amount": null, + "date": "2013-10-25", + "debit_amount": 80, + "description": "Morrisons Petrol", + "transaction_id": null, + "text": "25 Oct 2013 Faster Payment\tMorrisons Petrol\t\t\t\t80.00\t825.98" + }, + { + "order": 5, + "account_number": "1111111", + "balance": 745.98, + "card_number": null, + "credit_amount": 20000, + "date": "2013-10-25", + "debit_amount": null, + "description": "Business Loan", + "transaction_id": null, + "text": "25 Oct 2013 BACS\tBusiness Loan\t\t20,000.00\t\t745.98" + }, + { + "order": 6, + "account_number": "1111111", + "balance": 20745.98, + "card_number": null, + "credit_amount": null, + "date": "2013-10-26", + "debit_amount": 2461.55, + "description": "James White Media", + "transaction_id": null, + "text": "26 Oct 2013 BACS\tJames White Media\t\t\t2,461.55\t20745.98" + }, + { + "order": 7, + "account_number": "1111111", + "balance": 18284.43, + "card_number": null, + "credit_amount": null, + "date": "2013-10-27", + "debit_amount": 100, + "description": "ATM High Street", + "transaction_id": null, + "text": "27 Oct 2013 Faster Payment\tATM High Street\t\t\t\t100.00\t18284.43" + }, + { + "order": 8, + "account_number": "1111111", + "balance": 18184.43, + "card_number": null, + "credit_amount": null, + "date": "2013-11-01", + "debit_amount": 150, + "description": "Acorn Advertising Studies", + "transaction_id": null, + "text": "01 Nov 2013 BACS\tAcorn Advertising Studies\t\t\t150.00\t18184.43" + }, + { + "order": 9, + "account_number": "1111111", + "balance": 18034.43, + "card_number": null, + "credit_amount": null, + "date": "2013-11-01", + "debit_amount": 177, + "description": "Marriott Hotel", + "transaction_id": null, + "text": "01 Nov 2013 BACS\tMarriott Hotel\t\t\t\t177.00\t18034.43" + }, + { + "order": 10, + "account_number": "1111111", + "balance": 17857.43, + "card_number": null, + "credit_amount": null, + "date": "2013-11-01", + "debit_amount": 122.22, + "description": "Abellio Scotrail Ltd", + "transaction_id": null, + "text": "01 Nov 2013 Faster Payment\tAbellio Scotrail Ltd\t\t\t\t122.22\t17857.43" + }, + { + "order": 11, + "account_number": "1111111", + "balance": 17735.21, + "card_number": null, + "credit_amount": null, + "date": "2013-11-01", + "debit_amount": 1200, + "description": "Cheque 0000234", + "transaction_id": null, + "text": "01 Nov 2013 CHQ\tCheque 0000234\t\t\t\t1,200.00\t17735.21" + }, + { + "order": 12, + "account_number": "1111111", + "balance": 16535.21, + "card_number": null, + "credit_amount": 9.33, + "date": "2013-12-01", + "debit_amount": null, + "description": "Interest Paid", + "transaction_id": null, + "text": "01 Dec 2013 Int. Bank\tInterest Paid\t\t\t9.33\t\t16535.21" + }, + { + "order": 13, + "account_number": "1111111", + "balance": 16544.54, + "card_number": null, + "credit_amount": null, + "date": "2013-12-01", + "debit_amount": 2470, + "description": "OVO Energy", + "transaction_id": null, + "text": "01 Dec 2013 DD\t\tOVO Energy\t\t\t\t2470.00\t16544.54" + }, + { + "order": 14, + "account_number": "1111111", + "balance": 14074.54, + "card_number": null, + "credit_amount": null, + "date": "2013-12-21", + "debit_amount": 10526.4, + "description": "Various Payment", + "transaction_id": null, + "text": "21 Dec 2013 BACS\tVarious Payment\t\t\t\t10,526.40\t14074.54" + }, + { + "order": 15, + "account_number": "1111111", + "balance": 3548.14, + "card_number": null, + "credit_amount": null, + "date": "2013-12-21", + "debit_amount": 1000, + "description": "HMRC", + "transaction_id": null, + "text": "21 Dec 2013 BACS\tHMRC\t\t\t\t\t1,000.00\t3548.14" + }, + { + "order": 16, + "account_number": "1111111", + "balance": 2548.14, + "card_number": null, + "credit_amount": null, + "date": "2013-12-21", + "debit_amount": 280, + "description": "DVLA", + "transaction_id": null, + "text": "21 Dec 2013 DD\t\tDVLA\t\t\t\t\t280.00\t2548.14" + } + ], + "summaries": [ + { + "name": "Paid Out", + "total": 2684.1 + }, + { + "name": "Paid In", + "total": 2180.4 + } + ], + "account_numbers": [ + "1111111" + ], + "routing_numbers": [ + "16-10-00" + ], + "pdf_url": "https://scdn.veryfi.com/bank_statements/919ba4778c039560/a0340e88-e657-4616-b3e6-138fa6641426/e8c835fb-3dff-406f-aab2-4389c26351d6.pdf?Expires=1727837149&Signature=bylF8XxLMRG7-gntdsahIKSX9EfLNG8tyhXJ9C2Wh0NplgCg-PC1nNO0OWlXhgN0r1EoL3VYCzwj~cs5wCl7Ba2U6FqGPcZ46AVVPZKb-1WuW7MWAhdtIe9Y8xSkpxdC~TZEVCq9Va-YDacEn5MOuloNnNEiLpYfsltBkIa~jHLJzUCUJACJNX3Gj4vwUUxY9DqfZEW9YUjgchweYxbR-TOGd8Ur6y3hkORuMwWDPIIQZ4~VtRii4LPFSGg~XiOQxGXJChfjTbcdVBRLQprF-j9XlEd-admWpmgVFECtgERYi5zy7-n~rt5e1Q-uBqjaFnDnSSEkcszcgDfjorXNvg__&Key-Pair-Id=APKAJCILBXEJFZF4DCHQ", + "id": 4587174, + "external_id": null, + "created_date": "2024-10-02 02:30:49", + "updated_date": "2024-10-02 02:30:49", + "img_thumbnail_url": "https://scdn.veryfi.com/bank_statements/919ba4778c039560/a0340e88-e657-4616-b3e6-138fa6641426/thumbnail.png?Expires=1727837149&Signature=dh6Zy0439ly1jYMn2NbkuXOzf-7L3q8P-D22YEb52YYD6pfNw8zH~1PDPVDdSUbrFClg7lGuCuXcpiG8xcXbw14U-31viBuUrL96XygLxp8ubh82I3~HcJz9aQj4DQX36KPbVEchas0xOZaLmvlzDyv177sFpB4qqY3oJgDM5UzdG5CFpZRr6ze4R1-B~6rkI5fBtON5JhBi5YgnmyaWrz2Nb7WmGuPOJ4eh8lofWw6tVnk-2wa-5UyTJfokFjmrAVTRcXUH~-7Y66aKM5uDS0S2qsxi~bpGRu5rd4x8aCvHwOv7YYxd9WcmYeyx-Wmc-CQ1p81SfD5cSqhF9bnMjg__&Key-Pair-Id=APKAJCILBXEJFZF4DCHQ", + "account_holder_address": "210 S B St", + "account_holder_name": "Mr Robot Roboto", + "account_number": "1111111", + "account_type": "CURRENT ACCOUNT", + "bank_address": "The Mound, Edinburgh EH1 1YZ.", + "bank_name": "Royal Bank of Scotland Plc.", + "bank_website": null, + "beginning_balance": 1803.9, + "due_date": null, + "ending_balance": 300.2, + "minimum_due": null, + "period_end_date": "2023-12-21", + "period_start_date": "2023-10-22", + "routing_number": "16-10-00", + "statement_date": null, + "statement_number": null, + "currency_code": "GBP", + "iban_number": "GB11RBOS 1610 0011 1111 11", + "swift": "RBOSGB2L", + "account_vat_number": null, + "bank_vat_number": null +} diff --git a/Tests/VeryfiSDKTests/Resources/processW2.json b/Tests/VeryfiSDKTests/Resources/processW2.json new file mode 100644 index 0000000..f1435aa --- /dev/null +++ b/Tests/VeryfiSDKTests/Resources/processW2.json @@ -0,0 +1,58 @@ +{ + "pdf_url": "https://scdn.veryfi.com/w2s/919ba4778c039560/1915cec7-f536-4fe7-94bc-ee5053dacb27/6096478c-2e98-4fcf-8f1d-c4bab7f654c3.pdf?Expires=1729890325&Signature=Ru31fFuvcj2vJh~ClIgTPYF29RdZTIWZB9WQXnV4o4~3O6jrE3lfOZFiFyBH~kfc2K5V08X5ICMpNCXwNLMIx2iKueFsKtDG9G81UVs0Syfd22o7iuMMiIoNHDagemvFaWgo8VQASJQ5Gztqv1M1MYgKDsdV7DTTplhad3YhVddGFfEAbbAgQnawD1svrX1SrLOgyZB1QYjIIR4i8HzJXQTaH9lQlzMNM5mh6uBqpkdKftvQC7UXbmp9zL1qS79-bif21nJksb~~bIXlQNjmYFH8zsy-Uzs0olFqMi5ODrmQ1CDneqYLg5OS3QpPff3v1Isv7QrrhoyWm2wAajWggw__&Key-Pair-Id=APKAJCILBXEJFZF4DCHQ", + "id": 4652686, + "external_id": null, + "created_date": "2024-10-25 20:50:25", + "updated_date": "2024-10-25 20:50:25", + "img_thumbnail_url": "https://scdn.veryfi.com/w2s/919ba4778c039560/1915cec7-f536-4fe7-94bc-ee5053dacb27/thumbnail.png?Expires=1729890325&Signature=CZroGlrymBmMx7SXGncGuyAeQGk8U0YmHlUT2KwS5dhikUX5doUg2CqbzXnP9nqTr9h5JKmLcE2h5k4-BqZRZCzeN7X27DMk7EoA6Fh3ZWfrS~GlMK3CRendz0kU2up5-C5O3xZJz0jYk7zy5b0L8nQrZXhWQZjVdmrwoz6LBg-lWaULYwXVHbuGBZlq9LRTMacn8ixPInMMlfCo~~X0PCVbTxkpTz6ySwbSHy1VRImDahAlFP~Sd~cdO3FXpZLYnJdk0NfiqQtM0JXhfXEZ7xp-W9jkiHT7GPhMRMjc35sqfM-7wAPwwdR2HAo2CHhff23etaJQH2-x6PwkaL9sxw__&Key-Pair-Id=APKAJCILBXEJFZF4DCHQ", + "advance_eic_payment": null, + "employee_ssn": "123-45-6789", + "ein": "11-2233445", + "employer_name": "The Big Company", + "employer_address": "123 Main Street\nAnywhere, PA 12345", + "control_number": "A1B2", + "employee_name": "Jane A DOE", + "employee_address": "123 Elm Street\nAnywhere Else, PA 23456", + "wages_other_comps": 48500.0, + "federal_income_tax": 6835.0, + "ss_wages": 50000.0, + "ss_tax": 3100.0, + "medicare_wages": 50000.0, + "medicare_tax": 725.0, + "ss_tips": null, + "allocated_tips": null, + "dependent_care_benefits": null, + "non_qualified_plans": null, + "state": "PAL", + "employer_state_id": "1235", + "state_wages_tips": 50000.0, + "state_income_tax": 1535.0, + "local_wages_tips": 50000.0, + "local_income_tax": 750.0, + "locality_name": "MU", + "field_12a_col1": "D", + "field_12a_col2": 1500.0, + "field_12b_col1": "DD", + "field_12b_col2": 1000.0, + "field_12c_col1": "P", + "field_12c_col2": 4800.0, + "field_12d_col1": null, + "field_12d_col2": null, + "is_13a": false, + "is_13b": false, + "is_13c": false, + "states": [ + { + "state": "PAL", + "employer_state_id": "1235", + "state_wages_tips": 50000.0, + "state_income_tax": 1535.0, + "local_wages_tips": 50000.0, + "local_income_tax": 750.0, + "locality_name": "MU" + } + ], + "field_14_other": [ + + ] +} diff --git a/Tests/VeryfiSDKTests/Resources/replaceTags.json b/Tests/VeryfiSDKTests/Resources/replaceTags.json new file mode 100644 index 0000000..85ec3a6 --- /dev/null +++ b/Tests/VeryfiSDKTests/Resources/replaceTags.json @@ -0,0 +1,8 @@ +{ + "tags": [ + { + "id": 6862358, + "name": "replace_tag" + } + ] +} diff --git a/Tests/VeryfiSDKTests/Resources/w2.png b/Tests/VeryfiSDKTests/Resources/w2.png new file mode 100644 index 0000000..ab984b8 Binary files /dev/null and b/Tests/VeryfiSDKTests/Resources/w2.png differ diff --git a/Tests/VeryfiSDKTests/UpdateDocumentTest.swift b/Tests/VeryfiSDKTests/UpdateDocumentTest.swift new file mode 100644 index 0000000..13acbb9 --- /dev/null +++ b/Tests/VeryfiSDKTests/UpdateDocumentTest.swift @@ -0,0 +1,60 @@ +import XCTest +#if canImport(FoundationNetworking) +import FoundationNetworking +#endif +@testable import VeryfiSDK + +extension VeryfiSDKTests { + func testUpdateDocument() { + let expectation = XCTestExpectation(description: "Get data from update document") + + if (mockResponses) { + client = ClientSpy(clientId: clientId, clientSecret: clientSecret, username: username, apiKey: apiKey, resource: "updateDocument") + let updateNotes = ["notes": "Note updated"] + let id = 31727276 + client.updateDocument(documentId: String(id), params: updateNotes, withCompletion: { result in + switch result { + case .success(let data): + print(data) + XCTAssertTrue(true) + case .failure(let error): + print(error) + XCTAssert(false) + } + expectation.fulfill() + }) + } else { + func generateRandomString() -> String { + let letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" + return String((0..<10).map{ _ in letters.randomElement()! }) + } + let notes = generateRandomString() + let updateNotes = ["notes": notes] + client.getDocuments(withCompletion: { result in + switch result { + case .success(let data): + let jsonDocuments = try? JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary + guard let id = ((jsonDocuments?["documents"] as? NSArray)?[0] as? NSDictionary)?["id"] as? Int64 else { + XCTFail() + return + } + client.updateDocument(documentId: String(id), params: updateNotes, withCompletion: { result in + switch result { + case .success(let data): + print(data) + XCTAssertTrue(true) + case .failure(let error): + print(error) + XCTAssert(false) + } + expectation.fulfill() + }) + case .failure(let error): + print(error) + } + }) + } + + wait(for: [expectation], timeout: 40.0) + } +} diff --git a/Tests/VeryfiSDKTests/UpdateLineItemTest.swift b/Tests/VeryfiSDKTests/UpdateLineItemTest.swift new file mode 100644 index 0000000..7b5727a --- /dev/null +++ b/Tests/VeryfiSDKTests/UpdateLineItemTest.swift @@ -0,0 +1,56 @@ +import XCTest +#if canImport(FoundationNetworking) +import FoundationNetworking +#endif +@testable import VeryfiSDK + +extension VeryfiSDKTests { + func testUpdateLineItem() { + if (mockResponses) { + client = ClientSpy(clientId: clientId, clientSecret: clientSecret, username: username, apiKey: apiKey, resource: "addLineItem") + } + + let expectation1 = XCTestExpectation(description: "Add line item to document") + let documentId = 63480993 + var lineItemId = 0 + let params1 = AddLineItem(order: 20, description: "Test", total: 44.0) + params1.sku = "testsku" + client.addLineItem(documentId: String(documentId), params: params1, withCompletion: { result in + switch result { + case .success(let data): + let jsonResponse = try? JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary + if mockResponses { + XCTAssertGreaterThanOrEqual(jsonResponse!.count, 2) + } else { + lineItemId = jsonResponse!["id"] as? Int ?? 0 + } + case .failure(let error): + print(error) + XCTFail() + } + expectation1.fulfill() + }) + wait(for: [expectation1], timeout: 20.0) + + let expectation2 = XCTestExpectation(description: "Update line item to document") + let params2 = UpdateLineItem() + params2.description = "Test" + client.updateLineItem(documentId: String(documentId), lineItemId: String(lineItemId), params: params2, withCompletion: { result in + switch result { + case .success(let data): + let jsonResponse = try? JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary + if mockResponses { + XCTAssertGreaterThanOrEqual(jsonResponse!.count, 2) + } else { + XCTAssertEqual(jsonResponse!["description"] as? String, params2.description) + } + case .failure(let error): + print(error) + XCTFail() + } + expectation2.fulfill() + }) + + wait(for: [expectation2], timeout: 20.0) + } +} diff --git a/Tests/VeryfiSDKTests/VeryfiSDKTests.swift b/Tests/VeryfiSDKTests/VeryfiSDKTests.swift index 42fb44a..bf623be 100644 --- a/Tests/VeryfiSDKTests/VeryfiSDKTests.swift +++ b/Tests/VeryfiSDKTests/VeryfiSDKTests.swift @@ -10,6 +10,9 @@ let username = "username" let apiKey = "apiKey" let file = "receipt.jpeg" let url = "https://cdn.veryfi.com/receipts/fd36b2c0-a84d-459c-9d57-c29ac5d14685/21c95fc5-0e5c-48f8-abe0-849e438296bf.jpeg" +let driverLicenseUrl = "https://cdn-dev.veryfi.com/testing/veryfi-python/driver_license.png" +let bankStatementUrl = "https://cdn-dev.veryfi.com/testing/veryfi-python/bankstatement.pdf" +let w2Url = "https://cdn.veryfi.com/wp-content/uploads/image.png" var client = Client(clientId: clientId, clientSecret: clientSecret, username: username, apiKey: apiKey) let mockResponses = true @@ -29,533 +32,4 @@ class ClientSpy: Client { } } -final class VeryfiSDKTests: XCTestCase { - - func testGetDocuments() { - if (mockResponses) { - client = ClientSpy(clientId: clientId, clientSecret: clientSecret, username: username, apiKey: apiKey, resource: "getDocuments") - } - - let expectation = XCTestExpectation(description: "Get all documents in a JSON array") - - client.getDocuments(withCompletion: { result in - switch result { - case .success(let data): - let jsonResponse = try? JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary - XCTAssertGreaterThanOrEqual(jsonResponse!.count, 2) - case .failure(let error): - print(error) - XCTAssertTrue(false) - } - expectation.fulfill() - }) - - wait(for: [expectation], timeout: 20.0) - } - - func testGetDocumentWithQueryItems() { - if (mockResponses) { - client = ClientSpy(clientId: clientId, clientSecret: clientSecret, username: username, apiKey: apiKey, resource: "getDocuments") - } - - let expectation = XCTestExpectation(description: "Get all documents in a JSON array") - let queryItems = [URLQueryItem(name: "order_by", value: "created")] - client.getDocuments(queryItems: queryItems, withCompletion: { result in - switch result { - case .success(let data): - let jsonResponse = try? JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary - XCTAssertGreaterThanOrEqual(jsonResponse!.count, 2) - case .failure(let error): - print(error) - XCTAssertTrue(false) - } - expectation.fulfill() - }) - - wait(for: [expectation], timeout: 20.0) - } - - func testGetDocument() { - let expectation = XCTestExpectation(description: "Get a document by id in a JSON") - - if (mockResponses) { - client = ClientSpy(clientId: clientId, clientSecret: clientSecret, username: username, apiKey: apiKey, resource: "getDocument") - let id = Int64(31727276) - client.getDocument(documentId: String(id), withCompletion: { result in - switch result { - case .success(let data): - let jsonResponse = try? JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary - guard let getDocumentId = jsonResponse?["id"] as? Int64 else { - XCTFail() - return - } - XCTAssertEqual(getDocumentId, id) - case .failure(let error): - print(error) - XCTAssertTrue(false) - } - expectation.fulfill() - }) - } else { - client.getDocuments(withCompletion: { result in - switch result { - case .success(let data): - let jsonDocuments = try? JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary - guard let id = ((jsonDocuments?["documents"] as? NSArray)?[0] as? NSDictionary)?["id"] as? Int64 else { - XCTFail() - return - } - client.getDocument(documentId: String(id), withCompletion: { result in - switch result { - case .success(let data): - let jsonResponse = try? JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary - guard let getDocumentId = jsonResponse?["id"] as? Int64 else { - XCTFail() - return - } - XCTAssertEqual(getDocumentId, id) - case .failure(let error): - print(error) - XCTAssertTrue(false) - } - }) - case .failure(let error): - print(error) - XCTAssertTrue(false) - } - expectation.fulfill() - }) - } - - wait(for: [expectation], timeout: 40.0) - } - - func testProcessDocument() { - if (mockResponses) { - client = ClientSpy(clientId: clientId, clientSecret: clientSecret, username: username, apiKey: apiKey, resource: "processDocument") - } - - let expectation = XCTestExpectation(description: "Get data from processing document") - - let url = Bundle.module.url(forResource: "receipt", withExtension: "jpeg")! - let fileData = try? Data(contentsOf: url) - let categories = ["Advertising & Marketing", "Automotive"] - client.processDocument(fileName: file, fileData: fileData!, categories: categories, deleteAfterProcessing: true, withCompletion: { result in - switch result { - case .success(let data): - let jsonResponse = try? JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary - guard let vendor = (jsonResponse?["vendor"] as? NSDictionary)?["name"] as? String else { - XCTFail() - break - } - XCTAssertEqual("Walgreens", vendor) - case .failure(let error): - print(error) - XCTFail() - } - expectation.fulfill() - }) - - wait(for: [expectation], timeout: 60.0) - } - - func testUpdateDocument() { - let expectation = XCTestExpectation(description: "Get data from update document") - - if (mockResponses) { - client = ClientSpy(clientId: clientId, clientSecret: clientSecret, username: username, apiKey: apiKey, resource: "updateDocument") - let updateNotes = ["notes": "Note updated"] - let id = 31727276 - client.updateDocument(documentId: String(id), params: updateNotes, withCompletion: { result in - switch result { - case .success(let data): - print(data) - XCTAssertTrue(true) - case .failure(let error): - print(error) - XCTAssert(false) - } - expectation.fulfill() - }) - } else { - func generateRandomString() -> String { - let letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" - return String((0..<10).map{ _ in letters.randomElement()! }) - } - let notes = generateRandomString() - let updateNotes = ["notes": notes] - client.getDocuments(withCompletion: { result in - switch result { - case .success(let data): - let jsonDocuments = try? JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary - guard let id = ((jsonDocuments?["documents"] as? NSArray)?[0] as? NSDictionary)?["id"] as? Int64 else { - XCTFail() - return - } - client.updateDocument(documentId: String(id), params: updateNotes, withCompletion: { result in - switch result { - case .success(let data): - print(data) - XCTAssertTrue(true) - case .failure(let error): - print(error) - XCTAssert(false) - } - expectation.fulfill() - }) - case .failure(let error): - print(error) - } - }) - } - - wait(for: [expectation], timeout: 40.0) - } - - func testProcessDocumentURL() { - if (mockResponses) { - client = ClientSpy(clientId: clientId, clientSecret: clientSecret, username: username, apiKey: apiKey, resource: "processDocument") - } - - let expectation = XCTestExpectation(description: "Get a JSON response from process document") - - let categories = ["Advertising & Marketing", "Automotive"] - client.processDocumentURL(fileUrl: url, categories: categories, deleteAfterProcessing: true, boostMode: 1, withCompletion: { result in - switch result { - case .success(let data): - let jsonResponse = try? JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary - guard let vendor = (jsonResponse?["vendor"] as? NSDictionary)?["name"] as? String else { - XCTFail() - break - } - XCTAssertEqual("Walgreens", vendor) - case .failure(let error): - print(error) - XCTFail() - } - expectation.fulfill() - }) - - wait(for: [expectation], timeout: 20.0) - } - - func testDeleteDocument() { - let expectationDocuments = XCTestExpectation(description: "Get documents") - let expectationDelete = XCTestExpectation(description: "Get a JSON response from deleted document") - - if (mockResponses) { - client = ClientSpy(clientId: clientId, clientSecret: clientSecret, username: username, apiKey: apiKey, resource: "deleteDocument") - let documentId = 31727276 - expectationDocuments.fulfill() - client.deleteDocument(documentId: String(documentId), withCompletion: { result in - switch result { - case .success(let data): - let jsonStringDeleteResponse = try? JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary - guard let status = jsonStringDeleteResponse?["status"] as? String else { - XCTFail() - return - } - XCTAssertEqual("ok", status) - case .failure(let error): - print(error) - XCTAssertTrue(false) - } - expectationDelete.fulfill() - }) - } else { - client.processDocumentURL(fileUrl: url, withCompletion: { result in - switch result { - case .success(let data): - let jsonResponse = try? JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary - guard let documentId = jsonResponse?["id"] as? Int64 else { - XCTFail() - return - } - client.deleteDocument(documentId: String(documentId), withCompletion: { result in - switch result { - case .success(let data): - let jsonStringDeleteResponse = try? JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary - guard let status = jsonStringDeleteResponse?["status"] as? String else { - XCTFail() - return - } - XCTAssertEqual("ok", status) - case .failure(let error): - print(error) - XCTAssertTrue(false) - } - expectationDelete.fulfill() - }) - case .failure(let error): - print(error) - } - expectationDocuments.fulfill() - }) - } - - wait(for: [expectationDocuments, expectationDelete], timeout: 40.0) - } - - func testGetDocumentLineItems() { - if (mockResponses) { - client = ClientSpy(clientId: clientId, clientSecret: clientSecret, username: username, apiKey: apiKey, resource: "getDocumentLineItems") - } - - let expectation = XCTestExpectation(description: "Get all line items from document") - let documentId = 63480993 - client.getDocumentLineItems(documentId: String(documentId), withCompletion: { result in - switch result { - case .success(let data): - let jsonResponse = try? JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary - XCTAssertNotNil(jsonResponse!["line_items"]) - case .failure(let error): - print(error) - XCTAssertTrue(false) - } - expectation.fulfill() - }) - - wait(for: [expectation], timeout: 20.0) - } - - func testGetLineItem() { - if (mockResponses) { - client = ClientSpy(clientId: clientId, clientSecret: clientSecret, username: username, apiKey: apiKey, resource: "getLineItem") - } - - let expectation = XCTestExpectation(description: "Get line item from document") - let documentId = 63480993 - let lineItemId = 190399931 - client.getLineItem(documentId: String(documentId), lineItemId: String(lineItemId), withCompletion: { result in - switch result { - case .success(let data): - let jsonResponse = try? JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary - XCTAssertGreaterThanOrEqual(jsonResponse!.count, 2) - case .failure(let error): - print(error) - XCTAssertTrue(false) - } - expectation.fulfill() - }) - - wait(for: [expectation], timeout: 20.0) - } - - func testAddLineItem() { - if (mockResponses) { - client = ClientSpy(clientId: clientId, clientSecret: clientSecret, username: username, apiKey: apiKey, resource: "addLineItem") - } - - let expectation = XCTestExpectation(description: "Add line item to document") - let documentId = 63480993 - let params = AddLineItem(order: 20, description: "Test", total: 44.0) - params.sku = "testsku" - client.addLineItem(documentId: String(documentId), params: params, withCompletion: { result in - switch result { - case .success(let data): - let jsonResponse = try? JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary - if mockResponses { - XCTAssertGreaterThanOrEqual(jsonResponse!.count, 2) - } else { - XCTAssertEqual(jsonResponse!["total"] as? Float, params.total) - XCTAssertEqual(jsonResponse!["description"] as? String, params.description) - } - case .failure(let error): - print(error) - XCTFail() - } - expectation.fulfill() - }) - - wait(for: [expectation], timeout: 20.0) - } - - func testUpdateLineItem() { - if (mockResponses) { - client = ClientSpy(clientId: clientId, clientSecret: clientSecret, username: username, apiKey: apiKey, resource: "addLineItem") - } - - let expectation1 = XCTestExpectation(description: "Add line item to document") - let documentId = 63480993 - var lineItemId = 0 - let params1 = AddLineItem(order: 20, description: "Test", total: 44.0) - params1.sku = "testsku" - client.addLineItem(documentId: String(documentId), params: params1, withCompletion: { result in - switch result { - case .success(let data): - let jsonResponse = try? JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary - if mockResponses { - XCTAssertGreaterThanOrEqual(jsonResponse!.count, 2) - } else { - lineItemId = jsonResponse!["id"] as? Int ?? 0 - } - case .failure(let error): - print(error) - XCTFail() - } - expectation1.fulfill() - }) - wait(for: [expectation1], timeout: 20.0) - - let expectation2 = XCTestExpectation(description: "Update line item to document") - let params2 = UpdateLineItem() - params2.description = "Test" - client.updateLineItem(documentId: String(documentId), lineItemId: String(lineItemId), params: params2, withCompletion: { result in - switch result { - case .success(let data): - let jsonResponse = try? JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary - if mockResponses { - XCTAssertGreaterThanOrEqual(jsonResponse!.count, 2) - } else { - XCTAssertEqual(jsonResponse!["description"] as? String, params2.description) - } - case .failure(let error): - print(error) - XCTFail() - } - expectation2.fulfill() - }) - - wait(for: [expectation2], timeout: 20.0) - } - - func testDeleteDocumentLineItems() { - let expectationDocuments = XCTestExpectation(description: "Get documents") - let expectationDelete = XCTestExpectation(description: "Get a JSON response from deleted document") - - if (mockResponses) { - client = ClientSpy(clientId: clientId, clientSecret: clientSecret, username: username, apiKey: apiKey, resource: "deleteDocumentLineItems") - let documentId = 63480993 - expectationDocuments.fulfill() - client.deleteDocumentLineItems(documentId: String(documentId), withCompletion: { result in - switch result { - case .success(let data): - let jsonStringDeleteResponse = try? JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary - guard let status = jsonStringDeleteResponse?["status"] as? String else { - XCTFail() - return - } - XCTAssertEqual("ok", status) - case .failure(let error): - print(error) - XCTAssertTrue(false) - } - expectationDelete.fulfill() - }) - } else { - client.processDocumentURL(fileUrl: url, withCompletion: { result in - switch result { - case .success(let data): - let jsonResponse = try? JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary - guard let documentId = jsonResponse?["id"] as? Int64 else { - XCTFail() - return - } - client.deleteDocumentLineItems(documentId: String(documentId), withCompletion: { result in - switch result { - case .success(let data): - let jsonStringDeleteResponse = try? JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary - guard let status = jsonStringDeleteResponse?["status"] as? String else { - XCTFail() - return - } - XCTAssertEqual("ok", status) - case .failure(let error): - print(error) - XCTAssertTrue(false) - } - expectationDelete.fulfill() - }) - case .failure(let error): - print(error) - } - expectationDocuments.fulfill() - }) - } - - wait(for: [expectationDocuments, expectationDelete], timeout: 40.0) - } - - func testDeleteLineItem() { - let expectationDocuments = XCTestExpectation(description: "Get documents") - let expectationDelete = XCTestExpectation(description: "Get a JSON response from deleted document") - - if (mockResponses) { - client = ClientSpy(clientId: clientId, clientSecret: clientSecret, username: username, apiKey: apiKey, resource: "deleteLineItem") - let documentId = 63480993 - let lineItemId = 190399931 - expectationDocuments.fulfill() - client.deleteLineItem(documentId: String(documentId), lineItemId: String(lineItemId), withCompletion: { result in - switch result { - case .success(let data): - let jsonStringDeleteResponse = try? JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary - guard let status = jsonStringDeleteResponse?["status"] as? String else { - XCTFail() - return - } - XCTAssertEqual("ok", status) - case .failure(let error): - print(error) - XCTAssertTrue(false) - } - expectationDelete.fulfill() - }) - } else { - let documentId = 63480993 - let params = AddLineItem(order: 20, description: "Test", total: 44.4) - params.sku = "testsku" - client.addLineItem(documentId: String(documentId), params: params, withCompletion: { result in - switch result { - case .success(let data): - let jsonResponse = try? JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary - guard let lineItemId = jsonResponse?["id"] as? Int64 else { - XCTFail() - return - } - client.deleteLineItem(documentId: String(documentId), lineItemId: String(lineItemId), withCompletion: { result in - switch result { - case .success(let data): - let jsonStringDeleteResponse = try? JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary - guard let status = jsonStringDeleteResponse?["status"] as? String else { - XCTFail() - return - } - XCTAssertEqual("ok", status) - case .failure(let error): - print(error) - XCTAssertTrue(false) - } - expectationDelete.fulfill() - }) - case .failure(let error): - print(error) - } - expectationDocuments.fulfill() - }) - } - - wait(for: [expectationDocuments, expectationDelete], timeout: 40.0) - } - - func testBadCredentials() { - let expectation = XCTestExpectation(description: "Get response to a bad credential case") - let badClient = Client(clientId: "badClientId", clientSecret: "badClientSecret", username: "badUsername", apiKey: "badApiKey") - badClient.getDocuments(withCompletion: { result in - switch result{ - case .success(let data): - let jsonResponse = try? JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary - guard let status = jsonResponse?["status"] as? String, let message = jsonResponse?["message"] as? String else { - XCTFail() - return - } - XCTAssertEqual("fail", status) - XCTAssertEqual("Not Authorized", message) - case .failure(let error): - print(error) - } - expectation.fulfill() - }) - - wait(for: [expectation], timeout: 20.0) - } -} +final class VeryfiSDKTests: XCTestCase {}