Ejemplo n.º 1
0
 /**
  * Tests if a response is valid and prints out
  * a error trace if not
  *
  * @param AbstractResponseType $res
  * @return boolean
  */
 protected function testValid($res)
 {
     if ($res->getAck() == AckCodeType::CodeType_Success) {
         return true;
     } else {
         echo $this->proxy->getErrorsToString($res, true);
         return false;
     }
 }
function get_new_Transactions($session, $to)
{
    $transaction_update_time = olc_db_query(SELECT . "transaction_update_time from " . TABLE_EBAY_CONFIG);
    $update_time = olc_db_fetch_array($transaction_update_time);
    $transaction_update_time = $update_time['transaction_update_time'];
    if ($transaction_update_time == NULL) {
        $event_first_time = olc_db_query(SELECT . "starttime" . SQL_FROM . TABLE_AUCTION_LIST . " ORDER BY starttime ASC");
        $first_time = olc_db_fetch_array($event_first_time);
        $from = $first_time['starttime'];
    } else {
        $from = $transaction_update_time;
    }
    //update time
    $cs = new EbatNs_ServiceProxy($session);
    $req = new GetSellerTransactionsRequestType();
    $req->setModTimeFrom($from);
    $req->setModTimeTo($to);
    $res = $cs->GetSellerTransactions($req);
    $transactions = $res->getTransactionArray();
    if ($res->getAck() == 'Success') {
        for ($i = 0; $i < count($transactions); $i++) {
            $transaction = $transactions[$i];
            $tmp[$transaction->Item->getItemID()][$transaction->getTransactionID()] = array('endtime' => $transaction->getCreatedDate(), 'price' => $transaction->Item->SellingStatus->CurrentPrice->value, 'amount' => $transaction->getQuantityPurchased(), 'buyerid' => $transaction->Buyer->getUserID(), 'buyer_name' => $transaction->Buyer->RegistrationAddress->getName(), 'buyer_email' => $transaction->Buyer->getEmail(), 'buyer_land' => $transaction->Buyer->BuyerInfo->ShippingAddress->getCountryName(), 'buyer_countrycode' => $transaction->Buyer->BuyerInfo->ShippingAddress->getCountry(), 'buyer_state' => $transaction->Buyer->BuyerInfo->ShippingAddress->getStateOrProvince(), 'buyer_zip' => $transaction->Buyer->BuyerInfo->ShippingAddress->getPostalCode(), 'buyer_city' => $transaction->Buyer->BuyerInfo->ShippingAddress->getCityName(), 'buyer_street' => $transaction->Buyer->BuyerInfo->ShippingAddress->getStreet(), 'buyer_phone' => $transaction->Buyer->getPhone());
        }
        $update_time = olc_db_query(SQL_UPDATE . TABLE_EBAY_CONFIG . " SET `transaction_update_time` = '" . $to . APOS . SQL_WHERE . "`id` =1");
    }
    return $tmp;
}
require 'includes/application_top.php';
require_once $ebatns_dir . 'EbatNs_ServiceProxy.php';
require_once $ebatns_dir . 'GetCategoriesRequestType.php';
require_once $ebatns_dir . 'GetCategoriesResponseType.php';
require_once $ebatns_dir . 'CategoryType.php';
//include functions for save and browse category in db
require_once DIR_WS_FUNCTIONS . 'auction_CategorySQL.php';
$main_content = '<div id="main_content">
<h3>' . HTML_NBSP . AUCTIONS_TEXT_SUB_HEADER_CATEGORIES . '</h3>
';
//look if there is a category id in database
$catid = $_GET['catid'];
if (!isset($catid)) {
    $session = create_ebay_session();
    if ($session) {
        $cs = new EbatNs_ServiceProxy($session);
        $req = new GetCategoriesRequestType();
        //categories form ebay.de
        $req->CategorySiteID = 77;
        $req->LevelLimit = 1;
        $req->DetailLevel = 'ReturnHeaders';
        if (isset($_POST['updatecat'])) {
            set_time_limit(0);
            //if button update is pressed
            //truncate old categories
            olc_db_query("TRUNCATE TABLE " . TABLE_EBAY_CATEGORIES);
            //return all categories
            $req->DetailLevel = 'ReturnAll';
            $req->LevelLimit = 1;
            $req->setCategoryParent(0);
            $res = $cs->GetCategories($req);
Ejemplo n.º 4
0
 //send auction to ebay
 if ($addItem) {
     require_once $ebatns_dir . 'EbatNs_ServiceProxy.php';
     require_once $ebatns_dir . 'EbatNs_Logger.php';
     require_once $ebatns_dir . 'VerifyAddItemRequestType.php';
     require_once $ebatns_dir . 'AddItemRequestType.php';
     require_once $ebatns_dir . 'ItemType.php';
     require_once $ebatns_dir . 'ListingEnhancementsCodeType.php';
     require_once $ebatns_dir . 'BuyerPaymentMethodCodeType.php';
     require_once $ebatns_dir . 'CountryCodeType.php';
     $session = create_ebay_session();
     if ($session) {
         $ListingEnhancementsCodeType = new BuyerPaymentMethodCodeType();
         $PaymentMethodCode = new BuyerPaymentMethodCodeType();
         $CountryCodeType = new CountryCodeType();
         $cs = new EbatNs_ServiceProxy($session);
         $item = new ItemType();
         //auction type
         $item->setListingType($auction_type_name);
         $item->Currency = DEFAULT_CURRENCY;
         //currency
         $item->Site = 'Germany';
         //site (ebay.de)
         //use sheduling if there is one
         if (isset($future_auction)) {
             $item->setScheduleTime($mynewstarttime);
         }
         //set title
         $product_title = stripcslashes($product_title);
         $product_title = striptags($product_title);
         $item->Title = $product_title;
<?php

/*auctions_getItem.php*/
require 'includes/application_top.php';
// include needed functions
require_once $ebatns_dir . 'EbatNs_ServiceProxy.php';
require_once $ebatns_dir . 'EbatNs_Logger.php';
require_once $ebatns_dir . 'GetItemRequestType.php';
require_once $ebatns_dir . 'ItemType.php';
$session = create_ebay_session();
if ($session) {
    $cs = new EbatNs_ServiceProxy($session);
    $cs->setHandler('ItemType', 'handleItem');
    $logger = new EbatNs_Logger(true);
    // $logger->_debugXmlBeautify = true;
    // $logger->_debugSecureLogging = false;
    $cs->attachLogger($logger);
    $req = new GetItemRequestType();
    $req->setItemID($_GET['itemId']);
    $req->setDetailLevel($Facet_DetailLevelCodeType->ReturnAll);
    $res = $cs->GetItem($req);
    echo "<pre>";
    if ($res->getAck() != $Facet_AckCodeType->Success) {
        echo "we got a failure<br/>";
        foreach ($res->getErrors() as $error) {
            echo "#" . $error->getErrorCode() . " " . htmlentities($error->getShortMessage()) . "/" . htmlentities($error->getLongMessage()) . HTML_BR;
        }
    } else {
        //#type $item ItemType
        $item = $res->getItem();
        echo "ShippingTerms : " . $item->getShippingTerms() . HTML_BR;
Ejemplo n.º 6
0
 public function initEbay($site_id, $sandbox_enabled, $token = false, $account_id = false)
 {
     // init autoloader fro EbatNs classes
     $this->loadEbayClasses();
     WPLE()->logger->info("initEbay( {$account_id} )");
     // require_once 'EbatNs_ServiceProxy.php';
     // require_once 'EbatNs_Logger.php';
     // hide inevitable cURL warnings from SDK
     // *** DISABLE FOR DEBUGGING ***
     $this->error_reporting_level = error_reporting();
     WPLE()->logger->debug('original error reporting level: ' . $this->error_reporting_level);
     // // regard php_error_handling option
     // // first bit (1) will show all php errors if set
     // if ( 1 & get_option( 'wplister_php_error_handling', 0 ) ) {
     //     error_reporting( E_ALL | E_STRICT );
     // } else {
     //     // only show fatal errors (default)
     //     error_reporting( E_ERROR );
     // }
     error_reporting(E_ERROR);
     WPLE()->logger->debug('new error reporting level: ' . error_reporting());
     $this->siteId = $site_id;
     $this->sandbox = $sandbox_enabled;
     #$this->compLevel = 765;
     if ($sandbox_enabled) {
         // sandbox keys
         $this->devId = 'db0c17b6-c357-4a38-aa60-7e80158f57dc';
         $this->appId = 'LWSWerbu-c159-4552-8411-1406ca5a2bba';
         $this->certId = '33272b6e-ef02-4d22-a487-a1a3f02b9c66';
         $this->RuName = 'LWS_Werbung_Gmb-LWSWerbu-c159-4-tchfyrowj';
         $this->apiurl = 'https://api.sandbox.ebay.com/ws/api.dll';
         $this->signin = 'https://signin.sandbox.ebay.com/ws/eBayISAPI.dll?SignIn&';
     } else {
         // production keys
         $this->devId = 'db0c17b6-c357-4a38-aa60-7e80158f57dc';
         $this->appId = 'LWSWerbu-6147-43ed-9835-853f7b5dc6cb';
         $this->certId = '61212d27-f74b-416b-8d48-3160f245443f';
         $this->RuName = 'LWS_Werbung_Gmb-LWSWerbu-6147-4-ywstl';
         $this->apiurl = 'https://api.ebay.com/ws/api.dll';
         $this->signin = 'https://signin.ebay.com/ws/eBayISAPI.dll?SignIn&';
     }
     // filter RuName
     if (defined('WPLISTER_RESELLER_VERSION')) {
         $this->RuName = apply_filters('wplister_runame', $this->RuName, $sandbox_enabled);
     }
     // init session
     $session = new EbatNs_Session();
     // depends on the site working on (needs ID-Value !)
     $session->setSiteId($site_id);
     $session->wple_account_id = $account_id;
     // regard WP proxy server
     if (defined('WP_USEPROXY') && WP_USEPROXY) {
         if (defined('WP_PROXY_HOST') && defined('WP_PROXY_PORT')) {
             $session->setProxyServer(WP_PROXY_HOST . ':' . WP_PROXY_PORT);
         }
     }
     // environment (0=production, 1=sandbox)
     if ($sandbox_enabled == '1') {
         WPLE()->logger->info('initEbay(): SANDBOX ENABLED');
         $session->setAppMode(1);
         // this must be set *before* setting the keys (appId, devId, ...)
     } else {
         $session->setAppMode(0);
     }
     $session->setAppId($this->appId);
     $session->setDevId($this->devId);
     $session->setCertId($this->certId);
     if ($token) {
         // use a token as credential
         $session->setTokenMode(true);
         // do NOT use a token file !
         $session->setTokenUsePickupFile(false);
         // token of the user
         $session->setRequestToken($token);
     } else {
         $session->setTokenMode(false);
     }
     // creating a proxy for UTF8
     $sp = new EbatNs_ServiceProxy($session, 'EbatNs_DataConverterUtf8');
     // // logger doc: http://www.intradesys.com/de/forum/1528
     // if ( get_option('wplister_log_level') > 5 ) {
     //     #$sp->attachLogger( new EbatNs_Logger(false, 'stdout', true, false) );
     //     $sp->attachLogger( new EbatNs_Logger(false, WPLE()->logger->file ) );
     // }
     // attach custom DB Logger for Tools page
     // if ( get_option('wplister_log_to_db') == '1' ) {
     if (isset($_REQUEST['page']) && $_REQUEST['page'] == 'wplister-tools') {
         $sp->attachLogger(new WPL_EbatNs_Logger(false, 'db', $account_id, $site_id));
     }
     // save service proxy - and session
     $this->sp = $sp;
     $this->session = $session;
 }