#NEWLINE# def validate( self , basket , product , quantity , options ) : #NEWLINE# #INDENT# availability = basket . strategy . fetch_for_product ( product ) . availability #NEWLINE# if ( not availability . is_available_to_buy ) : #NEWLINE# #INDENT# return ( False , availability . message ) #NEWLINE# #UNINDENT# ( allowed , message ) = availability . is_purchase_permitted ( quantity ) #NEWLINE# if ( not allowed ) : #NEWLINE# #INDENT# return ( False , message ) #NEWLINE# #UNINDENT# ( allowed , message ) = basket . is_quantity_allowed ( quantity ) #NEWLINE# if ( not allowed ) : #NEWLINE# #INDENT# return ( False , message ) #NEWLINE# #UNINDENT# return ( True , None )