Changeset 12498
- Timestamp:
- 20 Jan 2015, 06:53:55 (10 years ago)
- 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 1147 1147 title = _(u'Credit Card (PayPal)') 1148 1148 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`. 1151 1151 1152 1152 `None` if the payer has (yet) no credit card stored with ikoba. … … 1157 1157 if not 'creditcards' in site: 1158 1158 return None 1159 return site['creditcards'].get( payer_id, None)1159 return site['creditcards'].get(customer_id, None) 1160 1160 1161 1161 def store_credit_card(self, paypal_credit_card): … … 1182 1182 raise IOError(pp_credit_card.error) 1183 1183 result = CreditCardToken( 1184 pp_credit_card.id, pp_credit_card. payer_id,1184 pp_credit_card.id, pp_credit_card.external_customer_id, 1185 1185 pp_credit_card.number, pp_credit_card.type, 1186 1186 pp_credit_card.expire_month, pp_credit_card.expire_year 1187 1187 ) 1188 site['creditcards'][pp_credit_card. payer_id] = result1188 site['creditcards'][pp_credit_card.external_customer_id] = result 1189 1189 return result 1190 1190 1191 1191 def create_payment(self, payer, payment_item, payee=None): 1192 1192 """Create a creditcard payment. 1193 1194 XXX: payer_id is deprecated by paypal: use1195 XXX: external_customer_id instead (also when creating credit cards).1196 XXX: This is a Good Thing(tm) because `payer_id` is already used in1197 XXX: some parts of the API for PayPal-assigned values.1198 1193 """ 1199 1194 if not IPayer.providedBy(payer): … … 1214 1209 "credit_card_token": { 1215 1210 "credit_card_id": credit_card.credit_card_id, 1216 "payer_id": payer.payer_id,1217 1211 }}]}, 1218 1212 "transactions": [ -
main/waeup.ikoba/trunk/src/waeup/ikoba/payments/tests/test_paypal.py
r12497 r12498 1105 1105 credit_card = CreditCard( 1106 1106 credit_card_type=u"visa", 1107 payer_id=u"PAYER_0123456789012345678901",1107 external_customer_id=u"PAYER_0123456789012345678901", 1108 1108 number=u"4417119669820331", 1109 1109 expire_month=11, … … 1168 1168 assert 'creditcards' in site 1169 1169 assert ICreditCardToken.providedBy(result) 1170 assert result. payer_id in site['creditcards']1171 assert site['creditcards'][result. payer_id] == result1170 assert result.external_customer_id in site['creditcards'] 1171 assert site['creditcards'][result.external_customer_id] == result 1172 1172 1173 1173 @external_paypal_test … … 1206 1206 credit_card = self.get_credit_card() 1207 1207 result = service.store_credit_card(credit_card) 1208 payer_id = result.payer_id1209 1208 payer = FakePayer() 1210 payer.payer_id = result. payer_id1209 payer.payer_id = result.external_customer_id 1211 1210 payment_item = FakePaymentItem() 1212 1211 payment = service.create_payment( … … 1214 1213 result = payment.create() 1215 1214 assert result is True 1216 1217 ###1218 ### hier gehts weiter1219 1215 1220 1216
Note: See TracChangeset for help on using the changeset viewer.