@@ -526,6 +526,9 @@ def purchase(request, addon):
526526 slug = slug ,
527527 uuid = uuid_ ))
528528 except :
529+ paypal .paypal_log_cef (request , addon , uuid_ ,
530+ 'PayKey Failure' , 'PAYKEYFAIL' ,
531+ 'There was an error getting the paykey' )
529532 log .error ('Error getting paykey, purchase of addon: %s' % addon .pk ,
530533 exc_info = True )
531534 error = _ ('There was an error communicating with PayPal.' )
@@ -540,6 +543,10 @@ def purchase(request, addon):
540543 # If this was a pre-approval, it's completed already, we'll
541544 # double check this with PayPal, just to be sure nothing went wrong.
542545 if status == 'COMPLETED' :
546+ paypal .paypal_log_cef (request , addon , uuid_ ,
547+ 'Purchase' , 'PURCHASE' ,
548+ 'A user purchased using pre-approval' )
549+
543550 log .debug ('Status is completed for uuid: %s' % uuid_ )
544551 if paypal .check_purchase (paykey ) == 'COMPLETED' :
545552 log .debug ('Check purchase is completed for uuid: %s' % uuid_ )
@@ -596,8 +603,14 @@ def purchase_complete(request, addon, status):
596603 try :
597604 result = paypal .check_purchase (con .paykey )
598605 if result == 'ERROR' :
606+ paypal .paypal_log_cef (request , addon , uuid_ ,
607+ 'Purchase Fail' , 'PURCHASEFAIL' ,
608+ 'Checking purchase state returned error' )
599609 raise
600610 except :
611+ paypal .paypal_log_cef (request , addon , uuid_ ,
612+ 'Purchase Fail' , 'PURCHASEFAIL' ,
613+ 'There was an error checking purchase state' )
601614 log .error ('Check purchase paypal addon: %s, user: %s, paykey: %s'
602615 % (addon .pk , request .amo_user .pk , con .paykey [:10 ]),
603616 exc_info = True )
@@ -684,6 +697,9 @@ def contribute(request, addon):
684697 slug = addon .slug ,
685698 uuid = contribution_uuid ))
686699 except :
700+ paypal .paypal_log_cef (request , addon , contribution_uuid ,
701+ 'PayKey Failure' , 'PAYKEYFAIL' ,
702+ 'There was an error getting the paykey' )
687703 log .error ('Error getting paykey, contribution for addon: %s'
688704 % addon .pk , exc_info = True )
689705 error = _ ('There was an error communicating with PayPal.' )
@@ -702,8 +718,6 @@ def contribute(request, addon):
702718 paykey = paykey )
703719 contrib .save ()
704720
705- assert settings .PAYPAL_FLOW_URL , 'settings.PAYPAL_FLOW_URL is not defined'
706-
707721 url = '%s?paykey=%s' % (settings .PAYPAL_FLOW_URL , paykey )
708722 if request .GET .get ('result_type' ) == 'json' or request .is_ajax ():
709723 # If there was an error getting the paykey, then JSON will
0 commit comments