Customizing Billing Exports
CloudPortal Business Manager has a built-in functionality of exporting billing information in xml everyday such as account statements, invoices, payment and credit statements, and payment failures.
Billing export is driven by a xml configuration named billing-export-config.xml located in the citrix.cpbm.custom.common bundle. CloudPortal Business Manager allows you to customize various factors before exporting a file. Customization includes the following:
- File name pattern
- Sequencing of records
- sftp/ftp configuration
- batch size
- xslt transformation config file that needs to be applied on the generated xml
Supported streams
- AccountStatement StreamThe AccountStatement Stream is capable of generating data with different types of sequencing. Sequence can be altered in the configuration settings file. Valid Sequences for AccountStatement Stream are:
- ACCOUNT_TYPE
- CHANNEL
- TENANT
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <AccountStatements> <AccountStatement> <uuid>22c1aede-614d-4be4-8cf3-4737853111a7</uuid> <Tenant> <Uuid>890077fe-6844-4732-8199-215566da083f</Uuid> <Name>nageshp</Name> <AccountType>Corporate</AccountType> <Channel>Channel-14-8-2013</Channel> <State>ACTIVE</State> <CreationDate>2013-09-03T08:22:33Z</CreationDate> <Currency>US Dollar</Currency> <Owner> <Uuid>d34c5ee3-e3e0-4772-a5fb-d0377ffd6e14</Uuid> <Name>nageshp</Name> <Username>nageshp</Username> </Owner> <Address> <City>bangalore</City> <Country>IN</Country> <PostalCode>560073</PostalCode> <State>KAR</State> <Street1>1stAvenue</Street1> </Address> </Tenant> <State>POSTED</State> <StartDate>2013-09-09T00:00:00Z</StartDate> <EndDate>2013-09-11T23:59:59Z</EndDate> <PostedAt>2013-09-12T01:06:15Z</PostedAt> <BalanceForward>-43709.4</BalanceForward> <NewCharges>6301.69</NewCharges> <Credits>0.0</Credits> <Discounts>0.0</Discounts> <TotalTaxes>572.88</TotalTaxes> <FinalCharges>50011.09</FinalCharges> <SubscriptionCharges>137.99</SubscriptionCharges> <UtilityCharges>5590.82</UtilityCharges> <RenewalCharges>0.0</RenewalCharges> <Invoices> <Invoice> <uuid>750b8fc4-2ffd-474e-b779-c2aac284e4fd</uuid> <GenerationDate>2013-09-12T01:06:14Z</GenerationDate> <ServiceStartDate>2013-09-11T00:00:00Z</ServiceStartDate> <ServiceEndDate>2013-09-11T23:59:59Z</ServiceEndDate> <PostedAt>2013-09-12T01:06:14Z</PostedAt> <State>Posted</State> <RawAmount>2865.39</RawAmount> <Discount>0.0</Discount> <SubTotal>2865.39</SubTotal> <Tax>286.54</Tax> <FinalAmount>3151.93</FinalAmount> <Subscription/> <InvoiceItems> <InvoiceItem type="Charge" chargeableUsage="48.0" unitPrice="12.1234"> <Amount>581.9232</Amount> <Description>Charge</Description> </InvoiceItem> <InvoiceItem type="Charge" chargeableUsage="0.020237457" unitPrice="6.0"> <Amount>0.121424735</Amount> <Description>Charge</Description> </InvoiceItem> <InvoiceItem type="Charge" chargeableUsage="0.0" unitPrice="4.0"> <Amount>0.0</Amount> <Description>Charge</Description> </InvoiceItem> <InvoiceItem type="Charge" chargeableUsage="48.0" unitPrice="3.0"> <Amount>144.0</Amount> <Description>Prod-16-8-2013</Description> </InvoiceItem> <InvoiceItem type="Charge" chargeableUsage="0.0" unitPrice="5.0"> <Amount>0.0</Amount> <Description>Charge</Description> </InvoiceItem> <InvoiceItem type="Charge" chargeableUsage="0.0" unitPrice="4.0"> <Amount>0.0</Amount> <Description>Charge</Description> </InvoiceItem> <InvoiceItem type="Charge" chargeableUsage="15.026944" unitPrice="80.0"> <Amount>1202.1555</Amount> <Description>Running-VM-CentOS</Description> </InvoiceItem> <InvoiceItem type="Charge" chargeableUsage="48.0" unitPrice="2.0"> <Amount>96.0</Amount> <Description>Charge</Description> </InvoiceItem> <InvoiceItem type="Charge" chargeableUsage="0.032258064" unitPrice="2.0"> <Amount>0.06451613</Amount> <Description>Charge</Description> </InvoiceItem> <InvoiceItem type="Charge" chargeableUsage="15.056945" unitPrice="6.0"> <Amount>90.34167</Amount> <Description>Charge</Description> </InvoiceItem> <InvoiceItem type="Charge" chargeableUsage="15.026944" unitPrice="7.0"> <Amount>105.18861</Amount> <Description>prod-26-8-2013</Description> </InvoiceItem> <InvoiceItem type="Charge" chargeableUsage="1.54227E-5" unitPrice="6.0"> <Amount>9.25362E-5</Amount> <Description>Charge</Description> </InvoiceItem> <InvoiceItem type="Charge" chargeableUsage="15.026944" unitPrice="5.0"> <Amount>75.13472</Amount> <Description>Prod-27-6-2013</Description> </InvoiceItem> <InvoiceItem type="Charge" chargeableUsage="0.40475658" unitPrice="0.0"> <Amount>0.0</Amount> <Description>Charge</Description> </InvoiceItem> <InvoiceItem type="Charge" chargeableUsage="0.030000687" unitPrice="10.0"> <Amount>0.30000687</Amount> <Description>stopped_VM</Description> </InvoiceItem> <InvoiceItem type="Charge" chargeableUsage="48.0" unitPrice="10.0"> <Amount>480.0</Amount> <Description>Prod_RunningVM</Description> </InvoiceItem> <InvoiceItem type="Charge" chargeableUsage="15.026944" unitPrice="6.0"> <Amount>90.16167</Amount> <Description>Charge</Description> </InvoiceItem> <InvoiceItem type="Charge" chargeableUsage="0.0" unitPrice="6.0"> <Amount>0.0</Amount> <Description>Charge</Description> </InvoiceItem> <InvoiceItem type="Charge" chargeableUsage="1.54227E-5" unitPrice="100.0"> <Amount>0.00154227</Amount> <Description>internetcharges</Description> </InvoiceItem> <InvoiceItem type="Subtotal" chargeableUsage="0.0" unitPrice="0.0"> <Amount>2865.39</Amount> <Description>Subtotal</Description> </InvoiceItem> <InvoiceItem type="Discounts" chargeableUsage="0.0" unitPrice="0.0"> <Amount>0.0</Amount> <Description>Discounts</Description> </InvoiceItem> <InvoiceItem type="Tax" chargeableUsage="0.0" unitPrice="0.0"> <Amount>286.539</Amount> <Description>Tax @ 10.00%</Description> </InvoiceItem> <InvoiceItem type="Taxes" chargeableUsage="0.0" unitPrice="0.0"> <Amount>286.54</Amount> <Description>Taxes</Description> </InvoiceItem> <InvoiceItem type="Net" chargeableUsage="0.0" unitPrice="0.0"> <Amount>3151.93</Amount> <Description>Net</Description> </InvoiceItem> </InvoiceItems> </Invoice> </Invoices> </AccountStatement> </AccountStatements>
- All invoices for the day:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <Invoices> <Invoice> <uuid>b36d0c37-1324-485b-8049-36b534754986</uuid> <GenerationDate>2013-09-12T01:04:11Z</GenerationDate> <ServiceStartDate>2013-09-11T00:00:00Z</ServiceStartDate> <ServiceEndDate>2013-09-11T23:59:59Z</ServiceEndDate> <PostedAt>2013-09-12T01:04:11Z</PostedAt> <State>Posted</State> <RawAmount>2327.99</RawAmount> <Discount>931.2</Discount> <SubTotal>1396.79</SubTotal> <Tax>139.68</Tax> <FinalAmount>1536.47</FinalAmount> <Subscription/> <InvoiceItems> <InvoiceItem type="Charge" chargeableUsage="48.0" unitPrice="5.0"> <Amount>240.0</Amount> <Description>Prod-14-8-2013</Description> </InvoiceItem> <InvoiceItem type="Charge" chargeableUsage="0.058015037" unitPrice="5.0"> <Amount>0.29007518</Amount> <Description>Charge</Description> </InvoiceItem> <InvoiceItem type="Charge" chargeableUsage="80.36278" unitPrice="12.1234"> <Amount>974.2701</Amount> <Description>Charge</Description> </InvoiceItem> <InvoiceItem type="Charge" chargeableUsage="96.0" unitPrice="2.0"> <Amount>192.0</Amount> <Description>Charge</Description> </InvoiceItem> <InvoiceItem type="Charge" chargeableUsage="0.032258064" unitPrice="2.0"> <Amount>0.06451613</Amount> <Description>Charge</Description> </InvoiceItem> <InvoiceItem type="Charge" chargeableUsage="32.362778" unitPrice="3.0"> <Amount>97.08833</Amount> <Description>Prod-16-8-2013</Description> </InvoiceItem> <InvoiceItem type="Charge" chargeableUsage="0.0" unitPrice="4.0"> <Amount>0.0</Amount> <Description>Charge</Description> </InvoiceItem> <InvoiceItem type="Charge" chargeableUsage="2.580645" unitPrice="5.0"> <Amount>12.903226</Amount> <Description>Charge</Description> </InvoiceItem> <InvoiceItem type="Charge" chargeableUsage="1.2903225" unitPrice="6.0"> <Amount>7.7419353</Amount> <Description>Charge</Description> </InvoiceItem> <InvoiceItem type="Charge" chargeableUsage="80.36278" unitPrice="10.0"> <Amount>803.6278</Amount> <Description>Prod_RunningVM</Description> </InvoiceItem> <InvoiceItem type="Charge" chargeableUsage="3.57069E-5" unitPrice="4.0"> <Amount>1.428276E-4</Amount> <Description>Charge</Description> </InvoiceItem> <InvoiceItem type="Subtotal" chargeableUsage="0.0" unitPrice="0.0"> <Amount>2327.99</Amount> <Description>Subtotal</Description> </InvoiceItem> <InvoiceItem type="Discount" chargeableUsage="0.0" unitPrice="0.0"> <Amount>931.196</Amount> <Description>Discount @ 40.0000%</Description> </InvoiceItem> <InvoiceItem type="Discounts" chargeableUsage="0.0" unitPrice="0.0"> <Amount>931.2</Amount> <Description>Discounts</Description> </InvoiceItem> <InvoiceItem type="Tax" chargeableUsage="0.0" unitPrice="0.0"> <Amount>139.679</Amount> <Description>Tax @ 10.00%</Description> </InvoiceItem> <InvoiceItem type="Taxes" chargeableUsage="0.0" unitPrice="0.0"> <Amount>139.68</Amount> <Description>Taxes</Description> </InvoiceItem> <InvoiceItem type="Net" chargeableUsage="0.0" unitPrice="0.0"> <Amount>1536.47</Amount> <Description>Net</Description> </InvoiceItem> </InvoiceItems> </Invoice> </Invoices>
- Payments and credits
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <Payments> <Payment> <Uuid>8a80262e-3d52-4079-adda-1301362fa613</Uuid> <Tenant> <Uuid>8822c76b-0a98-4e37-864a-31508eccec72</Uuid> <Name>anusha</Name> <AccountType>RETAIL</AccountType> <Channel>Channel-14-8-2013</Channel> <State>SUSPENDED</State> <CreationDate>2013-08-28T09:31:55Z</CreationDate> <Currency>US Dollar</Currency> <Owner> <Uuid>a08a9bb6-6644-4971-8812-8211eb6b2d87</Uuid> <Name>anusha b</Name> <Username>anusha</Username> </Owner> <Address> <City>bangalore</City> <Country>IN</Country> <PostalCode>560078</PostalCode> <State>KAR</State> <Street1>MajesticAvenue</Street1> </Address> </Tenant> <type>AUTO</type> <TransactionAmount>2170.04</TransactionAmount> <memo>Making Auto Payment</memo> <AccountStatement uuid="69911443-bf90-408b-9331-443a0b23a822" <PaymentTransaction> <Uuid>257cc015-49a2-40aa-aed5-4a32b6bfe773</Uuid> <Type>CHARGE</Type> <TransactionId>3789481256760176056470</TransactionId> <TransactionTime>2013-09-12T01:05:16Z</TransactionTime> <TransactedAmount>2170.04</TransactedAmount> <Amount>2170.04</Amount> <State>COMPLETED</State> <StatusCode>0</StatusCode> <Memo>Making Auto Payment</Memo> </PaymentTransaction> </Payment> <Payments>
- Payment failure
<PaymentFailures> <PaymentFailure> <Uuid>f5892323-ad4c-4439-8b46-3687f1e0192d</Uuid> <Tenant> <Uuid>f132a5e3-f1ae-478b-999f-ddaf68e2b711</Uuid> <Name>peter</Name> <AccountType>RETAIL</AccountType> <Channel>Default</Channel> <State>ACTIVE</State> <CreationDate>2012-04-30T00:00:00Z</CreationDate> <Currency>Euro</Currency> <Owner> <Uuid>13c1d293-9dbc-4408-abd6-2190e72de091</Uuid> <Name>peter</Name> <Username>peter</Username> </Owner> <Address> <City>bangalore</City> <Country>IN</Country> <PostalCode>560002</PostalCode> <State>KAR</State> <Street1>FrazerTown</Street1> </Address> </Tenant> <type>CHARGE</type> <PaymentTransaction> <Uuid>f5892323-ad4c-4439-8b46-3687f1e0192d</Uuid> <Type>CHARGE</Type> <TransactionId>3678348733330176056442</TransactionId> <TransactionTime>2013-05-06T09:57:23Z</TransactionTime> <TransactedAmount>100.0</TransactedAmount> <Amount>100.0</Amount> <State>ERRORED</State> <StatusCode>0</StatusCode> <Memo></Memo> </PaymentTransaction> </PaymentFailure> </PaymentFailures>
Global stream configuration
There are 2 configurations which can be applied at global level for all the streams:
- com.citrix.cpbm.portal.billing.export.URL - URL refers to the configuration to which generated stream file would be uploaded. It has to be a valid URL pattern supported by apache VFS. For example, sftp://root:root1234@localhost/.
- com.citrix.cpbm.portal.billing.export.directory: Directory (CloudPortal Business Manager installed system) on which all the streams will be generated locally.
Both these settings can be applied from the configuration screen.
Stream configuration
Stream configuration consists of the following:
- Batch size: Number of records that should be written to the batch file as output.
- File:
- pattern: File pattern is the name of the file to be generated during the batch process. For example, cloudportal_subs_%d.log.%s, where %d gets replaced by the current date and %s gets replaced by the last file sequence + 1.
CloudPortal Business Manager supports only %d and %s replacement of runtime variables in the file name pattern.
- trasformxsl: Path of the xslt configuration file, that will be used to generate the batch file in various formats like csv, xslt, and so on.System has the capability of reading a file from classpath. Path should prefixed with appropriate config:
- classpath:
- pattern: File pattern is the name of the file to be generated during the batch process. For example, cloudportal_subs_%d.log.%s, where %d gets replaced by the current date and %s gets replaced by the last file sequence + 1.
- Sequence algorithms: Sequence algorithm defines the logical grouping of billing export data that is by type-1 and then by type-2.
- Export file: Value of the element can be:
<Export url=""/>
- Full URL path, if global settings are not applied.
- Directory location in the remote system assigned to the stream.
This is implemented using Apache VFS. All file systems in Apache VFS that allow file upload and create in a remote system are supported. - Configuration:
<BillingExport> <ExportStream name="AccountStatement"> <file pattern="cpbm_account_stmt_%d_%s" transformxsl="classpath:/opt/billing/xsl/transform.xsl"/> <batch size="10"/> <sequence id="channel"/> <sequence id="accounttype"/> <Export url=""/> </ExportStream> <ExportStream name="invoice"> <file pattern="cpbm_invoice_%d_%s" transformxsl="classpath:/com/citrix/cpbm/custom/transform.xsl"/> <batch size="10"/> <Export url=""/> </ExportStream> </BillingExport>
Comments