Changeset 12726 for main/waeup.ikoba


Ignore:
Timestamp:
11 Mar 2015, 09:17:36 (10 years ago)
Author:
uli
Message:

Extend IPayable.

File:
1 edited

Legend:

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

    r12725 r12726  
    163163
    164164
     165class IPaymentItem(Interface):
     166    """Something to sell.
     167    """
     168    item_id = schema.TextLine(
     169        title=u'Payment Item ID',
     170        required=True,
     171        )
     172
     173    title = schema.TextLine(
     174        title=u'Title',
     175        description=u'A short title of the good sold.',
     176        required=True,
     177        default=u'Unnamed'
     178        )
     179
     180    amount = schema.Decimal(
     181        title=u'Amount',
     182        description=u'Total amount, includung any taxes, fees, etc.',
     183        required=True,
     184        default=decimal.Decimal('0.00'),
     185        )
     186
     187
    165188class IPayable(Interface):
    166189    """Something that can be payed.
     
    169192    objects into something with a standarized interfaces for use with
    170193    payments.
     194
     195    While currency is important to tell about the amount currency, the
     196    total amount is computed on-demand from payment items.
    171197    """
    172198    payable_id = schema.TextLine(
     
    186212        )
    187213
    188 
    189 class IPaymentItem(Interface):
    190     """Something to sell.
    191     """
    192     item_id = schema.TextLine(
    193         title=u'Payment Item ID',
    194         required=True,
    195         )
    196 
    197     title = schema.TextLine(
    198         title=u'Title',
    199         description=u'A short title of the good sold.',
    200         required=True,
    201         default=u'Unnamed'
    202         )
    203 
    204     amount = schema.Decimal(
    205         title=u'Amount',
    206         description=u'Total amount, includung any taxes, fees, etc.',
    207         required=True,
    208         default=decimal.Decimal('0.00'),
     214    currency = schema.Choice(
     215        title=u'Currency',
     216        source=ISO_4217_CURRENCIES_VOCAB,
     217        required=True,
     218        default='USD',
     219        readonly=True,
     220        )
     221
     222    payment_items = schema.Tuple(
     223        title=u'Tuple of IPaymentItems.',
     224        value_type=schema.Object(
     225            title=u'Payment Item',
     226            schema=IPaymentItem,
     227            ),
     228        required=False,
     229        default=(),
     230        readonly=True,
    209231        )
    210232
Note: See TracChangeset for help on using the changeset viewer.