Skip to content

Swe 12 enable payment suite #13

Merged
merged 14 commits into from Apr 8, 2019

SWE-12 Set up Payment Result view

- we now will receive a dictionary in Payment Result which contains (for now) the payment confirmation number and payment id
- these are displayed in the labels
  • Loading branch information
ahm11003 committed Mar 29, 2019
commit 6f9d87c236fa3bdfa915d4749dd2e42a6b10893f
@@ -224,6 +224,31 @@
</objects>
<point key="canvasLocation" x="1085" y="186"/>
</scene>
<!--PaymentResult-->
<scene sceneID="mFc-oM-oG1">
<objects>
<controller identifier="PaymentResult" id="mpK-7H-pjK" customClass="PaymentResultInterfaceController" customModule="SynchronyFinancial_WatchKit_App" customModuleProvider="target">
<items>
<label width="1" alignment="center" text="Payment Result:" textAlignment="center" id="gg1-Wq-NeI"/>
<separator width="1" alignment="center" id="Y1o-3Q-hjG"/>
<label width="1" alignment="center" text="Confirmation Number:" textAlignment="center" minimumScaleFactor="0.69999999999999996" id="qAX-bM-U5t"/>
<label width="1" alignment="center" text="Label" textAlignment="center" id="cF3-r2-BMf"/>
<label width="1" alignment="center" text="Payment ID:" textAlignment="center" id="7Cr-Kh-rJ2"/>
<label width="1" alignment="center" text="Label" textAlignment="center" id="wSp-wZ-Ksf"/>
<button width="1" height="30" alignment="left" title="Home" id="HbC-l6-p2S">
<connections>
<action selector="didTapHome" destination="mpK-7H-pjK" id="nZ1-FD-iEx"/>
</connections>
</button>
</items>
<connections>
<outlet property="confirmationNumberLabel" destination="cF3-r2-BMf" id="FBR-K8-kdQ"/>
<outlet property="paymentIDLabel" destination="wSp-wZ-Ksf" id="7MN-ZT-Jxw"/>
</connections>
</controller>
</objects>
<point key="canvasLocation" x="1414" y="182"/>
</scene>
<!--Transactions-->
<scene sceneID="yXO-yR-k6b">
<objects>
@@ -34,12 +34,12 @@ class PaymentDetailInterfaceController: WKInterfaceController {

@IBAction func paymentAction() {
if paymentButtonArmed {
popToRootController()
guard let alias = selectedAccount?.accountAlias else { return }
FetchData.submitPayment(for: alias, type: "CBL", amount: 20.00, bankID: "9999") { confirmationNum, paymentID, error in
guard error == nil else { return }
self.dictForPayment.updateValue(confirmationNum, forKey: "payment_confirmation_number")
self.dictForPayment.updateValue(paymentID, forKey: "payment_id")
self.pushController(withName: "PaymentResult", context: self.dictForPayment)
}

// popToRootController()
@@ -9,13 +9,23 @@
import WatchKit
import Foundation


class PaymentResultInterfaceController: WKInterfaceController {
@IBOutlet var confirmationNumberLabel: WKInterfaceLabel!
@IBOutlet var paymentIDLabel: WKInterfaceLabel!

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

// Configure interface objects here.

if let data = context as? [String: String],
let paymentConfirmation = data["payment_confirmation_number"],
let paymentID = data["payment_id"] {
confirmationNumberLabel.setText(paymentConfirmation)
paymentIDLabel.setText(paymentID)
}
}

@IBAction func didTapHome() {
popToRootController()
}

override func willActivate() {
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.