Ejemplo n.º 1
0
class RegioManagerBaseTO(object):
    email = unicode_property('1')
    name = unicode_property('2')
    app_ids = unicode_list_property('3')
    show_in_stats = bool_property('4')
    internal_support = bool_property('5')
    phone = unicode_property('6')
    team_id = long_property('7')
    admin = bool_property('8')

    @classmethod
    def from_model(cls, model):
        to = cls()
        to.email = model.email
        to.name = model.name
        to.app_ids = sorted([
            app_id for app_id in model.app_ids
            if app_id not in model.read_only_app_ids
        ])
        to.show_in_stats = model.show_in_stats
        to.internal_support = model.internal_support
        to.phone = model.phone
        to.team_id = model.team_id
        to.admin = model.admin
        return to
Ejemplo n.º 2
0
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')
Ejemplo n.º 3
0
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)
Ejemplo n.º 4
0
class SolutionServiceMenuItem(object):
    icon_name = unicode_property('1')
    icon_color = unicode_property('2')
    label = unicode_property('3')
    tag = unicode_property('4')
    screen_branding = unicode_property('5')
    static_flow = unicode_property('6')
    requires_wifi = bool_property('7')  # False
    run_in_background = bool_property('8')  # True
    roles = long_list_property('9')  # []
    is_broadcast_settings = bool_property('10')  # False
    broadcast_branding = unicode_property('11')  # None
    broadcast_types = unicode_list_property('12')
    coords = long_list_property('13')
    action = long_property('14')
    link = typed_property('15', ServiceMenuItemLinkTO)

    def __init__(self,
                 icon_name,
                 icon_color,
                 label,
                 tag,
                 screen_branding=None,
                 requires_wifi=False,
                 run_in_background=True,
                 static_flow=None,
                 roles=None,
                 is_broadcast_settings=False,
                 broadcast_branding=None,
                 broadcast_types=None,
                 coords=None,
                 action=0,
                 link=None):
        self.icon_name = icon_name
        self.icon_color = icon_color
        self.label = label
        self.tag = tag
        self.screen_branding = screen_branding
        self.requires_wifi = requires_wifi
        self.run_in_background = run_in_background
        self.static_flow = static_flow
        self.roles = list() if roles is None else roles
        self.is_broadcast_settings = is_broadcast_settings
        self.broadcast_branding = broadcast_branding
        self.broadcast_types = list(
        ) if broadcast_types is None else broadcast_types
        self.coords = list() if coords is None else coords
        self.action = action
        self.link = link
Ejemplo n.º 5
0
class ChargeTO(object):
    id = long_property('0')
    reference = unicode_property('1')
    amount = long_property('2')  # in euro cents
    order_number = unicode_property('3')
    full_date_str = unicode_property('4')
    last_notification_date_str = unicode_property('5')
    structured_info = unicode_property('6')
    is_recurrent = bool_property('7')
    currency = unicode_property('8')
    total_amount_formatted = unicode_property('9')
    amount_paid_in_advance = long_property('10')
    amount_paid_in_advance_formatted = unicode_property('11')
    status = long_property('12')
    customer_id = long_property('13')
    manager = unicode_property('14')
    customer_po_number = unicode_property('15')
    invoice_number = unicode_property('16')
    paid = bool_property('17')

    @classmethod
    def from_model(cls, model):
        """
        Args:
            model (shop.models.Charge): charge db model
        """
        to = cls()
        to.id = model.key().id()
        to.reference = model.reference
        to.amount = model.total_amount
        to.order_number = model.order_number
        to.full_date_str = unicode(model.full_date_str)
        to.last_notification_date_str = unicode(
            model.last_notification_date_str)
        to.structured_info = model.structured_info
        to.is_recurrent = model.is_recurrent
        to.currency = model.currency
        to.total_amount_formatted = unicode(model.total_amount_formatted)
        to.amount_paid_in_advance = model.amount_paid_in_advance
        to.amount_paid_in_advance_formatted = unicode(
            model.amount_paid_in_advance_formatted)
        to.status = model.status
        to.customer_id = model.customer_id
        to.manager = model.manager and model.manager.email()
        to.customer_po_number = model.customer_po_number
        to.invoice_number = model.invoice_number
        to.paid = model.paid
        return to
