com.highdeal.pnr.tif
Class ChargedTransaction

java.lang.Object
  extended by com.highdeal.pnr.tif.ChargedTransaction
All Implemented Interfaces:
XMLMarshallable

public class ChargedTransaction
extends java.lang.Object
implements XMLMarshallable

This class represents a charged transaction that is a data record generated by the SAP CC system during the charging operation to a prepaid account or to an external account (postpaid account) in a subscriber account.

Note

The SAP CC system can generate different types of transactional data. Refer to the SAP CC Library (Application Help) for more information.

See Also:
TaxStatus, SubscriberAccountModel

XML API for HCI

The XML APIs specify the following XSD fragment:

XSD Fragment

<xs:element name="chargedTransaction">
   <xs:complexType>
       <xs:sequence>
         <xs:element ref="taxDetail" minOccurs="0" maxOccurs="unbounded"/>
         <xs:element ref="detail" minOccurs="0" maxOccurs="unbounded"/>
       </xs:sequence>
       <xs:attribute name="serviceProvider" type="xs:string"/>
       <xs:attribute name="subscriberAccountCode" type="xs:string"/>
       <xs:attribute name="subscriberAccountReference" type="xs:string"/>
       <xs:attribute name="accountCode" type="xs:string"/>
       <xs:attribute name="accountType">
         <xs:simpleType>
           <xs:restriction base="xs:string">
              <xs:enumeration value="prepaid"/>
              <xs:enumeration value="external"/>
           </xs:restriction>
         </xs:simpleType>
       </xs:attribute>
       <xs:attribute name="operationType">
         <xs:simpleType>
           <xs:restriction base="xs:string">
              <xs:enumeration value="credit"/>
              <xs:enumeration value="debit"/>
           </xs:restriction>
         </xs:simpleType>
       </xs:attribute>
       <xs:attribute name="baseAmount" type="xs:string"/>
       <xs:attribute name="amount" type="xs:string"/>
       <xs:attribute name="date" type="xs:dateTime"/>
       <xs:attribute name="creditorId" type="xs:string"/>
       <xs:attribute name="debtorId" type="xs:string"/>
       <xs:attribute name="taxAmount" type="xs:string"/>
       <xs:attribute name="totalAmount" type="xs:string"/>
       <xs:attribute name="taxCode" type="xs:string" use="required"/>
       <xs:attribute name="taxStatus"  use="required">
          <xs:simpleType>
              <xs:restriction base="xs:string">
                  <xs:enumeration value="tsNoTax"/>
                  <xs:enumeration value="tsForInfo"/>
                  <xs:enumeration value="tsApplied"/>
                  <xs:enumeration value="tsTaxExempted"/>
                  <xs:enumeration value="tsTaxMissedForInfo"/>
                  <xs:enumeration value="tsTaxMissedForApply"/>
                  <xs:enumeration value="tsUnknown"/>
              </xs:restriction>
          </xs:simpleType>
       </xs:attribute>
   </xs:complexType>
  </xs:element>


Nested Class Summary
static class ChargedTransaction.AccountType
          Builds an account type.
 
Field Summary
static OperationType CREDIT_OPERATION
          CREDIT_OPERATION
static OperationType DEBIT_OPERATION
          DEBIT_OPERATION
static ChargedTransaction.AccountType EXTERNAL_ACCOUNT
          EXTERNAL_ACCOUNT
static ChargedTransaction.AccountType PREPAID_ACCOUNT
          PREPAID_ACCOUNT
 
Constructor Summary
ChargedTransaction()
          FOR INTERNAL USE ONLY - Builds an empty charged transaction.
ChargedTransaction(com.highdeal.pnr.domain.IAccountAccessor suacModel, OperationType opType, java.lang.String accountCode, ChargedTransaction.AccountType accountType, java.util.Date date, Money amount, boolean isForced)
          Initializes a charged transaction.
 
