class TffProfileTO(TO): username = unicode_property('username') app_user = unicode_property('app_user') referrer_user = unicode_property('referrer_user') referrer_username = unicode_property('referrer_username') nodes = typed_property('nodes', dict, True) referral_code = unicode_property('referral_code') kyc = typed_property('kyc', dict)
class Dummy(object): f1 = unicode_property('1') f2 = bool_property('2') f3 = float_property('3') f4 = long_property('4') f5 = unicode_list_property('5') f6 = typed_property('6', InnerDummy) f7 = typed_property('7', InnerDummy, True)
class ProspectDetailsTO(object): prospect = typed_property('1', ProspectTO, False) regio_managers = typed_property('2', RegioManagerBaseTO, True) @classmethod def from_model(cls, prospect, regio_managers): to = cls() to.prospect = ProspectTO.from_model(prospect) to.regio_managers = map(RegioManagerBaseTO.from_model, regio_managers) return to
class BoundsTO(object): south_west = typed_property('1', PointTO) north_east = typed_property('2', PointTO) @classmethod def create(cls, sw_lat, sw_lon, ne_lat, ne_lon): to = cls() to.south_west = PointTO.create(sw_lat, sw_lon) to.north_east = PointTO.create(ne_lat, ne_lon) return to
class CustomerChargeTO(object): # was a part of SignOrderReturnStatusTO with 51/52 charge = typed_property('51', ChargeTO, False) customer = typed_property('52', CustomerTO, False) @classmethod def from_model(cls, charge, customer, can_edit=False, is_admin=False): to = cls() to.charge = ChargeTO.from_model(charge) to.customer = CustomerTO.fromCustomerModel(customer, can_edit, is_admin) return to
class CreateNodeOrderTO(TO): app_user = unicode_property('app_user') billing_info = typed_property('billing_info', ContactInfoTO) # type: ContactInfoTO shipping_info = typed_property('shipping_info', ContactInfoTO) # type: ContactInfoTO status = long_property('status') order_time = long_property('order_time') sign_time = long_property('sign_time') send_time = long_property('send_time') odoo_sale_order_id = long_property('odoo_sale_order_id') document = unicode_property('document')
class PaymentProviderAssetTO(TO): provider_id = unicode_property('1') id = unicode_property('2') type = unicode_property('3') name = unicode_property('4') currency = unicode_property('5') available_balance = typed_property('6', PaymentAssetBalanceTO) total_balance = typed_property('7', PaymentAssetBalanceTO) verified = bool_property('8') enabled = bool_property('9') has_balance = bool_property('10') has_transactions = bool_property('11') required_action = typed_property('12', PaymentAssetRequiredActionTO)
class CustomerServiceTO(SerializableTO): name = unicode_property('1') email = unicode_property('2') address = unicode_property('3') phone_number = unicode_property('4') language = unicode_property('5') currency = unicode_property('6') modules = unicode_list_property('7') broadcast_types = unicode_list_property('8') apps = unicode_list_property('9') organization_type = long_property('10') app_infos = typed_property('11', AppInfoTO, True) current_user_app_infos = typed_property('12', AppInfoTO, True) managed_organization_types = long_list_property('13')
class ProspectsMapTO(object): cursor = unicode_property('1') prospects = typed_property('2', ProspectTO, True) regio_managers = typed_property('3', RegioManagerBaseTO, True) @classmethod def from_model(cls, cursor, prospects, regio_managers): to = cls() to.cursor = cursor to.prospects = [ ProspectTO.from_model(p) for p in prospects if p.geo_point ] to.regio_managers = map(RegioManagerBaseTO.from_model, regio_managers) return to
class MenuCategory(object): name = unicode_property('1') items = typed_property('2', MenuItem, True) index = long_property('3') predescription = unicode_property('4') postdescription = unicode_property('5') id = unicode_property('6')
class CustomerChargesTO(object): customer_charges = typed_property('1', CustomerChargeTO, True) # related to manager/user is_admin = bool_property('2') is_reseller = bool_property('3') is_payment_admin = bool_property('4') cursor = unicode_property('5')
class TickerEntryTO(TO): date = unicode_property('date') data = typed_property('data', dict) id = unicode_property('id') type = unicode_property('type') # one of ['flow', 'installation'] def to_dict(self, include=None, exclude=None): return super(TickerEntryTO, self).to_dict(exclude=exclude or ['id'])
class LegalEntityReturnStatusTO(ReturnStatusTO): entity = typed_property('101', LegalEntityTO, False) @classmethod def create(cls, success=True, errormsg=None, entity=None): to = super(LegalEntityReturnStatusTO, cls).create(success, errormsg) to.entity = LegalEntityTO.from_model(entity) if entity else None return to
class TffConfiguration(TO): """ Args: rogerthat(RogerthatConfiguration) ledger(LedgerConfiguration) odoo(OdooConfiguration) orchestator(OrchestatorConfiguration) investor(InvestorConfiguration) apple(AppleConfiguration) backup_disabled(bool) intercom_admin_id(unicode) cloudstorage_encryption_key(unicode) onfido(OnfidoConfiguration) """ rogerthat = typed_property('1', RogerthatConfiguration, False) ledger = typed_property('3', LedgerConfiguration, False) odoo = typed_property('4', OdooConfiguration, False) orchestator = typed_property('5', OrchestatorConfiguration, False) investor = typed_property('6', InvestorConfiguration, False) apple = typed_property('apple', AppleConfiguration) backup_disabled = bool_property('backup_disabled') intercom_admin_id = long_property('intercom_admin_id') cloudstorage_encryption_key = unicode_property( 'cloudstorage_encryption_key') exchangerate_key = unicode_property('exchangerate_key') onfido = typed_property('onfido', OnfidoConfiguration)
class GlobalStatsTO(TO): id = unicode_property('id') name = unicode_property('name') token_count = long_property('token_count') unlocked_count = long_property('unlocked_count') value = float_property('value') currencies = typed_property('currencies', CurrencyValueTO, True) # type: list[CurrencyValueTO] market_cap = float_property('market_cap')
class ContactReturnStatusTO(ReturnStatusTO): contact = typed_property('51', ContactTO) @classmethod def create(cls, success=True, errormsg=None, contact=None): r = super(ContactReturnStatusTO, cls).create(success=success, errormsg=errormsg) r.contact = contact return r
class NodeOrderDetailsTO(NodeOrderTO): see_document = typed_property('see_document', IYOSeeDocument) # type: IYOSeeDocument @classmethod def from_model(cls, model, see_document): to = super(NodeOrderDetailsTO, cls).from_model(model) to.see_document = see_document return to
class OrderReturnStatusTO(ReturnStatusTO): order = typed_property('3', OrderTO, False) @classmethod def create(cls, success=True, errormsg=None, order=None): to = super(OrderReturnStatusTO, cls).create(success=success, errormsg=errormsg) to.order = OrderTO.fromOrderModel(order) if order else None return to
class CityBoundsReturnStatusTO(ReturnStatusTO): bounds = typed_property('51', BoundsTO, False) @classmethod def create(cls, success=True, errormsg=None, bounds=None): to = super(CityBoundsReturnStatusTO, cls).create(success=success, errormsg=errormsg) to.bounds = bounds return to
class NodeOrderTO(TO): id = long_property('id') app_user = unicode_property('app_user') billing_info = typed_property('billing_info', ContactInfoTO) shipping_info = typed_property('shipping_info', ContactInfoTO) status = long_property('status') tos_iyo_see_id = unicode_property('tos_iyo_see_id') signature_payload = unicode_property('signature_payload') signature = unicode_property('signature') order_time = long_property('order_time') sign_time = long_property('sign_time') send_time = long_property('send_time') arrival_time = long_property('arrival_time') cancel_time = long_property('cancel_time') modification_time = long_property('modification_time') odoo_sale_order_id = long_property('odoo_sale_order_id') socket = unicode_property('socket') document_url = unicode_property('document_url')
class PaginatedResultTO(TO): cursor = unicode_property('cursor') more = bool_property('more') results = typed_property('results', dict, True) # Must be overwritten by superclass def __init__(self, cursor=None, more=False, results=None): super(PaginatedResultTO, self).__init__(cursor=cursor, more=more, results=results or [])
class PendingTransactionListTO(PaginatedResultTO): results = typed_property('results', PendingTransactionTO, True) @classmethod def from_query(cls, models, cursor, more): # type: (list[PendingTransaction], unicode, boolean) -> PendingTransactionListTO assert isinstance(cursor, (ndb.Cursor, NoneType)) results = [PendingTransactionTO.from_model(model) for model in models] return cls(cursor and cursor.to_websafe_string().decode('utf-8'), more, results)
class RegioManagerReturnStatusTO(ReturnStatusTO): regio_manager = typed_property('51', RegioManagerTO, False) @classmethod def create(cls, success=True, errormsg=None, regio_manager=None): to = super(RegioManagerReturnStatusTO, cls).create(success=success, errormsg=errormsg) to.regio_manager = RegioManagerTO.from_model( regio_manager) if regio_manager else None return to
class InvestmentAgreementDetailsTO(InvestmentAgreementTO): see_document = typed_property('see_document', IYOSeeDocument) @classmethod def from_model(cls, model, see_document=None): # type: (InvestmentAgreement, IYOSeeDocument) -> cls assert isinstance(model, InvestmentAgreement) to = super(InvestmentAgreementDetailsTO, cls).from_model(model) to.see_document = see_document return to
class OdooConfiguration(TO): url = unicode_property('1') database = unicode_property('2') username = unicode_property('3') password = unicode_property('4') incoterm = long_property('5') payment_term = long_property('6') product_ids = typed_property( 'product_ids', dict) # key: the node's socket type, value: product id
class CustomerReturnStatusTO(ReturnStatusTO): customer = typed_property('51', CustomerTO) warning = unicode_property('52') @classmethod def create(cls, success=True, errormsg=None, customer=None, warning=None): r = super(CustomerReturnStatusTO, cls).create(success=success, errormsg=errormsg) r.customer = customer r.warning = warning return r
class RegioManagerTeamsTO(object): unassigned_regio_managers = typed_property('1', RegioManagerTO, True) regio_manager_teams = typed_property('2', RegioManagerTeamTO, True) apps = typed_property('3', AppInfoTO, True) unassigned_apps = unicode_list_property('4') @classmethod def from_model(cls, regio_manager_teams, regio_managers, apps): to = cls() unassigned_regio_managers = [] rms = {} for rm in regio_managers: unassigned_regio_managers.append(rm.email) rms[rm.email] = rm filtered_apps = [] unassigned_apps = [] for app in apps: if app.app_id != App.APP_ID_OSA_LOYALTY: filtered_apps.append(app) unassigned_apps.append(app.app_id) to.regio_manager_teams = [] for rmt in regio_manager_teams: rmt_members = [] for rm in rmt.regio_managers: unassigned_regio_managers.remove(rm) rmt_members.append(rms[rm]) to.regio_manager_teams.append( RegioManagerTeamTO.from_model(rmt, rmt_members)) for app_id in rmt.app_ids: if app_id in unassigned_apps: unassigned_apps.remove(app_id) to.unassigned_regio_managers = map( RegioManagerTO.from_model, [rms[rm] for rm in unassigned_regio_managers]) to.apps = map(AppInfoTO.fromModel, filtered_apps) to.unassigned_apps = sorted(unassigned_apps) return to
class TffConfiguration(TO): """ Args: rogerthat(RogerthatConfiguration) ledger(LedgerConfiguration) odoo(OdooConfiguration) support_emails(list[string]) orchestator(OrchestatorConfiguration) investor(InvestorConfiguration) apple(AppleConfiguration) backup_disabled(bool) intercom_admin_id(unicode) cloudstorage_encryption_key(unicode) onfido(OnfidoConfiguration) influxdb(InfluxDBConfig) """ rogerthat = typed_property('1', RogerthatConfiguration, False) ledger = typed_property('3', LedgerConfiguration, False) odoo = typed_property('4', OdooConfiguration, False) orchestator = typed_property('5', OrchestatorConfiguration, False) support_emails = unicode_list_property('support_emails') backup_disabled = bool_property('backup_disabled') intercom_admin_id = long_property('intercom_admin_id') cloudstorage_encryption_key = unicode_property( 'cloudstorage_encryption_key') exchangerate_key = unicode_property('exchangerate_key') onfido = typed_property('onfido', OnfidoConfiguration) influxdb = typed_property('influxdb', InfluxDBConfig)
class AuditLogDetailsTO(AuditLogTO): reference = typed_property('reference', TO, subtype_attr_name='audit_type', subtype_mapping=AUDIT_LOG_TYPE_MAPPING) @classmethod def from_model(cls, model, reference_model=None): # type: (NdbModel, NdbModel) -> AuditLogDetailsTO props = model.to_dict() props['reference'] = reference_model.to_dict( ) if reference_model else None return parse_complex_value(cls, props, False)
class ErrorResponse(object): status_code = long_property('1') error = unicode_property('2') data = typed_property('3', dict) def __init__(self, rest_exception): """ Args: rest_exception (mcfw.exceptions.HttpException): """ self.status_code = rest_exception.http_code self.error = u'%s' % rest_exception.error self.data = rest_exception.data
def __init__(self): self.step_id = None self.buttons = list() self.sent_count = list() self.received_count = list() self.read_count = list() def get_button(self, btn_id): for button in self.buttons: if button.button_id == btn_id: return button return None # need to set next_step this way because FlowStepButtonStatisticsTO and FlowStepStatisticsTO refer to each other FlowStepButtonStatisticsTO.next_steps = typed_property('3', FlowStepStatisticsTO, True) class FlowStatisticsTO(object): tag = unicode_property('1') flows = typed_property('2', FlowStepStatisticsTO, True, doc='Hierarchical view of steps') steps = typed_property('3', FlowStepStatisticsTO, True, doc='Flat view of steps, containing the total sent/received/read/acked counts per day') VIEW_FLOWS = 1 VIEW_STEPS = 2 GROUP_BY_DAY = u'day' GROUP_BY_MONTH = u'month' GROUP_BY_YEAR = u'year'