Skip to content

Swe 13 choose bank account #15

Merged
merged 12 commits into from
Apr 10, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder.WatchKit.Storyboard" version="3.0" toolsVersion="14490.70" targetRuntime="watchKit" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="Qge-pO-HLc">
<document type="com.apple.InterfaceBuilder.WatchKit.Storyboard" version="3.0" toolsVersion="14460.31" targetRuntime="watchKit" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="Qge-pO-HLc">
<device id="watch38" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="watchOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBWatchKitPlugin" version="14490.21"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBWatchKitPlugin" version="14460.16"/>
</dependencies>
<scenes>
<!--root-->
@@ -201,13 +201,16 @@
<objects>
<controller id="t8d-XB-ngB" customClass="PaymentDetailInterfaceController" customModule="SynchronyFinancial_WatchKit_App" customModuleProvider="target">
<items>
<imageView alignment="left" hidden="YES" id="qfi-KI-QXK"/>
<label width="1" alignment="center" hidden="YES" text="Processing ..." textAlignment="center" id="kgd-iG-og7"/>
<imageView alignment="left" hidden="YES" id="jH5-mg-vuQ"/>
<label width="1" alignment="center" hidden="YES" text="Processing ..." textAlignment="center" id="YNm-eO-7xL"/>
<group width="1" height="1" alignment="left" layout="vertical" id="9VF-fb-CV3">
<items>
<label width="1" alignment="center" text="Pay From:" textAlignment="center" id="xE5-Zl-U7d"/>
<button width="1" height="40" alignment="left" title="Synchrony (1234)" id="SZD-0B-PrF" userLabel="detailButton">
<button width="1" height="40" alignment="left" title="Select Bank" id="SZD-0B-PrF" userLabel="detailButton">
<fontDescription key="font" type="system" pointSize="15"/>
<connections>
<action selector="bankAccountsTapped" destination="t8d-XB-ngB" id="bQR-Mu-nB6"/>
</connections>
</button>
<separator alignment="left" verticalAlignment="center" id="et0-Sq-Qxm">
<color key="color" white="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
@@ -224,17 +227,48 @@
</group>
</items>
<connections>
<outlet property="activityIndicator" destination="qfi-KI-QXK" id="wVj-x3-NzV"/>
<outlet property="activityIndicatorLabel" destination="kgd-iG-og7" id="csx-e2-1eZ"/>
<outlet property="activityIndicator" destination="jH5-mg-vuQ" id="ucI-rB-ebj"/>
<outlet property="activityIndicatorLabel" destination="YNm-eO-7xL" id="okk-cx-k3L"/>
<outlet property="amount" destination="mT0-3D-JGP" id="rff-wG-B82"/>
<outlet property="contentGroup" destination="9VF-fb-CV3" id="vfa-YT-ipt"/>
<outlet property="detailButton" destination="SZD-0B-PrF" id="xEw-gE-yIP"/>
<outlet property="payFrom" destination="xE5-Zl-U7d" id="62t-6n-KSD"/>
<outlet property="paymentButton" destination="FgU-iZ-2XU" id="yZe-dZ-nBV"/>
<outlet property="separate" destination="et0-Sq-Qxm" id="JfK-S7-H9d"/>
</connections>
</controller>
</objects>
<point key="canvasLocation" x="1085" y="186"/>
</scene>
<!--PaymentOptions-->
<scene sceneID="T56-bi-gCI">
<objects>
<controller identifier="PaymentOptions" id="jbp-Bi-Bk7" userLabel="PaymentOptions" customClass="PaymentOptionsInterfaceController" customModule="SynchronyFinancial_WatchKit_Extension">
<items>
<table alignment="left" id="RJQ-am-qV6" userLabel="Banks Table">
<items>
<tableRow identifier="bankAcctCell" id="Mfw-7m-ih3" customClass="BankAcctCell" customModule="SynchronyFinancial_WatchKit_Extension">
<group key="rootItem" width="1" height="43" alignment="left" layout="vertical" id="8u2-82-z5f">
<items>
<label width="136" alignment="left" text="Bank Name" id="y0D-7u-Qtr" userLabel="Bank Name Label"/>
<label width="58" height="20" alignment="left" text="(1234)" id="FMl-Jx-r2b" userLabel="last4 Label"/>
</items>
</group>
<connections>
<outlet property="bankNameLabel" destination="y0D-7u-Qtr" id="5Ao-39-aie"/>
<outlet property="last4Label" destination="FMl-Jx-r2b" id="w7N-Dp-fkz"/>
</connections>
</tableRow>
</items>
</table>
</items>
<connections>
<outlet property="bankAcctTable" destination="RJQ-am-qV6" id="mjy-8f-Qzt"/>
</connections>
</controller>
</objects>
<point key="canvasLocation" x="1400" y="186"/>
</scene>
<!--PaymentResult-->
<scene sceneID="mFc-oM-oG1">
<objects>
@@ -253,7 +287,7 @@
</connections>
</controller>
</objects>
<point key="canvasLocation" x="1408" y="185"/>
<point key="canvasLocation" x="1400" y="516"/>
</scene>
<!--Transactions-->
<scene sceneID="yXO-yR-k6b">
@@ -282,7 +316,7 @@
</connections>
</controller>
</objects>
<point key="canvasLocation" x="1085" y="-229"/>
<point key="canvasLocation" x="1085" y="-233"/>
</scene>
<!--TransactionDetails-->
<scene sceneID="aqX-eB-bdU">
@@ -322,7 +356,7 @@
</connections>
</controller>
</objects>
<point key="canvasLocation" x="1420" y="-229.5"/>
<point key="canvasLocation" x="1400" y="-233"/>
</scene>
<!--Cancellation-->
<scene sceneID="ZZZ-KP-exO">
@@ -341,10 +375,10 @@
</connections>
</controller>
</objects>
<point key="canvasLocation" x="1806" y="-229"/>
<point key="canvasLocation" x="1722" y="-229"/>
</scene>
</scenes>
<inferredMetricsTieBreakers>
<segue reference="AFS-lo-piH"/>
<segue reference="kTV-Eb-cpT"/>
</inferredMetricsTieBreakers>
</document>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// BankAcctCell.swift
// SynchronyFinancial WatchKit Extension
//
// Created by Rahul Kantesaria on 4/5/19.
// Copyright © 2019 Alan Maynard. All rights reserved.
//

