Ejemplo n.º 1
0
 /**
  *
  */
 public function actionPreSync()
 {
     if (Yii::$app->request->isAjax) {
         Yii::$app->response->format = Response::FORMAT_JSON;
         $post = Yii::$app->request->post();
         $ebayListing = new EbayListing($post['ebayID']);
         $preListingInfo = $ebayListing->getPreListingInfo();
         if (!isset($preListingInfo['Error'])) {
             $result['status'] = 'success';
             $result['message'] = 'Connection Success';
             $result['data'] = $preListingInfo['data'];
             $result['totalPages'] = $preListingInfo['totalPages'];
         } else {
             $result['status'] = 'error';
             $result['message'] = 'Follow errors:' . "<br>";
             foreach ($preListingInfo['Error'] as $error) {
                 $result['message'] .= $error . "<br>";
             }
         }
         return $result;
         //$result['status']='error';
     } else {
         //echo Json::encode("NOT AJAX!Denied");
         return false;
     }
 }
Ejemplo n.º 2
0
 public function actionItemPic()
 {
     if (Yii::$app->request->isAjax) {
         Yii::$app->response->format = Response::FORMAT_JSON;
         $post = Yii::$app->request->post();
         $ebayListing = new EbayListing($post['ebayID']);
         $itemPicUrl = $ebayListing->getItemPicUrl($post['itemID']);
         $transaction = $this->findTransaction($post['transactionID']);
         $transaction->image = $itemPicUrl;
         if ($transaction->save()) {
             return $itemPicUrl;
         }
     }
 }
Ejemplo n.º 3
0
 public function actionSyncListing($id)
 {
     $request = Yii::$app->request;
     if ($request->isAjax) {
         $ebayListing = new EbayListing($id);
         $syncResult = $ebayListing->syncListings(true);
         echo Json::encode($syncResult);
     } else {
         echo Json::encode("NOT AJAX!Denied");
     }
 }