mirror of
https://github.com/aclindsa/ofxgo.git
synced 2024-11-21 19:20:05 -05:00
Add status code meanings to status code error messages
This commit is contained in:
parent
3c56e60a85
commit
896bd55327
@ -52,7 +52,8 @@ func bankTransactions() {
|
||||
}
|
||||
|
||||
if response.Signon.Status.Code != 0 {
|
||||
fmt.Printf("Nonzero signon status with message: %s\n", response.Signon.Status.Message)
|
||||
meaning, _ := response.Signon.Status.CodeMeaning()
|
||||
fmt.Printf("Nonzero signon status (%d: %s) with message: %s\n", response.Signon.Status.Code, meaning, response.Signon.Status.Message)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,8 @@ func ccTransactions() {
|
||||
}
|
||||
|
||||
if response.Signon.Status.Code != 0 {
|
||||
fmt.Printf("Nonzero signon status with message: %s\n", response.Signon.Status.Message)
|
||||
meaning, _ := response.Signon.Status.CodeMeaning()
|
||||
fmt.Printf("Nonzero signon status (%d: %s) with message: %s\n", response.Signon.Status.Code, meaning, response.Signon.Status.Message)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
|
@ -36,25 +36,26 @@ func getAccounts() {
|
||||
}
|
||||
query.Signup = append(query.Signup, &acctInfo)
|
||||
|
||||
signupResponse, err := client.Request(query)
|
||||
response, err := client.Request(query)
|
||||
if err != nil {
|
||||
fmt.Println("Error requesting account information:", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
if signupResponse.Signon.Status.Code != 0 {
|
||||
fmt.Printf("Nonzero signon status with message: %s\n", signupResponse.Signon.Status.Message)
|
||||
if response.Signon.Status.Code != 0 {
|
||||
meaning, _ := response.Signon.Status.CodeMeaning()
|
||||
fmt.Printf("Nonzero signon status (%d: %s) with message: %s\n", response.Signon.Status.Code, meaning, response.Signon.Status.Message)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
if len(signupResponse.Signup) < 1 {
|
||||
if len(response.Signup) < 1 {
|
||||
fmt.Println("No signup messages received")
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Println("\nFound the following accounts:\n")
|
||||
|
||||
if acctinfo, ok := signupResponse.Signup[0].(ofxgo.AcctInfoResponse); ok {
|
||||
if acctinfo, ok := response.Signup[0].(ofxgo.AcctInfoResponse); ok {
|
||||
for _, acct := range acctinfo.AcctInfo {
|
||||
if acct.BankAcctInfo != nil {
|
||||
fmt.Printf("Bank Account:\n\tBankId: \"%s\"\n\tAcctId: \"%s\"\n\tAcctType: %s\n", acct.BankAcctInfo.BankAcctFrom.BankId, acct.BankAcctInfo.BankAcctFrom.AcctId, acct.BankAcctInfo.BankAcctFrom.AcctType)
|
||||
|
@ -55,7 +55,8 @@ func invTransactions() {
|
||||
}
|
||||
|
||||
if response.Signon.Status.Code != 0 {
|
||||
fmt.Printf("Nonzero signon status with message: %s\n", response.Signon.Status.Message)
|
||||
meaning, _ := response.Signon.Status.CodeMeaning()
|
||||
fmt.Printf("Nonzero signon status (%d: %s) with message: %s\n", response.Signon.Status.Code, meaning, response.Signon.Status.Message)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user