#NEWLINE# def confirm_info( request ) : #NEWLINE# #INDENT# payment_module = config_get_group ( 'PAYMENT_PAYPAL' ) #NEWLINE# try : #NEWLINE# #INDENT# order = Order . objects . from_request ( request ) #NEWLINE# #UNINDENT# except Order . DoesNotExist : #NEWLINE# #INDENT# url = lookup_url ( payment_module , 'satchmo_checkout-step1' ) #NEWLINE# return HttpResponseRedirect ( url ) #NEWLINE# #UNINDENT# tempCart = Cart . objects . from_request ( request ) #NEWLINE# if ( ( tempCart . numItems == 0 ) and ( not order . is_partially_paid ) ) : #NEWLINE# #INDENT# template = lookup_template ( payment_module , 'shop/checkout/empty_cart.html' ) #NEWLINE# return render_to_response ( template , context_instance = RequestContext ( request ) ) #NEWLINE# #UNINDENT# if ( not order . validate ( request ) ) : #NEWLINE# #INDENT# context = RequestContext ( request , { #NEWLINE# #INDENT# 'message' : _ ( 'Your order is no longer valid.' ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# return render_to_response ( 'shop/404.html' , context_instance = context ) #NEWLINE# #UNINDENT# template = lookup_template ( payment_module , 'shop/checkout/paypal/confirm.html' ) #NEWLINE# if payment_module . LIVE . value : #NEWLINE# #INDENT# log . debug ( 'live order on %s' , payment_module . KEY . value ) #NEWLINE# url = payment_module . POST_URL . value #NEWLINE# account = payment_module . BUSINESS . value #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# url = payment_module . POST_TEST_URL . value #NEWLINE# account = payment_module . BUSINESS_TEST . value #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# address = lookup_url ( payment_module , payment_module . RETURN_ADDRESS . value , include_server = True ) #NEWLINE# #UNINDENT# except urlresolvers . NoReverseMatch : #NEWLINE# #INDENT# address = payment_module . RETURN_ADDRESS . value #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# cart = Cart . objects . from_request ( request ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# cart = None #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# contact = Contact . objects . from_request ( request ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# contact = None #NEWLINE# #UNINDENT# if ( cart and contact ) : #NEWLINE# #INDENT# cart . customer = contact #NEWLINE# log . debug ( ( ':::Updating Cart %s for %s' % ( cart , contact ) ) ) #NEWLINE# cart . save ( ) #NEWLINE# #UNINDENT# processor_module = payment_module . MODULE . load_module ( 'processor' ) #NEWLINE# processor = processor_module . PaymentProcessor ( payment_module ) #NEWLINE# processor . create_pending_payment ( order = order ) #NEWLINE# default_view_tax = config_value ( 'TAX' , 'DEFAULT_VIEW_TAX' ) #NEWLINE# recurring = None #NEWLINE# if ( 'product.modules.subscription' in settings . INSTALLED_APPS ) : #NEWLINE# #INDENT# order_items = order . orderitem_set . all ( ) #NEWLINE# for item in order_items : #NEWLINE# #INDENT# if ( not item . product . is_subscription ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# recurring = { #NEWLINE# #INDENT# 'product' : item . product , #NEWLINE# 'price' : item . product . price_set . all ( ) [ 0 ] . price . quantize ( Decimal ( '.01' ) ) , #NEWLINE# #UNINDENT# } #NEWLINE# trial0 = recurring [ 'product' ] . subscriptionproduct . get_trial_terms ( 0 ) #NEWLINE# if ( ( len ( order_items ) > 1 ) or ( trial0 is not None ) or ( recurring [ 'price' ] < order . balance ) ) : #NEWLINE# #INDENT# recurring [ 'trial1' ] = { #NEWLINE# #INDENT# 'price' : order . balance , #NEWLINE# #UNINDENT# } #NEWLINE# if ( trial0 is not None ) : #NEWLINE# #INDENT# recurring [ 'trial1' ] [ 'expire_length' ] = trial0 . expire_length #NEWLINE# recurring [ 'trial1' ] [ 'expire_unit' ] = trial0 . subscription . expire_unit [ 0 ] #NEWLINE# #UNINDENT# trial1 = recurring [ 'product' ] . subscriptionproduct . get_trial_terms ( 1 ) #NEWLINE# if ( trial1 is not None ) : #NEWLINE# #INDENT# recurring [ 'trial2' ] [ 'expire_length' ] = trial1 . expire_length #NEWLINE# recurring [ 'trial2' ] [ 'expire_unit' ] = trial1 . subscription . expire_unit [ 0 ] #NEWLINE# recurring [ 'trial2' ] [ 'price' ] = trial1 . price #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# ctx = RequestContext ( request , { #NEWLINE# #INDENT# 'order' : order , #NEWLINE# 'post_url' : url , #NEWLINE# 'default_view_tax' : default_view_tax , #NEWLINE# 'business' : account , #NEWLINE# 'currency_code' : payment_module . CURRENCY_CODE . value , #NEWLINE# 'return_address' : address , #NEWLINE# 'invoice' : order . id , #NEWLINE# 'subscription' : recurring , #NEWLINE# 'PAYMENT_LIVE' : gateway_live ( payment_module ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# return render_to_response ( template , context_instance = ctx )