From 7aa80415c2f98868fbd45783b1d321df6c733ec4 Mon Sep 17 00:00:00 2001 From: Euller Cristian Date: Wed, 10 Jan 2024 14:40:12 -0300 Subject: [PATCH] first commit --- .gitignore | 14 + CHANGELOG.md | 7 + LICENSE.txt | 41 ++ README.md | 61 +++ build.xml | 69 +++ composer.json | 28 ++ lib/PayPal/Api/Address.php | 132 +++++ lib/PayPal/Api/Amount.php | 57 +++ lib/PayPal/Api/AmountDetails.php | 72 +++ lib/PayPal/Api/Authorization.php | 117 +++++ lib/PayPal/Api/Capture.php | 147 ++++++ lib/PayPal/Api/CreditCard.php | 253 ++++++++++ lib/PayPal/Api/CreditCardToken.php | 42 ++ lib/PayPal/Api/FundingInstrument.php | 42 ++ lib/PayPal/Api/Item.php | 87 ++++ lib/PayPal/Api/ItemList.php | 42 ++ lib/PayPal/Api/Link.php | 57 +++ lib/PayPal/Api/Payee.php | 57 +++ lib/PayPal/Api/Payer.php | 57 +++ lib/PayPal/Api/PayerInfo.php | 102 ++++ lib/PayPal/Api/Payment.php | 244 ++++++++++ lib/PayPal/Api/PaymentExecution.php | 42 ++ lib/PayPal/Api/PaymentHistory.php | 57 +++ lib/PayPal/Api/RedirectUrls.php | 42 ++ lib/PayPal/Api/Refund.php | 191 ++++++++ lib/PayPal/Api/Resource.php | 13 + lib/PayPal/Api/Sale.php | 169 +++++++ lib/PayPal/Api/ShippingAddress.php | 27 ++ lib/PayPal/Api/SubTransaction.php | 72 +++ lib/PayPal/Api/Transaction.php | 87 ++++ lib/PayPal/Auth/OAuthTokenCredential.php | 118 +++++ lib/PayPal/Common/ArrayUtil.php | 19 + lib/PayPal/Common/Model.php | 88 ++++ lib/PayPal/Common/ReflectionUtil.php | 73 +++ lib/PayPal/Common/UserAgent.php | 44 ++ lib/PayPal/Rest/ApiContext.php | 74 +++ lib/PayPal/Rest/Call.php | 59 +++ lib/PayPal/Rest/IResource.php | 7 + phpunit.xml | 29 ++ sample/README.md | 14 + sample/bootstrap.php | 50 ++ sample/composer.json | 14 + sample/images/edt-format-source-button.png | Bin 0 -> 173 bytes sample/images/play_button.png | Bin 0 -> 1712 bytes sample/index.html | 94 ++++ sample/payments/CreatePayment.php | 111 +++++ sample/payments/CreatePaymentUsingPayPal.php | 93 ++++ .../payments/CreatePaymentUsingSavedCard.php | 96 ++++ sample/payments/ExecutePayment.php | 47 ++ sample/payments/GetPayment.php | 39 ++ sample/payments/ListPayments.php | 42 ++ sample/sale/GetSale.php | 35 ++ sample/sale/RefundSale.php | 55 +++ sample/sdk_config.ini | 35 ++ sample/source/CreateCreditCard.html | 48 ++ sample/source/CreatePayment.html | 90 ++++ sample/source/CreatePaymentUsingPayPal.html | 72 +++ .../source/CreatePaymentUsingSavedCard.html | 77 +++ sample/source/ExecutePayment.html | 40 ++ sample/source/GetCreditCard.html | 31 ++ sample/source/GetPayment.html | 34 ++ sample/source/GetSale.html | 30 ++ sample/source/ListPayments.html | 35 ++ sample/source/RefundSale.html | 44 ++ sample/source/assets/behavior.js | 459 ++++++++++++++++++ sample/source/assets/docs.js | 93 ++++ sample/source/assets/jquery.min.js | 4 + sample/source/assets/sideNavOut.png | Bin 0 -> 289 bytes sample/source/assets/sideNavOver.png | Bin 0 -> 300 bytes sample/source/assets/style.css | 1 + sample/vault/CreateCreditCard.php | 57 +++ sample/vault/GetCreditCard.php | 38 ++ tests/PayPal/Test/Api/AddressTest.php | 56 +++ tests/PayPal/Test/Api/AmountDetailsTest.php | 45 ++ tests/PayPal/Test/Api/AmountTest.php | 45 ++ tests/PayPal/Test/Api/AuthorizationTest.php | 69 +++ tests/PayPal/Test/Api/CaptureTest.php | 60 +++ tests/PayPal/Test/Api/CreditCardTest.php | 95 ++++ tests/PayPal/Test/Api/CreditCardTokenTest.php | 38 ++ .../PayPal/Test/Api/FundingInstrumentTest.php | 36 ++ tests/PayPal/Test/Api/ItemListTest.php | 46 ++ tests/PayPal/Test/Api/ItemTest.php | 46 ++ tests/PayPal/Test/Api/LinkTest.php | 40 ++ tests/PayPal/Test/Api/PayeeTest.php | 44 ++ tests/PayPal/Test/Api/PayerInfoTest.php | 50 ++ tests/PayPal/Test/Api/PayerTest.php | 45 ++ tests/PayPal/Test/Api/PaymentHistoryTest.php | 39 ++ tests/PayPal/Test/Api/PaymentTest.php | 82 ++++ tests/PayPal/Test/Api/RefundTest.php | 57 +++ tests/PayPal/Test/Api/SaleTest.php | 74 +++ tests/PayPal/Test/Api/ShippingAddressTest.php | 59 +++ tests/PayPal/Test/Api/SubTransactionTest.php | 35 ++ tests/PayPal/Test/Api/TransactionTest.php | 49 ++ .../Test/Auth/OAuthTokenCredentialTest.php | 33 ++ tests/PayPal/Test/Common/ArrayUtilTest.php | 22 + tests/PayPal/Test/Common/ModelTest.php | 135 ++++++ tests/PayPal/Test/Common/UserAgentTest.php | 23 + tests/PayPal/Test/Constants.php | 7 + tests/PayPal/Test/Rest/CallTest.php | 41 ++ tests/bootstrap.php | 6 + tests/sdk_config.ini | 35 ++ 101 files changed, 6229 insertions(+) create mode 100644 .gitignore create mode 100644 CHANGELOG.md create mode 100644 LICENSE.txt create mode 100644 README.md create mode 100644 build.xml create mode 100644 composer.json create mode 100644 lib/PayPal/Api/Address.php create mode 100644 lib/PayPal/Api/Amount.php create mode 100644 lib/PayPal/Api/AmountDetails.php create mode 100644 lib/PayPal/Api/Authorization.php create mode 100644 lib/PayPal/Api/Capture.php create mode 100644 lib/PayPal/Api/CreditCard.php create mode 100644 lib/PayPal/Api/CreditCardToken.php create mode 100644 lib/PayPal/Api/FundingInstrument.php create mode 100644 lib/PayPal/Api/Item.php create mode 100644 lib/PayPal/Api/ItemList.php create mode 100644 lib/PayPal/Api/Link.php create mode 100644 lib/PayPal/Api/Payee.php create mode 100644 lib/PayPal/Api/Payer.php create mode 100644 lib/PayPal/Api/PayerInfo.php create mode 100644 lib/PayPal/Api/Payment.php create mode 100644 lib/PayPal/Api/PaymentExecution.php create mode 100644 lib/PayPal/Api/PaymentHistory.php create mode 100644 lib/PayPal/Api/RedirectUrls.php create mode 100644 lib/PayPal/Api/Refund.php create mode 100644 lib/PayPal/Api/Resource.php create mode 100644 lib/PayPal/Api/Sale.php create mode 100644 lib/PayPal/Api/ShippingAddress.php create mode 100644 lib/PayPal/Api/SubTransaction.php create mode 100644 lib/PayPal/Api/Transaction.php create mode 100644 lib/PayPal/Auth/OAuthTokenCredential.php create mode 100644 lib/PayPal/Common/ArrayUtil.php create mode 100644 lib/PayPal/Common/Model.php create mode 100644 lib/PayPal/Common/ReflectionUtil.php create mode 100644 lib/PayPal/Common/UserAgent.php create mode 100644 lib/PayPal/Rest/ApiContext.php create mode 100644 lib/PayPal/Rest/Call.php create mode 100644 lib/PayPal/Rest/IResource.php create mode 100644 phpunit.xml create mode 100644 sample/README.md create mode 100644 sample/bootstrap.php create mode 100644 sample/composer.json create mode 100644 sample/images/edt-format-source-button.png create mode 100644 sample/images/play_button.png create mode 100644 sample/index.html create mode 100644 sample/payments/CreatePayment.php create mode 100644 sample/payments/CreatePaymentUsingPayPal.php create mode 100644 sample/payments/CreatePaymentUsingSavedCard.php create mode 100644 sample/payments/ExecutePayment.php create mode 100644 sample/payments/GetPayment.php create mode 100644 sample/payments/ListPayments.php create mode 100644 sample/sale/GetSale.php create mode 100644 sample/sale/RefundSale.php create mode 100644 sample/sdk_config.ini create mode 100644 sample/source/CreateCreditCard.html create mode 100644 sample/source/CreatePayment.html create mode 100644 sample/source/CreatePaymentUsingPayPal.html create mode 100644 sample/source/CreatePaymentUsingSavedCard.html create mode 100644 sample/source/ExecutePayment.html create mode 100644 sample/source/GetCreditCard.html create mode 100644 sample/source/GetPayment.html create mode 100644 sample/source/GetSale.html create mode 100644 sample/source/ListPayments.html create mode 100644 sample/source/RefundSale.html create mode 100644 sample/source/assets/behavior.js create mode 100644 sample/source/assets/docs.js create mode 100644 sample/source/assets/jquery.min.js create mode 100644 sample/source/assets/sideNavOut.png create mode 100644 sample/source/assets/sideNavOver.png create mode 100644 sample/source/assets/style.css create mode 100644 sample/vault/CreateCreditCard.php create mode 100644 sample/vault/GetCreditCard.php create mode 100644 tests/PayPal/Test/Api/AddressTest.php create mode 100644 tests/PayPal/Test/Api/AmountDetailsTest.php create mode 100644 tests/PayPal/Test/Api/AmountTest.php create mode 100644 tests/PayPal/Test/Api/AuthorizationTest.php create mode 100644 tests/PayPal/Test/Api/CaptureTest.php create mode 100644 tests/PayPal/Test/Api/CreditCardTest.php create mode 100644 tests/PayPal/Test/Api/CreditCardTokenTest.php create mode 100644 tests/PayPal/Test/Api/FundingInstrumentTest.php create mode 100644 tests/PayPal/Test/Api/ItemListTest.php create mode 100644 tests/PayPal/Test/Api/ItemTest.php create mode 100644 tests/PayPal/Test/Api/LinkTest.php create mode 100644 tests/PayPal/Test/Api/PayeeTest.php create mode 100644 tests/PayPal/Test/Api/PayerInfoTest.php create mode 100644 tests/PayPal/Test/Api/PayerTest.php create mode 100644 tests/PayPal/Test/Api/PaymentHistoryTest.php create mode 100644 tests/PayPal/Test/Api/PaymentTest.php create mode 100644 tests/PayPal/Test/Api/RefundTest.php create mode 100644 tests/PayPal/Test/Api/SaleTest.php create mode 100644 tests/PayPal/Test/Api/ShippingAddressTest.php create mode 100644 tests/PayPal/Test/Api/SubTransactionTest.php create mode 100644 tests/PayPal/Test/Api/TransactionTest.php create mode 100644 tests/PayPal/Test/Auth/OAuthTokenCredentialTest.php create mode 100644 tests/PayPal/Test/Common/ArrayUtilTest.php create mode 100644 tests/PayPal/Test/Common/ModelTest.php create mode 100644 tests/PayPal/Test/Common/UserAgentTest.php create mode 100644 tests/PayPal/Test/Constants.php create mode 100644 tests/PayPal/Test/Rest/CallTest.php create mode 100644 tests/bootstrap.php create mode 100644 tests/sdk_config.ini diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e9c37ab --- /dev/null +++ b/.gitignore @@ -0,0 +1,14 @@ + +build +.DS_Store +*.log + +# IDE +.project +.settings +.buildpath +*.bak + +# Composer +vendor +composer.lock diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..ec7af6f --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,7 @@ +CHANGELOG +========= + +V0.5.0 (March 07, 2013) +----------------------- + + * Initial Release diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..ad030e5 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,41 @@ +PAYPAL, INC. + +SDK LICENSE + +NOTICE TO USER: PayPal, Inc. is providing the Software and Documentation for use under the terms of this Agreement. Any use, reproduction, modification or distribution of the Software or Documentation, or any derivatives or portions hereof, constitutes your acceptance of this Agreement. + +As used in this Agreement, "PayPal" means PayPal, Inc. "Software" means the software code accompanying this agreement. "Documentation" means the documents, specifications and all other items accompanying this Agreement other than the Software. + +1. LICENSE GRANT Subject to the terms of this Agreement, PayPal hereby grants you a non-exclusive, worldwide, royalty free license to use, reproduce, prepare derivative works from, publicly display, publicly perform, distribute and sublicense the Software for any purpose, provided the copyright notice below appears in a conspicuous location within the source code of the distributed Software and this license is distributed in the supporting documentation of the Software you distribute. Furthermore, you must comply with all third party licenses in order to use the third party software contained in the Software. + +Subject to the terms of this Agreement, PayPal hereby grants you a non-exclusive, worldwide, royalty free license to use, reproduce, publicly display, publicly perform, distribute and sublicense the Documentation for any purpose. You may not modify the Documentation. + +No title to the intellectual property in the Software or Documentation is transferred to you under the terms of this Agreement. You do not acquire any rights to the Software or the Documentation except as expressly set forth in this Agreement. + +If you choose to distribute the Software in a commercial product, you do so with the understanding that you agree to defend, indemnify and hold harmless PayPal and its suppliers against any losses, damages and costs arising from the claims, lawsuits or other legal actions arising out of such distribution. You may distribute the Software in object code form under your own license, provided that your license agreement: + +(a) complies with the terms and conditions of this license agreement; + +(b) effectively disclaims all warranties and conditions, express or implied, on behalf of PayPal; + +(c) effectively excludes all liability for damages on behalf of PayPal; + +(d) states that any provisions that differ from this Agreement are offered by you alone and not PayPal; and + +(e) states that the Software is available from you or PayPal and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange. + +2. DISCLAIMER OF WARRANTY +PAYPAL LICENSES THE SOFTWARE AND DOCUMENTATION TO YOU ONLY ON AN "AS IS" BASIS WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. PAYPAL MAKES NO WARRANTY THAT THE SOFTWARE OR DOCUMENTATION WILL BE ERROR-FREE. Each user of the Software or Documentation is solely responsible for determining the appropriateness of using and distributing the Software and Documentation and assumes all risks associated with its exercise of rights under this Agreement, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs, or equipment, and unavailability or interruption of operations. Use of the Software and Documentation is made with the understanding that PayPal will not provide you with any technical or customer support or maintenance. Some states or jurisdictions do not allow the exclusion of implied warranties or limitations on how long an implied warranty may last, so the above limitations may not apply to you. To the extent permissible, any implied warranties are limited to ninety (90) days. + + +3. LIMITATION OF LIABILITY +PAYPAL AND ITS SUPPLIERS SHALL NOT BE LIABLE FOR LOSS OR DAMAGE ARISING OUT OF THIS AGREEMENT OR FROM THE USE OF THE SOFTWARE OR DOCUMENTATION. IN NO EVENT WILL PAYPAL OR ITS SUPPLIERS BE LIABLE TO YOU OR ANY THIRD PARTY FOR ANY DIRECT, INDIRECT, CONSEQUENTIAL, INCIDENTAL, OR SPECIAL DAMAGES INCLUDING LOST PROFITS, LOST SAVINGS, COSTS, FEES, OR EXPENSES OF ANY KIND ARISING OUT OF ANY PROVISION OF THIS AGREEMENT OR THE USE OR THE INABILITY TO USE THE SOFTWARE OR DOCUMENTATION, HOWEVER CAUSED AND UNDER ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. PAYPAL'S AGGREGATE LIABILITY AND THAT OF ITS SUPPLIERS UNDER OR IN CONNECTION WITH THIS AGREEMENT SHALL BE LIMITED TO THE AMOUNT PAID BY YOU FOR THE SOFTWARE AND DOCUMENTATION. + +4. TRADEMARK USAGE +PayPal is a trademark PayPal, Inc. in the United States and other countries. Such trademarks may not be used to endorse or promote any product unless expressly permitted under separate agreement with PayPal. + +5. TERM +Your rights under this Agreement shall terminate if you fail to comply with any of the material terms or conditions of this Agreement and do not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all your rights under this Agreement terminate, you agree to cease use and distribution of the Software and Documentation as soon as reasonably practicable. + +6. GOVERNING LAW AND JURISDICTION. This Agreement is governed by the statutes and laws of the State of California, without regard to the conflicts of law principles thereof. If any part of this Agreement is found void and unenforceable, it will not affect the validity of the balance of the Agreement, which shall remain valid and enforceable according to its terms. Any dispute arising out of or related to this Agreement shall be brought in the courts of Santa Clara County, California, USA. + diff --git a/README.md b/README.md new file mode 100644 index 0000000..cbb0ff8 --- /dev/null +++ b/README.md @@ -0,0 +1,61 @@ +REST API SDK for PHP (V0.5.0) +============================== + + PayPal's PHP SDK for the RESTful APIs + + +Prerequisites +------------- + + * PHP 5.3 or above + * curl, json & openssl extensions must be enabled + * composer for running the sample out of the box (See http://getcomposer.org) + + +Running the sample +------------------ + + * Ensure that you have composer installed on your machine. + * Navigate to the samples folder and run 'composer update'. + * Optionally, update the sdk_config.ini file with your own client Id and client secret. + * Run any of the command line samples in the folder to see what the APIs can do. + + +Usage +----- + +To write an app that uses the SDK + + * Copy the composer.json file from the sample folder over to your project and run 'composer update' to fetch all +dependencies + * Copy the sample configuration file sdk_config.ini to a location of your choice and let the SDK know your config path using the following define directive + + define('PP_SDK_CONFIG_PATH', /path/to/your/sdk_config.ini); + + * Obtain your clientId and client secret from the developer portal and add them to your config file + * Now you are all set to make your first API call. Create a resource object as per your need and call the relevant operation or invoke one of the static methods on your resource class. + + $payment = new Payment(); + + $payment->setIntent("Sale"); + + ... + + $payment->create(); + + *OR* + + $payment = Payment::get('payment_id'); + + These examples pick the client id / secret automatically from your config file. You can also set API credentials dynamically. See the sample code for how you can do this. + + +Contributing +------------ + +More help +--------- + + * API Reference + * Reporting issues / feature requests + diff --git a/build.xml b/build.xml new file mode 100644 index 0000000..5c927f4 --- /dev/null +++ b/build.xml @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + + + + Composer is installed + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..8cd0749 --- /dev/null +++ b/composer.json @@ -0,0 +1,28 @@ +{ + "name": "paypal/rest-api-sdk-php", + "description": "PayPal's PHP SDK for REST APIs", + "keywords": ["paypal", "payments", "rest", "sdk"], + "type": "library", + "license": "Apache2", + "homepage": "https://github.com/paypal/rest-api-sdk-php", + "authors": [ + { + "name": "PayPal", + "homepage": "https://github.com/paypal/rest-api-sdk-php/contributors" + } + ], + "require": { + "php": ">=5.3.0", + "ext-curl": "*", + "ext-json": "*", + "paypal/sdk-core-php": "1.2.*" + }, + "require-dev": { + "phpunit/phpunit": "3.7.*" + }, + "autoload": { + "psr-0": { + "PayPal": "lib/" + } + } +} \ No newline at end of file diff --git a/lib/PayPal/Api/Address.php b/lib/PayPal/Api/Address.php new file mode 100644 index 0000000..70f0376 --- /dev/null +++ b/lib/PayPal/Api/Address.php @@ -0,0 +1,132 @@ +line1 = $line1; + } + + /** + * Getter for line1 + */ + public function getLine1() { + return $this->line1; + } + + /** + * Setter for line2 + * @param string $line2 + */ + public function setLine2($line2) { + $this->line2 = $line2; + } + + /** + * Getter for line2 + */ + public function getLine2() { + return $this->line2; + } + + /** + * Setter for city + * @param string $city + */ + public function setCity($city) { + $this->city = $city; + } + + /** + * Getter for city + */ + public function getCity() { + return $this->city; + } + + /** + * Setter for state + * @param string $state + */ + public function setState($state) { + $this->state = $state; + } + + /** + * Getter for state + */ + public function getState() { + return $this->state; + } + + /** + * Setter for postal_code + * @param string $postal_code + */ + public function setPostal_code($postal_code) { + $this->postal_code = $postal_code; + } + + /** + * Getter for postal_code + */ + public function getPostal_code() { + return $this->postal_code; + } + + /** + * Setter for country_code + * @param string $country_code + */ + public function setCountry_code($country_code) { + $this->country_code = $country_code; + } + + /** + * Getter for country_code + */ + public function getCountry_code() { + return $this->country_code; + } + + /** + * Setter for type + * @param string $type + */ + public function setType($type) { + $this->type = $type; + } + + /** + * Getter for type + */ + public function getType() { + return $this->type; + } + + /** + * Setter for phone + * @param string $phone + */ + public function setPhone($phone) { + $this->phone = $phone; + } + + /** + * Getter for phone + */ + public function getPhone() { + return $this->phone; + } + + +} \ No newline at end of file diff --git a/lib/PayPal/Api/Amount.php b/lib/PayPal/Api/Amount.php new file mode 100644 index 0000000..ad7191d --- /dev/null +++ b/lib/PayPal/Api/Amount.php @@ -0,0 +1,57 @@ +total = $total; + } + + /** + * Getter for total + */ + public function getTotal() { + return $this->total; + } + + /** + * Setter for currency + * @param string $currency + */ + public function setCurrency($currency) { + $this->currency = $currency; + } + + /** + * Getter for currency + */ + public function getCurrency() { + return $this->currency; + } + + /** + * Setter for details + * @param PayPal\Api\AmountDetails $details + */ + public function setDetails($details) { + $this->details = $details; + } + + /** + * Getter for details + */ + public function getDetails() { + return $this->details; + } + + +} \ No newline at end of file diff --git a/lib/PayPal/Api/AmountDetails.php b/lib/PayPal/Api/AmountDetails.php new file mode 100644 index 0000000..65e5a33 --- /dev/null +++ b/lib/PayPal/Api/AmountDetails.php @@ -0,0 +1,72 @@ +subtotal = $subtotal; + } + + /** + * Getter for subtotal + */ + public function getSubtotal() { + return $this->subtotal; + } + + /** + * Setter for tax + * @param string $tax + */ + public function setTax($tax) { + $this->tax = $tax; + } + + /** + * Getter for tax + */ + public function getTax() { + return $this->tax; + } + + /** + * Setter for shipping + * @param string $shipping + */ + public function setShipping($shipping) { + $this->shipping = $shipping; + } + + /** + * Getter for shipping + */ + public function getShipping() { + return $this->shipping; + } + + /** + * Setter for fee + * @param string $fee + */ + public function setFee($fee) { + $this->fee = $fee; + } + + /** + * Getter for fee + */ + public function getFee() { + return $this->fee; + } + + +} \ No newline at end of file diff --git a/lib/PayPal/Api/Authorization.php b/lib/PayPal/Api/Authorization.php new file mode 100644 index 0000000..3b4b82c --- /dev/null +++ b/lib/PayPal/Api/Authorization.php @@ -0,0 +1,117 @@ +id = $id; + } + + /** + * Getter for id + */ + public function getId() { + return $this->id; + } + + /** + * Setter for create_time + * @param string $create_time + */ + public function setCreate_time($create_time) { + $this->create_time = $create_time; + } + + /** + * Getter for create_time + */ + public function getCreate_time() { + return $this->create_time; + } + + /** + * Setter for update_time + * @param string $update_time + */ + public function setUpdate_time($update_time) { + $this->update_time = $update_time; + } + + /** + * Getter for update_time + */ + public function getUpdate_time() { + return $this->update_time; + } + + /** + * Setter for state + * @param string $state + */ + public function setState($state) { + $this->state = $state; + } + + /** + * Getter for state + */ + public function getState() { + return $this->state; + } + + /** + * Setter for amount + * @param PayPal\Api\Amount $amount + */ + public function setAmount($amount) { + $this->amount = $amount; + } + + /** + * Getter for amount + */ + public function getAmount() { + return $this->amount; + } + + /** + * Setter for parent_payment + * @param string $parent_payment + */ + public function setParent_payment($parent_payment) { + $this->parent_payment = $parent_payment; + } + + /** + * Getter for parent_payment + */ + public function getParent_payment() { + return $this->parent_payment; + } + + /** + * Setter for links + * @param PayPal\Api\Link $links + */ + public function setLinks($links) { + $this->links = $links; + } + + /** + * Getter for links + */ + public function getLinks() { + return $this->links; + } + + +} \ No newline at end of file diff --git a/lib/PayPal/Api/Capture.php b/lib/PayPal/Api/Capture.php new file mode 100644 index 0000000..3c36e5a --- /dev/null +++ b/lib/PayPal/Api/Capture.php @@ -0,0 +1,147 @@ +id = $id; + } + + /** + * Getter for id + */ + public function getId() { + return $this->id; + } + + /** + * Setter for create_time + * @param string $create_time + */ + public function setCreate_time($create_time) { + $this->create_time = $create_time; + } + + /** + * Getter for create_time + */ + public function getCreate_time() { + return $this->create_time; + } + + /** + * Setter for update_time + * @param string $update_time + */ + public function setUpdate_time($update_time) { + $this->update_time = $update_time; + } + + /** + * Getter for update_time + */ + public function getUpdate_time() { + return $this->update_time; + } + + /** + * Setter for state + * @param string $state + */ + public function setState($state) { + $this->state = $state; + } + + /** + * Getter for state + */ + public function getState() { + return $this->state; + } + + /** + * Setter for amount + * @param PayPal\Api\Amount $amount + */ + public function setAmount($amount) { + $this->amount = $amount; + } + + /** + * Getter for amount + */ + public function getAmount() { + return $this->amount; + } + + /** + * Setter for parent_payment + * @param string $parent_payment + */ + public function setParent_payment($parent_payment) { + $this->parent_payment = $parent_payment; + } + + /** + * Getter for parent_payment + */ + public function getParent_payment() { + return $this->parent_payment; + } + + /** + * Setter for authorization_id + * @param string $authorization_id + */ + public function setAuthorization_id($authorization_id) { + $this->authorization_id = $authorization_id; + } + + /** + * Getter for authorization_id + */ + public function getAuthorization_id() { + return $this->authorization_id; + } + + /** + * Setter for description + * @param string $description + */ + public function setDescription($description) { + $this->description = $description; + } + + /** + * Getter for description + */ + public function getDescription() { + return $this->description; + } + + /** + * Setter for links + * @param PayPal\Api\Link $links + */ + public function setLinks($links) { + $this->links = $links; + } + + /** + * Getter for links + */ + public function getLinks() { + return $this->links; + } + + +} \ No newline at end of file diff --git a/lib/PayPal/Api/CreditCard.php b/lib/PayPal/Api/CreditCard.php new file mode 100644 index 0000000..7486242 --- /dev/null +++ b/lib/PayPal/Api/CreditCard.php @@ -0,0 +1,253 @@ +id = $id; + } + + /** + * Getter for id + */ + public function getId() { + return $this->id; + } + + /** + * Setter for valid_until + * @param string $valid_until + */ + public function setValid_until($valid_until) { + $this->valid_until = $valid_until; + } + + /** + * Getter for valid_until + */ + public function getValid_until() { + return $this->valid_until; + } + + /** + * Setter for state + * @param string $state + */ + public function setState($state) { + $this->state = $state; + } + + /** + * Getter for state + */ + public function getState() { + return $this->state; + } + + /** + * Setter for payer_id + * @param string $payer_id + */ + public function setPayer_id($payer_id) { + $this->payer_id = $payer_id; + } + + /** + * Getter for payer_id + */ + public function getPayer_id() { + return $this->payer_id; + } + + /** + * Setter for type + * @param string $type + */ + public function setType($type) { + $this->type = $type; + } + + /** + * Getter for type + */ + public function getType() { + return $this->type; + } + + /** + * Setter for number + * @param string $number + */ + public function setNumber($number) { + $this->number = $number; + } + + /** + * Getter for number + */ + public function getNumber() { + return $this->number; + } + + /** + * Setter for expire_month + * @param string $expire_month + */ + public function setExpire_month($expire_month) { + $this->expire_month = $expire_month; + } + + /** + * Getter for expire_month + */ + public function getExpire_month() { + return $this->expire_month; + } + + /** + * Setter for expire_year + * @param string $expire_year + */ + public function setExpire_year($expire_year) { + $this->expire_year = $expire_year; + } + + /** + * Getter for expire_year + */ + public function getExpire_year() { + return $this->expire_year; + } + + /** + * Setter for cvv2 + * @param string $cvv2 + */ + public function setCvv2($cvv2) { + $this->cvv2 = $cvv2; + } + + /** + * Getter for cvv2 + */ + public function getCvv2() { + return $this->cvv2; + } + + /** + * Setter for first_name + * @param string $first_name + */ + public function setFirst_name($first_name) { + $this->first_name = $first_name; + } + + /** + * Getter for first_name + */ + public function getFirst_name() { + return $this->first_name; + } + + /** + * Setter for last_name + * @param string $last_name + */ + public function setLast_name($last_name) { + $this->last_name = $last_name; + } + + /** + * Getter for last_name + */ + public function getLast_name() { + return $this->last_name; + } + + /** + * Setter for billing_address + * @param PayPal\Api\Address $billing_address + */ + public function setBilling_address($billing_address) { + $this->billing_address = $billing_address; + } + + /** + * Getter for billing_address + */ + public function getBilling_address() { + return $this->billing_address; + } + + /** + * Setter for links + * @param PayPal\Api\Link $links + */ + public function setLinks($links) { + $this->links = $links; + } + + /** + * Getter for links + */ + public function getLinks() { + return $this->links; + } + + + + /** + * @path /v1/vault/credit-card + * @method POST + + * @param PayPal\Rest\ApiContext $apiContext optional + */ + public function create( $apiContext=null) { + $payLoad = $this->toJSON(); + if($apiContext == null) { + $apiContext = new ApiContext(self::$credential); + } + $call = new Call(); + $json = $call->execute("/v1/vault/credit-card", "POST", $payLoad, $apiContext); + $this->fromJson($json); + return $this; + } + + /** + * @path /v1/vault/credit-card/:credit-card-id + * @method GET + * @param string $creditcardid + */ + public static function get( $creditcardid) { + if (($creditcardid == null) || (strlen($creditcardid) <= 0)) { + throw new \InvalidArgumentException("creditcardid cannot be null or empty"); + } + $payLoad = ""; + + $apiContext = new ApiContext(self::$credential); $call = new Call(); + $json = $call->execute("/v1/vault/credit-card/$creditcardid", "GET", $payLoad, $apiContext); + $ret = new CreditCard(); + $ret->fromJson($json); + return $ret; + + } + + +} \ No newline at end of file diff --git a/lib/PayPal/Api/CreditCardToken.php b/lib/PayPal/Api/CreditCardToken.php new file mode 100644 index 0000000..7ca48f1 --- /dev/null +++ b/lib/PayPal/Api/CreditCardToken.php @@ -0,0 +1,42 @@ +credit_card_id = $credit_card_id; + } + + /** + * Getter for credit_card_id + */ + public function getCredit_card_id() { + return $this->credit_card_id; + } + + /** + * Setter for payer_id + * @param string $payer_id + */ + public function setPayer_id($payer_id) { + $this->payer_id = $payer_id; + } + + /** + * Getter for payer_id + */ + public function getPayer_id() { + return $this->payer_id; + } + + +} \ No newline at end of file diff --git a/lib/PayPal/Api/FundingInstrument.php b/lib/PayPal/Api/FundingInstrument.php new file mode 100644 index 0000000..7fc07a0 --- /dev/null +++ b/lib/PayPal/Api/FundingInstrument.php @@ -0,0 +1,42 @@ +credit_card = $credit_card; + } + + /** + * Getter for credit_card + */ + public function getCredit_card() { + return $this->credit_card; + } + + /** + * Setter for credit_card_token + * @param PayPal\Api\CreditCardToken $credit_card_token + */ + public function setCredit_card_token($credit_card_token) { + $this->credit_card_token = $credit_card_token; + } + + /** + * Getter for credit_card_token + */ + public function getCredit_card_token() { + return $this->credit_card_token; + } + + +} \ No newline at end of file diff --git a/lib/PayPal/Api/Item.php b/lib/PayPal/Api/Item.php new file mode 100644 index 0000000..7d547ae --- /dev/null +++ b/lib/PayPal/Api/Item.php @@ -0,0 +1,87 @@ +name = $name; + } + + /** + * Getter for name + */ + public function getName() { + return $this->name; + } + + /** + * Setter for sku + * @param string $sku + */ + public function setSku($sku) { + $this->sku = $sku; + } + + /** + * Getter for sku + */ + public function getSku() { + return $this->sku; + } + + /** + * Setter for price + * @param string $price + */ + public function setPrice($price) { + $this->price = $price; + } + + /** + * Getter for price + */ + public function getPrice() { + return $this->price; + } + + /** + * Setter for currency + * @param string $currency + */ + public function setCurrency($currency) { + $this->currency = $currency; + } + + /** + * Getter for currency + */ + public function getCurrency() { + return $this->currency; + } + + /** + * Setter for quantity + * @param string $quantity + */ + public function setQuantity($quantity) { + $this->quantity = $quantity; + } + + /** + * Getter for quantity + */ + public function getQuantity() { + return $this->quantity; + } + + +} \ No newline at end of file diff --git a/lib/PayPal/Api/ItemList.php b/lib/PayPal/Api/ItemList.php new file mode 100644 index 0000000..2c7fe18 --- /dev/null +++ b/lib/PayPal/Api/ItemList.php @@ -0,0 +1,42 @@ +items = $items; + } + + /** + * Getter for items + */ + public function getItems() { + return $this->items; + } + + /** + * Setter for shipping_address + * @param PayPal\Api\ShippingAddress $shipping_address + */ + public function setShipping_address($shipping_address) { + $this->shipping_address = $shipping_address; + } + + /** + * Getter for shipping_address + */ + public function getShipping_address() { + return $this->shipping_address; + } + + +} \ No newline at end of file diff --git a/lib/PayPal/Api/Link.php b/lib/PayPal/Api/Link.php new file mode 100644 index 0000000..643c95c --- /dev/null +++ b/lib/PayPal/Api/Link.php @@ -0,0 +1,57 @@ +href = $href; + } + + /** + * Getter for href + */ + public function getHref() { + return $this->href; + } + + /** + * Setter for rel + * @param string $rel + */ + public function setRel($rel) { + $this->rel = $rel; + } + + /** + * Getter for rel + */ + public function getRel() { + return $this->rel; + } + + /** + * Setter for method + * @param string $method + */ + public function setMethod($method) { + $this->method = $method; + } + + /** + * Getter for method + */ + public function getMethod() { + return $this->method; + } + + +} \ No newline at end of file diff --git a/lib/PayPal/Api/Payee.php b/lib/PayPal/Api/Payee.php new file mode 100644 index 0000000..ab3cba3 --- /dev/null +++ b/lib/PayPal/Api/Payee.php @@ -0,0 +1,57 @@ +merchant_id = $merchant_id; + } + + /** + * Getter for merchant_id + */ + public function getMerchant_id() { + return $this->merchant_id; + } + + /** + * Setter for email + * @param string $email + */ + public function setEmail($email) { + $this->email = $email; + } + + /** + * Getter for email + */ + public function getEmail() { + return $this->email; + } + + /** + * Setter for phone + * @param string $phone + */ + public function setPhone($phone) { + $this->phone = $phone; + } + + /** + * Getter for phone + */ + public function getPhone() { + return $this->phone; + } + + +} \ No newline at end of file diff --git a/lib/PayPal/Api/Payer.php b/lib/PayPal/Api/Payer.php new file mode 100644 index 0000000..f083087 --- /dev/null +++ b/lib/PayPal/Api/Payer.php @@ -0,0 +1,57 @@ +payment_method = $payment_method; + } + + /** + * Getter for payment_method + */ + public function getPayment_method() { + return $this->payment_method; + } + + /** + * Setter for payer_info + * @param PayPal\Api\PayerInfo $payer_info + */ + public function setPayer_info($payer_info) { + $this->payer_info = $payer_info; + } + + /** + * Getter for payer_info + */ + public function getPayer_info() { + return $this->payer_info; + } + + /** + * Setter for funding_instruments + * @param PayPal\Api\FundingInstrument $funding_instruments + */ + public function setFunding_instruments($funding_instruments) { + $this->funding_instruments = $funding_instruments; + } + + /** + * Getter for funding_instruments + */ + public function getFunding_instruments() { + return $this->funding_instruments; + } + + +} \ No newline at end of file diff --git a/lib/PayPal/Api/PayerInfo.php b/lib/PayPal/Api/PayerInfo.php new file mode 100644 index 0000000..5d6a108 --- /dev/null +++ b/lib/PayPal/Api/PayerInfo.php @@ -0,0 +1,102 @@ +email = $email; + } + + /** + * Getter for email + */ + public function getEmail() { + return $this->email; + } + + /** + * Setter for first_name + * @param string $first_name + */ + public function setFirst_name($first_name) { + $this->first_name = $first_name; + } + + /** + * Getter for first_name + */ + public function getFirst_name() { + return $this->first_name; + } + + /** + * Setter for last_name + * @param string $last_name + */ + public function setLast_name($last_name) { + $this->last_name = $last_name; + } + + /** + * Getter for last_name + */ + public function getLast_name() { + return $this->last_name; + } + + /** + * Setter for payer_id + * @param string $payer_id + */ + public function setPayer_id($payer_id) { + $this->payer_id = $payer_id; + } + + /** + * Getter for payer_id + */ + public function getPayer_id() { + return $this->payer_id; + } + + /** + * Setter for shipping_address + * @param PayPal\Api\Address $shipping_address + */ + public function setShipping_address($shipping_address) { + $this->shipping_address = $shipping_address; + } + + /** + * Getter for shipping_address + */ + public function getShipping_address() { + return $this->shipping_address; + } + + /** + * Setter for phone + * @param string $phone + */ + public function setPhone($phone) { + $this->phone = $phone; + } + + /** + * Getter for phone + */ + public function getPhone() { + return $this->phone; + } + + +} \ No newline at end of file diff --git a/lib/PayPal/Api/Payment.php b/lib/PayPal/Api/Payment.php new file mode 100644 index 0000000..a736b59 --- /dev/null +++ b/lib/PayPal/Api/Payment.php @@ -0,0 +1,244 @@ +id = $id; + } + + /** + * Getter for id + */ + public function getId() { + return $this->id; + } + + /** + * Setter for create_time + * @param string $create_time + */ + public function setCreate_time($create_time) { + $this->create_time = $create_time; + } + + /** + * Getter for create_time + */ + public function getCreate_time() { + return $this->create_time; + } + + /** + * Setter for update_time + * @param string $update_time + */ + public function setUpdate_time($update_time) { + $this->update_time = $update_time; + } + + /** + * Getter for update_time + */ + public function getUpdate_time() { + return $this->update_time; + } + + /** + * Setter for state + * @param string $state + */ + public function setState($state) { + $this->state = $state; + } + + /** + * Getter for state + */ + public function getState() { + return $this->state; + } + + /** + * Setter for intent + * @param string $intent + */ + public function setIntent($intent) { + $this->intent = $intent; + } + + /** + * Getter for intent + */ + public function getIntent() { + return $this->intent; + } + + /** + * Setter for payer + * @param PayPal\Api\Payer $payer + */ + public function setPayer($payer) { + $this->payer = $payer; + } + + /** + * Getter for payer + */ + public function getPayer() { + return $this->payer; + } + + /** + * Setter for transactions + * @param PayPal\Api\Transaction $transactions + */ + public function setTransactions($transactions) { + $this->transactions = $transactions; + } + + /** + * Getter for transactions + */ + public function getTransactions() { + return $this->transactions; + } + + /** + * Setter for redirect_urls + * @param PayPal\Api\RedirectUrls $redirect_urls + */ + public function setRedirect_urls($redirect_urls) { + $this->redirect_urls = $redirect_urls; + } + + /** + * Getter for redirect_urls + */ + public function getRedirect_urls() { + return $this->redirect_urls; + } + + /** + * Setter for links + * @param PayPal\Api\Link $links + */ + public function setLinks($links) { + $this->links = $links; + } + + /** + * Getter for links + */ + public function getLinks() { + return $this->links; + } + + + + /** + * @path /v1/payments/payment + * @method GET + * @param array $params + * array containing the query strings with the + * following values as keys: + * count, + * start_id, + * start_index, + * start_time, + * end_time, + * payee_id, + * sort_by, + * sort_order, + * All other keys in the map are ignored by the SDK + */ + public static function all($params) { + $payLoad = ""; + $allowedParams = array('count' => 1, 'start_id' => 1, 'start_index' => 1, 'start_time' => 1, 'end_time' => 1, 'payee_id' => 1, 'sort_by' => 1, 'sort_order' => 1, ); + + $apiContext = new ApiContext(self::$credential); $call = new Call(); + $json = $call->execute("/v1/payments/payment?" . http_build_query(array_intersect_key($params, $allowedParams)), "GET", $payLoad, $apiContext); + $ret = new PaymentHistory(); + $ret->fromJson($json); + return $ret; + + } + + /** + * @path /v1/payments/payment + * @method POST + + * @param PayPal\Rest\ApiContext $apiContext optional + */ + public function create( $apiContext=null) { + $payLoad = $this->toJSON(); + if($apiContext == null) { + $apiContext = new ApiContext(self::$credential); + } + $call = new Call(); + $json = $call->execute("/v1/payments/payment", "POST", $payLoad, $apiContext); + $this->fromJson($json); + return $this; + } + + /** + * @path /v1/payments/payment/:payment-id + * @method GET + * @param string $paymentid + */ + public static function get( $paymentid) { + if (($paymentid == null) || (strlen($paymentid) <= 0)) { + throw new \InvalidArgumentException("paymentid cannot be null or empty"); + } + $payLoad = ""; + + $apiContext = new ApiContext(self::$credential); $call = new Call(); + $json = $call->execute("/v1/payments/payment/$paymentid", "GET", $payLoad, $apiContext); + $ret = new Payment(); + $ret->fromJson($json); + return $ret; + + } + + /** + * @path /v1/payments/payment/:payment-id/execute + * @method POST + * @param PaymentExecution $payment_execution + * @param PayPal\Rest\ApiContext $apiContext optional + */ + public function execute( $payment_execution, $apiContext=null) { + if ($payment_execution == null) { + throw new \InvalidArgumentException("payment_execution cannot be null"); + } + if ($this->getId() == null) { + throw new \InvalidArgumentException("Id cannot be null"); + } + $payLoad = $payment_execution->toJSON(); + if($apiContext == null) { + $apiContext = new ApiContext(self::$credential); + } + $call = new Call(); + $json = $call->execute("/v1/payments/payment/{$this->getId()}/execute", "POST", $payLoad, $apiContext); + $this->fromJson($json); + return $this; + } + + +} \ No newline at end of file diff --git a/lib/PayPal/Api/PaymentExecution.php b/lib/PayPal/Api/PaymentExecution.php new file mode 100644 index 0000000..b095a96 --- /dev/null +++ b/lib/PayPal/Api/PaymentExecution.php @@ -0,0 +1,42 @@ +payer_id = $payer_id; + } + + /** + * Getter for payer_id + */ + public function getPayer_id() { + return $this->payer_id; + } + + /** + * Setter for transactions + * @param PayPal\Api\Amount $transactions + */ + public function setTransactions($transactions) { + $this->transactions = $transactions; + } + + /** + * Getter for transactions + */ + public function getTransactions() { + return $this->transactions; + } + + +} \ No newline at end of file diff --git a/lib/PayPal/Api/PaymentHistory.php b/lib/PayPal/Api/PaymentHistory.php new file mode 100644 index 0000000..de232c3 --- /dev/null +++ b/lib/PayPal/Api/PaymentHistory.php @@ -0,0 +1,57 @@ +payments = $payments; + } + + /** + * Getter for payments + */ + public function getPayments() { + return $this->payments; + } + + /** + * Setter for count + * @param integer $count + */ + public function setCount($count) { + $this->count = $count; + } + + /** + * Getter for count + */ + public function getCount() { + return $this->count; + } + + /** + * Setter for next_id + * @param string $next_id + */ + public function setNext_id($next_id) { + $this->next_id = $next_id; + } + + /** + * Getter for next_id + */ + public function getNext_id() { + return $this->next_id; + } + + +} \ No newline at end of file diff --git a/lib/PayPal/Api/RedirectUrls.php b/lib/PayPal/Api/RedirectUrls.php new file mode 100644 index 0000000..2a92f8c --- /dev/null +++ b/lib/PayPal/Api/RedirectUrls.php @@ -0,0 +1,42 @@ +return_url = $return_url; + } + + /** + * Getter for return_url + */ + public function getReturn_url() { + return $this->return_url; + } + + /** + * Setter for cancel_url + * @param string $cancel_url + */ + public function setCancel_url($cancel_url) { + $this->cancel_url = $cancel_url; + } + + /** + * Getter for cancel_url + */ + public function getCancel_url() { + return $this->cancel_url; + } + + +} \ No newline at end of file diff --git a/lib/PayPal/Api/Refund.php b/lib/PayPal/Api/Refund.php new file mode 100644 index 0000000..93b14a2 --- /dev/null +++ b/lib/PayPal/Api/Refund.php @@ -0,0 +1,191 @@ +id = $id; + } + + /** + * Getter for id + */ + public function getId() { + return $this->id; + } + + /** + * Setter for create_time + * @param string $create_time + */ + public function setCreate_time($create_time) { + $this->create_time = $create_time; + } + + /** + * Getter for create_time + */ + public function getCreate_time() { + return $this->create_time; + } + + /** + * Setter for update_time + * @param string $update_time + */ + public function setUpdate_time($update_time) { + $this->update_time = $update_time; + } + + /** + * Getter for update_time + */ + public function getUpdate_time() { + return $this->update_time; + } + + /** + * Setter for state + * @param string $state + */ + public function setState($state) { + $this->state = $state; + } + + /** + * Getter for state + */ + public function getState() { + return $this->state; + } + + /** + * Setter for amount + * @param PayPal\Api\Amount $amount + */ + public function setAmount($amount) { + $this->amount = $amount; + } + + /** + * Getter for amount + */ + public function getAmount() { + return $this->amount; + } + + /** + * Setter for sale_id + * @param string $sale_id + */ + public function setSale_id($sale_id) { + $this->sale_id = $sale_id; + } + + /** + * Getter for sale_id + */ + public function getSale_id() { + return $this->sale_id; + } + + /** + * Setter for capture_id + * @param string $capture_id + */ + public function setCapture_id($capture_id) { + $this->capture_id = $capture_id; + } + + /** + * Getter for capture_id + */ + public function getCapture_id() { + return $this->capture_id; + } + + /** + * Setter for parent_payment + * @param string $parent_payment + */ + public function setParent_payment($parent_payment) { + $this->parent_payment = $parent_payment; + } + + /** + * Getter for parent_payment + */ + public function getParent_payment() { + return $this->parent_payment; + } + + /** + * Setter for description + * @param string $description + */ + public function setDescription($description) { + $this->description = $description; + } + + /** + * Getter for description + */ + public function getDescription() { + return $this->description; + } + + /** + * Setter for links + * @param PayPal\Api\Link $links + */ + public function setLinks($links) { + $this->links = $links; + } + + /** + * Getter for links + */ + public function getLinks() { + return $this->links; + } + + + + /** + * @path /v1/payments/refund/:refund-id + * @method GET + * @param string $refundid + */ + public static function get( $refundid) { + if (($refundid == null) || (strlen($refundid) <= 0)) { + throw new \InvalidArgumentException("refundid cannot be null or empty"); + } + $payLoad = ""; + + $apiContext = new ApiContext(self::$credential); $call = new Call(); + $json = $call->execute("/v1/payments/refund/$refundid", "GET", $payLoad, $apiContext); + $ret = new Refund(); + $ret->fromJson($json); + return $ret; + + } + + +} \ No newline at end of file diff --git a/lib/PayPal/Api/Resource.php b/lib/PayPal/Api/Resource.php new file mode 100644 index 0000000..825384a --- /dev/null +++ b/lib/PayPal/Api/Resource.php @@ -0,0 +1,13 @@ +id = $id; + } + + /** + * Getter for id + */ + public function getId() { + return $this->id; + } + + /** + * Setter for create_time + * @param string $create_time + */ + public function setCreate_time($create_time) { + $this->create_time = $create_time; + } + + /** + * Getter for create_time + */ + public function getCreate_time() { + return $this->create_time; + } + + /** + * Setter for update_time + * @param string $update_time + */ + public function setUpdate_time($update_time) { + $this->update_time = $update_time; + } + + /** + * Getter for update_time + */ + public function getUpdate_time() { + return $this->update_time; + } + + /** + * Setter for state + * @param string $state + */ + public function setState($state) { + $this->state = $state; + } + + /** + * Getter for state + */ + public function getState() { + return $this->state; + } + + /** + * Setter for amount + * @param PayPal\Api\Amount $amount + */ + public function setAmount($amount) { + $this->amount = $amount; + } + + /** + * Getter for amount + */ + public function getAmount() { + return $this->amount; + } + + /** + * Setter for parent_payment + * @param string $parent_payment + */ + public function setParent_payment($parent_payment) { + $this->parent_payment = $parent_payment; + } + + /** + * Getter for parent_payment + */ + public function getParent_payment() { + return $this->parent_payment; + } + + /** + * Setter for links + * @param PayPal\Api\Link $links + */ + public function setLinks($links) { + $this->links = $links; + } + + /** + * Getter for links + */ + public function getLinks() { + return $this->links; + } + + + + /** + * @path /v1/payments/sale/:sale-id + * @method GET + * @param string $saleid + */ + public static function get( $saleid) { + if (($saleid == null) || (strlen($saleid) <= 0)) { + throw new \InvalidArgumentException("saleid cannot be null or empty"); + } + $payLoad = ""; + + $apiContext = new ApiContext(self::$credential); $call = new Call(); + $json = $call->execute("/v1/payments/sale/$saleid", "GET", $payLoad, $apiContext); + $ret = new Sale(); + $ret->fromJson($json); + return $ret; + + } + + /** + * @path /v1/payments/sale/:sale-id/refund + * @method POST + * @param Refund $refund + * @param PayPal\Rest\ApiContext $apiContext optional + */ + public function refund( $refund, $apiContext=null) { + if ($refund == null) { + throw new \InvalidArgumentException("refund cannot be null"); + } + if ($this->getId() == null) { + throw new \InvalidArgumentException("Id cannot be null"); + } + $payLoad = $refund->toJSON(); + if($apiContext == null) { + $apiContext = new ApiContext(self::$credential); + } + $call = new Call(); + $json = $call->execute("/v1/payments/sale/{$this->getId()}/refund", "POST", $payLoad, $apiContext); + $this->fromJson($json); + return $this; + } + + +} \ No newline at end of file diff --git a/lib/PayPal/Api/ShippingAddress.php b/lib/PayPal/Api/ShippingAddress.php new file mode 100644 index 0000000..798df69 --- /dev/null +++ b/lib/PayPal/Api/ShippingAddress.php @@ -0,0 +1,27 @@ +recipient_name = $recipient_name; + } + + /** + * Getter for recipient_name + */ + public function getRecipient_name() { + return $this->recipient_name; + } + + +} \ No newline at end of file diff --git a/lib/PayPal/Api/SubTransaction.php b/lib/PayPal/Api/SubTransaction.php new file mode 100644 index 0000000..4e92a09 --- /dev/null +++ b/lib/PayPal/Api/SubTransaction.php @@ -0,0 +1,72 @@ +sale = $sale; + } + + /** + * Getter for sale + */ + public function getSale() { + return $this->sale; + } + + /** + * Setter for authorization + * @param PayPal\Api\Authorization $authorization + */ + public function setAuthorization($authorization) { + $this->authorization = $authorization; + } + + /** + * Getter for authorization + */ + public function getAuthorization() { + return $this->authorization; + } + + /** + * Setter for refund + * @param PayPal\Api\Refund $refund + */ + public function setRefund($refund) { + $this->refund = $refund; + } + + /** + * Getter for refund + */ + public function getRefund() { + return $this->refund; + } + + /** + * Setter for capture + * @param PayPal\Api\Capture $capture + */ + public function setCapture($capture) { + $this->capture = $capture; + } + + /** + * Getter for capture + */ + public function getCapture() { + return $this->capture; + } + + +} \ No newline at end of file diff --git a/lib/PayPal/Api/Transaction.php b/lib/PayPal/Api/Transaction.php new file mode 100644 index 0000000..f5857a5 --- /dev/null +++ b/lib/PayPal/Api/Transaction.php @@ -0,0 +1,87 @@ +amount = $amount; + } + + /** + * Getter for amount + */ + public function getAmount() { + return $this->amount; + } + + /** + * Setter for payee + * @param PayPal\Api\Payee $payee + */ + public function setPayee($payee) { + $this->payee = $payee; + } + + /** + * Getter for payee + */ + public function getPayee() { + return $this->payee; + } + + /** + * Setter for description + * @param string $description + */ + public function setDescription($description) { + $this->description = $description; + } + + /** + * Getter for description + */ + public function getDescription() { + return $this->description; + } + + /** + * Setter for item_list + * @param PayPal\Api\ItemList $item_list + */ + public function setItem_list($item_list) { + $this->item_list = $item_list; + } + + /** + * Getter for item_list + */ + public function getItem_list() { + return $this->item_list; + } + + /** + * Setter for related_resources + * @param PayPal\Api\SubTransaction $related_resources + */ + public function setRelated_resources($related_resources) { + $this->related_resources = $related_resources; + } + + /** + * Getter for related_resources + */ + public function getRelated_resources() { + return $this->related_resources; + } + + +} \ No newline at end of file diff --git a/lib/PayPal/Auth/OAuthTokenCredential.php b/lib/PayPal/Auth/OAuthTokenCredential.php new file mode 100644 index 0000000..cd28348 --- /dev/null +++ b/lib/PayPal/Auth/OAuthTokenCredential.php @@ -0,0 +1,118 @@ +clientId = $clientId; + $this->clientSecret = $clientSecret; + $this->logger = new \PPLoggingManager(__CLASS__); + } + + /** + * @return the accessToken + */ + public function getAccessToken() { + // Check if Access Token is not null and has not expired. + // The API returns expiry time as a relative time unit + // We use a buffer time when checking for token expiry to account + // for API call delays and any delay between the time the token is + // retrieved and subsequently used + if ($this->accessToken != null && + (time() - $this->tokenCreateTime) > ($this->tokenExpiresIn - self::$expiryBufferTime)) { + $this->accessToken = null; + } + // If accessToken is Null, obtain a new token + if ($this->accessToken == null) { + $this->generateAccessToken(); + } + return $this->accessToken; + } + + /** + * Generates a new access token + */ + private function generateAccessToken() { + return $this->generateOAuthToken(base64_encode($this->clientId . ":" . $this->clientSecret)); + } + + /** + * Generate OAuth type token from Base64Client ID + */ + private function generateOAuthToken($base64ClientID) { + + $headers = array( + "Authorization" => "Basic " . $base64ClientID, + "Accept" => "*/*" + ); + $httpConfiguration = $this->getOAuthHttpConfiguration(); + $httpConfiguration->setHeaders($headers); + + $connection = \PPConnectionManager::getInstance()->getConnection($httpConfiguration); + $res = $connection->execute("grant_type=client_credentials"); + $jsonResponse = json_decode($res, true); + if($jsonResponse == NULL || + !isset($jsonResponse["access_token"]) || !isset($jsonResponse["expires_in"]) ) { + $this->accessToken = NULL; + $this->tokenExpiresIn = NULL; + $this->logger->warning("Could not generate new Access token. Invalid response from server: " . $jsonResponse); + } else { + $this->accessToken = $jsonResponse["access_token"]; + $this->tokenExpiresIn = $jsonResponse["expires_in"]; + } + $this->tokenCreateTime = time(); + return $this->accessToken; + } + + /* + * Get HttpConfiguration object for OAuth API + */ + private function getOAuthHttpConfiguration() { + $configMgr = \PPConfigManager::getInstance(); + + $baseEndpoint = ($configMgr->get("oauth.EndPoint") != '' && !is_array($configMgr->get("oauth.EndPoint"))) ? + $configMgr->get("oauth.EndPoint") : $configMgr->get("service.EndPoint"); + $baseEndpoint = rtrim(trim($baseEndpoint), '/'); + return new \PPHttpConfig($baseEndpoint . "/v1/oauth2/token", "POST"); + } +} diff --git a/lib/PayPal/Common/ArrayUtil.php b/lib/PayPal/Common/ArrayUtil.php new file mode 100644 index 0000000..315a2e4 --- /dev/null +++ b/lib/PayPal/Common/ArrayUtil.php @@ -0,0 +1,19 @@ + $v) { + if(is_int($k)) { + return false; + } + } + return true; + } +} \ No newline at end of file diff --git a/lib/PayPal/Common/Model.php b/lib/PayPal/Common/Model.php new file mode 100644 index 0000000..ff72c52 --- /dev/null +++ b/lib/PayPal/Common/Model.php @@ -0,0 +1,88 @@ +_propMap[$key]; + } + + public function __set($key, $value) { + $this->_propMap[$key] = $value; + } + + public function __isset($key) { + return isset($this->_propMap[$key]); + } + + public function __unset($key) { + unset($this->_propMap[$key]); + } + + + private function _convertToArray($param) { + $ret = array(); + foreach($param as $k => $v) { + if($v instanceof Model ) { + $ret[$k] = $v->toArray(); + } else if (is_array($v)) { + $ret[$k] = $this->_convertToArray($v); + } else { + $ret[$k] = $v; + } + } + return $ret; + } + + public function fromArray($arr) { + + foreach($arr as $k => $v) { + if(is_array($v)) { + $clazz = ReflectionUtil::getPropertyClass(get_class($this), $k); + if(ArrayUtil::isAssocArray($v)) { + $o = new $clazz(); + $o->fromArray($v); + $setterFunc = "set".ucfirst($k); + $this->$setterFunc($o); + } else { + $setterFunc = "set".ucfirst($k); + $arr = array(); + foreach($v as $nk => $nv) { + if(is_array($nv)) { + $o = new $clazz(); + $o->fromArray($nv); + $arr[$nk] = $o; + } else { + $arr[$nk] = $nv; + } + } + $this->$setterFunc($arr); //TODO: Cleaning up any current values in this case. Should be doing this allways + } + }else { + $this->$k = $v; + } + } + } + + public function fromJson($json) { + $this->fromArray(json_decode($json, true)); + } + + public function toArray() { + return $this->_convertToArray($this->_propMap); + } + + public function toJSON() { + return json_encode($this->toArray()); + } +} \ No newline at end of file diff --git a/lib/PayPal/Common/ReflectionUtil.php b/lib/PayPal/Common/ReflectionUtil.php new file mode 100644 index 0000000..3aa0fcd --- /dev/null +++ b/lib/PayPal/Common/ReflectionUtil.php @@ -0,0 +1,73 @@ +getDocComment(), $annots, PREG_PATTERN_ORDER)) { + return NULL; + } + foreach ($annots[1] as $i => $annot) { + $annotations[strtolower($annot)] = empty($annots[2][$i]) ? TRUE : rtrim($annots[2][$i], " \t\n\r)"); + } + + return $annotations; + } +} \ No newline at end of file diff --git a/lib/PayPal/Common/UserAgent.php b/lib/PayPal/Common/UserAgent.php new file mode 100644 index 0000000..2f1e302 --- /dev/null +++ b/lib/PayPal/Common/UserAgent.php @@ -0,0 +1,44 @@ +credential; + } + + public function getrequestId() { + if($this->requestId == null) { + $this->requestId = $this->generaterequestId(); + } + return $this->requestId; + } + + /** + * + * @param PayPal/Api/OAuthTokenCredential $credential + * @param string $requestId + */ + public function __construct($credential, $requestId=null) { + $this->credential = $credential; + $this->requestId = $requestId; + } + + /** + * Generates a unique per request id that + * can be used to set the PayPal-Request-Id header + * that is used for idemptency + * @return string + */ + private function generateRequestId() { + + static $pid = -1; + static $addr = -1; + + if ($pid == -1) { + $pid = getmypid(); + } + if ($addr == -1) { + if(array_key_exists('SERVER_ADDR', $_SERVER)) { + $addr = ip2long($_SERVER['SERVER_ADDR']); + } else { + $addr = php_uname('n'); + } + } + + return $addr . $pid . $_SERVER['REQUEST_TIME'] . mt_rand(0, 0xffff); + } +} diff --git a/lib/PayPal/Rest/Call.php b/lib/PayPal/Rest/Call.php new file mode 100644 index 0000000..2a1fceb --- /dev/null +++ b/lib/PayPal/Rest/Call.php @@ -0,0 +1,59 @@ +logger = new \PPLoggingManager(__CLASS__); + } + + /** + * + * @param string $path + * @param string $data + * @param PayPal/Rest/ApiContext $apiContext + * @param array $headers + */ + public function execute($path, $method, $data='', $apiContext, $headers=array()) { + $configMgr = \PPConfigManager::getInstance(); + + $credential = $apiContext->getCredential(); + if($credential == NULL) { + // Try picking credentials from the config file + $credMgr = \PPCredentialManager::getInstance(); + $credValues = $credMgr->getCredentialObject(); + if(!is_array($credValues)) { + throw new \PPMissingCredentialException("Empty or invalid credentials passed"); + } + $credential = new OAuthTokenCredential($credValues['clientId'], $credValues['clientSecret']); + } + if($credential == NULL || ! ($credential instanceof OAuthTokenCredential) ) { + throw new \PPInvalidCredentialException("Invalid credentials passed"); + } + + $resourceUrl = rtrim( trim($configMgr->get('service.EndPoint')), '/') . $path; + $config = new \PPHttpConfig($resourceUrl, $method); + $headers += array( + 'Content-Type' => 'application/json', + 'User-Agent' => UserAgent::getValue() + ); + if(!is_null($credential) && $credential instanceof OAuthTokenCredential) { + $headers['Authorization'] = "Bearer " . $credential->getAccessToken(); + } + if($method == 'POST' || $method == 'PUT') { + $headers['PayPal-Request-Id'] = $apiContext->getRequestId(); + } + $config->setHeaders($headers); + $connection = new \PPHttpConnection($config); + $response = $connection->execute($data); + $this->logger->fine($response); + + return $response; + } +} diff --git a/lib/PayPal/Rest/IResource.php b/lib/PayPal/Rest/IResource.php new file mode 100644 index 0000000..395586c --- /dev/null +++ b/lib/PayPal/Rest/IResource.php @@ -0,0 +1,7 @@ + + + + + + tests + + + + + + + + + + ./lib + + + + + \ No newline at end of file diff --git a/sample/README.md b/sample/README.md new file mode 100644 index 0000000..dfffbfe --- /dev/null +++ b/sample/README.md @@ -0,0 +1,14 @@ +Rest API Samples +=================== + + +This sample project is a simple web app that you can explore to understand what the payment APIs can do for you. To try out the sample, run `composer update` from the samples folder and you are all set. + + +The sample comes pre-configured with a test account but in case you need to try them against your account, you must + + * Obtain your client id and client secret from the developer portal + * Update the sdk_config.ini file with your new client id and secret. + + +If you are looking for a full fledged application that uses the new RESTful APIs, check out the Pizza store sample app at https://github.com/paypal/rest-api-sample-app-php diff --git a/sample/bootstrap.php b/sample/bootstrap.php new file mode 100644 index 0000000..3d8f23c --- /dev/null +++ b/sample/bootstrap.php @@ -0,0 +1,50 @@ +::setCredential($cred) calls that +// you see in the samples. +$cred = new OAuthTokenCredential( + $configManager->get('acct1.ClientId'), + $configManager->get('acct1.ClientSecret')); + + +/** + * ### getBaseUrl function + * // utility function that returns base url for + * // determining return/cancel urls + * @return string + */ +function getBaseUrl() { + + $protocol = 'http'; + if ($_SERVER['SERVER_PORT'] == 443 || (!empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on')) { + $protocol .= 's'; + $protocol_port = $_SERVER['SERVER_PORT']; + } else { + $protocol_port = 80; + } + + $host = $_SERVER['HTTP_HOST']; + $port = $_SERVER['SERVER_PORT']; + $request = $_SERVER['PHP_SELF']; + return dirname($protocol . '://' . $host . ($port == $protocol_port ? '' : ':' . $port) . $request); +} diff --git a/sample/composer.json b/sample/composer.json new file mode 100644 index 0000000..f3c60bf --- /dev/null +++ b/sample/composer.json @@ -0,0 +1,14 @@ +{ + "name": "paypal/rest-api-sdk-sample-php", + "description": "Samples using PayPal's REST API SDK for PHP", + "homepage": "https://github.com/paypal/rest-api-sdk-php", + "config": { + "require-all": true + }, + "require": { + "php": ">=5.3.0", + "ext-curl": "*", + "ext-json": "*", + "paypal/rest-api-sdk-php" : "0.5.*" + } +} diff --git a/sample/images/edt-format-source-button.png b/sample/images/edt-format-source-button.png new file mode 100644 index 0000000000000000000000000000000000000000..88cc504dcfcfc5ce468ce8a539f125e0d98afc28 GIT binary patch literal 173 zcmeAS@N?(olHy`uVBq!ia0vp^(m*W9!3HD`$b`lLsS-~Y#}JRsG^}LITGZZ}nS?zRpg2 zG*vxAQjyt%QTaytiG~UKn%^Wf+XR^w+W}Qc4Tx0C)j~RL^S@K@|QrZmG~B2wH0nvUrdpNm;9CMbtL^5n^i$+aIn^?(HA4aZWV5ov6ELTdbo0FI&wK{O>*+w4vx20?>!`FrQsdJlnHR>OPy zcd~b_n$otK2Za4V;76L-DzNVtaSB-y0*E}{p()372;bw_^6ZZ}PI-92wGS&j#91PI zKs7DSe@(bk%_Y-7gGe}(^>I=@oY#w#*Bu9GZf3^F5WP>3rn}7Ut74&?PWBFvy`A)a zPP5)V!Xd&78LdA?xQ(9mjMYElVd13a#D+Z_7&Y|xU=_C-srWU*6kiZcC!$nw*)9$7 zn6CX+@=AhmkT}X@VSsa5NKe;HZuq)~1$`#h6R+ZTR#D-3j}vF!)ZOnz+5)dI4jl{{ z44Mr{P!L4~VVJN`K!!XTF*LGrKO?IK8z<8w`3e3jI8lUGNUta*C8 zn(P`s>{pjD=7Kek#B;Fw@hxAK%$F&Q6vg9J^Xf~4by_hu-=A!MJ3Znq&n~srbFGPs zH&&aMXZ>nO`|hf|ljc?VPhR!${AbO?W8x_>CU%PFA&Hm8F7cAsOREdwU~R_;ot1_u z(ruCYB-LPGn!NQdT|ZlRy+(fw^-+`=%+gee_kY4FWHg<*4sZI8+sFJD270UUORdLHO0nA4V) z%{fwsET5CQ>B?eK%uw4yQc~9?*JVo2}ze(;aRcp*ceL#HUJSllrgm5wQKR zQu+C;QrUh^8rFfA`ftFz{YAidi-`aL010qNS#tmY3ljhU3ljkVnw%H_00U@AL_t(Y z4ZW6aNK;`H$B&~Ap}VO~h>@6POoMXLJ}e{|y*Nq{g3Pj4Sb-$Lpit|BLN8Pb1tlp& zF3bYod=5;#V1l#knIi(Q;2^t^*?AA(D^E2Rk=2r!(fvl{8b4sDn zuivEiWgSlWyd9W^U${u?*PCd_K8f2`Xa{yF8$=x8LM)4_QKjpqKk; zZP4olM{%LQrtIJ(`Oq?$hnZgT$w4ud3=EGOF5GXohj?`W36M2#dZER6+OyBRJw!fv zWdzD*mDEx|Lzmms*!{{z*MDPc$`5&Kj}=SRF<1l3pVCD|B+-GuxS_GD&jyh&tYu;@ zYRGO*)J70iBfVXfcU|^KIKmifpQu5gsCG7jq-ySTzBJ7(@%jj>MmZlk&%lPn^>Kb> z9A2XaY7q<>I!45gQ5=t63|O=(Ik~?8Mq6*em5S0;Rf}4riwvwt{NjhFX1LG-t0v5< zQJI*OoRkPxPn5!#>o$~F&8l&fi(04|g{9KV024FcIbZMw%3p&IhC z(lv8L&1jwkdg~uE(%q<88An=4;S$*|GflDV_vsQm_QVo~H&NA0?>S(gF*d zD%umDFKgHmXz#8aK@wH7Y5?@L_YXpDg%g^3+;Je(q`Y;s$lYS(5wO}Z82AX)O;2Iu z)3jy^YSJcx=Gja&Z_DI2a!EpHkymY=lra6{CsaRZgXcpZ$farx$((?i(M>$F#6wHG zt~_k_t35XKEeOBhrmF``N2=hN*BAGglzFH{cYq9Rsxb{Uy~I&5w;12CQ}jt9jFMNf zX~}wFw$If;G1yq~Wtd_MJQ>CDq~7UK-W^`gFY$k@g7Q#<^rG5Q_r~K_97R@hsLpZJ z3#_TGWnwOBkRG$5Hl0W4k2&~W`vQiu_4n*^td+=;G?!^9oX~dtlBdX;FF{x}(vdC) zp-9|Oe&cbcskyt)q6I`iRe6cO?)-7-utOmR(LBm=A4g1O%PxSxFT-;_nKFohySs)U@%ipc+8{%#QrEdl@e59Dvt&lEN8iT4x$0000 + + + +PayPal REST API Samples + + + +
+

