#NEWLINE# def process_data( self , payment , request ) : #NEWLINE# #INDENT# if ( not ( 'trans' in request . GET ) ) : #NEWLINE# #INDENT# return HttpResponseForbidden ( 'FAILED' ) #NEWLINE# #UNINDENT# transaction_id = request . GET . get ( 'trans' ) #NEWLINE# payment . transaction_id = transaction_id #NEWLINE# transaction_request = render_to_string ( 'payments/sofort/transaction_request.xml' , { #NEWLINE# #INDENT# 'transactions' : [ transaction_id ] , #NEWLINE# #UNINDENT# } ) #NEWLINE# ( doc , response ) = self . post_request ( transaction_request ) #NEWLINE# try : #NEWLINE# #INDENT# status = doc [ 'transactions' ] [ 'transaction_details' ] [ 'status' ] #NEWLINE# #UNINDENT# except KeyError : #NEWLINE# #INDENT# payment . change_status ( 'rejected' ) #NEWLINE# return redirect ( payment . get_failure_url ( ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# payment . captured_amount = payment . total #NEWLINE# payment . change_status ( 'confirmed' ) #NEWLINE# payment . extra_data = json . dumps ( doc ) #NEWLINE# sender_data = payment [ 'transactions' ] [ 'transaction_details' ] [ 'sender' ] #NEWLINE# holder_data = sender_data [ 'holder' ] #NEWLINE# ( first_name , last_name ) = holder_data . rsplit ( ' ' , 1 ) #NEWLINE# payment . billing_first_name = first_name #NEWLINE# payment . billing_last_name = last_name #NEWLINE# payment . billing_country_code = sender_data [ 'country_code' ] #NEWLINE# payment . save ( ) #NEWLINE# return redirect ( payment . get_success_url ( ) )