Ignore:
Timestamp:
20 Jan 2015, 06:53:55 (10 years ago)
Author:
uli
Message:

Fix tests and bugs revealed by tests.

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

    r12497 r12498  
    11471147    title = _(u'Credit Card (PayPal)')
    11481148
    1149     def get_credit_card(self, payer_id):
    1150         """Get an ICreditCard for `payer_id`.
     1149    def get_credit_card(self, customer_id):
     1150        """Get an ICreditCard for `customer_id`.
    11511151
    11521152        `None` if the payer has (yet) no credit card stored with ikoba.
     
    11571157        if not 'creditcards' in site:
    11581158            return None
    1159         return site['creditcards'].get(payer_id, None)
     1159        return site['creditcards'].get(customer_id, None)
    11601160
    11611161    def store_credit_card(self, paypal_credit_card):
     
    11821182            raise IOError(pp_credit_card.error)
    11831183        result = CreditCardToken(
    1184             pp_credit_card.id, pp_credit_card.payer_id,
     1184            pp_credit_card.id, pp_credit_card.external_customer_id,
    11851185            pp_credit_card.number, pp_credit_card.type,
    11861186            pp_credit_card.expire_month, pp_credit_card.expire_year
    11871187            )
    1188         site['creditcards'][pp_credit_card.payer_id] = result
     1188        site['creditcards'][pp_credit_card.external_customer_id] = result
    11891189        return result
    11901190
    11911191    def create_payment(self, payer, payment_item,  payee=None):
    11921192        """Create a creditcard payment.
    1193 
    1194         XXX: payer_id is deprecated by paypal: use
    1195         XXX: external_customer_id instead (also when creating credit cards).
    1196         XXX: This is a Good Thing(tm) because `payer_id` is already used in
    1197         XXX: some parts of the API for PayPal-assigned values.
    11981193        """
    11991194        if not IPayer.providedBy(payer):
     
    12141209                    "credit_card_token": {
    12151210                        "credit_card_id": credit_card.credit_card_id,
    1216                         "payer_id": payer.payer_id,
    12171211                        }}]},
    12181212            "transactions": [
  • main/waeup.ikoba/trunk/src/waeup/ikoba/payments/tests/test_paypal.py

    r12497 r12498  
    11051105        credit_card = CreditCard(
    11061106            credit_card_type=u"visa",
    1107             payer_id=u"PAYER_0123456789012345678901",
     1107            external_customer_id=u"PAYER_0123456789012345678901",
    11081108            number=u"4417119669820331",
    11091109            expire_month=11,
     
    11681168        assert 'creditcards' in site
    11691169        assert ICreditCardToken.providedBy(result)
    1170         assert result.payer_id in site['creditcards']
    1171         assert site['creditcards'][result.payer_id] == result
     1170        assert result.external_customer_id in site['creditcards']
     1171        assert site['creditcards'][result.external_customer_id] == result
    11721172
    11731173    @external_paypal_test
     
    12061206        credit_card = self.get_credit_card()
    12071207        result = service.store_credit_card(credit_card)
    1208         payer_id = result.payer_id
    12091208        payer = FakePayer()
    1210         payer.payer_id = result.payer_id
     1209        payer.payer_id = result.external_customer_id
    12111210        payment_item = FakePaymentItem()
    12121211        payment = service.create_payment(
     
    12141213        result = payment.create()
    12151214        assert result is True
    1216        
    1217         ###
    1218         ### hier gehts weiter
    12191215
    12201216
Note: See TracChangeset for help on using the changeset viewer.