Ejemplo n.º 1
0
 def __init__(
     self,
     *,
     id: UUID,
     changed: int = timestamp(),
     user: int,  # User.id
     tag: UUID,  # Tag.id
     date: datetime_date,  # yyyy-MM-dd
     income: float,  # >= 0
     incomeAccount: str,  # -> Account.id
     outcome: float,  # >= 0
     outcomeAccount: str,  # -> Account.id
     **kwargs,
 ):
     self.id = id
     self.changed = changed
     self.user = user
     self.tag = tag
     self.date = date
     self.income = income
     self.incomeAccount = incomeAccount
     self.outcome = outcome
     self.outcomeAccount = outcomeAccount
     for k, v in kwargs.items():
         setattr(self, k, v)
Ejemplo n.º 2
0
    def diff(self, data: dict, server_timestamp: int = None) -> dict:
        if 'serverTimestamp' not in data:
            data['serverTimestamp'] = server_timestamp
        if 'currentClientTimestamp' not in data:
            data['currentClientTimestamp'] = timestamp()

        response = self.s.post(self.uri_diff, json=data)
        return response.json()
Ejemplo n.º 3
0
 def __init__(
     self,
     *,
     id: UUID,  # UUID, string in original
     changed: int = timestamp(),
     created: int = timestamp(),
     user: UUID,  # User.id
     deleted: bool = False,
     # hold:                 Bool?
     incomeInstrument: int,  # -> Instrument.id
     incomeAccount: UUID,  # -> Account.id
     income: float,  # >= 0
     outcomeInstrument: int,  # -> Instrument.id
     outcomeAccount: UUID,  # -> Account.id
     outcome: float,  # >= 0
     # tag:                  [String  -> Tag.id]?
     # merchant:             UUID? -> Merchant.id
     # payee:                String?
     # originalPayee:        String?
     # comment:              String?
     date: datetime_date,  # 'yyyy-MM-dd'
     # mcc:                  Int?
     # reminderMarker:       String? -> ReminderMarker.id
     # opIncome:             Double? >= 0
     # opIncomeInstrument:   Int? -> Instrument.id
     # opOutcome:            Double? >= 0
     # opOutcomeInstrument:  Int? -> Instrument.id
     # latitude:             Double? >= -90  && <= 90
     # longitude:            Double? >= -180 && <= 180
     **kwargs):
     self.id = id
     self.changed = changed
     self.created = created
     self.user = user
     self.deleted = deleted
     self.incomeInstrument = incomeInstrument
     self.incomeAccount = incomeAccount
     self.income = income
     self.outcomeInstrument = outcomeInstrument
     self.outcomeAccount = outcomeAccount
     self.outcome = outcome
     self.date = date
     for k, v in kwargs.items():
         setattr(self, k, v)
Ejemplo n.º 4
0
 def __init__(self,
              *,
              id:       UUID,  # UUID, string in original
              changed:  int = timestamp(),
              user:     UUID,  # User.id
              title:    str,
              **kwargs,
              ):
     self.id = id
     self.changed = changed
     self.user = user
     self.title = title
     for k, v in kwargs.items():
         setattr(self, k, v)
Ejemplo n.º 5
0
 def __init__(
     self,
     *,
     id: int,
     changed: int = timestamp(),
     login: str = None,  # could be empty
     currency: int,  # Instrument.id
     parent: int = None,  # User.id, could be empty
     **kwargs,
 ):
     self.id = id
     self.changed = changed
     self.login = login
     self.currency = currency
     self.parent = parent
     for k, v in kwargs.items():
         setattr(self, k, v)
Ejemplo n.º 6
0
 def __init__(self,
              *,
              id:          int,
              changed:     int = timestamp(),
              title:       str,
              shortTitle:  str,  # 3 letters code
              symbol:      str,
              rate:        float,  # relative to RUB
              **kwargs,
              ):
     self.id = id
     self.changed = changed
     self.title = title
     self.shortTitle = shortTitle
     self.symbol = symbol
     self.rate = rate
     for k, v in kwargs.items():
         setattr(self, k, v)
