def searchByDate(cls, credentials, pageNumber, maxPageResults, initialDate, finalDate = None):
     LogPagSeguro.info("PagSeguroTransactionSearchService.SearchByDate(initialDate=%s, finalDate=%s) - begin" % (PagSeguroHelper.formatDate(initialDate), PagSeguroHelper.formatDate(finalDate)))
     connectionData = PagSeguroConnectionData(credentials, cls.serviceName)
     searchParams = {'initialDate': PagSeguroHelper.formatDate(initialDate),
                     'pageNumber': pageNumber,
                     'maxPageResults': maxPageResults }
     if finalDate:
         searchParams['finalDate'] = PagSeguroHelper.formatDate(searchParams['finalDate'])
     else:
         searchParams['finalDate'] = None
     
     try:
         connection = PagSeguroHttpConnection()
         connection.get(cls.buildSearchUrlByDate(connectionData, searchParams),connectionData.getServiceTimeout(), connectionData.getCharset())
         httpStatus = PagSeguroHttpStatus(connection.getStatus())
         httpStatusType = httpStatus.getType()
         if httpStatusType == 'OK':
             searchResult = PagSeguroTransactionParser.readSearchResult(connection.getResponse())
             LogPagSeguro.info("PagSeguroTransactionSearchService.SearchByDate(initialDate=%s,finalDate=%s) - end %s" % (PagSeguroHelper.formatDate(initialDate),PagSeguroHelper.formatDate(finalDate), searchResult))
         elif httpStatusType == 'BAD_REQUEST':
             errors = PagSeguroTransactionParser.readErrors(connection.getResponse())
             e = PagSeguroServiceException(httpStatus, errors)
             LogPagSeguro.info("PagSeguroTransactionSearchService.SearchByDate(initialDate=%s,finalDate=%s) - error %s" % (PagSeguroHelper.formatDate(initialDate),PagSeguroHelper.formatDate(finalDate), e.getOneLineMessage()))
             raise e
         else:
             e = PagSeguroServiceException(httpStatus)
             LogPagSeguro.info("PagSeguroTransactionSearchService.SearchByDate(initialDate=%s,finalDate=%s) - error %s" % (PagSeguroHelper.formatDate(initialDate),PagSeguroHelper.formatDate(finalDate), e.getOneLineMessage()))
             raise e
         if searchResult:
             return searchResult
         return False
     except e:
         LogPagSeguro.error("Exception: %s" % e.getMessage())
         raise e
    def getData(cls, payment):
        data = {}
        if payment.getReference() != None:
            data['reference'] = payment.getReference()
        
        sender = payment.getSender()
        if sender != None:
            if sender.getName() != None:
                data['senderName'] = sender.getName()
            if sender.getEmail != None:
                data['senderEmail'] = sender.getEmail()
            
            if sender.getPhone() != None:
                if sender.getPhone().getAreaCode() != None:
                    data['senderAreaCode'] = sender.getPhone().getAreaCode()
                if sender.getPhone().getNumber() != None:
                    data['senderNumber'] = sender.getPhone().getAreaCode()
        if payment.getCurrency() != None:
            data['currency'] = payment.getCurrency()
        items = payment.getItems()
        if len(items) > 0:
            x=0
            for v in items:
                v = items[v]
                x = x + 1
                if v.getId() != None:
                    data["itemId%s" % x] = v.getId()
                    
                if v.getDescription() != None:
                    data["itemDescription%s" % x] = v.getDescription()
                
                if v.getQuantity() != None:
                    data["itemQuantity%s" % x] = v.getQuantity()

                if v.getAmount() != None:
                    data["itemAmount%s" % x] = PagSeguroHelper.decimalFormat(v.getAmount())
                    
                if v.getWeight() != None:
                    data["itemWeight%s" % x] = v.getWeight()
  
                if v.getShippingCost() != None:
                    data["itemShippingCost%s" % x] = PagSeguroHelper.decimalFormat(v.getShippingCost())
        if payment.getExtraAmount() != None:
            data['extraAmount'] = PagSeguroHelper.decimalFormat(payment.getExtraAmount())   

        if payment.getShipping() != None:
            if payment.getShipping.getType != None and payment.getShipping().getType().getValue() != None:
                data['shippingType']= payment.getShipping().getType().getValue()
            
            if payment.getShipping().getAddress != None:
                if payment.getShipping().getAddress().getStreet() != None:
                    data['shippingAddressStreet'] = payment.getShipping().getAddress().getStreet()
                    
                if payment.getShipping().getAddress().getNumber() != None:
                    data['shippingAddressNumber'] = payment.getShipping().getAddress().getNumber()
                    
                if payment.getShipping().getAddress().etComplement() != None:
                    data['shippingAddressComplement'] = payment.getShipping().getAddress().getComplement()
                    
                if payment.getShipping().getAddress().getCity() != None:
                    data['shippingAddressCity'] = payment.getShipping().getAddress().getCity()
                    
                if payment.getShipping().getAddress().getState() != None:
                    data['shippingAddressState'] = payment.getShipping().getAddress().getState()
                    
                if payment.getShipping().getAddress().getDistrict() != None:
                    data['shippingAddressDistrict'] = payment.getShipping().getAddress().getDistrict()
                    
                if payment.getShipping().getAddress().getPostalCode() != None:
                    data['shippingAddressPostalCode'] = payment.getShipping().getAddress().getPostalCode()
                    
                if payment.getShipping().getAddress().getCountry() != None:
                    data['shippingAddressCountry'] = payment.getShipping().getAddress().getCountry()
        
        if payment.getMaxAge() != None:
            data['maxAge'] = payment.getMaxAge()
            
        if payment.getMaxUses() != None:
            data['maxUses'] = payment.getMaxUses()
        if payment.getRedirectURL() != None:
            data['redirectURL'] = payment.getRedirectURL()
        return data