# Path: netvisor/schemas/fields.py
# class Decimal(fields.Decimal):
#     def _deserialize(self, value, attr, data):
#         return super(Decimal, self)._deserialize(
#             value.replace(',', '.'),
#             attr,
#             data
#         )
# 
#     def serialize(self, attr, obj, accessor=None):
#         value = super(Decimal, self).serialize(attr, obj, accessor)
#         if value is missing:
#             return value
#         return str(value).replace('.', ',')
# 
# class FinnishDate(fields.Field):
#     def _deserialize(self, value, attr, data):
#         msg = 'Could not deserialize {0!r} to a date object.'.format(value)
#         err = ValidationError(getattr(self, 'error', None) or msg)
#         if not value:  # falsy values are invalid
#             raise err
#         try:
#             return datetime.strptime(value, '%d.%m.%Y').date()
#         except (AttributeError, TypeError, ValueError):
#             raise err
# 
# class List(fields.List):
#     def _deserialize(self, value, attr, data):
#         if not is_collection(value) and value is not None:
#             value = [value]
#         return super(List, self)._deserialize(value, attr, data)


from marshmallow import Schema, fields, post_load
from ..fields import Decimal, FinnishDate, List
# -*- coding: utf-8 -*-
"""
    netvisor.schemas.sales_payments.list
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    :copyright: (c) 2013-2016 by Fast Monkeys Oy.
    :license: MIT, see LICENSE for more details.
"""



class BankStatusErrorDescriptionSchema(Schema):
    code = fields.String(load_from='@code')
    description = fields.String(load_from='#text')


class SalesPaymentSchema(Schema):
    netvisor_key = fields.Integer()
    name = fields.String()

# Path: netvisor/schemas/fields.py
# class Decimal(fields.Decimal):
#     def _deserialize(self, value, attr, data):
#         return super(Decimal, self)._deserialize(
#             value.replace(',', '.'),
#             attr,
#             data
#         )
# 
#     def serialize(self, attr, obj, accessor=None):
#         value = super(Decimal, self).serialize(attr, obj, accessor)
#         if value is missing:
#             return value
#         return str(value).replace('.', ',')
# 
# class FinnishDate(fields.Field):
#     def _deserialize(self, value, attr, data):
#         msg = 'Could not deserialize {0!r} to a date object.'.format(value)
#         err = ValidationError(getattr(self, 'error', None) or msg)
#         if not value:  # falsy values are invalid
#             raise err
#         try:
#             return datetime.strptime(value, '%d.%m.%Y').date()
#         except (AttributeError, TypeError, ValueError):
#             raise err
# 
# class List(fields.List):
#     def _deserialize(self, value, attr, data):
#         if not is_collection(value) and value is not None:
#             value = [value]
#         return super(List, self)._deserialize(value, attr, data)


# Path: netvisor/schemas/sales_payments/list.py
from marshmallow import Schema, fields, post_load
from ..fields import Decimal, FinnishDate, List

# -*- coding: utf-8 -*-
"""
    netvisor.schemas.sales_payments.list
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    :copyright: (c) 2013-2016 by Fast Monkeys Oy.
    :license: MIT, see LICENSE for more details.
"""



class BankStatusErrorDescriptionSchema(Schema):
    code = fields.String(load_from='@code')
    description = fields.String(load_from='#text')


class SalesPaymentSchema(Schema):
    netvisor_key = fields.Integer()
    name = fields.String()

    date = FinnishDate()