PayPal REST API Samples

+
+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Payment with a credit cardExecuteSource
Payment with a PayPal AccountExecuteSource
Get Payment DetailsExecuteSource
Get Payment HistoryExecuteSource
Get Sale DetailsExecuteSource
Refund a PaymentExecuteSource
Save a credit cardExecuteSource
Retrieve saved credit cardExecuteSource
Payment with saved credit cardExecuteSource
+ + \ No newline at end of file diff --git a/sample/payments/CreatePayment.php b/sample/payments/CreatePayment.php new file mode 100644 index 0000000..562a70d --- /dev/null +++ b/sample/payments/CreatePayment.php @@ -0,0 +1,111 @@ +setLine1("3909 Witmer Road"); +$addr->setLine2("Niagara Falls"); +$addr->setCity("Niagara Falls"); +$addr->setState("NY"); +$addr->setPostal_code("14305"); +$addr->setCountry_code("US"); +$addr->setPhone("716-298-1822"); + +// ### CreditCard +// A resource representing a credit card that can be +// used to fund a payment. +$card = new CreditCard(); +$card->setType("visa"); +$card->setNumber("4417119669820331"); +$card->setExpire_month("11"); +$card->setExpire_year("2019"); +$card->setCvv2("012"); +$card->setFirst_name("Joe"); +$card->setLast_name("Shopper"); +$card->setBilling_address($addr); + +// ### FundingInstrument +// A resource representing a Payer's funding instrument. +// Use a Payer ID (A unique identifier of the payer generated +// and provided by the facilitator. This is required when +// creating or using a tokenized funding instrument) +// and the `CreditCardDetails` +$fi = new FundingInstrument(); +$fi->setCredit_card($card); + +// ### Payer +// A resource representing a Payer that funds a payment +// Use the List of `FundingInstrument` and the Payment Method +// as 'credit_card' +$payer = new Payer(); +$payer->setPayment_method("credit_card"); +$payer->setFunding_instruments(array($fi)); + +// ### Amount +// Let's you specify a payment amount. +$amount = new Amount(); +$amount->setCurrency("USD"); +$amount->setTotal("1.00"); + +// ### Transaction +// A transaction defines the contract of a +// payment - what is the payment for and who +// is fulfilling it. Transaction is created with +// a `Payee` and `Amount` types +$transaction = new Transaction(); +$transaction->setAmount($amount); +$transaction->setDescription("This is the payment description."); + +// ### Payment +// A Payment Resource; create one using +// the above types and intent as 'sale' +$payment = new Payment(); +$payment->setIntent("sale"); +$payment->setPayer($payer); +$payment->setTransactions(array($transaction)); + +// ### Api Context +// Pass in a `ApiContext` object to authenticate +// the call and to send a unique request id +// (that ensures idempotency). The SDK generates +// a request id if you do not pass one explicitly. +$apiContext = new ApiContext($cred, 'Request' . time()); + +// ### Create Payment +// Create a payment by posting to the APIService +// using a valid ApiContext +// The return object contains the status; +try { + $payment->create($apiContext); +} catch (\PPConnectionException $ex) { + echo "Exception: " . $ex->getMessage() . PHP_EOL; + var_dump($ex->getData()); + exit(1); +} +?> + + +
+ Created payment: + getId();?> +
+
toArray());?>
+ Back + + diff --git a/sample/payments/CreatePaymentUsingPayPal.php b/sample/payments/CreatePaymentUsingPayPal.php new file mode 100644 index 0000000..8467c15 --- /dev/null +++ b/sample/payments/CreatePaymentUsingPayPal.php @@ -0,0 +1,93 @@ +setPayment_method("paypal"); + +// ### Amount +// Let's you specify a payment amount. +$amount = new Amount(); +$amount->setCurrency("USD"); +$amount->setTotal("1.00"); + +// ### Transaction +// A transaction defines the contract of a +// payment - what is the payment for and who +// is fulfilling it. Transaction is created with +// a `Payee` and `Amount` types +$transaction = new Transaction(); +$transaction->setAmount($amount); +$transaction->setDescription("This is the payment description."); + +// ### Redirect urls +// Set the urls that the buyer must be redirected to after +// payment approval/ cancellation. +$baseUrl = getBaseUrl(); +$redirectUrls = new RedirectUrls(); +$redirectUrls->setReturn_url("$baseUrl/ExecutePayment.php?success=true"); +$redirectUrls->setCancel_url("$baseUrl/ExecutePayment.php?success=false"); + +// ### Payment +// A Payment Resource; create one using +// the above types and intent as 'sale' +$payment = new Payment(); +$payment->setIntent("sale"); +$payment->setPayer($payer); +$payment->setRedirect_urls($redirectUrls); +$payment->setTransactions(array($transaction)); + +// ### Api Context +// Pass in a `ApiContext` object to authenticate +// the call and to send a unique request id +// (that ensures idempotency). The SDK generates +// a request id if you do not pass one explicitly. +$apiContext = new ApiContext($cred, 'Request' . time()); + +// ### Create Payment +// Create a payment by posting to the APIService +// using a valid apiContext +// The return object contains the status and the +// url to which the buyer must be redirected to +// for payment approval +try { + $payment->create($apiContext); +} catch (\PPConnectionException $ex) { + echo "Exception: " . $ex->getMessage() . PHP_EOL; + var_dump($ex->getData()); + exit(1); +} + +// ### Redirect buyer to paypal +// Retrieve buyer approval url from the `payment` object. +foreach($payment->getLinks() as $link) { + if($link->getRel() == 'approval_url') { + $redirectUrl = $link->getHref(); + } +} +// It is not really a great idea to store the payment id +// in the session. In a real world app, please store the +// payment id in a database. +$_SESSION['paymentId'] = $payment->getId(); +if(isset($redirectUrl)) { + header("Location: $redirectUrl"); + exit; +} diff --git a/sample/payments/CreatePaymentUsingSavedCard.php b/sample/payments/CreatePaymentUsingSavedCard.php new file mode 100644 index 0000000..5994c7c --- /dev/null +++ b/sample/payments/CreatePaymentUsingSavedCard.php @@ -0,0 +1,96 @@ +setCredit_card_id($creditCardId); + +// ### FundingInstrument +// A resource representing a Payer's funding instrument. +// Use a Payer ID (A unique identifier of the payer generated +// and provided by the facilitator. This is required when +// creating or using a tokenized funding instrument) +// and the `CreditCardDetails` +$fi = new FundingInstrument(); +$fi->setCredit_card_token($creditCardToken); + +// ### Payer +// A resource representing a Payer that funds a payment +// Use the List of `FundingInstrument` and the Payment Method +// as 'credit_card' +$payer = new Payer(); +$payer->setPayment_method("credit_card"); +$payer->setFunding_instruments(array($fi)); + +// ### Amount +// Let's you specify a payment amount. +$amount = new Amount(); +$amount->setCurrency("USD"); +$amount->setTotal("1.00"); + +// ### Transaction +// A transaction defines the contract of a +// payment - what is the payment for and who +// is fulfilling it. Transaction is created with +// a `Payee` and `Amount` types +$transaction = new Transaction(); +$transaction->setAmount($amount); +$transaction->setDescription("This is the payment description."); + +// ### Payment +// A Payment Resource; create one using +// the above types and intent as 'sale' +$payment = new Payment(); +$payment->setIntent("sale"); +$payment->setPayer($payer); +$payment->setTransactions(array($transaction)); + +// ### Api Context +// Pass in a `ApiContext` object to authenticate +// the call and to send a unique request id +// (that ensures idempotency). The SDK generates +// a request id if you do not pass one explicitly. +$apiContext = new ApiContext($cred, 'Request' . time()); + +// ###Create Payment +// Create a payment by posting to the APIService +// using a valid apiContext +// The return object contains the status; +try { + $payment->create($apiContext); +} catch (\PPConnectionException $ex) { + echo "Exception: " . $ex->getMessage() . PHP_EOL; + var_dump($ex->getData()); + exit(1); +} +?> + + +
+ Created payment: + getId();?> +
+
toArray());?>
+ Back + + \ No newline at end of file diff --git a/sample/payments/ExecutePayment.php b/sample/payments/ExecutePayment.php new file mode 100644 index 0000000..45224fd --- /dev/null +++ b/sample/payments/ExecutePayment.php @@ -0,0 +1,47 @@ +/execute'. + +require __DIR__ . '/../bootstrap.php'; +use PayPal\Api\ExecutePayment; +use PayPal\Api\Payment; +use PayPal\Api\PaymentExecution; +use PayPal\Rest\ApiContext; +session_start(); + +if(isset($_GET['success']) && $_GET['success'] == 'true') { + // ### Api Context + // Pass in a `ApiContext` object to authenticate + // the call and to send a unique request id + // (that ensures idempotency). The SDK generates + // a request id if you do not pass one explicitly. + $apiContext = new ApiContext($cred); + + // Get the payment Object by passing paymentId + // payment id was previously stored in session in + // CreatePaymentUsingPayPal.php + $paymentId = $_SESSION['paymentId']; + $payment = Payment::get($paymentId); + + // PaymentExecution object includes information necessary + // to execute a PayPal account payment. + // The payer_id is added to the request query parameters + // when the user is redirected from paypal back to your site + $execution = new PaymentExecution(); + $execution->setPayer_id($_GET['PayerID']); + + //Execute the payment + $payment->execute($execution, $apiContext); + + echo "
";
+	var_dump($payment->toArray());
+	echo "
Back"; + +} else { + echo "User cancelled payment."; +} \ No newline at end of file diff --git a/sample/payments/GetPayment.php b/sample/payments/GetPayment.php new file mode 100644 index 0000000..97415ca --- /dev/null +++ b/sample/payments/GetPayment.php @@ -0,0 +1,39 @@ +getMessage() . PHP_EOL; + var_dump($ex->getData()); + exit(1); +} +?> + + +
Retrieving Payment ID:
+
toArray());?>
+ Back + + \ No newline at end of file diff --git a/sample/payments/ListPayments.php b/sample/payments/ListPayments.php new file mode 100644 index 0000000..c11396c --- /dev/null +++ b/sample/payments/ListPayments.php @@ -0,0 +1,42 @@ + 10, 'start_index' => 5)); +} catch (\PPConnectionException $ex) { + echo "Exception:" . $ex->getMessage() . PHP_EOL; + var_dump($ex->getData()); + exit(1); +} +?> + + +
Got getCount(); ?> matching payments
+
toArray());?>
+ Back + + diff --git a/sample/sale/GetSale.php b/sample/sale/GetSale.php new file mode 100644 index 0000000..9ac1697 --- /dev/null +++ b/sample/sale/GetSale.php @@ -0,0 +1,35 @@ +getMessage() . PHP_EOL; + var_dump($ex->getData()); + exit(1); +} +?> + + +
Retrieving sale id:
+
+ Back + + \ No newline at end of file diff --git a/sample/sale/RefundSale.php b/sample/sale/RefundSale.php new file mode 100644 index 0000000..072af6d --- /dev/null +++ b/sample/sale/RefundSale.php @@ -0,0 +1,55 @@ +setCurrency('USD'); +$amt->setTotal('0.01'); + +$refund = new Refund(); +$refund->setAmount($amt); + +$saleId = '3RM92092UW5126232'; + +// ###Sale +// A sale transaction. +// Create a Sale object with the +// given sale transaction id. +$sale = new Sale(); +$sale->setId($saleId); + +// ### Api Context +// Pass in a `ApiContext` object to authenticate +// the call and to send a unique request id +// (that ensures idempotency). The SDK generates +// a request id if you do not pass one explicitly. +$apiContext = new ApiContext($cred, 'Request' . time()); +try { + // Refund the sale + $sale->refund($refund, $apiContext); +} catch (\PPConnectionException $ex) { + echo "Exception:" . $ex->getMessage() . PHP_EOL; + var_dump($ex->getData()); + exit(1); +} +?> + + +
Refunding sale id:
+
+ Back + + \ No newline at end of file diff --git a/sample/sdk_config.ini b/sample/sdk_config.ini new file mode 100644 index 0000000..69de99f --- /dev/null +++ b/sample/sdk_config.ini @@ -0,0 +1,35 @@ +;Account credentials from developer portal +[Account] +acct1.ClientId = EBWKjlELKMYqRNQ6sYvFo64FtaRLRR5BdHEESmha49TM +acct1.ClientSecret = EO422dn3gQLgDbuwqTjzrFgFtaRLRR5BdHEESmha49TM + + +;Connection Information +[Http] +http.ConnectionTimeOut = 30 +http.Retry = 1 +;http.Proxy=http://[username:password]@hostname[:port][/path] + + +;Service Configuration +[Service] +service.EndPoint="https://api.sandbox.paypal.com" +; Uncomment this line for integrating with the live endpoint +; service.EndPoint="https://api.paypal.com" + + +;Logging Information +[Log] + +log.LogEnabled=true + +# When using a relative path, the log file is created +# relative to the .php file that is the entry point +# for this request. You can also provide an absolute +# path here +log.FileName=../PayPal.log + +# Logging level can be one of FINE, INFO, WARN or ERROR +# Logging is most verbose in the 'FINE' level and +# decreases as you proceed towards ERROR +log.LogLevel=FINE \ No newline at end of file diff --git a/sample/source/CreateCreditCard.html b/sample/source/CreateCreditCard.html new file mode 100644 index 0000000..86eaa6f --- /dev/null +++ b/sample/source/CreateCreditCard.html @@ -0,0 +1,48 @@ +CreateCreditCard
<?php

Create Credit Card Sample

+ +

Using the 'vault' API, you can store a +Credit Card securely on PayPal. You can +use a saved Credit Card to process +a payment in the future. +The following code demonstrates how +can save a Credit Card on PayPal using +the Vault API. +API used: POST /v1/vault/credit-card

use PayPal\Rest\ApiContext; + +require __DIR__ . '/../bootstrap.php'; +use PayPal\Api\CreditCard; +use PayPal\Api\Address;

CreditCard

+ +

A resource representing a credit card that can be +used to fund a payment.

$card = new CreditCard(); +$card->setType("visa"); +$card->setNumber("4417119669820331"); +$card->setExpire_month("11"); +$card->setExpire_year("2019"); +$card->setCvv2("012"); +$card->setFirst_name("Joe"); +$card->setLast_name("Shopper");

Api Context

+ +

Pass in a ApiContext object to authenticate +the call and to send a unique request id +(that ensures idempotency). The SDK generates +a request id if you do not pass one explicitly.

$apiContext = new ApiContext($cred, 'Request' . time());

Save card

+ +

Creates the credit card as a resource +in the PayPal vault. The response contains +an 'id' that you can use to refer to it +in the future payments.

try { + $card->create(); +} catch (\PPConnectionException $ex) { + echo "Exception:" . $ex->getMessage() . PHP_EOL; + var_dump($ex->getData()); + exit(1); +} +?> +<html> +<body> + <div>Saved a new credit card with id: <?php echo $card->getId();?></div> + <pre><?php var_dump($card);?></pre> + <a href='../index.html'>Back</a> +</body> +</html>
\ No newline at end of file diff --git a/sample/source/CreatePayment.html b/sample/source/CreatePayment.html new file mode 100644 index 0000000..284662e --- /dev/null +++ b/sample/source/CreatePayment.html @@ -0,0 +1,90 @@ +CreatePayment
<?php

