Created
April 8, 2018 00:47
-
-
Save azamsharp/72f0d31ef98768bde224d4ff0396c09f 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
class Transaction : Codable { | |
var driverLicenseNumber :String | |
var voilationType :String | |
var noOfVoilations :Int = 1 | |
var isDrivingLicenseSuspended :Bool = false | |
init(licenseNoHash :String, voilationType :String) { | |
self.driverLicenseNumber = licenseNoHash | |
self.voilationType = voilationType | |
} | |
init?(request :Request) { | |
guard let driverLicenseNumber = request.data["driverLicense"]?.string, | |
let voilationType = request.data["voilationType"]?.string else { | |
return nil | |
} | |
self.driverLicenseNumber = driverLicenseNumber.sha1Hash() | |
self.voilationType = voilationType | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment