Skip to content

Swe 24 show pending transactions and allow cancel #16

Merged
merged 9 commits into from Apr 9, 2019

SWE-24 make call to web service to cancel payment

  • Loading branch information
ahm11003 committed Apr 9, 2019
commit b8da22e1192772fe57395937123b214f29e322ae
@@ -289,8 +289,8 @@
<objects>
<controller identifier="TransactionDetails" id="LeA-fL-4Wb" customClass="TransactionDetailsInterfaceController" customModule="SynchronyFinancial_WatchKit_App" customModuleProvider="target">
<items>
<imageView alignment="center" hidden="YES" id="GUu-D2-6Oc"/>
<label width="136" alignment="center" hidden="YES" text="Cancelling..." textAlignment="center" id="SBS-c6-zvx"/>
<imageView alignment="left" hidden="YES" id="579-gg-q4m"/>
<label width="1" alignment="left" verticalAlignment="center" hidden="YES" text="Cancelling..." textAlignment="center" id="fN3-48-fyV"/>
<group width="1" alignment="left" layout="vertical" id="w3k-a5-ZaU">
<items>
<label width="1" alignment="center" text="Scheduled Online Payment Processing" textAlignment="center" numberOfLines="2" minimumScaleFactor="0.69999999999999996" id="z1i-je-74F">
@@ -312,8 +312,8 @@
</group>
</items>
<connections>
<outlet property="activityIndicator" destination="GUu-D2-6Oc" id="EQW-cn-wV1"/>
<outlet property="activityIndicatorLabel" destination="SBS-c6-zvx" id="f24-Cg-XrS"/>
<outlet property="activityIndicator" destination="579-gg-q4m" id="9r5-DE-Ise"/>
<outlet property="activityIndicatorLabel" destination="fN3-48-fyV" id="gy3-Ci-bwx"/>
<outlet property="amountLabel" destination="d4y-NP-GbP" id="WOU-uA-pCu"/>
<outlet property="cancelButton" destination="4Rt-Xc-Vdh" id="TLc-0k-RFv"/>
<outlet property="contentGroup" destination="w3k-a5-ZaU" id="rQo-G8-l7A"/>
@@ -10,13 +10,14 @@ import WatchKit
import Foundation

class TransactionDetailsInterfaceController: WKInterfaceController {
@IBOutlet var contentGroup: WKInterfaceGroup!
@IBOutlet var activityIndicator: WKInterfaceImage!
@IBOutlet var activityIndicatorLabel: WKInterfaceLabel!
@IBOutlet weak var contentGroup: WKInterfaceGroup!
@IBOutlet var transactionName: WKInterfaceLabel!
@IBOutlet var dateLabel: WKInterfaceLabel!
@IBOutlet var amountLabel: WKInterfaceLabel!
@IBOutlet var cancelButton: WKInterfaceButton!

var transaction: Transaction?
var account: Account?

@@ -42,7 +43,26 @@ class TransactionDetailsInterfaceController: WKInterfaceController {
}

@IBAction func cancelButtonTapped() {
guard let t = transaction, let acct = account else {
NSLog("Error: no values for transaction or account.")
return
}

activityIndicator.configureForActivityIndicator()
activityIndicatorLabel.setHidden(false)
contentGroup.setHidden(true)

FetchData.cancelPayment(accountAlias: acct.accountAlias, confirmationNum: t.confirmationNum, paymentId: t.paymentId) { conf, error in
guard error == nil else { return }
self.activityIndicatorLabel.setHidden(true)
self.activityIndicator.stopAnimating()
self.contentGroup.setHidden(false)
let context: [String: String] = ["cancellation_confirm": conf]
self.presentController(withName: "Cancellation", context: context)
self.popToRootController()
}
}

override func willActivate() {
// This method is called when watch view controller is about to be visible to user
super.willActivate()
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.