Ignore:
Timestamp:
20 Jan 2015, 05:57:59 (10 years ago)
Author:
uli
Message:

Adapt (nice) change in official Paypal API for ICreditCard.

File:
1 edited

Legend:

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

    r12494 r12496  
    300300        )
    301301
    302     payer_id = schema.TextLine(
     302    external_customer_id = schema.TextLine(
    303303        title=u'Payer ID',
    304304        description=(u'A unique identifier for the credit card. This '
     
    390390          data. Required if using a stored credit card.
    391391
    392     `payer_id`: Unique identifier. If none is given, we assign a
    393           uuid. The uuid reads 'PAYER_<32 hex digits>'.
     392    `external_customer_id`: Unique identifier. If none is given, we
     393          assign a uuid. The uuid reads 'PAYER_<32 hex digits>'.
    394394
    395395    `number`: Credit card number. Numeric characters only with no
     
    426426    grok.implements(ICreditCard)
    427427
    428     def __init__(self, paypal_id=None, payer_id=None, number=None,
    429                  credit_card_type=None, expire_month=1, expire_year=2000,
    430                  cvv2=None, first_name=None, last_name=None,
    431                  billing_address=None, state=None, paypal_valid_until=None):
     428    def __init__(self, paypal_id=None, external_customer_id=None,
     429                 number=None, credit_card_type=None, expire_month=1,
     430                 expire_year=2000, cvv2=None, first_name=None,
     431                 last_name=None, billing_address=None, state=None,
     432                 paypal_valid_until=None):
    432433        if not re.match('^[0-9]+$', number):
    433434            raise ValueError("Credit card number may "
    434435                             "not contain non-numbers.")
    435         if payer_id is None:
    436             payer_id = u'PAYER_' + unicode(uuid.uuid4().hex)
     436        if external_customer_id is None:
     437            external_customer_id = u'PAYER_' + unicode(uuid.uuid4().hex)
    437438        self.paypal_id = paypal_id
    438         self.payer_id = payer_id
     439        self.external_customer_id = external_customer_id
    439440        self.number = number
    440441        self.credit_card_type = credit_card_type
     
    11891190
    11901191    def create_payment(self, payer, payment_item,  payee=None):
     1192        """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.
     1198        """
    11911199        if not IPayer.providedBy(payer):
    11921200            payer = IPayer(payer)
Note: See TracChangeset for help on using the changeset viewer.