CreatePaymentSample

+ +

This sample code demonstrate how you can process +a payment with a credit card. +API used: /v1/payments/payment

require __DIR__ . '/../bootstrap.php'; +use PayPal\Api\Address; +use PayPal\Api\Amount; +use PayPal\Api\CreditCard; +use PayPal\Api\Payer; +use PayPal\Api\Payment; +use PayPal\Api\FundingInstrument; +use PayPal\Api\Transaction; +use PayPal\Rest\ApiContext;

Address

+ +

Base Address object used as shipping or billing +address in a payment. [Optional]

$addr = new Address(); +$addr->setLine1("3909 Witmer Road"); +$addr->setLine2("Niagara Falls"); +$addr->setCity("Niagara Falls"); +$addr->setState("NY"); +$addr->setPostal_code("14305"); +$addr->setCountry_code("US"); +$addr->setPhone("716-298-1822");

CreditCard

+ +

A resource representing a credit card that can be +used to fund a payment.

$card = new CreditCard(); +$card->setType("visa"); +$card->setNumber("4417119669820331"); +$card->setExpire_month("11"); +$card->setExpire_year("2019"); +$card->setCvv2("012"); +$card->setFirst_name("Joe"); +$card->setLast_name("Shopper"); +$card->setBilling_address($addr);

FundingInstrument

+ +

A resource representing a Payer's funding instrument. +Use a Payer ID (A unique identifier of the payer generated +and provided by the facilitator. This is required when +creating or using a tokenized funding instrument) +and the CreditCardDetails

$fi = new FundingInstrument(); +$fi->setCredit_card($card);

Payer

+ +

A resource representing a Payer that funds a payment +Use the List of FundingInstrument and the Payment Method +as 'credit_card'

$payer = new Payer(); +$payer->setPayment_method("credit_card"); +$payer->setFunding_instruments(array($fi));

Amount

+ +

Let's you specify a payment amount.

$amount = new Amount(); +$amount->setCurrency("USD"); +$amount->setTotal("1.00");

Transaction

+ +

A transaction defines the contract of a +payment - what is the payment for and who +is fulfilling it. Transaction is created with +a Payee and Amount types

$transaction = new Transaction(); +$transaction->setAmount($amount); +$transaction->setDescription("This is the payment description.");

Payment

+ +

A Payment Resource; create one using +the above types and intent as 'sale'

$payment = new Payment(); +$payment->setIntent("sale"); +$payment->setPayer($payer); +$payment->setTransactions(array($transaction));

Api Context

+ +

Pass in a ApiContext object to authenticate +the call and to send a unique request id +(that ensures idempotency). The SDK generates +a request id if you do not pass one explicitly.

$apiContext = new ApiContext($cred, 'Request' . time());

Create Payment

+ +

Create a payment by posting to the APIService +using a valid ApiContext +The return object contains the status;

try { + $payment->create($apiContext); +} catch (\PPConnectionException $ex) { + echo "Exception: " . $ex->getMessage() . PHP_EOL; + <pre><?php var_dump($card);?></pre> + exit(1); +} +?> +<html> +<body> + <div> + Created payment: + <?php echo $payment->getId();?> + </div> + <pre><?php var_dump($payment->toArray());?></pre> + <a href='../index.html'>Back</a> +</body> +</html>
diff --git a/sample/source/CreatePaymentUsingPayPal.html b/sample/source/CreatePaymentUsingPayPal.html new file mode 100644 index 0000000..7a03153 --- /dev/null +++ b/sample/source/CreatePaymentUsingPayPal.html @@ -0,0 +1,72 @@ +CreatePaymentUsingPayPal
<?php

Create Payment using PayPal as payment method

+ +

This sample code demonstrates how you can process a +PayPal Account based Payment. +API used: /v1/payments/payment

require __DIR__ . '/../bootstrap.php'; +use PayPal\Api\Address; +use PayPal\Api\Amount; +use PayPal\Api\Payer; +use PayPal\Api\Payment; +use PayPal\Api\FundingInstrument; +use PayPal\Api\RedirectUrls; +use PayPal\Api\Transaction; +use PayPal\Rest\ApiContext; +session_start();

Payer

+ +

A resource representing a Payer that funds a payment +Use the List of FundingInstrument and the Payment Method +as 'credit_card'

$payer = new Payer(); +$payer->setPayment_method("paypal");

Amount

+ +

Let's you specify a payment amount.

$amount = new Amount(); +$amount->setCurrency("USD"); +$amount->setTotal("1.00");

Transaction

+ +

A transaction defines the contract of a +payment - what is the payment for and who +is fulfilling it. Transaction is created with +a Payee and Amount types

$transaction = new Transaction(); +$transaction->setAmount($amount); +$transaction->setDescription("This is the payment description.");

Redirect urls

+ +

Set the urls that the buyer must be redirected to after +payment approval/ cancellation.

$baseUrl = getBaseUrl(); +$redirectUrls = new RedirectUrls(); +$redirectUrls->setReturn_url("$baseUrl/ExecutePayment.php?success=true"); +$redirectUrls->setCancel_url("$baseUrl/ExecutePayment.php?success=false");

Payment

+ +

A Payment Resource; create one using +the above types and intent as 'sale'

$payment = new Payment(); +$payment->setIntent("sale"); +$payment->setPayer($payer); +$payment->setRedirect_urls($redirectUrls); +$payment->setTransactions(array($transaction));

Api Context

+ +

Pass in a ApiContext object to authenticate +the call and to send a unique request id +(that ensures idempotency). The SDK generates +a request id if you do not pass one explicitly.

$apiContext = new ApiContext($cred, 'Request' . time());

Create Payment

+ +

Create a payment by posting to the APIService +using a valid apiContext +The return object contains the status and the +url to which the buyer must be redirected to +for payment approval

try { + $payment->create($apiContext); +} catch (\PPConnectionException $ex) { + echo "Exception: " . $ex->getMessage() . PHP_EOL; + var_dump($ex->getData()); + exit(1); +}

Redirect buyer to paypal

+ +

Retrieve buyer approval url from the payment object.

foreach($payment->getLinks() as $link) { + if($link->getRel() == 'approval_url') { + $redirectUrl = $link->getHref(); + } +}

It is not really a great idea to store the payment id +in the session. In a real world app, please store the +payment id in a database.

$_SESSION['paymentId'] = $payment->getId(); +if(isset($redirectUrl)) { + header("Location: $redirectUrl"); + exit; +}
\ No newline at end of file diff --git a/sample/source/CreatePaymentUsingSavedCard.html b/sample/source/CreatePaymentUsingSavedCard.html new file mode 100644 index 0000000..b4d90d0 --- /dev/null +++ b/sample/source/CreatePaymentUsingSavedCard.html @@ -0,0 +1,77 @@ +CreatePaymentUsingSavedCard
<?php

Create payment using a saved credit card

+ +

This sample code demonstrates how you can process a +Payment using a previously saved credit card. +API used: /v1/payments/payment

require __DIR__ . '/../bootstrap.php'; +use PayPal\Api\Address; +use PayPal\Api\Amount; +use PayPal\Api\CreditCard; +use PayPal\Api\CreditCardToken; +use PayPal\Api\Payer; +use PayPal\Api\Payment; +use PayPal\Api\FundingInstrument; +use PayPal\Api\RedirectUrls; +use PayPal\Api\Transaction; +use PayPal\Auth\OAuthTokenCredential; +use PayPal\Rest\ApiContext;

Credit card token

+ +

Saved credit card id from a previous call to +CreateCreditCard.php

$creditCardId = 'CARD-5BT058015C739554AKE2GCEI'; +$creditCardToken = new CreditCardToken(); +$creditCardToken->setCredit_card_id($creditCardId);

FundingInstrument

+ +

A resource representing a Payer's funding instrument. +Use a Payer ID (A unique identifier of the payer generated +and provided by the facilitator. This is required when +creating or using a tokenized funding instrument) +and the CreditCardDetails

$fi = new FundingInstrument(); +$fi->setCredit_card_token($creditCardToken);

Payer

+ +

A resource representing a Payer that funds a payment +Use the List of FundingInstrument and the Payment Method +as 'credit_card'

$payer = new Payer(); +$payer->setPayment_method("credit_card"); +$payer->setFunding_instruments(array($fi));

Amount

+ +

Let's you specify a payment amount.

$amount = new Amount(); +$amount->setCurrency("USD"); +$amount->setTotal("1.00");

Transaction

+ +

A transaction defines the contract of a +payment - what is the payment for and who +is fulfilling it. Transaction is created with +a Payee and Amount types

$transaction = new Transaction(); +$transaction->setAmount($amount); +$transaction->setDescription("This is the payment description.");

Payment

+ +

A Payment Resource; create one using +the above types and intent as 'sale'

$payment = new Payment(); +$payment->setIntent("sale"); +$payment->setPayer($payer); +$payment->setTransactions(array($transaction));

Api Context

+ +

Pass in a ApiContext object to authenticate +the call and to send a unique request id +(that ensures idempotency). The SDK generates +a request id if you do not pass one explicitly.

$apiContext = new ApiContext($cred, 'Request' . time());

Create Payment

+ +

Create a payment by posting to the APIService +using a valid apiContext +The return object contains the status;

try { + $payment->create($apiContext); +} catch (\PPConnectionException $ex) { + echo "Exception: " . $ex->getMessage() . PHP_EOL; + var_dump($ex->getData()); + exit(1); +} +?> +<html> +<body> + <div> + Created payment: + <?php echo $payment->getId();?> + </div> + <pre><?php var_dump($payment->toArray());?></pre> + <a href='../index.html'>Back</a> +</body> +</html>
\ No newline at end of file diff --git a/sample/source/ExecutePayment.html b/sample/source/ExecutePayment.html new file mode 100644 index 0000000..5f007b7 --- /dev/null +++ b/sample/source/ExecutePayment.html @@ -0,0 +1,40 @@ +ExecutePayment
<?php

Execute Payment Sample

+ +

This sample shows how you can complete +a payment that has been approved by +the buyer by logging into paypal site. +You can optionally update transaction +information by passing in one or more transactions. +API used: POST '/v1/payments/payment//execute'.

require __DIR__ . '/../bootstrap.php'; +use PayPal\Api\ExecutePayment; +use PayPal\Api\Payment; +use PayPal\Api\PaymentExecution; +use PayPal\Rest\ApiContext; +session_start(); + +if(isset($_GET['success']) && $_GET['success'] == 'true') {

Api Context

+ +

Pass in a ApiContext object to authenticate +the call and to send a unique request id +(that ensures idempotency). The SDK generates +a request id if you do not pass one explicitly.

$apiContext = new ApiContext($cred); +

Get the payment Object by passing paymentId +payment id was previously stored in session in +CreatePaymentUsingPayPal.php

$paymentId = $_SESSION['paymentId']; + $payment = Payment::get($paymentId); +

PaymentExecution object includes information necessary +to execute a PayPal account payment. +The payer_id is added to the request query parameters +when the user is redirected from paypal back to your site

$execution = new PaymentExecution(); + $execution->setPayer_id($_GET['PayerID']); + + //Execute the payment + $payment->execute($execution, $apiContext); + + echo "<html><body><pre>"; + var_dump($payment->toArray()); + echo "</pre><a href='../index.html'>Back</a></body></html>"; + +} else { + echo "User cancelled payment."; +}
\ No newline at end of file diff --git a/sample/source/GetCreditCard.html b/sample/source/GetCreditCard.html new file mode 100644 index 0000000..b22c75d --- /dev/null +++ b/sample/source/GetCreditCard.html @@ -0,0 +1,31 @@ +GetCreditCard
<?php

Get Credit Card Sample

+ +

The CreditCard resource allows you to +retrieve previously saved CreditCards, +by sending a GET request to the URI +'/v1/vault/credit-card' +The following code takes you through +the process of retrieving a saved CreditCard

require __DIR__ . '/../bootstrap.php'; +use PayPal\Api\CreditCard;

The cardId can be obtained from a previous save credit +card operation. Use $card->getId()

$cardId = "CARD-5BT058015C739554AKE2GCEI";

Authentication

+ +

Pass in a OAuthTokenCredential object +explicilty to authenticate the call. +If you skip this step, the client id/secret +set in the config file will be used.

CreditCard::setCredential($cred); +/// ### Retrieve card +try { + $card = CreditCard::get($cardId); +} catch (\PPConnectionException $ex) { + echo "Exception: " . $ex->getMessage() . PHP_EOL; + var_dump($ex->getData()); + exit(1); +} +?> +<html> +<body> + <div>Retrieving credit card: <?php echo $cardId;?></div> + <pre><?php var_dump($card);?></pre> + <a href='../index.html'>Back</a> +</body> +</html>
\ No newline at end of file diff --git a/sample/source/GetPayment.html b/sample/source/GetPayment.html new file mode 100644 index 0000000..4805cee --- /dev/null +++ b/sample/source/GetPayment.html @@ -0,0 +1,34 @@ +GetPayment
<?php

GetPaymentSample

+ +

This sample code demonstrate how you can +retrieve a list of all Payment resources +you've created using the Payments API. +Note various query parameters that you can +use to filter, and paginate through the +payments list. +API used: GET /v1/payments/payments

require __DIR__ . '/../bootstrap.php'; +use PayPal\Api\Payment; + +$paymentId = "PAY-0XL713371A312273YKE2GCNI";

Authentication

+ +

Pass in a OAuthTokenCredential object +explicilty to authenticate the call.

Payment::setCredential($cred);

Retrieve payment

+ +

Retrieve the payment object by calling the +static get method +on the Payment class by passing a valid +Payment ID

try { + $payment = Payment::get($paymentId); +} catch (\PPConnectionException $ex) { + echo "Exception:" . $ex->getMessage() . PHP_EOL; + var_dump($ex->getData()); + exit(1); +} +?> +<html> +<body> + <div>Retrieving Payment ID: <?php echo $paymentId;?></div> + <pre><?php var_dump($payment->toArray());?></pre> + <a href='../index.html'>Back</a> +</body> +</html>
\ No newline at end of file diff --git a/sample/source/GetSale.html b/sample/source/GetSale.html new file mode 100644 index 0000000..0c02368 --- /dev/null +++ b/sample/source/GetSale.html @@ -0,0 +1,30 @@ +GetSale
<?php

Get Sale sample

+ +

This sample code demonstrates how you can retrieve +details of completed Sale Transaction. +API used: /v1/payments/sale/{sale-id}

require __DIR__ . '/../bootstrap.php'; +use PayPal\Api\Sale; + +$saleId = '3RM92092UW5126232';

Authentication

+ +

Pass in a OAuthTokenCredential object +explicilty to authenticate the call. +If you skip this step, the client id/secret +set in the config file will be used.

Sale::setCredential($cred); +try {

Retrieve the sale object

+ +

Pass the ID of the sale +transaction from your payment resource.

$sale = Sale::get($saleId); +} catch (\PPConnectionException $ex) { + echo "Exception:" . $ex->getMessage() . PHP_EOL; + var_dump($ex->getData()); + exit(1); +} +?> +<html> +<body> + <div>Retrieving sale id: <?php echo $saleId;?></div> + <pre><?php var_dump($sale);?></pre> + <a href='../index.html'>Back</a> +</body> +</html>
\ No newline at end of file diff --git a/sample/source/ListPayments.html b/sample/source/ListPayments.html new file mode 100644 index 0000000..d6ac87c --- /dev/null +++ b/sample/source/ListPayments.html @@ -0,0 +1,35 @@ +ListPayments
<?php

GetPaymentList

+ +

This sample code demonstrate how you can +retrieve a list of all Payment resources +you've created using the Payments API. +Note various query parameters that you can +use to filter, and paginate through the +payments list. +API used: GET /v1/payments/payments

require __DIR__ . '/../bootstrap.php'; +use PayPal\Api\Payment;

Authentication

+ +

Pass in a OAuthTokenCredential object +explicilty to authenticate the call. +If you skip this step, the client id/secret +set in the config file will be used.

Payment::setCredential($cred);

Retrieve payment

+ +

Retrieve the PaymentHistory object by calling the +static get method on the Payment class, +and pass a Map object that contains +query parameters for paginations and filtering. +Refer the method doc for valid values for keys

try { + $payments = Payment::all(array('count' => 10, 'start_index' => 5)); +} catch (\PPConnectionException $ex) { + echo "Exception:" . $ex->getMessage() . PHP_EOL; + var_dump($ex->getData()); + exit(1); +} +?> +<html> +<body> + <div>Got <?php echo $payments->getCount(); ?> matching payments </div> + <pre><?php var_dump($payments->toArray());?></pre> + <a href='../index.html'>Back</a> +</body> +</html>
\ No newline at end of file diff --git a/sample/source/RefundSale.html b/sample/source/RefundSale.html new file mode 100644 index 0000000..87c2455 --- /dev/null +++ b/sample/source/RefundSale.html @@ -0,0 +1,44 @@ +RefundSale
<?php

Sale Refund Sample

+ +

This sample code demonstrate how you can +process a refund on a sale transaction created +using the Payments API. +API used: /v1/payments/sale/{sale-id}/refund

require __DIR__ . '/../bootstrap.php'; +use PayPal\Api\Amount; +use PayPal\Api\Refund; +use PayPal\Api\Sale; +use PayPal\Rest\ApiContext;

Refund

+ +

Create a refund object indicating +refund amount

$amt = new Amount(); +$amt->setCurrency('USD'); +$amt->setTotal('0.01'); + +$refund = new Refund(); +$refund->setAmount($amt); + +$saleId = '3RM92092UW5126232';

Sale

+ +

A sale transaction. +Create a Sale object with the +given sale transaction id.

$sale = new Sale(); +$sale->setId($saleId);

Api Context

+ +

Pass in a ApiContext object to authenticate +the call and to send a unique request id +(that ensures idempotency). The SDK generates +a request id if you do not pass one explicitly.

$apiContext = new ApiContext($cred, 'Request' . time()); +try {

Refund the sale

$sale->refund($refund, $apiContext); +} catch (\PPConnectionException $ex) { + echo "Exception:" . $ex->getMessage() . PHP_EOL; + var_dump($ex->getData()); + exit(1); +} +?> +<html> +<body> + <div>Refunding sale id: <?php echo $saleId;?></div> + <pre><?php var_dump($sale);?></pre> + <a href='../index.html'>Back</a> +</body> +</html>
\ No newline at end of file diff --git a/sample/source/assets/behavior.js b/sample/source/assets/behavior.js new file mode 100644 index 0000000..c76f978 --- /dev/null +++ b/sample/source/assets/behavior.js @@ -0,0 +1,459 @@ +/*! jQuery v1.7.1 jquery.com | jquery.org/license */ +(function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cv(a){if(!ck[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){cl||(cl=c.createElement("iframe"),cl.frameBorder=cl.width=cl.height=0),b.appendChild(cl);if(!cm||!cl.createElement)cm=(cl.contentWindow||cl.contentDocument).document,cm.write((c.compatMode==="CSS1Compat"?"":"")+""),cm.close();d=cm.createElement(a),cm.body.appendChild(d),e=f.css(d,"display"),b.removeChild(cl)}ck[a]=e}return ck[a]}function cu(a,b){var c={};f.each(cq.concat.apply([],cq.slice(0,b)),function(){c[this]=a});return c}function ct(){cr=b}function cs(){setTimeout(ct,0);return cr=f.now()}function cj(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ci(){try{return new a.XMLHttpRequest}catch(b){}}function cc(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g0){if(c!=="border")for(;g=0===c})}function S(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function K(){return!0}function J(){return!1}function n(a,b,c){var d=b+"defer",e=b+"queue",g=b+"mark",h=f._data(a,d);h&&(c==="queue"||!f._data(a,e))&&(c==="mark"||!f._data(a,g))&&setTimeout(function(){!f._data(a,e)&&!f._data(a,g)&&(f.removeData(a,d,!0),h.fire())},0)}function m(a){for(var b in a){if(b==="data"&&f.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function l(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(k,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNumeric(d)?parseFloat(d):j.test(d)?f.parseJSON(d):d}catch(g){}f.data(a,c,d)}else d=b}return d}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=/-([a-z]|[0-9])/ig,w=/^-ms-/,x=function(a,b){return(b+"").toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=m.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.7.1",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),A.add(a);return this},eq:function(a){a=+a;return a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j0)return;A.fireWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").off("ready")}},bindReady:function(){if(!A){A=e.Callbacks("once memory");if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):I[C.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||D.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw new Error(a)},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,"ms-").replace(v,x)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i1?i.call(arguments,0):b,j.notifyWith(k,e)}}function l(a){return function(c){b[a]=arguments.length>1?i.call(arguments,0):c,--g||j.resolveWith(j,b)}}var b=i.call(arguments,0),c=0,d=b.length,e=Array(d),g=d,h=d,j=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred(),k=j.promise();if(d>1){for(;c
a",d=q.getElementsByTagName("*"),e=q.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=q.getElementsByTagName("input")[0],b={leadingWhitespace:q.firstChild.nodeType===3,tbody:!q.getElementsByTagName("tbody").length,htmlSerialize:!!q.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:q.className!=="t",enctype:!!c.createElement("form").enctype,html5Clone:c.createElement("nav").cloneNode(!0).outerHTML!=="<:nav>",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,b.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,b.optDisabled=!h.disabled;try{delete q.test}catch(s){b.deleteExpando=!1}!q.addEventListener&&q.attachEvent&&q.fireEvent&&(q.attachEvent("onclick",function(){b.noCloneEvent=!1}),q.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),b.radioValue=i.value==="t",i.setAttribute("checked","checked"),q.appendChild(i),k=c.createDocumentFragment(),k.appendChild(q.lastChild),b.checkClone=k.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=i.checked,k.removeChild(i),k.appendChild(q),q.innerHTML="",a.getComputedStyle&&(j=c.createElement("div"),j.style.width="0",j.style.marginRight="0",q.style.width="2px",q.appendChild(j),b.reliableMarginRight=(parseInt((a.getComputedStyle(j,null)||{marginRight:0}).marginRight,10)||0)===0);if(q.attachEvent)for(o in{submit:1,change:1,focusin:1})n="on"+o,p=n in q,p||(q.setAttribute(n,"return;"),p=typeof q[n]=="function"),b[o+"Bubbles"]=p;k.removeChild(q),k=g=h=j=q=i=null,f(function(){var a,d,e,g,h,i,j,k,m,n,o,r=c.getElementsByTagName("body")[0];!r||(j=1,k="position:absolute;top:0;left:0;width:1px;height:1px;margin:0;",m="visibility:hidden;border:0;",n="style='"+k+"border:5px solid #000;padding:0;'",o="
"+""+"
",a=c.createElement("div"),a.style.cssText=m+"width:0;height:0;position:static;top:0;margin-top:"+j+"px",r.insertBefore(a,r.firstChild),q=c.createElement("div"),a.appendChild(q),q.innerHTML="
t
",l=q.getElementsByTagName("td"),p=l[0].offsetHeight===0,l[0].style.display="",l[1].style.display="none",b.reliableHiddenOffsets=p&&l[0].offsetHeight===0,q.innerHTML="",q.style.width=q.style.paddingLeft="1px",f.boxModel=b.boxModel=q.offsetWidth===2,typeof q.style.zoom!="undefined"&&(q.style.display="inline",q.style.zoom=1,b.inlineBlockNeedsLayout=q.offsetWidth===2,q.style.display="",q.innerHTML="
",b.shrinkWrapBlocks=q.offsetWidth!==2),q.style.cssText=k+m,q.innerHTML=o,d=q.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,i={doesNotAddBorder:e.offsetTop!==5,doesAddBorderForTableAndCells:h.offsetTop===5},e.style.position="fixed",e.style.top="20px",i.fixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",i.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,i.doesNotIncludeMarginInBodyOffset=r.offsetTop!==j,r.removeChild(a),q=a=null,f.extend(b,i))});return b}();var j=/^(?:\{.*\}|\[.*\])$/,k=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!m(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c=="string",l=a.nodeType,m=l?f.cache:a,n=l?a[j]:a[j]&&j,o=c==="events";if((!n||!m[n]||!o&&!e&&!m[n].data)&&k&&d===b)return;n||(l?a[j]=n=++f.uuid:n=j),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[n].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[h]:h;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)||(b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,g=b.length;e-1)return!0;return!1},val:function(a){var c,d,e,g=this[0];{if(!!arguments.length){e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}if(g){c=f.valHooks[g.nodeName.toLowerCase()]||f.valHooks[g.type];if(c&&"get"in c&&(d=c.get(g,"value"))!==b)return d;d=g.value;return typeof d=="string"?d.replace(q,""):d==null?"":d}}}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,g=a.selectedIndex,h=[],i=a.options,j=a.type==="select-one";if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var g,h,i,j=a.nodeType;if(!!a&&j!==3&&j!==8&&j!==2){if(e&&c in f.attrFn)return f(a)[c](d);if(typeof a.getAttribute=="undefined")return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);return}if(h&&"set"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,""+d);return d}if(h&&"get"in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g}},removeAttr:function(a,b){var c,d,e,g,h=0;if(b&&a.nodeType===1){d=b.toLowerCase().split(p),g=d.length;for(;h=0}})});var z=/^(?:textarea|input|select)$/i,A=/^([^\.]*)?(?:\.(.+))?$/,B=/\bhover(\.\S+)?\b/,C=/^key/,D=/^(?:mouse|contextmenu)|click/,E=/^(?:focusinfocus|focusoutblur)$/,F=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,G=function(a){var b=F.exec(a);b&&(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b},H=function(a,b){var c=a.attributes||{};return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||(c.id||{}).value===b[2])&&(!b[3]||b[3].test((c["class"]||{}).value))},I=function(a){return f.event.special.hover?a:a.replace(B,"mouseenter$1 mouseleave$1")}; +f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b},i.elem=a),c=f.trim(I(c)).split(" ");for(k=0;k=0&&(h=h.slice(0,-1),k=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,o=h.indexOf(":")<0?"on"+h:"";if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArray(d):[],d.unshift(c),p=f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,m=E.test(s+h)?e:e.parentNode,n=null;for(;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s])}for(l=0;le&&i.push({elem:this,matches:d.slice(e)});for(j=0;j0?this.on(b,null,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0),C.test(b)&&(f.event.fixHooks[b]=f.event.keyHooks),D.test(b)&&(f.event.fixHooks[b]=f.event.mouseHooks)}),function(){function x(a,b,c,e,f,g){for(var h=0,i=e.length;h0){k=j;break}}j=j[a]}e[h]=k}}}function w(a,b,c,e,f,g){for(var h=0,i=e.length;h+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d="sizcache"+(Math.random()+"").replace(".",""),e=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\/g,k=/\r\n/g,l=/\W/;[0,0].sort(function(){i=!1;return 0});var m=function(b,d,e,f){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return e;var i,j,k,l,n,q,r,t,u=!0,v=m.isXML(d),w=[],x=b;do{a.exec(""),i=a.exec(x);if(i){x=i[3],w.push(i[1]);if(i[2]){l=i[3];break}}}while(i);if(w.length>1&&p.exec(b))if(w.length===2&&o.relative[w[0]])j=y(w[0]+w[1],d,f);else{j=o.relative[w[0]]?[d]:m(w.shift(),d);while(w.length)b=w.shift(),o.relative[b]&&(b+=w.shift()),j=y(b,j,f)}else{!f&&w.length>1&&d.nodeType===9&&!v&&o.match.ID.test(w[0])&&!o.match.ID.test(w[w.length-1])&&(n=m.find(w.shift(),d,v),d=n.expr?m.filter(n.expr,n.set)[0]:n.set[0]);if(d){n=f?{expr:w.pop(),set:s(f)}:m.find(w.pop(),w.length===1&&(w[0]==="~"||w[0]==="+")&&d.parentNode?d.parentNode:d,v),j=n.expr?m.filter(n.expr,n.set):n.set,w.length>0?k=s(j):u=!1;while(w.length)q=w.pop(),r=q,o.relative[q]?r=w.pop():q="",r==null&&(r=d),o.relative[q](k,r,v)}else k=w=[]}k||(k=j),k||m.error(q||b);if(g.call(k)==="[object Array]")if(!u)e.push.apply(e,k);else if(d&&d.nodeType===1)for(t=0;k[t]!=null;t++)k[t]&&(k[t]===!0||k[t].nodeType===1&&m.contains(d,k[t]))&&e.push(j[t]);else for(t=0;k[t]!=null;t++)k[t]&&k[t].nodeType===1&&e.push(j[t]);else s(k,e);l&&(m(l,h,e,f),m.uniqueSort(e));return e};m.uniqueSort=function(a){if(u){h=i,a.sort(u);if(h)for(var b=1;b0},m.find=function(a,b,c){var d,e,f,g,h,i;if(!a)return[];for(e=0,f=o.order.length;e":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!l.test(b)){b=b.toLowerCase();for(;e=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(j,"")},TAG:function(a,b){return a[1].replace(j,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||m.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&m.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,"");!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(j,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=m(b[3],null,null,c);else{var g=m.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(o.match.POS.test(b[0])||o.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!m(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return bc[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=o.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||n([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||!!a.nodeName&&a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=m.attr?m.attr(a,c):o.attrHandle[c]?o.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":!f&&m.attr?d!=null:f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=o.setFilters[e];if(f)return f(a,c,b,d)}}},p=o.match.POS,q=function(a,b){return"\\"+(b-0+1)};for(var r in o.match)o.match[r]=new RegExp(o.match[r].source+/(?![^\[]*\])(?![^\(]*\))/.source),o.leftMatch[r]=new RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[r].source.replace(/\\(\d+)/g,q));var s=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(t){s=function(a,b){var c=0,d=b||[];if(g.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var e=a.length;c",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(o.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},o.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(o.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(o.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=m,b=c.createElement("div"),d="__sizzle__";b.innerHTML="

";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){m=function(b,e,f,g){e=e||c;if(!g&&!m.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return s(e.getElementsByTagName(b),f);if(h[2]&&o.find.CLASS&&e.getElementsByClassName)return s(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return s([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return s([],f);if(i.id===h[3])return s([i],f)}try{return s(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var k=e,l=e.getAttribute("id"),n=l||d,p=e.parentNode,q=/^\s*[+~]/.test(b);l?n=n.replace(/'/g,"\\$&"):e.setAttribute("id",n),q&&p&&(e=e.parentNode);try{if(!q||p)return s(e.querySelectorAll("[id='"+n+"'] "+b),f)}catch(r){}finally{l||k.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)m[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}m.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!m.isXML(a))try{if(e||!o.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return m(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="
";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;o.order.splice(1,0,"CLASS"),o.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?m.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:m.contains=function(){return!1},m.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var y=function(a,b,c){var d,e=[],f="",g=b.nodeType?[b]:b;while(d=o.match.PSEUDO.exec(a))f+=d[0],a=a.replace(o.match.PSEUDO,"");a=o.relative[a]?a+"*":a;for(var h=0,i=g.length;h0)for(h=g;h=0:f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h=1;while(g&&g.ownerDocument&&g!==b){for(d=0;d-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(S(c[0])||S(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c);L.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!R[a]?f.unique(e):e,(this.length>1||N.test(d))&&M.test(a)&&(e=e.reverse());return this.pushStack(e,a,P.call(arguments).join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var V="abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",W=/ jQuery\d+="(?:\d+|null)"/g,X=/^\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Z=/<([\w:]+)/,$=/",""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],col:[2,"","
"],area:[1,"",""],_default:[0,"",""]},bh=U(c);bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,"div
","
"]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=f.isFunction(a);return this.each(function(c){f(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f.clean(arguments);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f.clean(arguments));return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function() +{for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(W,""):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!bg[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1>");try{for(var c=0,d=this.length;c1&&l0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d,e,g,h=f.support.html5Clone||!bc.test("<"+a.nodeName)?a.cloneNode(!0):bo(a);if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bk(a,h),d=bl(a),e=bl(h);for(g=0;d[g];++g)e[g]&&bk(d[g],e[g])}if(b){bj(a,h);if(c){d=bl(a),e=bl(h);for(g=0;d[g];++g)bj(d[g],e[g])}}d=e=null;return h},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!_.test(k))k=b.createTextNode(k);else{k=k.replace(Y,"<$1>");var l=(Z.exec(k)||["",""])[1].toLowerCase(),m=bg[l]||bg._default,n=m[0],o=b.createElement("div");b===c?bh.appendChild(o):U(b).appendChild(o),o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=$.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]===""&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&X.test(k)&&o.insertBefore(b.createTextNode(X.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return br.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNumeric(b)?"alpha(opacity="+b*100+")":"",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bq,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bq.test(g)?g.replace(bq,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bz(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(bA=function(a,b){var c,d,e;b=b.replace(bs,"-$1").toLowerCase(),(d=a.ownerDocument.defaultView)&&(e=d.getComputedStyle(a,null))&&(c=e.getPropertyValue(b),c===""&&!f.contains(a.ownerDocument.documentElement,a)&&(c=f.style(a,b)));return c}),c.documentElement.currentStyle&&(bB=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;f===null&&g&&(e=g[b])&&(f=e),!bt.test(f)&&bu.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f||0,f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d));return f===""?"auto":f}),bz=bA||bB,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style&&a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bD=/%20/g,bE=/\[\]$/,bF=/\r?\n/g,bG=/#.*$/,bH=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bI=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bJ=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bK=/^(?:GET|HEAD)$/,bL=/^\/\//,bM=/\?/,bN=/)<[^<]*)*<\/script>/gi,bO=/^(?:select|textarea)/i,bP=/\s+/,bQ=/([?&])_=[^&]*/,bR=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bS=f.fn.load,bT={},bU={},bV,bW,bX=["*/"]+["*"];try{bV=e.href}catch(bY){bV=c.createElement("a"),bV.href="",bV=bV.href}bW=bR.exec(bV.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bS)return bS.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("
").append(c.replace(bN,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bO.test(this.nodeName)||bI.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bF,"\r\n")}}):{name:b.name,value:c.replace(bF,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.on(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?b_(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),b_(a,b);return a},ajaxSettings:{url:bV,isLocal:bJ.test(bW[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":bX},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:bZ(bT),ajaxTransport:bZ(bU),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?cb(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=cc(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.fireWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f.Callbacks("once memory"),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bH.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.add,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bG,"").replace(bL,bW[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bP),d.crossDomain==null&&(r=bR.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bW[1]&&r[2]==bW[2]&&(r[3]||(r[1]==="http:"?80:443))==(bW[3]||(bW[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),b$(bT,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bK.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bM.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bQ,"$1_="+x);d.url=y+(y===d.url?(bM.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bX+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=b$(bU,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){if(s<2)w(-1,z);else throw z}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)ca(g,a[g],c,e);return d.join("&").replace(bD,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var cd=f.now(),ce=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cd++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(ce.test(b.url)||e&&ce.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(ce,l),b.url===j&&(e&&(k=k.replace(ce,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var cf=a.ActiveXObject?function(){for(var a in ch)ch[a](0,1)}:!1,cg=0,ch;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ci()||cj()}:ci,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,cf&&delete ch[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cg,cf&&(ch||(ch={},f(a).unload(cf)),ch[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var ck={},cl,cm,cn=/^(?:toggle|show|hide)$/,co=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cp,cq=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cr;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cu("show",3),a,b,c);for(var g=0,h=this.length;g=i.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),i.animatedProperties[this.prop]=!0;for(b in i.animatedProperties)i.animatedProperties[b]!==!0&&(g=!1);if(g){i.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){h.style["overflow"+b]=i.overflow[a]}),i.hide&&f(h).hide();if(i.hide||i.show)for(b in i.animatedProperties)f.style(h,b,i.orig[b]),f.removeData(h,"fxshow"+b,!0),f.removeData(h,"toggle"+b,!0);d=i.complete,d&&(i.complete=!1,d.call(h))}return!1}i.duration==Infinity?this.now=e:(c=e-this.startTime,this.state=c/i.duration,this.pos=f.easing[i.animatedProperties[this.prop]](this.state,c,0,1,i.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){var a,b=f.timers,c=0;for(;c-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cx.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cx.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cy(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cy(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){var a=this[0];return a?a.style?parseFloat(f.css(a,d,"padding")):this[d]():null},f.fn["outer"+c]=function(a){var b=this[0];return b?b.style?parseFloat(f.css(b,d,a?"margin":"border")):this[d]():null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c],h=e.document.body;return e.document.compatMode==="CSS1Compat"&&g||h&&h["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var i=f.css(e,d),j=parseFloat(i);return f.isNumeric(j)?j:i}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return f})})(window);(function() { + var MAX_FILTER_SIZE, appendSearchNode, buildNav, buildTOCNode, clearFilter, clearHighlight, currentNode$, currentQuery, fileMap, focusCurrentNode, highlightMatch, moveCurrentNode, nav$, searchNodes, searchableNodes, selectNode, selectNodeByDocumentPath, setCurrentNodeExpanded, setTableOfContentsActive, sidenav$, tableOfContents, toc$, toggleTableOfContents, visitCurrentNode; + + tableOfContents = [ + { + "type": "file", + "data": { + "language": { + "nameMatchers": [{}, ".fbp"], + "pygmentsLexer": "php", + "singleLineComment": ["//"], + "name": "PHP" + }, + "sourcePath": "c:\\xcommerce\\repo\\PayPalSDKs\\rest-api-sdk-php\\sample\\sale\\GetSale.php", + "projectPath": "GetSale.php", + "targetPath": "GetSale", + "title": "GetSale" + }, + "depth": 1, + "outline": [ + { + "type": "heading", + "data": { + "level": 1, + "title": "Get Sale sample", + "slug": "get-sale-sample" + }, + "depth": 1, + "children": [ + { + "type": "heading", + "data": { + "level": 3, + "title": "Authentication", + "slug": "authentication" + }, + "depth": 3 + }, { + "type": "heading", + "data": { + "level": 3, + "title": "Retrieve the sale object", + "slug": "retrieve-the-sale-object" + }, + "depth": 3 + } + ] + } + ] + }, { + "type": "file", + "data": { + "language": { + "nameMatchers": [{}, ".fbp"], + "pygmentsLexer": "php", + "singleLineComment": ["//"], + "name": "PHP" + }, + "sourcePath": "c:\\xcommerce\\repo\\PayPalSDKs\\rest-api-sdk-php\\sample\\sale\\RefundSale.php", + "projectPath": "RefundSale.php", + "targetPath": "RefundSale", + "title": "RefundSale" + }, + "depth": 1, + "outline": [ + { + "type": "heading", + "data": { + "level": 1, + "title": "Sale Refund Sample", + "slug": "sale-refund-sample" + }, + "depth": 1, + "children": [ + { + "type": "heading", + "data": { + "level": 3, + "title": "Refund", + "slug": "refund" + }, + "depth": 3 + }, { + "type": "heading", + "data": { + "level": 3, + "title": "Sale", + "slug": "sale" + }, + "depth": 3 + }, { + "type": "heading", + "data": { + "level": 3, + "title": "Api Context", + "slug": "api-context" + }, + "depth": 3 + } + ] + } + ] + } + ]; + + nav$ = null; + + toc$ = null; + + sidenav$ = null; + + setTableOfContentsActive = function(active) { + var html$; + html$ = $('html'); + if (active) { + nav$.addClass('active'); + return html$.addClass('popped'); + } else { + nav$.removeClass('active'); + return html$.removeClass('popped'); + } + }; + + toggleTableOfContents = function() { + return setTableOfContentsActive(!nav$.hasClass('active')); + }; + + currentNode$ = null; + + focusCurrentNode = function() { + var currentNodeBottom, currentNodeTop; + currentNodeTop = currentNode$.offset().top - toc$.children(':visible').first().offset().top; + currentNodeBottom = currentNodeTop + currentNode$.children('.label').height(); + if (currentNodeTop < toc$.scrollTop()) { + toc$.scrollTop(currentNodeTop); + } + if (currentNodeBottom > toc$.scrollTop() + toc$.height()) { + return toc$.scrollTop(currentNodeBottom - toc$.height()); + } + }; + + setCurrentNodeExpanded = function(expanded) { + var parents$; + if (expanded) { + currentNode$.addClass('expanded'); + } else { + if (currentNode$.hasClass('expanded')) { + currentNode$.removeClass('expanded'); + } else { + parents$ = currentNode$.parents('li'); + if (parents$.length > 0) { + selectNode(parents$.first()); + } + } + } + return focusCurrentNode(); + }; + + selectNode = function(newNode$) { + currentNode$.removeClass('selected'); + newNode$.addClass('selected'); + currentNode$ = newNode$; + return focusCurrentNode(); + }; + + selectNodeByDocumentPath = function(documentPath, headerSlug) { + var link, urlChunks, _i, _len, _ref; + if (headerSlug == null) { + headerSlug = null; + } + currentNode$ = fileMap[documentPath]; + if (headerSlug) { + _ref = currentNode$.find('.outline a'); + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + link = _ref[_i]; + urlChunks = $(link).attr('href').split('#'); + if (urlChunks[1] === headerSlug) { + currentNode$ = $(link).parents('li').first(); + break; + } + } + } + currentNode$.addClass('selected expanded'); + currentNode$.parents('li').addClass('expanded'); + return focusCurrentNode(); + }; + + moveCurrentNode = function(up) { + var i, newIndex, node, visibleNodes$, _i, _len; + visibleNodes$ = toc$.find('li:visible:not(.filtered)'); + newIndex = 0; + for (i = _i = 0, _len = visibleNodes$.length; _i < _len; i = ++_i) { + node = visibleNodes$[i]; + if (node === currentNode$[0]) { + newIndex = up ? i - 1 : i + 1; + if (newIndex < 0) { + newIndex = 0; + } + if (newIndex > visibleNodes$.length - 1) { + newIndex = visibleNodes$.length - 1; + } + break; + } + } + return selectNode($(visibleNodes$[newIndex])); + }; + + visitCurrentNode = function() { + var labelLink$; + labelLink$ = currentNode$.children('a.label'); + if (labelLink$.length > 0) { + return window.location = labelLink$.attr('href'); + } + }; + + MAX_FILTER_SIZE = 10; + + searchableNodes = []; + + appendSearchNode = function(node$) { + var text$; + text$ = node$.find('> .label .text'); + return searchableNodes.push([text$.text().toLowerCase(), node$, text$]); + }; + + currentQuery = ''; + + searchNodes = function(queryString) { + var c, filtered, matched, matcher, nodeInfo, p, _i, _j, _k, _len, _len1, _len2, _results; + queryString = queryString.toLowerCase().replace(/\s+/, ''); + if (queryString === currentQuery) { + return; + } + currentQuery = queryString; + if (queryString === '') { + return clearFilter(); + } + matcher = new RegExp(((function() { + var _i, _len, _results; + _results = []; + for (_i = 0, _len = queryString.length; _i < _len; _i++) { + c = queryString[_i]; + _results.push(c.replace(/[-[\]{}()*+?.,\\^$|#\s]/, "\\$&")); + } + return _results; + })()).join('.*')); + matched = []; + filtered = []; + for (_i = 0, _len = searchableNodes.length; _i < _len; _i++) { + nodeInfo = searchableNodes[_i]; + if (matcher.test(nodeInfo[0])) { + matched.push(nodeInfo); + } else { + filtered.push(nodeInfo); + } + } + if (matched.length > MAX_FILTER_SIZE) { + return clearFilter(); + } + nav$.addClass('searching'); + for (_j = 0, _len1 = filtered.length; _j < _len1; _j++) { + nodeInfo = filtered[_j]; + nodeInfo[1].removeClass('matched-child'); + nodeInfo[1].addClass('filtered'); + clearHighlight(nodeInfo[2]); + } + _results = []; + for (_k = 0, _len2 = matched.length; _k < _len2; _k++) { + nodeInfo = matched[_k]; + nodeInfo[1].removeClass('filtered matched-child'); + nodeInfo[1].addClass('matched'); + highlightMatch(nodeInfo[2], queryString); + _results.push((function() { + var _l, _len3, _ref, _results1; + _ref = nodeInfo[1].parents('li'); + _results1 = []; + for (_l = 0, _len3 = _ref.length; _l < _len3; _l++) { + p = _ref[_l]; + _results1.push($(p).addClass('matched-child')); + } + return _results1; + })()); + } + return _results; + }; + + clearFilter = function() { + var nodeInfo, _i, _len, _results; + nav$.removeClass('searching'); + currentQuery = ''; + _results = []; + for (_i = 0, _len = searchableNodes.length; _i < _len; _i++) { + nodeInfo = searchableNodes[_i]; + nodeInfo[1].removeClass('filtered matched-child'); + _results.push(clearHighlight(nodeInfo[2])); + } + return _results; + }; + + highlightMatch = function(text$, queryString) { + var char, foundIndex, furthestIndex, lowerText, markedText, nodeText, _i, _len; + nodeText = text$.text(); + lowerText = nodeText.toLowerCase(); + markedText = ''; + furthestIndex = 0; + for (_i = 0, _len = queryString.length; _i < _len; _i++) { + char = queryString[_i]; + foundIndex = lowerText.indexOf(char, furthestIndex); + markedText += nodeText.slice(furthestIndex, foundIndex) + ("" + nodeText[foundIndex] + ""); + furthestIndex = foundIndex + 1; + } + return text$.html(markedText + nodeText.slice(furthestIndex)); + }; + + clearHighlight = function(text$) { + return text$.text(text$.text()); + }; + + fileMap = {}; + + buildNav = function(metaInfo) { + var node, sourceURL, _i, _len; + nav$ = $("
\n").appendTo($('body')); + toc$ = nav$.find('.toc'); + if (metaInfo.githubURL) { + if (metaInfo.documentPath === 'index') { + sourceURL = metaInfo.githubURL; + } else { + sourceURL = "" + metaInfo.githubURL + "/blob/master/" + metaInfo.projectPath; + } + nav$.find('.tools').prepend("
  • \n \n View source on GitHub\n \n
  • "); + } + for (_i = 0, _len = tableOfContents.length; _i < _len; _i++) { + node = tableOfContents[_i]; + toc$.append(buildTOCNode(node, metaInfo)); + } + return nav$; + }; + + buildTOCNode = function(node, metaInfo) { + var c, children$, discloser$, label$, node$, _i, _len, _ref, _ref1, _ref2; + node$ = $("
  • "); + switch (node.type) { + case 'file': + node$.append("" + node.data.title + ""); + break; + case 'folder': + node$.append("" + node.data.title + ""); + } + if (((_ref = node.children) != null ? _ref.length : void 0) > 0) { + children$ = $('
      '); + _ref1 = node.children; + for (_i = 0, _len = _ref1.length; _i < _len; _i++) { + c = _ref1[_i]; + children$.append(buildTOCNode(c, metaInfo)); + } + node$.append(children$); + } + label$ = node$.find('> .label'); + label$.click(function() { + return selectNode(node$); + }); + discloser$ = $('').prependTo(label$); + if (!(((_ref2 = node.children) != null ? _ref2.length : void 0) > 0)) { + discloser$.addClass('placeholder'); + } + discloser$.click(function(evt) { + node$.toggleClass('expanded'); + return evt.preventDefault(); + }); + if (node.type === 'file') { + fileMap[node.data.targetPath] = node$; + } + appendSearchNode(node$); + return node$; + }; + + $(function() { + var lastMousedownTimestamp, metaInfo, search$, toggle$; + metaInfo = { + relativeRoot: $('meta[name="groc-relative-root"]').attr('content'), + githubURL: $('meta[name="groc-github-url"]').attr('content'), + documentPath: $('meta[name="groc-document-path"]').attr('content'), + projectPath: $('meta[name="groc-project-path"]').attr('content') + }; + nav$ = buildNav(metaInfo); + toc$ = nav$.find('.toc'); + search$ = $('#search'); + selectNodeByDocumentPath(metaInfo.documentPath, window.location.hash.replace('#', '')); + search$.focus(function() { + return setTableOfContentsActive(true); + }); + lastMousedownTimestamp = null; + nav$.mousedown(function(evt) { + if (evt.target !== toggle$[0]) { + return lastMousedownTimestamp = evt.timeStamp; + } + }); + search$.blur(function(evt) { + if (evt.timeStamp - lastMousedownTimestamp < 10) { + return search$.focus(); + } else { + return setTableOfContentsActive(false); + } + }); + toggle$ = nav$.find('.toggle'); + toggle$.click(function(evt) { + if (search$.is(':focus')) { + search$.blur(); + } else { + search$.focus(); + } + return evt.preventDefault(); + }); + toggle$.mousedown(function(evt) { + return evt.preventDefault(); + }); + $('body').keydown(function(evt) { + if (nav$.hasClass('active')) { + switch (evt.keyCode) { + case 13: + visitCurrentNode(); + break; + case 37: + setCurrentNodeExpanded(false); + break; + case 38: + moveCurrentNode(true); + break; + case 39: + setCurrentNodeExpanded(true); + break; + case 40: + moveCurrentNode(false); + break; + default: + return; + } + return evt.preventDefault(); + } + }); + search$.bind('keyup search', function(evt) { + return searchNodes(search$.val()); + }); + return search$.keydown(function(evt) { + if (evt.keyCode === 27) { + if (search$.val().trim() === '') { + return search$.blur(); + } else { + return search$.val(''); + } + } + }); + }); + +}).call(this); diff --git a/sample/source/assets/docs.js b/sample/source/assets/docs.js new file mode 100644 index 0000000..a60f4f0 --- /dev/null +++ b/sample/source/assets/docs.js @@ -0,0 +1,93 @@ +/** + * @depend jquery.nicescroll.js + */ + +var j_window = $(window), + j_flybar = $('#flybar'); + j_sidebar = $('.sidebar_popout'), + j_content = $('#document'); + +var docs = { + init: function() { + this.sidebar_popout(); + this.url_rewrite(); + }, + + sidebar_popout: function() { + $('#sidebar_button').on('click', function() { + var sidebar_hidden_class = 'sidebar_hidden', + animation_speed = 200; + + if ( !j_sidebar.hasClass(sidebar_hidden_class) ) { + j_sidebar.stop() + .animate({ + marginLeft: -270 + }, animation_speed) + .addClass(sidebar_hidden_class); + j_content.stop() + .animate({ + paddingLeft: 18 + }, animation_speed); + j_flybar.stop() + .animate({ + marginLeft: -282 + }, animation_speed); + $(this).stop() + .animate({ + marginLeft: -270 + }, animation_speed); + } + else { + j_sidebar.stop() + .animate({ + marginLeft: 0 + }, animation_speed) + .removeClass(sidebar_hidden_class); + j_content.stop() + .animate({ + paddingLeft: 300 + }, animation_speed); + j_flybar.stop() + .animate({ + marginLeft: 0 + }, animation_speed); + $(this).stop() + .animate({ + marginLeft: 0 + }, animation_speed); + } + }); + }, + + url_rewrite: function() { + $('.sidebar .menu a').each(function() { + var j_this = $(this), + href = j_this.attr('href'), + url = new RegExp(window.location.protocol + '//' + window.location.host + window.location.pathname); + + if (url.test(href)) { + href = href.replace(url, '#') // Replace domain and path + .replace(/\//g, '-') // Replace '/' with '-' + .replace(/-$/, ''); // Remove last '-' + + j_this.attr('href', encodeURI(href)); + } + }); + } +} + +$(function() { + docs.init(); + + /* Enable Nice Scroll on docs sidebar */ +// j_sidebar_docs.niceScroll({ +// zindex: 1, +// cursorcolor: '#bbb', +// cursorwidth: '7px', +// cursorborder: '0', +// cursorborderradius: '10px', +// autohidemode: false, +// railoffset: { left: 15 } +// }); + +}); diff --git a/sample/source/assets/jquery.min.js b/sample/source/assets/jquery.min.js new file mode 100644 index 0000000..198b3ff --- /dev/null +++ b/sample/source/assets/jquery.min.js @@ -0,0 +1,4 @@ +/*! jQuery v1.7.1 jquery.com | jquery.org/license */ +(function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cv(a){if(!ck[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){cl||(cl=c.createElement("iframe"),cl.frameBorder=cl.width=cl.height=0),b.appendChild(cl);if(!cm||!cl.createElement)cm=(cl.contentWindow||cl.contentDocument).document,cm.write((c.compatMode==="CSS1Compat"?"":"")+""),cm.close();d=cm.createElement(a),cm.body.appendChild(d),e=f.css(d,"display"),b.removeChild(cl)}ck[a]=e}return ck[a]}function cu(a,b){var c={};f.each(cq.concat.apply([],cq.slice(0,b)),function(){c[this]=a});return c}function ct(){cr=b}function cs(){setTimeout(ct,0);return cr=f.now()}function cj(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ci(){try{return new a.XMLHttpRequest}catch(b){}}function cc(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g0){if(c!=="border")for(;g=0===c})}function S(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function K(){return!0}function J(){return!1}function n(a,b,c){var d=b+"defer",e=b+"queue",g=b+"mark",h=f._data(a,d);h&&(c==="queue"||!f._data(a,e))&&(c==="mark"||!f._data(a,g))&&setTimeout(function(){!f._data(a,e)&&!f._data(a,g)&&(f.removeData(a,d,!0),h.fire())},0)}function m(a){for(var b in a){if(b==="data"&&f.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function l(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(k,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNumeric(d)?parseFloat(d):j.test(d)?f.parseJSON(d):d}catch(g){}f.data(a,c,d)}else d=b}return d}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=/-([a-z]|[0-9])/ig,w=/^-ms-/,x=function(a,b){return(b+"").toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=m.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.7.1",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),A.add(a);return this},eq:function(a){a=+a;return a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j0)return;A.fireWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").off("ready")}},bindReady:function(){if(!A){A=e.Callbacks("once memory");if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):I[C.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||D.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw new Error(a)},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,"ms-").replace(v,x)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i1?i.call(arguments,0):b,j.notifyWith(k,e)}}function l(a){return function(c){b[a]=arguments.length>1?i.call(arguments,0):c,--g||j.resolveWith(j,b)}}var b=i.call(arguments,0),c=0,d=b.length,e=Array(d),g=d,h=d,j=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred(),k=j.promise();if(d>1){for(;c
  • a",d=q.getElementsByTagName("*"),e=q.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=q.getElementsByTagName("input")[0],b={leadingWhitespace:q.firstChild.nodeType===3,tbody:!q.getElementsByTagName("tbody").length,htmlSerialize:!!q.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:q.className!=="t",enctype:!!c.createElement("form").enctype,html5Clone:c.createElement("nav").cloneNode(!0).outerHTML!=="<:nav>",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,b.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,b.optDisabled=!h.disabled;try{delete q.test}catch(s){b.deleteExpando=!1}!q.addEventListener&&q.attachEvent&&q.fireEvent&&(q.attachEvent("onclick",function(){b.noCloneEvent=!1}),q.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),b.radioValue=i.value==="t",i.setAttribute("checked","checked"),q.appendChild(i),k=c.createDocumentFragment(),k.appendChild(q.lastChild),b.checkClone=k.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=i.checked,k.removeChild(i),k.appendChild(q),q.innerHTML="",a.getComputedStyle&&(j=c.createElement("div"),j.style.width="0",j.style.marginRight="0",q.style.width="2px",q.appendChild(j),b.reliableMarginRight=(parseInt((a.getComputedStyle(j,null)||{marginRight:0}).marginRight,10)||0)===0);if(q.attachEvent)for(o in{submit:1,change:1,focusin:1})n="on"+o,p=n in q,p||(q.setAttribute(n,"return;"),p=typeof q[n]=="function"),b[o+"Bubbles"]=p;k.removeChild(q),k=g=h=j=q=i=null,f(function(){var a,d,e,g,h,i,j,k,m,n,o,r=c.getElementsByTagName("body")[0];!r||(j=1,k="position:absolute;top:0;left:0;width:1px;height:1px;margin:0;",m="visibility:hidden;border:0;",n="style='"+k+"border:5px solid #000;padding:0;'",o="
    "+""+"
    ",a=c.createElement("div"),a.style.cssText=m+"width:0;height:0;position:static;top:0;margin-top:"+j+"px",r.insertBefore(a,r.firstChild),q=c.createElement("div"),a.appendChild(q),q.innerHTML="
    t
    ",l=q.getElementsByTagName("td"),p=l[0].offsetHeight===0,l[0].style.display="",l[1].style.display="none",b.reliableHiddenOffsets=p&&l[0].offsetHeight===0,q.innerHTML="",q.style.width=q.style.paddingLeft="1px",f.boxModel=b.boxModel=q.offsetWidth===2,typeof q.style.zoom!="undefined"&&(q.style.display="inline",q.style.zoom=1,b.inlineBlockNeedsLayout=q.offsetWidth===2,q.style.display="",q.innerHTML="
    ",b.shrinkWrapBlocks=q.offsetWidth!==2),q.style.cssText=k+m,q.innerHTML=o,d=q.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,i={doesNotAddBorder:e.offsetTop!==5,doesAddBorderForTableAndCells:h.offsetTop===5},e.style.position="fixed",e.style.top="20px",i.fixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",i.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,i.doesNotIncludeMarginInBodyOffset=r.offsetTop!==j,r.removeChild(a),q=a=null,f.extend(b,i))});return b}();var j=/^(?:\{.*\}|\[.*\])$/,k=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!m(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c=="string",l=a.nodeType,m=l?f.cache:a,n=l?a[j]:a[j]&&j,o=c==="events";if((!n||!m[n]||!o&&!e&&!m[n].data)&&k&&d===b)return;n||(l?a[j]=n=++f.uuid:n=j),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[n].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[h]:h;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)||(b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,g=b.length;e-1)return!0;return!1},val:function(a){var c,d,e,g=this[0];{if(!!arguments.length){e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}if(g){c=f.valHooks[g.nodeName.toLowerCase()]||f.valHooks[g.type];if(c&&"get"in c&&(d=c.get(g,"value"))!==b)return d;d=g.value;return typeof d=="string"?d.replace(q,""):d==null?"":d}}}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,g=a.selectedIndex,h=[],i=a.options,j=a.type==="select-one";if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var g,h,i,j=a.nodeType;if(!!a&&j!==3&&j!==8&&j!==2){if(e&&c in f.attrFn)return f(a)[c](d);if(typeof a.getAttribute=="undefined")return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);return}if(h&&"set"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,""+d);return d}if(h&&"get"in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g}},removeAttr:function(a,b){var c,d,e,g,h=0;if(b&&a.nodeType===1){d=b.toLowerCase().split(p),g=d.length;for(;h=0}})});var z=/^(?:textarea|input|select)$/i,A=/^([^\.]*)?(?:\.(.+))?$/,B=/\bhover(\.\S+)?\b/,C=/^key/,D=/^(?:mouse|contextmenu)|click/,E=/^(?:focusinfocus|focusoutblur)$/,F=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,G=function(a){var b=F.exec(a);b&&(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b},H=function(a,b){var c=a.attributes||{};return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||(c.id||{}).value===b[2])&&(!b[3]||b[3].test((c["class"]||{}).value))},I=function(a){return f.event.special.hover?a:a.replace(B,"mouseenter$1 mouseleave$1")}; +f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b},i.elem=a),c=f.trim(I(c)).split(" ");for(k=0;k=0&&(h=h.slice(0,-1),k=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,o=h.indexOf(":")<0?"on"+h:"";if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArray(d):[],d.unshift(c),p=f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,m=E.test(s+h)?e:e.parentNode,n=null;for(;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s])}for(l=0;le&&i.push({elem:this,matches:d.slice(e)});for(j=0;j0?this.on(b,null,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0),C.test(b)&&(f.event.fixHooks[b]=f.event.keyHooks),D.test(b)&&(f.event.fixHooks[b]=f.event.mouseHooks)}),function(){function x(a,b,c,e,f,g){for(var h=0,i=e.length;h0){k=j;break}}j=j[a]}e[h]=k}}}function w(a,b,c,e,f,g){for(var h=0,i=e.length;h+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d="sizcache"+(Math.random()+"").replace(".",""),e=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\/g,k=/\r\n/g,l=/\W/;[0,0].sort(function(){i=!1;return 0});var m=function(b,d,e,f){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return e;var i,j,k,l,n,q,r,t,u=!0,v=m.isXML(d),w=[],x=b;do{a.exec(""),i=a.exec(x);if(i){x=i[3],w.push(i[1]);if(i[2]){l=i[3];break}}}while(i);if(w.length>1&&p.exec(b))if(w.length===2&&o.relative[w[0]])j=y(w[0]+w[1],d,f);else{j=o.relative[w[0]]?[d]:m(w.shift(),d);while(w.length)b=w.shift(),o.relative[b]&&(b+=w.shift()),j=y(b,j,f)}else{!f&&w.length>1&&d.nodeType===9&&!v&&o.match.ID.test(w[0])&&!o.match.ID.test(w[w.length-1])&&(n=m.find(w.shift(),d,v),d=n.expr?m.filter(n.expr,n.set)[0]:n.set[0]);if(d){n=f?{expr:w.pop(),set:s(f)}:m.find(w.pop(),w.length===1&&(w[0]==="~"||w[0]==="+")&&d.parentNode?d.parentNode:d,v),j=n.expr?m.filter(n.expr,n.set):n.set,w.length>0?k=s(j):u=!1;while(w.length)q=w.pop(),r=q,o.relative[q]?r=w.pop():q="",r==null&&(r=d),o.relative[q](k,r,v)}else k=w=[]}k||(k=j),k||m.error(q||b);if(g.call(k)==="[object Array]")if(!u)e.push.apply(e,k);else if(d&&d.nodeType===1)for(t=0;k[t]!=null;t++)k[t]&&(k[t]===!0||k[t].nodeType===1&&m.contains(d,k[t]))&&e.push(j[t]);else for(t=0;k[t]!=null;t++)k[t]&&k[t].nodeType===1&&e.push(j[t]);else s(k,e);l&&(m(l,h,e,f),m.uniqueSort(e));return e};m.uniqueSort=function(a){if(u){h=i,a.sort(u);if(h)for(var b=1;b0},m.find=function(a,b,c){var d,e,f,g,h,i;if(!a)return[];for(e=0,f=o.order.length;e":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!l.test(b)){b=b.toLowerCase();for(;e=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(j,"")},TAG:function(a,b){return a[1].replace(j,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||m.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&m.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,"");!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(j,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=m(b[3],null,null,c);else{var g=m.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(o.match.POS.test(b[0])||o.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!m(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return bc[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=o.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||n([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||!!a.nodeName&&a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=m.attr?m.attr(a,c):o.attrHandle[c]?o.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":!f&&m.attr?d!=null:f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=o.setFilters[e];if(f)return f(a,c,b,d)}}},p=o.match.POS,q=function(a,b){return"\\"+(b-0+1)};for(var r in o.match)o.match[r]=new RegExp(o.match[r].source+/(?![^\[]*\])(?![^\(]*\))/.source),o.leftMatch[r]=new RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[r].source.replace(/\\(\d+)/g,q));var s=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(t){s=function(a,b){var c=0,d=b||[];if(g.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var e=a.length;c",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(o.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},o.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(o.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(o.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=m,b=c.createElement("div"),d="__sizzle__";b.innerHTML="

    ";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){m=function(b,e,f,g){e=e||c;if(!g&&!m.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return s(e.getElementsByTagName(b),f);if(h[2]&&o.find.CLASS&&e.getElementsByClassName)return s(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return s([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return s([],f);if(i.id===h[3])return s([i],f)}try{return s(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var k=e,l=e.getAttribute("id"),n=l||d,p=e.parentNode,q=/^\s*[+~]/.test(b);l?n=n.replace(/'/g,"\\$&"):e.setAttribute("id",n),q&&p&&(e=e.parentNode);try{if(!q||p)return s(e.querySelectorAll("[id='"+n+"'] "+b),f)}catch(r){}finally{l||k.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)m[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}m.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!m.isXML(a))try{if(e||!o.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return m(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="
    ";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;o.order.splice(1,0,"CLASS"),o.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?m.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:m.contains=function(){return!1},m.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var y=function(a,b,c){var d,e=[],f="",g=b.nodeType?[b]:b;while(d=o.match.PSEUDO.exec(a))f+=d[0],a=a.replace(o.match.PSEUDO,"");a=o.relative[a]?a+"*":a;for(var h=0,i=g.length;h0)for(h=g;h=0:f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h=1;while(g&&g.ownerDocument&&g!==b){for(d=0;d-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(S(c[0])||S(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c);L.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!R[a]?f.unique(e):e,(this.length>1||N.test(d))&&M.test(a)&&(e=e.reverse());return this.pushStack(e,a,P.call(arguments).join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var V="abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",W=/ jQuery\d+="(?:\d+|null)"/g,X=/^\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Z=/<([\w:]+)/,$=/",""],legend:[1,"
    ","
    "],thead:[1,"","
    "],tr:[2,"","
    "],td:[3,"","
    "],col:[2,"","
    "],area:[1,"",""],_default:[0,"",""]},bh=U(c);bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,"div
    ","
    "]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=f.isFunction(a);return this.each(function(c){f(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f.clean(arguments);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f.clean(arguments));return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function() +{for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(W,""):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!bg[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1>");try{for(var c=0,d=this.length;c1&&l0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d,e,g,h=f.support.html5Clone||!bc.test("<"+a.nodeName)?a.cloneNode(!0):bo(a);if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bk(a,h),d=bl(a),e=bl(h);for(g=0;d[g];++g)e[g]&&bk(d[g],e[g])}if(b){bj(a,h);if(c){d=bl(a),e=bl(h);for(g=0;d[g];++g)bj(d[g],e[g])}}d=e=null;return h},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!_.test(k))k=b.createTextNode(k);else{k=k.replace(Y,"<$1>");var l=(Z.exec(k)||["",""])[1].toLowerCase(),m=bg[l]||bg._default,n=m[0],o=b.createElement("div");b===c?bh.appendChild(o):U(b).appendChild(o),o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=$.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]===""&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&X.test(k)&&o.insertBefore(b.createTextNode(X.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return br.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNumeric(b)?"alpha(opacity="+b*100+")":"",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bq,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bq.test(g)?g.replace(bq,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bz(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(bA=function(a,b){var c,d,e;b=b.replace(bs,"-$1").toLowerCase(),(d=a.ownerDocument.defaultView)&&(e=d.getComputedStyle(a,null))&&(c=e.getPropertyValue(b),c===""&&!f.contains(a.ownerDocument.documentElement,a)&&(c=f.style(a,b)));return c}),c.documentElement.currentStyle&&(bB=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;f===null&&g&&(e=g[b])&&(f=e),!bt.test(f)&&bu.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f||0,f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d));return f===""?"auto":f}),bz=bA||bB,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style&&a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bD=/%20/g,bE=/\[\]$/,bF=/\r?\n/g,bG=/#.*$/,bH=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bI=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bJ=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bK=/^(?:GET|HEAD)$/,bL=/^\/\//,bM=/\?/,bN=/)<[^<]*)*<\/script>/gi,bO=/^(?:select|textarea)/i,bP=/\s+/,bQ=/([?&])_=[^&]*/,bR=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bS=f.fn.load,bT={},bU={},bV,bW,bX=["*/"]+["*"];try{bV=e.href}catch(bY){bV=c.createElement("a"),bV.href="",bV=bV.href}bW=bR.exec(bV.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bS)return bS.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("
    ").append(c.replace(bN,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bO.test(this.nodeName)||bI.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bF,"\r\n")}}):{name:b.name,value:c.replace(bF,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.on(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?b_(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),b_(a,b);return a},ajaxSettings:{url:bV,isLocal:bJ.test(bW[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":bX},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:bZ(bT),ajaxTransport:bZ(bU),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?cb(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=cc(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.fireWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f.Callbacks("once memory"),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bH.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.add,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bG,"").replace(bL,bW[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bP),d.crossDomain==null&&(r=bR.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bW[1]&&r[2]==bW[2]&&(r[3]||(r[1]==="http:"?80:443))==(bW[3]||(bW[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),b$(bT,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bK.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bM.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bQ,"$1_="+x);d.url=y+(y===d.url?(bM.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bX+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=b$(bU,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){if(s<2)w(-1,z);else throw z}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)ca(g,a[g],c,e);return d.join("&").replace(bD,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var cd=f.now(),ce=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cd++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(ce.test(b.url)||e&&ce.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(ce,l),b.url===j&&(e&&(k=k.replace(ce,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var cf=a.ActiveXObject?function(){for(var a in ch)ch[a](0,1)}:!1,cg=0,ch;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ci()||cj()}:ci,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,cf&&delete ch[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cg,cf&&(ch||(ch={},f(a).unload(cf)),ch[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var ck={},cl,cm,cn=/^(?:toggle|show|hide)$/,co=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cp,cq=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cr;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cu("show",3),a,b,c);for(var g=0,h=this.length;g=i.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),i.animatedProperties[this.prop]=!0;for(b in i.animatedProperties)i.animatedProperties[b]!==!0&&(g=!1);if(g){i.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){h.style["overflow"+b]=i.overflow[a]}),i.hide&&f(h).hide();if(i.hide||i.show)for(b in i.animatedProperties)f.style(h,b,i.orig[b]),f.removeData(h,"fxshow"+b,!0),f.removeData(h,"toggle"+b,!0);d=i.complete,d&&(i.complete=!1,d.call(h))}return!1}i.duration==Infinity?this.now=e:(c=e-this.startTime,this.state=c/i.duration,this.pos=f.easing[i.animatedProperties[this.prop]](this.state,c,0,1,i.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){var a,b=f.timers,c=0;for(;c-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cx.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cx.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cy(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cy(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){var a=this[0];return a?a.style?parseFloat(f.css(a,d,"padding")):this[d]():null},f.fn["outer"+c]=function(a){var b=this[0];return b?b.style?parseFloat(f.css(b,d,a?"margin":"border")):this[d]():null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c],h=e.document.body;return e.document.compatMode==="CSS1Compat"&&g||h&&h["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var i=f.css(e,d),j=parseFloat(i);return f.isNumeric(j)?j:i}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return f})})(window); \ No newline at end of file diff --git a/sample/source/assets/sideNavOut.png b/sample/source/assets/sideNavOut.png new file mode 100644 index 0000000000000000000000000000000000000000..b7129bf8bb728b8eb0dffa6425adafb1bdd512b9 GIT binary patch literal 289 zcmeAS@N?(olHy`uVBq!ia0vp^JRr=$1|-8uW1a&k#^NA%Cx&(BWL^R}Y)RhkE)4%c zaKYZ?lYt_f1s;*b3=G`DAk4@xYmNj^kiEpy*OmPak35SG^Wn*UUw}djJzX3_G|nd{ zCtNn(C20#EZXu|EptOZj0UI<@f2t4eP zr2&@tllpY0hlipMZwRwHUm~x7sSghjfHeMnB9wb@=?|dc+&X$5eHN1#8KgHm|37tY RZwAn@44$rjF6*2Ung9!lY4`vD literal 0 HcmV?d00001 diff --git a/sample/source/assets/sideNavOver.png b/sample/source/assets/sideNavOver.png new file mode 100644 index 0000000000000000000000000000000000000000..37ca9c9494b110889f8357100c612b26ad87124c GIT binary patch literal 300 zcmeAS@N?(olHy`uVBq!ia0vp^JRr=$1|-8uW1a&k#^NA%Cx&(BWL^R}Y)RhkE)4%c zaKYZ?lYt_f1s;*b3=G`DAk4@xYmNj^kiEpy*OmPak35Tx_BXX>d_bW!o-U3d8t0P} z6a)>FiY=`3qi%K@uL~DW6aM}Gzy0C2<@@7htA5&lsNVU@kcW5E-|OmZD+-<^8kZiP z`+l;Vc-FJSrUhm9ws>7kvhO;tS-kG=mVa^U>UugG8ygS$%_+21+.children,nav .toc .expanded>.outline,nav .toc .expanded>.outline .children{display:block}nav .toc .discloser{-webkit-transition-property:-moz-transform,-webkit-transform,-o-transform,-webkit-transform;-moz-transition-property:-moz-transform,-webkit-transform,-o-transform,-moz-transform;-o-transition-property:-moz-transform,-webkit-transform,-o-transform,-o-transform;transition-property:-moz-transform -webkit-transform -o-transform transform;-webkit-transition-duration:200ms;-moz-transition-duration:200ms;-o-transition-duration:200ms;transition-duration:200ms;-webkit-transform:rotate(0deg);-moz-transform:rotate(0deg);-ms-transform:rotate(0deg);-o-transform:rotate(0deg);transform:rotate(0deg);display:inline-block;height:9px;width:9px;padding:0.2em;margin:0.2em 0.2em -0.2em 0.2em;vertical-align:baseline;background:url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyRpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYxIDY0LjE0MDk0OSwgMjAxMC8xMi8wNy0xMDo1NzowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNS4xIE1hY2ludG9zaCIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDowOEFDRENGQzE2NEUxMUUxODdDNUQ2ODM0QzVGRkVBMSIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDowOEFDRENGRDE2NEUxMUUxODdDNUQ2ODM0QzVGRkVBMSI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOjA4QUNEQ0ZBMTY0RTExRTE4N0M1RDY4MzRDNUZGRUExIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjA4QUNEQ0ZCMTY0RTExRTE4N0M1RDY4MzRDNUZGRUExIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+nQHMgwAAAM1JREFUeNpi/P//P0NJSYkuAwNDJhDXAPE7BjIAExIbZNA9IC4CYjZKDAIBfiDuBeLzQOxBiUEwoAXE26FYixKDYMAD6rpeqGvJNogBGl5F0PDLpMQgGBAC4mlQF9pTYhAMGADxASBeB8RylBgEA4FAfAOIW4CYhxKDQIAZxmChwJD1QFwGxHfINegaEGcB8UFyA/sd1AA9dEOIddFfIJ4OzdAfcSkiZNAOIC6GegcvwGXQHagBm8jNtB+hBmiTYgi6i+ZCw+EFOWkBIMAA1W4l62UzKWwAAAAASUVORK5CYII=') center center no-repeat;background-size:9px 9px}nav .toc .discloser.placeholder,nav .toc .expanded>.outline .discloser{background:none}nav .toc .expanded>.label .discloser{-webkit-transform:rotate(90deg);-moz-transform:rotate(90deg);-ms-transform:rotate(90deg);-o-transform:rotate(90deg);transform:rotate(90deg)}nav .toc .filtered>.label{display:none}nav .toc .matched-child>.label{display:block}nav .toc .matched-child>.children,nav .toc .matched-child>.outline,nav .toc .matched-child>.outline .children{display:block}nav .toc .matched>.children,nav .toc .matched>.outline,nav .toc .matched>.outline .children{display:block}nav.searching .toc .discloser{display:none}.comments .wrapper{font-family:"Helvetica Neue",Helvetica,"Droid Sans",sans-serif;font-weight:300;font-size:0.82em;line-height:1.3}.comments .wrapper h1,.comments .wrapper h2,.comments .wrapper h3,.comments .wrapper h4,.comments .wrapper h5,.comments .wrapper h6{font-family:"HelveticaNeue-UltraLight","Helvetica Neue",Helvetica,"Droid Sans",sans-serif;font-weight:100;letter-spacing:0.0625em}.comments .wrapper h1{font-size:1.6em}.comments .wrapper h2{font-size:1.4em}.comments .wrapper h3{font-size:1.2em}.comments .wrapper h4{font-size:1em}.comments .wrapper h5{font-size:1em}.comments .wrapper h6{font-size:1em}.comments .wrapper p{margin:1em 0}.comments .wrapper>*:first-child{margin-top:-60px;padding-top:60px}.comments .wrapper>*:last-child{margin-bottom:0}.comments .wrapper ol,.comments .wrapper ul{padding-left:1.75em}.comments .wrapper ol li{list-style:decimal}.comments .wrapper ul li{list-style:disc}.comments .wrapper li{margin:1em 0}.comments .wrapper li:first-child{margin-top:0}.comments .wrapper li:last-child{margin-bottom:0}.comments .wrapper code{display:inline-block;padding:0.25em 0.25em 0 0.25em}.comments .wrapper pre{display:block;overflow-x:auto;overflow-y:hidden}.comments .wrapper pre code{padding:1em}.comments .wrapper blockquote{padding:0 1em}html{background:#f3f3f3}#document{background-color:#fff;margin-right:-1em;padding-right:1em}@media (max-width: 41.65em){#document{margin-right:0;padding-right:0}}#meta>*{font-family:"Helvetica Neue",Helvetica,"Droid Sans",sans-serif;font-weight:300;font-size:0.82em;line-height:1.3;text-shadow:#cdcdcd 1px 1px 0}#meta>*,#meta>* a{color:#0d0d0d}#meta>* a{text-decoration:none}.comments .wrapper{font-family:"Helvetica Neue",Helvetica,"Droid Sans",sans-serif;font-weight:300;font-size:0.82em;line-height:1.3;text-shadow:#fff 1px 1px 0;color:#4a525a}.code .wrapper{font-family:"Droid Sans Mono",Menlo,Monaco,monospace;font-size:0.75em;line-height:1.4;color:#333}.code .wrapper .k{color:#d14}.code .wrapper .kn{color:#d14}.code .wrapper .kc{color:#d14}.code .wrapper .kd{color:#d14}.code .wrapper .kp{color:#d14}.code .wrapper .kr{color:#d14}.code .wrapper .kt{color:#d14}.code .wrapper .na{color:teal}.code .wrapper .nc{color:#458}.code .wrapper .no{color:#458}.code .wrapper .nd{color:#458}.code .wrapper .nf{color:navy}.code .wrapper .py{color:navy}.code .wrapper .nv{color:teal}.code .wrapper .vc{color:teal}.code .wrapper .vg{color:teal}.code .wrapper .vi{color:teal}.code .wrapper .s{color:#2a9e3d}.code .wrapper .sb{color:#2a9e3d}.code .wrapper .sc{color:#2a9e3d}.code .wrapper .sd{color:#2a9e3d}.code .wrapper .s2{color:#2a9e3d}.code .wrapper .se{color:#2a9e3d}.code .wrapper .sh{color:#2a9e3d}.code .wrapper .si{color:#2a9e3d}.code .wrapper .sx{color:#2a9e3d}.code .wrapper .sr{color:#333}.code .wrapper .s1{color:#2a9e3d}.code .wrapper .ss{color:#333}.code .wrapper .m{color:#333}.code .wrapper .mf{color:#333}.code .wrapper .mh{color:#333}.code .wrapper .mi{color:#333}.code .wrapper .il{color:#333}.code .wrapper .mo{color:#333}.code .wrapper .o{color:#882d17}.code .wrapper .ow{color:#882d17}.code .wrapper .p{color:#882d17}.code .wrapper .c,.code .wrapper .cm,.code .wrapper .cp,.code .wrapper .c1,.code .wrapper .cs{font-style:italic}.code .wrapper .c{color:#666}.code .wrapper .cm{color:#666}.code .wrapper .cp{color:#666}.code .wrapper .c1{color:#666}.code .wrapper .cs{color:#666}@media (max-width: 41.65em){.code{-webkit-border-radius:0.4em;-moz-border-radius:0.4em;-ms-border-radius:0.4em;-o-border-radius:0.4em;border-radius:0.4em;-webkit-box-shadow:#cdcdcd 0 0 0.5em 0.2em inset;-moz-box-shadow:#cdcdcd 0 0 0.5em 0.2em inset;box-shadow:#cdcdcd 0 0 0.5em 0.2em inset;background:#f3f3f3}.code .wrapper{-webkit-box-shadow:#f3f3f3 0 0 0.25em 0.75em;-moz-box-shadow:#f3f3f3 0 0 0.25em 0.75em;box-shadow:#f3f3f3 0 0 0.25em 0.75em;background:#f3f3f3}}@media (max-width: 25em){.code{-webkit-border-radius:0;-moz-border-radius:0;-ms-border-radius:0;-o-border-radius:0;border-radius:0}}nav{text-shadow:#f0f0f0 1px 1px 0;color:#4a525a}nav .tools,nav .toc{font-family:"Helvetica Neue",Helvetica,"Droid Sans",sans-serif;font-weight:300;font-size:0.82em;line-height:1.3}nav .tools{-webkit-box-shadow:rgba(0,0,0,0.3) 0 0 0.5em 0.1em;-moz-box-shadow:rgba(0,0,0,0.3) 0 0 0.5em 0.1em;box-shadow:rgba(0,0,0,0.3) 0 0 0.5em 0.1em;background:-webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, rgba(255,255,255,0.9)), color-stop(100%, rgba(205,205,205,0.9)));background:-webkit-linear-gradient(top, rgba(255,255,255,0.9),rgba(205,205,205,0.9));background:-moz-linear-gradient(top, rgba(255,255,255,0.9),rgba(205,205,205,0.9));background:-o-linear-gradient(top, rgba(255,255,255,0.9),rgba(205,205,205,0.9));background:linear-gradient(top, rgba(255,255,255,0.9),rgba(205,205,205,0.9));-moz-border-radius-bottomleft:0.4em;-webkit-border-bottom-left-radius:0.4em;border-bottom-left-radius:0.4em;border-bottom:1px solid #4a525a;border-left:1px solid #4a525a}@media (max-width: 49em){nav .tools{-moz-border-radius-bottomleft:0;-webkit-border-bottom-left-radius:0;border-bottom-left-radius:0}}nav .tools li{border-right:1px solid #4a525a}nav .tools li:last-child{border-right:none}nav .tools .toggle{cursor:pointer}nav .tools .github a{-webkit-transition:opacity 200ms;-moz-transition:opacity 200ms;-o-transition:opacity 200ms;transition:opacity 200ms;filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=50);opacity:0.5;background:url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACcAAAAwCAYAAACScGMWAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyRpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYxIDY0LjE0MDk0OSwgMjAxMC8xMi8wNy0xMDo1NzowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNS4xIE1hY2ludG9zaCIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDowOEFDRENGODE2NEUxMUUxODdDNUQ2ODM0QzVGRkVBMSIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDowOEFDRENGOTE2NEUxMUUxODdDNUQ2ODM0QzVGRkVBMSI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOjA4QUNEQ0Y2MTY0RTExRTE4N0M1RDY4MzRDNUZGRUExIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjA4QUNEQ0Y3MTY0RTExRTE4N0M1RDY4MzRDNUZGRUExIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+FC/Z5AAACv9JREFUeNrMWXl0VNUdvu/NmzWZJQnZN0hCWIQEIQuErUCBI2qwEAFRBJUeDvUPDwfKVhDUY2mPp8spakVELSq11goIiCBbUVKKUGKQQFiCSBJIQjLJZPbJzOt3J/dOXiYJgcqh3nO+vPfm3Xfvd3/3t94IsiyTH2sTyY+4SfxGpVIpfzdBokdxjQHOADuAj4GmuzRvFjAbmAZkAocEQZjLX/r9/vYbuq0UgigoQKagsxyG74FlgB4gYdAA0UASkAIkACahvSn70Xd/AlrCxm4VRDEBIBScUxg5wiCs7oZcEJDwN7g+AswH3gAOApVALdAIWIEGtpgyYAfwPFtYTU/jbtmy5W/gsZAugnMKbSsJ2oXAn1J62o9AIJCDy/ZgbzbQLVoqkAtM722fa2pqYnHJwfgmXG23MgjV7SjO3bR06BnlogUSe7PW+ntplXQHUlNTHewxqjdyR+8lOehxYNCgQa3hnHoil8a18F60trY2cenSpYU+n48qfXMnvaEQYcIMQ4KmrbAk/Cb3ZGV3gt7GWbx4cSm4xHd1JR2+aPfdIPK/ICIiwlNaWroKfMSgwDq0Moj78feB/1e4cjqdmq1btz6C25921jk5iOLe4i2XdDh+aF/ejhw5ksYEZJE6BAeHSuT83nyaMTLSZzAYfO2K7BPdbo/k9ngkOM8u32i1moBep2/TarVtGrU64PZ6VC0tLVqv1ydyFxLeamtrzbgYgJFSh+Bk2jOpe1ICmf7QtKp5856sHJo7zGoym4Lk3G636HQ4JXurTd3U1KTBtqgcTpcQZTYHIiIjfNExMV6DIaINuuTX6XQBp8sp1t24odv3+d6UN9/cPPTqtWpjOEFYLOeUI3CJwJJULAMZFE5u9cqVx1/esKE8jLebgWc3akCjjIFKbwF46dw0AlLXVnXpUlzx9OJpZyvO9VEShJR9LpfrHdy2SgqDCEB83i7Elj53NozYKeAY3QHAE0ZOz0KQmukuJ+VifUPkMrKyjO9t2bzvwUdmbL5eV2/gBBVE1crAL/OAy4mlJSe5Vq5Zd0pB7O/4OB7XXwJbgC/pYLHRFhJtNhONRk1q6xtIv+RE4vJ4SUOTldTdDKWABcBi+g3wdtH9OfaHJ4zaVpg7NHvH/oPrFKGMW4wghYn/uvJhwvjx1UZLFN+6I/iQ3r/Pnh+iGQcWUVPfaCWNzTZiiowgMA5yo7GJ1N5oIP4OI4llmQzV6QVAdenp8v3J8X1IhF7aplarV0HXaE5IJEniH8md/RwhFZ1iWFoqj3dUop8yQrzFPPvss78Cuf48e7W22IjL7SHXauuUxGgbpTS2goKC5fhu9InyCnLmfFWDiByQv6OOuCu5dmEeU46Iyfj7CqzKwXQp1OLj4wfSrcJEll78q0b5EBMTQ4k++V3N9cE6rVYCuRCP5OTkFm5ECskJFMdxd5X/dLOh3shuG9n1n8pMYuLEiQ10sawmuFU7SQMAfxg3bhxXn1yLyWDx+X0mhVT5O2d4NLADb/GHr0/9J97ltFO9lDJSgruyC3gpNjb20tq1a4+OHj26OaxQGgDMYxarbN8BTxuNxm9nzZr1zZIlS6r4GiWVekhbW0BL9Q0L9s+dO/dqKKfsJvCb4fMuMKuRP/nwvSN4//PHH55CsAXckqkhbGJ4nWYSbMCXmIKkKRNJhQeIATYqvs3PGZD1EX1F55s0adI5xbupXciJ7ddCWBCVopyekuw8ffJr2lkzMLMviYky0/7UeRcDNIMYxbeIKf6IvLy8madOnZqId1KEQU8S4/rA1ZiwODX9Ng9YCcxc/sxjkyWVivo+GRGkurKy8j1G7DW6YGWECMVY2hKTEicjHH1stVpNSYkJztmPlqw/uG/vK/6ATPeC+Nv88JIqUg2X0epwEo/XW4LPltMaFNs+vays7HhSUtLS9OTEpgi9jkRbTMRmd5Ios5G0OuGTA/LkMxcubWtr89MIcRnZyLYnnniC70Ap8JfutjWE9evXF02YMKGCiz0hPu5YWlLC/PuyMzOGZGdKOQP7k76pSSR3YDZJSYyDVE0js7KyVhw88MVQjJkODAR0AzLSyJi8XIJvzMMGZU+M7xP9V5p4snHf3/jqxp+g35+Z1F4GTEFOCsktYCHmANCgKAX779q1a9W7776bd/jw4b6QpFEtSUSr0VyTJPE8vMB3Br2uSRREh0oUbPEpaQlFhQW5dXU3mtUaddzBA4crHE5HItba3+ly9/V4fWbMSQuo7SD2DsanPnQhEMnmfYM66c4Vf3txTFdSDTwakqAYrE2jgAV2u/2tvXv3/mPRokUfZWdnfwhvXhHKBBm4IYXhX8BrwC/wvmDZsmV9mFQXKgzgaeovRUXFr5QcdQcvAKupwFJSUkqqa6q3Kxw0lWIqU/rhly9fTsKWP1hdXR3dW4YL3fumqqrq1xqNhpZ9cewMhiYJNAKdpjqG+a9wy+56VsIkNXLkSOqIZXjx5s/37Z3QnS5SK4yMjDx8J/VBSUlJOb5bATwGUB3rC2j57gQ9BSuyeixwEJLiYdbUucq5uTnXNm3a1B3BXKDtTshZLBbnxYsXV1M31GW82yXH8ArXHbPZbENa/kc8zwPoQcvrwDU+Kd7ZIUUXq57cc+bMKeMlICKCC1sZWsTOnTs/wVyP3i65noqZjezEiNhsNiP83XPovBXYzHKy0EHPzJkzz6elpQXDGIj48/Pz67mWjhgxorqoqOhKKJGwWmkCUADdNXSuBTqrWG8V//d0hXq93spDEEd4Gz58eCMqdoENLtPqPXQyKUl+vK8PS8tMQaMQeDkqk477zkm+dAsjOzxjxozxXq/3rZMnT2Y0NzcbaIWFrXLjKqJKCqZJCHOy4qTIj+ghK47GBLwPhEsITddxL/R+7Npd++CDD86AyJPAMzU1NXGYW0C+5UHkGLhhw4axzL0IyiCvUomBsPM84QefCfd4oi2KlZhgQ2pq6ng83ke3xeFweHo6ykIKJCuykB90GCTdTicQpLq3AyR30oIXQXoRPzLopu9dO52S7uSUkrkXmq67uzMOOAMZRtDj6aeisrqt+UIjqTWasEHbM/eo2HiiQ07G9JtodDpibahTNdXdCPYzRBoFo8XCDr2D48h8clRutH8oROoMkaEVpQ8YzCxE6PEoMERubPHPFJZDvXOwpiB6gyF4/E5/87jcJDE9gxz7bMcDlBx1mOkZGS5UXMFxNHq9v29mf4+I+oIarj9ApCE5w+x8jhNl5emzSmbUBM8aRo3lUaBdCjJzKQrrVUhO23kVcrsP8nk9TJdUxGGzJXz2/pYXbtbWBI/JxkyavKd/Zlbr1StV9PCFDB6aW1dUmN/YLzOr5cK5iuizZ8v7PDD17S+HDLu/8tuy0wP+8NuXh/jdds/8BU9Fet3uXrc2RM7a0NBOjq1ECB0CtBMVoUu2psZxrVbrOKM5emeE2bj7iz27Ilauf/EZR2srVE3tXvP8ui+R55Hla9Z9tfDx2cVVFy6YP9r5acaRQ4deLZk9K9Nlt5fs3r0nc3h+4RRbc+PJAETL5RH0jWHOMKQPk+fM7+7cq+NjSSQum4M01V8nZ//9FfXyxRevXJ02ZtTI6TGxsVf6ZWWv2LP946ms8iofkDOsKeBx/06j1WtPHC99E7XEizSfA7LZ6LSSOzBl7lPuTkqOtn/bO53J3WHLAx4G6igRlvPPZO6FFiy/B2j5V0hLQvYNPcY4AVB/Sa3BEqwTCLnSo3e4S//oiGHFDTXh3cDFsIVMZXH8N4z8bbX/CjAA0UTEH4oMvREAAAAASUVORK5CYII=') center center no-repeat;background-size:19.5px 24px}nav .tools .github a:hover{filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=90);opacity:0.9}nav.active .tools{-moz-border-radius-bottomleft:0;-webkit-border-bottom-left-radius:0;border-bottom-left-radius:0}nav.active .tools .toggle{background:rgba(205,205,205,0.9);position:relative}nav .toc{-webkit-box-shadow:rgba(0,0,0,0.3) 0 0 0.5em 0.1em;-moz-box-shadow:rgba(0,0,0,0.3) 0 0 0.5em 0.1em;box-shadow:rgba(0,0,0,0.3) 0 0 0.5em 0.1em;background:rgba(230,230,230,0.9);border-left:1px solid #4a525a}nav .toc .label{color:#4a525a;text-decoration:none;border-top:1px solid rgba(192,192,192,0.9);border-bottom:1px solid rgba(192,192,192,0.9);margin-top:-1px}nav .toc .label:hover{background:rgba(205,205,205,0.9)}nav .toc .file>.label{font-weight:bold}nav .toc .selected>.label{background:#fff}nav .toc .label em{font-weight:bold}nav .toc .file>.label em{color:#101214}nav .toc .matched-child>.label{filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=65);opacity:0.65;text-shadow:none;background:rgba(192,192,192,0.9)}@media (max-width: 41.65em){nav .tools,nav .toc{border-left-width:0}nav .tools{background:-webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #ffffff), color-stop(100%, #cdcdcd));background:-webkit-linear-gradient(top, #ffffff,#cdcdcd);background:-moz-linear-gradient(top, #ffffff,#cdcdcd);background:-o-linear-gradient(top, #ffffff,#cdcdcd);background:linear-gradient(top, #ffffff,#cdcdcd)}nav .toc{background:#e6e6e6}}.comments .wrapper a{display:inline-block;color:#a8614e;text-decoration:none}.comments .wrapper a:hover,.comments .wrapper a:hover *{text-decoration:underline}.comments .wrapper code{font-family:"Droid Sans Mono",Menlo,Monaco,monospace;font-size:0.75em;line-height:1.4;border:1px solid #e6e0d5}.comments .wrapper pre,.comments .wrapper code{-webkit-border-radius:0.4em;-moz-border-radius:0.4em;-ms-border-radius:0.4em;-o-border-radius:0.4em;border-radius:0.4em;background:#fbf8f3}.comments .wrapper pre{-webkit-box-shadow:#f2ece3 0 0 0.4em 0.2em;-moz-box-shadow:#f2ece3 0 0 0.4em 0.2em;box-shadow:#f2ece3 0 0 0.4em 0.2em;border:1px solid #d9c9af}.comments .wrapper pre code{border-width:0;background:transparent}.comments .wrapper blockquote{border-left:0.15em solid #959fa8;margin-left:-0.15em}body{-webkit-text-size-adjust:100%}input[type="search"]{-webkit-border-radius:1em;-moz-border-radius:1em;-ms-border-radius:1em;-o-border-radius:1em;border-radius:1em;-webkit-box-shadow:#ddd 0 1px 1px 0 inset;-moz-box-shadow:#ddd 0 1px 1px 0 inset;box-shadow:#ddd 0 1px 1px 0 inset;border:1px solid #959595;padding:0.15em 0.8em}#document .pilwrap{position:relative}#document .pilcrow{color:#454545;font:12px Arial;left:-20px;opacity:0;padding:1px 2px;position:absolute;text-decoration:none;top:3px}#document .comments:hover .pilcrow{opacity:1}#side-nav{left:10px;position:fixed;top:40%;z-index:1000}#side-nav li{margin:10px 0}#side-nav li a{background:url("sideNavOut.png") no-repeat scroll left top transparent;display:block;height:12px;position:relative;width:12px}#side-nav li a .text{display:none}#side-nav li a.active{background:url("sideNavOver.png") no-repeat scroll left top transparent}#flybar{font-family:"Helvetica Neue",Helvetica,"Droid Sans",sans-serif;font-weight:300;font-size:0.82em;line-height:1.3;background-color:#267bb6;background-image:-moz-linear-gradient(center bottom, #2576b4 0px, #348dce 94%);border-bottom:1px solid #888;box-shadow:0 3px 5px rgba(0,0,0,0.1);height:35px;left:0;min-width:745px;padding-left:777px;position:fixed;right:0;top:0;z-index:100;color:#fff}#nav-logo,#nav-logo-nav,#nav-logo-doc{display:block;height:30px;left:10px;position:absolute;top:9px;font-weight:bold}#nav-logo-doc{padding-left:290px}.flybar-button{border-left:1px solid transparent;border-right:1px solid transparent;color:#fff;font-size:12px;font-weight:bold;line-height:35px;padding:0 1em;text-align:center;text-decoration:none;text-transform:uppercase}.flybar-nav{display:block;float:left;position:relative;width:220px}.flybar-language{display:block;float:left;position:relative}.flybar-language .flybar-button{border-left:1px solid transparent;border-right:1px solid transparent;clear:none;float:left;margin-left:-1px;min-width:80px}.flybar-menu{-moz-border-bottom-colors:none;-moz-border-left-colors:none;-moz-border-right-colors:none;-moz-border-top-colors:none;background-color:rgba(249,249,249,0.99);border-bottom-left-radius:8px;border-bottom-right-radius:8px;border-color:-moz-use-text-color #bbb #bbb;border-image:none;border-right:1px solid #bbb;border-style:none solid solid;border-width:0 1px 1px;box-shadow:0 3px 5px rgba(0,0,0,0.1);display:none;padding:1em;position:absolute;top:41px;width:870px}#toc-menu{right:-345px}#language-menu{left:-25px}#language-menu li{display:inline-block;margin-right:25px}.flybar-menu h3{font-size:100%;text-transform:uppercase}.flybar-menu h4{color:#9b9b9b;font-size:90%;margin:0.5em 0;text-transform:uppercase}.flybar-menu ul{margin:0 0 1em 1em}.flybar-nav:hover .flybar-menu,.flybar-nav.active .flybar-menu{display:block}.flybar-button:hover,.flybar-button.active{background:none repeat scroll 0 0 #1d77bc;text-decoration:none}.flybar-nav:hover .flybar-button,.flybar-nav.active .flybar-button{background:-moz-linear-gradient(center top, #eee, #f8f8f8) repeat scroll 0 0 transparent;border-left:1px solid #bbb;border-right:1px solid #bbb}.flybar-nav:hover .flybar-button,.flybar-nav.active .flybar-button{background:-moz-linear-gradient(center top, #e5e5e5, #fff) repeat scroll 0 0 transparent;color:#000;height:51px}.sidebar{font-family:"Helvetica Neue",Helvetica,"Droid Sans",sans-serif;font-weight:300;font-size:0.82em;line-height:1.3;border-right:1px solid #e8e8e8;display:inline-block;padding:10px 30px 30px;vertical-align:top;width:220px;z-index:1}.sidebar ul{margin:0}.sidebar .menu li{position:relative}.sidebar .menu a{display:block;margin-top:10px}.sidebar .menu>li{margin-top:20px}.sidebar .menu>li:first-child{margin-top:0}.sidebar .menu>li:first-child>a{margin-top:0}.sidebar .menu>li>a{color:#333;font-weight:bold;margin-bottom:5px;text-decoration:none;text-transform:uppercase}.sidebar .menu .has_sub_menu>a{font-weight:bold}.sidebar .sub-menu .sub-menu{display:none;margin-left:9px}.sub_menu_arrow{border-bottom:3px solid transparent;border-left:3px solid #1a74ba;border-top:3px solid transparent;cursor:pointer;display:block;height:0;left:-10px;position:absolute;top:4px;width:0}.sub_menu_arrow:after{content:"";display:block;height:18px;left:-10px;position:absolute;top:-10px;width:18px}.lte_ie8 .sub_menu_arrow{display:none}.sub_menu_active>.sub_menu_arrow{border-left:3px solid transparent;border-right:3px solid transparent;border-top:3px solid #1a74ba}.sidebar_popout{background:none repeat scroll 0 0 #fcfcfc;height:100%;padding-left:20px;padding-top:60px;position:fixed}.sidebar_popout .menu-container{padding-left:10px}.sidebar_popout a{color:#1a74ba;text-decoration:none}.sidebar_popout a:link,.sidebar_popout a:visited{color:#1a74ba;text-decoration:none}.sidebar_popout a:hover{text-decoration:underline}.sidebar_popout a.no_underline{text-decoration:none}.sidebar_popout a.block_link{display:block;text-decoration:none}.sidebar_popout a.block_link:hover{background:none repeat scroll 0 0 #f8fbfd}.sidebar_no_fixed{position:absolute}.sidebar_button{background:none repeat scroll 0 0 #eaeaea;border-left:1px solid #d7d7d7;border-radius:0 10px 10px 0;cursor:pointer;height:45px;left:270px;position:fixed;top:60px;width:20px;z-index:1}.sidebar_button:hover{background:none repeat scroll 0 0 #dedede}.sidebar_button:after{border-bottom:6px solid transparent;border-right:6px solid #bbb;border-top:6px solid transparent;content:"";display:block;height:0;margin:17px 0 0 5px;width:0}.sidebar_hidden .sidebar_button:after{border-left:6px solid #bbb;border-right:0 none}.content_sidebar{border-left:1px solid #e8e8e8;display:inline-block;margin-left:-5px;padding-left:34px;vertical-align:top;width:640px}.content_sidebar_popout{display:block;padding-left:300px;width:100%}.content_no_fixed_header{margin-top:-66px}.section_anchor{display:block;height:60px;margin-top:-60px} diff --git a/sample/vault/CreateCreditCard.php b/sample/vault/CreateCreditCard.php new file mode 100644 index 0000000..1bcf1ce --- /dev/null +++ b/sample/vault/CreateCreditCard.php @@ -0,0 +1,57 @@ +setType("visa"); +$card->setNumber("4417119669820331"); +$card->setExpire_month("11"); +$card->setExpire_year("2019"); +$card->setCvv2("012"); +$card->setFirst_name("Joe"); +$card->setLast_name("Shopper"); + +// ### Api Context +// Pass in a `ApiContext` object to authenticate +// the call and to send a unique request id +// (that ensures idempotency). The SDK generates +// a request id if you do not pass one explicitly. +$apiContext = new ApiContext($cred, 'Request' . time()); + +// ### Save card +// Creates the credit card as a resource +// in the PayPal vault. The response contains +// an 'id' that you can use to refer to it +// in the future payments. +try { + $card->create(); +} catch (\PPConnectionException $ex) { + echo "Exception:" . $ex->getMessage() . PHP_EOL; + var_dump($ex->getData()); + exit(1); +} +?> + + +
    Saved a new credit card with id: getId();?>
    +
    + Back + + \ No newline at end of file diff --git a/sample/vault/GetCreditCard.php b/sample/vault/GetCreditCard.php new file mode 100644 index 0000000..4246b17 --- /dev/null +++ b/sample/vault/GetCreditCard.php @@ -0,0 +1,38 @@ +getId() +$cardId = "CARD-5BT058015C739554AKE2GCEI"; + +// ### Authentication +// Pass in a `OAuthTokenCredential` object +// explicilty to authenticate the call. +// If you skip this step, the client id/secret +// set in the config file will be used. +CreditCard::setCredential($cred); +/// ### Retrieve card +try { + $card = CreditCard::get($cardId); +} catch (\PPConnectionException $ex) { + echo "Exception: " . $ex->getMessage() . PHP_EOL; + var_dump($ex->getData()); + exit(1); +} +?> + + +
    Retrieving credit card:
    +
    + Back + + \ No newline at end of file diff --git a/tests/PayPal/Test/Api/AddressTest.php b/tests/PayPal/Test/Api/AddressTest.php new file mode 100644 index 0000000..3909d09 --- /dev/null +++ b/tests/PayPal/Test/Api/AddressTest.php @@ -0,0 +1,56 @@ +setLine1(self::$line1); + $addr->setLine2(self::$line2); + $addr->setCity(self::$city); + $addr->setState(self::$state); + $addr->setPostal_code(self::$postalCode); + $addr->setCountry_code(self::$countryCode); + $addr->setPhone(self::$phone); + $addr->setType(self::$type); + return $addr; + } + + public function setup() { + $this->address = self::createAddress(); + } + + public function testGetterSetter() { + $this->assertEquals(self::$line1, $this->address->getLine1()); + $this->assertEquals(self::$line2, $this->address->getLine2()); + $this->assertEquals(self::$city, $this->address->getCity()); + $this->assertEquals(self::$state, $this->address->getState()); + $this->assertEquals(self::$postalCode, $this->address->getPostal_code()); + $this->assertEquals(self::$countryCode, $this->address->getCountry_code()); + $this->assertEquals(self::$phone, $this->address->getPhone()); + $this->assertEquals(self::$type, $this->address->getType()); + } + + public function testSerializeDeserialize() { + $a1 = $this->address; + + $a2 = new Address(); + $a2->fromJson($a1->toJson()); + + $this->assertEquals($a1, $a2); + } +} \ No newline at end of file diff --git a/tests/PayPal/Test/Api/AmountDetailsTest.php b/tests/PayPal/Test/Api/AmountDetailsTest.php new file mode 100644 index 0000000..1456433 --- /dev/null +++ b/tests/PayPal/Test/Api/AmountDetailsTest.php @@ -0,0 +1,45 @@ +setSubtotal(self::$subtotal); + $amountDetails->setTax(self::$tax); + $amountDetails->setShipping(self::$shipping); + $amountDetails->setFee(self::$fee); + + return $amountDetails; + } + + public function setup() { + $this->amountDetails = self::createAmountDetails(); + } + + public function testGetterSetters() { + $this->assertEquals(self::$subtotal, $this->amountDetails->getSubtotal()); + $this->assertEquals(self::$tax, $this->amountDetails->getTax()); + $this->assertEquals(self::$shipping, $this->amountDetails->getShipping()); + $this->assertEquals(self::$fee, $this->amountDetails->getFee()); + } + + public function testSerializeDeserialize() { + $a1 = $this->amountDetails; + + $a2 = new AmountDetails(); + $a2->fromJson($a1->toJson()); + + $this->assertEquals($a1, $a2); + } +} \ No newline at end of file diff --git a/tests/PayPal/Test/Api/AmountTest.php b/tests/PayPal/Test/Api/AmountTest.php new file mode 100644 index 0000000..c1028c8 --- /dev/null +++ b/tests/PayPal/Test/Api/AmountTest.php @@ -0,0 +1,45 @@ +setCurrency(self::$currency); + $amount->setTotal(self::$total); + + return $amount; + } + + public function setup() { + $this->amounts['partial'] = self::createAmount(); + + $amount = self::createAmount(); + $amount->setDetails(AmountDetailsTest::createAmountDetails()); + $this->amounts['full'] = $amount; + } + + public function testGetterSetter() { + $this->assertEquals(self::$currency, $this->amounts['partial']->getCurrency()); + $this->assertEquals(self::$total, $this->amounts['partial']->getTotal()); + $this->assertEquals(AmountDetailsTest::$fee, $this->amounts['full']->getDetails()->getFee()); + } + + public function testSerializeDeserialize() { + $a1 = $this->amounts['partial']; + + $a2 = new Amount(); + $a2->fromJson($a1->toJson()); + + $this->assertEquals($a1, $a2); + } +} \ No newline at end of file diff --git a/tests/PayPal/Test/Api/AuthorizationTest.php b/tests/PayPal/Test/Api/AuthorizationTest.php new file mode 100644 index 0000000..baec44f --- /dev/null +++ b/tests/PayPal/Test/Api/AuthorizationTest.php @@ -0,0 +1,69 @@ +setCreate_time(self::$create_time); + $authorization->setId(self::$id); + $authorization->setState(self::$state); + + $authorization->setAmount(AmountTest::createAmount()); + $authorization->setLinks(array(LinkTest::createLink())); + + return $authorization; + } + + public function setup() { + $authorization = new Authorization(); + $authorization->setCreate_time(self::$create_time); + $authorization->setId(self::$id); + $authorization->setState(self::$state); + $authorization->setParent_payment(self::$parent_payment); + $this->authorizations['partial'] = $authorization; + + + $this->authorizations['full'] = self::createAuthorization(); + } + + public function testGetterSetter() { + $authorization = $this->authorizations['partial']; + $this->assertEquals(self::$create_time, $authorization->getCreate_time()); + $this->assertEquals(self::$id, $authorization->getId()); + $this->assertEquals(self::$state, $authorization->getState()); + $this->assertEquals(self::$parent_payment, $authorization->getParent_payment()); + + $authorization = $this->authorizations['full']; + $this->assertEquals(AmountTest::$currency, $authorization->getAmount()->getCurrency()); + $this->assertEquals(1, count($authorization->getLinks())); + } + + public function testSerializeDeserialize() { + $a1 = $this->authorizations['partial']; + + $a2 = new Authorization(); + $a2->fromJson($a1->toJson()); + + $this->assertEquals($a1, $a2); + } +} \ No newline at end of file diff --git a/tests/PayPal/Test/Api/CaptureTest.php b/tests/PayPal/Test/Api/CaptureTest.php new file mode 100644 index 0000000..45a0a88 --- /dev/null +++ b/tests/PayPal/Test/Api/CaptureTest.php @@ -0,0 +1,60 @@ +setAuthorization_id(self::$authorization_id); + $capture->setCreate_time(self::$create_time); + $capture->setDescription(self::$description); + $capture->setId(self::$id); + $capture->setParent_payment(self::$parent_payment); + $capture->setState(self::$state); + + return $capture; + } + + public function setup() { + $this->captures['partial'] = self::createCapture(); + + $capture = self::createCapture(); + $capture->setAmount(AmountTest::createAmount()); + $capture->setLinks(array(LinkTest::createLink())); + $this->captures['full'] = $capture; + } + + public function testGetterSetter() { + $this->assertEquals(self::$authorization_id, $this->captures['partial']->getAuthorization_id()); + $this->assertEquals(self::$create_time, $this->captures['partial']->getCreate_time()); + $this->assertEquals(self::$description, $this->captures['partial']->getDescription()); + $this->assertEquals(self::$id, $this->captures['partial']->getId()); + $this->assertEquals(self::$parent_payment, $this->captures['partial']->getParent_payment()); + $this->assertEquals(self::$state, $this->captures['partial']->getState()); + + $this->assertEquals(AmountTest::$currency, $this->captures['full']->getAmount()->getCurrency()); + $links = $this->captures['full']->getLinks(); + $this->assertEquals(LinkTest::$href, $links[0]->getHref()); + } + + public function testSerializeDeserialize() { + $c1 = $this->captures['partial']; + + $c2 = new Capture(); + $c2->fromJson($c1->toJson()); + + $this->assertEquals($c1, $c2); + } +} \ No newline at end of file diff --git a/tests/PayPal/Test/Api/CreditCardTest.php b/tests/PayPal/Test/Api/CreditCardTest.php new file mode 100644 index 0000000..e442e70 --- /dev/null +++ b/tests/PayPal/Test/Api/CreditCardTest.php @@ -0,0 +1,95 @@ +setType(self::$cardType); + $card->setNumber(self::$cardNumber); + $card->setExpire_month(self::$expireMonth); + $card->setExpire_year(self::$expireYear); + $card->setCvv2(self::$cvv); + $card->setFirst_name(self::$firstName); + $card->setLast_name(self::$lastName); + $card->setId(self::$id); + $card->setValid_until(self::$validUntil); + $card->setState(self::$state); + $card->setPayer_id(self::$payerId); + return $card; + } + + public function setup() { + + $card = self::createCreditCard(); + $card->setBilling_address(AddressTest::createAddress()); + $card->setLinks(array(LinkTest::createLink())); + $this->cards['full'] = $card; + + $card = self::createCreditCard(); + $this->cards['partial'] = $card; + } + + public function testGetterSetters() { + $c = $this->cards['partial']; + $this->assertEquals(self::$cardType, $c->getType()); + $this->assertEquals(self::$cardNumber, $c->getNumber()); + $this->assertEquals(self::$expireMonth, $c->getExpire_month()); + $this->assertEquals(self::$expireYear, $c->getExpire_year()); + $this->assertEquals(self::$cvv, $c->getCvv2()); + $this->assertEquals(self::$firstName, $c->getFirst_name()); + $this->assertEquals(self::$lastName, $c->getLast_name()); + $this->assertEquals(self::$id, $c->getId()); + $this->assertEquals(self::$validUntil, $c->getValid_until()); + $this->assertEquals(self::$state, $c->getState()); + $this->assertEquals(self::$payerId, $c->getPayer_id()); + + $c = $this->cards['full']; + $this->assertEquals(AddressTest::$line1, $c->getBilling_address()->getLine1()); + $link = $c->getLinks(); + $this->assertEquals(LinkTest::$href, $link[0]->getHref()); + } + + public function testSerializeDeserialize() { + $c1 = $this->cards['full']; + $json = $c1->toJson(); + + $c2 = new CreditCard(); + $c2->fromJson($json); + + $this->assertEquals($c1, $c2); + } + + public function testOperations() { + $c1 = $this->cards['full']; + +// $this->assertNull($c1->getId()); + $c1->create(); + $this->assertNotNull($c1->getId()); + + $c2 = CreditCard::get($c1->getId()); + $this->assertEquals($c1->getBilling_address(), $c2->getBilling_address()); + $this->assertGreaterThan(0, count($c2->getLinks())); + $this->assertEquals(self::$cardType, $c2->getType()); + $this->assertNotNull($c2->getState()); + } +} \ No newline at end of file diff --git a/tests/PayPal/Test/Api/CreditCardTokenTest.php b/tests/PayPal/Test/Api/CreditCardTokenTest.php new file mode 100644 index 0000000..75de222 --- /dev/null +++ b/tests/PayPal/Test/Api/CreditCardTokenTest.php @@ -0,0 +1,38 @@ +setPayer_id(self::$payerId); + $ccToken->setCredit_card_id(self::$creditCardId); + return $ccToken; + } + + public function setup() { + $this->ccToken = self::createCreditCardToken(); + } + + public function testGetterSetter() { + $this->assertEquals(self::$payerId, $this->ccToken->getPayer_id()); + $this->assertEquals(self::$creditCardId, $this->ccToken->getCredit_card_id()); + } + + public function testSerializeDeserialize() { + $t1 = $this->ccToken; + + $t2 = new CreditCardToken(); + $t2->fromJson($t1->toJson()); + + $this->assertEquals($t1, $t2); + } +} \ No newline at end of file diff --git a/tests/PayPal/Test/Api/FundingInstrumentTest.php b/tests/PayPal/Test/Api/FundingInstrumentTest.php new file mode 100644 index 0000000..5a93c36 --- /dev/null +++ b/tests/PayPal/Test/Api/FundingInstrumentTest.php @@ -0,0 +1,36 @@ +setCredit_card(CreditCardTest::createCreditCard()); + $fi->setCredit_card_token(CreditCardTokenTest::createCreditCardToken()); + return $fi; + } + + public function setup() { + $this->fi = self::createFundingInstrument(); + } + + public function testGetterSetter() { + $this->assertEquals(CreditCardTest::$cardNumber, $this->fi->getCredit_card()->getNumber()); + $this->assertEquals(CreditCardTokenTest::$creditCardId, + $this->fi->getCredit_card_token()->getCredit_card_id()); + } + + public function testSerializeDeserialize() { + $fi1 = $this->fi; + + $fi2 = new FundingInstrument(); + $fi2->fromJson($fi1->toJson()); + $this->assertEquals($fi1, $fi2); + } +} \ No newline at end of file diff --git a/tests/PayPal/Test/Api/ItemListTest.php b/tests/PayPal/Test/Api/ItemListTest.php new file mode 100644 index 0000000..96a6d2a --- /dev/null +++ b/tests/PayPal/Test/Api/ItemListTest.php @@ -0,0 +1,46 @@ +setItems(array($item)); + $itemList->setShipping_address(ShippingAddressTest::createAddress()); + + return $itemList; + } + + public function setup() { + $this->items = self::createItemList(); + } + + public function testGetterSetters() { + $items = $this->items->getItems(); + $this->assertEquals(ItemTest::createItem(), $items[0]); + $this->assertEquals(ShippingAddressTest::createAddress(), $this->items->getShipping_address()); + } + + public function testSerializeDeserialize() { + $itemList = new ItemList(); + $itemList->fromJson($this->items->toJSON()); + + $this->assertEquals($itemList, $this->items); + } + +} \ No newline at end of file diff --git a/tests/PayPal/Test/Api/ItemTest.php b/tests/PayPal/Test/Api/ItemTest.php new file mode 100644 index 0000000..59be288 --- /dev/null +++ b/tests/PayPal/Test/Api/ItemTest.php @@ -0,0 +1,46 @@ +setName(self::$name); + $item->setPrice(self::$price); + $item->setQuantity(self::$quantity); + $item->setSku(self::$sku); + $item->setCurrency(self::$currency); + + return $item; + } + public function setup() { + $this->item = ItemTest::createItem(); + } + + public function testGetterSetters() { + $this->assertEquals(self::$name, $this->item->getName()); + $this->assertEquals(self::$price, $this->item->getPrice()); + $this->assertEquals(self::$sku, $this->item->getSku()); + $this->assertEquals(self::$quantity, $this->item->getQuantity()); + $this->assertEquals(self::$currency, $this->item->getCurrency()); + } + + public function testSerializeDeserialize() { + $item = new Item(); + $item->fromJson($this->item->toJSON()); + + $this->assertEquals($item, $this->item); + } + +} \ No newline at end of file diff --git a/tests/PayPal/Test/Api/LinkTest.php b/tests/PayPal/Test/Api/LinkTest.php new file mode 100644 index 0000000..8deec92 --- /dev/null +++ b/tests/PayPal/Test/Api/LinkTest.php @@ -0,0 +1,40 @@ +setHref(self::$href); + $link->setRel(self::$rel); + $link->setMethod(self::$method); + + return $link; + } + + public function setup() { + $this->link = self::createLink(); + } + + public function testGetterSetters() { + $this->assertEquals(self::$href, $this->link->getHref()); + $this->assertEquals(self::$rel, $this->link->getRel()); + $this->assertEquals(self::$method, $this->link->getMethod()); + } + + public function testSerializeDeserialize() { + $link2 = new Link(); + $link2->fromJson($this->link->toJSON()); + $this->assertEquals($this->link, $link2); + } +} \ No newline at end of file diff --git a/tests/PayPal/Test/Api/PayeeTest.php b/tests/PayPal/Test/Api/PayeeTest.php new file mode 100644 index 0000000..95687c9 --- /dev/null +++ b/tests/PayPal/Test/Api/PayeeTest.php @@ -0,0 +1,44 @@ +setEmail(self::$email); + $payee->setMerchant_id(self::$merchant_id); + $payee->setPhone(self::$phone); + + return $payee; + } + + public function setup() { + $this->payee = self::createPayee(); + } + + public function testGetterSetter() { + $this->assertEquals(self::$email, $this->payee->getEmail()); + $this->assertEquals(self::$merchant_id, $this->payee->getMerchant_id()); + $this->assertEquals(self::$phone, $this->payee->getPhone()); + } + + public function testSerializeDeserialize() { + $p1 = $this->payee; + + $p2 = new Payee(); + $p2->fromJson($p1->toJson()); + + $this->assertEquals($p1, $p2); + } +} \ No newline at end of file diff --git a/tests/PayPal/Test/Api/PayerInfoTest.php b/tests/PayPal/Test/Api/PayerInfoTest.php new file mode 100644 index 0000000..ddf584d --- /dev/null +++ b/tests/PayPal/Test/Api/PayerInfoTest.php @@ -0,0 +1,50 @@ +setEmail(self::$email); + $payerInfo->setFirst_name(self::$firstName); + $payerInfo->setLast_name(self::$lastName); + $payerInfo->setPhone(self::$phone); + $payerInfo->setPayer_id(self::$payerId); + $payerInfo->setShipping_address(AddressTest::createAddress()); + + return $payerInfo; + } + + public function setup() { + $this->payerInfo = self::createPayerInfo(); + } + + public function testGetterSetter() { + $this->assertEquals(self::$email, $this->payerInfo->getEmail()); + $this->assertEquals(self::$firstName, $this->payerInfo->getFirst_name()); + $this->assertEquals(self::$lastName, $this->payerInfo->getLast_name()); + $this->assertEquals(self::$phone, $this->payerInfo->getPhone()); + $this->assertEquals(self::$payerId, $this->payerInfo->getPayer_id()); + $this->assertEquals(AddressTest::$line1, $this->payerInfo->getShipping_address()->getLine1()); + } + + public function testSerializeDeserialize() { + $p1 = $this->payerInfo; + + $p2 = new PayerInfo(); + $p2->fromJson($p1->toJson()); + + $this->assertEquals($p1, $p2); + } +} \ No newline at end of file diff --git a/tests/PayPal/Test/Api/PayerTest.php b/tests/PayPal/Test/Api/PayerTest.php new file mode 100644 index 0000000..f956a15 --- /dev/null +++ b/tests/PayPal/Test/Api/PayerTest.php @@ -0,0 +1,45 @@ +setPayment_method(self::$paymentMethod); + $payer->setPayer_info(PayerInfoTest::createPayerInfo()); + $payer->setFunding_instruments(array(FundingInstrumentTest::createFundingInstrument())); + + return $payer; + } + + public function setup() { + $this->payer = self::createPayer(); + } + + public function testGetterSetter() { + $this->assertEquals(self::$paymentMethod, $this->payer->getPayment_method()); + $this->assertEquals(PayerInfoTest::$email, $this->payer->getPayer_info()->getEmail()); + + $fi = $this->payer->getFunding_instruments(); + $this->assertEquals(CreditCardTokenTest::$creditCardId, $fi[0]->getCredit_card_token()->getCredit_card_id()); + } + + public function testSerializeDeserialize() { + $p1 = $this->payer; + + $p2 = new Payer(); + $p2->fromJson($p1->toJson()); + + $this->assertEquals($p1, $p2); + } +} \ No newline at end of file diff --git a/tests/PayPal/Test/Api/PaymentHistoryTest.php b/tests/PayPal/Test/Api/PaymentHistoryTest.php new file mode 100644 index 0000000..98885da --- /dev/null +++ b/tests/PayPal/Test/Api/PaymentHistoryTest.php @@ -0,0 +1,39 @@ +setCount(self::$count); + $history->setNext_id(self::$nextId); + $history->setPayments(array(PaymentTest::createPayment())); + return $history; + } + public function setup() { + $this->history = PaymentHistoryTest::createPaymentHistory(); + } + + public function testGetterSetters() { + $this->assertEquals(self::$count, $this->history->getCount()); + $this->assertEquals(self::$nextId, $this->history->getNext_id()); + + } + + public function testSerializeDeserialize() { + $history = new PaymentHistory(); + $history->fromJson($this->history->toJSON()); + + $this->assertEquals($history, $this->history); + } + +} \ No newline at end of file diff --git a/tests/PayPal/Test/Api/PaymentTest.php b/tests/PayPal/Test/Api/PaymentTest.php new file mode 100644 index 0000000..5bdaf31 --- /dev/null +++ b/tests/PayPal/Test/Api/PaymentTest.php @@ -0,0 +1,82 @@ +setReturn_url("http://localhost/return"); + $redirectUrls->setCancel_url("http://localhost/cancel"); + + $payment = new Payment(); + $payment->setIntent("sale"); + $payment->setRedirect_urls($redirectUrls); + $payment->setPayer(PayerTest::createPayer()); + $payment->setTransactions(array(TransactionTest::createTransaction())); + + return $payment; + } + + public static function createNewPayment() { + $payer = new Payer(); + $payer->setPayment_method("credit_card"); + $payer->setFunding_instruments(array(FundingInstrumentTest::createFundingInstrument())); + + $transaction = new Transaction(); + $transaction->setAmount(AmountTest::createAmount()); + $transaction->setDescription("This is the payment description."); + + $redirectUrls = new RedirectUrls(); + $redirectUrls->setReturn_url("http://localhost/return"); + $redirectUrls->setCancel_url("http://localhost/cancel"); + + $payment = new Payment(); + $payment->setIntent("sale"); + $payment->setRedirect_urls($redirectUrls); + $payment->setPayer($payer); + $payment->setTransactions(array($transaction)); + + return $payment; + } + + public function setup() { + $this->payments['full'] = self::createPayment(); + $this->payments['new'] = self::createNewPayment(); + } + + public function testSerializeDeserialize() { + $p2 = new Payment(); + $p2->fromJson($this->payments['full']->toJSON()); + $this->assertEquals($p2, $this->payments['full']); + } + + public function testOperations() { + + $p1 = $this->payments['new']; + + $p1->create(); + $this->assertNotNull($p1->getId()); + + $p2 = Payment::get($p1->getId()); + $this->assertNotNull($p2); + + $paymentHistory = Payment::all(array('count' => '10')); + $this->assertNotNull($paymentHistory); + } +} diff --git a/tests/PayPal/Test/Api/RefundTest.php b/tests/PayPal/Test/Api/RefundTest.php new file mode 100644 index 0000000..9a0387e --- /dev/null +++ b/tests/PayPal/Test/Api/RefundTest.php @@ -0,0 +1,57 @@ +setAmount(AmountTest::createAmount()); + $refund->setCapture_id(self::$captureId); + $refund->setCreate_time(self::$createTime); + $refund->setDescription(self::$description); + $refund->setId(self::$id); + $refund->setLinks(array(LinkTest::createLink())); + $refund->setParent_payment(self::$parentPayment); + + return $refund; + } + + public function setup() { + $this->refund = self::createRefund(); + } + + public function testGetterSetter() { + $this->assertEquals(self::$captureId, $this->refund->getCapture_id()); + $this->assertEquals(self::$createTime, $this->refund->getCreate_time()); + $this->assertEquals(self::$description, $this->refund->getDescription()); + $this->assertEquals(self::$id, $this->refund->getId()); + $this->assertEquals(self::$parentPayment, $this->refund->getParent_payment()); + $this->assertEquals(AmountTest::$currency, $this->refund->getAmount()->getCurrency()); + $links = $this->refund->getLinks(); + $this->assertEquals(LinkTest::$href, $links[0]->getHref()); + } + + public function testSerializeDeserialize() { + $r1 = $this->refund; + + $r2 = new Refund(); + $r2->fromJson($r1->toJson()); + + $this->assertEquals($r1, $r2); + } + + public function testOperations() { + + } +} \ No newline at end of file diff --git a/tests/PayPal/Test/Api/SaleTest.php b/tests/PayPal/Test/Api/SaleTest.php new file mode 100644 index 0000000..fb46f74 --- /dev/null +++ b/tests/PayPal/Test/Api/SaleTest.php @@ -0,0 +1,74 @@ +setAmount(AmountTest::createAmount()); + $sale->setCreate_time(self::$createTime); + $sale->setId(self::$id); + $sale->setLinks(array(LinkTest::createLink())); + $sale->setParent_payment(self::$parentPayment); + $sale->setState(self::$state); + return $sale; + } + + public function setup() { + $this->sale = self::createSale(); + } + + public function testGetterSetter() { + $this->assertEquals(self::$createTime, $this->sale->getCreate_time()); + $this->assertEquals(self::$id, $this->sale->getId()); + $this->assertEquals(self::$parentPayment, $this->sale->getParent_payment()); + $this->assertEquals(self::$state, $this->sale->getState()); + $this->assertEquals(AmountTest::$currency, $this->sale->getAmount()->getCurrency()); + $links = $this->sale->getLinks(); + $this->assertEquals(LinkTest::$href, $links[0]->getHref()); + } + + public function testSerializeDeserialize() { + $s1 = $this->sale; + + $s2 = new Sale(); + $s2->fromJson($s1->toJson()); + + $this->assertEquals($s1, $s2); + } + + public function testOperations() { + $payment = PaymentTest::createNewPayment(); + $payment->create(); + + $transactions = $payment->getTransactions(); + $resources = $transactions[0]->getRelated_resources(); + $saleId = $resources[0]->getSale()->getId(); + + $sale = Sale::get($saleId); + $this->assertNotNull($sale); + + $refund = new Refund(); + $refund->setAmount(AmountTest::createAmount()); + $sale->refund($refund); + + $this->setExpectedException('\InvalidArgumentException'); + $sale->refund(NULL); + } +} \ No newline at end of file diff --git a/tests/PayPal/Test/Api/ShippingAddressTest.php b/tests/PayPal/Test/Api/ShippingAddressTest.php new file mode 100644 index 0000000..4560ae1 --- /dev/null +++ b/tests/PayPal/Test/Api/ShippingAddressTest.php @@ -0,0 +1,59 @@ +setLine1(self::$line1); + $addr->setLine2(self::$line2); + $addr->setCity(self::$city); + $addr->setState(self::$state); + $addr->setPostal_code(self::$postalCode); + $addr->setCountry_code(self::$countryCode); + $addr->setPhone(self::$phone); + $addr->setRecipient_name(self::$recipientName); + $addr->setType(self::$type); + return $addr; + } + + public function setup() { + $this->address = self::createAddress(); + } + + public function testGetterSetter() { + $this->assertEquals(self::$line1, $this->address->getLine1()); + $this->assertEquals(self::$line2, $this->address->getLine2()); + $this->assertEquals(self::$city, $this->address->getCity()); + $this->assertEquals(self::$state, $this->address->getState()); + $this->assertEquals(self::$postalCode, $this->address->getPostal_code()); + $this->assertEquals(self::$countryCode, $this->address->getCountry_code()); + $this->assertEquals(self::$phone, $this->address->getPhone()); + $this->assertEquals(self::$recipientName, $this->address->getRecipient_name()); + $this->assertEquals(self::$type, $this->address->getType()); + } + + public function testSerializeDeserialize() { + $a1 = $this->address; + + $a2 = new ShippingAddress(); + $a2->fromJson($a1->toJson()); + + $this->assertEquals($a1, $a2); + } +} \ No newline at end of file diff --git a/tests/PayPal/Test/Api/SubTransactionTest.php b/tests/PayPal/Test/Api/SubTransactionTest.php new file mode 100644 index 0000000..7d57496 --- /dev/null +++ b/tests/PayPal/Test/Api/SubTransactionTest.php @@ -0,0 +1,35 @@ +setAuthorization(AuthorizationTest::createAuthorization()); + $subTransaction->setCapture(CaptureTest::createCapture()); + return $subTransaction; + } + + public function setup() { + $this->subTransaction = self::createSubTransaction(); + } + + public function testGetterSetter() { + $this->assertEquals(AuthorizationTest::$create_time, $this->subTransaction->getAuthorization()->getCreate_Time()); + $this->assertEquals(CaptureTest::$create_time, $this->subTransaction->getCapture()->getCreate_Time()); + } + + public function testSerializeDeserialize() { + $s1 = $this->subTransaction; + + $s2 = new SubTransaction(); + $s2->fromJson($s1->toJson()); + + $this->assertEquals($s1, $s2); + } +} \ No newline at end of file diff --git a/tests/PayPal/Test/Api/TransactionTest.php b/tests/PayPal/Test/Api/TransactionTest.php new file mode 100644 index 0000000..d23b281 --- /dev/null +++ b/tests/PayPal/Test/Api/TransactionTest.php @@ -0,0 +1,49 @@ +setAmount(AmountTest::createAmount()); + $transaction->setDescription(self::$description); + $transaction->setItem_list(ItemListTest::createItemList()); + $transaction->setPayee(PayeeTest::createPayee()); + $transaction->setRelated_resources( array(SubTransactionTest::createSubTransaction()) ); + return $transaction; + } + + public function setup() { + $this->transaction = self::createTransaction(); + } + + public function testGetterSetter() { + $this->assertEquals(AmountTest::$currency, $this->transaction->getAmount()->getCurrency()); + $this->assertEquals(self::$description, $this->transaction->getDescription()); + $items = $this->transaction->getItem_list()->getItems(); + $this->assertEquals(ItemTest::$quantity, $items[0]->getQuantity()); + $this->assertEquals(PayeeTest::$email, $this->transaction->getPayee()->getEmail()); + $resources = $this->transaction->getRelated_resources(); + $this->assertEquals(AuthorizationTest::$create_time, $resources[0]->getAuthorization()->getCreate_Time()); + } + + public function testSerializeDeserialize() { + $t1 = $this->transaction; + + $t2 = new Transaction(); + $t2->fromJson($t1->toJson()); + + $this->assertEquals($t1, $t2); + } +} \ No newline at end of file diff --git a/tests/PayPal/Test/Auth/OAuthTokenCredentialTest.php b/tests/PayPal/Test/Auth/OAuthTokenCredentialTest.php new file mode 100644 index 0000000..962b42b --- /dev/null +++ b/tests/PayPal/Test/Auth/OAuthTokenCredentialTest.php @@ -0,0 +1,33 @@ +getAccessToken(); + $this->assertNotNull($token); + + // Check that we get the same token when issuing a new call before token expiry + $newToken = $cred->getAccessToken(); + $this->assertNotNull($newToken); + $this->assertEquals($token, $newToken); + +// sleep(60*8); +// $newToken = $cred->getAccessToken(); +// $this->assertNotNull($newToken); +// $this->assertNotEqual($token, $newToken); + + } + + public function testInvalidCredentials() { + $this->setExpectedException('\PPConnectionException'); + $cred = new OAuthTokenCredential('dummy', 'secret'); + $this->assertNull($cred->getAccessToken()); + } +} \ No newline at end of file diff --git a/tests/PayPal/Test/Common/ArrayUtilTest.php b/tests/PayPal/Test/Common/ArrayUtilTest.php new file mode 100644 index 0000000..c6c79ca --- /dev/null +++ b/tests/PayPal/Test/Common/ArrayUtilTest.php @@ -0,0 +1,22 @@ +assertEquals(false, ArrayUtil::isAssocArray($arr)); + + $arr = array( + 'name' => 'John Doe', + 'City' => 'San Jose' + ); + $this->assertEquals(true, ArrayUtil::isAssocArray($arr)); + + $arr[] = 'CA'; + $this->assertEquals(false, ArrayUtil::isAssocArray($arr)); + } +} diff --git a/tests/PayPal/Test/Common/ModelTest.php b/tests/PayPal/Test/Common/ModelTest.php new file mode 100644 index 0000000..c810b7f --- /dev/null +++ b/tests/PayPal/Test/Common/ModelTest.php @@ -0,0 +1,135 @@ +name = $name; + } + public function getName() { + return $this->name; + } + + public function setDescription($desc) { + $this->desc = $desc; + } + public function getDescription() { + return $this->desc; + } +} + +class ArrayClass extends Model { + + public function setName($name) { + $this->name = $name; + } + public function getName() { + return $this->name; + } + + public function setDescription($desc) { + $this->desc = $desc; + } + public function getDescription() { + return $this->desc; + } + + public function setTags($tags) { + if(!is_array($tags)) { + $tags = array($tags); + } + $this->tags = $tags; + } + public function getTags() { + return $this->tags; + } +} + +class NestedClass extends Model { + + public function setId($id) { + $this->id = $id; + } + public function getId() { + return $this->id; + } + + /** + * + * @param ArrayClass $info + */ + public function setInfo($info) { + $this->info = $info; + } + public function getInfo() { + return $this->info; + } +} + +class ChildClass extends SimpleClass { + +} + +class ModelTest extends PHPUnit_Framework_TestCase { + + public function testSimpleClassConversion() { + $o = new SimpleClass(); + $o->setName("test"); + $o->setDescription("description"); + + $this->assertEquals("test", $o->getName()); + $this->assertEquals("description", $o->getDescription()); + + $json = $o->toJSON(); + $this->assertEquals('{"name":"test","desc":"description"}', $json); + + $newO = new SimpleClass(); + $newO->fromJson($json); + $this->assertEquals($o, $newO); + + } + + + public function testArrayClassConversion() { + $o = new ArrayClass(); + $o->setName("test"); + $o->setDescription("description"); + $o->setTags(array('payment', 'info', 'test')); + + $this->assertEquals("test", $o->getName()); + $this->assertEquals("description", $o->getDescription()); + $this->assertEquals(array('payment', 'info', 'test'), $o->getTags()); + + $json = $o->toJSON(); + $this->assertEquals('{"name":"test","desc":"description","tags":["payment","info","test"]}', $json); + + $newO = new ArrayClass(); + $newO->fromJson($json); + $this->assertEquals($o, $newO); + } + + public function testNestedClassConversion() { + $n = new ArrayClass(); + $n->setName("test"); + $n->setDescription("description"); +// $n->setTags(array('payment', 'info', 'test')); + $o = new NestedClass(); + $o->setId('123'); + $o->setInfo($n); + + $this->assertEquals("123", $o->getId()); + $this->assertEquals("test", $o->getInfo()->getName()); +// $this->assertEquals(array('payment', 'info', 'test'), $o->getInfo()->getTags()); + + $json = $o->toJSON(); +// $this->assertEquals('{"id":"123","info":{"name":"test","desc":"description","tags":["payment","info","test"]}}', $json); + $this->assertEquals('{"id":"123","info":{"name":"test","desc":"description"}}', $json); + + $newO = new NestedClass(); + $newO->fromJson($json); + $this->assertEquals($o, $newO); + } +} \ No newline at end of file diff --git a/tests/PayPal/Test/Common/UserAgentTest.php b/tests/PayPal/Test/Common/UserAgentTest.php new file mode 100644 index 0000000..9436ab2 --- /dev/null +++ b/tests/PayPal/Test/Common/UserAgentTest.php @@ -0,0 +1,23 @@ +assertNotNull($id); + $this->assertNotNull($version); + $this->assertNotNull($features); + + // Check that we pass in these mininal features + $this->assertThat($features, $this->stringContains("OS=")); + $this->assertThat($features, $this->stringContains("Bit=")); + $this->assertThat($features, $this->stringContains("Lang=")); + $this->assertThat($features, $this->stringContains("V=")); + $this->assertGreaterThan(5, count(explode(';', $features))); + } +} \ No newline at end of file diff --git a/tests/PayPal/Test/Constants.php b/tests/PayPal/Test/Constants.php new file mode 100644 index 0000000..7c424e3 --- /dev/null +++ b/tests/PayPal/Test/Constants.php @@ -0,0 +1,7 @@ +execute('/v1/payments/echo', "POST", $data, $cred); + $this->assertEquals($data, $ret); + } + + public function testExecuteWithInvalidCredentials() { + + $cred = new OAuthTokenCredential('test', 'dummy'); + $data = '"request":"test message"'; + + $call = new Call(); + $this->setExpectedException('\PPConnectionException'); + $ret = $call->execute('/v1/payments/echo', "POST", $data, $cred); + + } + + + public function testExecuteWithDefaultCredentials() { + + $data = '"request":"test message"'; + + $call = new Call(); + $ret = $call->execute('/v1/payments/echo', "POST", $data); + $this->assertEquals($data, $ret); + } +} \ No newline at end of file diff --git a/tests/bootstrap.php b/tests/bootstrap.php new file mode 100644 index 0000000..d249596 --- /dev/null +++ b/tests/bootstrap.php @@ -0,0 +1,6 @@ +add('PayPal\\Test', __DIR__); +define("PP_CONFIG_PATH", __DIR__); \ No newline at end of file diff --git a/tests/sdk_config.ini b/tests/sdk_config.ini new file mode 100644 index 0000000..f73b92a --- /dev/null +++ b/tests/sdk_config.ini @@ -0,0 +1,35 @@ +;Account credentials from developer portal +[Account] +acct1.ClientId = EBWKjlELKMYqRNQ6sYvFo64FtaRLRR5BdHEESmha49TM +acct1.ClientSecret = EO422dn3gQLgDbuwqTjzrFgFtaRLRR5BdHEESmha49TM + + +;Connection Information +[Http] +http.ConnectionTimeOut = 30 +http.Retry = 1 +;http.Proxy=http://[username:password]@hostname[:port][/path] + + +;Service Configuration +[Service] +service.EndPoint="https://api.sandbox.paypal.com" +; Uncomment this line for integrating with the live endpoint +; service.EndPoint="https://api.paypal.com" + + +;Logging Information +[Log] + +log.LogEnabled=true + +# When using a relative path, the log file is created +# relative to the .php file that is the entry point +# for this request. You can also provide an absolute +# path here +log.FileName=PayPal.log + +# Logging level can be one of FINE, INFO, WARN or ERROR +# Logging is most verbose in the 'FINE' level and +# decreases as you proceed towards ERROR +log.LogLevel=FINE