Skip to content

Commit

Permalink
Merge pull request devartis#13 from NafieAlhilaly/feat/add-nfc
Browse files Browse the repository at this point in the history
feat: add NFC support
  • Loading branch information
NafieAlhilaly committed Jul 22, 2022
2 parents 377bcce + 40915d6 commit 40a2579
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
9 changes: 5 additions & 4 deletions wallet/Pass.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@

from wallet.PassInformation import PassInformation
from typing import Optional, List, Union
from wallet.PassProps.Barcode import Barcode
from wallet.PassProps.Location import Location
from wallet.PassProps.IBeacon import IBeacon
from wallet.PassProps import Barcode, Location, IBeacon, NFC
from .exceptions import PassParameterException


Expand Down Expand Up @@ -51,6 +49,7 @@ def __init__(
user_info: json = None,
expriration_date: str = None,
voided: bool = False,
nfc: NFC = None
) -> None:
"""
Prepare Pass
Expand Down Expand Up @@ -150,6 +149,8 @@ def __init__(

self.exprirationDate = expriration_date
self.voided = voided
if nfc:
self.NFC = nfc

self.passInformation = pass_information

Expand Down Expand Up @@ -322,7 +323,7 @@ def json_dict(self) -> dict:
data["locations"] = []
for location in self.locations:
data["locations"].append(location.json_dict())
if len(data["locations"]) >= 10:
if len(data["locations"]) > 10:
raise PassParameterException("Field locations has<10 entries")

if self.ibeacons:
Expand Down
11 changes: 11 additions & 0 deletions wallet/PassProps/NFC.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class NFC:
def __init__(
self, encryption_public_key, message, requires_authentication=False
) -> None:
self.encryptionPublicKey = encryption_public_key
self.message = message
self.requiresAuthentication = requires_authentication

def json_dict(self):
"""Return dict object from class"""
return self.__dict__

0 comments on commit 40a2579

Please sign in to comment.