コード例 #1
0
 public function loadDataInRequest($request)
 {
     $apiActionName = $this->getApiActionName();
     $shortFormatActions = array('get');
     if (in_array($apiActionName, $shortFormatActions)) {
         $request = parent::loadDataInRequest($request, '//', $shortFormatActions);
         $request->set('ID', $request->get($apiActionName));
         $request->remove($apiActionName);
     } else {
         $request = parent::loadDataInRequest($request, self::getXMLPath() . '//', $this->getApiFieldNames());
     }
     return $request;
 }
コード例 #2
0
 public function loadDataInRequest($request)
 {
     $apiActionName = $this->getApiActionName();
     $shortFormatActions = array('get', 'invoice', 'delete', 'capture', 'cancel');
     // like <customer><delete>[customer id]</delete></customer>
     if (in_array($apiActionName, $shortFormatActions)) {
         $request = parent::loadDataInRequest($request, '//', $shortFormatActions);
         $request->set('ID', $request->get($apiActionName));
         $request->remove($apiActionName);
     } else {
         $request = parent::loadDataInRequest($request, self::getXMLPath() . '//', $this->getApiFieldNames());
     }
     return $request;
 }
コード例 #3
0
ファイル: XmlStockApiReader.php プロジェクト: saiber/livecart
 public function loadDataInRequest($request)
 {
     $apiActionName = $this->getApiActionName();
     switch ($apiActionName) {
         case 'get':
             $request = parent::loadDataInRequest($request, '//', array($apiActionName));
             // rename get to SKU
             $request->set('SKU', $request->get($apiActionName));
             $request->remove($apiActionName);
             break;
         case 'set':
             // 'flat' fields
             $request = parent::loadDataInRequest($request, self::getXMLPath() . '/' . $apiActionName . '/', array('sku', 'quantity'));
             break;
     }
     return $request;
 }
コード例 #4
0
 public function loadDataInRequest($request)
 {
     $apiActionName = $this->getApiActionName();
     switch ($apiActionName) {
         case 'get':
             $request = parent::loadDataInRequest($request, '//', array($apiActionName));
             // rename get to SKU
             $request->set('SKU', $request->get($apiActionName));
             $request->remove($apiActionName);
             break;
         case 'replace':
         case 'set':
             // 'flat' fields
             $request = parent::loadDataInRequest($request, self::getXMLPath() . '/' . $apiActionName . '/', array('sku', 'currency', 'definedPrice', 'definedListPrice'));
             // quantity prices
             $quantityPrices = array();
             foreach ($this->xml->xpath('/request/price/' . $apiActionName . '/quantityPrices/quantityPrice') as $quantityPrice) {
                 $quantityPrices[] = array('quantity' => (string) $quantityPrice->quantity, 'price' => (string) $quantityPrice->price, 'group' => (string) $quantityPrice->group, 'currency' => (string) $quantityPrice->currency);
             }
             $request->set('quantityPrices', $quantityPrices);
             break;
     }
     return $request;
 }