Class ChipDnaMobileSerializer

java.lang.Object
com.creditcall.chipdnamobile.ChipDnaMobileSerializer

public class ChipDnaMobileSerializer extends Object
Utility class for serializing and deserializing ChipDNA Mobile data objects to/from XML format.

This class provides static methods for converting ChipDNA Mobile data structures to XML strings and converting XML strings back into various ChipDNA Mobile data structures (such as receipt data, card hashes, device status, etc.).

All public methods in this class are static and thread-safe for XML serialization and deserialization operations.

Since:
16/07/2017
Author:
Creditcall
  • Field Details

  • Constructor Details

    • ChipDnaMobileSerializer

      public ChipDnaMobileSerializer()
  • Method Details

    • deserializeReceiptData

      public static Map<String,ReceiptField> deserializeReceiptData(String receiptDataXml) throws org.xmlpull.v1.XmlPullParserException, IOException
      Deserializes XML string containing receipt data into a Map of ReceiptField objects.
      Parameters:
      receiptDataXml - The XML string containing receipt data to be deserialized
      Returns:
      A Map where keys are receipt item IDs and values are ReceiptField objects
      Throws:
      org.xmlpull.v1.XmlPullParserException - If there is an error parsing the XML
      IOException - If there is an I/O error during parsing
    • deserializeCardHashes

      public static List<CardHash> deserializeCardHashes(String cardHashXml) throws org.xmlpull.v1.XmlPullParserException, IOException
      Deserializes XML string containing card hashes into a List of CardHash objects.
      Parameters:
      cardHashXml - The XML string containing card hash data to be deserialized
      Returns:
      A List of CardHash objects parsed from the XML
      Throws:
      org.xmlpull.v1.XmlPullParserException - If there is an error parsing the XML
      IOException - If there is an I/O error during parsing
    • deserializeCardTokens

      public static List<CardToken> deserializeCardTokens(String cardTokenXml) throws org.xmlpull.v1.XmlPullParserException, IOException
      Deserializes XML string containing card tokens into a List of CardToken objects.
      Parameters:
      cardTokenXml - The XML string containing card token data to be deserialized. Cannot be null.
      Returns:
      A List of CardToken objects parsed from the XML
      Throws:
      org.xmlpull.v1.XmlPullParserException - If there is an error parsing the XML
      IOException - If there is an I/O error during parsing
      NullPointerException - If cardTokenXml is null
    • serializeFeatureTokens

      public static String serializeFeatureTokens(List<FeatureToken> featureTokens)
      Serializes a List of FeatureToken objects into XML string format.
      Parameters:
      featureTokens - The List of FeatureToken objects to be serialized. Cannot be null.
      Returns:
      An XML string representation of the feature tokens
      Throws:
      NullPointerException - If featureTokens is null
      RuntimeException - If there is an error during XML serialization
    • deserializeVersionInformation

      public static VersionInformation deserializeVersionInformation(String versionInformationXml) throws org.xmlpull.v1.XmlPullParserException, IOException
      Deserializes XML string containing version information into a VersionInformation object.
      Parameters:
      versionInformationXml - The XML string containing version information to be deserialized
      Returns:
      A VersionInformation object containing version, release name, and application name
      Throws:
      org.xmlpull.v1.XmlPullParserException - If there is an error parsing the XML
      IOException - If there is an I/O error during parsing
    • deserializeDeviceStatus

      public static DeviceStatus deserializeDeviceStatus(String deviceStatusXml) throws org.xmlpull.v1.XmlPullParserException, IOException
      Deserializes XML string containing device status information into a DeviceStatus object.
      Parameters:
      deviceStatusXml - The XML string containing device status data to be deserialized
      Returns:
      A DeviceStatus object containing device information such as name, status, make, model, firmware details, battery information, etc.
      Throws:
      org.xmlpull.v1.XmlPullParserException - If there is an error parsing the XML
      IOException - If there is an I/O error during parsing
    • deserializeFirmwareUpdateStatus

      public static FirmwareUpdateStatus deserializeFirmwareUpdateStatus(String firmwareUpdateStatusXml) throws org.xmlpull.v1.XmlPullParserException, IOException
      Deserializes XML string containing firmware update status into a FirmwareUpdateStatus object.
      Parameters:
      firmwareUpdateStatusXml - The XML string containing firmware update status data to be deserialized
      Returns:
      A FirmwareUpdateStatus object containing update requirements, dates, and files requiring updates
      Throws:
      org.xmlpull.v1.XmlPullParserException - If there is an error parsing the XML
      IOException - If there is an I/O error during parsing
    • deserializeRequestQueueStatus

      public static RequestQueueStatus deserializeRequestQueueStatus(String requestQueueStatusXml) throws org.xmlpull.v1.XmlPullParserException, IOException
      Deserializes XML string containing request queue status into a RequestQueueStatus object.
      Parameters:
      requestQueueStatusXml - The XML string containing request queue status data to be deserialized
      Returns:
      A RequestQueueStatus object containing information about pending and failed requests, storage limits, and request totals by type
      Throws:
      org.xmlpull.v1.XmlPullParserException - If there is an error parsing the XML
      IOException - If there is an I/O error during parsing
    • deserializeTmsStatus

      public static TmsStatus deserializeTmsStatus(String tmsStatusXml) throws org.xmlpull.v1.XmlPullParserException, IOException
      Deserializes XML string containing TMS status information into a TmsStatus object.
      Parameters:
      tmsStatusXml - The XML string containing TMS status data to be deserialized
      Returns:
      A TmsStatus object containing configuration update information and date/time details
      Throws:
      org.xmlpull.v1.XmlPullParserException - If there is an error parsing the XML
      IOException - If there is an I/O error during parsing
    • deserializePaymentPlatformStatus

      public static PaymentPlatformStatus deserializePaymentPlatformStatus(String paymentPlatformStatusXml) throws org.xmlpull.v1.XmlPullParserException, IOException
      Deserializes XML string containing payment platform status into a PaymentPlatformStatus object.
      Parameters:
      paymentPlatformStatusXml - The XML string containing payment platform status data to be deserialized
      Returns:
      A PaymentPlatformStatus object containing availability state, date/time information, and any errors
      Throws:
      org.xmlpull.v1.XmlPullParserException - If there is an error parsing the XML
      IOException - If there is an I/O error during parsing
    • deserializeTerminalStatus

      public static TerminalStatus deserializeTerminalStatus(String terminalStatusXml) throws org.xmlpull.v1.XmlPullParserException, IOException
      Deserializes XML string containing terminal status information into a TerminalStatus object.
      Parameters:
      terminalStatusXml - The XML string containing terminal status data to be deserialized
      Returns:
      A TerminalStatus object containing terminal configuration including ID, transaction key, API key, and WebMIS credentials
      Throws:
      org.xmlpull.v1.XmlPullParserException - If there is an error parsing the XML
      IOException - If there is an I/O error during parsing
    • deserializeAvailableCurrencies

      public static HashMap<PaymentMethod,ArrayList<Currency>> deserializeAvailableCurrencies(String availableCurrenciesXml) throws org.xmlpull.v1.XmlPullParserException, IOException
      Deserializes XML string containing available currencies into a HashMap mapping payment methods to currency lists.
      Parameters:
      availableCurrenciesXml - The XML string containing available currencies data to be deserialized
      Returns:
      A HashMap where keys are PaymentMethod enums and values are ArrayLists of Currency objects
      Throws:
      org.xmlpull.v1.XmlPullParserException - If there is an error parsing the XML
      IOException - If there is an I/O error during parsing
    • deserializeAvailablePinPads

      public static HashMap<String,ArrayList<String>> deserializeAvailablePinPads(String availablePinPadsXml) throws org.xmlpull.v1.XmlPullParserException, IOException
      Deserializes XML string containing available pin pads into a HashMap mapping connection types to pin pad names.
      Parameters:
      availablePinPadsXml - The XML string containing available pin pads data to be deserialized. Can be null.
      Returns:
      A HashMap where keys are connection type strings and values are ArrayLists of pin pad names. Returns empty HashMap if input is null.
      Throws:
      org.xmlpull.v1.XmlPullParserException - If there is an error parsing the XML
      IOException - If there is an I/O error during parsing
    • deserializeAvailableApplications

      public static ArrayList<Application> deserializeAvailableApplications(String availableApplicationsXml) throws org.xmlpull.v1.XmlPullParserException, IOException
      Deserializes XML string containing available applications into an ArrayList of Application objects.
      Parameters:
      availableApplicationsXml - The XML string containing available applications data to be deserialized
      Returns:
      An ArrayList of Application objects containing application names and priorities
      Throws:
      org.xmlpull.v1.XmlPullParserException - If there is an error parsing the XML
      IOException - If there is an I/O error during parsing
    • deserializeMerchantData

      public static MerchantData deserializeMerchantData(String merchantDataXml) throws org.xmlpull.v1.XmlPullParserException, IOException
      Deserializes XML string containing merchant data into a MerchantData object.
      Parameters:
      merchantDataXml - The XML string containing merchant data to be deserialized
      Returns:
      A MerchantData object containing a list of Merchant objects with their associated information
      Throws:
      org.xmlpull.v1.XmlPullParserException - If there is an error parsing the XML
      IOException - If there is an I/O error during parsing