Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Quick Fix for bug where request not parsing payload JSON
  • Loading branch information
rrk12005 committed Mar 14, 2019
1 parent da5294a commit a2599ec
Showing 1 changed file with 19 additions and 11 deletions.
Expand Up @@ -19,25 +19,33 @@ class FetchData{
let json = JSON(value) let json = JSON(value)
let dict = json.dictionaryValue let dict = json.dictionaryValue
guard dict["status"]?.dictionaryValue["response_code"]?.string == "0" else { return } guard dict["status"]?.dictionaryValue["response_code"]?.string == "0" else { return }
print(json)

if let accounts = dict["account_number_list"]?.arrayValue{ if let accounts = dict["account_number_list"]?.arrayValue{
for account in accounts{ for account in accounts{
guard let accountAlias = account.dictionaryValue["account_alias"]?.string else {return} guard let accountAlias = account.dictionaryValue["account_alias"]?.string else {return}
guard let creditLimit = account.dictionaryValue["credit_limit"]?.double else {return} guard let creditLimit = account.dictionaryValue["credit_limit"]?.string else {return}
guard let payDueDate = account.dictionaryValue["next_payment_due_date"]?.string else {return} guard let payDueDate = account.dictionaryValue["next_payment_due_date"]?.string else {return}
guard let curBal = account.dictionaryValue["current_balance"]?.double else {return} guard let curBal = account.dictionaryValue["current_balance"]?.string else {return}
guard let availCredit = account.dictionaryValue["available_credit"]?.double else {return} guard let availCredit = account.dictionaryValue["available_credit"]?.string else {return}
guard let minPayDue = account.dictionaryValue["minimum_payment_due"]?.double else {return} guard let minPayDue = account.dictionaryValue["minimum_payment_due"]?.string else {return}
guard let statementBal = account.dictionaryValue["statement_bal"]?.double else {return} guard let statementBal = account.dictionaryValue["statement_bal"]?.string else {return}
guard let accountName = account.dictionaryValue["cc_program_name"]?.string else {return} guard let accountName = account.dictionaryValue["cc_program_name"]?.string else {return}

let creditLimitD = Double(creditLimit)!
let curBalD = Double(curBal)!
let availCreditD = Double(availCredit)!
let minPayDueD = Double(minPayDue)!
let stateBalD = Double(statementBal)!
debugPrint(accountAlias) debugPrint(accountAlias)
debugPrint(creditLimit) debugPrint(creditLimitD)
debugPrint(payDueDate) debugPrint(payDueDate)
debugPrint(curBal) debugPrint(curBalD)
debugPrint(availCredit) debugPrint(availCreditD)
debugPrint(minPayDue) debugPrint(minPayDueD)
debugPrint(statementBal) debugPrint(stateBalD)
debugPrint(accountName) debugPrint(accountName)
let inAccount = Account(accountAlias: accountAlias, creditLimit: creditLimit, paymentDueDate: payDueDate, curBalance: curBal, availCredit: availCredit, minPayDue: minPayDue, statementBal: statementBal, accountName: accountName) let inAccount = Account(accountAlias: accountAlias, creditLimit: creditLimitD, paymentDueDate: payDueDate, curBalance: curBalD, availCredit: availCreditD, minPayDue: minPayDueD, statementBal: stateBalD, accountName: accountName)
accountList.append(inAccount) accountList.append(inAccount)
} }
} }
Expand Down

0 comments on commit a2599ec

Please sign in to comment.