Changeset 12113


Ignore:
Timestamp:
2 Dec 2014, 08:30:01 (10 years ago)
Author:
uli
Message:

Try to incorporate a more general idea of payments.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.ikoba/branches/uli-payments/src/waeup/ikoba/payments/interfaces.py

    r11949 r12113  
    1616## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
    1717##
     18import decimal
    1819from zope.interface import Attribute
    1920from zope import schema
     
    2324from waeup.ikoba.interfaces import MessageFactory as _
    2425
     26
     27#: Possible states of payments
     28STATE_UNPAID = 1
     29STATE_PAID = 2
     30STATE_FAILED = 4
     31
    2532payment_states = SimpleIkobaVocabulary(
    26     (_('Not yet paid'),'unpaid'),
    27     (_('Paid'),'paid'),
    28     (_('Failed'),'failed'),
     33    (_('Not yet paid'), STATE_UNPAID),
     34    (_('Paid'), STATE_PAID),
     35    (_('Failed'), STATE_FAILED),
    2936    )
     37
    3038
    3139class PaymentCategorySource(ContextualDictSourceFactoryBase):
     
    4553
    4654    """
    47     p_id = Attribute('Payment identifier')
    48 
    49     p_category = schema.Choice(
    50         title = _(u'Payment Category'),
    51         #default = u'schoolfee',
    52         source = PaymentCategorySource(),
     55    payment_id = schema.TextLine(
     56        title = u'Payment Identifier',
     57        default = None,
    5358        required = True,
    5459        )
    5560
    56     p_item = schema.TextLine(
    57         title = u'',
     61    payer_id = schema.TextLine(
     62        title = u'Payer',
    5863        default = None,
    59         required = False,
    60         )
    61 
    62     display_item = schema.TextLine(
    63         title = _(u'Payment Item'),
    64         required = False,
    65         readonly = True,
    66         )
    67 
    68     p_session = schema.Choice(
    69         title = _(u'Payment Session'),
    70         source = application_sessions_vocab,
    7164        required = True,
    7265        )
    7366
    74     p_state = schema.Choice(
     67    payed_item_id = schema.TextLine(
     68        title = u'Payed Item',
     69        default = None,
     70        required = True,
     71        )
     72
     73    state = schema.Choice(
    7574        title = _(u'Payment State'),
    76         default = u'unpaid',
     75        default = STATE_UNPAID,
    7776        vocabulary = payment_states,
    7877        required = True,
     
    8079
    8180    creation_date = schema.Datetime(
    82         title = _(u'Ticket Creation Date'),
     81        title = _(u'Creation Date'),
    8382        readonly = False,
    8483        required = False,
     
    9190        )
    9291
    93     amount_auth = schema.Float(
    94         title = _(u'Amount Authorized'),
    95         default = 0.0,
     92    amount = schema.Decimal(
     93        title = _(u'Amount'),
     94        description = _(
     95            'The overall sum payed, including all taxes fees, etc.'),
     96        default = decimal.Decimal("0.00"),
    9697        required = True,
    9798        readonly = False,
    9899        )
     100
    99101
    100102class IOnlinePayment(IPayment):
Note: See TracChangeset for help on using the changeset viewer.