Ejemplo n.º 6
0
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)
Ejemplo n.º 7
0
class InfluxDBConfig(TO):
    host = unicode_property('host')
    ssl = bool_property('ssl')
    port = long_property('port')
    database = unicode_property('database')
    username = unicode_property('username')
    password = unicode_property('password')
Ejemplo n.º 8
0
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)
Ejemplo n.º 9
0
class CreateOrderReturnStatusTO(ReturnStatusTO):
    can_replace = bool_property('5')

    @classmethod
    def create(cls, success=True, errormsg=None, can_replace=False):
        r = super(CreateOrderReturnStatusTO, cls).create(success, errormsg)
        r.can_replace = can_replace
        return r
Ejemplo n.º 10
0
class BoolReturnStatusTO(ReturnStatusTO):
    bool = bool_property('5')

    @classmethod
    def create(cls, success=True, errormsg=None, bool_value=False):
        r = super(BoolReturnStatusTO, cls).create(success, errormsg)
        r.bool = bool_value
        return r
Ejemplo n.º 11
0
 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)
Ejemplo n.º 12
0
class EventTO(TO):
    id = long_property('id')
    type = long_property('type')
    title = unicode_property('title')
    description = unicode_property('description')
    location = unicode_property('location')
    start_timestamp = unicode_property('start_timestamp')
    end_timestamp = unicode_property('end_timestamp')
    past = bool_property('past')
Ejemplo n.º 13
0
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 [])
Ejemplo n.º 14
0
class ProductTO(object):
    default = bool_property('0')
    default_comment = unicode_property('1')
    default_count = long_property('2')
    description = unicode_property('3')
    extra_subscription_months = long_property('4')
    is_subscription = bool_property('5')
    is_subscription_discount = bool_property('6')
    module_set = unicode_property('7')
    organization_types = long_list_property('8')
    possible_counts = long_list_property('9')
    price = long_property('10')
    product_dependencies = unicode_list_property('12')
    visible = bool_property('13')
    code = unicode_property('14')
    picture_url = unicode_property('15')
    price_in_euro = unicode_property('16')

    @classmethod
    def create(cls, model, language):
        to = ProductTO()
        to.code = model.key().name()
        to.default = model.default
        to.default_comment = model.default_comment(language)
        to.default_count = model.default_count
        to.description = model.description(language)
        to.extra_subscription_months = model.extra_subscription_months
        to.is_subscription = model.is_subscription
        to.is_subscription_discount = model.is_subscription_discount
        to.module_set = model.module_set
        to.organization_types = model.organization_types
        to.possible_counts = model.possible_counts
        to.price = model.price
        to.product_dependencies = model.product_dependencies
        to.visible = model.visible
        to.picture_url = model.picture_url
        to.price_in_euro = model.price_in_euro
        return to
Ejemplo n.º 15
0
class MenuItem(object):
    VISIBLE_IN_MENU = 1
    VISIBLE_IN_ORDER = 2

    name = unicode_property('1')
    price = long_property('2')
    description = unicode_property('3')
    visible_in = long_property('4')
    unit = long_property('5')
    step = long_property('6')
    image_id = long_property('7')
    qr_url = unicode_property('8')
    has_price = bool_property('9')
    id = unicode_property('10')
Ejemplo n.º 16
0
class RegioManagerStatisticTO(object):
    month_revenue = long_list_property('0')
    manager = unicode_property('1')
    show_in_stats = bool_property('2')
    team_id = long_property('3')

    @classmethod
    def create(cls, model, regio_manager):
        to = cls()
        to.month_revenue = model.month_revenue or list()
        to.manager = model.key().name()
        to.show_in_stats = bool(regio_manager) and regio_manager.show_in_stats
        to.team_id = regio_manager.team_id
        return to
Ejemplo n.º 17
0
class InvoiceTO(object):
    customer_id = long_property('1')
    charge_id = long_property('2')
    order_number = unicode_property('3')
    invoice_number = unicode_property('4')
    full_date_str = unicode_property('5')
    paid = bool_property('6')

    @staticmethod
    def fromInvoiceModel(obj):
        i = InvoiceTO()
        i.customer_id = obj.customer_id
        i.charge_id = obj.charge_id
        i.order_number = obj.order_number
        i.invoice_number = obj.invoice_number
        i.full_date_str = unicode(obj.full_date_str)
        i.paid = obj.paid or obj.payment_type in (obj.PAYMENT_MANUAL,
                                                  obj.PAYMENT_STRIPE,
                                                  obj.PAYMENT_ON_SITE)
        return i
