Changeset 12640


Ignore:
Timestamp:
1 Mar 2015, 22:50:48 (10 years ago)
Author:
uli
Message:

Make payment items real subobjects of payments.

Location:
main/waeup.ikoba/branches/uli-fake-gw-provider/src/waeup/ikoba/payments
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.ikoba/branches/uli-fake-gw-provider/src/waeup/ikoba/payments/catalog.py

    r12311 r12640  
    3232    payment_id = grok.index.Field(attribute='payment_id')
    3333    payer_id = grok.index.Field(attribute='payer_id')
    34     payed_item_id = grok.index.Field(attribute='payed_item_id')
    3534    state = grok.index.Field(attribute='state')
    3635    amount = grok.index.Field(attribute='amount')
  • main/waeup.ikoba/branches/uli-fake-gw-provider/src/waeup/ikoba/payments/interfaces.py

    r12636 r12640  
    196196        )
    197197
    198     payed_item_id = schema.TextLine(
    199         title=u'Payed Item ID',
    200         default=None,
    201         required=True,
    202         )
     198    payee_id = schema.TextLine(
     199        title=u'Payee',
     200        default=None,
     201        required=False,
     202    )
    203203
    204204    gateway_service = schema.Choice(
     
    253253        """
    254254
     255    def add_payment_item(item):
     256        """Payments contain payment items.
     257
     258        Add one
     259        """
     260
     261
    255262class IPayer(Interface):
    256263    """A payer.
  • main/waeup.ikoba/branches/uli-fake-gw-provider/src/waeup/ikoba/payments/payment.py

    r12636 r12640  
    9696        notify(grok.ObjectModifiedEvent(self))
    9797
     98    def add_payment_item(self, item):
     99        """Add `item`
     100
     101        Returns the key under which the `item` was stored.
     102        """
     103        cnt = 0
     104        while str(cnt) in self:
     105            cnt += 1
     106        self[str(cnt)] = item
     107        return str(cnt)
     108
    98109
    99110@attrs_to_fields
  • main/waeup.ikoba/branches/uli-fake-gw-provider/src/waeup/ikoba/payments/tests/test_payment.py

    r12461 r12640  
    113113        assert p1.state == STATE_FAILED
    114114
     115    def test_add_payment_item(self):
     116        # we can add payment items
     117        p1 = Payment()
     118        item1 = PaymentItem()
     119        result = p1.add_payment_item(item1)
     120        assert result == "0"
    115121
    116122class PaymentItemTests(unittest.TestCase):
Note: See TracChangeset for help on using the changeset viewer.