diff --git a/Kiosk/App/AppSetup.swift b/Kiosk/App/AppSetup.swift
index 08b4208f..4b80d1ce 100644
--- a/Kiosk/App/AppSetup.swift
+++ b/Kiosk/App/AppSetup.swift
@@ -30,6 +30,6 @@ class AppSetup {
var needsZipCode: Bool {
// If we're swiping with the card reaer, we don't need to collect a zip code.
- return disableCardReader
+ return false
}
}
diff --git a/Kiosk/Bid Fulfillment/ManualCreditCardInputViewController.swift b/Kiosk/Bid Fulfillment/ManualCreditCardInputViewController.swift
index 42cac84f..ee201dfe 100644
--- a/Kiosk/Bid Fulfillment/ManualCreditCardInputViewController.swift
+++ b/Kiosk/Bid Fulfillment/ManualCreditCardInputViewController.swift
@@ -10,16 +10,18 @@ class ManualCreditCardInputViewController: UIViewController, RegistrationSubCont
@IBOutlet weak var expirationMonthTextField: TextField!
@IBOutlet weak var expirationYearTextField: TextField!
@IBOutlet weak var securitycodeTextField: TextField!
+ @IBOutlet weak var billingZipTextField: TextField!
@IBOutlet weak var cardNumberWrapperView: UIView!
@IBOutlet weak var expirationDateWrapperView: UIView!
- @IBOutlet weak var expirationDateErrorLabel: UILabel!
@IBOutlet weak var securityCodeWrapperView: UIView!
- @IBOutlet weak var securityCodeErrorLabel: UILabel!
+ @IBOutlet weak var billingZipWrapperView: UIView!
+ @IBOutlet weak var billingZipErrorLabel: UILabel!
@IBOutlet weak var cardConfirmButton: ActionButton!
@IBOutlet weak var dateConfirmButton: ActionButton!
@IBOutlet weak var securityCodeConfirmButton: ActionButton!
+ @IBOutlet weak var billingZipConfirmButton: ActionButton!
lazy var keys = EidolonKeys()
@@ -32,18 +34,19 @@ class ManualCreditCardInputViewController: UIViewController, RegistrationSubCont
super.viewDidLoad()
expirationDateWrapperView.hidden = true
securityCodeWrapperView.hidden = true
+ billingZipWrapperView.hidden = true
// We show the enter credit card number, then the date switching the views around
RAC(viewModel, "cardFullDigits") <~ cardNumberTextField.rac_textSignal()
RAC(viewModel, "expirationYear") <~ expirationYearTextField.rac_textSignal()
RAC(viewModel, "expirationMonth") <~ expirationMonthTextField.rac_textSignal()
RAC(viewModel, "securityCode") <~ securitycodeTextField.rac_textSignal()
+ RAC(viewModel, "billingZip") <~ billingZipTextField.rac_textSignal()
RAC(cardConfirmButton, "enabled") <~ viewModel.creditCardNumberIsValidSignal
- securityCodeConfirmButton.rac_command = viewModel.registerButtonCommand()
-
- RAC(securityCodeErrorLabel, "hidden") <~ securityCodeConfirmButton.rac_command.errors.take(1).mapReplace(false).startWith(true)
+ billingZipConfirmButton.rac_command = viewModel.registerButtonCommand()
+ RAC(billingZipErrorLabel, "hidden") <~ billingZipConfirmButton.rac_command.errors.take(1).mapReplace(false).startWith(true)
viewModel.moveToYearSignal.take(1).subscribeNext { [weak self] _ -> Void in
self?.expirationYearTextField.becomeFirstResponder()
@@ -61,6 +64,7 @@ class ManualCreditCardInputViewController: UIViewController, RegistrationSubCont
cardNumberWrapperView.hidden = true
expirationDateWrapperView.hidden = false
securityCodeWrapperView.hidden = true
+ billingZipWrapperView.hidden = true
expirationDateWrapperView.frame = CGRectMake(0, 0, CGRectGetWidth(expirationDateWrapperView.frame), CGRectGetHeight(expirationDateWrapperView.frame))
@@ -71,16 +75,29 @@ class ManualCreditCardInputViewController: UIViewController, RegistrationSubCont
cardNumberWrapperView.hidden = true
expirationDateWrapperView.hidden = true
securityCodeWrapperView.hidden = false
+ billingZipWrapperView.hidden = true
securityCodeWrapperView.frame = CGRectMake(0, 0, CGRectGetWidth(securityCodeWrapperView.frame), CGRectGetHeight(securityCodeWrapperView.frame))
securitycodeTextField.becomeFirstResponder()
}
+ @IBAction func securityCodeConfirmTapped(sender: AnyObject) {
+ cardNumberWrapperView.hidden = true
+ expirationDateWrapperView.hidden = true
+ securityCodeWrapperView.hidden = true
+ billingZipWrapperView.hidden = false
+
+ billingZipWrapperView.frame = CGRectMake(0, 0, CGRectGetWidth(billingZipWrapperView.frame), CGRectGetHeight(billingZipWrapperView.frame))
+
+ billingZipTextField.becomeFirstResponder()
+ }
+
@IBAction func backToCardNumber(sender: AnyObject) {
cardNumberWrapperView.hidden = false
expirationDateWrapperView.hidden = true
securityCodeWrapperView.hidden = true
+ billingZipWrapperView.hidden = true
cardNumberTextField.becomeFirstResponder()
}
@@ -89,10 +106,20 @@ class ManualCreditCardInputViewController: UIViewController, RegistrationSubCont
cardNumberWrapperView.hidden = true
expirationDateWrapperView.hidden = false
securityCodeWrapperView.hidden = true
+ billingZipWrapperView.hidden = true
expirationMonthTextField.becomeFirstResponder()
}
+ @IBAction func backToSecurityCode(sender: AnyObject) {
+ cardNumberWrapperView.hidden = true
+ expirationDateWrapperView.hidden = true
+ securityCodeWrapperView.hidden = false
+ billingZipWrapperView.hidden = true
+
+ securitycodeTextField.becomeFirstResponder()
+ }
+
class func instantiateFromStoryboard(storyboard: UIStoryboard) -> ManualCreditCardInputViewController {
return storyboard.viewControllerWithID(.ManualCardDetailsInput) as! ManualCreditCardInputViewController
}
@@ -113,6 +140,10 @@ private extension ManualCreditCardInputViewController {
securitycodeTextField.text = "123"
securitycodeTextField.sendActionsForControlEvents(.AllEditingEvents)
securityCodeConfirmButton.sendActionsForControlEvents(.TouchUpInside)
+
+ billingZipTextField.text = "10001"
+ billingZipTextField.sendActionsForControlEvents(.AllEditingEvents)
+ billingZipTextField.sendActionsForControlEvents(.TouchUpInside)
}
@IBAction func dev_creditCardOKTapped(sender: AnyObject) {
diff --git a/Kiosk/Bid Fulfillment/ManualCreditCardInputViewModel.swift b/Kiosk/Bid Fulfillment/ManualCreditCardInputViewModel.swift
index 5f338d87..51453f07 100644
--- a/Kiosk/Bid Fulfillment/ManualCreditCardInputViewModel.swift
+++ b/Kiosk/Bid Fulfillment/ManualCreditCardInputViewModel.swift
@@ -11,6 +11,7 @@ class ManualCreditCardInputViewModel: NSObject {
dynamic var expirationMonth = ""
dynamic var expirationYear = ""
dynamic var securityCode = ""
+ dynamic var billingZip = ""
private(set) var bidDetails: BidDetails!
private(set) var finishedSubject: RACSubject?
@@ -39,6 +40,10 @@ class ManualCreditCardInputViewModel: NSObject {
return RACObserve(self, "securityCode").map(isStringLengthIn(3..<5))
}
+ var billingZipIsValidSignal: RACSignal {
+ return RACObserve(self, "billingZip").map(isStringLengthIn(4..<8))
+ }
+
var moveToYearSignal: RACSignal {
return RACObserve(self, "expirationMonth").filter { (value) -> Bool in
return (value as! String).characters.count == 2
@@ -47,7 +52,7 @@ class ManualCreditCardInputViewModel: NSObject {
func registerButtonCommand() -> RACCommand {
let newUser = bidDetails.newUser
- let enabled = RACSignal.combineLatest([creditCardNumberIsValidSignal, expiryDatesAreValidSignal, securityCodeIsValidSignal]).and()
+ let enabled = RACSignal.combineLatest([creditCardNumberIsValidSignal, expiryDatesAreValidSignal, securityCodeIsValidSignal, billingZipIsValidSignal]).and()
return RACCommand(enabled: enabled) { [weak self] _ in
(self?.registerCardSignal(newUser) ?? RACSignal.empty())?.doCompleted { () -> Void in
self?.finishedSubject?.sendCompleted()
@@ -69,9 +74,8 @@ class ManualCreditCardInputViewModel: NSObject {
private func registerCardSignal(newUser: NewUser) -> RACSignal {
let month = expirationMonth.toUIntWithDefault(0)
let year = expirationYear.toUIntWithDefault(0)
- let postalCode = newUser.zipCode ?? ""
- return stripeManager.registerCard(cardFullDigits, month: month, year: year, securityCode: securityCode, postalCode: postalCode).doNext() { (object) in
+ return stripeManager.registerCard(cardFullDigits, month: month, year: year, securityCode: securityCode, postalCode: billingZip).doNext() { (object) in
let token = object as! STPToken
newUser.creditCardName = token.card.name
diff --git a/Kiosk/Storyboards/Fulfillment.storyboard b/Kiosk/Storyboards/Fulfillment.storyboard
index f8d0d080..66fa274d 100644
--- a/Kiosk/Storyboards/Fulfillment.storyboard
+++ b/Kiosk/Storyboards/Fulfillment.storyboard
@@ -60,6 +60,8 @@
AGaramondPro-Regular
AGaramondPro-Regular
AGaramondPro-Regular
+ AGaramondPro-Regular
+ AGaramondPro-Regular
AGaramondPro-Semibold
@@ -1516,12 +1518,6 @@
-
@@ -1585,14 +1581,60 @@
-