anchor.diff:  	application:start(inets),
   	Config;
   init_per_testcase(TestCase, Config) when TestCase == notify_create_bucket;
  +		TestCase == notify_delete_bucket;
   		TestCase == notify_rating_deleted_bucket;
   		TestCase == notify_accumulated_balance;
   		TestCase == notify_accumulated_threshold;
  
positive.code: notifycreatebucket(SessionID, _Env, Input) ->
  	mod_esi:deliver(SessionID, "status: 201 Created\r\n\r\n"),
  	notify_create_bucket ! Input.
  
  -spec notifyratingdeletedbucket(SessionID :: term(), Env :: list(),
  		Input :: string()) -> any().
  
negative.code: 	{_, MillionthsOut} = lists:keyfind("amount", 1, RemainAmount),
  	100 = ocs_rest:millionths_in(MillionthsOut).
  
  notify_delete_bucket() ->
  	[{userdata, [{doc, "Notify deletion of bucket"}]}].
  
  notify_delete_bucket(Config) ->
  	HostUrl = ?config(host_url, Config),
  	CollectionUrl = HostUrl ++ ?PathBalanceHub,
  	ListenerPort = ?config(listener_port, Config),
  	ListenerServer = "http://localhost:" ++ integer_to_list(ListenerPort),
  	Callback = ListenerServer ++ "/listener/"
  			++ atom_to_list(?MODULE) ++ "/notifydeletebucket",
  	RequestBody = "{\n"
  			++ "\t\"callback\": \"" ++ Callback ++ "\",\n"
  			++ "}\n",
  	ContentType = "application/json",
  	Accept = {"accept", "application/json"},
  	Request = {CollectionUrl, [Accept, auth_header()], ContentType, RequestBody},
  	{ok, {{_, 201, _}, _, _}} = httpc:request(post, Request, [], []),
  	PackagePrice = 100,
  	PackageSize = 1000,
  	P1 = #price{name = ocs:generate_identity(), type = usage, units = octets,
  			size = PackageSize, amount = PackagePrice},
  	OfferId = add_offer([P1], 4),
  	{ok, #product{id = ProdRef}} = ocs:add_product(OfferId, [], []),
  	receive
  		Input1 ->
  			{struct, ProductEvent} = mochijson:decode(Input1),
  			{_, {struct, ProductList}} = lists:keyfind("event", 1, ProductEvent),
  			{_, ProdRef} = lists:keyfind("id", 1, ProductList)
  	end,
  	BId = add_bucket(ProdRef, cents, 100000000),
  	receive
  		Input3 ->
  			{struct, BalanceEvent} = mochijson:decode(Input3),
  			{_, {struct, BalanceList}} = lists:keyfind("event", 1, BalanceEvent),
  			{_, BId} = lists:keyfind("id", 1, BalanceList)
  	end,
  	ok = ocs:delete_bucket(BId),
  	receive
  		Input4 ->
  			{struct, BalDelEvent} = mochijson:decode(Input4),
  			{_, "BucketBalanceDeletionEvent"}
  					= lists:keyfind("eventType", 1, BalDelEvent)
  	end.
  
  notify_rating_deleted_bucket() ->
  	[{userdata, [{doc, "Notify deletion of bucket during rating"}]}].
  
  