Class BillingXml provides XML writer functions needed to create OSB XML invoices. Such writers exist for the invoice itself, each type of invoice item and all basic billing classes that need to be written to the invoice. The invoice XML writer is the entry point and should be called by the billing application to print an invoice. All XML writers are collected in a class so that you can easily store thread specific data as members of this class.
Class BillingXml contains default implementations of XML writers for commonly used billing classes. It can be extended by inheritance. In order to overload functions of this class, e.g., BillingXml::writeInfo(), remember to use a using-declaration in the derived class:
class MyBillingXml : public OSB_LIB::BillingXml { public: // Make writeInfo() functions of the base class visible using OSB_LIB::BillingXml::writeInfo; // ... }
Furthermore, note how we use dynamic_cast in connection with template functions. This seems necessary because template functions cannot be virtual.
Definition at line 239 of file billingxml.h.
OSB_LIB::BillingXml::BillingXml | ( | std::ostream & | o | ) | [inline] |
Constructor.
o | Output stream for the generated XML. |
Definition at line 246 of file billingxml.h.
virtual OSB_LIB::BillingXml::~BillingXml | ( | ) | [inline, virtual] |
virtual void OSB_LIB::BillingXml::writeAddress | ( | const Address & | address, | |
AddressType | addressType | |||
) | [virtual] |
virtual void OSB_LIB::BillingXml::writeAssociate | ( | const Associate & | associate | ) | [virtual] |
virtual void OSB_LIB::BillingXml::writeBaseAmount | ( | const BaseAmount & | baseAmount | ) | [virtual] |
Base amount XML writer.
baseAmount | Base amount. |
virtual void OSB_LIB::BillingXml::writeInvoice | ( | Invoice & | invoice, | |
const Contract & | contract, | |||
const AssociateList & | associates | |||
) | [virtual] |
XML writer for an OSB invoice.
This is the starting point to write an OSB XML invoice. Its main task is to invoke the writeXml() method of each invoice item on the invoice. In addition, it prints an XML header and footer and before each invoice item is written, it prints its section.
This method should not need to be overwritten except if you want to change the basic structure of an XML invoice. Instead, changes to the contents of XML invoices can be made by adding new invoice items and corresponding XML writers or customizing existing XML writers.
Here is the default implementation of writeInvoice():
void BillingXml::writeInvoice(Invoice& invoice, const Contract& contract, const AssociateList& associates) { writeXmlHeader(); for (Invoice::ItemListI i=invoice.itemListBegin(); i != invoice.itemListEnd(); ++i) { writeSection((*i)->section(), contract, associates); (*i)->writeXml(*this); } writeXmlFooter(); }
invoice | The invoice to be written. | |
contract | Contract for which the invoice is generated. | |
associates | List of all associates (owner and all product users) related to the contract. |
Implements OSB_LIB::BillingXmlBase.
virtual void OSB_LIB::BillingXml::writeInvoiceInfo | ( | const InvoiceInfo & | invInfo | ) | [virtual] |
virtual void OSB_LIB::BillingXml::writeMoney | ( | const Money & | money, | |
bool | withCurrency = true | |||
) | [virtual] |
virtual void OSB_LIB::BillingXml::writeOtc | ( | const OnetimeCharge & | otc | ) | [virtual] |
One-time charge XML writer.
otc | One-time charge. |
virtual void OSB_LIB::BillingXml::writeOtcItem | ( | const OnetimeChargeItem & | otcItem | ) | [virtual] |
One-time charge item XML writer.
otcItem | One-time charge item. |
void OSB_LIB::BillingXml::writeSection | ( | const Section & | section, | |
const Contract & | contract, | |||
const AssociateList & | associates | |||
) |
virtual void OSB_LIB::BillingXml::writeSubsCharge | ( | const SubsCharge & | subsCharge | ) | [virtual] |
Subscription charge XML writer.
subsCharge | Subscription charge. |
virtual void OSB_LIB::BillingXml::writeSubsItem | ( | const SubsItem & | subsItem | ) | [virtual] |
Subscription item XML writer.
subsItem | Subscription item. |
virtual void OSB_LIB::BillingXml::writeSummaryCharges | ( | const SummaryCharges & | sumCharges | ) | [virtual] |
Summary charges XML writer.
sumCharges | Summary charges to write. |
virtual void OSB_LIB::BillingXml::writeTaxAmount | ( | const TaxAmount & | taxAmount | ) | [virtual] |
virtual void OSB_LIB::BillingXml::writeTotalItem | ( | const TotalItem & | totalItem | ) | [virtual] |
Total item XML writer.
totalItem | Total item. |
virtual void OSB_LIB::BillingXml::writeUsagerecord | ( | const Usagerecord & | usagerecord | ) | [protected, virtual] |
Usage record XML writer.
usagerecord | Usage record. |
virtual void OSB_LIB::BillingXml::writeUsagerecordDetail | ( | const UsagerecordDetail & | UsagerecordDetail | ) | [virtual] |
virtual void OSB_LIB::BillingXml::writeUsagerecordItem | ( | const UsagerecordItem & | usagerecordItem | ) | [virtual] |
Usage item XML writer.
usagerecordItem | Usage item. |
virtual void OSB_LIB::BillingXml::writeXmlFooter | ( | ) | [virtual] |
virtual void OSB_LIB::BillingXml::writeXmlHeader | ( | ) | [virtual] |