diff --git a/SynchronyFinancial/SynchronyFinancial WatchKit App/Base.lproj/Interface.storyboard b/SynchronyFinancial/SynchronyFinancial WatchKit App/Base.lproj/Interface.storyboard
index 4ccc998..26db9cf 100644
--- a/SynchronyFinancial/SynchronyFinancial WatchKit App/Base.lproj/Interface.storyboard
+++ b/SynchronyFinancial/SynchronyFinancial WatchKit App/Base.lproj/Interface.storyboard
@@ -199,24 +199,33 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -247,7 +256,7 @@
-
+
diff --git a/SynchronyFinancial/SynchronyFinancial WatchKit Extension/PaymentDetailInterfaceController.swift b/SynchronyFinancial/SynchronyFinancial WatchKit Extension/PaymentDetailInterfaceController.swift
index 161082c..18b312b 100644
--- a/SynchronyFinancial/SynchronyFinancial WatchKit Extension/PaymentDetailInterfaceController.swift
+++ b/SynchronyFinancial/SynchronyFinancial WatchKit Extension/PaymentDetailInterfaceController.swift
@@ -16,15 +16,21 @@ class PaymentDetailInterfaceController: WKInterfaceController {
var paymentButtonArmed: Bool = false
var paymentAmount: Double = 0.0
+ @IBOutlet weak var contentGroup: WKInterfaceGroup!
+ @IBOutlet weak var activityIndicator: WKInterfaceImage!
+ @IBOutlet weak var activityIndicatorLabel: WKInterfaceLabel!
@IBOutlet weak var detailButton: WKInterfaceButton!
@IBOutlet weak var amount: WKInterfaceLabel!
@IBOutlet weak var paymentButton: WKInterfaceButton!
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
@@ -35,13 +41,28 @@ class PaymentDetailInterfaceController: WKInterfaceController {
@IBAction func paymentAction() {
if paymentButtonArmed {
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.presentController(withName: "PaymentResult", context: self.dictForPayment)
- self.popToRootController()
- }
+ let cancel = WKAlertAction(title: "Cancel", style: .cancel, handler: {})
+ let submit = WKAlertAction(title: "Pay Now", style: .default, handler: {
+ self.contentGroup.setHidden(true)
+ self.activityIndicator.configureForActivityIndicator()
+ self.activityIndicatorLabel.setHidden(false)
+ self.activityIndicatorLabel.setVerticalAlignment(.center)
+ FetchData.submitPayment(for: alias, type: "CBL", amount: 20.00, bankID: "9999") { 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()
+ self.activityIndicatorLabel.setHidden(true)
+ self.contentGroup.setHidden(false)
+ self.presentController(withName: "PaymentResult", context: self.dictForPayment)
+ self.popToRootController()
+ }
+ })
+ presentAlert(withTitle: "Disclaimer", message: "By tapping \"Pay Now\", you are authorizing Synchrony Bank to process a one time payment in the amount of \(String(format: "$%.2f", paymentAmount)).", preferredStyle: .actionSheet, actions: [cancel, submit])
} else {
animate(withDuration: 0.5) {
self.paymentButton.setBackgroundColor(#colorLiteral(red: 0.6092301607, green: 0.9366738796, blue: 0.2432599962, alpha: 1))
diff --git a/SynchronyFinancial/SynchronyFinancial WatchKit Extension/PaymentResultInterfaceController.swift b/SynchronyFinancial/SynchronyFinancial WatchKit Extension/PaymentResultInterfaceController.swift
index 6bf3c42..d93a30d 100644
--- a/SynchronyFinancial/SynchronyFinancial WatchKit Extension/PaymentResultInterfaceController.swift
+++ b/SynchronyFinancial/SynchronyFinancial WatchKit Extension/PaymentResultInterfaceController.swift
@@ -10,8 +10,8 @@ import WatchKit
import Foundation
class PaymentResultInterfaceController: WKInterfaceController {
- @IBOutlet var confirmationNumberLabel: WKInterfaceLabel!
- @IBOutlet var paymentIDLabel: WKInterfaceLabel!
+ @IBOutlet weak var confirmationNumberLabel: WKInterfaceLabel!
+ @IBOutlet weak var paymentIDLabel: WKInterfaceLabel!
override func awake(withContext context: Any?) {
super.awake(withContext: context)