import Foundation
import WatchKit

class BankAcctCell: NSObject {
@IBOutlet weak var bankNameLabel: WKInterfaceLabel!
@IBOutlet weak var last4Label: WKInterfaceLabel!
}
Original file line number Diff line number Diff line change
@@ -97,7 +97,6 @@ class FetchData {
let modifiable = $0["is_payment_modifiable"].string {
let type: TransactionType = $0["payment_amount_type"].stringValue == "" ? .purchase : .reimbursement
let isModifiable: Bool = modifiable == "Y" ? true : false

transactions.append(Transaction(type: type, amount: amount, merchantID: desc, date: date, confirmationNum: confirmationNum, paymentId: paymentId, isPending: true, isModifiable: isModifiable))
}
}
@@ -131,11 +130,10 @@ class FetchData {
//"fetch_bank_account_details"
dict["fetch_bank_account_details"]?.arrayValue.forEach {
if let bankId = $0["bank_account_id"].string,
let accttype: AccountType = $0["bank_account_type"].stringValue ==
"C" ? .checkings : .savings {
//print(bankId)
//print(accttype)
bankIds.append(BankAcct(bankAcctId: bankId, acctType: accttype))
let bankName = $0["bank_name"].string,
let last4Acct = $0["last4_bank_acct_number"].string,
let accttype: AccountType = AccountType(rawValue: $0["bank_account_type"].stringValue) {
bankIds.append(BankAcct(bankAcctId: bankId, acctType: accttype, bankName: bankName, last4Acct: last4Acct))
}
}
completion(bankIds, nil)
@@ -151,7 +149,6 @@ class FetchData {
paymentHeader["account_alias"] = accountAlias
paymentHeader["payment_confirmation_number"] = confirmationNum
paymentHeader["payment_id"] = paymentId

Alamofire.request(Defaults.CANCEL_PAYMENT_URL, method: .post, parameters: paymentHeader, encoding: JSONEncoding.default, headers: Defaults.authHeader).responseJSON { payload in
switch payload.result {
case .success(let value):
Original file line number Diff line number Diff line change
@@ -15,22 +15,23 @@ class PaymentDetailInterfaceController: WKInterfaceController {
var dictForPayment: [String: String] = [:]
var paymentButtonArmed: Bool = false
var paymentAmount: Double = 0.0

@IBOutlet weak var contentGroup: WKInterfaceGroup!
var dictForBankAcct: [String: [BankAcct]] = [:]
//var bankID: String = ""
@IBOutlet weak var activityIndicator: WKInterfaceImage!
@IBOutlet weak var activityIndicatorLabel: WKInterfaceLabel!
@IBOutlet weak var contentGroup: WKInterfaceGroup!
@IBOutlet weak var detailButton: WKInterfaceButton!
@IBOutlet weak var amount: WKInterfaceLabel!
@IBOutlet weak var paymentButton: WKInterfaceButton!
@IBOutlet weak var payFrom: WKInterfaceLabel!
@IBOutlet weak var separate: WKInterfaceSeparator!

override func awake(withContext context: Any?) {
super.awake(withContext: context)

guard let data = context as? [String: Any],
let acct = data["acct"] as? Account,
let amount = data["payment_amount"] as? Double else {
NSLog("Error getting account object and payment amount")
return
guard let data = context as? [String: Any], let acct = data["acct"] as? Account, let amount = data["payment_amount"] as? Double else {
NSLog("Error getting account object and payment amount")
return
}

self.paymentAmount = amount
@@ -50,12 +51,17 @@ class PaymentDetailInterfaceController: WKInterfaceController {
let type: PaymentType = self.paymentAmount == self.selectedAccount?.curBalance ? .currentBal : .minimumDue

// process this payment using default bank account (9999) until ability to change account is implemented
FetchData.submitPayment(for: alias, type: type, amount: self.paymentAmount, bankID: "9999") { confirmationNum, paymentID, error in
guard let bankacct = UserDefaults.standard.getDefaultBankAccount() else {
NSLog("Error retrieving Payment Option")
return
}
FetchData.submitPayment(for: alias, type: type, amount: self.paymentAmount, bankID: bankacct.bankAcctId) { confirmationNum, paymentID, error in
guard error == nil else {
let dismiss = WKAlertAction(title: "Dismiss", style: .cancel, handler: {})
self.presentAlert(withTitle: "Error", message: "We were unable to process your payment at this time. Please try again later.", preferredStyle: .alert, actions: [dismiss])
return
}

self.dictForPayment.updateValue(confirmationNum, forKey: "payment_confirmation_number")
self.dictForPayment.updateValue(paymentID, forKey: "payment_id")
self.activityIndicator.stopAnimatingAsIndicator()
@@ -75,13 +81,49 @@ class PaymentDetailInterfaceController: WKInterfaceController {
}
}

@IBAction func bankAccountsTapped() {
configureInterfaceObjects(true)
activityIndicator.configureForActivityIndicator()
FetchData.getBankInfo { accts, error in
guard error == nil else {
NSLog("Error retrieving payment methods for account in paymentDetailInterfaceController.")
return
}
self.dictForBankAcct.updateValue(accts, forKey: "paymentOptions")
self.configureInterfaceObjects(false)
//self.detailButton.setTitle("Hello")
self.activityIndicator.stopAnimatingAsIndicator()
self.pushController(withName: "PaymentOptions", context: self.dictForBankAcct)
}
}

override func willActivate() {
// This method is called when watch view controller is about to be visible to user
super.willActivate()
/*if let bankacct = UserDefaults.standard.dictionary(forKey: "default_bank_acct") as? [String: String] {
detailButton.setTitle(bankacct["bankName"])
}*/
//let userDefaults = UserDefaults.standard
guard let bankacct = UserDefaults.standard.getDefaultBankAccount() else {
NSLog("Error recieving default bank account in Payment Details Controller")
return
}
detailButton.setTitle(bankacct.bankName)
}

override func didDeactivate() {
// This method is called when watch view controller is no longer visible
super.didDeactivate()
}

private func configureInterfaceObjects(_ hide: Bool) {
detailButton.setHidden(hide)
amount.setHidden(hide)
paymentButton.setHidden(hide)
payFrom.setHidden(hide)
separate.setHidden(hide)
contentGroup.setHidden(hide)
activityIndicatorLabel.setVerticalAlignment(.center)
activityIndicatorLabel.setHidden(!hide)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
//
// BankSelectionInterfaceController.swift
// SynchronyFinancial WatchKit Extension
//
// Created by Rahul Kantesaria on 4/5/19.
// Copyright © 2019 Alan Maynard. All rights reserved.
//

import WatchKit
import Foundation

class PaymentOptionsInterfaceController: WKInterfaceController {
@IBOutlet weak var bankAcctTable: WKInterfaceTable!
var bankAccts: [BankAcct] = []
var dictForDefault: [String: String] = [:]
override func awake(withContext context: Any?) {
super.awake(withContext: context)
//grab the potential list of bank accounts from the payment detail controller
guard let data = context as? [String: [BankAcct]], let accts = data["paymentOptions"] else {
NSLog("Error receiving context containing bank accounts in PaymentOptionsInterfaceController")
return
}
bankAccts = accts
configureRows()
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

insert new line after this closing brace


override func willActivate() {
// This method is called when watch view controller is about to be visible to user
super.willActivate()
}

override func didDeactivate() {
// This method is called when watch view controller is no longer visible
super.didDeactivate()
}

private func configureRows() {
bankAcctTable.setNumberOfRows(bankAccts.count, withRowType: "bankAcctCell")
for index in 0..<bankAcctTable.numberOfRows {
if let row = bankAcctTable.rowController(at: index) as? BankAcctCell {
row.bankNameLabel.setText(bankAccts[index].bankName)
row.last4Label.setText("(\(bankAccts[index].last4Acct))")
}
}
}

override func table(_ table: WKInterfaceTable, didSelectRowAt rowIndex: Int) {
let acct = bankAccts[rowIndex]
dictForDefault.updateValue(acct.acctType.rawValue, forKey: "acctType")
dictForDefault.updateValue(acct.bankAcctId, forKey: "bankAcctId")
dictForDefault.updateValue(acct.bankName, forKey: "bankName")
dictForDefault.updateValue(acct.last4Acct, forKey: "last4Acct")
UserDefaults.standard.set(dictForDefault, forKey: "default_bank_acct")
pop()
}
}
14 changes: 14 additions & 0 deletions SynchronyFinancial/SynchronyFinancial.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
@@ -7,7 +7,11 @@
objects = {

/* Begin PBXBuildFile section */
110B4615225BBDD70028B53A /* UserDefaults+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 110B4614225BBDD70028B53A /* UserDefaults+Extensions.swift */; };
110B4616225BBDD70028B53A /* UserDefaults+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 110B4614225BBDD70028B53A /* UserDefaults+Extensions.swift */; };
1123372E223ABD6400B70925 /* FetchData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1123372D223ABD6400B70925 /* FetchData.swift */; };
112969422257B8920082AAC5 /* PaymentOptionsInterfaceController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 112969412257B8920082AAC5 /* PaymentOptionsInterfaceController.swift */; };
112B56512257C3D9003E9C78 /* BankAcctCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 112B56502257C3D9003E9C78 /* BankAcctCell.swift */; };
11E6ADB92253FA050009922E /* BankAcct.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11E6ADB82253FA050009922E /* BankAcct.swift */; };
11E6ADBA225401DB0009922E /* BankAcct.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11E6ADB82253FA050009922E /* BankAcct.swift */; };
281283568A34D3C5D9C7B383 /* libPods-SynchronyFinancial WatchKit Extension.a in Frameworks */ = {isa = PBXBuildFile; fileRef = CAA6D46F907ADAABF49FD409 /* libPods-SynchronyFinancial WatchKit Extension.a */; };
@@ -88,7 +92,10 @@
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
110B4614225BBDD70028B53A /* UserDefaults+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UserDefaults+Extensions.swift"; sourceTree = "<group>"; };
1123372D223ABD6400B70925 /* FetchData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FetchData.swift; sourceTree = "<group>"; };
112969412257B8920082AAC5 /* PaymentOptionsInterfaceController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PaymentOptionsInterfaceController.swift; sourceTree = "<group>"; };
112B56502257C3D9003E9C78 /* BankAcctCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BankAcctCell.swift; sourceTree = "<group>"; };
11E6ADB82253FA050009922E /* BankAcct.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BankAcct.swift; sourceTree = "<group>"; };
1BEF4B8BF190D117CA6104E5 /* Pods-SynchronyFinancial WatchKit App.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SynchronyFinancial WatchKit App.release.xcconfig"; path = "Pods/Target Support Files/Pods-SynchronyFinancial WatchKit App/Pods-SynchronyFinancial WatchKit App.release.xcconfig"; sourceTree = "<group>"; };
250BDAF6AD4E1CCA82995E30 /* Pods-SynchronyFinancial WatchKit Extension.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SynchronyFinancial WatchKit Extension.release.xcconfig"; path = "Pods/Target Support Files/Pods-SynchronyFinancial WatchKit Extension/Pods-SynchronyFinancial WatchKit Extension.release.xcconfig"; sourceTree = "<group>"; };
@@ -192,6 +199,7 @@
67BAC26F219E254800713FEF /* Assets.xcassets */,
67BAC271219E254800713FEF /* LaunchScreen.storyboard */,
67BAC274219E254800713FEF /* Info.plist */,
110B4614225BBDD70028B53A /* UserDefaults+Extensions.swift */,
);
path = SynchronyFinancial;
sourceTree = "<group>";
@@ -214,6 +222,7 @@
67293CF022542F15009E0E7A /* TransactionDetailsInterfaceController.swift */,
674BD1522239A39D0076AFD6 /* PayBillInterfaceController.swift */,
481864A7224802BB0059CF7A /* PaymentDetailInterfaceController.swift */,
112969412257B8920082AAC5 /* PaymentOptionsInterfaceController.swift */,
676392B322429DC800740A8C /* TransactionsInterfaceController.swift */,
673F396C21A644460051469E /* MainMenuInterfaceController.swift */,
67228CD7224D6E2700CA29E4 /* WKInterfaceImage+Extensions.swift */,
@@ -223,6 +232,7 @@
67BAC291219E254900713FEF /* Assets.xcassets */,
48DA0057221D12E70081A500 /* AccountCell.swift */,
676392B52242A3F800740A8C /* TransactionCell.swift */,
112B56502257C3D9003E9C78 /* BankAcctCell.swift */,
67BAC293219E254900713FEF /* Info.plist */,
1123372D223ABD6400B70925 /* FetchData.swift */,
);
@@ -477,6 +487,7 @@
files = (
67E17B86223812C2008871FE /* Defaults.swift in Sources */,
674BD1532239A39D0076AFD6 /* PayBillInterfaceController.swift in Sources */,
110B4615225BBDD70028B53A /* UserDefaults+Extensions.swift in Sources */,
48F2430D2214CBF700B9C894 /* Account.swift in Sources */,
678C388622309F7D00FEAAF6 /* AccountCell.swift in Sources */,
11E6ADB92253FA050009922E /* BankAcct.swift in Sources */,
@@ -490,6 +501,7 @@
buildActionMask = 2147483647;
files = (
11E6ADBA225401DB0009922E /* BankAcct.swift in Sources */,
112B56512257C3D9003E9C78 /* BankAcctCell.swift in Sources */,
678C3885223098C400FEAAF6 /* Account.swift in Sources */,
67BAC28E219E254900713FEF /* ExtensionDelegate.swift in Sources */,
674BD1542239A39D0076AFD6 /* PayBillInterfaceController.swift in Sources */,
@@ -500,12 +512,14 @@
67293CF122542F15009E0E7A /* TransactionDetailsInterfaceController.swift in Sources */,
1123372E223ABD6400B70925 /* FetchData.swift in Sources */,
679A9069225C1B0E00247F39 /* CancellationInterfaceController.swift in Sources */,
112969422257B8920082AAC5 /* PaymentOptionsInterfaceController.swift in Sources */,
48F243072214C98600B9C894 /* AccountTableInterfaceController.swift in Sources */,
676392B62242A3F800740A8C /* TransactionCell.swift in Sources */,
48F2430F2214CC2200B9C894 /* Transaction.swift in Sources */,
676392B422429DC800740A8C /* TransactionsInterfaceController.swift in Sources */,
48DA0058221D12E70081A500 /* AccountCell.swift in Sources */,
67228CD8224D6E2700CA29E4 /* WKInterfaceImage+Extensions.swift in Sources */,
110B4616225BBDD70028B53A /* UserDefaults+Extensions.swift in Sources */,
481864A9224802BB0059CF7A /* PaymentDetailInterfaceController.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
12 changes: 8 additions & 4 deletions SynchronyFinancial/SynchronyFinancial/BankAcct.swift
Original file line number Diff line number Diff line change
@@ -8,16 +8,20 @@

import Foundation

public enum AccountType: Int {
case checkings = 0
case savings = 1
public enum AccountType: String {
case checkings = "C"
case savings = "S"
}

class BankAcct: NSObject {
var bankAcctId: String
var acctType: AccountType
init(bankAcctId: String, acctType: AccountType) {
var bankName: String
var last4Acct: String
init(bankAcctId: String, acctType: AccountType, bankName: String, last4Acct: String) {
self.bankAcctId = bankAcctId
self.acctType = acctType
self.bankName = bankName
self.last4Acct = last4Acct
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//
// UserDefaults+Extensions.swift
// SynchronyFinancial
//
// Created by Rahul Kantesaria on 4/8/19.
// Copyright © 2019 Alan Maynard. All rights reserved.
//

import Foundation

extension UserDefaults {
func setDefaultBankAccount(_ acct: BankAcct) {
UserDefaults.standard.set(acct, forKey: "default_bank_acct")
}

func getDefaultBankAccount() -> BankAcct? {
if let bankDict = UserDefaults.standard.value(forKey: "default_bank_acct") as? [String: String],
let bankAcctId = bankDict["bankAcctId"],
let acctTypeRaw: String = bankDict["acctType"],
let bankName = bankDict["bankName"],
let last4Acct = bankDict["last4Acct"],
let acctType: AccountType = AccountType(rawValue: acctTypeRaw) {
return BankAcct(bankAcctId: bankAcctId, acctType: acctType, bankName: bankName, last4Acct: last4Acct)
}
return nil
}
}