예제 #1
0
def make_passbook_file(args={}):
	cardInfo = EventTicket()
	cardInfo.addPrimaryField('eventName', args['ticket'], 'Ticket')
	cardInfo.addSecondaryField('doorsOpen', args['from'], 'From')
	cardInfo.addSecondaryField('doorsClose', args['to'], 'To')

	passfile = Pass(cardInfo, passTypeIdentifier=args['identifier'], organizationName=args['organisation'], teamIdentifier=args['teamidentifier'])

	passfile.description = args['desc']
	passfile.backgroundColor = args['bgcolor']
	passfile.foregroundColor = args['fgcolor']
	passfile.logoText = args['logotext']
	passfile.serialNumber = args['uuid']
	passfile.barcode = Barcode(message=args['uuid'], format=BarcodeFormat.QR)
	passfile.barcode.altText = args['uuid'][:13]

	loc = Location(args['lat'], args['long'])
	passfile.locations = [loc,]
	passfile.relevantDate = args['relevant_date']

	passfile.addFile('icon.png', open('%s/icon.png' % args['filespath'], 'r'))
	passfile.addFile('logo.png', open('%s/logo.png' % args['filespath'], 'r'))
	passfile.addFile('*****@*****.**', open('%s/[email protected]' % args['filespath'], 'r'))
	passfile.addFile('background.png', open('%s/background.png' % args['filespath'], 'r'))
	passfile.addFile('*****@*****.**', open('%s/[email protected]' % args['filespath'], 'r'))

	return passfile.create('%s/certificate.pem' % args['filespath'], '%s/key.pem' % args['filespath'], '%s/wwdr.pem' % args['filespath'], args['password'])
예제 #2
0
def create_apple_pass(user):
    card_info = EventTicket()
    header_field = Field('date', 'Oct 7-9', 'MASONIC TEMPLE')
    header_field.textAlignment = Alignment.RIGHT
    card_info.headerFields.append(header_field)
    card_info.addPrimaryField('name', user.get_full_name(), 'HACKER')
    card_info.addBackField('name', user.get_full_name(), 'NAME')
    card_info.addBackField('email', user.email, 'EMAIL')

    app = user.application_or_none()

    school_name = user.cleaned_school_name(app)
    card_info.addSecondaryField('school', school_name, 'SCHOOL')
    card_info.addBackField('school', school_name, 'SCHOOL')

    if app:
        if app.user_is_minor():
            card_info.addAuxiliaryField('minor', 'YES', 'MINOR')
            card_info.addBackField('minor', 'YES', 'MINOR')

    registration = user.registration_or_none()
    if registration:
        card_info.addBackField('tshirt', registration.t_shirt_size, 'T-SHIRT SIZE')
        card_info.addBackField('dietary', registration.dietary_restrictions if registration.dietary_restrictions else 'None', 'DIETARY RESTRICTIONS')

    pass_file = Pass(card_info, passTypeIdentifier='pass.com.MPowered.MHacks.UserPass',
                     organizationName='MHacks', teamIdentifier='478C74MJ7T')
    pass_file.description = 'MHacks Ticket'
    pass_file.serialNumber = str(user.pk)
    pass_file.barcode = Barcode(message=user.email, format=BarcodeFormat.QR)
    pass_file.backgroundColor = 'rgb(0, 188, 212)'
    pass_file.foregroundColor = 'rgb(250, 250, 250)'
    pass_file.labelColor = 'rgba(0, 0, 0, 0.6)'
    pass_file.associatedStoreIdentifiers = [955659359]

    pass_file.locations = [{'longitude': 42.3415958, 'latitude': -83.0606906},
                           {'longitude': 42.3420320, 'latitude': -83.0596780},
                           {'longitude': 42.3415800, 'latitude': -83.0607620}]
    i_beacon = IBeacon('5759985C-B037-43B4-939D-D6286CE9C941', 0, 0)
    i_beacon.relevantText = 'You are near a scanner.'
    pass_file.ibeacons = [i_beacon]

    # Including the icon is necessary for the passbook to be valid.
    pass_file.addFile('icon.png', open(STATICFILES_DIRS[0] + '/assets/app_icon.png', 'r'))
    pass_file.addFile('*****@*****.**', open(STATICFILES_DIRS[0] + '/assets/app_icon.png', 'r'))
    pass_file.addFile('*****@*****.**', open(STATICFILES_DIRS[0] + '/assets/app_icon.png', 'r'))
    pass_file.addFile('logo.png', open(STATICFILES_DIRS[0] + '/assets/apple_pass_logo.png', 'r'))
    pass_file.addFile('*****@*****.**', open(STATICFILES_DIRS[0] + '/assets/apple_pass_logo.png', 'r'))
    pass_file.addFile('*****@*****.**', open(STATICFILES_DIRS[0] + '/assets/apple_pass_logo.png', 'r'))

    # Create and return the Passbook file (.pkpass)
    return pass_file.create('config/apple_wallet_certificate.pem',
                            'config/apple_wallet_key.pem',
                            'config/apple_wallet_wwdr.pem',
                            APPLE_WALLET_PASSPHRASE)