Ejemplo n.º 18
0
class LegalEntityTO(object):
    id = long_property('1')
    name = unicode_property('2')
    address = unicode_property('3')
    postal_code = unicode_property('4')
    city = unicode_property('5')
    country_code = unicode_property('6')
    phone = unicode_property('7')
    email = unicode_property('8')
    vat_percent = long_property('9')
    vat_number = unicode_property('10')
    iban = unicode_property('11')
    bic = unicode_property('12')
    terms_of_use = unicode_property('13')
    is_mobicage = bool_property('14')
    currency = unicode_property('15')
    currency_code = unicode_property('16')
    revenue_percentage = long_property('17')

    @classmethod
    def from_model(cls, model):
        to = cls()
        to.id = model.key().id()
        to.name = model.name
        to.address = model.address
        to.postal_code = model.postal_code
        to.city = model.city
        to.country_code = model.country_code
        to.phone = model.phone
        to.email = model.email
        to.vat_percent = model.vat_percent
        to.vat_number = model.vat_number
        to.iban = model.iban
        to.bic = model.bic
        to.terms_of_use = model.terms_of_use
        to.is_mobicage = model.is_mobicage
        to.currency = model.currency
        to.currency_code = model.currency_code
        to.revenue_percentage = model.revenue_percentage
        return to
Ejemplo n.º 19
0
class ShopAppTO(object):
    name = unicode_property('1')
    bounds = typed_property('2', BoundsTO, False)
    searched_bounds = typed_property('3', BoundsTO, True)
    postal_codes = unicode_list_property('4')
    signup_enabled = bool_property('5')

    @classmethod
    def from_model(cls, model):
        to = cls()
        to.name = model.name
        most_sw, most_ne = model.south_west(), model.north_east()
        to.bounds = BoundsTO.create(
            most_sw.lat, most_sw.lon, most_ne.lat,
            most_ne.lon) if most_sw and most_ne else None
        to.searched_bounds = [
            BoundsTO.create(sw.lat, sw.lon, ne.lat, ne.lon)
            for sw, ne in zip(model.searched_south_west_bounds,
                              model.searched_north_east_bounds)
        ]
        to.postal_codes = model.postal_codes
        to.signup_enabled = model.signup_enabled
        return to
Ejemplo n.º 20
0
class CustomerLocationTO(object):
    name = unicode_property('1')
    description = unicode_property('2')
    has_terminal = bool_property('3')
    lat = float_property('4')
    lon = float_property('5')
    address = unicode_property('6')
    type = long_property('7')

    def __init__(self,
                 name=None,
                 description=None,
                 has_terminal=False,
                 lat=None,
                 lon=None,
                 address=None,
                 type_=None):
        self.name = name
        self.description = description
        self.has_terminal = has_terminal
        self.lat = lat
        self.lon = lon
        self.address = address
        self.type = type_
Ejemplo n.º 21
0
class ProspectTO(object):
    id = unicode_property('0')
    app_id = unicode_property('1')
    name = unicode_property('2')
    lat = float_property('3')
    lon = float_property('4')
    address = unicode_property('5')
    phone = unicode_property('6')
    website = unicode_property('7')
    types = unicode_list_property('8')
    status = long_property('9')
    reason = unicode_property('10')
    action_timestamp = long_property('11')
    assignee = unicode_property('12')
    email = unicode_property('13')
    comments = typed_property('14', ProspectComment, True)
    has_customer = bool_property('15')
    customer_id = long_property('16')
    certainty = long_property('17')
    subscription = long_property('18')
    categories = unicode_list_property('19')

    @classmethod
    def from_model(cls, model):
        if not model:
            return None
        to = cls()
        to.id = model.id
        to.app_id = model.app_id
        to.name = model.name
        if model.geo_point:
            to.lat = model.geo_point.lat
            to.lon = model.geo_point.lon
        else:
            to.lat = 0
            to.lon = 0
        to.address = model.address
        to.phone = model.phone
        to.website = model.website
        to.types = model.type
        to.status = model.status
        to.reason = model.reason
        to.action_timestamp = model.action_timestamp
        to.assignee = model.assignee
        to.email = model.email
        to.comments = list(
        ) if model.comments is None else model.comments.values()
        if model.customer_id is None:
            to.has_customer = False
            to.customer_id = -1
        else:
            to.has_customer = True
            to.customer_id = model.customer_id
        if model.certainty is None:
            to.certainty = 0
        else:
            to.certainty = model.certainty
        if model.subscription is None:
            to.subscription = 0
        else:
            to.subscription = model.subscription
        to.categories = map(unicode, model.categories)
        return to
