def text_modules_data(self, header, body, localized_header, localized_body): text_module = { 'header': header, 'body': body, 'localizedHeader': utils.localized_string(localized_header, self._defaultLang), 'localizedBody': utils.localized_string(localized_body, self._defaultLang), } if 'textModulesData' not in self._eventTicketClass: self._eventTicketClass['textModulesData'] = [] self._eventTicketClass['textModulesData'].append(text_module)
def confirmation_code_label(self, confirmation_code_label): if hasattr(constants.ConfirmationCode, str(confirmation_code_label)): self._eventTicketClass['confirmationCodeLabel'] = confirmation_code_label else: self._eventTicketClass['customConfirmationCodeLabel'] = utils.localized_string( confirmation_code_label, self._defaultLang )
def gate(self, gate): if 'seatInfo' not in self._eventTicketObject: self._eventTicketObject['seatInfo'] = { 'kind': 'walletobjects#eventSeat' } self._eventTicketObject['seatInfo']['gate'] = utils.localized_string( gate, self._defaultLang)
def section(self, section): if 'seatInfo' not in self._eventTicketObject: self._eventTicketObject['seatInfo'] = { 'kind': 'walletobjects#eventSeat' } self._eventTicketObject['seatInfo'][ 'section'] = utils.localized_string(section, self._defaultLang)
def row(self, row): if 'seatInfo' not in self._eventTicketObject: self._eventTicketObject['seatInfo'] = { 'kind': 'walletobjects#eventSeat' } self._eventTicketObject['seatInfo']['row'] = utils.localized_string( row, self._defaultLang)
def date_time(self, doors_open_label, doors_open, start, end): date_time = { 'kind': 'walletobjects#eventDateTime', 'doorsOpen': doors_open, 'start': start, 'end': end } if hasattr(constants.DoorsOpen, str(doors_open_label)): date_time['doorsOpenLabel'] = doors_open_label else: date_time['customDoorsOpenLabel'] = utils.localized_string(doors_open_label, self._defaultLang) self._eventTicketClass['dateTime'] = date_time
def __init__( self, issuer_name, class_id, multiple_devices_and_holders_allowed_status, event_name, review_status, default_lang ): if not issuer_name: raise ValueError('issuer_name is not provided') if not class_id: raise ValueError('class_id is not provided') if not hasattr( constants.MultipleDevicesAndHoldersAllowedStatus, str(multiple_devices_and_holders_allowed_status) ): raise TypeError( "multiple_devices_and_holders_allowed_status is not of instance " "walletobjects.constants.MultipleDevicesAndHoldersAllowedStatus" ) if not event_name: raise ValueError('event_name is not provided') if not hasattr(constants.ReviewStatus, str(review_status)): raise TypeError('review_status is not of instance walletobjects.constants.reviewStatus') if not default_lang: raise ValueError('default_lang is not specified') self._defaultLang = default_lang self._eventTicketClass = { 'id': class_id, 'issuerName': issuer_name, 'multipleDevicesAndHoldersAllowedStatus': multiple_devices_and_holders_allowed_status, 'eventName': utils.localized_string(event_name, self._defaultLang), 'reviewStatus': review_status, }
def localized_issuer_name(self, localized_issuer_name): self._eventTicketClass['localizedIssuerName'] = utils.localized_string(localized_issuer_name, self._defaultLang)
def gate_label(self, gate_label): if hasattr(constants.Gate, str(gate_label)): self._eventTicketClass['gateLabel'] = gate_label else: self._eventTicketClass['customGateLabel'] = utils.localized_string(gate_label, self._defaultLang)
def section_label(self, section_label): if hasattr(constants.Section, str(section_label)): self._eventTicketClass['sectionLabel'] = section_label else: self._eventTicketClass['customSectionLabel'] = utils.localized_string(section_label, self._defaultLang)
def row_label(self, row_label): if hasattr(constants.Row, str(row_label)): self._eventTicketClass['rowLabel'] = row_label else: self._eventTicketClass['customRowLabel'] = utils.localized_string(row_label, self._defaultLang)
def fine_print(self, fine_print): self._eventTicketClass['finePrint'] = utils.localized_string(fine_print, self._defaultLang)
def ticket_type(self, ticket_type): self._eventTicketObject['ticketType'] = utils.localized_string( ticket_type, self._defaultLang)