Created
April 12, 2016 13:05
-
-
Save isaldin/d187d191384b970bb3012334430764b5 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// MARK: CardIOViewDelegate methods | |
func cardIOView(cardIOView:CardIOView, didScanCard info:CardIOCreditCardInfo?) | |
{ | |
guard info != nil else { return } | |
if let cardNumber = info!.cardNumber { | |
Dispatcher.instance.perform(Dispatcher.Action.UpdateField(key: props.cardNumberFieldKey, value: cardNumber)) | |
} | |
if let cardholderName = info!.cardholderName { | |
Dispatcher.instance.perform(Dispatcher.Action.UpdateField(key: props.cardholderNameFieldKey, value: cardholderName)) | |
} | |
if let expiryMonth: UInt = info!.expiryMonth where expiryMonth > 0, let expiryYear: UInt = info!.expiryYear where expiryYear > 0 { | |
Dispatcher.instance.perform(Dispatcher.Action.UpdateField(key: props.expiredAtFieldKey, value: "\(expiryMonth)/\(expiryYear)")) | |
} | |
if let cardType = BankCardType(cardIOCardType: info!.cardType) { | |
Dispatcher.instance.perform(Dispatcher.Action.UpdateField(key: props.cardTypeFieldKey, value: cardType.rawValue)) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment