00001
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #ifndef _BILLINGXML_H_
00033 #define _BILLINGXML_H_
00034
00035
00036
00037
00038 #include <iosfwd>
00039
00040
00041 #include "osbxml.h"
00042 #include "osbunit.h"
00043 #include "associate.h"
00044 #include "section.h"
00045
00046
00047 namespace OSB_LIB {
00048 class AssociateList;
00049 class AssociateInfo;
00050 class BaseAmount;
00051 class Contract;
00052 class Invoice;
00053 class InvoiceInfo;
00054 class InvoiceInfoItem;
00055 class OnetimeChargeItem;
00056 class Section;
00057 class SubsItem;
00058 class SumCdr01;
00059 class SumCdr01Detail;
00060 class SumCdr01Item;
00061 class SummaryCharges;
00062 class SummaryChargesInfo;
00063 class TaxAmount;
00064 class TotalItem;
00065 class Usagerecord;
00066 class UsagerecordDetail;
00067 class UsagerecordItem;
00068 struct OnetimeCharge;
00069 struct SubsCharge;
00070 };
00071
00072
00073
00074 namespace OSB_LIB {
00075
00076
00077
00078
00079
00113 class BillingXmlBase {
00114 public:
00120 BillingXmlBase(std::ostream& o)
00121 : xml(o),
00122 last_(Section::globalSection()),
00123 globalSectionWritten_(false)
00124 {};
00125
00127 virtual ~BillingXmlBase() {}
00128
00167 virtual void writeInvoice(
00168 Invoice& invoice,
00169 const Contract& contract,
00170 const AssociateList& associates
00171 ) = 0;
00172
00176 virtual void writeXmlHeader() = 0;
00177
00181 virtual void writeXmlFooter() = 0;
00182
00183
00184
00185
00187 OsbXml xml;
00188
00189 protected:
00197 Section last_;
00198
00203 bool globalSectionWritten_;
00204 };
00205
00239 class BillingXml : public BillingXmlBase {
00240 public:
00246 BillingXml(std::ostream& o) : BillingXmlBase(o) {}
00248 virtual ~BillingXml() {}
00249
00288 virtual void writeInvoice(
00289 Invoice& invoice,
00290 const Contract& contract,
00291 const AssociateList& associates
00292 );
00293
00298 virtual void writeUsagerecordItem(
00299 const UsagerecordItem& usagerecordItem
00300 );
00301
00306 virtual void writeSubsItem(const SubsItem& subsItem);
00307
00312 virtual void writeOtcItem(const OnetimeChargeItem& otcItem);
00313
00318 virtual void writeTotalItem(const TotalItem& totalItem);
00319
00324 virtual void writeOtc(const OnetimeCharge& otc);
00325
00330 virtual void writeSubsCharge(const SubsCharge& subsCharge);
00331
00336 virtual void writeBaseAmount(const BaseAmount& baseAmount);
00337
00346 virtual void writeTaxAmount(const TaxAmount& taxAmount);
00347
00354 virtual void writeMoney(
00355 const Money& money,
00356 bool withCurrency = true
00357 );
00358
00364 virtual void writeAddress(
00365 const Address& address,
00366 AddressType addressType
00367 );
00368
00373 virtual void writeAssociate(const Associate& associate);
00374
00379 virtual void writeSummaryCharges(
00380 const SummaryCharges& sumCharges
00381 );
00382
00387 virtual void writeInvoiceInfo(
00388 const InvoiceInfo& invInfo
00389 );
00390
00403 void writeSection(
00404 const Section& section,
00405 const Contract& contract,
00406 const AssociateList& associates
00407 );
00408
00412 virtual void writeXmlHeader();
00413
00417 virtual void writeXmlFooter();
00418
00423 virtual void writeUsagerecordDetail(
00424 const UsagerecordDetail& UsagerecordDetail
00425 );
00426 protected:
00431 virtual void writeUsagerecord(const Usagerecord& usagerecord);
00432 };
00433
00434 class SumCdr01BillingXml : public BillingXml {
00435 public:
00441 SumCdr01BillingXml(std::ostream& o) : BillingXml(o) {}
00443 virtual ~SumCdr01BillingXml() {}
00444
00449 virtual void writeSumCdr01Item(
00450 const SumCdr01Item& usageItem
00451 );
00452
00457 virtual void writeSumCdr01Detail(
00458 const SumCdr01Detail& usageDetail
00459 );
00460 };
00461 }
00462 #endif // #ifndef _BILLINGXML_H_