Ignore:
Timestamp:
2 Mar 2015, 00:46:09 (10 years ago)
Author:
uli
Message:

Consider changed Payment interface.

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

Legend:

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

    r12637 r12647  
    1515    title = _(u'Demo Creditcard')
    1616
    17     def create_payment(self, payer, payment_item,  payee=None):
     17    def create_payment(self, payer, payment_item_list=[],  payee=None):
    1818        """Create a payment.
    1919        """
    2020        payment = Payment()
    2121        payment.gateway_service = 'demo'  # must be grok.name above
    22         payment.payed_item_id = payment_item.item_id
    23         payment.amount = payment_item.amount
    2422        payment.payer_id = payer.payer_id
     23        for item in payment_item_list:
     24            payment.add_payment_item(item)
    2525        return payment
  • main/waeup.ikoba/branches/uli-fake-gw-provider/src/waeup/ikoba/payments/tests/test_demo_provider.py

    r12642 r12647  
    2727        service = DemoCreditcardPaymentService()
    2828        payer, payment_item, payee = Payer(), PaymentItem(), Payee()
    29         payment_item.item_id = u'SOME_ITEM_ID'
    3029        payer.payer_id = u'SOME_PAYER_ID'
    31         result = service.create_payment(payer, payment_item, payee)
     30        result = service.create_payment(payer, [], payee)
    3231        assert IPayment.providedBy(result)
    3332        assert result.gateway_service == u'demo'
    3433        assert result.state == STATE_UNPAID
     34        assert len(result) == 0  # no items stored
    3535
    3636    def test_create_payment_honors_payment_item(self):
     
    4141        payer.payer_id = u'SOME_PAYER_ID'
    4242        payment_item.amount = decimal.Decimal("300.99")
    43         result = service.create_payment(payer, payment_item, payee)
    44         assert result.payed_item_id == payment_item.item_id
    45         assert result.amount == payment_item.amount
     43        result = service.create_payment(payer, [payment_item], payee)
     44        self.assertEqual(result.amount, payment_item.amount)
     45        assert len(result) == 1
    4646
    4747    def test_create_payment_honors_payer(self):
     
    5151        payment_item.item_id = u'SOME_ITEM_ID'
    5252        payer.payer_id = u'SOME_PAYER_ID'
    53         result = service.create_payment(payer, payment_item, payee)
     53        result = service.create_payment(payer, [payment_item], payee)
    5454        assert result.payer_id == payer.payer_id
Note: See TracChangeset for help on using the changeset viewer.