Ejemplo n.º 22
0
class BasePresenceTO(TO):
    event_id = long_property('event_id')
    username = unicode_property('username')
    wants_recording = bool_property('wants_recording')
    status = long_property('status')
Ejemplo n.º 23
0
class CustomerTO(CompanyTO):
    id = long_property('51')
    service_email = unicode_property('52')
    auto_login_url = unicode_property('54')
    stripe_valid = bool_property('55')
    migration_job = unicode_property('56')
    manager = unicode_property('57')
    app_ids = unicode_list_property('58')
    extra_apps_count = long_property('59')
    prospect_id = unicode_property('60')
    language = unicode_property('61')
    subscription_type = unicode_property('62')
    has_loyalty = bool_property('63')
    creation_time = long_property('64')
    team_id = long_property('65')
    can_edit = bool_property('66')
    is_admin = bool_property('67')
    service_disabled_at = long_property('68')
    service_disabled_reason = unicode_property('69')
    service_disabled_reason_int = long_property('70')
    subscription_cancel_pending_date = long_property('71')
    cancelling_on_date = long_property(
        '72')  # Customer his subscription will be disabled on this date

    @staticmethod
    def fromCustomerModel(customer, can_edit, is_admin):
        c = CustomerTO()
        c.name = customer.name
        c.address1 = customer.address1
        c.address2 = customer.address2
        c.zip_code = customer.zip_code
        c.city = customer.city
        c.country = customer.country
        c.vat = customer.vat
        c.organization_type = customer.organization_type
        c.id = customer.id
        c.service_email = customer.service_email
        c.user_email = customer.user_email
        c.auto_login_url = customer.auto_login_url if customer.service_email else None
        c.stripe_valid = customer.stripe_valid
        c.migration_job = customer.migration_job
        c.manager = customer.manager.email().decode(
            'utf-8') if customer.manager else None
        c.app_ids = customer.sorted_app_ids
        c.extra_apps_count = customer.extra_apps_count
        c.prospect_id = customer.prospect_id
        c.language = customer.language
        c.subscription_type = customer.SUBSCRIPTION_TYPES[
            customer.subscription_type]
        c.has_loyalty = customer.has_loyalty
        c.creation_time = customer.creation_time
        c.team_id = customer.team_id
        c.can_edit = can_edit
        c.is_admin = is_admin
        c.service_disabled_at = customer.service_disabled_at
        if customer.subscription_cancel_pending_date != 0 and customer.subscription_order_number:
            c.cancelling_on_date = Order.get(
                Order.create_key(
                    customer.id,
                    customer.subscription_order_number)).next_charge_date
        else:
            c.cancelling_on_date = 0
        c.service_disabled_reason = customer.disabled_reason or customer.disabled_reason_str
        c.service_disabled_reason_int = customer.disabled_reason_int
        c.subscription_cancel_pending_date = customer.subscription_cancel_pending_date
        c.website = customer.website
        c.facebook_page = customer.facebook_page
        return c
Ejemplo n.º 24
0
class CurrencyValueTO(TO):
    currency = unicode_property('currency')
    value = float_property('value')
    timestamp = long_property('timestamp')
    auto_update = bool_property('auto_update')
Ejemplo n.º 25
0
class TransactionTO(BaseTransactionTO):
    id = long_property('id')
    amount_left = long_property('amount_left')
    height = long_property('height')
    fully_spent = bool_property('fully_spent')
Ejemplo n.º 26
0
class PendingTransactionTO(BaseTransactionTO):
    id = unicode_property('id')
    synced = bool_property('synced')
    synced_status = unicode_property('synced_status')