Changeset 12647 for main/waeup.ikoba/branches/uli-fake-gw-provider/src
- Timestamp:
- 2 Mar 2015, 00:46:09 (10 years ago)
- 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 15 15 title = _(u'Demo Creditcard') 16 16 17 def create_payment(self, payer, payment_item , payee=None):17 def create_payment(self, payer, payment_item_list=[], payee=None): 18 18 """Create a payment. 19 19 """ 20 20 payment = Payment() 21 21 payment.gateway_service = 'demo' # must be grok.name above 22 payment.payed_item_id = payment_item.item_id23 payment.amount = payment_item.amount24 22 payment.payer_id = payer.payer_id 23 for item in payment_item_list: 24 payment.add_payment_item(item) 25 25 return payment -
main/waeup.ikoba/branches/uli-fake-gw-provider/src/waeup/ikoba/payments/tests/test_demo_provider.py
r12642 r12647 27 27 service = DemoCreditcardPaymentService() 28 28 payer, payment_item, payee = Payer(), PaymentItem(), Payee() 29 payment_item.item_id = u'SOME_ITEM_ID'30 29 payer.payer_id = u'SOME_PAYER_ID' 31 result = service.create_payment(payer, payment_item, payee)30 result = service.create_payment(payer, [], payee) 32 31 assert IPayment.providedBy(result) 33 32 assert result.gateway_service == u'demo' 34 33 assert result.state == STATE_UNPAID 34 assert len(result) == 0 # no items stored 35 35 36 36 def test_create_payment_honors_payment_item(self): … … 41 41 payer.payer_id = u'SOME_PAYER_ID' 42 42 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_id45 assert result.amount == payment_item.amount43 result = service.create_payment(payer, [payment_item], payee) 44 self.assertEqual(result.amount, payment_item.amount) 45 assert len(result) == 1 46 46 47 47 def test_create_payment_honors_payer(self): … … 51 51 payment_item.item_id = u'SOME_ITEM_ID' 52 52 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) 54 54 assert result.payer_id == payer.payer_id
Note: See TracChangeset for help on using the changeset viewer.