Ignore:
Timestamp:
26 Dec 2014, 11:28:59 (10 years ago)
Author:
uli
Message:

We cannot do creditcard payments w/o creditcards.

Location:
main/waeup.ikoba/trunk/src/waeup/ikoba/payments
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.ikoba/trunk/src/waeup/ikoba/payments/paypal.py

    r12325 r12326  
    11461146        if (payee is not None) and (not IPayee.providedBy(payee)):
    11471147            payee = IPayee(payee)
     1148        credit_card = self.get_credit_card(payer.payer_id)
     1149        if credit_card is None:
     1150            raise ValueError("Payer %s has no credit card." % payer.payer_id)
    11481151        return None
    11491152
  • main/waeup.ikoba/trunk/src/waeup/ikoba/payments/tests/test_paypal.py

    r12325 r12326  
    3434from waeup.ikoba.interfaces import IPayPalConfig
    3535from waeup.ikoba.payments.interfaces import (
    36     IPaymentGatewayService, IPayer, IPayee, IPaymentItem, IPayment,
     36    IPaymentGatewayService, IPayer, IPayee, IPaymentItem,
    3737    )
    3838from waeup.ikoba.payments.paypal import (
     
    11421142        assert service.get_credit_card(u'CARD2') is None
    11431143
    1144     def DIStest_creditcard_service_can_create_payment(self):
    1145         # we can create IPayment objects with creditcard service
     1144    def test_create_payment_no_credictard(self):
     1145        # trying to create a payment without credit card raises an exception
    11461146        service = PayPalCreditCardService()
    1147         payment = service.create_payment(
    1148             payer=FakePayer(),
    1149             payment_item=FakePaymentItem(),
    1150             payee=FakePayee()
    1151             )
    1152         assert IPayment.providedBy(payment)
     1147        exception = None
     1148        try:
     1149            service.create_payment(
     1150                payer=FakePayer(),
     1151                payment_item=FakePaymentItem(),
     1152                payee=FakePayee()
     1153                )
     1154        except (ValueError, ) as err:
     1155            exception = err
     1156        assert exception.message == 'Payer PAYER-123 has no credit card.'
    11531157
    11541158
Note: See TracChangeset for help on using the changeset viewer.