-
Notifications
You must be signed in to change notification settings - Fork 0
Swe 13 choose bank account #15
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
63bb56b
Created PaymentOptions interface and controller for selecting payment…
rrk12005 6ffbf64
reated PaymentOptions interface and controller for selecting payment …
rrk12005 18c29c8
SWF-13 updating default payment option
rrk12005 0b6fb67
SWF-13 able to choose bank that user would like to pay for. No passin…
rrk12005 76ef026
SWF-13 finished addition of ability to choose bank account to pay for…
rrk12005 61ca428
Merge branch 'master' into SWE-13-choose-bank-account
ahm11003 520d31a
Fixed errors from code review. Additionally, moved where fetchBankInf…
rrk12005 cc16cdf
hotfix for passing default bank acct id
rrk12005 3594b68
SWE-13 PR Requested changes
rrk12005 0c9a242
SWE-13 [swiftlint] resolve swiftlint warnings
ahm11003 8b78622
Merge branch 'master' into SWE-13-choose-bank-account
ahm11003 d60bd62
SWE-13 Integration of UserDefaults+Extension as the getter for bankAc…
rrk12005 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
SynchronyFinancial/SynchronyFinancial WatchKit Extension/BankAcctCell.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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! | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
...nyFinancial/SynchronyFinancial WatchKit Extension/PaymentOptionsInterfaceController.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | ||
} | ||
|
||
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() | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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