rule { include getDiscountedPrice from "socket://localhost:8000" on { N.offers == 0 and N.scopename == "price_inquiry" } do { cardId@buyer = getInput( "Insert your customer card ID"); card: buyer( cardId ) -> seller( cardId ); s_price@seller = getDiscountedPrice( s_prod, cardId ); offer: seller( s_price ) -> buyer( b_price ); priceOk@buyer = getInput( "Do you accept the price " + b_price + " [yes/no]" ) } } rule { include testChallenge from "socket://localhost:8001" on { N.securityLevel < 2 and N.scopename == "payment" } do { auth@buyer = getInput( "Do you authorise the payment? [yes/no]"); if( auth == "yes" )@buyer{ account: bank( "Insert your account ID" ) -> buyer( b_req ); b_acc@buyer = getInput( b_req ); account: buyer( b_acc ) -> bank( bank_acc ); pin: bank( "Insert your PIN" ) -> buyer( b_req ); b_pin@buyer = getInput( b_req ); pin: buyer( b_pin ) -> bank( bank_pin ); match@bank = testChallenge( bank_acc, bank_pin ); if ( match == true )@bank{ paymentOK@bank = true } else { paymentOk@bank = false } } } }