Development

Changeset 4725

You must first sign up to be able to contribute.

Changeset 4725

Show
Ignore:
Timestamp:
07/26/07 23:40:12 (1 year ago)
Author:
Jonathan.Wage
Message:

sfAmazonECSPlugin: Rewrote class to use SoapClient? instead of rest and curl.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/sfAmazonECSPlugin/README

    r4715 r4725  
    88 
    99{{{ 
    10 includeRequestInResponse 
    11 browseNodeLookup 
    12 cartAdd 
    13 cartAddByAsin 
    14 cartAddByAsinListItemId 
    15 cartClear 
    16 cartCreate 
    17 cartCreateByAsin 
    18 cartCreateByAsinListItemId 
    19 cartGet 
    20 cartModify 
    21 cartRemove 
    22 customerContentLookup 
    23 customerContentSearch 
    24 help 
    25 itemLookup 
    26 itemSearch 
    27 listLookup 
    28 listSearch 
    29 sellerListingLookup 
    30 sellerListingSearch 
    31 sellerLookup 
    32 similarityLookup 
    33 tagLookup 
    34 transactionLookup 
     10BrowseNodeLookup 
     11CartAdd 
     12CartAddByAsin 
     13CartAddByAsinListItemId 
     14CartClear 
     15CartCreate 
     16CartCreateByAsin 
     17CartCreateByAsinListItemId 
     18CartGet 
     19CartModify 
     20CartRemove 
     21CustomerContentLookup 
     22CustomerContentSearch 
     23Help 
     24ItemLookup 
     25ItemSearch 
     26ListLookup 
     27ListSearch 
     28SellerListingLookup 
     29SellerListingSearch 
     30SellerLookup 
     31SimilarityLookup 
     32TagLookup 
     33TransactionLookup 
    3534}}} 
  • plugins/sfAmazonECSPlugin/lib/BasesfAmazonECS.class.php

    r4715 r4725  
    1818class BasesfAmazonECS 
    1919{ 
    20   protected $ecsUrl                   = null, 
     20  protected $wsdl                     = 'http://webservices.amazon.com/AWSECommerceService/AWSECommerceService.wsdl', 
     21            $service                  = 'AWSECommerceService', 
     22            $soapClient               = null, 
    2123            $awsAccessKeyId           = null, 
    2224            $associateTag             = null, 
    23             $apiVersion               = '2006-07-16', 
    24             $contentType              = 'text/xml', 
    25             $merchantId               = null, 
    26             $includeRequestInResponse = true; 
    27    
     25            $merchantId               = null; 
     26 
    2827  /** 
    2928   * Constructor 
     
    3736   * @author  Jonathan H. Wage 
    3837   **/ 
    39   function __construct($awsAccessKeyId, $associateTag = null, $merchantId = null) 
    40   { 
    41     $this->ecsUrl  = 'http://ecs.amazonaws.com/onca/xml?Service=AWSECommerceService'; 
     38  public function __construct($awsAccessKeyId, $associateTag = null, $merchantId = null) 
     39  { 
     40    $this->soapClient = new SoapClient($this->wsdl); 
     41     
    4242    $this->awsAccessKeyId = $awsAccessKeyId; 
    4343    $this->associateTag = $associateTag; 
     
    4646   
    4747  /** 
    48    * Build Request Args as String 
    49    * 
    50    * Builds an array of key => value pairs in to a string to be appended to a request url 
    51    * 
    52    * @param   array $args 
    53    * @return  string $string 
    54    * @author  Jonathan H. Wage 
    55    **/ 
    56   static protected function buildRequestArgsString($args) 
    57   { 
    58     $string = ''; 
    59     foreach($args AS $key => $value) 
    60     { 
    61       $string .= '&'.$key.'='.$value; 
    62     } 
    63      
    64     return $string; 
    65   } 
    66    
    67   /** 
    68    * Do Operation 
    69    * 
    70    * Performs the specified operation on the ECS api and returns the resulting parsed xml 
    71    * 
    72    * @param   string $operation Name of the operation to perform 
    73    * @param   array $params Array of parameters for the operation 
    74    * @return  object $xml 
    75    * @author  Jonathan H. Wage 
    76    **/ 
    77   protected function doOperation($operation, $params) 
    78   { 
    79     $params['Operation'] = $operation; 
    80     $params['AWSAccessKeyId'] = $this->awsAccessKeyId; 
    81      
    82     if( $this->associateTag ) 
    83     { 
    84       $params['AssociateTag'] = $this->associateTag; 
    85     } 
    86      
    87     if( $this->merchantId ) 
    88     { 
    89       $params['MerchantId'] = $this->merchantId; 
    90     } 
    91      
    92     if( $this->includeRequestInResponse ) 
    93     { 
    94       $params['ResponseGroup'] = 'Request,'.$params['ResponseGroup']; 
    95     } 
    96      
    97     $request  = $this->ecsUrl; 
    98     $request .= self::buildRequestArgsString($params); 
    99      
    100     $session = curl_init($request); 
    101     curl_setopt($session, CURLOPT_HEADER, false); 
    102     curl_setopt($session, CURLOPT_RETURNTRANSFER, true); 
    103     $response = curl_exec($session); 
    104     curl_close($session);  
    105      
    106     return simplexml_load_string($response); 
    107   } 
    108    
    109   /** 
    110    * Include Request In Response Group 
    111    * 
    112    * Allows you to globally include the Request ResponseGroup in all ECS operations 
    113    * 
    114    * @param   bool $bool True or false for whether or not you want to include the Request in the ResponseGroup. Default is true 
    115    * @return  void 
    116    * @author  Jonathan H. Wage 
    117    **/ 
    118   public function includeRequestInResponse($bool) 
    119   { 
    120     $this->includeRequestInResponse = $bool; 
    121   } 
    122    
    123   /** 
    12448   * Browse Node Lookup 
    12549   * 
    126    * @param   int $browseNodeId 
    127    * @param   string $responseGroup Comma seperated list of ResponseGroups to include in the response 
    128    * @param   array $params Array of additional parameters to be sent to ECS 
    129    * @return  object $xml 
    130    * @author  Jonathan H. Wage 
    131    **/ 
    132   public function browseNodeLookup($browseNodeId, $responseGroup = 'BrowseNodeInfo', $params = array()) 
    133   { 
    134     $params['BrowseNodeId'] = $browseNodeId; 
    135     $params['ResponseGroup'] = $responseGroup; 
    136      
    137     return $this->doOperation('BrowseNodeLookup', $params); 
     50   * @param   int $BrowseNodeId 
     51   * @param   string $ResponseGroup Comma seperated list of ResponseGroups to include in the response 
     52   * @param   array $params Array of additional parameters to be sent to ECS 
     53   * @return  object $xml 
     54   * @author  Jonathan H. Wage 
     55   **/ 
     56  public function BrowseNodeLookup($BrowseNodeId, $ResponseGroup = null, $params = array()) 
     57  { 
     58    return $this->doOperation(__FUNCTION__, get_defined_vars(), $params); 
    13859  } 
    13960   
     
    14162   * Cart Add 
    14263   * 
    143    * @param   int $cartId Id of the cart you wish to add to 
    144    * @param   string $hmac Hash Message Authentication Code returned by CartCreate that identifies a cart 
    145    * @param   string $offerListingId An offer listing ID is a token that uniquely identifies an item that is sold by any merchant, including Amazon. 
    146    * @param   int $quantity Number to add to cart 
    147    * @param   string $responseGroup Comma seperated list of ResponseGroups to include in the response 
    148    * @param   array $params Array of additional parameters to be sent to ECS 
    149    * @return  object $xml 
    150    * @author  Jonathan H. Wage 
    151    **/ 
    152   public function cartAdd($cartId, $hmac, $offerListingId, $quantity = 1, $responseGroup = 'Cart', $params = array()) 
    153   { 
    154     $params['CartId'] = $cartId; 
    155     $params['HMAC'] = urlencode($hmac); 
    156     $params['Item.1.OfferListingId'] = $offerListingId; 
    157     $params['Item.1.Quantity'] = $quantity; 
    158     $params['ResponseGroup'] = $responseGroup; 
    159      
    160     return $this->doOperation('CartAdd', $params); 
     64   * @param   int $CartId Id of the cart you wish to add to 
     65   * @param   string $HMAC Hash Message Authentication Code returned by CartCreate that identifies a cart 
     66   * @param   string $OfferListingId An offer listing ID is a token that uniquely identifies an item that is sold by any merchant, including Amazon. 
     67   * @param   int $Quantity Number to add to cart 
     68   * @param   string $ResponseGroup Comma seperated list of ResponseGroups to include in the response 
     69   * @param   array $params Array of additional parameters to be sent to ECS 
     70   * @return  object $xml 
     71   * @author  Jonathan H. Wage 
     72   **/ 
     73  public function cartAdd($CartId, $HMAC, $OfferListingId, $Quantity = 1, $ResponseGroup = null, $params = array()) 
     74  { 
     75    return $this->doOperation(__FUNCTION__, get_defined_vars(), $params); 
    16176  } 
    16277   
     
    16479   * Cart Add by ASIN 
    16580   * 
    166    * @param   int $cartId Id of the cart you wish to add to 
    167    * @param   string $hmac Hash Message Authentication Code returned by CartCreate that identifies a cart 
    168    * @param   string $asin Amazon Standard Identification Number 
    169    * @param   int $quantity Number to add to cart 
    170    * @param   string $responseGroup Comma seperated list of ResponseGroups to include in the response 
    171    * @param   array $params Array of additional parameters to be sent to ECS 
    172    * @return  object $xml 
    173    * @author  Jonathan H. Wage 
    174    **/ 
    175   public function cartAddByAsin($cartId, $hmac, $asin, $quantity = 1, $responseGroup = 'Cart', $params = array()) 
    176   { 
    177     $params['CartId'] = $cartId; 
    178     $params['HMAC'] = urlencode($hmac); 
    179     $params['Item.1.ASIN'] = $asin; 
    180     $params['Item.1.Quantity'] = $quantity; 
    181     $params['ResponseGroup'] = $responseGroup; 
    182      
    183     return $this->doOperation('CartAdd', $params); 
     81   * @param   int $CartId Id of the cart you wish to add to 
     82   * @param   string $HMAC Hash Message Authentication Code returned by CartCreate that identifies a cart 
     83   * @param   string $ASIN Amazon Standard Identification Number 
     84   * @param   int $Quantity Number to add to cart 
     85   * @param   string $ResponseGroup Comma seperated list of ResponseGroups to include in the response 
     86   * @param   array $params Array of additional parameters to be sent to ECS 
     87   * @return  object $xml 
     88   * @author  Jonathan H. Wage 
     89   **/ 
     90  public function CartAddByAsin($CartId, $HMAC, $ASIN, $Quantity = 1, $ResponseGroup = null, $params = array()) 
     91  { 
     92    return $this->doOperation('CartAdd', get_defined_vars(), $params); 
    18493  } 
    18594   
     
    197106   * @author  Jonathan H. Wage 
    198107   **/ 
    199   public function cartAddByAsinListItemId($cartId, $hmac, $asin, $listItemId, $quantity = 1, $responseGroup = 'Cart', $params = array()) 
    200   { 
    201     $params['CartId'] = $cartId; 
    202     $params['HMAC'] = urlencode($hmac); 
    203     $params['Item.1.ASIN'] = $asin; 
    204     $params['Item.1.ListItemId'] = $listItemId; 
    205     $params['Item.1.Quantity'] = $quantity; 
    206     $params['ResponseGroup'] = $responseGroup; 
    207      
    208     return $this->doOperation('CartAdd', $params); 
     108  public function CartAddByAsinListItemId($CartId, $HMAC, $ASIN, $ListItemId, $Quantity = 1, $ResponseGroup = null, $params = array()) 
     109  { 
     110    return $this->doOperation('CartAdd', get_defined_vars(), $params); 
    209111  } 
    210112   
     
    212114   * Cart Clear 
    213115   * 
    214    * @param   int $cartId Id of the cart you wish to clear 
    215    * @param   string $hmac Hash Message Authentication Code returned by CartCreate that identifies a cart 
    216    * @param   string $responseGroup Comma seperated list of ResponseGroups to include in the response 
    217    * @param   array $params Array of additional parameters to be sent to ECS 
    218    * @return  object $xml 
    219    * @author  Jonathan H. Wage 
    220    **/ 
    221   public function cartClear($cartId, $hmac, $responseGroup = 'Cart', $params = array()) 
    222   { 
    223     $params['CartId'] = $cartId; 
    224     $params['HMAC'] = urlencode($hmac); 
    225     $params['ResponseGroup'] = $responseGroup; 
    226      
    227     return $this->doOperation('CartClear', $params); 
     116   * @param   int $CartId Id of the cart you wish to clear 
     117   * @param   string $HMAC Hash Message Authentication Code returned by CartCreate that identifies a cart 
     118   * @param   string $ResponseGroup Comma seperated list of ResponseGroups to include in the response 
     119   * @param   array $params Array of additional parameters to be sent to ECS 
     120   * @return  object $xml 
     121   * @author  Jonathan H. Wage 
     122   **/ 
     123  public function CartClear($CartId, $HMAC, $ResponseGroup = null, $params = array()) 
     124  { 
     125    return $this->doOperation(__FUNCTION__, get_defined_vars(), $params); 
    228126  } 
    229127   
     
    231129   * Cart Create 
    232130   * 
    233    * @param   string $offerListingId An offer listing ID is a token that uniquely identifies an item that is sold by any merchant, including Amazon. 
    234    * @param   int $quantity Number to add to cart 
    235    * @param   string $responseGroup Comma seperated list of ResponseGroups to include in the response 
    236    * @param   array $params Array of additional parameters to be sent to ECS 
    237    * @return  object $xml 
    238    * @author  Jonathan H. Wage 
    239    **/ 
    240   public function cartCreate($offerListingId, $quantity = 1, $responseGroup = 'Cart', $params = array()) 
    241   { 
    242     $params['Item.1.OfferListingId'] = $offerListingId; 
    243     $params['Item.1.Quantity'] = $quantity; 
    244     $params['ResponseGroup'] = $responseGroup; 
    245      
    246     return $this->doOperation('CartCreate', $params); 
     131   * @param   string $OfferListingId An offer listing ID is a token that uniquely identifies an item that is sold by any merchant, including Amazon. 
     132   * @param   int $Quantity Number to add to cart 
     133   * @param   string $ResponseGroup Comma seperated list of ResponseGroups to include in the response 
     134   * @param   array $params Array of additional parameters to be sent to ECS 
     135   * @return  object $xml 
     136   * @author  Jonathan H. Wage 
     137   **/ 
     138  public function CartCreate($OfferListingId, $Quantity = 1, $ResponseGroup = null, $params = array()) 
     139  { 
     140    return $this->doOperation('CartCreate', get_defined_vars(), $params); 
    247141  } 
    248142   
     
    250144   * Cart Create by ASIN 
    251145   * 
    252    * @param   string $asin Amazon Standard Identification Number 
    253    * @param   int $quantity Number to add to cart 
    254    * @param   string $responseGroup Comma seperated list of ResponseGroups to include in the response 
    255    * @param   array $params Array of additional parameters to be sent to ECS 
    256    * @return  object $xml 
    257    * @author  Jonathan H. Wage 
    258    **/ 
    259   public function cartCreateByAsin($asin, $quantity = 1, $responseGroup = 'Cart', $params = array()) 
    260   { 
    261     $params['Item.1.ASIN'] = $offerListingId; 
    262     $params['Item.1.Quantity'] = $quantity; 
    263     $params['ResponseGroup'] = $responseGroup; 
    264      
    265     return $this->doOperation('CartCreate', $params); 
     146   * @param   string $ASIN Amazon Standard Identification Number 
     147   * @param   int $Quantity Number to add to cart 
     148   * @param   string $ResponseGroup Comma seperated list of ResponseGroups to include in the response 
     149   * @param   array $params Array of additional parameters to be sent to ECS 
     150   * @return  object $xml 
     151   * @author  Jonathan H. Wage 
     152   **/ 
     153  public function CartCreateByAsin($ASIN, $Quantity = 1, $ResponseGroup = null, $params = array()) 
     154  { 
     155    return $this->doOperation('CartCreate', get_defined_vars(), $params); 
    266156  } 
    267157   
     
    269159   * Cart Create by ASIN & List Item Id 
    270160   * 
    271    * @param   string $asin Amazon Standard Identification Number 
    272    * @param   string $listItemId The ListItemId value is returned by the ListItems response group. 
    273    * @param   int $quantity Number to add to cart 
    274    * @param   string $responseGroup Comma seperated list of ResponseGroups to include in the response 
    275    * @param   array $params Array of additional parameters to be sent to ECS 
    276    * @return  object $xml 
    277    * @author  Jonathan H. Wage 
    278    **/ 
    279   public function cartCreateByAsinListItemId($asin, $listItemId, $quantity = 1, $responseGroup = 'Cart', $params = array()) 
    280   { 
    281     $params['Item.1.ASIN'] = $asin; 
    282     $params['Item.1.ListItemId'] = $listItemId; 
    283     $params['Item.1.Quantity'] = $quantity; 
    284     $params['ResponseGroup'] = $responseGroup; 
    285      
    286     return $this->doOperation('CartCreate', $params); 
     161   * @param   string $ASIN Amazon Standard Identification Number 
     162   * @param   string $ListItemId The ListItemId value is returned by the ListItems response group. 
     163   * @param   int $Quantity Number to add to cart 
     164   * @param   string $ResponseGroup Comma seperated list of ResponseGroups to include in the response 
     165   * @param   array $params Array of additional parameters to be sent to ECS 
     166   * @return  object $xml 
     167   * @author  Jonathan H. Wage 
     168   **/ 
     169  public function CartCreateByAsinListItemId($ASIN, $ListItemId, $Quantity = 1, $ResponseGroup = null, $params = array()) 
     170  { 
     171    return $this->doOperation('CartCreate', get_defined_vars(), $params); 
    287172  } 
    288173   
    289174  /** 
    290175   * Cart Get 
     176   * 
     177   * @param   int $CartId Id of the cart you wish to get 
     178   * @param   int $CartItemId Number of the item in the cart 
     179   * @param   string $HMAC Hash Message Authentication Code returned by CartCreate that identifies a cart 
     180   * @param   string $ResponseGroup Comma seperated list of ResponseGroups to include in the response 
     181   * @param   array $params Array of additional parameters to be sent to ECS 
     182   * @return  object $xml 
     183   * @author  Jonathan H. Wage 
     184   **/ 
     185  public function CartGet($CartId, $CartItemId, $HMAC, $ResponseGroup = null, $params = array()) 
     186  { 
     187    return $this->doOperation(__FUNCTION__, get_defined_vars(), $params); 
     188  } 
     189   
     190  /** 
     191   * Cart Modify 
     192   * 
     193   * @param   int $CartId Id of the cart you wish to get 
     194   * @param   int $CartItemId Number of the item in the cart 
     195   * @param   string $HMAC Hash Message Authentication Code returned by CartCreate that identifies a cart 
     196   * @param   int $Quantity Number to modify cart with 
     197   * @param   string $ResponseGroup Comma seperated list of ResponseGroups to include in the response 
     198   * @param   array $params Array of additional parameters to be sent to ECS 
     199   * @return  object $xml 
     200   * @author  Jonathan H. Wage 
     201   **/ 
     202  public function CartModify($CartId, $CartItemId, $HMAC, $Quantity = 1, $ResponseGroup = null, $params = array()) 
     203  { 
     204    return $this->doOperation(__FUNCTION__, get_defined_vars(), $params); 
     205  } 
     206   
     207  /** 
     208   * Cart Remove 
    291209   * 
    292210   * @param   int $cartId Id of the cart you wish to get 
     
    298216   * @author  Jonathan H. Wage 
    299217   **/ 
    300   public function cartGet($cartId, $cartItemId, $hmac, $responseGroup = 'Cart', $params = array()) 
    301   { 
    302     $params['CartId'] = $cartId; 
    303     $params['CartItemId'] = $cartItemId; 
    304     $params['HMAC'] = urlencode($hmac); 
    305     $params['ResponseGroup'] = $responseGroup; 
     218  public function CartRemove($cartId, $cartItemId, $hmac, $responseGroup = null, $params = array()) 
     219  { 
     220    return $this->cartModify($cartId, $cartItemId, $hmac, 0, $responseGroup, $params); 
     221  } 
     222   
     223  /** 
     224   * Customer Content Lookup 
     225   * 
     226   * @param   int $CustomerId Id of the customer you wish to lookup 
     227   * @param   string $ResponseGroup Comma seperated list of ResponseGroups to include in the response 
     228   * @param   array $params Array of additional parameters to be sent to ECS 
     229   * @return  object $xml 
     230   * @author  Jonathan H. Wage 
     231   **/ 
     232  public function CustomerContentLookup($CustomerId, $ResponseGroup = null, $params = array()) 
     233  { 
     234    return $this->doOperation(__FUNCTION__, get_defined_vars(), $params); 
     235  } 
     236   
     237  /** 
     238   * Customer Content Search 
     239   * 
     240   * @param   int $CustomerPage A positive integer that specifies the page of customer IDs to return 
     241   * @param   string $Email E-mail address of the customer you wish to lookup 
     242   * @param   string $Name Name of the customer you wish to lookup 
     243   * @param   int $CustomerPage Page number of results to get. Default is 1 
     244   * @param   string $ResponseGroup Comma seperated list of ResponseGroups to include in the response 
     245   * @param   array $params Array of additional parameters to be sent to ECS 
     246   * @return  object $xml 
     247   * @author  Jonathan H. Wage 
     248   **/ 
     249  public function CustomerContentSearch($CustomerPage, $Email = null, $Name = null, $CustomerPage = 1, $ResponseGroup = null, $params = array()) 
     250  { 
     251    return $this->doOperation(__FUNCTION__, get_defined_vars(), $params); 
     252  } 
     253   
     254  /** 
     255   * Help 
     256   * 
     257   * @param   string $About Specifies the operation or response group about which you want more information. 
     258   * @param   string $HelpType Specifies whether the help topic is an operation or response group. HelpType and About values must both be operations or response groups, not a mixture of the two.  
     259   * @param   string $ResponseGroup Comma seperated list of ResponseGroups to include in the response 
     260   * @param   array $params Array of additional parameters to be sent to ECS 
     261   * @return  object $xml 
     262   * @author  Jonathan H. Wage 
     263   **/ 
     264  public function Help($About = null, $HelpType = null, $ResponseGroup = null, $params = array()) 
     265  { 
     266    return $this->doOperation(__FUNCTION__, get_defined_vars(), $params); 
     267  } 
     268   
     269  /** 
     270   * Item Lookup 
     271   * 
     272   * @param   int $ItemId A positive integer that unique identifies an item.  
     273   * @param   string $SearchIndex The product category to search. 
     274   * @param   string $ResponseGroup Comma seperated list of ResponseGroups to include in the response 
     275   * @param   array $params Array of additional parameters to be sent to ECS 
     276   * @return  object $xml 
     277   * @author  Jonathan H. Wage 
     278   **/ 
     279  public function ItemLookup($ItemId, $SearchIndex = null, $ResponseGroup = null, $params = array()) 
     280  { 
     281    return $this->doOperation(__FUNCTION__, get_defined_vars(), $params); 
     282  } 
     283   
     284  /** 
     285   * Item Search 
     286   * 
     287   * @param   string $Keywords Keywords to search for 
     288   * @param   string $SearchIndex The product category to search. 
     289   * @param   string $ItemPage Page number of items to return. Default is 1 
     290   * @param   string $ResponseGroup Comma seperated list of ResponseGroups to include in the response 
     291   * @param   array $params Array of additional parameters to be sent to ECS 
     292   * @return  object $xml 
     293   * @author  Jonathan H. Wage 
     294   **/ 
     295  public function ItemSearch($Keywords, $SearchIndex, $ItemPage = 1, $ResponseGroup = null, $params = array()) 
     296  {  
     297    return $this->doOperation(__FUNCTION__, get_defined_vars(), $params); 
     298  } 
     299   
     300  /** 
     301   * List Lookup 
     302   * 
     303   * @param   int $ListingId Number that uniquely identifies a list. 
     304   * @param   int $ListType Type of list. 
     305   * @param   string $ResponseGroup Comma seperated list of ResponseGroups to include in the response 
     306   * @param   array $params Array of additional parameters to be sent to ECS 
     307   * @return  object $xml 
     308   * @author  Jonathan H. Wage 
     309   **/ 
     310  public function ListLookup($ListingId, $ListType, $ResponseGroup = null, $params = array()) 
     311  { 
     312    return $this->doOperation(__FUNCTION__, get_defined_vars(), $params); 
     313  } 
     314   
     315  /** 
     316   * List Search 
     317   * 
     318   * @param   string $Email 
     319   * @param   string $FirstName 
     320   * @param   string $LastName 
     321   * @param   string $City 
     322   * @param   string $State 
     323   * @param   int $ListPage Page number of lists to return. Default is 1 
     324   * @param   string $ResponseGroup Comma seperated list of ResponseGroups to include in the response 
     325   * @param   array $params Array of additional parameters to be sent to ECS 
     326   * @return  object $xml 
     327   * @author  Jonathan H. Wage 
     328   **/ 
     329  public function ListSearch($Email = null, $FirstName = null, $LastName = null, $City = null, $State = null, $ListPage = 1, $ResponseGroup = null, $params = array()) 
     330  { 
     331    return $this->doOperation(__FUNCTION__, get_defined_vars(), $params); 
     332  } 
     333   
     334  /** 
     335   * Seller Listing Lookup 
     336   * 
     337   * @param   int $Id Number that uniquely identifies an item. The valid value depends on the value for IdType. 
     338   * @param   int $IdType Use the IdType parameter to specify the value type of the Id parameter value. 
     339   * @param   int $SellerId Alphanumeric token that uniquely identifies a seller. This parameter limits the results to a single seller ID. 
     340   * @param   string $ResponseGroup Comma seperated list of ResponseGroups to include in the response 
     341   * @param   array $params Array of additional parameters to be sent to ECS 
     342   * @return  object $xml 
     343   * @author  Jonathan H. Wage 
     344   **/ 
     345  public function SellerListingLookup($Id, $IdType, $SellerId = null, $ResponseGroup = null, $params = array()) 
     346  { 
     347    return $this->doOperation(__FUNCTION__, get_defined_vars(), $params); 
     348  } 
     349   
     350  /** 
     351   * Seller Listing Search 
     352   * 
     353   * @param   int $SellerId Alphanumeric token that uniquely identifies a seller. This parameter limits the results to a single seller ID. 
     354   * @param   string $Title Searches for products based on the product’s name 
     355   * @param   string $ResponseGroup Comma seperated list of ResponseGroups to include in the response 
     356   * @param   string $ListPage Page number of lists to return. Default is 1 
     357   * @param   array $params Array of additional parameters to be sent to ECS 
     358   * @return  object $xml 
     359   * @author  Jonathan H. Wage 
     360   **/ 
     361  public function SellerListingSearch($SellerId, $Title = null, $ListPage = 1, $ResponseGroup = null, $params = array()) 
     362  { 
     363    return $this->doOperation(__FUNCTION__, get_defined_vars(), $params); 
     364  } 
     365   
     366  /** 
     367   * Seller Lookup 
     368   * 
     369   * @param   int $SellerId Alphanumeric token that uniquely identifies a seller. This parameter limits the results to a single seller ID. 
     370   * @param   string $ResponseGroup Comma seperated list of ResponseGroups to include in the response 
     371   * @param   array $params Array of additional parameters to be sent to ECS 
     372   * @return  object $xml 
     373   * @author  Jonathan H. Wage 
     374   **/ 
     375  public function SellerLookup($SellerId, $ResponseGroup = null, $params = array()) 
     376  { 
     377    return $this->doOperation(__FUNCTION__, get_defined_vars(), $params); 
     378  } 
     379   
     380  /** 
     381   * Similarity Lookup 
     382   * 
     383   * @param   int $ItemId Specifies the item you want to look up. 
     384   * @param   string $ResponseGroup Comma seperated list of ResponseGroups to include in the response 
     385   * @param   array $params Array of additional parameters to be sent to ECS 
     386   * @return  object $xml 
     387   * @author  Jonathan H. Wage 
     388   **/ 
     389  public function SimilarityLookup($ItemId, $ResponseGroup = null, $params = array()) 
     390  { 
     391    return $this->doOperation(__FUNCTION__, get_defined_vars(), $params); 
     392  } 
     393   
     394  /** 
     395   * Tag Lookup 
     396   * 
     397   * @param   string $TagName Comma separated list of tag names. Up to five tags can be included in a request. 
     398   * @param   string $ResponseGroup Comma seperated list of ResponseGroups to include in the response 
     399   * @param   array $params Array of additional parameters to be sent to ECS 
     400   * @return  object $xml 
     401   * @author  Jonathan H. Wage 
     402   **/ 
     403  public function TagLookup($TagName, $ResponseGroup = null, $params = array()) 
     404  { 
     405    return $this->doOperation(__FUNCTION__, get_defined_vars(), $params); 
     406  } 
     407   
     408  /** 
     409   * Transaction Lookup 
     410   * 
     411   * @param   int $TransactionId A number that uniquely identifies a transaction. 
     412   * @param   string $ResponseGroup Comma seperated list of ResponseGroups to include in the response 
     413   * @param   array $params Array of additional parameters to be sent to ECS 
     414   * @return  object $xml 
     415   * @author  Jonathan H. Wage 
     416   **/ 
     417  public function TransactionLookup($TransactionId, $ResponseGroup = null, $params = array()) 
     418  { 
     419    return $this->doOperation(__FUNCTION__, get_defined_vars(), $params); 
     420  } 
     421   
     422  protected function doOperation($method, $mainParams, $additionalParams = array()) 
     423  { 
     424    unset($mainParams['params']); 
     425    $params = array_merge($mainParams, $additionalParams); 
    306426     
    307     return $this->doOperation('CartGet', $params); 
    308   } 
    309    
    310   /** 
    311    * Cart Modify 
    312    * 
    313    * @param   int $cartId Id of the cart you wish to get 
    314    * @param   int $cartItemId Number of the item in the cart 
    315    * @param   string $hmac Hash Message Authentication Code returned by CartCreate that identifies a cart 
    316    * @param   int $quantity Number to modify cart with 
    317    * @param   string $responseGroup Comma seperated list of ResponseGroups to include in the response 
    318    * @param   array $params Array of additional parameters to be sent to ECS 
    319    * @return  object $xml 
    320    * @author  Jonathan H. Wage 
    321    **/ 
    322   public function cartModify($cartId, $cartItemId, $hmac, $quantity = 1, $responseGroup = 'Cart', $params = array()) 
    323   { 
    324     $params['CartId'] = $cartId; 
    325     $params['HMAC'] = urlencode($hmac); 
    326     $params['Item.1.CartItemId'] = $cartItemId; 
    327     $params['Item.1.Quantity'] = $quantity; 
    328     $params['ResponseGroup'] = $responseGroup; 
     427    $parameters = array('Service'         =>  $this->service, 
     428                        'AssociateTag'    =>  $this->associateTag, 
     429                        'AWSAccessKeyId'  =>  $this->awsAccessKeyId, 
     430                        'Request'         =>  array($params)); 
    329431     
    330     return $this->doOperation('CartModify', $params); 
    331   } 
    332    
    333   /** 
    334    * Cart Remove 
    335    * 
    336    * @param   int $cartId Id of the cart you wish to get 
    337    * @param   int $cartItemId Number of the item in the cart 
    338    * @param   string $hmac Hash Message Authentication Code returned by CartCreate that identifies a cart 
    339    * @param   string $responseGroup Comma seperated list of ResponseGroups to include in the response 
    340    * @param   array $params Array of additional parameters to be sent to ECS 
    341    * @return  object $xml 
    342    * @author  Jonathan H. Wage 
    343    **/ 
    344   public function cartRemove($cartId, $cartItemId, $hmac, $responseGroup = 'Cart', $params = array()) 
    345   { 
    346     return $this->cartModify($cartId, $cartItemId, $hmac, 0, $responseGroup, $params); 
    347   } 
    348    
    349   /** 
    350    * Customer Content Lookup 
    351    * 
    352    * @param   int $customerId Id of the customer you wish to lookup 
    353    * @param   string $responseGroup Comma seperated list of ResponseGroups to include in the response 
    354    * @param   array $params Array of additional parameters to be sent to ECS 
    355    * @return  object $xml 
    356    * @author  Jonathan H. Wage 
    357    **/ 
    358   public function customerContentLookup($customerId, $responseGroup = 'CustomerInfo,TaggedItems,TagsSummary', $params = array()) 
    359   { 
    360     $params['CustomerId'] = $customerId; 
    361     $params['ResponseGroup'] = $responseGroup; 
    362      
    363     return $this->doOperation('CustomerContentLookup', $params); 
    364   } 
    365    
    366   /** 
    367    * Customer Content Search 
    368    * 
    369    * @param   int $customerPage A positive integer that specifies the page of customer IDs to return 
    370    * @param   string $email E-mail address of the customer you wish to lookup 
    371    * @param   string $name Name of the customer you wish to lookup 
    372    * @param   string $responseGroup Comma seperated list of ResponseGroups to include in the response 
    373    * @param   array $params Array of additional parameters to be sent to ECS 
    374    * @return  object $xml 
    375    * @author  Jonathan H. Wage 
    376    **/ 
    377   public function customerContentSearch($customerPage, $email = null, $name = null, $responseGroup = 'CustomerInfo', $params = array()) 
    378   { 
    379     if( !$email AND !$name ) 
    380     { 
    381       throw new Exception('You must specify either an e-mail address or a name.'); 
    382     } 
    383      
    384     $params['CustomerPage'] = $customerPage; 
    385      
    386     if( $email ) 
    387     { 
    388       $params['Email'] = $email; 
    389     } 
    390      
    391     if( $name ) 
    392     { 
    393       $params['Name'] = $name; 
    394     } 
    395      
    396     $params['ResponseGroup'] = $responseGroup; 
    397      
    398     return $this->doOperation('CustomerContentSearch', $params); 
    399   } 
    400    
    401   /** 
    402    * Help 
    403    * 
    404    * @param   string $about Specifies the operation or response group about which you want more information. 
    405    * @param   string $helpType Specifies whether the help topic is an operation or response group. HelpType and About values must both be operations or response groups, not a mixture of the two.  
    406    * @param   string $responseGroup Comma seperated list of ResponseGroups to include in the response 
    407    * @param   array $params Array of additional parameters to be sent to ECS 
    408    * @return  object $xml 
    409    * @author  Jonathan H. Wage 
    410    **/ 
    411   public function help($about = null, $helpType = null, $responseGroup = 'Help', $params = array()) 
    412   { 
    413     if( $about ) 
    414     { 
    415       $params['About'] = $about; 
    416     } 
    417      
    418     if( $helpType ) 
    419     { 
    420       $params['HelpType'] = $helpType; 
    421     } 
    422      
    423     $params['ResponseGroup'] = $responseGroup; 
    424      
    425     return $this->doOperation('Help', $params); 
    426   } 
    427    
    428   /** 
    429    * Item Lookup 
    430    * 
    431    * @param   int $itemId A positive integer that unique identifies an item.  
    432    * @param   string $searchIndex The product category to search. 
    433    * @param   string $responseGroup Comma seperated list of ResponseGroups to include in the response 
    434    * @param   array $params Array of additional parameters to be sent to ECS 
    435    * @return  object $xml 
    436    * @author  Jonathan H. Wage 
    437    **/ 
    438   public function itemLookup($itemId, $searchIndex = null, $responseGroup = 'Small', $params = array()) 
    439   { 
    440     $params['ItemId'] = $itemId; 
    441      
    442     // Required for non ASIN itemids 
    443     if( $searchIndex ) 
    444     { 
    445       $params['SearchIndex'] = $searchIndex; 
    446     } 
    447      
    448     $params['ResponseGroup'] = $responseGroup; 
    449      
    450     return $this->doOperation('ItemLookup', $params); 
    451   } 
    452    
    453   /** 
    454    * Item Search 
    455    * 
    456    * @param   string $keywords Keywords to search for 
    457    * @param   string $searchIndex The product category to search. 
    458    * @param   string $responseGroup Comma seperated list of ResponseGroups to include in the response 
    459    * @param   array $params Array of additional parameters to be sent to ECS 
    460    * @return  object $xml 
    461    * @author  Jonathan H. Wage 
    462    **/ 
    463   public function itemSearch($keywords, $searchIndex, $responseGroup = 'Small', $params = array()) 
    464   {  
    465     $params['Keywords'] = $keywords; 
    466     $params['SearchIndex'] = $searchIndex; 
    467      
    468     return $this->doOperation('ItemSearch', $params); 
    469   } 
    470    
    471   /** 
    472    * List Lookup 
    473    * 
    474    * @param   int $listingId Number that uniquely identifies a list. 
    475    * @param   int $listType Type of list. 
    476    * @param   string $responseGroup Comma seperated list of ResponseGroups to include in the response 
    477    * @param   array $params Array of additional parameters to be sent to ECS 
    478    * @return  object $xml 
    479    * @author  Jonathan H. Wage 
    480    **/ 
    481   public function listLookup($listingId, $listType, $responseGroup = 'ListInfo', $params = array()) 
    482   { 
    483     $params['ListingId'] = $listingId; 
    484     $params['ListType'] = $listType; 
    485     $params['ResponseGroup'] = $responseGroup; 
    486      
    487     return $this->doOperation('ListLookup', $params); 
    488   } 
    489    
    490   /** 
    491    * List Search 
    492    * 
    493    * @param   string $email 
    494    * @param   string $firstName 
    495    * @param   string $lastName 
    496    * @param   string $city 
    497    * @param   string $state 
    498    * @param   string $responseGroup Comma seperated list of ResponseGroups to include in the response 
    499    * @param   array $params Array of additional parameters to be sent to ECS 
    500    * @return  object $xml 
    501    * @author  Jonathan H. Wage 
    502    **/ 
    503   public function listSearch($email = null, $firstName = null, $lastName = null, $city = null, $state = null, $responseGroup = 'ListInfo', $params = array()) 
    504   { 
    505     if( $email ) 
    506     { 
    507       $params['Email'] = $email; 
    508     } 
    509      
    510     if( $firstName ) 
    511     { 
    512       $params['FirstName'] = $firstName; 
    513     } 
    514      
    515     if( $lastName ) 
    516     { 
    517       $params['LastName'] = $lastName; 
    518     } 
    519      
    520     if( $city ) 
    521     { 
    522       $params['City'] = $city; 
    523     } 
    524      
    525     if( $state ) 
    526     { 
    527       $params['State'] = $state; 
    528     } 
    529      
    530     $params['ResponseGroup'] = $responseGroup; 
    531      
    532     return $this->doOperation('ListSearch', $params); 
    533   } 
    534    
    535   /** 
    536    * Seller Listing Lookup 
    537    * 
    538    * @param   int $id Number that uniquely identifies an item. The valid value depends on the value for IdType. 
    539    * @param   int $idType Use the IdType parameter to specify the value type of the Id parameter value. 
    540    * @param   int $sellerId Alphanumeric token that uniquely identifies a seller. This parameter limits the results to a single seller ID. 
    541    * @param   string $responseGroup Comma seperated list of ResponseGroups to include in the response 
    542    * @param   array $params Array of additional parameters to be sent to ECS 
    543    * @return  object $xml 
    544    * @author  Jonathan H. Wage 
    545    **/ 
    546   public function sellerListingLookup($id, $idType, $sellerId = null, $responseGroup = 'SellerListing', $params = array()) 
    547   { 
    548     if( $idType != 'Exchange' AND !$sellerId ) 
    549     { 
    550       throw new Exception('SellerId is required when IdType does not equal Exchange'); 
    551     } 
    552      
    553     $params['Id'] = $id; 
    554     $params['IdType'] = $idType; 
    555      
    556     if( $sellerId ) 
    557     { 
    558       $params['SellerId'] = $sellerId; 
    559     } 
    560      
    561     $params['ResponseGroup'] = $responseGroup; 
    562      
    563     return $this->doOperation('SellerListingLookup', $params); 
    564   } 
    565    
    566   /** 
    567    * Seller Listing Search 
    568    * 
    569    * @param   int $sellerId Alphanumeric token that uniquely identifies a seller. This parameter limits the results to a single seller ID. 
    570    * @param   string $title Searches for products based on the product’s name 
    571    * @param   string $responseGroup Comma seperated list of ResponseGroups to include in the response 
    572    * @param   array $params Array of additional parameters to be sent to ECS 
    573    * @return  object $xml 
    574    * @author  Jonathan H. Wage 
    575    **/ 
    576   public function sellerListingSearch($sellerId, $title = null, $responseGroup = 'SellerListing', $params = array()) 
    577   { 
    578     $params['SellerId'] = $sellerId; 
    579      
    580     if( $title ) 
    581     { 
    582       $params['Title'] = $title; 
    583     } 
    584      
    585     $params['ResponseGroup'] = $responseGroup; 
    586      
    587     return $this->doOperation('SellerListingSearch', $params); 
    588   } 
    589    
    590   /** 
    591    * Seller Lookup 
    592    * 
    593    * @param   int $sellerId Alphanumeric token that uniquely identifies a seller. This parameter limits the results to a single seller ID. 
    594    * @param   string $responseGroup Comma seperated list of ResponseGroups to include in the response 
    595    * @param   array $params Array of additional parameters to be sent to ECS 
    596    * @return  object $xml 
    597    * @author  Jonathan H. Wage 
    598    **/ 
    599   public function sellerLookup($sellerId, $responseGroup = 'Seller', $params = array()) 
    600   { 
    601     $params['SellerId'] = $sellerId; 
    602     $params['ResponseGroup'] = $responseGroup; 
    603      
    604     return $this->doOperation('SellerLookup', $params); 
    605   } 
    606    
    607   /** 
    608    * Similarity Lookup 
    609    * 
    610    * @param   int $itemId Specifies the item you want to look up. 
    611    * @param   string $responseGroup Comma seperated list of ResponseGroups to include in the response 
    612    * @param   array $params Array of additional parameters to be sent to ECS 
    613    * @return  object $xml 
    614    * @author  Jonathan H. Wage 
    615    **/ 
    616   public function similarityLookup($itemId, $responseGroup = 'Small', $params = array()) 
    617   { 
    618     $params['ItemId'] = $itemId; 
    619     $params['ResponseGroup'] = $responseGroup; 
    620      
    621     return $this->doOperation('SimilarityLookup', $params); 
    622   } 
    623    
    624   /** 
    625    * Tag Lookup 
    626    * 
    627    * @param   string $tagName Comma separated list of tag names. Up to five tags can be included in a request. 
    628    * @param   string $responseGroup Comma seperated list of ResponseGroups to include in the response 
    629    * @param   array $params Array of additional parameters to be sent to ECS 
    630    * @return  object $xml 
    631    * @author  Jonathan H. Wage 
    632    **/ 
    633   public function tagLookup($tagName, $responseGroup = 'TaggedItems,TagsSummary', $params = array()) 
    634   { 
    635     $params['TagName'] = $tagName; 
    636     $params['ResponseGroup'] = $responseGroup; 
    637      
    638     return $this->doOperation('TagLookup', $params); 
    639   } 
    640    
    641   /** 
    642    * Tag Lookup 
    643    * 
    644    * @param   int $transactionId A number that uniquely identifies a transaction. 
    645    * @param   string $responseGroup Comma seperated list of ResponseGroups to include in the response 
    646    * @param   array $params Array of additional parameters to be sent to ECS 
    647    * @return  object $xml 
    648    * @author  Jonathan H. Wage 
    649    **/ 
    650   public function transactionLookup($transactionId, $responseGroup = 'TransactionDetails', $params = array()) 
    651   { 
    652     $params['TransactionId'] = $transactionId; 
    653     $params['ResponseGroup'] = $responseGroup; 
    654      
    655     return $this->doOperation('TransactionLookup', $params); 
     432    return $this->soapClient->__soapCall($method, array($parameters)); 
    656433  } 
    657434}