Skip to content

Commit

Permalink
WHISTLE-1236: fix zero billing second originator cancel
Browse files Browse the repository at this point in the history
  • Loading branch information
k-anderson committed Jun 28, 2012
1 parent 7129843 commit 14db8db
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
5 changes: 3 additions & 2 deletions ecallmgr/src/ecallmgr_authz.erl
Expand Up @@ -168,8 +168,9 @@ authorize(AccountId, Props) ->
ReqResp = wh_amqp_worker:call(?ECALLMGR_AMQP_POOL
,authz_req(AccountId, Props)
,fun wapi_authz:publish_req/1
,fun wapi_authz:resp_v/1),
case ReqResp of
,fun wapi_authz:resp_v/1
,5000),
case ReqResp of
{error, _R} ->
lager:debug("authz request lookup failed: ~p", [_R]),
authz_default();
Expand Down
11 changes: 5 additions & 6 deletions whistle_apps/apps/jonny5/src/j5_call_cdr.erl
Expand Up @@ -18,12 +18,12 @@ handle_req(JObj, _Props) ->
timer:sleep(crypto:rand_uniform(0, 1000)),
CCV = wh_json:get_value(<<"Custom-Channel-Vars">>, JObj, wh_json:new()),
case wh_json:get_value(<<"Account-Billing">>, CCV) of
<<"per_minute">> -> reconcile_cost(wh_json:get_value(<<"Account-ID">>, CCV), JObj);
_ -> ok
<<"flat_rate">> -> ok;
_ -> reconcile_cost(wh_json:get_value(<<"Account-ID">>, CCV), JObj)
end,
case wh_json:get_value(<<"Reseller-Billing">>, CCV) of
<<"per_minute">> -> reconcile_cost(wh_json:get_value(<<"Reseller-ID">>, CCV), JObj);
_ -> ok
<<"flat_rate">> -> ok;
_ -> reconcile_cost(wh_json:get_value(<<"Reseller-ID">>, CCV), JObj)
end.

-spec reconcile_cost/2 :: ('undefined' | ne_binary(), wh_json:json_object()) -> 'ok'.
Expand Down Expand Up @@ -60,9 +60,8 @@ reconcile_cost(Ledger, JObj) ->
extract_cost(JObj) ->
BillingSecs = wh_json:get_integer_value(<<"Billing-Seconds">>, JObj),
CCVs = wh_json:get_value(<<"Custom-Channel-Vars">>, JObj),
DefaultRate = whapps_config:get_float(<<"jonny5">>, <<"default_rate">>, ?DEFAULT_RATE),
DefaultRateIncr = whapps_config:get_integer(<<"jonny5">>, <<"default_rate_increment">>, 60),
Rate = wh_json:get_float_value(<<"Rate">>, CCVs, DefaultRate),
Rate = wh_json:get_float_value(<<"Rate">>, CCVs, 0.0),
RateIncr = wh_json:get_integer_value(<<"Rate-Increment">>, CCVs, DefaultRateIncr),
RateMin = wh_json:get_integer_value(<<"Rate-Minimum">>, CCVs, 0),
Surcharge = wh_json:get_float_value(<<"Surcharge">>, CCVs, 0.0),
Expand Down

0 comments on commit 14db8db

Please sign in to comment.