function engagements_get_fp_price
Search API
7.x engagements.module | engagements_get_fp_price($price, $direction, $num_segments = 1, $type = 'sms') |
6.x engagements.module | engagements_get_fp_price($price, $direction, $num_segments = 1, $type = 'sms') |
figure out the price we will charge.
2 calls to engagements_get_fp_price()
- engagements_handle_incoming_sms in modules/
engagements/ engagements.module - This catches incoming sms messages from POST, but can also be used by our "sms_get_all_messages" function, but it is also used by the sms_get_all_messages to save/update information.
- engagements_sms_get_all_messages in modules/
engagements/ engagements.module - Retrieve all messages, update the ones which don't have prices associated with them yet.
File
- modules/
engagements/ engagements.module, line 1817 - This is the primary module file for the engagements module.
Code
function engagements_get_fp_price($price, $direction, $num_segments = 1, $type = 'sms')
{
$rtn = 0;
if ($num_segments == 0) {
$num_segments = 1;
}
if (strstr($direction, 'outbound')) {
$rtn = 0.0033 * $num_segments;
}
if ($price == 0.01) {
$rtn = 0.015;
}
if ($type == 'call') {
$rtn = 0.005;
}
// Guess at 15% over, if we don't know.
$new_price = $price * 1.15; // generic; add 15%.
// Return the LARGER of the two prices.
if ($new_price > $rtn) {
return $new_price;
}
return $rtn;
}