diff --git a/passbook/models.py b/passbook/models.py index eecd43b..a538c4c 100755 --- a/passbook/models.py +++ b/passbook/models.py @@ -235,7 +235,11 @@ def __init__(self): class Pass(object): def __init__(self, passInformation, json='', passTypeIdentifier='', - organizationName='', teamIdentifier=''): + organizationName='', teamIdentifier='', + nfc_message=None, + encryption_public_key=None, + sharingProhibited=None, + requiresAuthentication=False): self._files = {} # Holds the files to include in the .pkpass self._hashes = {} # Holds the SHAs of the files array @@ -298,6 +302,17 @@ def __init__(self, passInformation, json='', passTypeIdentifier='', self.passInformation = passInformation + # Create an NFC pass + self.nfc_message = nfc_message + # Public encryption key + self.encryption_public_key = encryption_public_key + + # This one prevents users from sharing passes with older iOS versions and bypassing the authentication requirement. + self.sharingProhibited = sharingProhibited + + # It's a Boolean value that indicates whether the NFC pass requires authentication. + self.requiresAuthentication = requiresAuthentication + # Adds file to the file array def addFile(self, name, fd): self._files[name] = fd.read() @@ -405,7 +420,7 @@ def json_dict(self): if self.logoText: d.update({'logoText': self.logoText}) if self.locations: - d.update({'locations': self.locations}) + d['locations'] = self.locations if self.ibeacons: d.update({'beacons': self.ibeacons}) if self.userInfo: @@ -423,6 +438,15 @@ def json_dict(self): if self.webServiceURL: d.update({'webServiceURL': self.webServiceURL, 'authenticationToken': self.authenticationToken}) + if self.nfc_message: + d['nfc'] = { + 'message': self.nfc_message, + "encryptionPublicKey": self.encryption_public_key, + "requiresAuthentication": self.requiresAuthentication + } + if self.sharingProhibited: + d.update({"sharingProhibited": self.sharingProhibited}) + return d