Permalink
Browse files

initial commit to the PEAR repository

git-svn-id: http://svn.php.net/repository/pear/packages/Services_Ebay/trunk@171461 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information...
0 parents commit 3ce013d9dfe90bfa53802e3c4c75bc36cdd9b9d7 Stephan Schmidt committed Oct 28, 2004
Showing with 7,043 additions and 0 deletions.
  1. +322 −0 Ebay.php
  2. +139 −0 Ebay/Call.php
  3. +54 −0 Ebay/Call/AddDispute.php
  4. +53 −0 Ebay/Call/AddDisputeResponse.php
  5. +89 −0 Ebay/Call/AddItem.php
  6. +59 −0 Ebay/Call/AddMemberMessage.php
  7. +64 −0 Ebay/Call/AddOrder.php
  8. +45 −0 Ebay/Call/AddSecondChanceItem.php
  9. +65 −0 Ebay/Call/AddShipment.php
  10. +45 −0 Ebay/Call/AddToItemDescription.php
  11. +42 −0 Ebay/Call/EndItem.php
  12. +52 −0 Ebay/Call/FetchToken.php
  13. +32 −0 Ebay/Call/GetAPIAccessRules.php
  14. +46 −0 Ebay/Call/GetAccount.php
  15. +43 −0 Ebay/Call/GetAllBidders.php
  16. +56 −0 Ebay/Call/GetBidderList.php
  17. +42 −0 Ebay/Call/GetCategories.php
  18. +54 −0 Ebay/Call/GetCategoryListings.php
  19. +62 −0 Ebay/Call/GetCrossPromotions.php
  20. +41 −0 Ebay/Call/GetDescriptionTemplates.php
  21. +48 −0 Ebay/Call/GetDispute.php
  22. +42 −0 Ebay/Call/GetDomains.php
  23. +56 −0 Ebay/Call/GetFeedback.php
  24. +43 −0 Ebay/Call/GetItem.php
  25. +62 −0 Ebay/Call/GetItemShipping.php
  26. +46 −0 Ebay/Call/GetItemTransactions.php
  27. +50 −0 Ebay/Call/GetLogoURL.php
  28. +41 −0 Ebay/Call/GetMyeBay.php
  29. +41 −0 Ebay/Call/GetNotificationPreferences.php
  30. +41 −0 Ebay/Call/GetOutageSchedules.php
  31. +57 −0 Ebay/Call/GetPreferences.php
  32. +45 −0 Ebay/Call/GetReturnURL.php
  33. +46 −0 Ebay/Call/GetRuName.php
  34. +45 −0 Ebay/Call/GetSearchResults.php
  35. +54 −0 Ebay/Call/GetSellerList.php
  36. +45 −0 Ebay/Call/GetSellerTransactions.php
  37. +47 −0 Ebay/Call/GetShippingRates.php
  38. +39 −0 Ebay/Call/GetStoreDetails.php
  39. +43 −0 Ebay/Call/GetSuggestedCategories.php
  40. +42 −0 Ebay/Call/GetUser.php
  41. +60 −0 Ebay/Call/GetUserDisputes.php
  42. +52 −0 Ebay/Call/GetWatchList.php
  43. +57 −0 Ebay/Call/GeteBayDetails.php
  44. +31 −0 Ebay/Call/GeteBayOfficialTime.php
  45. +47 −0 Ebay/Call/LeaveFeedback.php
  46. +40 −0 Ebay/Call/RelistItem.php
  47. +50 −0 Ebay/Call/ReviseCheckoutStatus.php
  48. +81 −0 Ebay/Call/ReviseItem.php
  49. +52 −0 Ebay/Call/SellerReverseDispute.php
  50. +64 −0 Ebay/Call/SetPreferences.php
  51. +53 −0 Ebay/Call/SetReturnURL.php
  52. +51 −0 Ebay/Call/SetSellerPaymentAddress.php
  53. +48 −0 Ebay/Call/ValidateTestUserRegistration.php
  54. +51 −0 Ebay/Call/VerifyAddItem.php
  55. +51 −0 Ebay/Call/VerifyAddSecondChanceItem.php
  56. +133 −0 Ebay/Model.php
  57. +49 −0 Ebay/Model/Account.php
  58. +32 −0 Ebay/Model/Dispute.php
  59. +32 −0 Ebay/Model/DisputeList.php
  60. +65 −0 Ebay/Model/Feedback.php
  61. +37 −0 Ebay/Model/FeedbackEntry.php
  62. +199 −0 Ebay/Model/Item.php
  63. +51 −0 Ebay/Model/ItemList.php
  64. +42 −0 Ebay/Model/MyeBay.php
  65. +71 −0 Ebay/Model/Order.php
  66. +103 −0 Ebay/Model/Preferences.php
  67. +52 −0 Ebay/Model/SearchResult.php
  68. +64 −0 Ebay/Model/Shipment.php
  69. +47 −0 Ebay/Model/Store.php
  70. +14 −0 Ebay/Model/Transaction.php
  71. +50 −0 Ebay/Model/TransactionList.php
  72. +103 −0 Ebay/Model/User.php
  73. +352 −0 Ebay/Session.php
  74. +83 −0 Ebay/Transport/Curl.php
  75. +76 −0 Ebay/Transport/HttpRequest.php
  76. +85 −0 Ebay/Transport/Streams.php
  77. +36 −0 docs/ideas.txt
  78. +36 −0 docs/models.txt
  79. +49 −0 docs/todo.txt
  80. +19 −0 examples/config.php
  81. +24 −0 examples/example_AddDispute.php
  82. +28 −0 examples/example_AddDisputeResponse.php
  83. +35 −0 examples/example_AddItem.php
  84. +28 −0 examples/example_AddMemberMessage.php
  85. +35 −0 examples/example_AddOrder.php
  86. +26 −0 examples/example_AddSecondChanceItem.php
  87. +47 −0 examples/example_AddShipment.php
  88. +27 −0 examples/example_AddToItemDescription.php
  89. +23 −0 examples/example_DescribingCalls.php
  90. +25 −0 examples/example_EndItem.php
  91. +24 −0 examples/example_FetchToken.php
  92. +26 −0 examples/example_GetAPIAccessRules.php
  93. +32 −0 examples/example_GetAccount.php
  94. +26 −0 examples/example_GetAllBidders.php
  95. +45 −0 examples/example_GetBidderList.php
  96. +36 −0 examples/example_GetCategories.php
  97. +25 −0 examples/example_GetCategoryListings.php
  98. +33 −0 examples/example_GetCrossPromotions.php
  99. +26 −0 examples/example_GetDescriptionTemplates.php
  100. +32 −0 examples/example_GetDispute.php
  101. +29 −0 examples/example_GetDomains.php
  102. +50 −0 examples/example_GetFeedback.php
  103. +37 −0 examples/example_GetItem.php
  104. +26 −0 examples/example_GetItemShipping.php
  105. +55 −0 examples/example_GetItemTransactions.php
  106. +48 −0 examples/example_GetLogoUrl.php
  107. +31 −0 examples/example_GetMyeBay.php
  108. +26 −0 examples/example_GetNotificationPreferences.php
  109. +26 −0 examples/example_GetOutageSchedules.php
  110. +34 −0 examples/example_GetPreferences.php
  111. +32 −0 examples/example_GetRuName.php
  112. +33 −0 examples/example_GetSearchResults.php
  113. +45 −0 examples/example_GetSellerList.php
  114. +55 −0 examples/example_GetSellerTransactions.php
  115. +28 −0 examples/example_GetShippingRates.php
  116. +37 −0 examples/example_GetStoreDetails.php
  117. +23 −0 examples/example_GetSuggestedCategories.php
  118. +50 −0 examples/example_GetUser.php
  119. +32 −0 examples/example_GetUserDisputes.php
  120. +26 −0 examples/example_GetWatchList.php
  121. +32 −0 examples/example_GeteBayDetails.php
  122. +22 −0 examples/example_GeteBayOfficalTime.php
  123. +31 −0 examples/example_LeaveFeedback.php
  124. +27 −0 examples/example_RelistItem.php
  125. +28 −0 examples/example_ReviseCheckoutStatus.php
  126. +31 −0 examples/example_ReviseItem.php
  127. +28 −0 examples/example_SellerReverseDispute.php
  128. +36 −0 examples/example_SetPreferences.php
  129. +28 −0 examples/example_SetSellerPaymentAddress.php
  130. +30 −0 examples/example_UsingModels.php
  131. +23 −0 examples/example_UsingObjects.php
  132. +27 −0 examples/example_ValidateTestUserRegistration.php
  133. +33 −0 examples/example_VerifyAddItem.php
  134. +58 −0 examples/example_complex.php
  135. +87 −0 package.php
  136. +190 −0 package.xml
