Ejemplo n.º 1
0
 /**
  * @param array $values Optional properties and values to assign to the object.
  */
 public function __construct(array $values = [])
 {
     list($parentValues, $childValues) = self::getParentValues(self::$propertyTypes, $values);
     parent::__construct($parentValues);
     if (!array_key_exists(__CLASS__, self::$properties)) {
         self::$properties[__CLASS__] = array_merge(self::$properties[get_parent_class()], self::$propertyTypes);
     }
     $this->setValues(__CLASS__, $childValues);
 }
Ejemplo n.º 2
0
 /**
  * @param array $values Optional properties and values to assign to the object.
  */
 public function __construct(array $values = array())
 {
     list($parentValues, $childValues) = self::getParentValues(self::$propertyTypes, $values);
     parent::__construct($parentValues);
     if (!array_key_exists(__CLASS__, self::$properties)) {
         self::$properties[__CLASS__] = array_merge(self::$properties[get_parent_class()], self::$propertyTypes);
     }
     if (!array_key_exists(__CLASS__, self::$xmlNamespaces)) {
         self::$xmlNamespaces[__CLASS__] = 'urn:ebay:apis:eBLBaseComponents';
     }
     $this->setValues(__CLASS__, $childValues);
 }
 /**
  * @param array $values Optional properties and values to assign to the object.
  */
 public function __construct(array $values = [])
 {
     list($parentValues, $childValues) = self::getParentValues(self::$propertyTypes, $values);
     parent::__construct($parentValues);
     if (!array_key_exists(__CLASS__, self::$properties)) {
         self::$properties[__CLASS__] = array_merge(self::$properties[get_parent_class()], self::$propertyTypes);
     }
     if (!array_key_exists(__CLASS__, self::$xmlNamespaces)) {
         self::$xmlNamespaces[__CLASS__] = 'xmlns="http://www.ebay.com/marketplace/returns/v1/services"';
     }
     $this->setValues(__CLASS__, $childValues);
 }
Ejemplo n.º 4
0
 /**
  * @param array $values Optional properties and values to assign to the object.
  */
 public function __construct(array $values = [])
 {
     list($parentValues, $childValues) = self::getParentValues(self::$propertyTypes, $values);
     parent::__construct($parentValues);
     if (!array_key_exists(__CLASS__, self::$properties)) {
         self::$properties[__CLASS__] = array_merge(self::$properties[get_parent_class()], self::$propertyTypes);
     }
     if (!array_key_exists(__CLASS__, self::$xmlNamespaces)) {
         self::$xmlNamespaces[__CLASS__] = 'xmlns:xop="http://www.w3.org/2004/08/xop/include"';
     }
     $this->setValues(__CLASS__, $childValues);
 }
