# PCRate

## Program ID

MetraPipeline.PCRate.1

## Description

The PCRate plug-in retrieves rates from a parameter table for a given session. The PCRateLookup plug-in uses all subscription and effective date information to determine up to three rate schedules that could apply to a session. These rate schedules are the subscription rate schedule, the product offering rate schedule, and the default account price list rate schedule. The rules in these rate schedules are applied in order. The plug-in uses the price list chaining configuration information in PCConfig.xml to decide whether it should go to the next rate schedule if the previous rate schedule fails to match.

By default, the plug-in uses a set of reserved properties. These properties can optionally be overridden.

Note: | The PCRate plug-in verifies that child priceable items are metered with parents, and that parent priceable items are not metered with other parents. If metered incorrectly, you will get one of the two following errors: A child priceable item was rated with no parent A parent priceable item was rated as a child

## Required Input Properties

The names of the properties may be overridden (see the Configuration Example).

Property | Data Type | Description
_timestamp | datetime | Timestamp used as the effective date for this session.
_PriceableItemName | string | The name of the priceable item template. Either this property or _PriceableItemTemplateID must be set.
_PriceableItemTemplateID | long | ID of the priceable item template. Either this property or _PriceableItemName must be set.
_AccountID | long | The account ID associated with the session.
_AccountPriceList | long | The price list ID for the account's default price list (-1 if not set).
accountCycleID | long | The account's usage cycle ID.

## Required Output Properties

Property | Data Type | Description
_PriceableItemTypeID | long | The priceable item type ID associated with the priceable item template.
_PriceableItemTemplateID | long | The priceable item template ID (set if PriceableItemName is passed in to identify the priceable item template).

## Additional Configuration Tags

Property | Data Type | Description
usebcpflag | Boolean | If using a SQL Server database, when TRUE, this plug-in uses the SQL Server Bulk Copy Program (BCP) utility to insert temporary data into the database. (This increases the performance of this plug-in.) If Oracle is used, this tag is ignored.

## Configuration Example

The only required configuration is the name of the parameter table. The tags <RateLookup> <ParamTable> </ParamTable> </RateLookup> may be repeated any number of times to look up rates for multiple parameter tables. Simply embed the parameter table name in each set of tags:

<configdata>
<RateLookup>
<ParamTable>metratech.com/songdownloads</ParamTable>
</RateLookup>
<RateLookup>
<ParamTable>metratech.com/songsession</ParamTable>
</RateLookup>
</configdata>

The required property names may be overridden from their default names by including the "properties" section. You may override any number of these properties. You must specify them in the order shown below:

<configdata>
<RateLookup>
<ParamTable>metratech.com/songdownloads</ParamTable>
<properties>
<_Timestamp>_Timestamp</_Timestamp>
<_PriceableItemName>_PriceableItemName</_PriceableItemName>
<_AccountID>_AccountID</_AccountID>
<_AccountPriceList>_AccountPriceList</_AccountPriceList>
<_PriceableItemTypeID>_PriceableItemTypeID</_PriceableItemTypeID>
<_PriceableItemTemplateID>_PriceableItemTemplateID</_PriceableItemTemplateID>
<_SubscriptionID>_SubscriptionID</_SubscriptionID>
<accountCycleID>accountCycleID</accountCycleID>
</properties>
</RateLookup>
</configdata>