Skip to content

Instantly share code, notes, and snippets.

@azamsharp
Created April 8, 2018 00:47
Show Gist options
  • Save azamsharp/72f0d31ef98768bde224d4ff0396c09f to your computer and use it in GitHub Desktop.
Save azamsharp/72f0d31ef98768bde224d4ff0396c09f to your computer and use it in GitHub Desktop.
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