用于与Plaid.com交互的Swift客户端。
几乎所有方法都需要Plaid客户端ID和Plaid密钥。您可以在Plaid注册以获取这些信息
首先,使用在Plaid注册后获得的唯一clientID和secretToken初始化一个PlaidClient
实例
您可以直接通过Plaid检索机构,或者Plaid还允许您通过Intuit连接到机构
检索Plaid机构
func plaidInstitutions(completionHandler: (response: NSHTTPURLResponse?, institutions: [PlaidInstitution]) -> ())
检索Intuit机构
func intuitInstitutions(count: Int, skip: Int, completionHandler: (response: NSHTTPURLResponse?, institutions: [PlaidInstitution]) -> ())
func plaidInstitutionWithID(id: String, callBack: (response: NSHTTPURLResponse?, institution: PlaidInstitution, error: NSError?) -> ())
func loginToInstitution(institution: PlaidInstitution, username: String, password: String, pin: String, email: String, callBack: (response: NSHTTPURLResponse, responseData: [String: AnyObject]) -> ())
“pin”是可选的。如果机构不需要,请设置为nil。userAccounts将指示是否需要MFA身份验证。默认的MFA是问题
使用以下方式提交用户的MFA响应:
func submitMFAResponse(response: String, institution: PlaidInstitution, accessToken: String, callBack: (response: NSHTTPURLResponse, responseData: [String: AnyObject]) -> ())
userAccounts将返回另一个MFA响应或用户账户列表
func downloadAccountData(#accessToken: String, account: String, pending: Bool, fromDate: NSDate?, toDate: NSDate?, callBack: (response: NSHTTPURLResponse, account: PlaidAccount?, plaidTransactions: [PlaidTransaction]?, error: NSError?) -> ())
isPending,accountID,transactionID,fromDate,toDate都是可选字段。如果不需要,请设置为nil。如果accountID未设置,将下载特定机构的所有交易。
如果用户更改登录凭据,请使用以下方式更新:
func patchInstitution(accessToken: String, username: String, password: String, pin: String, callBack: (response: NSHTTPURLResponse, data: [String : AnyObject]) -> ())
func patchSubmitMFAResponse(response: String, accessToken: String, username: String, password: String, callBack: (response: NSHTTPURLResponse, data: [String : AnyObject]) -> ())