예제 #3
0
cardInfo.addBackField('phone', Globalhospitalphone, 'Hospital Phone')
cardInfo.addBackField('address', Globalhospitaladdress, 'Hospital Address')
cardInfo.addBackField('location', Globallocation, 'Location')
cardInfo.addBackField('instruction', 'Bring your photo Id and other required documents with you.', 'Instruction')


organizationName = 'InterSystems'
passTypeIdentifier = 'pass.com.intersystems.trakcare.apptPassDemo'
teamIdentifier = '5HLUDG9M34'

passfile = Pass(cardInfo, \
    passTypeIdentifier=passTypeIdentifier, \
    organizationName=organizationName, \
    teamIdentifier=teamIdentifier)
passfile.description = "This is the appointment pass powered by InterSystems"
passfile.backgroundColor='#87CEFA'
passfile.foregroundColor='#000000'
passfile.labelColor='#000000'
#passfile.stripColor='#000000'
passfile.logoText= 'InterSystems'
passfile.serialNumber = '1234567'
passfile.barcode = Barcode(message = Globalmrn ,format=BarcodeFormat.PDF417)
passfile.locations = []
location = Location(-12.3559002,130.8807508)
passfile.locations.append(location)

# Including the icon and logo is necessary for the passbook to be valid.
passfile.addFile('icon.png', open('/irisdev/app/apple/test.pass/icon.png', 'rb'))
passfile.addFile('logo.png', open('/irisdev/app/apple/test.pass/logo.png', 'rb'))
#passfile.addFile('background.png', open('/irisdev/app/apple/test.pass/background.png', 'rb'))
예제 #4
0
def TRANSAVIA_PASS(dest, FROM, TO, EMBARQUEMENT, NOM_PRENOM, TERMINAL, FLIGHT, SEAT, ZONE):
    cardInfo = BoardingPass(transitType=TransitType.AIR)
    field = Field("date", EMBARQUEMENT.strftime("%d %b"), "Date")
    field.textAlignment = Alignment.NATURAL
    cardInfo.headerFields.append(field)

    field = Field("fli", FLIGHT, "Flight")
    field.textAlignment = Alignment.CENTER
    cardInfo.headerFields.append(field)

    cardInfo.primaryFields.append(Field("src", FROM[0], FROM[1]))
    field = Field("dst", TO[0], TO[1])
    field.textAlignment = Alignment.NATURAL
    cardInfo.primaryFields.append(field)

    cardInfo.auxiliaryFields.append(
        Field("nam", NOM_PRENOM, "Passenger")
    )

    field = Field("ter", TERMINAL, "Terminal")
    field.textAlignment = Alignment.CENTER
    cardInfo.auxiliaryFields.append(field)

    field = Field("sea", SEAT, "Seat")
    field.textAlignment = Alignment.CENTER
    cardInfo.auxiliaryFields.append(field)

    field = Field("zon", ZONE, "Zone")
    field.textAlignment = Alignment.RIGHT
    cardInfo.auxiliaryFields.append(field)

    field = DateField(
        "boa",
        EMBARQUEMENT.isoformat(),
        "Boarding",
        dateStyle=DateStyle.NONE,
        timeStyle=DateStyle.SHORT,
    )
    cardInfo.secondaryFields.append(field)

    field = DateField(
        "gat",
        (EMBARQUEMENT + datetime.timedelta(minutes=15)).isoformat(),
        "Gate closed",
        dateStyle=DateStyle.NONE,
        timeStyle=DateStyle.SHORT,
    )
    field.textAlignment = Alignment.CENTER
    cardInfo.secondaryFields.append(field)

    field = DateField(
        "dep",
        (EMBARQUEMENT + datetime.timedelta(minutes=30)).isoformat(),
        "Departure",
        dateStyle=DateStyle.NONE,
        timeStyle=DateStyle.SHORT,
    )
    field.textAlignment = Alignment.RIGHT
    cardInfo.secondaryFields.append(field)

    cardInfo.backFields.append(
        Field(
            "hnd",
            """You are permitted 1 piece of hand luggage per adult/child of max. 10 kg.
You can choose from:
1 piece of hand luggage of max. 45x40x25 cm. Guaranteed to be allowed into the cabin.
or
1 piece of hand luggage of max. 55x40x25 cm. Keep in mind that it will be transported as hold luggage on crowded flights.
If you are only traveling with hand luggage, you can go straight to security and onto your gate.

<a href="https://www.transavia.com/en-NL/faq/hand-luggage/">More information about hand luggage</a>
""", 
            "Hand luggage",
        )
    )
    cardInfo.backFields.append(
        Field(
            "dro",
            "Are you travelling with hold luggage or special luggage? You can drop it off at the 'baggage drop-off' counters. If there is no drop-off counter, you can check in your bags at the check-in desk.",
            "Dropping off luggage at the airport",
        )
    )
    cardInfo.backFields.append(
        Field("ont", "Make sure you arrive at the airport well ahead of time (at least 2 hours before departure). This way, you can start your trip without any stress and make sure we can depart on time.", "Go to the airport on time")
    )

    cardInfo.backFields.append(
        Field("mor", "On the <a href='https://www.transavia.com/en-EU/service'>website of Transavia</a> you will find all the information to prepare for your trip.", "More information")
    )

    organizationName = "Transavia"
    passTypeIdentifier = "pass.com.sear.app"
    teamIdentifier = "836469M6XW"

    passfile = Pass(
        cardInfo,
        passTypeIdentifier=passTypeIdentifier,
        organizationName=organizationName,
        teamIdentifier=teamIdentifier,
    )
    passfile.serialNumber = "AZERTYUIOT"
    passfile.barcode = Barcode(
        message=f"M1{NOM_PRENOM.replace(' ','/').upper()}       U7EDGF {FROM[0]}{TO[0]}{FLIGHT} 093Y009D0080 147>1181WW1092BTO 0000000000000299790000000000 0                          ",
        format=BarcodeFormat.QR,
        altText="seq. nr. " + FLIGHT + ":80"
    )

    passfile.labelColor = "rgb(26, 209, 89)"
    passfile.foregroundColor = "rgb(96, 96, 96)"
    passfile.backgroundColor = "rgb(255, 255, 255)"

    passfile.description = "Transavia boardingpass"

    passfile.relevantDate = EMBARQUEMENT.isoformat()

    # Including the icon and logo is necessary for the passbook to be valid.
    passfile.addFile("icon.png", open("images/logo-transavia.png", "rb"))
    passfile.addFile("*****@*****.**", open("images/[email protected]", "rb"))
    passfile.addFile("logo.png", open("images/logo-transavia.png", "rb"))

    # Create and output the Passbook file (.pkpass)
    password = open(expanduser("~") + "/pass_creator/passcreatorpwd.txt").read()
    return passfile.create(
        "certs/certificate.pem",
        expanduser("~") + "/pass_creator/private.key",
        "certs/wwdr.pem",
        password,
        "passes/" + dest + ".pkpass",
    )
예제 #5
0
def TRANSAVIA_PASS(dest, FROM, TO, EMBARQUEMENT, NOM_PRENOM, TERMINAL, FLIGHT,
                   SEAT, ZONE):
    cardInfo = BoardingPass(transitType=TransitType.AIR)
    field = Field("date", EMBARQUEMENT.strftime("%d %b"), "Date")
    field.textAlignment = Alignment.NATURAL
    cardInfo.headerFields.append(field)

    field = Field("fli", FLIGHT, "Vol")
    field.textAlignment = Alignment.CENTER
    cardInfo.headerFields.append(field)

    cardInfo.primaryFields.append(Field("src", FROM[0], FROM[1]))
    field = Field("dst", TO[0], TO[1])
    field.textAlignment = Alignment.NATURAL
    cardInfo.primaryFields.append(field)

    cardInfo.auxiliaryFields.append(Field("nam", NOM_PRENOM, "Passager"))

    field = Field("ter", TERMINAL, "Terminal")
    field.textAlignment = Alignment.CENTER
    cardInfo.auxiliaryFields.append(field)

    field = Field("sea", SEAT, "Siège")
    field.textAlignment = Alignment.CENTER
    cardInfo.auxiliaryFields.append(field)

    field = Field("zon", ZONE, "Zone")
    field.textAlignment = Alignment.RIGHT
    cardInfo.auxiliaryFields.append(field)

    field = DateField(
        "boa",
        EMBARQUEMENT.isoformat(),
        "Embarquement",
        dateStyle=DateStyle.NONE,
        timeStyle=DateStyle.SHORT,
    )
    cardInfo.secondaryFields.append(field)

    field = Field(
        "dur",
        "01:00",
        "Durée de vol",
    )
    field.textAlignment = Alignment.RIGHT
    cardInfo.secondaryFields.append(field)

    cardInfo.backFields.append(
        Field(
            "vid",
            """Une vidéo d'instructions est consultable <a href="http://9ogu.mjt.lu/lnk/EAAAAiBEcpQAAAAAAAAAAR4qWN8AALQJix0AAAAAAAwbTwBhSs829ezekZWBSeO6pIQnHHNxRAAMJnY/2/nkoaOE6dKkZG6NAj65d89g/aHR0cHM6Ly93d3cueW91dHViZS5jb20vd2F0Y2g_dj0yRXVCaHR6TVFMVQ">ici</a>""",
            "Présentation"))

    cardInfo.backFields.append(
        Field(
            "acs",
            """Le terminal de l'aérodrome The Game se situe au <a href="https://maps.apple.com/?address=6%20Rue%20de%20la%20Harpe,%2075005%20Paris,%20France&auid=14148564957634573501&ll=48.852927,2.344476&lsp=9902&q=The%20Game&_ext=CisKBAgEEHoKBAgFEAMKBQgGEN8BCgQIChAACgQIUhACCgQIVRAOCgQIWRABEiYpd44S9plsSEAx0ZAjdJmzAkA59WM4UsBtSEBBo+RINY/PAkBQBA%3D%3D&t=r">6 rue de la Harpe 75005 Paris</a>""",
            "Accès au terminal"))

    cardInfo.backFields.append(
        Field(
            "svc",
            """The Game Airlines vous propose toute une gamme de rafraîchissements dès votre arrivée dans notre terminal d'embarquement. Jus d'orange, thé glacé et café... à volonté pour votre plus grand confort. Retrouvez également notre Magazine pour faire passer le temps durant votre vol...""",
            "Nos services à bord",
        ))
    cardInfo.backFields.append(
        Field(
            "mor",
            """Nous avons mis en place une <a href="http://9ogu.mjt.lu/lnk/CAAAAmTDWgQAAAAAAAAAAR4qWN8AALQJix0AAAAAAAwbTwBhvFGqf8uNRHzDQLe3vSX6eKsIYwAMJnY/2/qpmowiQheKKUSDKKZU5IHA/aHR0cHM6Ly93d3cudGhlZ2FtZS1mcmFuY2UuY29tL2ZyL2NvdmlkLTE5Lmh0bQ">série de mesures</a> que nous jugeons essentielles, ce qui ne vous empêchera pas de vivre un moment fun et convivial !
Et sous nos masques gardons le sourire !""", "Covid 19 - Mesures Sanitaires"))
    cardInfo.backFields.append(
        Field(
            "pas",
            """En plus de ces mesures, la présentation du Pass Sanitaire est obligatoire pour les joueurs de 12 ans et plus. Nous vous invitons à privilégier ce pass sous format numérique via l'application Tous Anti Covid afin d'éviter tout problème à la lecture du QR code. Retrouvez toutes nos informations sur ce pass en suivant <a href="http://9ogu.mjt.lu/lnk/CAAAAmTDWgQAAAAAAAAAAR4qWN8AALQJix0AAAAAAAwbTwBhvFGqf8uNRHzDQLe3vSX6eKsIYwAMJnY/3/zcOSDpgl2hZ2FQRqCtiyFQ/aHR0cHM6Ly93d3cudGhlZ2FtZS1mcmFuY2UuY29tL2ZyL2NvdmlkLTE5Lmh0bQ">ce lien</a>""",
            "Covid 19 - Mesures Sanitaires"))

    organizationName = "The Game"
    passTypeIdentifier = "pass.com.sear.app"
    teamIdentifier = "836469M6XW"

    passfile = Pass(
        cardInfo,
        passTypeIdentifier=passTypeIdentifier,
        organizationName=organizationName,
        teamIdentifier=teamIdentifier,
    )
    passfile.serialNumber = "AZERTYUIPT"
    passfile.barcode = Barcode(
        message=
        f"M1{NOM_PRENOM.replace(' ','/').upper()}       U7EDGF {FROM[0]}{TO[0]}{FLIGHT} 093Y009D0080 147>1181WW1092BTO 0000000000000299790000000000 0                          ",
        format=BarcodeFormat.QR,
        altText="seq. nr. " + FLIGHT + ":80")

    passfile.labelColor = "rgb(37, 150, 190)"
    passfile.foregroundColor = "rgb(96, 96, 96)"
    passfile.backgroundColor = "rgb(255, 255, 255)"

    passfile.description = "The Game boardingpass"

    passfile.relevantDate = EMBARQUEMENT.isoformat()

    # Including the icon and logo is necessary for the passbook to be valid.
    passfile.addFile("icon.png", open("images/vh2tz.png", "rb"))
    passfile.addFile("*****@*****.**", open("images/vh2tz.png", "rb"))
    passfile.addFile("logo.png", open("images/vh2tz.png", "rb"))

    # Create and output the Passbook file (.pkpass)
    password = open(expanduser("~") +
                    "/pass_creator/passcreatorpwd.txt").read()
    return passfile.create(
        "certs/certificate.pem",
        expanduser("~") + "/pass_creator/private.key",
        "certs/wwdr.pem",
        password,
        "passes/" + dest + ".pkpass",
    )
예제 #6
0
def OUI_PASS(FROM, TO, DEPART, ARRIVEE, NOM, PRENOM, NUM_TRAIN, dest):
    cardInfo = BoardingPass(transitType=TransitType.TRAIN)
    field = DateField("date", DEPART, "VOYAGE DU")
    field.textAlignment = Alignment.RIGHT
    cardInfo.headerFields.append(field)

    cardInfo.primaryFields.append(Field("src", FROM[0], FROM[1]))
    field = Field("dst", TO[0], TO[1])
    field.textAlignment = Alignment.RIGHT
    cardInfo.primaryFields.append(field)

    cardInfo.secondaryFields.append(Field("nam", NOM, "NOM"))
    cardInfo.secondaryFields.append(Field("srn", PRENOM, "PRÉNOM"))

    cardInfo.auxiliaryFields.append(
        DateField(
            "dep", DEPART, "DÉPART", dateStyle=DateStyle.NONE, timeStyle=DateStyle.SHORT
        )
    )
    cardInfo.auxiliaryFields.append(Field("trn", f"N° {NUM_TRAIN}", "TRAIN"))
    cardInfo.auxiliaryFields.append(
        DateField(
            "arr",
            ARRIVEE,
            "ARRIVÉE",
            dateStyle=DateStyle.NONE,
            timeStyle=DateStyle.SHORT,
        )
    )

    cardInfo.backFields.append(
        Field(
            "ebl",
            "Le e-billet est nominatif, personnel et incessible. Une pièce d'identité pourra vous être demandée.",
            "E-BILLET",
        )
    )
    cardInfo.backFields.append(
        Field(
            "rec",
            "Il est conseillé de présenter le e-billet depuis votre application OUI.sncf.",
            "Recommandé pour le contrôle",
        )
    )
    cardInfo.backFields.append(
        Field("app", "http://bit.ly/appli_ouisncf", "Application OUI.sncf")
    )

    organizationName = "OUI.sncf"
    passTypeIdentifier = "pass.com.sear.app"
    teamIdentifier = "836469M6XW"

    passfile = Pass(
        cardInfo,
        passTypeIdentifier=passTypeIdentifier,
        organizationName=organizationName,
        teamIdentifier=teamIdentifier,
    )
    passfile.serialNumber = "AZERTYUIOP"
    passfile.barcode = Barcode(
        message="Doudou s**t s**t, Doudou s**t s**t, Doudou s**t s**t, Doudou s**t s**t, Doudou s**t s**t, Doudou s**t s**t, Doudou s**t s**t, Doudou s**t s**t !!",
        format=BarcodeFormat.AZTEC,
    )

    passfile.labelColor = "rgb(120, 114, 100)"
    passfile.foregroundColor = "rgb(203, 70, 40)"
    passfile.backgroundColor = "rgb(255, 255, 255)"

    passfile.description = "OUI PASS"

    passfile.relevantDate = DEPART

    # Including the icon and logo is necessary for the passbook to be valid.
    passfile.addFile("icon.png", open("images/logo-oui.png", "rb"))
    passfile.addFile("*****@*****.**", open("images/[email protected]", "rb"))
    passfile.addFile("logo.png", open("images/logo-oui.png", "rb"))

    # Create and output the Passbook file (.pkpass)
    password = open(expanduser("~") + "/pass_creator/passcreatorpwd.txt").read()
    return passfile.create(
        "certs/certificate.pem",
        expanduser("~") + "/pass_creator/private.key",
        "certs/wwdr.pem",
        password,
        "passes/" + dest + ".pkpass",
    )