Ejemplo n.º 7
0
 def __init__(
     self,
     *,
     id: UUID,  # UUID, string in original
     changed: int = timestamp(),
     user: UUID,  # User.id
     # role:                   Int? -> User.id?
     instrument: int = None,  # -> Instrument.id
     company: int = None,  # -> Company.id
     type: str,  # See check in body
     # balance:                Double?
     # startBalance:           Double?
     # creditLimit:            Double? >= 0
     inBalance: bool,
     # savings:                Bool?
     enableCorrection: bool,
     enableSMS: bool,
     archive: bool,
     # capitalization:         Bool
     # percent:                Double >= 0 && < 100
     # startDate:              'yyyy-MM-dd'
     # endDateOffset:          Int
     # endDateOffsetInterval:  ('day' | 'week' | 'month' | 'year')
     # payoffStep:             Int?
     # payoffInterval:         ('month' | 'year')?
     **kwargs,
 ):
     self.id = id
     self.changed = changed
     self.user = user
     self.instrument = instrument
     self.company = company
     valid_type = [
         'cash', 'ccard', 'checking', 'loan', 'deposit', 'emoney', 'debt'
     ]
     if type not in valid_type:
         raise (ValueError('"type" should be in {}'.format(valid_type)))
     self.type = type
     self.inBalance = inBalance
     self.enableCorrection = enableCorrection
     self.enableSMS = enableSMS
     self.archive = archive
     for k, v in kwargs.items():
         setattr(self, k, v)
Ejemplo n.º 8
0
 def __init__(
     self,
     *,
     id: int,
     changed: int = timestamp(),
     title: str,
     fullTitle: str = None,  # could be empty
     www: str = None,  # could be empty
     country: str = None,  # could be empty
     **kwargs,
 ):
     self.id = id
     self.changed = changed
     self.title = title
     self.fullTitle = fullTitle
     self.www = www
     self.country = country
     for k, v in kwargs.items():
         setattr(self, k, v)
Ejemplo n.º 9
0
 def __init__(self,
              *,
              id:                 UUID,  # UUID, string in original
              changed:            int = timestamp(),
              user:               UUID,  # User.id
              incomeInstrument:   int,  # -> Instrument.id
              incomeAccount:      UUID,  # -> Account.id
              income:             float,  # >= 0
              outcomeInstrument:  int,  # -> Instrument.id
              outcomeAccount:     UUID,  # -> Account.id
              outcome:            float,  # >= 0
              # tag:              [String  -> Tag.id]?
              # merchant:         UUID? -> Merchant.id
              # payee:            String?
              # originalPayee:    String?
              # comment:          String?
              interval:           str = None,  # See check in body
              step:               int = 0,
              points:             list = [],  # See check in body
              startDate:          date,
              endDate:            date = None,
              notify:             bool,
              **kwargs
              ):
     self.id = id
     self.changed = changed
     self.user = user
     self.incomeInstrument = incomeInstrument
     self.incomeAccount = incomeAccount
     self.income = income
     self.outcomeInstrument = outcomeInstrument
     self.outcomeAccount = outcomeAccount
     self.outcome = outcome
     self.interval = interval
     self.step = step
     self.points = points
     self.startDate = startDate
     self.endDate = endDate
     self.notify = notify
     for k, v in kwargs.items():
         setattr(self, k, v)
Ejemplo n.º 10
0
 def __init__(
         self,
         *,
         id: UUID,  # UUID, string in original
         changed: int = timestamp(),
         user: UUID,  # User.id
         incomeInstrument: int,  # -> Instrument.id
         incomeAccount: UUID,  # -> Account.id
         income: float,  # >= 0
         outcomeInstrument: int,  # -> Instrument.id
         outcomeAccount: UUID,  # -> Account.id
         outcome: float,  # >= 0
         # tag:              [String  -> Tag.id]?
         # merchant:         UUID? -> Merchant.id
         # payee:            String?
         # originalPayee:    String?
         # comment:          String?
     date: datetime_date,  # yyyy-MM-dd
         reminder: UUID,  # -> Reminder.id
         state: str,  # planned, processed, deleted
         notify: bool,
         **kwargs):
     self.id = id
     self.changed = changed
     self.user = user
     self.incomeInstrument = incomeInstrument
     self.incomeAccount = incomeAccount
     self.income = income
     self.outcomeInstrument = outcomeInstrument
     self.outcomeAccount = outcomeAccount
     self.outcome = outcome
     self.date = date
     self.reminder = reminder
     self.state = state
     self.notify = notify
     for k, v in kwargs.items():
         setattr(self, k, v)