@@ -0,0 +1,322 @@
+<?PHP
+/* vim: set expandtab tabstop=4 shiftwidth=4: */
+// +----------------------------------------------------------------------+
+// | PHP Version 4 |
+// +----------------------------------------------------------------------+
+// | Copyright (c) 1997-2002 The PHP Group |
+// +----------------------------------------------------------------------+
+// | This source file is subject to version 2.0 of the PHP license, |
+// | that is bundled with this package in the file LICENSE, and is |
+// | available at through the world-wide-web at |
+// | http://www.php.net/license/2_02.txt. |
+// | If you did not receive a copy of the PHP license and are unable to |
+// | obtain it through the world-wide-web, please send a note to |
+// | license@php.net so we can mail you a copy immediately. |
+// +----------------------------------------------------------------------+
+// | Authors: Stephan Schmidt <schst@php.net> |
+// +----------------------------------------------------------------------+
+//
+// $Id$
+
+/**
+ * Services/Ebay.php
+ *
+ * package to access the eBay API
+ *
+ * @package Services_Ebay
+ * @author Stephan Schmidt <schst@php.net>
+ */
+
+/**
+ * directory where Services_Ebay is installed
+ */
+define('SERVICES_EBAY_BASEDIR', dirname(__FILE__));
+
+/**
+ * API Call base class
+ */
+require_once SERVICES_EBAY_BASEDIR . '/Ebay/Call.php';
+
+/**
+ * Session
+ */
+require_once SERVICES_EBAY_BASEDIR . '/Ebay/Session.php';
+
+/**
+ * Model base class
+ */
+require_once SERVICES_EBAY_BASEDIR . '/Ebay/Model.php';
+
+/**
+ * uses XML_Serializer to build the request XML
+ */
+ require_once 'XML/Serializer.php';
+
+/**
+ * uses XML_Unserializer to parse the response XML
+ */
+ require_once 'XML/Unserializer.php';
+
+/**
+ * error happened
+ */
+define( 'SERVICES_EBAY_ERROR_TRANSPORT', 20000 );
+
+/**
+ * error happened
+ */
+define( 'SERVICES_EBAY_ERROR_NO_RETURN_VALUE', 20001 );
+
+/**
+ * Services/Ebay.php
+ *
+ * package to access the eBay API
+ *
+ * @package Services_Ebay
+ * @author Stephan Schmidt <schst@php.net>
+ * @link http://developer.ebay.com/DevProgram/developer/api.asp
+ */
+class Services_Ebay
+{
+ /**
+ * no authentication, this is only needed when using FetchToken
+ */
+ const AUTH_TYPE_NONE = 0;
+
+ /**
+ * token based authentication
+ */
+ const AUTH_TYPE_TOKEN = 1;
+
+ /**
+ * authentication based on user id and password
+ */
+ const AUTH_TYPE_USER = 2;
+
+ /**
+ * return only feedback summary
+ */
+ const FEEDBACK_BRIEF = 0;
+
+ /**
+ * return verbose feedback
+ */
+ const FEEDBACK_VERBOSE = 1;
+
+ /**
+ * GetItemTransactions():
+ * Detail level 2 focuses on checkout detail (and status) data.
+ */
+ const TRANSACTION_DETAIL_CHECKOUT = 2;
+
+ /**
+ * GetItemTransactions():
+ * Detail level 4 focuses on retrieving user data for the buyer.
+ */
+ const TRANSACTION_DETAIL_BUYER = 4;
+
+ /**
+ * GetItemTransactions():
+ * Detail level 8 focuses on the return of payment terms data.
+ */
+ const TRANSACTION_DETAIL_PAYMENTTERMS = 8;
+
+ /**
+ * GetItemTransactions():
+ * Detail level 16 retrieves the user data for the seller.
+ */
+ const TRANSACTION_DETAIL_SELLER = 16;
+
+ /**
+ * GetItemTransactions():
+ * Detail level 32 retrieves checkout status and general auction data (like Title and QuantitySold).
+ */
+ const TRANSACTION_DETAIL_PAYMENT_AUCTIONDATA = 32;
+
+ /**
+ * GetItemTransactions():
+ * Detail level 64 focuses on retrieving end-of-auction data.
+ */
+ const TRANSACTION_DETAIL_PAYMENT_ENDOFACTION = 64;
+
+ /**
+ * GetUserDisputes():
+ * 1 = See all disputes that involve me as seller or buyer.
+ */
+ const USER_DISPUTES_ALL = 1;
+
+ /**
+ * GetUserDisputes():
+ * 2 = See all disputes that are awaiting my response.
+ */
+ const USER_DISPUTES_MY_RESPONSE = 2;
+
+ /**
+ * GetUserDisputes():
+ * 3 = See all disputes that are awaiting the other party's response.
+ */
+ const USER_DISPUTES_OTHER_RESPONSE = 3;
+
+ /**
+ * GetUserDisputes():
+ * 4 = See all closed disputes that involve me.
+ */
+ const USER_DISPUTES_CLOSED = 4;
+
+ /**
+ * AddDisputeResponse():
+ * 11 = Seller wants to add information or respond to an email from the buyer.
+ */
+ const DISPUTE_RESPONSE_MESSAGE = 11;
+
+ /**
+ * AddDisputeResponse():
+ * 13 = Seller has completed the transaction or otherwise does not need to pursue the dispute any longer.
+ */
+ const DISPUTE_RESPONSE_COMPLETED = 13;
+
+ /**
+ * AddDisputeResponse():
+ * 14 = Seller has made an agreement with the buyer and requires a credit for FVF fees.
+ */
+ const DISPUTE_RESPONSE_AGREEMENT = 14;
+
+ /**
+ * AddDisputeResponse():
+ * 15 = Seller wants to end communication or stop waiting for the buyer.
+ */
+ const DISPUTE_RESPONSE_AGREEMENT = 15;
+
+ /**
+ * SellerReverseDispute():
+ * 7 = Came to agreement with buyer.
+ */
+ const DISPUTE_REVERSE_AGREEMENT = 7;
+
+ /**
+ * SellerReverseDispute():
+ * 9 = Buyer reimbursed auction fees.
+ */
+ const DISPUTE_REVERSE_REIMBURSED = 9;
+
+ /**
+ * SellerReverseDispute():
+ * 10 = Received payment.
+ */
+ const DISPUTE_REVERSE_RECEIVED = 10;
+
+ /**
+ * SellerReverseDispute():
+ * 11 = Other.
+ */
+ const DISPUTE_REVERSE_OTHER = 11;
+
+ /**
+ * GetAccount():
+ * 0 = view by period or date/range
+ */
+ const ACCOUNT_TYPE_PERIOD = 0;
+
+ /**
+ * GetAccount():
+ * 1 = view by invoice
+ */
+ const ACCOUNT_TYPE_INVOICE = 1;
+
+ /**
+ * session used for the calls
+ *
+ * @var object Services_Ebay_Session
+ */
+ private $session = null;
+
+ /**
+ * create Services Ebay helper class
+ *
+ * @param object Services_Ebay_Session
+ */
+ public function __construct(Services_Ebay_Session $session)
+ {
+ $this->session = $session;
+ }
+
+ /**
+ * Factory method to create a new session
+ *
+ * @param string developer id
+ * @param string application id
+ * @param string certificate id
+ * @return object Services_Ebay_Session
+ */
+ public static function getSession($devId, $appId, $certId)
+ {
+ $session = new Services_Ebay_Session($devId, $appId, $certId);
+
+ return $session;
+ }
+
+ /**
+ * make an API call
+ *
+ * @param string method to call
+ * @param array arguments of the call
+ */
+ public function __call($method, $args)
+ {
+ try {
+ $call = self::loadAPICall($method, $args);
+ } catch (Exception $e) {
+ throw $e;
+ }
+
+ return $call->call($this->session);
+ }
+
+ /**
+ * set the detail level for all subsequent calls
+ *
+ * @param integer
+ */
+ public function setDetailLevel($level)
+ {
+ return $this->session->setDetailLevel($level);
+ }
+
+ /**
+ * load a method call
+ *
+ * @param string name of the method
+ * @param array arguments
+ */
+ public static function loadAPICall($method, $args = null)
+ {
+ $method = ucfirst($method);
+
+ $classname = 'Services_Ebay_Call_'.$method;
+ include_once SERVICES_EBAY_BASEDIR . '/Ebay/Call/'.$method.'.php';
+ if (!class_exists($classname)) {
+ throw new Exception('API-Call \''.$method.'\' could not be found, please check the spelling');
+ }
+ $call = new $classname($args);
+ return $call;
+ }
+
+ /**
+ * load a model
+ *
+ * @param string type of the model
+ * @param array properties
+ */
+ public static function loadModel($type, $properties = null, $session = null)
+ {
+ $classname = 'Services_Ebay_Model_'.$type;
+ include_once SERVICES_EBAY_BASEDIR . '/Ebay/Model/'.$type.'.php';
+ if (!class_exists($classname)) {
+ throw new Exception('Model \''.$type.'\' could not be found, please check the spelling');
+ }
+ $model = new $classname($properties, $session);
+
+ return $model;
+ }
+}
+?>
Oops, something went wrong.

0 comments on commit 3ce013d

Please sign in to comment.