# TotalConfCharge

## Program ID

MetraPipeline.MTTotalConfCharge.1

## Description

The TotalConfCharge plug-in computes the applicable charges for the entire Audio-conference. It runs in the audio-conference parent stage and depends on a number of precalculated values.

TotalConfCharge computes the following values:

- Cancellation charge. A conference is cancelled if CancelFlag = ConfCancelledStr. The cancellation charge is determined by either a flat fee (if CancelRate = CancelCharges/FlatFee) or ScheduledCon* CancelRate (if CancelType = CancelCharges/PerScheduledPort). If CancelMaxCharge is > 0 then the cancellation charge is the minimum of the max charge and calculated cancellation charge. For example, if the calculated minimum charge is $20 and the max is $15, the user would only be charged $15.

- Unused port charge. An unused port charge is only calculated if the number of unused ports is greater than 0. if UnusedPortRate = UnusedPortCharges/FlatFee then the charge is UnusedPortRate. If UnusedPortRate = UnusedPortCharges/PerUnusedPort then the charge is UnusedPortRate* NumUnusedPorts.

- Overused port charge. Same as the unused port charge but for overused ports.

- Total conference call charges. The sum of cancellation charge, unused port charge, overused port charge, and reservation charge. This value does not include the charges for the child sessions.

- Amount. The sum of TotalCallCharges and ConTotal.

## Required Input Properties

Tag name | Value type | Description
ConTotal | decimal | The total amount the conference costs so far. This is usually the sum of the children sessions amounts.
CancelType | long | The ID that specifies to calculate a cancellation fee (if applicable) using a flat fee or via the number of scheduled ports.
CancelRate | decimal | The amount to charge if the call is cancelled.
CancelMaxCharge | decimal | The maximum amount of a cancellation charge. If this value is less than 0 than no cap is applied on the cancellation charge.
UnusedPortChargeType | long | The ID that specifies how to apply any applicable unused port charges.
UnusedPortRate | decimal | The amount to charge if there are any unused ports.
NumUnusedPorts | long | The number of unused ports. Must be >= 0
OverusedPortChargeType | long | The ID that specifies how to apply any applicable over used port charges.
OverusedPortRate | decimal | The amount to charge if there are overused ports.
NumOverusedPorts | long | The Number of over used ports.
ResCharge | decimal | The conference reservation charge. Must be >=0.
ScheduledCon | long | The number of scheduled ports.
CancelFlag | string | Indicates if a conference was cancelled. A conference is cancelled if CancelFlag = ConfCancelledStr
ConfChargeMinimum | decimal | The minimum conference charge.

## Required Output Properties

Tag name | Value type | Description
Amount | decimal | The total charge of the conference. This includes charges from the child sessions.
AmountForReserve | decimal | The calculated reservation charge. May be 0.
AmountForUnusedPorts | decimal | The unused port charge. May be 0.
AmountForOverusedPorts | decimal | The over used port charge. May be 0.
AmountForcancel | decimal | The cancellation charge. May be 0.
TotalCallCharges | decimal | The sum of the reservation, unused port, over used port, and cancellation charges.
AdjustmentAmount | decimal | The difference between the minimum charge of the conference and the actual charge. For example, if the minimum is $2 and the amount is $1.50 the adjustmentAmount is $0.50 and the amount is $2.

## Additional configuration tags

The CancelCharges/FlatFee syntax specifies that FlatFee is a XML element under CancelCharges in the plugin configuration.

Tag name | Value type | Description
ConfCancelledStr | string | The string the indicates if a conference is cancelled.
CancelCharges/FlatFee | Integer | ID for using a flat fee for cancellations
CancelCharges/PerScheduledPort | Integer | ID is calculating cancellation charges via the number of scheduled ports.
UnusedPortCharges/FlatFee | Integer | ID for using a flat fee for Unused port charges
UnusedPortCharges/PerUnusedPort | Integer | ID for calculating the unused port charge with the number of unused ports.
OverusedPortCharges/FlatFee | Integer | ID for using a flat fee for Over used port charges
OverusedPortCharges/PerOverusedPort | Integer | ID for calculating the over used port charge with the number of over used ports.

## Configuration Example

<configdata>
<!-- Inputs -->
<ConTotal>ConnectionTotalAmount</ConTotal>
<CancelType>CancelChargeType</CancelType>
<CancelMaxCharge>CancelMaxCharge</CancelMaxCharge>
<CancelRate>CancelRate</CancelRate>
<UnusedPortChargeType>UnusedPortChargeType</UnusedPortChargeType>
<UnusedPortRate>UnusedPortRate</UnusedPortRate>
<ResCharge>ReserveCharge</ResCharge>
<NumUnusedPorts>NumUnusedPorts</NumUnusedPorts>
<ScheduledCon>ScheduledConnections</ScheduledCon>
<CancelFlag>CancelledFlag</CancelFlag>
<ConfChargeMinimum>ConfChargeMinimum</ConfChargeMinimum>
<OverusedPortChargeType>OverusedPortChargeType</OverusedPortChargeType>
<OverusedPortRate>OverusedPortRate</OverusedPortRate>
<NumOverusedPorts>NumOverusedPorts</NumOverusedPorts>
<ConfCancelledStr>Y</ConfCancelledStr>
<!-- Ouputs -->
<Amount>_Amount</Amount>
<AmountForReserve>ReservationCharges</AmountForReserve>
<AmountForUnusedPorts>UnusedPortCharges</AmountForUnusedPorts>
<AmountForcancel>CancelCharges</AmountForcancel>
<TotalCallCharges>TotalCallCharges</TotalCallCharges>
<AdjustmentAmount>AdjustmentAmount</AdjustmentAmount>
<AmountForOverusedPorts>OverusedPortCharges</AmountForOverusedPorts>
<CancelCharges>
<FlatFee PTYPE="INTEGER">0</FlatFee>
<PerScheduledPort PTYPE="INTEGER">1</PerScheduledPort>
</CancelCharges>
<UnusedPortCharges>
<FlatFee PTYPE="INTEGER">0</FlatFee>
<PerUnusedPort PTYPE="INTEGER">1</PerUnusedPort>
</UnusedPortCharges>
<OverusedPortCharges>
<FlatFee PTYPE="INTEGER">0</FlatFee>
<PerOverusedPort PTYPE="INTEGER">1</PerOverusedPort>
</OverusedPortCharges>
</configdata>

## Remarks

ConnectionTotalAmount, CancelRate, UnusedPortRate, and ResCharge must be greater or equal to 0.