function updateTransactions($session, $days = null, $current_page = 1)
 {
     WPLE()->logger->info('*** updateTransactions(' . $days . ') - page ' . $current_page);
     $this->initServiceProxy($session);
     // set request handler
     $this->_cs->setHandler('TransactionType', array(&$this, 'handleTransactionType'));
     // $this->_cs->setHandler( 'PaginationResultType', array( & $this, 'handlePaginationResultType' ) );
     // build request
     $req = new GetSellerTransactionsRequestType();
     $req->setIncludeContainingOrder(true);
     // check if we need to calculate lastdate
     if ($this->current_lastdate) {
         $lastdate = $this->current_lastdate;
         WPLE()->logger->info('used current_lastdate from last run: ' . $lastdate);
     } else {
         // period 30 days, which is the maximum allowed
         $now = time();
         $lastdate = $this->getDateOfLastTransaction();
         WPLE()->logger->info('getDateOfLastTransaction() returned: ' . $lastdate);
         if ($lastdate) {
             $lastdate = mysql2date('U', $lastdate);
         }
         // if last date is older than 30 days, fall back to default
         if ($lastdate < $now - 3600 * 24 * 30) {
             WPLE()->logger->info('resetting lastdate - fall back default ');
             $lastdate = false;
         }
     }
     // save lastdate for next page
     $this->current_lastdate = $lastdate;
     // parameter $days has priority
     if ($days) {
         $req->NumberOfDays = $days;
         $this->NumberOfDays = $days;
         WPLE()->logger->info('NumberOfDays: ' . $req->NumberOfDays);
         // default: transactions since last change
     } elseif ($lastdate) {
         $req->ModTimeFrom = gmdate('Y-m-d H:i:s', $lastdate);
         $req->ModTimeTo = gmdate('Y-m-d H:i:s', time());
         $this->ModTimeFrom = $req->ModTimeFrom;
         $this->ModTimeTo = $req->ModTimeTo;
         WPLE()->logger->info('lastdate: ' . $lastdate);
         WPLE()->logger->info('ModTimeFrom: ' . $req->ModTimeFrom);
         WPLE()->logger->info('ModTimeTo: ' . $req->ModTimeTo);
         // fallback: last 7 days (max allowed by ebay: 30 days)
     } else {
         $days = 7;
         $req->NumberOfDays = $days;
         $this->NumberOfDays = $days;
         WPLE()->logger->info('NumberOfDays (fallback): ' . $req->NumberOfDays);
     }
     // $req->DetailLevel = $Facet_DetailLevelCodeType->ReturnAll;
     if (!$this->is_ajax()) {
         $req->setDetailLevel('ReturnAll');
     }
     // set pagination for first page
     $items_per_page = 100;
     // should be set to 200 for production
     $this->current_page = $current_page;
     $Pagination = new PaginationType();
     $Pagination->setEntriesPerPage($items_per_page);
     $Pagination->setPageNumber($this->current_page);
     $req->setPagination($Pagination);
     // get transactions (single page)
     WPLE()->logger->info('fetching transactions - page ' . $this->current_page);
     $res = $this->_cs->GetSellerTransactions($req);
     $this->total_pages = $res->PaginationResult->TotalNumberOfPages;
     $this->total_items = $res->PaginationResult->TotalNumberOfEntries;
     // get transaction with pagination helper (doesn't work as expected)
     // EbatNs_PaginationHelper($proxy, $callName, $request, $responseElementToMerge = '__COUNT_BY_HANDLER', $maxEntries = 200, $pageSize = 200, $initialPage = 1)
     // $helper = new EbatNs_PaginationHelper( $this->_cs, 'GetSellerTransactions', $req, 'TransactionArray', 20, 10, 1);
     // $res = $helper->QueryAll();
     // handle response and check if successful
     if ($this->handleResponse($res)) {
         WPLE()->logger->info("*** Transactions updated successfully.");
         // WPLE()->logger->info( "*** PaginationResult:".print_r($res->PaginationResult,1) );
         // WPLE()->logger->info( "*** processed response:".print_r($res,1) );
         WPLE()->logger->info("*** current_page: " . $this->current_page);
         WPLE()->logger->info("*** total_pages: " . $this->total_pages);
         WPLE()->logger->info("*** total_items: " . $this->total_items);
         // fetch next page recursively - only in days mode
         if ($res->HasMoreTransactions) {
             $this->current_page++;
             $this->updateTransactions($session, $days, $this->current_page);
         }
     } else {
         WPLE()->logger->error("Error on transactions update" . print_r($res, 1));
     }
 }