Method Summary
 void addCharacterData(java.lang.String cData)
          Adds character data to the content element.
 void addChild(java.lang.String tagName, XMLMarshallable child)
          Adds a child to the object, the child representing the marshallable object which must be added to the element.
 java.lang.String getAccountCode()
          Returns the code of the charged account.
 ChargedTransaction.AccountType getAccountType()
          Returns the type of the charged account.
 Money getAmount()
          Returns the amount of the charging.
 Money getBaseAmount()
          Returns the base amount of the charging.
 ChargedItem getChargedItem()
          Returns the charged item associated to this charged transaction.
 java.lang.String getCreditorId()
          Returns the creditor identifier of the charged account.
 java.util.Date getDate()
          Returns the date of the charge.
 java.lang.String getDebtorId()
          Returns the debtor identifier of the charged account.
 DetailRecord getDetailRecord()
          Returns the detail records of this charged transaction.
 OperationType getOperationType()
          Returns the type of the operation of the this charged transaction: debit or credit.
 java.lang.String getServiceProvider()
          Returns the service provider of the subscriber account related of the charge.
 java.lang.String getSubscriberAccountCode()
          Returns the code of the subscriber account related to the charge.
 java.lang.String getSubscriberAccountReference()
          Returns the internal reference of the subscriber account related to the charge.
 Money getTaxAmount()
          Returns the tax amount of the charging.
 java.lang.String getTaxCode()
          Returns the tax code of the charging.
 java.util.List<TaxDetailModel> getTaxDetails()
          Returns a list of TaxDetailModel.
 TaxStatus getTaxStatus()
          Returns the tax status of the charging.
 Money getTotalAmount()
          Returns the total amount of the charging.
 boolean hasTaxDetails()
          Indicates whether the taxed amount has details.
 boolean isExternalAccount()
          Indicates whether the account type is External.
 boolean isForced()
          Returns if the charge was forced or not.
 boolean isPrepaidAccount()
          Indicates whether the account type is Prepaid.
 boolean isValid()
           
 void marshal(XMLOutputter output)
          Gives an XML representation of this object, including its children.
 void negateAmount()
          Negates the amount of this charged transaction.
 void setAmount(Money amount)
          Sets the amount of the charging.
 void setAttributes(XMLAttributes atts)
          Sets the attributes of the XML representation of the element being processed.
 void setBaseAmount(Money baseAamount)
          Sets the base amount of the charging.
 void setChargedItem(ChargedItem chargedItem)
          Sets the charged item associated to this charged transaction.
 void setTaxAmount(Money taxAmount)
          Sets the tax amount of the charging.
 void setTaxCode(java.lang.String taxCode)
          Sets the tax code of the charging.
 void setTaxStatus(TaxStatus taxStatus)
          Sets the tax status of the charging.
 void setTotalAmount(Money totalAmount)
          Sets the total amount of the charging.
 java.lang.String toString()
          Returns a string representation of the charged transaction.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PREPAID_ACCOUNT

public static final ChargedTransaction.AccountType PREPAID_ACCOUNT
PREPAID_ACCOUNT


EXTERNAL_ACCOUNT

public static final ChargedTransaction.AccountType EXTERNAL_ACCOUNT
EXTERNAL_ACCOUNT


CREDIT_OPERATION

public static final OperationType CREDIT_OPERATION
CREDIT_OPERATION


DEBIT_OPERATION

public static final OperationType DEBIT_OPERATION
DEBIT_OPERATION

Constructor Detail

ChargedTransaction

public ChargedTransaction()
FOR INTERNAL USE ONLY - Builds an empty charged transaction.


ChargedTransaction

public ChargedTransaction(com.highdeal.pnr.domain.IAccountAccessor suacModel,
                          OperationType opType,
                          java.lang.String accountCode,
                          ChargedTransaction.AccountType accountType,
                          java.util.Date date,
                          Money amount,
                          boolean isForced)
Initializes a charged transaction.

Parameters:
suacModel - The subscriber account that contains the charged account
opType - The operation type: DEBIT_OPERATION or CREDIT_OPERATION
accountCode - The identification code of the charged account
accountType - The type of the charged account: PREPAID_ACCOUNT if the charged account is a prepaid account or EXTERNAL_ACCOUNT if the charged account is an external account
date - Date when the charging operation has been done
amount - The amount of the charge
isForced - Flag that must be set to true to force charging on account, even if balance is empty.
Throws:
java.lang.IllegalArgumentException - if one argument is empty (null or empty string).
Method Detail

getOperationType

public final OperationType getOperationType()
Returns the type of the operation of the this charged transaction: debit or credit.

Returns:
DEBIT_OPERATION or CREDIT_OPERATION

getAccountCode

public final java.lang.String getAccountCode()
Returns the code of the charged account.

Returns:
The code of a prepaid/external account
Throws:
java.lang.IllegalStateException - if the account code is null (invalid xml initialization)

getAccountType

public final ChargedTransaction.AccountType getAccountType()
Returns the type of the charged account.

Returns:
is PREPAID_ACCOUNT if the charged account is a prepaid account or EXTERNAL_ACCOUNT if the charged account is an external account
Throws:
java.lang.IllegalStateException - if the account type is null (invalid xml initialization)

getBaseAmount

public final Money getBaseAmount()
Returns the base amount of the charging.

Returns:
A base amount

setBaseAmount

public void setBaseAmount(Money baseAamount)
Sets the base amount of the charging.

Parameters:
baseAamount - A base amount

getAmount

public final Money getAmount()
Returns the amount of the charging.

Returns:
An amount
Throws:
java.lang.IllegalStateException - if the amount is null (invalid xml initialization)

setAmount

public void setAmount(Money amount)
Sets the amount of the charging.

Parameters:
amount - An amount

getTaxAmount

public final Money getTaxAmount()
Returns the tax amount of the charging.

