anchor.diff:  	{Product#product{balance = NewBIds}, Buckets}.
   
   %% @hidden
  -dues(Payments, Now, Buckets, PName, Period, Amount) ->
  -	dues(Payments, Now, Buckets, PName, Period, Amount, []).
  -%% @hidden
  -dues([{_, DueDate} = P | T], Now, Buckets, PName, Period, Amount, Acc) when DueDate > Now ->
  -	dues(T, Now, Buckets, PName, Period, Amount, [P | Acc]);
  -dues([{PName, DueDate} | T], Now, Buckets, PName, Period, Amount, Acc) ->
  -	NewBuckets = charge(Amount, Buckets),
  +dues(Payments, Now, Buckets, PName, Period, Amount, ProdRef) ->
  +	dues(Payments, Now, Buckets, PName, Period, Amount, ProdRef, []).
  +%% @hidden
  +dues([{_, DueDate} = P | T], Now, Buckets, PName, Period, Amount, ProdRef, Acc) when DueDate > Now ->
  +	dues(T, Now, Buckets, PName, Period, Amount, ProdRef, [P | Acc]);
  +dues([{PName, DueDate} | T], Now, Buckets, PName, Period, Amount, ProdRef, Acc) ->
  +	NewBuckets = charge(ProdRef, Amount, Buckets),
   	case end_period(DueDate, Period) of
   		NextDueDate when NextDueDate < Now ->
   			dues([{PName, NextDueDate} | T], Now,
  -					NewBuckets, PName, Period, Amount, Acc);
  +					NewBuckets, PName, Period, Amount, ProdRef, Acc);
   		NextDueDate ->
   			dues(T, Now, NewBuckets, PName, Period,
  -					Amount, [{PName, NextDueDate} | Acc])
  +					Amount, ProdRef, [{PName, NextDueDate} | Acc])
   	end;
  -dues([P | T], Now, Buckets, PName, Period, Amount, Acc) ->
  -	dues(T, Now, Buckets, PName, Period, Amount, [P | Acc]);
  -dues([], _Now, Buckets, _PName, _Period, _Amount, Acc) ->
  +dues([P | T], Now, Buckets, PName, Period, Amount, ProdRef, Acc) ->
  +	dues(T, Now, Buckets, PName, Period, Amount, ProdRef, [P | Acc]);
  +dues([], _Now, Buckets, _PName, _Period, _Amount, _ProdRef, Acc) ->
   	{lists:reverse(Acc), Buckets}.
   
   -spec get_params() -> Result
  
positive.code: subscription(Product, Now, false, Buckets,
  		[#price{type = usage, alteration = #alteration{type = one_time}} | T]) ->
  	subscription(Product, Now, false, Buckets, T);
  subscription(#product{payment = Payments} = Product,
  		Now, true, Buckets, [#price{type = recurring, period = Period,
  		amount = Amount, name = Name, alteration = undefined} | T]) when
  		Period /= undefined ->
  	NewBuckets = charge(Amount, Buckets),
  	NewPayments = [{Name, end_period(Now, Period)} | Payments],
  	Product1 = Product#product{payment = NewPayments},
  	subscription(Product1, Now, true, NewBuckets, T);
  subscription(#product{payment = Payments} = Product, Now, false, Buckets,
  		[#price{type = recurring, period = Period, amount = Amount,
  			name = Name, alteration = undefined} | T]) when Period /= undefined ->
  	{NewPayments, NewBuckets} = dues(Payments, Now, Buckets, Name, Period, Amount),
  	Product1 = Product#product{payment = NewPayments},
  	subscription(Product1, Now, false, NewBuckets, T);
  subscription(#product{name = ProdRef, payment = Payments} = Product,
  
negative.code: 			amount = Amount, alteration = #alteration{units = Units, size = Size,
  			amount = AllowanceAmount}, name = Name} | T]) when (Period /= undefined)
  			and ((Units == octets) orelse (Units == seconds) orelse (Units == messages)) ->
  	{NewPayments, NewBuckets1} = dues(Payments, Now, Buckets, Name, Period, ProdRef, Amount),
  	N = erlang:unique_integer([positive]),
  	NewBuckets2 = charge(ProdRef, AllowanceAmount,
  			[#bucket{id = generate_bucket_id(),
  			units = Units, remain_amount = Size, product = [ProdRef],
  			termination_date = end_period(Now, Period), last_modified = {Now, N}}
  