Ejemplo n.º 5
0
 public function __construct(array $values = array())
 {
     list($parentValues, $childValues) = self::getParentValues(self::$propertyTypes, $values);
     parent::__construct($parentValues);
     if (!array_key_exists(__CLASS__, self::$properties)) {
         self::$properties[__CLASS__] = array_merge(self::$properties[get_parent_class()], self::$propertyTypes);
     }
     if (!array_key_exists(__CLASS__, self::$xmlNamespaces)) {
         self::$xmlNamespaces[__CLASS__] = 'http://davidtsadler.com';
     }
     $this->setValues(__CLASS__, $childValues);
 }
 /**
  * Sends an API request.
  *
  * This method overrides the parent so that it can modify
  * the request object before is handled by the parent class.
  *
  * @param string $name The name of the operation.
  * @param \DTS\eBaySDK\Types\BaseType $request Request object containing the request information.
  * @param string The name of the PHP class that will be created from the XML response.
  *
  * @return mixed A response object created from the XML respose.
  */
 protected function callOperation($name, \DTS\eBaySDK\Types\BaseType $request, $responseClass)
 {
     /**
        Modify the request object to add xop:Include element.
     */
     if ($name === 'uploadFile' && $request->hasAttachment()) {
         /**
            Don't modify a request if the file attachment already exists.
         */
         if (!isset($request->fileAttachment)) {
             $request->fileAttachment = new \DTS\eBaySDK\FileTransfer\Types\FileAttachment();
         }
         if (!isset($request->fileAttachment->Data)) {
             $request->fileAttachment->Data = new \DTS\eBaySDK\FileTransfer\Types\Data(['xopInclude' => new \DTS\eBaySDK\FileTransfer\Types\XopInclude(['href' => 'cid:attachment.bin@devbay.net'])]);
         }
         if (!isset($request->fileAttachment->Size)) {
             $attachment = $request->attachment();
             $request->fileAttachment->Size = strlen($attachment['data']);
         }
     }
     return parent::callOperation($name, $request, $responseClass);
 }
 /**
  * Sends an API request.
  *
  * This method overrides the parent so that it can modify
  * the request object before is handled by the parent class.
  *
  * @param string $name The name of the operation.
  * @param \DTS\eBaySDK\Types\BaseType $request Request object containing the request information.
  * @param string The name of the PHP class that will be created from the XML response.
  *
  * @return mixed A response object created from the XML respose.
  */
 protected function callOperation($name, \DTS\eBaySDK\Types\BaseType $request, $responseClass)
 {
     /**
        Modify the request object to add xop:Include element.
     */
     if ($name === 'uploadFile' && $request->hasAttachment()) {
         /**
            Don't modify a request if the file attachment already exists.
         */
         if (!isset($request->fileAttachment)) {
             $request->fileAttachment = new \DTS\eBaySDK\FileTransfer\Types\FileAttachment();
         }
         if (!isset($request->fileAttachment->Data)) {
             $request->fileAttachment->Data = '<xop:Include xmlns:xop="http://www.w3.org/2004/08/xop/include" href="cid:attachment.bin@devbay.net"/>';
         }
         if (!isset($request->fileAttachment->Size)) {
             $attachment = $request->attachment();
             $request->fileAttachment->Size = strlen($attachment['data']);
         }
     }
     return parent::callOperation($name, $request, $responseClass);
 }
 /**
  * @param array $values Optional properties and values to assign to the object.
  */
 public function __construct(array $values = [])
 {
     list($parentValues, $childValues) = self::getParentValues(self::$propertyTypes, $values);
     parent::__construct($parentValues);
     if (!array_key_exists(__CLASS__, self::$properties)) {
         self::$properties[__CLASS__] = array_merge(self::$properties[get_parent_class()], self::$propertyTypes);
     }
     if (!array_key_exists(__CLASS__, self::$xmlNamespaces)) {
         self::$xmlNamespaces[__CLASS__] = 'xmlns="urn:ebay:apis:eBLBaseComponents"';
     }
     if (!array_key_exists(__CLASS__, self::$requestXmlRootElementNames)) {
         self::$requestXmlRootElementNames[__CLASS__] = 'SetShipmentTrackingInfoRequest';
     }
     $this->setValues(__CLASS__, $childValues);
 }
Ejemplo n.º 9
0
 /**
  * Builds the XOP document part of the request body string.
  *
  * @param \DTS\eBaySDK\Types\BaseType $request Request object containing the request information.
  *
  * @return string The XOP document part of request body.
  */
 private function buildXopDocument(\DTS\eBaySDK\Types\BaseType $request)
 {
     return sprintf('%s%s%s%s%s', '--MIME_boundary' . self::CRLF, 'Content-Type: application/xop+xml;charset=UTF-8;type="text/xml"' . self::CRLF, 'Content-Transfer-Encoding: 8bit' . self::CRLF, 'Content-ID: <*****@*****.**>' . self::CRLF . self::CRLF, $request->toRequestXml() . self::CRLF);
 }
Ejemplo n.º 10
0
 /**
  * Helper function that builds the HTTP request headers.
  *
  * @param string $name The name of the operation.
  * @param \DTS\eBaySDK\Types\BaseType $request Request object containing the request information.
  * @param string $body The request body.
  *
  * @return array An associative array of HTTP headers.
  */
 private function buildRequestHeaders($name, $request, $body)
 {
     $headers = $this->getEbayHeaders($name);
     if ($request->hasAttachment()) {
         $headers['Content-Type'] = 'multipart/related;boundary=MIME_boundary;type="application/xop+xml";start="<*****@*****.**>";start-info="text/xml"';
     } else {
         $headers['Content-Type'] = 'text/xml';
     }
     $headers['Content-Length'] = strlen($body);
     return $headers;
 }
Ejemplo n.º 11
0
 /**
  * Sends an API request.
  *
  * @param string $name The name of the operation.
  * @param \DTS\eBaySDK\Types\BaseType $request Request object containing the request information.
  * @param string The name of the PHP class that will be created from the XML response.
  *
  * @return mixed A response object created from the XML respose.
  */
 protected function callOperation($name, \DTS\eBaySDK\Types\BaseType $request, $responseClass)
 {
     $debug = $this->config('debug');
     $url = $this->getUrl();
     $body = $request->toRequestXml();
     $headers = $this->getEbayHeaders($name);
     $headers['Content-Type'] = 'text/xml';
     $headers['Content-Length'] = strlen($body);
     if ($debug) {
         $this->logRequest($url, $name, $headers, $body);
     }
     $response = $this->httpClient->post($url, $headers, $body);
     if ($debug) {
         $this->logResponse($response);
     }
     $xmlParser = new XmlParser($responseClass);
     return $xmlParser->parse($response);
 }