Returns:
A tax amount

setTaxAmount

public void setTaxAmount(Money taxAmount)
Sets the tax amount of the charging.

Parameters:
taxAmount - A tax amount

getTotalAmount

public final Money getTotalAmount()
Returns the total amount of the charging.

Returns:
A total amount (including tax)

setTotalAmount

public void setTotalAmount(Money totalAmount)
Sets the total amount of the charging.

Parameters:
totalAmount - A total amount

getTaxCode

public final java.lang.String getTaxCode()
Returns the tax code of the charging.

Returns:
A tax code

setTaxCode

public void setTaxCode(java.lang.String taxCode)
Sets the tax code of the charging.

Parameters:
taxCode - A tax code

getTaxStatus

public final TaxStatus getTaxStatus()
Returns the tax status of the charging.

Returns:
A tax status

setTaxStatus

public void setTaxStatus(TaxStatus taxStatus)
Sets the tax status of the charging.

Parameters:
taxStatus - A tax status

negateAmount

public final void negateAmount()
Negates the amount of this charged transaction.


getDate

public final java.util.Date getDate()
Returns the date of the charge.

Returns:
A date
Throws:
java.lang.IllegalStateException - if the date is null (invalid xml initialization)

getServiceProvider

public final java.lang.String getServiceProvider()
Returns the service provider of the subscriber account related of the charge.

Returns:
The service provider
Throws:
java.lang.IllegalStateException - if the service providr is null (invalid xml initialization)

getSubscriberAccountCode

public final java.lang.String getSubscriberAccountCode()
Returns the code of the subscriber account related to the charge.

Returns:
The identification code of the subscriber account
Throws:
java.lang.IllegalStateException - if the subscriber account code is null (invalid xml initialization)

getSubscriberAccountReference

public final java.lang.String getSubscriberAccountReference()
Returns the internal reference of the subscriber account related to the charge.

Returns:
The internal reference of the subscriber account
Throws:
java.lang.IllegalStateException - if the subscriber account internal reference is null (invalid xml initialization)

isForced

public boolean isForced()
Returns if the charge was forced or not.

Returns:
true if the charge was forced, false otherwise.

getDebtorId

public java.lang.String getDebtorId()
Returns the debtor identifier of the charged account.

Returns:
The debtor identifier

getCreditorId

public java.lang.String getCreditorId()
Returns the creditor identifier of the charged account.

Returns:
The creditor identifier

getDetailRecord

public DetailRecord getDetailRecord()
Returns the detail records of this charged transaction.

Returns:
The detail records

getTaxDetails

public java.util.List<TaxDetailModel> getTaxDetails()
Returns a list of TaxDetailModel.

Returns:
A list of TaxDetailModel

hasTaxDetails

public boolean hasTaxDetails()
Indicates whether the taxed amount has details.

Returns:
true if the taxed amount has a list of TaxDetail, else false.

getChargedItem

public ChargedItem getChargedItem()
Returns the charged item associated to this charged transaction.

Returns:
The charged item associated to this charged transaction

setChargedItem

public void setChargedItem(ChargedItem chargedItem)
Sets the charged item associated to this charged transaction.

Parameters:
chargedItem - The charged item associated to this charged transaction

isPrepaidAccount

public final boolean isPrepaidAccount()
Indicates whether the account type is Prepaid.

Returns:
true if the account type is Prepaid, false otherwise.

isExternalAccount

public final boolean isExternalAccount()
Indicates whether the account type is External.

Returns:
true if the account type is External, false otherwise.

setAttributes

public final void setAttributes(XMLAttributes atts)
Description copied from interface: XMLMarshallable
Sets the attributes of the XML representation of the element being processed.

Specified by:
setAttributes in interface XMLMarshallable
Parameters:
atts - The XML attributes of the current element

addCharacterData

public void addCharacterData(java.lang.String cData)
Description copied from interface: XMLMarshallable
Adds character data to the content element.

Specified by:
addCharacterData in interface XMLMarshallable
Parameters:
cData - The character data to be added

addChild

public final void addChild(java.lang.String tagName,
                           XMLMarshallable child)
Description copied from interface: XMLMarshallable
Adds a child to the object, the child representing the marshallable object which must be added to the element.

Specified by:
addChild in interface XMLMarshallable
Parameters:
tagName - The name of tag for the child
child - The child to be added

marshal

public final void marshal(XMLOutputter output)
Description copied from interface: XMLMarshallable
Gives an XML representation of this object, including its children.

Specified by:
marshal in interface XMLMarshallable
Parameters:
output - The XML output to marshal the object into

isValid

public final boolean isValid()

toString

public java.lang.String toString()
Returns a string representation of the charged transaction.

Overrides:
toString in class java.lang.Object
Returns:
A string representation of the charged transaction

Document Published: October 2015 (SAP CC 4.0 SP10 and Later)