File manager - Edit - /home/linknsbh/sabel-eltaqwa.com/assets/lfm/files/shares/events/thumbs/paypal.tar
Back
rest-api-sdk-php/phpunit.integration.xml 0000644 00000002127 15213403564 0014374 0 ustar 00 <?xml version="1.0" encoding="UTF-8"?> <phpunit bootstrap="./tests/bootstrap.php" colors="true" processIsolation="false" stopOnFailure="false" syntaxCheck="false" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" testSuiteLoaderClass="PHPUnit_Runner_StandardTestSuiteLoader"> <php> <env name="REST_MODE" value="sandbox"/> </php> <testsuites> <testsuite name="All"> <directory>tests</directory> </testsuite> </testsuites> <logging> <log type="junit" target="build/junit.xml" logIncompleteSkipped="false" /> <log type="coverage-html" target="build/coverage/" charset="UTF-8" highlight="true" lowUpperBound="35" highLowerBound="70"/> <log type="coverage-clover" target="build/coverage/clover.xml"/> </logging> <filter> <whitelist> <directory suffix=".php">./lib</directory> <exclude> </exclude> </whitelist> </filter> </phpunit> rest-api-sdk-php/CHANGELOG.md 0000644 00000024051 15213403564 0011452 0 ustar 00 PayPal PHP SDK release notes ============================ 1.14.0 ----- * Update sdk_config.ini log.LogLevel comments [#983](https://github.com/paypal/PayPal-PHP-SDK/pull/983). * Update RefundCapture.php [#998](https://github.com/paypal/PayPal-PHP-SDK/pull/998). * update readme for direct credit card restriction [#1019](https://github.com/paypal/PayPal-PHP-SDK/pull/1019). * Add PHP 7.1 and 7.2 in travis build [#1061](https://github.com/paypal/PayPal-PHP-SDK/pull/1061). * Custom cache directory line was not written [#1062](https://github.com/paypal/PayPal-PHP-SDK/pull/1062). * Re-Order the array keys so that JSON will be an array, not an object [#1034](https://github.com/paypal/PayPal-PHP-SDK/pull/1034). * Refactoring tests [#1011](https://github.com/paypal/PayPal-PHP-SDK/pull/1011). * Added condition to ignore extra header [#1060](https://github.com/paypal/PayPal-PHP-SDK/pull/1060). * Fix links to Developer API Reference [#1095](https://github.com/paypal/PayPal-PHP-SDK/pull/1095). * adding target subject to the generate access token call. 1.13.0 ----- * Add HUF as a non-decimal currency [#974](https://github.com/paypal/PayPal-PHP-SDK/pull/974). * Add `purchaseOrder` in `CartBase` [#939](https://github.com/paypal/PayPal-PHP-SDK/pull/939). * Fixed annotation bug [#872](https://github.com/paypal/PayPal-PHP-SDK/pull/872). * Update PHPUnit [#979](https://github.com/paypal/PayPal-PHP-SDK/pull/979). 1.12.0 ----- * Add `getToken` method to `Payment` class to retrieve EC token from approval URL. * Add TLSv1.2 to cipher list [#844](https://github.com/paypal/PayPal-PHP-SDK/pull/844). * Use restCall object for function that makes REST requests [#841](https://github.com/paypal/PayPal-PHP-SDK/pull/841). * Minor bugfixes [#766](https://github.com/paypal/PayPal-PHP-SDK/issues/766), [#798](https://github.com/paypal/PayPal-PHP-SDK/issues/798), [#845](https://github.com/paypal/PayPal-PHP-SDK/pull/845). * Updated samples. 1.11.0 ----- * Update third party payment sample with PayPal payment. * Prevent error in SSL version check if curl is not available [#706](https://github.com/paypal/PayPal-PHP-SDK/pull/706). * Stop auto-generating PayPal-Request-Id header values and allow SDK users to optionally set the value [#747](https://github.com/paypal/PayPal-PHP-SDK/pull/747). * Remove automatic retries on failed requests [#747](https://github.com/paypal/PayPal-PHP-SDK/pull/747). 1.10.0 ----- * Updated Payments APIs [#700](https://github.com/paypal/PayPal-PHP-SDK/pull/700). * Minor bug fixes. 1.9.0 ----- * Updated Payouts APIs [#692](https://github.com/paypal/PayPal-PHP-SDK/pull/692). * Updated Payment Experience APIs [#682](https://github.com/paypal/PayPal-PHP-SDK/pull/682). * Updated Payments API to use Payment Card instead of credit card [#696](https://github.com/paypal/PayPal-PHP-SDK/pull/696). * Fixed bug on failed Access token call. [#665](https://github.com/paypal/PayPal-PHP-SDK/pull/665). 1.8.0 ----- * Updated Webhooks APIs [#653](https://github.com/paypal/PayPal-PHP-SDK/pull/653). * Updated Invoicing APIs [#657](https://github.com/paypal/PayPal-PHP-SDK/pull/657). * UTF-8 encoding bug fix [#655](https://github.com/paypal/PayPal-PHP-SDK/pull/655). * Updated PSR log [#654](https://github.com/paypal/PayPal-PHP-SDK/pull/654). 1.7.4 ----- * Fixed Duplicate conditional expression in PayPalCredentialManager.php [#594](https://github.com/paypal/PayPal-PHP-SDK/pull/594). * Updated Invoicing APIs [#605](https://github.com/paypal/PayPal-PHP-SDK/pull/605). * Fixed PSR code style errors [#607](https://github.com/paypal/PayPal-PHP-SDK/pull/607). 1.7.3 ----- * Enabled Third Party Invoicing [#581](https://github.com/paypal/PayPal-PHP-SDK/pull/581). 1.7.2 ---- * Vault API updates. * Fixes #575. 1.7.1 ---- * Fixes #559. 1.7.0 ---- * Enable custom logger injection. * Minor bug fixes. 1.6.4 ---- * SSL Connect Error Fix. * Fixes #474. 1.6.3 ---- * Fixes Continue 100 Header. * Minor Bug Fixes #452. 1.6.2 ---- * TLS Check Sample Added. * Updated README. 1.6.1 ---- * User Agent Changes. * SDK Version Fix. 1.6.0 ---- * Updated Payments API to latest version. * Removed ModelAccessValidator. * Minor Bug Fixes #399. 1.5.1 ---- * Fixed a bug #343 in Future Payment. * Minor Improvements. * Updates to Sample Docs. 1.5.0 ---- * Enabled Vault List API. * Added More Fields to Vault Credit Card Object. * Minor Fixes. 1.4.0 ---- * Ability to validate Webhook. * Fixes to Logging Manager to skip if mode is not set. * SDK updates and fixes. 1.3.2 ---- * Minor Fix for Agreement Details. 1.3.1 ---- * PayPalModel to differentiate between empty objects and array. * Fixed CURLINFO_HEADER_SIZE miscalculations if Proxy Enabled. 1.3.0 ---- * Updated Payment APIs. * Updating ModelAccessValidator to be disabled if not set explicitly. 1.2.1 ---- * Ability to handle missing accessors for unknown objects in json. 1.2.0 ---- * Order API Support. * Introduced DEBUG mode in Logging. Deprecated FINE. * Ability to not Log on DEBUG, while on live environment. * Vault APIs Update API Support. * Transaction Fee Added in Sale Object. * Fixed #237, #234, #233, #215. 1.1.1 ---- * Fix to Cipher Encryption (Critical). 1.1.0 ---- * Enabled Payouts Cancel API Support for Unclaimed Payouts. * Encrypting Access Token in Cached Storage. * Updated Billing Agreement Search Transaction code to pass start_date and end_date. * Updated OAuthToken to throw proper error on not receiving access token. * Minor Bug Fixes and Documentation Updates. 1.0.0 ---- * Enabled Payouts API Support. * Authorization Cache Custom Path Directory Configuration. * Helper Functions to retrieve specific HATEOS Links. * Default Mode set to Sandbox. * Enabled Rest SDK to work nicely with Classic SDKs. * If missing annotation of return type in Getters, it throws a proper exception. * `echo` on PayPalModel Objects will print nice looking JSON. * Updated Invoice Object to retrieve payments and refunds. > ## Breaking Changes * Removed Deprecated Getter Setters from all Model Classes. * All Camelcase getters and setters are removed. Please use first letter uppercase syntax. * E.g. instead of using get_notify_url(), use getNotifyUrl() instead. * Renamed Classes. * PayPal\Common\PPModel => PayPal\Common\PayPalModel. * PayPal\Common\ResourceModel => PayPal\Common\PayPalResourceModel. * PayPal\Common\PPUserAgent => PayPal\Common\PayPalUserAgent. * PayPal\Core\PPConfigManager => PayPal\Core\PayPalConfigManager. * PayPal\Core\PPConstants => PayPal\Core\PayPalConstants. * PayPal\Core\PPCredentialManager => PayPal\Core\PayPalCredentialManager. * PayPal\Core\PPHttpConfig => PayPal\Core\PayPalHttpConfig. * PayPal\Core\PPHttpConnection => PayPal\Core\PayPalHttpConnection. * PayPal\Core\PPLoggingLevel => PayPal\Core\PayPalLoggingLevel. * PayPal\Core\PPLoggingManager => PayPal\Core\PayPalLoggingManager. * PayPal\Exception\PPConfigurationException => PayPal\Exception\PayPalConfigurationException. * PayPal\Exception\PPConnectionException => PayPal\Exception\PayPalConnectionException. * PayPal\Exception\PPInvalidCredentialException => PayPal\Exception\PayPalInvalidCredentialException. * PayPal\Exception\PPMissingCredentialException => PayPal\Exception\PayPalMissingCredentialException. * PayPal\Handler\IPPHandler => PayPal\Handler\IPayPalHandler. * PayPal\Transport\PPRestCall => PayPal\Transport\PayPalRestCall. * Namespace Changes and Class Naming Convention. * PayPal\Common\FormatConverter => PayPal\Converter\FormatConverter. * PayPal\Rest\RestHandler => PayPal\Handler\RestHandler. * PayPal\Rest\OauthHandler => PayPal\Handler\OauthHandler. * Fixes to Methods. * PayPal\Api\Invoice->getPaymentDetails() was renamed to getPayments(). * PayPal\Api\Invoice->getRefundDetails() was renamed to getRefunds(). 1.0.0-beta ---- * Namespace Changes and Class Naming Convention. * Helper Functions to retrieve specific HATEOS Links. * Default Mode set to Sandbox. 0.16.1 ---- * Configurable Headers for all requests to PayPal. * Allows adding additional headers to every call to PayPal APIs. * SDK Config to add headers with http.headers.* syntax. 0.16.0 ---- * Enabled Webhook Management Capabilities. * Enabled Caching Abilities for Access Tokens. 0.15.1 ---- * Enabled Deleting Billing Plans. * Updated Samples. 0.15.0 ---- * Extended Invoicing Capabilities. * Allows QR Code Generation for Invoices. * Updated Formatter to work with multiple locales. * Removed Future Payments mandate on Correlation Id. 0.14.2 ---- * Quick Patch to Unset Cipher List for NSS. 0.14.1 ---- * Updated HttpConfig to use TLSv1 as Cipher List. * Added resetRequestId in ApiContext to enable multiple create calls in succession. * Sanitize Input for Price Variables. * Made samples look better and work best. 0.14.0 ---- * Enabled Billing Plans and Agreements APIs. * Renamed SDK name to PayPal-PHP-SDK. 0.13.2 ---- * Updated Future Payments and LIPP Support. * Updated Logging Syntax. 0.13.1 ---- * Enabled TLS version 1.x for SSL Negotiation. * Updated Identity Support from SDK Core. * Fixed Backward Compatibility changes. 0.13.0 ---- * Enabled Payment Experience. 0.12.0 ---- * Enabled EC Parameters Support for Payment APIs. * Enabled Validation for Missing Accessors. 0.11.1 ---- * Removed Dependency from SDK Core Project. * Enabled Future Payments. 0.11.0 ---- * Ability for PUT and PATCH requests. * Invoice number, custom and soft descriptor. * Order API and tests, more Authorization tests. * remove references to sdk-packages. * patch for retrieving paid invoices. * Shipping address docs patch. * Remove @array annotation. * Validate return cancel url. * type hinting, comment cleaning, and getters and setters for Shipping. 0.10.0 ----- * N/A. 0.9.0 ----- * N/A. 0.8.0 ----- * Invoicing API support added. 0.7.1 ----- * Added support for Reauthorization. 0.7.0 ----- * Added support for Auth and Capture APIs. * Types modified to match the API Spec. * Updated SDK to use namespace supported core library. 0.6.0 ----- * Adding support for dynamic configuration of SDK (Upgrading sdk-core-php dependency to V1.4.0). * Deprecating the setCredential method and changing resource class methods to take an ApiContext argument instead of a OauthTokenCredential argument. 0.5.0 ----- * Initial Release. rest-api-sdk-php/phpunit.xml 0000644 00000001747 15213403564 0012061 0 ustar 00 <?xml version="1.0" encoding="UTF-8"?> <phpunit bootstrap="./tests/bootstrap.php" colors="true" processIsolation="false" stopOnFailure="false" syntaxCheck="false" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" testSuiteLoaderClass="PHPUnit_Runner_StandardTestSuiteLoader"> <testsuites> <testsuite name="All"> <directory>tests</directory> </testsuite> </testsuites> <groups> <exclude> <group>integration</group> </exclude> </groups> <logging> <log type="junit" target="build/junit.xml" logIncompleteSkipped="false" /> <log type="coverage-clover" target="build/coverage/clover.xml"/> </logging> <filter> <whitelist> <directory suffix=".php">./lib</directory> <exclude> </exclude> </whitelist> </filter> </phpunit> rest-api-sdk-php/README.md 0000644 00000010456 15213403564 0011124 0 ustar 00 # REST API SDK for PHP  [](https://travis-ci.org/paypal/PayPal-PHP-SDK) [](https://coveralls.io/r/paypal/PayPal-PHP-SDK?branch=master) __Welcome to PayPal PHP SDK__. This repository contains PayPal's PHP SDK and samples for REST API. ## Direct Credit Card Support > **Important: The PayPal REST API no longer supports new direct credit card integrations.** Please instead consider [Braintree Direct](https://www.braintreepayments.com/products/braintree-direct); which is, PayPal's preferred integration solution for accepting direct credit card payments in your mobile app or website. Braintree, a PayPal service, is the easiest way to accept credit cards, PayPal, and many other payment methods. ## Please Note > **The Payment Card Industry (PCI) Council has [mandated](https://blog.pcisecuritystandards.org/migrating-from-ssl-and-early-tls) that early versions of TLS be retired from service. All organizations that handle credit card information are required to comply with this standard. As part of this obligation, PayPal is updating its services to require TLS 1.2 for all HTTPS connections. At this time, PayPal will also require HTTP/1.1 for all connections. [Click here](https://github.com/paypal/tls-update) for more information** > **Connections to the sandbox environment use only TLS 1.2.** ## SDK Documentation [Our PayPal-PHP-SDK Page](http://paypal.github.io/PayPal-PHP-SDK/) includes all the documentation related to PHP SDK. Everything from SDK Wiki, to Sample Codes, to Releases. Here are few quick links to get you there faster. * [PayPal-PHP-SDK Home Page](https://paypal.github.io/PayPal-PHP-SDK/) * [Wiki](https://github.com/paypal/PayPal-PHP-SDK/wiki) * [Samples](https://paypal.github.io/PayPal-PHP-SDK/sample/) * [Installation](https://github.com/paypal/PayPal-PHP-SDK/wiki/Installation) * [Make your First SDK Call](https://github.com/paypal/PayPal-PHP-SDK/wiki/Making-First-Call) * [PayPal Developer Docs](https://developer.paypal.com/docs/) ## Latest Updates - SDK now allows injecting your logger implementation. Please read [documentation](https://github.com/paypal/PayPal-PHP-SDK/wiki/Custom-Logger) for more details. - If you are running into SSL Connect Error talking to sandbox or live, please update your SDK to latest version or, follow instructions as shown [here](https://github.com/paypal/PayPal-PHP-SDK/issues/474) - Checkout the latest 1.0.0 release. Here are all the [breaking Changes in v1.0.0](https://github.com/paypal/PayPal-PHP-SDK/wiki/Breaking-Changes---1.0.0) if you are migrating from older versions. - Now we have a [Github Page](https://paypal.github.io/PayPal-PHP-SDK/), that helps you find all helpful resources building applications using PayPal-PHP-SDK. ## 2.0 Release Candidate! We're releasing a [brand new version of our SDK!](https://github.com/paypal/PayPal-php-SDK/tree/2.0-beta) 2.0 is currently at release candidate status, and represents a full refactor, with the goal of making all of our APIs extremely easy to use. 2.0 includes all of the existing APIs (except payouts), and includes the new Orders API (Disputes and Marketplace coming soon). Check out the [FAQ and migration guide](https://github.com/paypal/PayPal-php-SDK/tree/2.0-beta/docs), and let us know if you have any suggestions or issues! ## Prerequisites - PHP 5.3 or above - [curl](https://secure.php.net/manual/en/book.curl.php), [json](https://secure.php.net/manual/en/book.json.php) & [openssl](https://secure.php.net/manual/en/book.openssl.php) extensions must be enabled ## License Read [License](LICENSE) for more licensing information. ## Contributing Read [here](CONTRIBUTING.md) for more information. ## More help * [Going Live](https://github.com/paypal/PayPal-PHP-SDK/wiki/Going-Live) * [PayPal-PHP-SDK Home Page](http://paypal.github.io/PayPal-PHP-SDK/) * [SDK Documentation](https://github.com/paypal/PayPal-PHP-SDK/wiki) * [Sample Source Code](http://paypal.github.io/PayPal-PHP-SDK/sample/) * [API Reference](https://developer.paypal.com/docs/api/) * [Reporting Issues / Feature Requests](https://github.com/paypal/PayPal-PHP-SDK/issues) rest-api-sdk-php/LICENSE 0000644 00000014325 15213403564 0010651 0 ustar 00 The PayPal PHP SDK is released under the following license: Copyright (c) 2013-2016 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. rest-api-sdk-php/composer.json 0000644 00000001265 15213403564 0012365 0 ustar 00 { "name": "paypal/rest-api-sdk-php", "description": "PayPal's PHP SDK for REST APIs", "keywords": ["paypal", "payments", "rest", "sdk"], "type": "library", "license": "Apache-2.0", "homepage": "http://paypal.github.io/PayPal-PHP-SDK/", "authors": [ { "name": "PayPal", "homepage": "https://github.com/paypal/rest-api-sdk-php/contributors" } ], "require": { "php": ">=5.3.0", "ext-curl": "*", "ext-json": "*", "psr/log": "^1.0.0" }, "require-dev": { "phpunit/phpunit": "^4.8.35" }, "autoload": { "psr-0": { "PayPal": "lib/" } } } rest-api-sdk-php/.github/ISSUE_TEMPLATE.md 0000644 00000001464 15213403564 0013711 0 ustar 00 <!-- ** General notice: if you have an API issue, see our [REST API issues](https://github.com/paypal/PayPal-REST-API-issues) repository, or contact [PayPal Tech Support](https://developer.paypal.com/support/). ** --> ### General information * SDK/Library version: <!-- Example: 4.7.2 --> * Environment: <!-- Is this issue in Sandbox or Production? --> * `PayPal-Debug-ID` values: <!-- Report PayPal-Debug-IDs from any logs --> * Language, language version, and OS: <!-- Example: Java 1.8.0_101-b13 on Ubuntu 16.10 --> ### Issue description <!-- To help us quickly reproduce your issue, include as many details as possible, such as logs, steps to reproduce, and so on. If the issue reports a new feature, follow the [user story](https://en.wikipedia.org/wiki/User_story) format to clearly describe the use case. --> rest-api-sdk-php/.gitattributes 0000644 00000000466 15213403564 0012540 0 ustar 00 tests/ export-ignore sample/ export-ignore docs/ export-ignore .coveralls.yml export-ignore .editorconfig export-ignore .releasinator.rb export-ignore .travis.yml export-ignore CONTRIBUTING.md export-ignore Gemfile export-ignore Gemfile.lock export-ignore Rakefile export-ignore generate-api.sh export-ignore rest-api-sdk-php/.gitignore 0000644 00000000315 15213403564 0011626 0 ustar 00 build .DS_Store phpunit.local.xml *.log # IDE .idea .project .settings .buildpath atlassian-ide-plugin.xml *.bak # Composer vendor composer.lock composer.phar # Project var tools # Groc node_modules rest-api-sdk-php/lib/PayPal/Api/Payout.php 0000644 00000011561 15213403564 0014302 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalResourceModel; use PayPal\Rest\ApiContext; use PayPal\Transport\PayPalRestCall; use PayPal\Validation\ArgumentValidator; /** * Class Payout * * This object represents a set of payouts that includes status data for the payouts. This object enables you to create a payout using a POST request. * * @package PayPal\Api * * @property \PayPal\Api\PayoutSenderBatchHeader sender_batch_header * @property \PayPal\Api\PayoutItem[] items * @property \PayPal\Api\Links[] links */ class Payout extends PayPalResourceModel { /** * The original batch header as provided by the payment sender. * * @param \PayPal\Api\PayoutSenderBatchHeader $sender_batch_header * * @return $this */ public function setSenderBatchHeader($sender_batch_header) { $this->sender_batch_header = $sender_batch_header; return $this; } /** * The original batch header as provided by the payment sender. * * @return \PayPal\Api\PayoutSenderBatchHeader */ public function getSenderBatchHeader() { return $this->sender_batch_header; } /** * An array of payout items (that is, a set of individual payouts). * * @param \PayPal\Api\PayoutItem[] $items * * @return $this */ public function setItems($items) { $this->items = $items; return $this; } /** * An array of payout items (that is, a set of individual payouts). * * @return \PayPal\Api\PayoutItem[] */ public function getItems() { return $this->items; } /** * Append Items to the list. * * @param \PayPal\Api\PayoutItem $payoutItem * @return $this */ public function addItem($payoutItem) { if (!$this->getItems()) { return $this->setItems(array($payoutItem)); } else { return $this->setItems( array_merge($this->getItems(), array($payoutItem)) ); } } /** * Remove Items from the list. * * @param \PayPal\Api\PayoutItem $payoutItem * @return $this */ public function removeItem($payoutItem) { return $this->setItems( array_diff($this->getItems(), array($payoutItem)) ); } /** * Create a payout batch resource by passing a sender_batch_header and an items array to the request URI. The sender_batch_header contains payout parameters that describe the handling of a batch resource while the items array conatins payout items. * * @param array $params * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return PayoutBatch */ public function create($params = array(), $apiContext = null, $restCall = null) { $params = $params ? $params : array(); ArgumentValidator::validate($params, 'params'); $payLoad = $this->toJSON(); $allowedParams = array( 'sync_mode' => 1, ); $json = self::executeCall( "/v1/payments/payouts" . "?" . http_build_query(array_intersect_key($params, $allowedParams)), "POST", $payLoad, null, $apiContext, $restCall ); $ret = new PayoutBatch(); $ret->fromJson($json); return $ret; } /** * You can submit a payout with a synchronous API call, which immediately returns the results of a PayPal payment. * * @param ApiContext $apiContext * @param PayPalRestCall $restCall * @return PayoutBatch */ public function createSynchronous($apiContext = null, $restCall = null) { $params = array('sync_mode' => 'true'); return $this->create($params, $apiContext, $restCall); } /** * Obtain the status of a specific batch resource by passing the payout batch ID to the request URI. You can issue this call multiple times to get the current status. * * @param string $payoutBatchId * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return PayoutBatch */ public static function get($payoutBatchId, $apiContext = null, $restCall = null) { ArgumentValidator::validate($payoutBatchId, 'payoutBatchId'); $payLoad = ""; $json = self::executeCall( "/v1/payments/payouts/$payoutBatchId", "GET", $payLoad, null, $apiContext, $restCall ); $ret = new PayoutBatch(); $ret->fromJson($json); return $ret; } } rest-api-sdk-php/lib/PayPal/Api/Tax.php 0000644 00000004176 15213403564 0013561 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; use PayPal\Converter\FormatConverter; use PayPal\Validation\NumericValidator; /** * Class Tax * * Tax information. * * @package PayPal\Api * * @property string id * @property string name * @property \PayPal\Api\number percent * @property \PayPal\Api\Currency amount */ class Tax extends PayPalModel { /** * The resource ID. * * @param string $id * * @return $this */ public function setId($id) { $this->id = $id; return $this; } /** * The resource ID. * * @return string */ public function getId() { return $this->id; } /** * The tax name. Maximum length is 20 characters. * * @param string $name * * @return $this */ public function setName($name) { $this->name = $name; return $this; } /** * The tax name. Maximum length is 20 characters. * * @return string */ public function getName() { return $this->name; } /** * The rate of the specified tax. Valid range is from 0.001 to 99.999. * * @param string|double $percent * * @return $this */ public function setPercent($percent) { NumericValidator::validate($percent, "Percent"); $percent = FormatConverter::formatToPrice($percent); $this->percent = $percent; return $this; } /** * The rate of the specified tax. Valid range is from 0.001 to 99.999. * * @return string */ public function getPercent() { return $this->percent; } /** * The tax as a monetary amount. Cannot be specified in a request. * * @param \PayPal\Api\Currency $amount * * @return $this */ public function setAmount($amount) { $this->amount = $amount; return $this; } /** * The tax as a monetary amount. Cannot be specified in a request. * * @return \PayPal\Api\Currency */ public function getAmount() { return $this->amount; } } rest-api-sdk-php/lib/PayPal/Api/Participant.php 0000644 00000010071 15213403564 0015272 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class Participant * * Participant information. * * @package PayPal\Api * * @property string email * @property string first_name * @property string last_name * @property string business_name * @property \PayPal\Api\Phone phone * @property \PayPal\Api\Phone fax * @property string website * @property string additional_info * @property \PayPal\Api\Address address */ class Participant extends PayPalModel { /** * The participant email address. * * @param string $email * * @return $this */ public function setEmail($email) { $this->email = $email; return $this; } /** * The participant email address. * * @return string */ public function getEmail() { return $this->email; } /** * The participant first name. * * @param string $first_name * * @return $this */ public function setFirstName($first_name) { $this->first_name = $first_name; return $this; } /** * The participant first name. * * @return string */ public function getFirstName() { return $this->first_name; } /** * The participant last name. * * @param string $last_name * * @return $this */ public function setLastName($last_name) { $this->last_name = $last_name; return $this; } /** * The participant last name. * * @return string */ public function getLastName() { return $this->last_name; } /** * The participant company business name. * * @param string $business_name * * @return $this */ public function setBusinessName($business_name) { $this->business_name = $business_name; return $this; } /** * The participant company business name. * * @return string */ public function getBusinessName() { return $this->business_name; } /** * The participant phone number. * * @param \PayPal\Api\Phone $phone * * @return $this */ public function setPhone($phone) { $this->phone = $phone; return $this; } /** * The participant phone number. * * @return \PayPal\Api\Phone */ public function getPhone() { return $this->phone; } /** * The participant fax number. * * @param \PayPal\Api\Phone $fax * * @return $this */ public function setFax($fax) { $this->fax = $fax; return $this; } /** * The participant fax number. * * @return \PayPal\Api\Phone */ public function getFax() { return $this->fax; } /** * The participant website. * * @param string $website * * @return $this */ public function setWebsite($website) { $this->website = $website; return $this; } /** * The participant website. * * @return string */ public function getWebsite() { return $this->website; } /** * Additional information, such as business hours. * * @param string $additional_info * * @return $this */ public function setAdditionalInfo($additional_info) { $this->additional_info = $additional_info; return $this; } /** * Additional information, such as business hours. * * @return string */ public function getAdditionalInfo() { return $this->additional_info; } /** * The participant address. * * @param \PayPal\Api\Address $address * * @return $this */ public function setAddress($address) { $this->address = $address; return $this; } /** * The participant address. * * @return \PayPal\Api\Address */ public function getAddress() { return $this->address; } } rest-api-sdk-php/lib/PayPal/Api/MerchantPreferences.php 0000644 00000013673 15213403564 0016752 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; use PayPal\Validation\UrlValidator; /** * Class MerchantPreferences * * Resource representing merchant preferences like max failed attempts, set up fee and others for a plan. * * @package PayPal\Api * * @property string id * @property \PayPal\Api\Currency setup_fee * @property string cancel_url * @property string return_url * @property string notify_url * @property string max_fail_attempts * @property string auto_bill_amount * @property string initial_fail_amount_action * @property string accepted_payment_type * @property string char_set */ class MerchantPreferences extends PayPalModel { /** * Identifier of the merchant_preferences. 128 characters max. * * @param string $id * * @return $this */ public function setId($id) { $this->id = $id; return $this; } /** * Identifier of the merchant_preferences. 128 characters max. * * @return string */ public function getId() { return $this->id; } /** * Setup fee amount. Default is 0. * * @param \PayPal\Api\Currency $setup_fee * * @return $this */ public function setSetupFee($setup_fee) { $this->setup_fee = $setup_fee; return $this; } /** * Setup fee amount. Default is 0. * * @return \PayPal\Api\Currency */ public function getSetupFee() { return $this->setup_fee; } /** * Redirect URL on cancellation of agreement request. 1000 characters max. * * @param string $cancel_url * @throws \InvalidArgumentException * @return $this */ public function setCancelUrl($cancel_url) { UrlValidator::validate($cancel_url, "CancelUrl"); $this->cancel_url = $cancel_url; return $this; } /** * Redirect URL on cancellation of agreement request. 1000 characters max. * * @return string */ public function getCancelUrl() { return $this->cancel_url; } /** * Redirect URL on creation of agreement request. 1000 characters max. * * @param string $return_url * @throws \InvalidArgumentException * @return $this */ public function setReturnUrl($return_url) { UrlValidator::validate($return_url, "ReturnUrl"); $this->return_url = $return_url; return $this; } /** * Redirect URL on creation of agreement request. 1000 characters max. * * @return string */ public function getReturnUrl() { return $this->return_url; } /** * Notify URL on agreement creation. 1000 characters max. * * @param string $notify_url * @throws \InvalidArgumentException * @return $this */ public function setNotifyUrl($notify_url) { UrlValidator::validate($notify_url, "NotifyUrl"); $this->notify_url = $notify_url; return $this; } /** * Notify URL on agreement creation. 1000 characters max. * * @return string */ public function getNotifyUrl() { return $this->notify_url; } /** * Total number of failed attempts allowed. Default is 0, representing an infinite number of failed attempts. * * @param string $max_fail_attempts * * @return $this */ public function setMaxFailAttempts($max_fail_attempts) { $this->max_fail_attempts = $max_fail_attempts; return $this; } /** * Total number of failed attempts allowed. Default is 0, representing an infinite number of failed attempts. * * @return string */ public function getMaxFailAttempts() { return $this->max_fail_attempts; } /** * Allow auto billing for the outstanding amount of the agreement in the next cycle. Allowed values: `YES`, `NO`. Default is `NO`. * * @param string $auto_bill_amount * * @return $this */ public function setAutoBillAmount($auto_bill_amount) { $this->auto_bill_amount = $auto_bill_amount; return $this; } /** * Allow auto billing for the outstanding amount of the agreement in the next cycle. Allowed values: `YES`, `NO`. Default is `NO`. * * @return string */ public function getAutoBillAmount() { return $this->auto_bill_amount; } /** * Action to take if a failure occurs during initial payment. Allowed values: `CONTINUE`, `CANCEL`. Default is continue. * * @param string $initial_fail_amount_action * * @return $this */ public function setInitialFailAmountAction($initial_fail_amount_action) { $this->initial_fail_amount_action = $initial_fail_amount_action; return $this; } /** * Action to take if a failure occurs during initial payment. Allowed values: `CONTINUE`, `CANCEL`. Default is continue. * * @return string */ public function getInitialFailAmountAction() { return $this->initial_fail_amount_action; } /** * Payment types that are accepted for this plan. * * @param string $accepted_payment_type * * @return $this */ public function setAcceptedPaymentType($accepted_payment_type) { $this->accepted_payment_type = $accepted_payment_type; return $this; } /** * Payment types that are accepted for this plan. * * @return string */ public function getAcceptedPaymentType() { return $this->accepted_payment_type; } /** * char_set for this plan. * * @param string $char_set * * @return $this */ public function setCharSet($char_set) { $this->char_set = $char_set; return $this; } /** * char_set for this plan. * * @return string */ public function getCharSet() { return $this->char_set; } } rest-api-sdk-php/lib/PayPal/Api/PaymentDetail.php 0000644 00000010715 15213403564 0015561 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class PaymentDetail * * Invoicing payment information. * * @package PayPal\Api * * @property string type * @property string transaction_id * @property string transaction_type * @property string date * @property string method * @property string note * @property \PayPal\Api\Currency amount */ class PaymentDetail extends PayPalModel { /** * The PayPal payment detail. Indicates whether payment was made in an invoicing flow through PayPal or externally. In the case of the mark-as-paid API, the supported payment type is `EXTERNAL`. For backward compatibility, the `PAYPAL` payment type is still supported. * Valid Values: ["PAYPAL", "EXTERNAL"] * * @param string $type * * @return $this */ public function setType($type) { $this->type = $type; return $this; } /** * The PayPal payment detail. Indicates whether payment was made in an invoicing flow through PayPal or externally. In the case of the mark-as-paid API, the supported payment type is `EXTERNAL`. For backward compatibility, the `PAYPAL` payment type is still supported. * * @return string */ public function getType() { return $this->type; } /** * The PayPal payment transaction ID. Required with the `PAYPAL` payment type. * * @param string $transaction_id * * @return $this */ public function setTransactionId($transaction_id) { $this->transaction_id = $transaction_id; return $this; } /** * The PayPal payment transaction ID. Required with the `PAYPAL` payment type. * * @return string */ public function getTransactionId() { return $this->transaction_id; } /** * Type of the transaction. * Valid Values: ["SALE", "AUTHORIZATION", "CAPTURE"] * * @param string $transaction_type * * @return $this */ public function setTransactionType($transaction_type) { $this->transaction_type = $transaction_type; return $this; } /** * Type of the transaction. * * @return string */ public function getTransactionType() { return $this->transaction_type; } /** * The date when the invoice was paid. The date format is *yyyy*-*MM*-*dd* *z* as defined in [Internet Date/Time Format](http://tools.ietf.org/html/rfc3339#section-5.6). * * @param string $date * * @return $this */ public function setDate($date) { $this->date = $date; return $this; } /** * The date when the invoice was paid. The date format is *yyyy*-*MM*-*dd* *z* as defined in [Internet Date/Time Format](http://tools.ietf.org/html/rfc3339#section-5.6). * * @return string */ public function getDate() { return $this->date; } /** * The payment mode or method. Required with the `EXTERNAL` payment type. * Valid Values: ["BANK_TRANSFER", "CASH", "CHECK", "CREDIT_CARD", "DEBIT_CARD", "PAYPAL", "WIRE_TRANSFER", "OTHER"] * * @param string $method * * @return $this */ public function setMethod($method) { $this->method = $method; return $this; } /** * The payment mode or method. Required with the `EXTERNAL` payment type. * * @return string */ public function getMethod() { return $this->method; } /** * Optional. A note associated with the payment. * * @param string $note * * @return $this */ public function setNote($note) { $this->note = $note; return $this; } /** * Optional. A note associated with the payment. * * @return string */ public function getNote() { return $this->note; } /** * The amount to record as payment against invoice. If you omit this parameter, the total invoice amount is recorded as payment. * * @param \PayPal\Api\Currency $amount * * @return $this */ public function setAmount($amount) { $this->amount = $amount; return $this; } /** * The amount to record as payment against invoice. If you omit this parameter, the total invoice amount is recorded as payment. * * @return \PayPal\Api\Currency */ public function getAmount() { return $this->amount; } } rest-api-sdk-php/lib/PayPal/Api/Item.php 0000644 00000023165 15213403564 0013722 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; use PayPal\Converter\FormatConverter; use PayPal\Validation\NumericValidator; use PayPal\Validation\UrlValidator; /** * Class Item * * Item details. * * @package PayPal\Api * * @property string sku * @property string name * @property string description * @property string quantity * @property string price * @property string currency * @property string tax * @property string url */ class Item extends PayPalModel { /** * Stock keeping unit corresponding (SKU) to item. * * @param string $sku * * @return $this */ public function setSku($sku) { $this->sku = $sku; return $this; } /** * Stock keeping unit corresponding (SKU) to item. * * @return string */ public function getSku() { return $this->sku; } /** * Item name. 127 characters max. * * @param string $name * * @return $this */ public function setName($name) { $this->name = $name; return $this; } /** * Item name. 127 characters max. * * @return string */ public function getName() { return $this->name; } /** * Description of the item. Only supported when the `payment_method` is set to `paypal`. * * @param string $description * * @return $this */ public function setDescription($description) { $this->description = $description; return $this; } /** * Description of the item. Only supported when the `payment_method` is set to `paypal`. * * @return string */ public function getDescription() { return $this->description; } /** * Number of a particular item. 10 characters max. * * @param string $quantity * * @return $this */ public function setQuantity($quantity) { $this->quantity = $quantity; return $this; } /** * Number of a particular item. 10 characters max. * * @return string */ public function getQuantity() { return $this->quantity; } /** * Item cost. 10 characters max. * * @param string|double $price * * @return $this */ public function setPrice($price) { NumericValidator::validate($price, "Price"); $price = FormatConverter::formatToPrice($price, $this->getCurrency()); $this->price = $price; return $this; } /** * Item cost. 10 characters max. * * @return string */ public function getPrice() { return $this->price; } /** * 3-letter [currency code](https://developer.paypal.com/docs/integration/direct/rest_api_payment_country_currency_support/). * * @param string $currency * * @return $this */ public function setCurrency($currency) { $this->currency = $currency; return $this; } /** * 3-letter [currency code](https://developer.paypal.com/docs/integration/direct/rest_api_payment_country_currency_support/). * * @return string */ public function getCurrency() { return $this->currency; } /** * Tax of the item. Only supported when the `payment_method` is set to `paypal`. * * @param string|double $tax * * @return $this */ public function setTax($tax) { NumericValidator::validate($tax, "Tax"); $tax = FormatConverter::formatToPrice($tax, $this->getCurrency()); $this->tax = $tax; return $this; } /** * Tax of the item. Only supported when the `payment_method` is set to `paypal`. * * @return string */ public function getTax() { return $this->tax; } /** * URL linking to item information. Available to payer in transaction history. * * @param string $url * @throws \InvalidArgumentException * @return $this */ public function setUrl($url) { UrlValidator::validate($url, "Url"); $this->url = $url; return $this; } /** * URL linking to item information. Available to payer in transaction history. * * @return string */ public function getUrl() { return $this->url; } /** * Category type of the item. * Valid Values: ["DIGITAL", "PHYSICAL"] * @deprecated Not publicly available * @param string $category * * @return $this */ public function setCategory($category) { $this->category = $category; return $this; } /** * Category type of the item. * @deprecated Not publicly available * @return string */ public function getCategory() { return $this->category; } /** * Weight of the item. * @deprecated Not publicly available * @param \PayPal\Api\Measurement $weight * * @return $this */ public function setWeight($weight) { $this->weight = $weight; return $this; } /** * Weight of the item. * @deprecated Not publicly available * @return \PayPal\Api\Measurement */ public function getWeight() { return $this->weight; } /** * Length of the item. * @deprecated Not publicly available * @param \PayPal\Api\Measurement $length * * @return $this */ public function setLength($length) { $this->length = $length; return $this; } /** * Length of the item. * @deprecated Not publicly available * @return \PayPal\Api\Measurement */ public function getLength() { return $this->length; } /** * Height of the item. * @deprecated Not publicly available * @param \PayPal\Api\Measurement $height * * @return $this */ public function setHeight($height) { $this->height = $height; return $this; } /** * Height of the item. * @deprecated Not publicly available * @return \PayPal\Api\Measurement */ public function getHeight() { return $this->height; } /** * Width of the item. * @deprecated Not publicly available * @param \PayPal\Api\Measurement $width * * @return $this */ public function setWidth($width) { $this->width = $width; return $this; } /** * Width of the item. * @deprecated Not publicly available * @return \PayPal\Api\Measurement */ public function getWidth() { return $this->width; } /** * Set of optional data used for PayPal risk determination. * @deprecated Not publicly available * @param \PayPal\Api\NameValuePair[] $supplementary_data * * @return $this */ public function setSupplementaryData($supplementary_data) { $this->supplementary_data = $supplementary_data; return $this; } /** * Set of optional data used for PayPal risk determination. * @deprecated Not publicly available * @return \PayPal\Api\NameValuePair[] */ public function getSupplementaryData() { return $this->supplementary_data; } /** * Append SupplementaryData to the list. * @deprecated Not publicly available * @param \PayPal\Api\NameValuePair $nameValuePair * @return $this */ public function addSupplementaryData($nameValuePair) { if (!$this->getSupplementaryData()) { return $this->setSupplementaryData(array($nameValuePair)); } else { return $this->setSupplementaryData( array_merge($this->getSupplementaryData(), array($nameValuePair)) ); } } /** * Remove SupplementaryData from the list. * @deprecated Not publicly available * @param \PayPal\Api\NameValuePair $nameValuePair * @return $this */ public function removeSupplementaryData($nameValuePair) { return $this->setSupplementaryData( array_diff($this->getSupplementaryData(), array($nameValuePair)) ); } /** * Set of optional data used for PayPal post-transaction notifications. * @deprecated Not publicly available * @param \PayPal\Api\NameValuePair[] $postback_data * * @return $this */ public function setPostbackData($postback_data) { $this->postback_data = $postback_data; return $this; } /** * Set of optional data used for PayPal post-transaction notifications. * @deprecated Not publicly available * @return \PayPal\Api\NameValuePair[] */ public function getPostbackData() { return $this->postback_data; } /** * Append PostbackData to the list. * @deprecated Not publicly available * @param \PayPal\Api\NameValuePair $nameValuePair * @return $this */ public function addPostbackData($nameValuePair) { if (!$this->getPostbackData()) { return $this->setPostbackData(array($nameValuePair)); } else { return $this->setPostbackData( array_merge($this->getPostbackData(), array($nameValuePair)) ); } } /** * Remove PostbackData from the list. * @deprecated Not publicly available * @param \PayPal\Api\NameValuePair $nameValuePair * @return $this */ public function removePostbackData($nameValuePair) { return $this->setPostbackData( array_diff($this->getPostbackData(), array($nameValuePair)) ); } } rest-api-sdk-php/lib/PayPal/Api/Payment.php 0000644 00000046432 15213403564 0014443 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalResourceModel; use PayPal\Core\PayPalConstants; use PayPal\Validation\ArgumentValidator; use PayPal\Rest\ApiContext; /** * Class Payment * * Lets you create, process and manage payments. * * @package PayPal\Api * * @property string id * @property string intent * @property \PayPal\Api\Payer payer * @property \PayPal\Api\Transaction[] transactions * @property string state * @property string experience_profile_id * @property string note_to_payer * @property \PayPal\Api\Payee $payee * @property \PayPal\Api\RedirectUrls redirect_urls * @property string failure_reason * @property string create_time * @property string update_time * @property \PayPal\Api\Links[] links */ class Payment extends PayPalResourceModel { /** * Identifier of the payment resource created. * * @param string $id * * @return $this */ public function setId($id) { $this->id = $id; return $this; } /** * Identifier of the payment resource created. * * @return string */ public function getId() { return $this->id; } /** * Payment intent. * Valid Values: ["sale", "authorize", "order"] * * @param string $intent * * @return $this */ public function setIntent($intent) { $this->intent = $intent; return $this; } /** * Payment intent. * * @return string */ public function getIntent() { return $this->intent; } /** * Source of the funds for this payment represented by a PayPal account or a direct credit card. * * @param \PayPal\Api\Payer $payer * * @return $this */ public function setPayer($payer) { $this->payer = $payer; return $this; } /** * Source of the funds for this payment represented by a PayPal account or a direct credit card. * * @return \PayPal\Api\Payer */ public function getPayer() { return $this->payer; } /** * Information that the merchant knows about the payer. This information is not definitive and only serves as a hint to the UI or any pre-processing logic. * @deprecated Not publicly available * @param \PayPal\Api\PotentialPayerInfo $potential_payer_info * * @return $this */ public function setPotentialPayerInfo($potential_payer_info) { $this->potential_payer_info = $potential_payer_info; return $this; } /** * Information that the merchant knows about the payer. This information is not definitive and only serves as a hint to the UI or any pre-processing logic. * @deprecated Not publicly available * @return \PayPal\Api\PotentialPayerInfo */ public function getPotentialPayerInfo() { return $this->potential_payer_info; } /** * Receiver of funds for this payment. * @param \PayPal\Api\Payee $payee * * @return $this */ public function setPayee($payee) { $this->payee = $payee; return $this; } /** * Receiver of funds for this payment. * @return \PayPal\Api\Payee */ public function getPayee() { return $this->payee; } /** * ID of the cart to execute the payment. * @deprecated Not publicly available * @param string $cart * * @return $this */ public function setCart($cart) { $this->cart = $cart; return $this; } /** * ID of the cart to execute the payment. * @deprecated Not publicly available * @return string */ public function getCart() { return $this->cart; } /** * Transactional details including the amount and item details. * * @param \PayPal\Api\Transaction[] $transactions * * @return $this */ public function setTransactions($transactions) { $this->transactions = $transactions; return $this; } /** * Transactional details including the amount and item details. * * @return \PayPal\Api\Transaction[] */ public function getTransactions() { return $this->transactions; } /** * Append Transactions to the list. * * @param \PayPal\Api\Transaction $transaction * @return $this */ public function addTransaction($transaction) { if (!$this->getTransactions()) { return $this->setTransactions(array($transaction)); } else { return $this->setTransactions( array_merge($this->getTransactions(), array($transaction)) ); } } /** * Remove Transactions from the list. * * @param \PayPal\Api\Transaction $transaction * @return $this */ public function removeTransaction($transaction) { return $this->setTransactions( array_diff($this->getTransactions(), array($transaction)) ); } /** * Applicable for advanced payments like multi seller payment (MSP) to support partial failures * @deprecated Not publicly available * @param \PayPal\Api\Error[] $failed_transactions * * @return $this */ public function setFailedTransactions($failed_transactions) { $this->failed_transactions = $failed_transactions; return $this; } /** * Applicable for advanced payments like multi seller payment (MSP) to support partial failures * @deprecated Not publicly available * @return \PayPal\Api\Error[] */ public function getFailedTransactions() { return $this->failed_transactions; } /** * Append FailedTransactions to the list. * @deprecated Not publicly available * @param \PayPal\Api\Error $error * @return $this */ public function addFailedTransaction($error) { if (!$this->getFailedTransactions()) { return $this->setFailedTransactions(array($error)); } else { return $this->setFailedTransactions( array_merge($this->getFailedTransactions(), array($error)) ); } } /** * Remove FailedTransactions from the list. * @deprecated Not publicly available * @param \PayPal\Api\Error $error * @return $this */ public function removeFailedTransaction($error) { return $this->setFailedTransactions( array_diff($this->getFailedTransactions(), array($error)) ); } /** * Collection of PayPal generated billing agreement tokens. * @deprecated Not publicly available * @param string[] $billing_agreement_tokens * * @return $this */ public function setBillingAgreementTokens($billing_agreement_tokens) { $this->billing_agreement_tokens = $billing_agreement_tokens; return $this; } /** * Collection of PayPal generated billing agreement tokens. * @deprecated Not publicly available * @return string[] */ public function getBillingAgreementTokens() { return $this->billing_agreement_tokens; } /** * Append BillingAgreementTokens to the list. * @deprecated Not publicly available * @param string $billingAgreementToken * @return $this */ public function addBillingAgreementToken($billingAgreementToken) { if (!$this->getBillingAgreementTokens()) { return $this->setBillingAgreementTokens(array($billingAgreementToken)); } else { return $this->setBillingAgreementTokens( array_merge($this->getBillingAgreementTokens(), array($billingAgreementToken)) ); } } /** * Remove BillingAgreementTokens from the list. * @deprecated Not publicly available * @param string $billingAgreementToken * @return $this */ public function removeBillingAgreementToken($billingAgreementToken) { return $this->setBillingAgreementTokens( array_diff($this->getBillingAgreementTokens(), array($billingAgreementToken)) ); } /** * Credit financing offered to payer on PayPal side. Returned in payment after payer opts-in * @deprecated Not publicly available * @param \PayPal\Api\CreditFinancingOffered $credit_financing_offered * * @return $this */ public function setCreditFinancingOffered($credit_financing_offered) { $this->credit_financing_offered = $credit_financing_offered; return $this; } /** * Credit financing offered to payer on PayPal side. Returned in payment after payer opts-in * @deprecated Not publicly available * @return \PayPal\Api\CreditFinancingOffered */ public function getCreditFinancingOffered() { return $this->credit_financing_offered; } /** * Instructions for the payer to complete this payment. * @deprecated Not publicly available * @param \PayPal\Api\PaymentInstruction $payment_instruction * * @return $this */ public function setPaymentInstruction($payment_instruction) { $this->payment_instruction = $payment_instruction; return $this; } /** * Instructions for the payer to complete this payment. * @deprecated Not publicly available * @return \PayPal\Api\PaymentInstruction */ public function getPaymentInstruction() { return $this->payment_instruction; } /** * The state of the payment, authorization, or order transaction. The value is:<ul><li><code>created</code>. The transaction was successfully created.</li><li><code>approved</code>. The buyer approved the transaction.</li><li><code>failed</code>. The transaction request failed.</li></ul> * Valid Values: ["created", "approved", "failed", "partially_completed", "in_progress"] * * @param string $state * * @return $this */ public function setState($state) { $this->state = $state; return $this; } /** * The state of the payment, authorization, or order transaction. The value is:<ul><li><code>created</code>. The transaction was successfully created.</li><li><code>approved</code>. The buyer approved the transaction.</li><li><code>failed</code>. The transaction request failed.</li></ul> * * @return string */ public function getState() { return $this->state; } /** * PayPal generated identifier for the merchant's payment experience profile. Refer to [this](https://developer.paypal.com/docs/api/#payment-experience) link to create experience profile ID. * * @param string $experience_profile_id * * @return $this */ public function setExperienceProfileId($experience_profile_id) { $this->experience_profile_id = $experience_profile_id; return $this; } /** * PayPal generated identifier for the merchant's payment experience profile. Refer to [this](https://developer.paypal.com/docs/api/#payment-experience) link to create experience profile ID. * * @return string */ public function getExperienceProfileId() { return $this->experience_profile_id; } /** * free-form field for the use of clients to pass in a message to the payer * * @param string $note_to_payer * * @return $this */ public function setNoteToPayer($note_to_payer) { $this->note_to_payer = $note_to_payer; return $this; } /** * free-form field for the use of clients to pass in a message to the payer * * @return string */ public function getNoteToPayer() { return $this->note_to_payer; } /** * Set of redirect URLs you provide only for PayPal-based payments. * * @param \PayPal\Api\RedirectUrls $redirect_urls * * @return $this */ public function setRedirectUrls($redirect_urls) { $this->redirect_urls = $redirect_urls; return $this; } /** * Set of redirect URLs you provide only for PayPal-based payments. * * @return \PayPal\Api\RedirectUrls */ public function getRedirectUrls() { return $this->redirect_urls; } /** * Failure reason code returned when the payment failed for some valid reasons. * Valid Values: ["UNABLE_TO_COMPLETE_TRANSACTION", "INVALID_PAYMENT_METHOD", "PAYER_CANNOT_PAY", "CANNOT_PAY_THIS_PAYEE", "REDIRECT_REQUIRED", "PAYEE_FILTER_RESTRICTIONS"] * * @param string $failure_reason * * @return $this */ public function setFailureReason($failure_reason) { $this->failure_reason = $failure_reason; return $this; } /** * Failure reason code returned when the payment failed for some valid reasons. * * @return string */ public function getFailureReason() { return $this->failure_reason; } /** * Payment creation time as defined in [RFC 3339 Section 5.6](http://tools.ietf.org/html/rfc3339#section-5.6). * * @param string $create_time * * @return $this */ public function setCreateTime($create_time) { $this->create_time = $create_time; return $this; } /** * Payment creation time as defined in [RFC 3339 Section 5.6](http://tools.ietf.org/html/rfc3339#section-5.6). * * @return string */ public function getCreateTime() { return $this->create_time; } /** * Payment update time as defined in [RFC 3339 Section 5.6](http://tools.ietf.org/html/rfc3339#section-5.6). * * @param string $update_time * * @return $this */ public function setUpdateTime($update_time) { $this->update_time = $update_time; return $this; } /** * Payment update time as defined in [RFC 3339 Section 5.6](http://tools.ietf.org/html/rfc3339#section-5.6). * * @return string */ public function getUpdateTime() { return $this->update_time; } /** * Get Approval Link * * @return null|string */ public function getApprovalLink() { return $this->getLink(PayPalConstants::APPROVAL_URL); } /** * Get token from Approval Link * * @return null|string */ public function getToken() { $parameter_name = "token"; parse_str(parse_url($this->getApprovalLink(), PHP_URL_QUERY), $query); return !isset($query[$parameter_name]) ? null : $query[$parameter_name]; } /** * Creates and processes a payment. In the JSON request body, include a `payment` object with the intent, payer, and transactions. For PayPal payments, include redirect URLs in the `payment` object. * * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return Payment */ public function create($apiContext = null, $restCall = null) { $payLoad = $this->toJSON(); $json = self::executeCall( "/v1/payments/payment", "POST", $payLoad, null, $apiContext, $restCall ); $this->fromJson($json); return $this; } /** * Shows details for a payment, by ID. * * @param string $paymentId * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return Payment */ public static function get($paymentId, $apiContext = null, $restCall = null) { ArgumentValidator::validate($paymentId, 'paymentId'); $payLoad = ""; $json = self::executeCall( "/v1/payments/payment/$paymentId", "GET", $payLoad, null, $apiContext, $restCall ); $ret = new Payment(); $ret->fromJson($json); return $ret; } /** * Partially updates a payment, by ID. You can update the amount, shipping address, invoice ID, and custom data. You cannot use patch after execute has been called. * * @param PatchRequest $patchRequest * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return boolean */ public function update($patchRequest, $apiContext = null, $restCall = null) { ArgumentValidator::validate($this->getId(), "Id"); ArgumentValidator::validate($patchRequest, 'patchRequest'); $payLoad = $patchRequest->toJSON(); self::executeCall( "/v1/payments/payment/{$this->getId()}", "PATCH", $payLoad, null, $apiContext, $restCall ); return true; } /** * Executes, or completes, a PayPal payment that the payer has approved. You can optionally update selective payment information when you execute a payment. * * @param PaymentExecution $paymentExecution * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return Payment */ public function execute($paymentExecution, $apiContext = null, $restCall = null) { ArgumentValidator::validate($this->getId(), "Id"); ArgumentValidator::validate($paymentExecution, 'paymentExecution'); $payLoad = $paymentExecution->toJSON(); $json = self::executeCall( "/v1/payments/payment/{$this->getId()}/execute", "POST", $payLoad, null, $apiContext, $restCall ); $this->fromJson($json); return $this; } /** * List payments that were made to the merchant who issues the request. Payments can be in any state. * * @param array $params * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return PaymentHistory */ public static function all($params, $apiContext = null, $restCall = null) { ArgumentValidator::validate($params, '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, ); $json = self::executeCall( "/v1/payments/payment?" . http_build_query(array_intersect_key($params, $allowedParams)), "GET", $payLoad, null, $apiContext, $restCall ); $ret = new PaymentHistory(); $ret->fromJson($json); return $ret; } } rest-api-sdk-php/lib/PayPal/Api/CreditCardList.php 0000644 00000005105 15213403564 0015656 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalResourceModel; /** * Class CreditCardList * * A list of Credit Card Resources * * @package PayPal\Api * * @property \PayPal\Api\CreditCard[] items * @property \PayPal\Api\Links[] links * @property int total_items * @property int total_pages */ class CreditCardList extends PayPalResourceModel { /** * A list of credit card resources * * @param \PayPal\Api\CreditCard[] $items * * @return $this */ public function setItems($items) { $this->items = $items; return $this; } /** * A list of credit card resources * * @return \PayPal\Api\CreditCard[] */ public function getItems() { return $this->items; } /** * Append Items to the list. * * @param \PayPal\Api\CreditCard $creditCard * @return $this */ public function addItem($creditCard) { if (!$this->getItems()) { return $this->setItems(array($creditCard)); } else { return $this->setItems( array_merge($this->getItems(), array($creditCard)) ); } } /** * Remove Items from the list. * * @param \PayPal\Api\CreditCard $creditCard * @return $this */ public function removeItem($creditCard) { return $this->setItems( array_diff($this->getItems(), array($creditCard)) ); } /** * Total number of items present in the given list. Note that the number of items might be larger than the records in the current page. * * @param int $total_items * * @return $this */ public function setTotalItems($total_items) { $this->total_items = $total_items; return $this; } /** * Total number of items present in the given list. Note that the number of items might be larger than the records in the current page. * * @return int */ public function getTotalItems() { return $this->total_items; } /** * Total number of pages that exist, for the total number of items, with the given page size. * * @param int $total_pages * * @return $this */ public function setTotalPages($total_pages) { $this->total_pages = $total_pages; return $this; } /** * Total number of pages that exist, for the total number of items, with the given page size. * * @return int */ public function getTotalPages() { return $this->total_pages; } } rest-api-sdk-php/lib/PayPal/Api/RecipientBankingInstruction.php 0000644 00000006236 15213403564 0020502 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class RecipientBankingInstruction * * Recipient bank Details. * * @package PayPal\Api * * @property string bank_name * @property string account_holder_name * @property string account_number * @property string routing_number * @property string international_bank_account_number * @property string bank_identifier_code */ class RecipientBankingInstruction extends PayPalModel { /** * Name of the financial institution. * * @param string $bank_name * * @return $this */ public function setBankName($bank_name) { $this->bank_name = $bank_name; return $this; } /** * Name of the financial institution. * * @return string */ public function getBankName() { return $this->bank_name; } /** * Name of the account holder * * @param string $account_holder_name * * @return $this */ public function setAccountHolderName($account_holder_name) { $this->account_holder_name = $account_holder_name; return $this; } /** * Name of the account holder * * @return string */ public function getAccountHolderName() { return $this->account_holder_name; } /** * bank account number * * @param string $account_number * * @return $this */ public function setAccountNumber($account_number) { $this->account_number = $account_number; return $this; } /** * bank account number * * @return string */ public function getAccountNumber() { return $this->account_number; } /** * bank routing number * * @param string $routing_number * * @return $this */ public function setRoutingNumber($routing_number) { $this->routing_number = $routing_number; return $this; } /** * bank routing number * * @return string */ public function getRoutingNumber() { return $this->routing_number; } /** * IBAN equivalent of the bank * * @param string $international_bank_account_number * * @return $this */ public function setInternationalBankAccountNumber($international_bank_account_number) { $this->international_bank_account_number = $international_bank_account_number; return $this; } /** * IBAN equivalent of the bank * * @return string */ public function getInternationalBankAccountNumber() { return $this->international_bank_account_number; } /** * BIC identifier of the financial institution * * @param string $bank_identifier_code * * @return $this */ public function setBankIdentifierCode($bank_identifier_code) { $this->bank_identifier_code = $bank_identifier_code; return $this; } /** * BIC identifier of the financial institution * * @return string */ public function getBankIdentifierCode() { return $this->bank_identifier_code; } } rest-api-sdk-php/lib/PayPal/Api/RedirectUrls.php 0000644 00000003203 15213403564 0015422 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; use PayPal\Validation\UrlValidator; /** * Class RedirectUrls * * Set of redirect URLs you provide only for PayPal-based payments. * * @package PayPal\Api * * @property string return_url * @property string cancel_url */ class RedirectUrls extends PayPalModel { /** * Url where the payer would be redirected to after approving the payment. **Required for PayPal account payments.** * * @param string $return_url * @throws \InvalidArgumentException * @return $this */ public function setReturnUrl($return_url) { UrlValidator::validate($return_url, "ReturnUrl"); $this->return_url = $return_url; return $this; } /** * Url where the payer would be redirected to after approving the payment. **Required for PayPal account payments.** * * @return string */ public function getReturnUrl() { return $this->return_url; } /** * Url where the payer would be redirected to after canceling the payment. **Required for PayPal account payments.** * * @param string $cancel_url * @throws \InvalidArgumentException * @return $this */ public function setCancelUrl($cancel_url) { UrlValidator::validate($cancel_url, "CancelUrl"); $this->cancel_url = $cancel_url; return $this; } /** * Url where the payer would be redirected to after canceling the payment. **Required for PayPal account payments.** * * @return string */ public function getCancelUrl() { return $this->cancel_url; } } rest-api-sdk-php/lib/PayPal/Api/BaseAddress.php 0000644 00000010173 15213403564 0015177 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class BaseAddress * * Base Address object used as billing address in a payment or extended for Shipping Address. * * @package PayPal\Api * * @property string line1 * @property string line2 * @property string city * @property string country_code * @property string postal_code * @property string state * @property string normalization_status * @property string status */ class BaseAddress extends PayPalModel { /** * Line 1 of the Address (eg. number, street, etc). * * @param string $line1 * * @return $this */ public function setLine1($line1) { $this->line1 = $line1; return $this; } /** * Line 1 of the Address (eg. number, street, etc). * * @return string */ public function getLine1() { return $this->line1; } /** * Optional line 2 of the Address (eg. suite, apt #, etc.). * * @param string $line2 * * @return $this */ public function setLine2($line2) { $this->line2 = $line2; return $this; } /** * Optional line 2 of the Address (eg. suite, apt #, etc.). * * @return string */ public function getLine2() { return $this->line2; } /** * City name. * * @param string $city * * @return $this */ public function setCity($city) { $this->city = $city; return $this; } /** * City name. * * @return string */ public function getCity() { return $this->city; } /** * 2 letter country code. * * @param string $country_code * * @return $this */ public function setCountryCode($country_code) { $this->country_code = $country_code; return $this; } /** * 2 letter country code. * * @return string */ public function getCountryCode() { return $this->country_code; } /** * Zip code or equivalent is usually required for countries that have them. For list of countries that do not have postal codes please refer to http://en.wikipedia.org/wiki/Postal_code. * * @param string $postal_code * * @return $this */ public function setPostalCode($postal_code) { $this->postal_code = $postal_code; return $this; } /** * Zip code or equivalent is usually required for countries that have them. For list of countries that do not have postal codes please refer to http://en.wikipedia.org/wiki/Postal_code. * * @return string */ public function getPostalCode() { return $this->postal_code; } /** * 2 letter code for US states, and the equivalent for other countries. * * @param string $state * * @return $this */ public function setState($state) { $this->state = $state; return $this; } /** * 2 letter code for US states, and the equivalent for other countries. * * @return string */ public function getState() { return $this->state; } /** * Address normalization status * Valid Values: ["UNKNOWN", "UNNORMALIZED_USER_PREFERRED", "NORMALIZED", "UNNORMALIZED"] * * @param string $normalization_status * * @return $this */ public function setNormalizationStatus($normalization_status) { $this->normalization_status = $normalization_status; return $this; } /** * Address normalization status * * @return string */ public function getNormalizationStatus() { return $this->normalization_status; } /** * Address status * Valid Values: ["CONFIRMED", "UNCONFIRMED"] * * @param string $status * * @return $this */ public function setStatus($status) { $this->status = $status; return $this; } /** * Address status * * @return string */ public function getStatus() { return $this->status; } } rest-api-sdk-php/lib/PayPal/Api/Sale.php 0000644 00000044320 15213403564 0013704 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalResourceModel; use PayPal\Validation\ArgumentValidator; use PayPal\Rest\ApiContext; /** * Class Sale * * A sale transaction. This is the resource that is returned as a part related resources in Payment * * @package PayPal\Api * * @property string id * @property string purchase_unit_reference_id * @property \PayPal\Api\Amount amount * @property string payment_mode * @property string state * @property string reason_code * @property string protection_eligibility * @property string protection_eligibility_type * @property string clearing_time * @property string payment_hold_status * @property string[] payment_hold_reasons * @property \PayPal\Api\Currency transaction_fee * @property \PayPal\Api\Currency receivable_amount * @property string exchange_rate * @property \PayPal\Api\FmfDetails fmf_details * @property string receipt_id * @property string parent_payment * @property \PayPal\Api\ProcessorResponse processor_response * @property string billing_agreement_id * @property string create_time * @property string update_time * @property \PayPal\Api\Links[] links */ class Sale extends PayPalResourceModel { /** * Identifier of the sale transaction. * * @param string $id * * @return $this */ public function setId($id) { $this->id = $id; return $this; } /** * Identifier of the sale transaction. * * @return string */ public function getId() { return $this->id; } /** * Identifier to the purchase or transaction unit corresponding to this sale transaction. * * @param string $purchase_unit_reference_id * * @return $this */ public function setPurchaseUnitReferenceId($purchase_unit_reference_id) { $this->purchase_unit_reference_id = $purchase_unit_reference_id; return $this; } /** * Identifier to the purchase or transaction unit corresponding to this sale transaction. * * @return string */ public function getPurchaseUnitReferenceId() { return $this->purchase_unit_reference_id; } /** * Amount being collected. * * @param \PayPal\Api\Amount $amount * * @return $this */ public function setAmount($amount) { $this->amount = $amount; return $this; } /** * Amount being collected. * * @return \PayPal\Api\Amount */ public function getAmount() { return $this->amount; } /** * Specifies payment mode of the transaction. Only supported when the `payment_method` is set to `paypal`. * Valid Values: ["INSTANT_TRANSFER", "MANUAL_BANK_TRANSFER", "DELAYED_TRANSFER", "ECHECK"] * * @param string $payment_mode * * @return $this */ public function setPaymentMode($payment_mode) { $this->payment_mode = $payment_mode; return $this; } /** * Specifies payment mode of the transaction. Only supported when the `payment_method` is set to `paypal`. * * @return string */ public function getPaymentMode() { return $this->payment_mode; } /** * State of the sale transaction. * Valid Values: ["completed", "partially_refunded", "pending", "refunded", "denied"] * * @param string $state * * @return $this */ public function setState($state) { $this->state = $state; return $this; } /** * State of the sale transaction. * * @return string */ public function getState() { return $this->state; } /** * Reason code for the transaction state being Pending or Reversed. Only supported when the `payment_method` is set to `paypal`. * Valid Values: ["CHARGEBACK", "GUARANTEE", "BUYER_COMPLAINT", "REFUND", "UNCONFIRMED_SHIPPING_ADDRESS", "ECHECK", "INTERNATIONAL_WITHDRAWAL", "RECEIVING_PREFERENCE_MANDATES_MANUAL_ACTION", "PAYMENT_REVIEW", "REGULATORY_REVIEW", "UNILATERAL", "VERIFICATION_REQUIRED", "TRANSACTION_APPROVED_AWAITING_FUNDING"] * * @param string $reason_code * * @return $this */ public function setReasonCode($reason_code) { $this->reason_code = $reason_code; return $this; } /** * Reason code for the transaction state being Pending or Reversed. Only supported when the `payment_method` is set to `paypal`. * * @return string */ public function getReasonCode() { return $this->reason_code; } /** * The level of seller protection in force for the transaction. Only supported when the `payment_method` is set to `paypal`. * Valid Values: ["ELIGIBLE", "PARTIALLY_ELIGIBLE", "INELIGIBLE"] * * @param string $protection_eligibility * * @return $this */ public function setProtectionEligibility($protection_eligibility) { $this->protection_eligibility = $protection_eligibility; return $this; } /** * The level of seller protection in force for the transaction. Only supported when the `payment_method` is set to `paypal`. * * @return string */ public function getProtectionEligibility() { return $this->protection_eligibility; } /** * The kind of seller protection in force for the transaction. It is returned only when protection_eligibility is ELIGIBLE or PARTIALLY_ELIGIBLE. Only supported when the `payment_method` is set to `paypal`. * Valid Values: ["ITEM_NOT_RECEIVED_ELIGIBLE", "UNAUTHORIZED_PAYMENT_ELIGIBLE", "ITEM_NOT_RECEIVED_ELIGIBLE,UNAUTHORIZED_PAYMENT_ELIGIBLE"] * * @param string $protection_eligibility_type * * @return $this */ public function setProtectionEligibilityType($protection_eligibility_type) { $this->protection_eligibility_type = $protection_eligibility_type; return $this; } /** * The kind of seller protection in force for the transaction. It is returned only when protection_eligibility is ELIGIBLE or PARTIALLY_ELIGIBLE. Only supported when the `payment_method` is set to `paypal`. * * @return string */ public function getProtectionEligibilityType() { return $this->protection_eligibility_type; } /** * Expected clearing time for eCheck Transactions. Returned when payment is made with eCheck. Only supported when the `payment_method` is set to `paypal`. * * @param string $clearing_time * * @return $this */ public function setClearingTime($clearing_time) { $this->clearing_time = $clearing_time; return $this; } /** * Expected clearing time for eCheck Transactions. Returned when payment is made with eCheck. Only supported when the `payment_method` is set to `paypal`. * * @return string */ public function getClearingTime() { return $this->clearing_time; } /** * Status of the Recipient Fund. For now, it will be returned only when fund status is held * Valid Values: ["HELD"] * * @param string $payment_hold_status * * @return $this */ public function setPaymentHoldStatus($payment_hold_status) { $this->payment_hold_status = $payment_hold_status; return $this; } /** * Status of the Recipient Fund. For now, it will be returned only when fund status is held * * @return string */ public function getPaymentHoldStatus() { return $this->payment_hold_status; } /** * Reasons for PayPal holding recipient fund. It is set only if payment hold status is held * * @param string[] $payment_hold_reasons * * @return $this */ public function setPaymentHoldReasons($payment_hold_reasons) { $this->payment_hold_reasons = $payment_hold_reasons; return $this; } /** * Reasons for PayPal holding recipient fund. It is set only if payment hold status is held * * @return string[] */ public function getPaymentHoldReasons() { return $this->payment_hold_reasons; } /** * Append PaymentHoldReasons to the list. * * @param string $string * @return $this */ public function addPaymentHoldReason($string) { if (!$this->getPaymentHoldReasons()) { return $this->setPaymentHoldReasons(array($string)); } else { return $this->setPaymentHoldReasons( array_merge($this->getPaymentHoldReasons(), array($string)) ); } } /** * Remove PaymentHoldReasons from the list. * * @param string $string * @return $this */ public function removePaymentHoldReason($string) { return $this->setPaymentHoldReasons( array_diff($this->getPaymentHoldReasons(), array($string)) ); } /** * Transaction fee applicable for this payment. * * @param \PayPal\Api\Currency $transaction_fee * * @return $this */ public function setTransactionFee($transaction_fee) { $this->transaction_fee = $transaction_fee; return $this; } /** * Transaction fee applicable for this payment. * * @return \PayPal\Api\Currency */ public function getTransactionFee() { return $this->transaction_fee; } /** * Net amount the merchant receives for this transaction in their receivable currency. Returned only in cross-currency use cases where a merchant bills a buyer in a non-primary currency for that buyer. * * @param \PayPal\Api\Currency $receivable_amount * * @return $this */ public function setReceivableAmount($receivable_amount) { $this->receivable_amount = $receivable_amount; return $this; } /** * Net amount the merchant receives for this transaction in their receivable currency. Returned only in cross-currency use cases where a merchant bills a buyer in a non-primary currency for that buyer. * * @return \PayPal\Api\Currency */ public function getReceivableAmount() { return $this->receivable_amount; } /** * Exchange rate applied for this transaction. Returned only in cross-currency use cases where a merchant bills a buyer in a non-primary currency for that buyer. * * @param string $exchange_rate * * @return $this */ public function setExchangeRate($exchange_rate) { $this->exchange_rate = $exchange_rate; return $this; } /** * Exchange rate applied for this transaction. Returned only in cross-currency use cases where a merchant bills a buyer in a non-primary currency for that buyer. * * @return string */ public function getExchangeRate() { return $this->exchange_rate; } /** * Fraud Management Filter (FMF) details applied for the payment that could result in accept, deny, or pending action. Returned in a payment response only if the merchant has enabled FMF in the profile settings and one of the fraud filters was triggered based on those settings. See [Fraud Management Filters Summary](/docs/classic/fmf/integration-guide/FMFSummary/) for more information. * * @param \PayPal\Api\FmfDetails $fmf_details * * @return $this */ public function setFmfDetails($fmf_details) { $this->fmf_details = $fmf_details; return $this; } /** * Fraud Management Filter (FMF) details applied for the payment that could result in accept, deny, or pending action. Returned in a payment response only if the merchant has enabled FMF in the profile settings and one of the fraud filters was triggered based on those settings. See [Fraud Management Filters Summary](/docs/classic/fmf/integration-guide/FMFSummary/) for more information. * * @return \PayPal\Api\FmfDetails */ public function getFmfDetails() { return $this->fmf_details; } /** * Receipt id is a payment identification number returned for guest users to identify the payment. * * @param string $receipt_id * * @return $this */ public function setReceiptId($receipt_id) { $this->receipt_id = $receipt_id; return $this; } /** * Receipt id is a payment identification number returned for guest users to identify the payment. * * @return string */ public function getReceiptId() { return $this->receipt_id; } /** * ID of the payment resource on which this transaction is based. * * @param string $parent_payment * * @return $this */ public function setParentPayment($parent_payment) { $this->parent_payment = $parent_payment; return $this; } /** * ID of the payment resource on which this transaction is based. * * @return string */ public function getParentPayment() { return $this->parent_payment; } /** * Response codes returned by the processor concerning the submitted payment. Only supported when the `payment_method` is set to `credit_card`. * * @param \PayPal\Api\ProcessorResponse $processor_response * * @return $this */ public function setProcessorResponse($processor_response) { $this->processor_response = $processor_response; return $this; } /** * Response codes returned by the processor concerning the submitted payment. Only supported when the `payment_method` is set to `credit_card`. * * @return \PayPal\Api\ProcessorResponse */ public function getProcessorResponse() { return $this->processor_response; } /** * ID of the billing agreement used as reference to execute this transaction. * * @param string $billing_agreement_id * * @return $this */ public function setBillingAgreementId($billing_agreement_id) { $this->billing_agreement_id = $billing_agreement_id; return $this; } /** * ID of the billing agreement used as reference to execute this transaction. * * @return string */ public function getBillingAgreementId() { return $this->billing_agreement_id; } /** * Time of sale as defined in [RFC 3339 Section 5.6](http://tools.ietf.org/html/rfc3339#section-5.6) * * @param string $create_time * * @return $this */ public function setCreateTime($create_time) { $this->create_time = $create_time; return $this; } /** * Time of sale as defined in [RFC 3339 Section 5.6](http://tools.ietf.org/html/rfc3339#section-5.6) * * @return string */ public function getCreateTime() { return $this->create_time; } /** * Time the resource was last updated in UTC ISO8601 format. * * @param string $update_time * * @return $this */ public function setUpdateTime($update_time) { $this->update_time = $update_time; return $this; } /** * Time the resource was last updated in UTC ISO8601 format. * * @return string */ public function getUpdateTime() { return $this->update_time; } /** * Shows details for a sale, by ID. Returns only sales that were created through the REST API. * * @param string $saleId * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return Sale */ public static function get($saleId, $apiContext = null, $restCall = null) { ArgumentValidator::validate($saleId, 'saleId'); $payLoad = ""; $json = self::executeCall( "/v1/payments/sale/$saleId", "GET", $payLoad, null, $apiContext, $restCall ); $ret = new Sale(); $ret->fromJson($json); return $ret; } /** * Refund a completed payment by passing the sale_id in the request URI. In addition, include an empty JSON payload in the request body for a full refund. For a partial refund, include an amount object in the request body. * * @deprecated Please use #refundSale instead. * @param Refund $refund * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return Refund */ public function refund($refund, $apiContext = null, $restCall = null) { ArgumentValidator::validate($this->getId(), "Id"); ArgumentValidator::validate($refund, 'refund'); $payLoad = $refund->toJSON(); $json = self::executeCall( "/v1/payments/sale/{$this->getId()}/refund", "POST", $payLoad, null, $apiContext, $restCall ); $ret = new Refund(); $ret->fromJson($json); return $ret; } /** * Refunds a sale, by ID. For a full refund, include an empty payload in the JSON request body. For a partial refund, include an `amount` object in the JSON request body. * * @param RefundRequest $refundRequest * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return DetailedRefund */ public function refundSale($refundRequest, $apiContext = null, $restCall = null) { ArgumentValidator::validate($this->getId(), "Id"); ArgumentValidator::validate($refundRequest, 'refundRequest'); $payLoad = $refundRequest->toJSON(); $json = self::executeCall( "/v1/payments/sale/{$this->getId()}/refund", "POST", $payLoad, null, $apiContext, $restCall ); $ret = new DetailedRefund(); $ret->fromJson($json); return $ret; } } rest-api-sdk-php/lib/PayPal/Api/PaymentHistory.php 0000644 00000004736 15213403564 0016026 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class PaymentHistory * * List of Payments made by the seller. * * @package PayPal\Api * * @property \PayPal\Api\Payment[] payments * @property int count * @property string next_id */ class PaymentHistory extends PayPalModel { /** * A list of Payment resources * * @param \PayPal\Api\Payment[] $payments * * @return $this */ public function setPayments($payments) { $this->payments = $payments; return $this; } /** * A list of Payment resources * * @return \PayPal\Api\Payment[] */ public function getPayments() { return $this->payments; } /** * Append Payments to the list. * * @param \PayPal\Api\Payment $payment * @return $this */ public function addPayment($payment) { if (!$this->getPayments()) { return $this->setPayments(array($payment)); } else { return $this->setPayments( array_merge($this->getPayments(), array($payment)) ); } } /** * Remove Payments from the list. * * @param \PayPal\Api\Payment $payment * @return $this */ public function removePayment($payment) { return $this->setPayments( array_diff($this->getPayments(), array($payment)) ); } /** * Number of items returned in each range of results. Note that the last results range could have fewer items than the requested number of items. Maximum value: 20. * * @param int $count * * @return $this */ public function setCount($count) { $this->count = $count; return $this; } /** * Number of items returned in each range of results. Note that the last results range could have fewer items than the requested number of items. Maximum value: 20. * * @return int */ public function getCount() { return $this->count; } /** * Identifier of the next element to get the next range of results. * * @param string $next_id * * @return $this */ public function setNextId($next_id) { $this->next_id = $next_id; return $this; } /** * Identifier of the next element to get the next range of results. * * @return string */ public function getNextId() { return $this->next_id; } } rest-api-sdk-php/lib/PayPal/Api/Incentive.php 0000644 00000010517 15213403564 0014745 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; use PayPal\Validation\UrlValidator; /** * Class Incentive * * A resource representing a incentive. * * @package PayPal\Api * * @property string id * @property string code * @property string name * @property string description * @property \PayPal\Api\Currency minimum_purchase_amount * @property string logo_image_url * @property string expiry_date * @property string type * @property string terms */ class Incentive extends PayPalModel { /** * Identifier of the instrument in PayPal Wallet * * @param string $id * * @return $this */ public function setId($id) { $this->id = $id; return $this; } /** * Identifier of the instrument in PayPal Wallet * * @return string */ public function getId() { return $this->id; } /** * Code that identifies the incentive. * * @param string $code * * @return $this */ public function setCode($code) { $this->code = $code; return $this; } /** * Code that identifies the incentive. * * @return string */ public function getCode() { return $this->code; } /** * Name of the incentive. * * @param string $name * * @return $this */ public function setName($name) { $this->name = $name; return $this; } /** * Name of the incentive. * * @return string */ public function getName() { return $this->name; } /** * Description of the incentive. * * @param string $description * * @return $this */ public function setDescription($description) { $this->description = $description; return $this; } /** * Description of the incentive. * * @return string */ public function getDescription() { return $this->description; } /** * Indicates incentive is applicable for this minimum purchase amount. * * @param \PayPal\Api\Currency $minimum_purchase_amount * * @return $this */ public function setMinimumPurchaseAmount($minimum_purchase_amount) { $this->minimum_purchase_amount = $minimum_purchase_amount; return $this; } /** * Indicates incentive is applicable for this minimum purchase amount. * * @return \PayPal\Api\Currency */ public function getMinimumPurchaseAmount() { return $this->minimum_purchase_amount; } /** * Logo image url for the incentive. * * @param string $logo_image_url * @throws \InvalidArgumentException * @return $this */ public function setLogoImageUrl($logo_image_url) { UrlValidator::validate($logo_image_url, "LogoImageUrl"); $this->logo_image_url = $logo_image_url; return $this; } /** * Logo image url for the incentive. * * @return string */ public function getLogoImageUrl() { return $this->logo_image_url; } /** * expiry date of the incentive. * * @param string $expiry_date * * @return $this */ public function setExpiryDate($expiry_date) { $this->expiry_date = $expiry_date; return $this; } /** * expiry date of the incentive. * * @return string */ public function getExpiryDate() { return $this->expiry_date; } /** * Specifies type of incentive * Valid Values: ["COUPON", "GIFT_CARD", "MERCHANT_SPECIFIC_BALANCE", "VOUCHER"] * * @param string $type * * @return $this */ public function setType($type) { $this->type = $type; return $this; } /** * Specifies type of incentive * * @return string */ public function getType() { return $this->type; } /** * URI to the associated terms * * @param string $terms * * @return $this */ public function setTerms($terms) { $this->terms = $terms; return $this; } /** * URI to the associated terms * * @return string */ public function getTerms() { return $this->terms; } } rest-api-sdk-php/lib/PayPal/Api/CartBase.php 0000644 00000022244 15213403564 0014505 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; use PayPal\Validation\UrlValidator; /** * Class CartBase * * Base properties of a cart resource * * @package PayPal\Api * * @property string reference_id * @property \PayPal\Api\Amount amount * @property \PayPal\Api\Payee payee * @property string description * @property string note_to_payee * @property string custom * @property string invoice_number * @property string purchase_order * @property string soft_descriptor * @property \PayPal\Api\PaymentOptions payment_options * @property \PayPal\Api\ItemList item_list * @property string notify_url * @property string order_url */ class CartBase extends PayPalModel { /** * Merchant identifier to the purchase unit. Optional parameter * * @param string $reference_id * * @return $this */ public function setReferenceId($reference_id) { $this->reference_id = $reference_id; return $this; } /** * Merchant identifier to the purchase unit. Optional parameter * * @return string */ public function getReferenceId() { return $this->reference_id; } /** * Amount being collected. * * @param \PayPal\Api\Amount $amount * * @return $this */ public function setAmount($amount) { $this->amount = $amount; return $this; } /** * Amount being collected. * * @return \PayPal\Api\Amount */ public function getAmount() { return $this->amount; } /** * Recipient of the funds in this transaction. * * @param \PayPal\Api\Payee $payee * * @return $this */ public function setPayee($payee) { $this->payee = $payee; return $this; } /** * Recipient of the funds in this transaction. * * @return \PayPal\Api\Payee */ public function getPayee() { return $this->payee; } /** * Description of what is being paid for. * * @param string $description * * @return $this */ public function setDescription($description) { $this->description = $description; return $this; } /** * Description of what is being paid for. * * @return string */ public function getDescription() { return $this->description; } /** * Note to the recipient of the funds in this transaction. * * @param string $note_to_payee * * @return $this */ public function setNoteToPayee($note_to_payee) { $this->note_to_payee = $note_to_payee; return $this; } /** * Note to the recipient of the funds in this transaction. * * @return string */ public function getNoteToPayee() { return $this->note_to_payee; } /** * free-form field for the use of clients * * @param string $custom * * @return $this */ public function setCustom($custom) { $this->custom = $custom; return $this; } /** * free-form field for the use of clients * * @return string */ public function getCustom() { return $this->custom; } /** * invoice number to track this payment * * @param string $invoice_number * * @return $this */ public function setInvoiceNumber($invoice_number) { $this->invoice_number = $invoice_number; return $this; } /** * invoice number to track this payment * * @return string */ public function getInvoiceNumber() { return $this->invoice_number; } /** * purchase order is number or id specific to this payment * * @param string $purchase_order * * @return $this */ public function setPurchaseOrder($purchase_order) { $this->purchase_order = $purchase_order; return $this; } /** * purchase order is number or id specific to this payment * * @return string */ public function getPurchaseOrder() { return $this->purchase_order; } /** * Soft descriptor used when charging this funding source. If length exceeds max length, the value will be truncated * * @param string $soft_descriptor * * @return $this */ public function setSoftDescriptor($soft_descriptor) { $this->soft_descriptor = $soft_descriptor; return $this; } /** * Soft descriptor used when charging this funding source. If length exceeds max length, the value will be truncated * * @return string */ public function getSoftDescriptor() { return $this->soft_descriptor; } /** * Soft descriptor city used when charging this funding source. If length exceeds max length, the value will be truncated. Only supported when the `payment_method` is set to `credit_card` * @deprecated Not publicly available * @param string $soft_descriptor_city * * @return $this */ public function setSoftDescriptorCity($soft_descriptor_city) { $this->soft_descriptor_city = $soft_descriptor_city; return $this; } /** * Soft descriptor city used when charging this funding source. If length exceeds max length, the value will be truncated. Only supported when the `payment_method` is set to `credit_card` * @deprecated Not publicly available * @return string */ public function getSoftDescriptorCity() { return $this->soft_descriptor_city; } /** * Payment options requested for this purchase unit * * @param \PayPal\Api\PaymentOptions $payment_options * * @return $this */ public function setPaymentOptions($payment_options) { $this->payment_options = $payment_options; return $this; } /** * Payment options requested for this purchase unit * * @return \PayPal\Api\PaymentOptions */ public function getPaymentOptions() { return $this->payment_options; } /** * List of items being paid for. * * @param \PayPal\Api\ItemList $item_list * * @return $this */ public function setItemList($item_list) { $this->item_list = $item_list; return $this; } /** * List of items being paid for. * * @return \PayPal\Api\ItemList */ public function getItemList() { return $this->item_list; } /** * URL to send payment notifications * * @param string $notify_url * @throws \InvalidArgumentException * @return $this */ public function setNotifyUrl($notify_url) { UrlValidator::validate($notify_url, "NotifyUrl"); $this->notify_url = $notify_url; return $this; } /** * URL to send payment notifications * * @return string */ public function getNotifyUrl() { return $this->notify_url; } /** * Url on merchant site pertaining to this payment. * * @param string $order_url * @throws \InvalidArgumentException * @return $this */ public function setOrderUrl($order_url) { UrlValidator::validate($order_url, "OrderUrl"); $this->order_url = $order_url; return $this; } /** * Url on merchant site pertaining to this payment. * * @return string */ public function getOrderUrl() { return $this->order_url; } /** * List of external funding being applied to the purchase unit. Each external_funding unit should have a unique reference_id * @deprecated Not publicly available * @param \PayPal\Api\ExternalFunding[] $external_funding * * @return $this */ public function setExternalFunding($external_funding) { $this->external_funding = $external_funding; return $this; } /** * List of external funding being applied to the purchase unit. Each external_funding unit should have a unique reference_id * @deprecated Not publicly available * @return \PayPal\Api\ExternalFunding[] */ public function getExternalFunding() { return $this->external_funding; } /** * Append ExternalFunding to the list. * @deprecated Not publicly available * @param \PayPal\Api\ExternalFunding $externalFunding * @return $this */ public function addExternalFunding($externalFunding) { if (!$this->getExternalFunding()) { return $this->setExternalFunding(array($externalFunding)); } else { return $this->setExternalFunding( array_merge($this->getExternalFunding(), array($externalFunding)) ); } } /** * Remove ExternalFunding from the list. * @deprecated Not publicly available * @param \PayPal\Api\ExternalFunding $externalFunding * @return $this */ public function removeExternalFunding($externalFunding) { return $this->setExternalFunding( array_diff($this->getExternalFunding(), array($externalFunding)) ); } } rest-api-sdk-php/lib/PayPal/Api/ItemList.php 0000644 00000006656 15213403564 0014564 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class ItemList * * List of items being paid for. * * @package PayPal\Api * * @property \PayPal\Api\Item[] items * @property \PayPal\Api\ShippingAddress shipping_address * @property string shipping_method * @property string shipping_phone_number */ class ItemList extends PayPalModel { /** * List of items. * * @param \PayPal\Api\Item[] $items * * @return $this */ public function setItems($items) { $this->items = array_values($items); return $this; } /** * List of items. * * @return \PayPal\Api\Item[] */ public function getItems() { return $this->items; } /** * Append Items to the list. * * @param \PayPal\Api\Item $item * @return $this */ public function addItem($item) { if (!$this->getItems()) { return $this->setItems(array($item)); } else { return $this->setItems( array_merge($this->getItems(), array($item)) ); } } /** * Remove Items from the list. * * @param \PayPal\Api\Item $item * @return $this */ public function removeItem($item) { return $this->setItems( array_diff($this->getItems(), array($item)) ); } /** * Shipping address. * * @param \PayPal\Api\ShippingAddress $shipping_address * * @return $this */ public function setShippingAddress($shipping_address) { $this->shipping_address = $shipping_address; return $this; } /** * Shipping address. * * @return \PayPal\Api\ShippingAddress */ public function getShippingAddress() { return $this->shipping_address; } /** * Shipping method used for this payment like USPSParcel etc. * * @param string $shipping_method * * @return $this */ public function setShippingMethod($shipping_method) { $this->shipping_method = $shipping_method; return $this; } /** * Shipping method used for this payment like USPSParcel etc. * * @return string */ public function getShippingMethod() { return $this->shipping_method; } /** * Allows merchant's to share payer’s contact number with PayPal for the current payment. Final contact number of payer associated with the transaction might be same as shipping_phone_number or different based on Payer’s action on PayPal. The phone number must be represented in its canonical international format, as defined by the E.164 numbering plan * * @param string $shipping_phone_number * * @return $this */ public function setShippingPhoneNumber($shipping_phone_number) { $this->shipping_phone_number = $shipping_phone_number; return $this; } /** * Allows merchant's to share payer’s contact number with PayPal for the current payment. Final contact number of payer associated with the transaction might be same as shipping_phone_number or different based on Payer’s action on PayPal. The phone number must be represented in its canonical international format, as defined by the E.164 numbering plan * * @return string */ public function getShippingPhoneNumber() { return $this->shipping_phone_number; } } rest-api-sdk-php/lib/PayPal/Api/Address.php 0000644 00000002075 15213403564 0014406 0 ustar 00 <?php namespace PayPal\Api; /** * Class Address * * Base Address object used as billing address in a payment or extended for Shipping Address. * * @package PayPal\Api * * @property string phone * @property string type */ class Address extends BaseAddress { /** * Phone number in E.123 format. 50 characters max. * * @param string $phone * * @return $this */ public function setPhone($phone) { $this->phone = $phone; return $this; } /** * Phone number in E.123 format. 50 characters max. * * @return string */ public function getPhone() { return $this->phone; } /** * Type of address (e.g., HOME_OR_WORK, GIFT etc). * * @param string $type * * @return $this */ public function setType($type) { $this->type = $type; return $this; } /** * Type of address (e.g., HOME_OR_WORK, GIFT etc). * * @return string */ public function getType() { return $this->type; } } rest-api-sdk-php/lib/PayPal/Api/TemplateData.php 0000644 00000035472 15213403564 0015375 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; use PayPal\Validation\UrlValidator; /** * Class TemplateData * * Detailed template information. * * @package PayPal\Api * * @property \PayPal\Api\MerchantInfo merchant_info * @property \PayPal\Api\BillingInfo[] billing_info * @property string[] cc_info * @property \PayPal\Api\ShippingInfo shipping_info * @property \PayPal\Api\InvoiceItem[] items * @property \PayPal\Api\PaymentTerm payment_term * @property string reference * @property \PayPal\Api\Cost discount * @property \PayPal\Api\ShippingCost shipping_cost * @property \PayPal\Api\CustomAmount custom * @property bool allow_partial_payment * @property \PayPal\Api\Currency minimum_amount_due * @property bool tax_calculated_after_discount * @property bool tax_inclusive * @property string terms * @property string note * @property string merchant_memo * @property string logo_url * @property \PayPal\Api\Currency total_amount * @property \PayPal\Api\FileAttachment[] attachments */ class TemplateData extends PayPalModel { /** * Information about the merchant who is sending the invoice. * * @param \PayPal\Api\MerchantInfo $merchant_info * * @return $this */ public function setMerchantInfo($merchant_info) { $this->merchant_info = $merchant_info; return $this; } /** * Information about the merchant who is sending the invoice. * * @return \PayPal\Api\MerchantInfo */ public function getMerchantInfo() { return $this->merchant_info; } /** * The required invoice recipient email address and any optional billing information. One recipient is supported. * * @param \PayPal\Api\BillingInfo[] $billing_info * * @return $this */ public function setBillingInfo($billing_info) { $this->billing_info = $billing_info; return $this; } /** * The required invoice recipient email address and any optional billing information. One recipient is supported. * * @return \PayPal\Api\BillingInfo[] */ public function getBillingInfo() { return $this->billing_info; } /** * Append BillingInfo to the list. * * @param \PayPal\Api\BillingInfo $billingInfo * @return $this */ public function addBillingInfo($billingInfo) { if (!$this->getBillingInfo()) { return $this->setBillingInfo(array($billingInfo)); } else { return $this->setBillingInfo( array_merge($this->getBillingInfo(), array($billingInfo)) ); } } /** * Remove BillingInfo from the list. * * @param \PayPal\Api\BillingInfo $billingInfo * @return $this */ public function removeBillingInfo($billingInfo) { return $this->setBillingInfo( array_diff($this->getBillingInfo(), array($billingInfo)) ); } /** * For invoices sent by email, one or more email addresses to which to send a Cc: copy of the notification. Supports only email addresses under participant. * * @param string[] $cc_info * * @return $this */ public function setCcInfo($cc_info) { $this->cc_info = $cc_info; return $this; } /** * For invoices sent by email, one or more email addresses to which to send a Cc: copy of the notification. Supports only email addresses under participant. * * @return string[] */ public function getCcInfo() { return $this->cc_info; } /** * Append CcInfo to the list. * * @param string $email * @return $this */ public function addCcInfo($email) { if (!$this->getCcInfo()) { return $this->setCcInfo(array($email)); } else { return $this->setCcInfo( array_merge($this->getCcInfo(), array($email)) ); } } /** * Remove CcInfo from the list. * * @param string $email * @return $this */ public function removeCcInfo($email) { return $this->setCcInfo( array_diff($this->getCcInfo(), array($email)) ); } /** * The shipping information for entities to whom items are being shipped. * * @param \PayPal\Api\ShippingInfo $shipping_info * * @return $this */ public function setShippingInfo($shipping_info) { $this->shipping_info = $shipping_info; return $this; } /** * The shipping information for entities to whom items are being shipped. * * @return \PayPal\Api\ShippingInfo */ public function getShippingInfo() { return $this->shipping_info; } /** * The list of items to include in the invoice. Maximum value is 100 items per invoice. * * @param \PayPal\Api\InvoiceItem[] $items * * @return $this */ public function setItems($items) { $this->items = $items; return $this; } /** * The list of items to include in the invoice. Maximum value is 100 items per invoice. * * @return \PayPal\Api\InvoiceItem[] */ public function getItems() { return $this->items; } /** * Append Items to the list. * * @param \PayPal\Api\InvoiceItem $invoiceItem * @return $this */ public function addItem($invoiceItem) { if (!$this->getItems()) { return $this->setItems(array($invoiceItem)); } else { return $this->setItems( array_merge($this->getItems(), array($invoiceItem)) ); } } /** * Remove Items from the list. * * @param \PayPal\Api\InvoiceItem $invoiceItem * @return $this */ public function removeItem($invoiceItem) { return $this->setItems( array_diff($this->getItems(), array($invoiceItem)) ); } /** * Optional. The payment deadline for the invoice. Value is either `term_type` or `due_date` but not both. * * @param \PayPal\Api\PaymentTerm $payment_term * * @return $this */ public function setPaymentTerm($payment_term) { $this->payment_term = $payment_term; return $this; } /** * Optional. The payment deadline for the invoice. Value is either `term_type` or `due_date` but not both. * * @return \PayPal\Api\PaymentTerm */ public function getPaymentTerm() { return $this->payment_term; } /** * Reference data, such as PO number, to add to the invoice. Maximum length is 60 characters. * * @param string $reference * * @return $this */ public function setReference($reference) { $this->reference = $reference; return $this; } /** * Reference data, such as PO number, to add to the invoice. Maximum length is 60 characters. * * @return string */ public function getReference() { return $this->reference; } /** * The invoice level discount, as a percent or an amount value. * * @param \PayPal\Api\Cost $discount * * @return $this */ public function setDiscount($discount) { $this->discount = $discount; return $this; } /** * The invoice level discount, as a percent or an amount value. * * @return \PayPal\Api\Cost */ public function getDiscount() { return $this->discount; } /** * The shipping cost, as a percent or an amount value. * * @param \PayPal\Api\ShippingCost $shipping_cost * * @return $this */ public function setShippingCost($shipping_cost) { $this->shipping_cost = $shipping_cost; return $this; } /** * The shipping cost, as a percent or an amount value. * * @return \PayPal\Api\ShippingCost */ public function getShippingCost() { return $this->shipping_cost; } /** * The custom amount to apply on an invoice. If you include a label, the amount cannot be empty. * * @param \PayPal\Api\CustomAmount $custom * * @return $this */ public function setCustom($custom) { $this->custom = $custom; return $this; } /** * The custom amount to apply on an invoice. If you include a label, the amount cannot be empty. * * @return \PayPal\Api\CustomAmount */ public function getCustom() { return $this->custom; } /** * Indicates whether the invoice allows a partial payment. If set to `false`, invoice must be paid in full. If set to `true`, the invoice allows partial payments. Default is `false`. * * @param bool $allow_partial_payment * * @return $this */ public function setAllowPartialPayment($allow_partial_payment) { $this->allow_partial_payment = $allow_partial_payment; return $this; } /** * Indicates whether the invoice allows a partial payment. If set to `false`, invoice must be paid in full. If set to `true`, the invoice allows partial payments. Default is `false`. * * @return bool */ public function getAllowPartialPayment() { return $this->allow_partial_payment; } /** * If `allow_partial_payment` is set to `true`, the minimum amount allowed for a partial payment. * * @param \PayPal\Api\Currency $minimum_amount_due * * @return $this */ public function setMinimumAmountDue($minimum_amount_due) { $this->minimum_amount_due = $minimum_amount_due; return $this; } /** * If `allow_partial_payment` is set to `true`, the minimum amount allowed for a partial payment. * * @return \PayPal\Api\Currency */ public function getMinimumAmountDue() { return $this->minimum_amount_due; } /** * Indicates whether tax is calculated before or after a discount. If set to `false`, the tax is calculated before a discount. If set to `true`, the tax is calculated after a discount. Default is `false`. * * @param bool $tax_calculated_after_discount * * @return $this */ public function setTaxCalculatedAfterDiscount($tax_calculated_after_discount) { $this->tax_calculated_after_discount = $tax_calculated_after_discount; return $this; } /** * Indicates whether tax is calculated before or after a discount. If set to `false`, the tax is calculated before a discount. If set to `true`, the tax is calculated after a discount. Default is `false`. * * @return bool */ public function getTaxCalculatedAfterDiscount() { return $this->tax_calculated_after_discount; } /** * Indicates whether the unit price includes tax. Default is `false`. * * @param bool $tax_inclusive * * @return $this */ public function setTaxInclusive($tax_inclusive) { $this->tax_inclusive = $tax_inclusive; return $this; } /** * Indicates whether the unit price includes tax. Default is `false`. * * @return bool */ public function getTaxInclusive() { return $this->tax_inclusive; } /** * General terms of the invoice. 4000 characters max. * * @param string $terms * * @return $this */ public function setTerms($terms) { $this->terms = $terms; return $this; } /** * General terms of the invoice. 4000 characters max. * * @return string */ public function getTerms() { return $this->terms; } /** * Note to the payer. 4000 characters max. * * @param string $note * * @return $this */ public function setNote($note) { $this->note = $note; return $this; } /** * Note to the payer. 4000 characters max. * * @return string */ public function getNote() { return $this->note; } /** * A private bookkeeping memo for the merchant. Maximum length is 150 characters. * * @param string $merchant_memo * * @return $this */ public function setMerchantMemo($merchant_memo) { $this->merchant_memo = $merchant_memo; return $this; } /** * A private bookkeeping memo for the merchant. Maximum length is 150 characters. * * @return string */ public function getMerchantMemo() { return $this->merchant_memo; } /** * Full URL of an external image to use as the logo. Maximum length is 4000 characters. * * @param string $logo_url * @throws \InvalidArgumentException * @return $this */ public function setLogoUrl($logo_url) { UrlValidator::validate($logo_url, "LogoUrl"); $this->logo_url = $logo_url; return $this; } /** * Full URL of an external image to use as the logo. Maximum length is 4000 characters. * * @return string */ public function getLogoUrl() { return $this->logo_url; } /** * The total amount of the invoice. * * @param \PayPal\Api\Currency $total_amount * * @return $this */ public function setTotalAmount($total_amount) { $this->total_amount = $total_amount; return $this; } /** * The total amount of the invoice. * * @return \PayPal\Api\Currency */ public function getTotalAmount() { return $this->total_amount; } /** * List of files attached to the invoice. * * @param \PayPal\Api\FileAttachment[] $attachments * * @return $this */ public function setAttachments($attachments) { $this->attachments = $attachments; return $this; } /** * List of files attached to the invoice. * * @return \PayPal\Api\FileAttachment[] */ public function getAttachments() { return $this->attachments; } /** * Append Attachments to the list. * * @param \PayPal\Api\FileAttachment $fileAttachment * @return $this */ public function addAttachment($fileAttachment) { if (!$this->getAttachments()) { return $this->setAttachments(array($fileAttachment)); } else { return $this->setAttachments( array_merge($this->getAttachments(), array($fileAttachment)) ); } } /** * Remove Attachments from the list. * * @param \PayPal\Api\FileAttachment $fileAttachment * @return $this */ public function removeAttachment($fileAttachment) { return $this->setAttachments( array_diff($this->getAttachments(), array($fileAttachment)) ); } } rest-api-sdk-php/lib/PayPal/Api/TransactionBase.php 0000644 00000001657 15213403564 0016106 0 ustar 00 <?php namespace PayPal\Api; /** * Class TransactionBase * * A transaction defines the contract of a payment - what is the payment for and who is fulfilling it. * * @package PayPal\Api * * @property \PayPal\Api\RelatedResources related_resources */ class TransactionBase extends CartBase { /** * List of financial transactions (Sale, Authorization, Capture, Refund) related to the payment. * * * @param \PayPal\Api\RelatedResources[] $related_resources * * @return $this */ public function setRelatedResources($related_resources) { $this->related_resources = $related_resources; return $this; } /** * List of financial transactions (Sale, Authorization, Capture, Refund) related to the payment. * * @return \PayPal\Api\RelatedResources[] */ public function getRelatedResources() { return $this->related_resources; } } rest-api-sdk-php/lib/PayPal/Api/Terms.php 0000644 00000006102 15213403564 0014106 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class Terms * * Resource representing terms used by the plan. * * @package PayPal\Api * * @property string id * @property string type * @property \PayPal\Api\Currency max_billing_amount * @property string occurrences * @property \PayPal\Api\Currency amount_range * @property string buyer_editable */ class Terms extends PayPalModel { /** * Identifier of the terms. 128 characters max. * * @param string $id * * @return $this */ public function setId($id) { $this->id = $id; return $this; } /** * Identifier of the terms. 128 characters max. * * @return string */ public function getId() { return $this->id; } /** * Term type. Allowed values: `MONTHLY`, `WEEKLY`, `YEARLY`. * * @param string $type * * @return $this */ public function setType($type) { $this->type = $type; return $this; } /** * Term type. Allowed values: `MONTHLY`, `WEEKLY`, `YEARLY`. * * @return string */ public function getType() { return $this->type; } /** * Max Amount associated with this term. * * @param \PayPal\Api\Currency $max_billing_amount * * @return $this */ public function setMaxBillingAmount($max_billing_amount) { $this->max_billing_amount = $max_billing_amount; return $this; } /** * Max Amount associated with this term. * * @return \PayPal\Api\Currency */ public function getMaxBillingAmount() { return $this->max_billing_amount; } /** * How many times money can be pulled during this term. * * @param string $occurrences * * @return $this */ public function setOccurrences($occurrences) { $this->occurrences = $occurrences; return $this; } /** * How many times money can be pulled during this term. * * @return string */ public function getOccurrences() { return $this->occurrences; } /** * Amount_range associated with this term. * * @param \PayPal\Api\Currency $amount_range * * @return $this */ public function setAmountRange($amount_range) { $this->amount_range = $amount_range; return $this; } /** * Amount_range associated with this term. * * @return \PayPal\Api\Currency */ public function getAmountRange() { return $this->amount_range; } /** * Buyer's ability to edit the amount in this term. * * @param string $buyer_editable * * @return $this */ public function setBuyerEditable($buyer_editable) { $this->buyer_editable = $buyer_editable; return $this; } /** * Buyer's ability to edit the amount in this term. * * @return string */ public function getBuyerEditable() { return $this->buyer_editable; } } rest-api-sdk-php/lib/PayPal/Api/CarrierAccountToken.php 0000644 00000002630 15213403564 0016723 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class CarrierAccountToken * * A resource representing a carrier account that can be used to fund a payment. * * @package PayPal\Api * * @property string carrier_account_id * @property string external_customer_id */ class CarrierAccountToken extends PayPalModel { /** * ID of a previously saved carrier account resource. * * @param string $carrier_account_id * * @return $this */ public function setCarrierAccountId($carrier_account_id) { $this->carrier_account_id = $carrier_account_id; return $this; } /** * ID of a previously saved carrier account resource. * * @return string */ public function getCarrierAccountId() { return $this->carrier_account_id; } /** * The unique identifier of the payer used when saving this carrier account instrument. * * @param string $external_customer_id * * @return $this */ public function setExternalCustomerId($external_customer_id) { $this->external_customer_id = $external_customer_id; return $this; } /** * The unique identifier of the payer used when saving this carrier account instrument. * * @return string */ public function getExternalCustomerId() { return $this->external_customer_id; } } rest-api-sdk-php/lib/PayPal/Api/Currency.php 0000644 00000002703 15213403564 0014611 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; use PayPal\Converter\FormatConverter; use PayPal\Validation\NumericValidator; /** * Class Currency * * Base object for all financial value related fields (balance, payment due, etc.) * * @package PayPal\Api * * @property string currency * @property string value */ class Currency extends PayPalModel { /** * 3 letter currency code as defined by ISO 4217. * * @param string $currency * * @return $this */ public function setCurrency($currency) { $this->currency = $currency; return $this; } /** * 3 letter currency code as defined by ISO 4217. * * @return string */ public function getCurrency() { return $this->currency; } /** * amount up to N digit after the decimals separator as defined in ISO 4217 for the appropriate currency code. * * @param string|double $value * * @return $this */ public function setValue($value) { NumericValidator::validate($value, "Value"); $value = FormatConverter::formatToPrice($value, $this->getCurrency()); $this->value = $value; return $this; } /** * amount up to N digit after the decimals separator as defined in ISO 4217 for the appropriate currency code. * * @return string */ public function getValue() { return $this->value; } } rest-api-sdk-php/lib/PayPal/Api/FlowConfig.php 0000644 00000006062 15213403564 0015056 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; use PayPal\Validation\UrlValidator; /** * Class FlowConfig * * Parameters for flow configuration. * * @package PayPal\Api * * @property string landing_page_type * @property string bank_txn_pending_url * @property string user_action * @property string return_uri_http_method */ class FlowConfig extends PayPalModel { /** * The type of landing page to display on the PayPal site for user checkout. Set to `Billing` to use the non-PayPal account landing page. Set to `Login` to use the PayPal account login landing page. * * @param string $landing_page_type * * @return $this */ public function setLandingPageType($landing_page_type) { $this->landing_page_type = $landing_page_type; return $this; } /** * The type of landing page to display on the PayPal site for user checkout. Set to `Billing` to use the non-PayPal account landing page. Set to `Login` to use the PayPal account login landing page. * * @return string */ public function getLandingPageType() { return $this->landing_page_type; } /** * The merchant site URL to display after a bank transfer payment. Valid for only the Giropay or bank transfer payment method in Germany. * * @param string $bank_txn_pending_url * @throws \InvalidArgumentException * @return $this */ public function setBankTxnPendingUrl($bank_txn_pending_url) { UrlValidator::validate($bank_txn_pending_url, "BankTxnPendingUrl"); $this->bank_txn_pending_url = $bank_txn_pending_url; return $this; } /** * The merchant site URL to display after a bank transfer payment. Valid for only the Giropay or bank transfer payment method in Germany. * * @return string */ public function getBankTxnPendingUrl() { return $this->bank_txn_pending_url; } /** * Defines whether buyers can complete purchases on the PayPal or merchant website. * * @param string $user_action * * @return $this */ public function setUserAction($user_action) { $this->user_action = $user_action; return $this; } /** * Defines whether buyers can complete purchases on the PayPal or merchant website. * * @return string */ public function getUserAction() { return $this->user_action; } /** * Defines the HTTP method to use to redirect the user to a return URL. A valid value is `GET` or `POST`. * * @param string $return_uri_http_method * * @return $this */ public function setReturnUriHttpMethod($return_uri_http_method) { $this->return_uri_http_method = $return_uri_http_method; return $this; } /** * Defines the HTTP method to use to redirect the user to a return URL. A valid value is `GET` or `POST`. * * @return string */ public function getReturnUriHttpMethod() { return $this->return_uri_http_method; } } rest-api-sdk-php/lib/PayPal/Api/Presentation.php 0000644 00000010746 15213403564 0015500 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class Presentation * * Parameters for style and presentation. * * @package PayPal\Api * * @property string brand_name * @property string logo_image * @property string locale_code * @property string return_url_label * @property string note_to_seller_label */ class Presentation extends PayPalModel { /** * A label that overrides the business name in the PayPal account on the PayPal pages. Character length and limitations: 127 single-byte alphanumeric characters. * * @param string $brand_name * * @return $this */ public function setBrandName($brand_name) { $this->brand_name = $brand_name; return $this; } /** * A label that overrides the business name in the PayPal account on the PayPal pages. Character length and limitations: 127 single-byte alphanumeric characters. * * @return string */ public function getBrandName() { return $this->brand_name; } /** * A URL to the logo image. A valid media type is `.gif`, `.jpg`, or `.png`. The maximum width of the image is 190 pixels. The maximum height of the image is 60 pixels. PayPal crops images that are larger. PayPal places your logo image at the top of the cart review area. PayPal recommends that you store the image on a secure (HTTPS) server. Otherwise, web browsers display a message that checkout pages contain non-secure items. Character length and limit: 127 single-byte alphanumeric characters. * * @param string $logo_image * * @return $this */ public function setLogoImage($logo_image) { $this->logo_image = $logo_image; return $this; } /** * A URL to the logo image. A valid media type is `.gif`, `.jpg`, or `.png`. The maximum width of the image is 190 pixels. The maximum height of the image is 60 pixels. PayPal crops images that are larger. PayPal places your logo image at the top of the cart review area. PayPal recommends that you store the image on a secure (HTTPS) server. Otherwise, web browsers display a message that checkout pages contain non-secure items. Character length and limit: 127 single-byte alphanumeric characters. * * @return string */ public function getLogoImage() { return $this->logo_image; } /** * The locale of pages displayed by PayPal payment experience. A valid value is `AU`, `AT`, `BE`, `BR`, `CA`, `CH`, `CN`, `DE`, `ES`, `GB`, `FR`, `IT`, `NL`, `PL`, `PT`, `RU`, or `US`. A 5-character code is also valid for languages in specific countries: `da_DK`, `he_IL`, `id_ID`, `ja_JP`, `no_NO`, `pt_BR`, `ru_RU`, `sv_SE`, `th_TH`, `zh_CN`, `zh_HK`, or `zh_TW`. * * @param string $locale_code * * @return $this */ public function setLocaleCode($locale_code) { $this->locale_code = $locale_code; return $this; } /** * The locale of pages displayed by PayPal payment experience. A valid value is `AU`, `AT`, `BE`, `BR`, `CA`, `CH`, `CN`, `DE`, `ES`, `GB`, `FR`, `IT`, `NL`, `PL`, `PT`, `RU`, or `US`. A 5-character code is also valid for languages in specific countries: `da_DK`, `he_IL`, `id_ID`, `ja_JP`, `no_NO`, `pt_BR`, `ru_RU`, `sv_SE`, `th_TH`, `zh_CN`, `zh_HK`, or `zh_TW`. * * @return string */ public function getLocaleCode() { return $this->locale_code; } /** * A label to use as hypertext for the return to merchant link. * * @param string $return_url_label * * @return $this */ public function setReturnUrlLabel($return_url_label) { $this->return_url_label = $return_url_label; return $this; } /** * A label to use as hypertext for the return to merchant link. * * @return string */ public function getReturnUrlLabel() { return $this->return_url_label; } /** * A label to use as the title for the note to seller field. Used only when `allow_note` is `1`. * * @param string $note_to_seller_label * * @return $this */ public function setNoteToSellerLabel($note_to_seller_label) { $this->note_to_seller_label = $note_to_seller_label; return $this; } /** * A label to use as the title for the note to seller field. Used only when `allow_note` is `1`. * * @return string */ public function getNoteToSellerLabel() { return $this->note_to_seller_label; } } rest-api-sdk-php/lib/PayPal/Api/OpenIdUserinfo.php 0000644 00000025631 15213403564 0015715 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalResourceModel; use PayPal\Rest\ApiContext; /** * Class OpenIdUserinfo * * OpenIdConnect UserInfo Resource * * @property string user_id * @property string sub * @property mixed name * @property string given_name * @property string family_name * @property string middle_name * @property string picture * @property string email * @property bool email_verified * @property string gender * @property string birthday * @property string zoneinfo * @property string locale * @property string language * @property bool verified * @property string phone_number * @property OpenIdAddress address * @property mixed verified_account * @property mixed account_type * @property string age_range * @property string payer_id */ class OpenIdUserinfo extends PayPalResourceModel { /** * Subject - Identifier for the End-User at the Issuer. * * @param string $user_id * @return self */ public function setUserId($user_id) { $this->user_id = $user_id; return $this; } /** * Subject - Identifier for the End-User at the Issuer. * * @return string */ public function getUserId() { return $this->user_id; } /** * Subject - Identifier for the End-User at the Issuer. * * @param string $sub * @return self */ public function setSub($sub) { $this->sub = $sub; return $this; } /** * Subject - Identifier for the End-User at the Issuer. * * @return string */ public function getSub() { return $this->sub; } /** * End-User's full name in displayable form including all name parts, possibly including titles and suffixes, ordered according to the End-User's locale and preferences. * * @param string $name * @return self */ public function setName($name) { $this->name = $name; return $this; } /** * End-User's full name in displayable form including all name parts, possibly including titles and suffixes, ordered according to the End-User's locale and preferences. * * @return string */ public function getName() { return $this->name; } /** * Given name(s) or first name(s) of the End-User * * @param string $given_name * @return self */ public function setGivenName($given_name) { $this->given_name = $given_name; return $this; } /** * Given name(s) or first name(s) of the End-User * * @return string */ public function getGivenName() { return $this->given_name; } /** * Surname(s) or last name(s) of the End-User. * * @param string $family_name * @return self */ public function setFamilyName($family_name) { $this->family_name = $family_name; return $this; } /** * Surname(s) or last name(s) of the End-User. * * @return string */ public function getFamilyName() { return $this->family_name; } /** * Middle name(s) of the End-User. * * @param string $middle_name * @return self */ public function setMiddleName($middle_name) { $this->middle_name = $middle_name; return $this; } /** * Middle name(s) of the End-User. * * @return string */ public function getMiddleName() { return $this->middle_name; } /** * URL of the End-User's profile picture. * * @param string $picture * @return self */ public function setPicture($picture) { $this->picture = $picture; return $this; } /** * URL of the End-User's profile picture. * * @return string */ public function getPicture() { return $this->picture; } /** * End-User's preferred e-mail address. * * @param string $email * @return self */ public function setEmail($email) { $this->email = $email; return $this; } /** * End-User's preferred e-mail address. * * @return string */ public function getEmail() { return $this->email; } /** * True if the End-User's e-mail address has been verified; otherwise false. * * @param boolean $email_verified * @return self */ public function setEmailVerified($email_verified) { $this->email_verified = $email_verified; return $this; } /** * True if the End-User's e-mail address has been verified; otherwise false. * * @return boolean */ public function getEmailVerified() { return $this->email_verified; } /** * End-User's gender. * * @param string $gender * @return self */ public function setGender($gender) { $this->gender = $gender; return $this; } /** * End-User's gender. * * @return string */ public function getGender() { return $this->gender; } /** * End-User's birthday, represented as an YYYY-MM-DD format. They year MAY be 0000, indicating it is omited. To represent only the year, YYYY format would be used. * * @param string $birthday * @return self */ public function setBirthday($birthday) { $this->birthday = $birthday; return $this; } /** * End-User's birthday, represented as an YYYY-MM-DD format. They year MAY be 0000, indicating it is omited. To represent only the year, YYYY format would be used. * * @return string */ public function getBirthday() { return $this->birthday; } /** * Time zone database representing the End-User's time zone * * @param string $zoneinfo * @return self */ public function setZoneinfo($zoneinfo) { $this->zoneinfo = $zoneinfo; return $this; } /** * Time zone database representing the End-User's time zone * * @return string */ public function getZoneinfo() { return $this->zoneinfo; } /** * End-User's locale. * * @param string $locale * @return self */ public function setLocale($locale) { $this->locale = $locale; return $this; } /** * End-User's locale. * * @return string */ public function getLocale() { return $this->locale; } /** * End-User's language. * * @param string $language * @return self */ public function setLanguage($language) { $this->language = $language; return $this; } /** * End-User's language. * * @return string */ public function getLanguage() { return $this->language; } /** * End-User's verified status. * * @param boolean $verified * @return self */ public function setVerified($verified) { $this->verified = $verified; return $this; } /** * End-User's verified status. * * @return boolean */ public function getVerified() { return $this->verified; } /** * End-User's preferred telephone number. * * @param string $phone_number * @return self */ public function setPhoneNumber($phone_number) { $this->phone_number = $phone_number; return $this; } /** * End-User's preferred telephone number. * * @return string */ public function getPhoneNumber() { return $this->phone_number; } /** * End-User's preferred address. * * @param \PayPal\Api\OpenIdAddress $address * @return self */ public function setAddress($address) { $this->address = $address; return $this; } /** * End-User's preferred address. * * @return \PayPal\Api\OpenIdAddress */ public function getAddress() { return $this->address; } /** * Verified account status. * * @param boolean $verified_account * @return self */ public function setVerifiedAccount($verified_account) { $this->verified_account = $verified_account; return $this; } /** * Verified account status. * * @return boolean */ public function getVerifiedAccount() { return $this->verified_account; } /** * Account type. * * @param string $account_type * @return self */ public function setAccountType($account_type) { $this->account_type = $account_type; return $this; } /** * Account type. * * @return string */ public function getAccountType() { return $this->account_type; } /** * Account holder age range. * * @param string $age_range * @return self */ public function setAgeRange($age_range) { $this->age_range = $age_range; return $this; } /** * Account holder age range. * * @return string */ public function getAgeRange() { return $this->age_range; } /** * Account payer identifier. * * @param string $payer_id * @return self */ public function setPayerId($payer_id) { $this->payer_id = $payer_id; return $this; } /** * Account payer identifier. * * @return string */ public function getPayerId() { return $this->payer_id; } /** * returns user details * * @path /v1/identity/openidconnect/userinfo * @method GET * @param array $params (allowed values are access_token) * access_token - access token from the createFromAuthorizationCode / createFromRefreshToken calls * @param ApiContext $apiContext Optional API Context * @param PayPalRestCall $restCall * @return OpenIdUserinfo */ public static function getUserinfo($params, $apiContext = null, $restCall = null) { static $allowedParams = array('schema' => 1); $params = is_array($params) ? $params : array(); if (!array_key_exists('schema', $params)) { $params['schema'] = 'openid'; } $requestUrl = "/v1/identity/openidconnect/userinfo?" . http_build_query(array_intersect_key($params, $allowedParams)); $json = self::executeCall( $requestUrl, "GET", "", array( 'Authorization' => "Bearer " . $params['access_token'], 'Content-Type' => 'x-www-form-urlencoded' ), $apiContext, $restCall ); $ret = new OpenIdUserinfo(); $ret->fromJson($json); return $ret; } } rest-api-sdk-php/lib/PayPal/Api/OpenIdAddress.php 0000644 00000004623 15213403564 0015506 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class OpenIdAddress * * End-User's preferred address. * * @package PayPal\Api * * @property string street_address * @property string locality * @property string region * @property string postal_code * @property string country */ class OpenIdAddress extends PayPalModel { /** * Full street address component, which may include house number, street name. * * @param string $street_address * @return self */ public function setStreetAddress($street_address) { $this->street_address = $street_address; return $this; } /** * Full street address component, which may include house number, street name. * * @return string */ public function getStreetAddress() { return $this->street_address; } /** * City or locality component. * * @param string $locality * @return self */ public function setLocality($locality) { $this->locality = $locality; return $this; } /** * City or locality component. * * @return string */ public function getLocality() { return $this->locality; } /** * State, province, prefecture or region component. * * @param string $region * @return self */ public function setRegion($region) { $this->region = $region; return $this; } /** * State, province, prefecture or region component. * * @return string */ public function getRegion() { return $this->region; } /** * Zip code or postal code component. * * @param string $postal_code * @return self */ public function setPostalCode($postal_code) { $this->postal_code = $postal_code; return $this; } /** * Zip code or postal code component. * * @return string */ public function getPostalCode() { return $this->postal_code; } /** * Country name component. * * @param string $country * @return self */ public function setCountry($country) { $this->country = $country; return $this; } /** * Country name component. * * @return string */ public function getCountry() { return $this->country; } } rest-api-sdk-php/lib/PayPal/Api/BillingInfo.php 0000644 00000012400 15213403564 0015206 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class BillingInfo * * Billing information for the invoice recipient. * * @package PayPal\Api * * @property string email * @property string first_name * @property string last_name * @property string business_name * @property \PayPal\Api\InvoiceAddress address * @property string language * @property string additional_info * @property string notification_channel * @property \PayPal\Api\Phone phone */ class BillingInfo extends PayPalModel { /** * The invoice recipient email address. Maximum length is 260 characters. * * @param string $email * * @return $this */ public function setEmail($email) { $this->email = $email; return $this; } /** * The invoice recipient email address. Maximum length is 260 characters. * * @return string */ public function getEmail() { return $this->email; } /** * The invoice recipient first name. Maximum length is 30 characters. * * @param string $first_name * * @return $this */ public function setFirstName($first_name) { $this->first_name = $first_name; return $this; } /** * The invoice recipient first name. Maximum length is 30 characters. * * @return string */ public function getFirstName() { return $this->first_name; } /** * The invoice recipient last name. Maximum length is 30 characters. * * @param string $last_name * * @return $this */ public function setLastName($last_name) { $this->last_name = $last_name; return $this; } /** * The invoice recipient last name. Maximum length is 30 characters. * * @return string */ public function getLastName() { return $this->last_name; } /** * The invoice recipient company business name. Maximum length is 100 characters. * * @param string $business_name * * @return $this */ public function setBusinessName($business_name) { $this->business_name = $business_name; return $this; } /** * The invoice recipient company business name. Maximum length is 100 characters. * * @return string */ public function getBusinessName() { return $this->business_name; } /** * The invoice recipient address. * * @param \PayPal\Api\InvoiceAddress $address * * @return $this */ public function setAddress($address) { $this->address = $address; return $this; } /** * The invoice recipient address. * * @return \PayPal\Api\InvoiceAddress */ public function getAddress() { return $this->address; } /** * The language in which the email was sent to the payer. Used only when the payer does not have a PayPal account. * Valid Values: ["da_DK", "de_DE", "en_AU", "en_GB", "en_US", "es_ES", "es_XC", "fr_CA", "fr_FR", "fr_XC", "he_IL", "id_ID", "it_IT", "ja_JP", "nl_NL", "no_NO", "pl_PL", "pt_BR", "pt_PT", "ru_RU", "sv_SE", "th_TH", "tr_TR", "zh_CN", "zh_HK", "zh_TW", "zh_XC"] * * @param string $language * * @return $this */ public function setLanguage($language) { $this->language = $language; return $this; } /** * The language in which the email was sent to the payer. Used only when the payer does not have a PayPal account. * * @return string */ public function getLanguage() { return $this->language; } /** * Additional information, such as business hours. Maximum length is 40 characters. * * @param string $additional_info * * @return $this */ public function setAdditionalInfo($additional_info) { $this->additional_info = $additional_info; return $this; } /** * Additional information, such as business hours. Maximum length is 40 characters. * * @return string */ public function getAdditionalInfo() { return $this->additional_info; } /** * Preferred notification channel of the payer. Email by default. * Valid Values: ["SMS", "EMAIL"] * * @param string $notification_channel * * @return $this */ public function setNotificationChannel($notification_channel) { $this->notification_channel = $notification_channel; return $this; } /** * Preferred notification channel of the payer. Email by default. * * @return string */ public function getNotificationChannel() { return $this->notification_channel; } /** * Mobile Phone number of the recipient to which SMS will be sent if notification_channel is SMS. * * @param \PayPal\Api\Phone $phone * * @return $this */ public function setPhone($phone) { $this->phone = $phone; return $this; } /** * Mobile Phone number of the recipient to which SMS will be sent if notification_channel is SMS. * * @return \PayPal\Api\Phone */ public function getPhone() { return $this->phone; } } rest-api-sdk-php/lib/PayPal/Api/WebhookEventTypeList.php 0000644 00000002772 15213403564 0017123 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class WebhookEventTypeList * * List of webhook events. * * @package PayPal\Api * * @property \PayPal\Api\WebhookEventType[] event_types */ class WebhookEventTypeList extends PayPalModel { /** * A list of webhook events. * * @param \PayPal\Api\WebhookEventType[] $event_types * * @return $this */ public function setEventTypes($event_types) { $this->event_types = $event_types; return $this; } /** * A list of webhook events. * * @return \PayPal\Api\WebhookEventType[] */ public function getEventTypes() { return $this->event_types; } /** * Append EventTypes to the list. * * @param \PayPal\Api\WebhookEventType $webhookEventType * @return $this */ public function addEventType($webhookEventType) { if (!$this->getEventTypes()) { return $this->setEventTypes(array($webhookEventType)); } else { return $this->setEventTypes( array_merge($this->getEventTypes(), array($webhookEventType)) ); } } /** * Remove EventTypes from the list. * * @param \PayPal\Api\WebhookEventType $webhookEventType * @return $this */ public function removeEventType($webhookEventType) { return $this->setEventTypes( array_diff($this->getEventTypes(), array($webhookEventType)) ); } } rest-api-sdk-php/lib/PayPal/Api/HyperSchema.php 0000644 00000006464 15213403564 0015237 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class HyperSchema * * * * @package PayPal\Api * * @property \PayPal\Api\Links[] links * @property string fragmentResolution * @property bool readonly * @property string contentEncoding * @property string pathStart * @property string mediaType */ class HyperSchema extends PayPalModel { /** * Sets Links * * @param \PayPal\Api\Links[] $links * * @return $this */ public function setLinks($links) { $this->links = $links; return $this; } /** * Gets Links * * @return \PayPal\Api\Links[] */ public function getLinks() { return $this->links; } /** * Append Links to the list. * * @param \PayPal\Api\Links $links * @return $this */ public function addLink($links) { if (!$this->getLinks()) { return $this->setLinks(array($links)); } else { return $this->setLinks( array_merge($this->getLinks(), array($links)) ); } } /** * Remove Links from the list. * * @param \PayPal\Api\Links $links * @return $this */ public function removeLink($links) { return $this->setLinks( array_diff($this->getLinks(), array($links)) ); } /** * Sets FragmentResolution * * @param string $fragmentResolution * * @return $this */ public function setFragmentResolution($fragmentResolution) { $this->fragmentResolution = $fragmentResolution; return $this; } /** * Gets FragmentResolution * * @return string */ public function getFragmentResolution() { return $this->fragmentResolution; } /** * Sets Readonly * * @param bool $readonly * * @return $this */ public function setReadonly($readonly) { $this->readonly = $readonly; return $this; } /** * Gets Readonly * * @return bool */ public function getReadonly() { return $this->readonly; } /** * Sets ContentEncoding * * @param string $contentEncoding * * @return $this */ public function setContentEncoding($contentEncoding) { $this->contentEncoding = $contentEncoding; return $this; } /** * Gets ContentEncoding * * @return string */ public function getContentEncoding() { return $this->contentEncoding; } /** * Sets PathStart * * @param string $pathStart * * @return $this */ public function setPathStart($pathStart) { $this->pathStart = $pathStart; return $this; } /** * Gets PathStart * * @return string */ public function getPathStart() { return $this->pathStart; } /** * Sets MediaType * * @param string $mediaType * * @return $this */ public function setMediaType($mediaType) { $this->mediaType = $mediaType; return $this; } /** * Gets MediaType * * @return string */ public function getMediaType() { return $this->mediaType; } } rest-api-sdk-php/lib/PayPal/Api/WebhookEventList.php 0000644 00000005755 15213403564 0016265 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class WebhookEventList * * List of webhooks events. * * @package PayPal\Api * * @property \PayPal\Api\WebhookEvent[] events * @property int count * @property \PayPal\Api\Links[] links */ class WebhookEventList extends PayPalModel { /** * A list of webhooks events. * * @param \PayPal\Api\WebhookEvent[] $events * * @return $this */ public function setEvents($events) { $this->events = $events; return $this; } /** * A list of webhooks events. * * @return \PayPal\Api\WebhookEvent[] */ public function getEvents() { return $this->events; } /** * Append Events to the list. * * @param \PayPal\Api\WebhookEvent $webhookEvent * @return $this */ public function addEvent($webhookEvent) { if (!$this->getEvents()) { return $this->setEvents(array($webhookEvent)); } else { return $this->setEvents( array_merge($this->getEvents(), array($webhookEvent)) ); } } /** * Remove Events from the list. * * @param \PayPal\Api\WebhookEvent $webhookEvent * @return $this */ public function removeEvent($webhookEvent) { return $this->setEvents( array_diff($this->getEvents(), array($webhookEvent)) ); } /** * The number of items in each range of results. Note that the response might have fewer items than the requested `page_size` value. * * @param int $count * * @return $this */ public function setCount($count) { $this->count = $count; return $this; } /** * The number of items in each range of results. Note that the response might have fewer items than the requested `page_size` value. * * @return int */ public function getCount() { return $this->count; } /** * Sets Links * * @param \PayPal\Api\Links[] $links * * @return $this */ public function setLinks($links) { $this->links = $links; return $this; } /** * Gets Links * * @return \PayPal\Api\Links[] */ public function getLinks() { return $this->links; } /** * Append Links to the list. * * @param \PayPal\Api\Links $links * @return $this */ public function addLink($links) { if (!$this->getLinks()) { return $this->setLinks(array($links)); } else { return $this->setLinks( array_merge($this->getLinks(), array($links)) ); } } /** * Remove Links from the list. * * @param \PayPal\Api\Links $links * @return $this */ public function removeLink($links) { return $this->setLinks( array_diff($this->getLinks(), array($links)) ); } } rest-api-sdk-php/lib/PayPal/Api/Details.php 0000644 00000013272 15213403564 0014407 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; use PayPal\Converter\FormatConverter; use PayPal\Validation\NumericValidator; /** * Class Details * * Additional details of the payment amount. * * @package PayPal\Api * * @property string subtotal * @property string shipping * @property string tax * @property string handling_fee * @property string shipping_discount * @property string insurance * @property string gift_wrap * @property string fee */ class Details extends PayPalModel { /** * Amount of the subtotal of the items. **Required** if line items are specified. 10 characters max, with support for 2 decimal places. * * @param string|double $subtotal * * @return $this */ public function setSubtotal($subtotal) { NumericValidator::validate($subtotal, "Subtotal"); $subtotal = FormatConverter::formatToPrice($subtotal); $this->subtotal = $subtotal; return $this; } /** * Amount of the subtotal of the items. **Required** if line items are specified. 10 characters max, with support for 2 decimal places. * * @return string */ public function getSubtotal() { return $this->subtotal; } /** * Amount charged for shipping. 10 characters max with support for 2 decimal places. * * @param string|double $shipping * * @return $this */ public function setShipping($shipping) { NumericValidator::validate($shipping, "Shipping"); $shipping = FormatConverter::formatToPrice($shipping); $this->shipping = $shipping; return $this; } /** * Amount charged for shipping. 10 characters max with support for 2 decimal places. * * @return string */ public function getShipping() { return $this->shipping; } /** * Amount charged for tax. 10 characters max with support for 2 decimal places. * * @param string|double $tax * * @return $this */ public function setTax($tax) { NumericValidator::validate($tax, "Tax"); $tax = FormatConverter::formatToPrice($tax); $this->tax = $tax; return $this; } /** * Amount charged for tax. 10 characters max with support for 2 decimal places. * * @return string */ public function getTax() { return $this->tax; } /** * Amount being charged for the handling fee. Only supported when the `payment_method` is set to `paypal`. * * @param string|double $handling_fee * * @return $this */ public function setHandlingFee($handling_fee) { NumericValidator::validate($handling_fee, "Handling Fee"); $handling_fee = FormatConverter::formatToPrice($handling_fee); $this->handling_fee = $handling_fee; return $this; } /** * Amount being charged for the handling fee. Only supported when the `payment_method` is set to `paypal`. * * @return string */ public function getHandlingFee() { return $this->handling_fee; } /** * Amount being discounted for the shipping fee. Only supported when the `payment_method` is set to `paypal`. * * @param string|double $shipping_discount * * @return $this */ public function setShippingDiscount($shipping_discount) { NumericValidator::validate($shipping_discount, "Shipping Discount"); $shipping_discount = FormatConverter::formatToPrice($shipping_discount); $this->shipping_discount = $shipping_discount; return $this; } /** * Amount being discounted for the shipping fee. Only supported when the `payment_method` is set to `paypal`. * * @return string */ public function getShippingDiscount() { return $this->shipping_discount; } /** * Amount being charged for the insurance fee. Only supported when the `payment_method` is set to `paypal`. * * @param string|double $insurance * * @return $this */ public function setInsurance($insurance) { NumericValidator::validate($insurance, "Insurance"); $insurance = FormatConverter::formatToPrice($insurance); $this->insurance = $insurance; return $this; } /** * Amount being charged for the insurance fee. Only supported when the `payment_method` is set to `paypal`. * * @return string */ public function getInsurance() { return $this->insurance; } /** * Amount being charged as gift wrap fee. * * @param string|double $gift_wrap * * @return $this */ public function setGiftWrap($gift_wrap) { NumericValidator::validate($gift_wrap, "Gift Wrap"); $gift_wrap = FormatConverter::formatToPrice($gift_wrap); $this->gift_wrap = $gift_wrap; return $this; } /** * Amount being charged as gift wrap fee. * * @return string */ public function getGiftWrap() { return $this->gift_wrap; } /** * Fee charged by PayPal. In case of a refund, this is the fee amount refunded to the original receipient of the payment. * * @param string|double $fee * * @return $this */ public function setFee($fee) { NumericValidator::validate($fee, "Fee"); $fee = FormatConverter::formatToPrice($fee); $this->fee = $fee; return $this; } /** * Fee charged by PayPal. In case of a refund, this is the fee amount refunded to the original receipient of the payment. * * @return string */ public function getFee() { return $this->fee; } } rest-api-sdk-php/lib/PayPal/Api/RefundDetail.php 0000644 00000006255 15213403564 0015373 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class RefundDetail * * Invoicing refund information. * * @package PayPal\Api * * @property string type * @property string transaction_id * @property string date * @property string note * @property \PayPal\Api\Currency amount */ class RefundDetail extends PayPalModel { /** * The PayPal refund type. Indicates whether refund was paid in invoicing flow through PayPal or externally. In the case of mark-as-refunded API, the supported refund type is `EXTERNAL`. For backward compatability, the `PAYPAL` refund type is still supported. * Valid Values: ["PAYPAL", "EXTERNAL"] * * @param string $type * * @return $this */ public function setType($type) { $this->type = $type; return $this; } /** * The PayPal refund type. Indicates whether refund was paid in invoicing flow through PayPal or externally. In the case of mark-as-refunded API, the supported refund type is `EXTERNAL`. For backward compatability, the `PAYPAL` refund type is still supported. * * @return string */ public function getType() { return $this->type; } /** * The PayPal refund transaction ID. Required with the `PAYPAL` refund type. * * @param string $transaction_id * * @return $this */ public function setTransactionId($transaction_id) { $this->transaction_id = $transaction_id; return $this; } /** * The PayPal refund transaction ID. Required with the `PAYPAL` refund type. * * @return string */ public function getTransactionId() { return $this->transaction_id; } /** * Date on which the invoice was refunded. Date format: yyyy-MM-dd z. For example, 2014-02-27 PST. * * @param string $date * * @return $this */ public function setDate($date) { $this->date = $date; return $this; } /** * Date on which the invoice was refunded. Date format: yyyy-MM-dd z. For example, 2014-02-27 PST. * * @return string */ public function getDate() { return $this->date; } /** * Optional note associated with the refund. * * @param string $note * * @return $this */ public function setNote($note) { $this->note = $note; return $this; } /** * Optional note associated with the refund. * * @return string */ public function getNote() { return $this->note; } /** * Amount to be recorded as refund against invoice. If this field is not passed, the total invoice paid amount is recorded as refund. * * @param \PayPal\Api\Currency $amount * * @return $this */ public function setAmount($amount) { $this->amount = $amount; return $this; } /** * Amount to be recorded as refund against invoice. If this field is not passed, the total invoice paid amount is recorded as refund. * * @return \PayPal\Api\Currency */ public function getAmount() { return $this->amount; } } rest-api-sdk-php/lib/PayPal/Api/VerifyWebhookSignatureResponse.php 0000644 00000001572 15213403564 0021206 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class VerifyWebhookSignatureResponse * * The verify webhook signature response. * * @package PayPal\Api * * @property string verification_status */ class VerifyWebhookSignatureResponse extends PayPalModel { /** * The status of the signature verification. Value is `SUCCESS` or `FAILURE`. * Valid Values: ["SUCCESS", "FAILURE"] * * @param string $verification_status * * @return $this */ public function setVerificationStatus($verification_status) { $this->verification_status = $verification_status; return $this; } /** * The status of the signature verification. Value is `SUCCESS` or `FAILURE`. * * @return string */ public function getVerificationStatus() { return $this->verification_status; } } rest-api-sdk-php/lib/PayPal/Api/VerifyWebhookSignature.php 0000644 00000016212 15213403564 0017464 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalResourceModel; use PayPal\Validation\ArgumentValidator; use PayPal\Api\VerifyWebhookSignatureResponse; use PayPal\Rest\ApiContext; use PayPal\Validation\UrlValidator; /** * Class VerifyWebhookSignature * * Verify webhook signature. * * @package PayPal\Api * * @property string auth_algo * @property string cert_url * @property string transmission_id * @property string transmission_sig * @property string transmission_time * @property string webhook_id * @property \PayPal\Api\WebhookEvent webhook_event */ class VerifyWebhookSignature extends PayPalResourceModel { /** * The algorithm that PayPal uses to generate the signature and that you can use to verify the signature. Extract this value from the `PAYPAL-AUTH-ALGO` response header, which is received with the webhook notification. * * @param string $auth_algo * * @return $this */ public function setAuthAlgo($auth_algo) { $this->auth_algo = $auth_algo; return $this; } /** * The algorithm that PayPal uses to generate the signature and that you can use to verify the signature. Extract this value from the `PAYPAL-AUTH-ALGO` response header, which is received with the webhook notification. * * @return string */ public function getAuthAlgo() { return $this->auth_algo; } /** * The X.509 public key certificate. Download the certificate from this URL and use it to verify the signature. Extract this value from the `PAYPAL-CERT-URL` response header, which is received with the webhook notification. * * @param string $cert_url * @throws \InvalidArgumentException * @return $this */ public function setCertUrl($cert_url) { UrlValidator::validate($cert_url, "CertUrl"); $this->cert_url = $cert_url; return $this; } /** * The X.509 public key certificate. Download the certificate from this URL and use it to verify the signature. Extract this value from the `PAYPAL-CERT-URL` response header, which is received with the webhook notification. * * @return string */ public function getCertUrl() { return $this->cert_url; } /** * The ID of the HTTP transmission. Contained in the `PAYPAL-TRANSMISSION-ID` header of the notification message. * * @param string $transmission_id * * @return $this */ public function setTransmissionId($transmission_id) { $this->transmission_id = $transmission_id; return $this; } /** * The ID of the HTTP transmission. Contained in the `PAYPAL-TRANSMISSION-ID` header of the notification message. * * @return string */ public function getTransmissionId() { return $this->transmission_id; } /** * The PayPal-generated asymmetric signature. Extract this value from the `PAYPAL-TRANSMISSION-SIG` response header, which is received with the webhook notification. * * @param string $transmission_sig * * @return $this */ public function setTransmissionSig($transmission_sig) { $this->transmission_sig = $transmission_sig; return $this; } /** * The PayPal-generated asymmetric signature. Extract this value from the `PAYPAL-TRANSMISSION-SIG` response header, which is received with the webhook notification. * * @return string */ public function getTransmissionSig() { return $this->transmission_sig; } /** * The date and time of the HTTP transmission. Contained in the `PAYPAL-TRANSMISSION-TIME` header of the notification message. * * @param string $transmission_time * * @return $this */ public function setTransmissionTime($transmission_time) { $this->transmission_time = $transmission_time; return $this; } /** * The date and time of the HTTP transmission. Contained in the `PAYPAL-TRANSMISSION-TIME` header of the notification message. * * @return string */ public function getTransmissionTime() { return $this->transmission_time; } /** * The ID of the webhook as configured in your Developer Portal account. * * @param string $webhook_id * * @return $this */ public function setWebhookId($webhook_id) { $this->webhook_id = $webhook_id; return $this; } /** * The ID of the webhook as configured in your Developer Portal account. * * @return string */ public function getWebhookId() { return $this->webhook_id; } /** * The webhook notification, which is the content of the HTTP `POST` request body. * @deprecated Please use setRequestBody($request_body) instead. * @param \PayPal\Api\WebhookEvent $webhook_event * * @return $this */ public function setWebhookEvent($webhook_event) { $this->webhook_event = $webhook_event; return $this; } /** * The webhook notification, which is the content of the HTTP `POST` request body. * * @return \PayPal\Api\WebhookEvent */ public function getWebhookEvent() { return $this->webhook_event; } /** * The content of the HTTP `POST` request body of the webhook notification you received as a string. * * @param string $request_body * * @return $this */ public function setRequestBody($request_body) { $this->request_body = $request_body; return $this; } /** * The content of the HTTP `POST` request body of the webhook notification you received as a string. * * @return string */ public function getRequestBody() { return $this->request_body; } /** * Verifies a webhook signature. * * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return VerifyWebhookSignatureResponse */ public function post($apiContext = null, $restCall = null) { $payLoad = $this->toJSON(); $json = self::executeCall( "/v1/notifications/verify-webhook-signature", "POST", $payLoad, null, $apiContext, $restCall ); $ret = new VerifyWebhookSignatureResponse(); $ret->fromJson($json); return $ret; } public function toJSON($options = 0) { if (!is_null($this->request_body)) { $valuesToEncode = $this->toArray(); unset($valuesToEncode['webhook_event']); unset($valuesToEncode['request_body']); $payLoad = "{"; foreach ($valuesToEncode as $field => $value) { $payLoad .= "\"$field\": \"$value\","; } $payLoad .= "\"webhook_event\": $this->request_body"; $payLoad .= "}"; return $payLoad; } else { $payLoad = parent::toJSON($options); return $payLoad; } } } rest-api-sdk-php/lib/PayPal/Api/TemplateSettings.php 0000644 00000002602 15213403564 0016311 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class TemplateSettings * * Settings per template * * @package PayPal\Api * * @property string field_name * @property \PayPal\Api\TemplateSettingsMetadata display_preference */ class TemplateSettings extends PayPalModel { /** * The field name (for any field in template_data) for which the corresponding display preferences will be mapped to. * * @param string $field_name * * @return $this */ public function setFieldName($field_name) { $this->field_name = $field_name; return $this; } /** * The field name (for any field in template_data) for which the corresponding display preferences will be mapped to. * * @return string */ public function getFieldName() { return $this->field_name; } /** * Settings metadata for each field. * * @param \PayPal\Api\TemplateSettingsMetadata $display_preference * * @return $this */ public function setDisplayPreference($display_preference) { $this->display_preference = $display_preference; return $this; } /** * Settings metadata for each field. * * @return \PayPal\Api\TemplateSettingsMetadata */ public function getDisplayPreference() { return $this->display_preference; } } rest-api-sdk-php/lib/PayPal/Api/Templates.php 0000644 00000015443 15213403564 0014762 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalResourceModel; use PayPal\Transport\PayPalRestCall; use PayPal\Validation\ArgumentValidator; use PayPal\Api\Template; use PayPal\Rest\ApiContext; /** * Class Templates * * List of templates belonging to merchant. * * @package PayPal\Api * * @property \PayPal\Api\Address[] addresses * @property string[] emails * @property \PayPal\Api\Phone[] phones * @property \PayPal\Api\Template[] templates * @property \PayPal\Api\Links[] links */ class Templates extends PayPalResourceModel { /** * List of addresses in merchant's profile. * * @param \PayPal\Api\Address[] $addresses * * @return $this */ public function setAddresses($addresses) { $this->addresses = $addresses; return $this; } /** * List of addresses in merchant's profile. * * @return \PayPal\Api\Address[] */ public function getAddresses() { return $this->addresses; } /** * Append Addresses to the list. * * @param \PayPal\Api\Address $address * @return $this */ public function addAddress($address) { if (!$this->getAddresses()) { return $this->setAddresses(array($address)); } else { return $this->setAddresses( array_merge($this->getAddresses(), array($address)) ); } } /** * Remove Addresses from the list. * * @param \PayPal\Api\Address $address * @return $this */ public function removeAddress($address) { return $this->setAddresses( array_diff($this->getAddresses(), array($address)) ); } /** * List of emails in merchant's profile. * * @param string[] $emails * * @return $this */ public function setEmails($emails) { $this->emails = $emails; return $this; } /** * List of emails in merchant's profile. * * @return string[] */ public function getEmails() { return $this->emails; } /** * Append Emails to the list. * * @param string $string * @return $this */ public function addEmail($string) { if (!$this->getEmails()) { return $this->setEmails(array($string)); } else { return $this->setEmails( array_merge($this->getEmails(), array($string)) ); } } /** * Remove Emails from the list. * * @param string $string * @return $this */ public function removeEmail($string) { return $this->setEmails( array_diff($this->getEmails(), array($string)) ); } /** * List of phone numbers in merchant's profile. * * @param \PayPal\Api\Phone[] $phones * * @return $this */ public function setPhones($phones) { $this->phones = $phones; return $this; } /** * List of phone numbers in merchant's profile. * * @return \PayPal\Api\Phone[] */ public function getPhones() { return $this->phones; } /** * Append Phones to the list. * * @param \PayPal\Api\Phone $phone * @return $this */ public function addPhone($phone) { if (!$this->getPhones()) { return $this->setPhones(array($phone)); } else { return $this->setPhones( array_merge($this->getPhones(), array($phone)) ); } } /** * Remove Phones from the list. * * @param \PayPal\Api\Phone $phone * @return $this */ public function removePhone($phone) { return $this->setPhones( array_diff($this->getPhones(), array($phone)) ); } /** * Array of templates. * * @param \PayPal\Api\Template[] $templates * * @return $this */ public function setTemplates($templates) { $this->templates = $templates; return $this; } /** * Array of templates. * * @return \PayPal\Api\Template[] */ public function getTemplates() { return $this->templates; } /** * Append Templates to the list. * * @param \PayPal\Api\Template $template * @return $this */ public function addTemplate($template) { if (!$this->getTemplates()) { return $this->setTemplates(array($template)); } else { return $this->setTemplates( array_merge($this->getTemplates(), array($template)) ); } } /** * Remove Templates from the list. * * @param \PayPal\Api\Template $template * @return $this */ public function removeTemplate($template) { return $this->setTemplates( array_diff($this->getTemplates(), array($template)) ); } /** * Retrieve the details for a particular template by passing the template ID to the request URI. * * @deprecated Please use `Template::get()` instead. * @see Template::get * @param string $templateId * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return Template */ public static function get($templateId, $apiContext = null, $restCall = null) { ArgumentValidator::validate($templateId, 'templateId'); $payLoad = ""; $json = self::executeCall( "/v1/invoicing/templates/$templateId", "GET", $payLoad, null, $apiContext, $restCall ); $ret = new Template(); $ret->fromJson($json); return $ret; } /** * Retrieves the template information of the merchant. * * @param array $params * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return Templates */ public static function getAll($params = array(), $apiContext = null, $restCall = null) { ArgumentValidator::validate($params, 'params'); $payLoad = ""; $allowedParams = array( 'fields' => 1, ); $json = self::executeCall( "/v1/invoicing/templates/" . "?" . http_build_query(array_intersect_key($params, $allowedParams)), "GET", $payLoad, null, $apiContext, $restCall ); $ret = new Templates(); $ret->fromJson($json); return $ret; } } rest-api-sdk-php/lib/PayPal/Api/CountryCode.php 0000644 00000001656 15213403564 0015263 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class CountryCode * * The ISO 3166-1 alpha-2 country code. A complete list of valid codes is available at Wikipedia: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 In particular, note that the country code for Great Britain is GB, not UK as used in that country's top-level domain names. * * @package PayPal\Api * * @property string country_code */ class CountryCode extends PayPalModel { /** * ISO country code based on 2-character IS0-3166-1 codes. * * @param string $country_code * * @return $this */ public function setCountryCode($country_code) { $this->country_code = $country_code; return $this; } /** * ISO country code based on 2-character IS0-3166-1 codes. * * @return string */ public function getCountryCode() { return $this->country_code; } } rest-api-sdk-php/lib/PayPal/Api/Error.php 0000644 00000015511 15213403564 0014111 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class Error * * Details of an Error * * @package PayPal\Api * * @property string name * @property string message * @property \PayPal\Api\ErrorDetails[] details * @property string information_link * @property string debug_id * @property \PayPal\Api\Links[] links */ class Error extends PayPalModel { /** * Human readable, unique name of the error. * * @param string $name * * @return $this */ public function setName($name) { $this->name = $name; return $this; } /** * Human readable, unique name of the error. * * @return string */ public function getName() { return $this->name; } /** * Reference ID of the purchase_unit associated with this error * * @deprecated Not publicly available * @param string $purchase_unit_reference_id * * @return $this */ public function setPurchaseUnitReferenceId($purchase_unit_reference_id) { $this->purchase_unit_reference_id = $purchase_unit_reference_id; return $this; } /** * Reference ID of the purchase_unit associated with this error * * @deprecated Not publicly available * @return string */ public function getPurchaseUnitReferenceId() { return $this->purchase_unit_reference_id; } /** * PayPal internal error code. * * @deprecated Not publicly available * @param string $code * * @return $this */ public function setCode($code) { $this->code = $code; return $this; } /** * PayPal internal error code. * * @deprecated Not publicly available * @return string */ public function getCode() { return $this->code; } /** * PayPal internal identifier used for correlation purposes. * * @param string $debug_id * * @return $this */ public function setDebugId($debug_id) { $this->debug_id = $debug_id; return $this; } /** * PayPal internal identifier used for correlation purposes. * * @return string */ public function getDebugId() { return $this->debug_id; } /** * Message describing the error. * * @param string $message * * @return $this */ public function setMessage($message) { $this->message = $message; return $this; } /** * Message describing the error. * * @return string */ public function getMessage() { return $this->message; } /** * URI for detailed information related to this error for the developer. * * @param string $information_link * * @return $this */ public function setInformationLink($information_link) { $this->information_link = $information_link; return $this; } /** * URI for detailed information related to this error for the developer. * * @return string */ public function getInformationLink() { return $this->information_link; } /** * Additional details of the error * * @param \PayPal\Api\ErrorDetails[] $details * * @return $this */ public function setDetails($details) { $this->details = $details; return $this; } /** * Additional details of the error * * @return \PayPal\Api\ErrorDetails[] */ public function getDetails() { return $this->details; } /** * Append Details to the list. * * @param \PayPal\Api\ErrorDetails $errorDetails * @return $this */ public function addDetail($errorDetails) { if (!$this->getDetails()) { return $this->setDetails(array($errorDetails)); } else { return $this->setDetails( array_merge($this->getDetails(), array($errorDetails)) ); } } /** * Remove Details from the list. * * @param \PayPal\Api\ErrorDetails $errorDetails * @return $this */ public function removeDetail($errorDetails) { return $this->setDetails( array_diff($this->getDetails(), array($errorDetails)) ); } /** * response codes returned from a payment processor such as avs, cvv, etc. Only supported when the `payment_method` is set to `credit_card`. * * @deprecated Not publicly available * @param \PayPal\Api\ProcessorResponse $processor_response * * @return $this */ public function setProcessorResponse($processor_response) { $this->processor_response = $processor_response; return $this; } /** * response codes returned from a payment processor such as avs, cvv, etc. Only supported when the `payment_method` is set to `credit_card`. * * @deprecated Not publicly available * @return \PayPal\Api\ProcessorResponse */ public function getProcessorResponse() { return $this->processor_response; } /** * Fraud filter details. Only supported when the `payment_method` is set to `credit_card` * * @deprecated Not publicly available * @param \PayPal\Api\FmfDetails $fmf_details * * @return $this */ public function setFmfDetails($fmf_details) { $this->fmf_details = $fmf_details; return $this; } /** * Fraud filter details. Only supported when the `payment_method` is set to `credit_card` * * @deprecated Not publicly available * @return \PayPal\Api\FmfDetails */ public function getFmfDetails() { return $this->fmf_details; } /** * Sets Links * * @param \PayPal\Api\Links[] $links * * @return $this */ public function setLinks($links) { $this->links = $links; return $this; } /** * Gets Links * * @return \PayPal\Api\Links[] */ public function getLinks() { return $this->links; } /** * Append Links to the list. * * @param \PayPal\Api\Links $links * @return $this */ public function addLink($links) { if (!$this->getLinks()) { return $this->setLinks(array($links)); } else { return $this->setLinks( array_merge($this->getLinks(), array($links)) ); } } /** * Remove Links from the list. * * @param \PayPal\Api\Links $links * @return $this */ public function removeLink($links) { return $this->setLinks( array_diff($this->getLinks(), array($links)) ); } } rest-api-sdk-php/lib/PayPal/Api/Amount.php 0000644 00000004372 15213403564 0014266 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; use PayPal\Converter\FormatConverter; use PayPal\Validation\NumericValidator; /** * Class Amount * * payment amount with break-ups. * * @package PayPal\Api * * @property string currency * @property string total * @property \PayPal\Api\Details details */ class Amount extends PayPalModel { /** * 3-letter [currency code](https://developer.paypal.com/docs/integration/direct/rest_api_payment_country_currency_support/). PayPal does not support all currencies. * * @param string $currency * * @return $this */ public function setCurrency($currency) { $this->currency = $currency; return $this; } /** * 3-letter [currency code](https://developer.paypal.com/docs/integration/direct/rest_api_payment_country_currency_support/). PayPal does not support all currencies. * * @return string */ public function getCurrency() { return $this->currency; } /** * Total amount charged from the payer to the payee. In case of a refund, this is the refunded amount to the original payer from the payee. 10 characters max with support for 2 decimal places. * * @param string|double $total * * @return $this */ public function setTotal($total) { NumericValidator::validate($total, "Total"); $total = FormatConverter::formatToPrice($total, $this->getCurrency()); $this->total = $total; return $this; } /** * Total amount charged from the payer to the payee. In case of a refund, this is the refunded amount to the original payer from the payee. 10 characters max with support for 2 decimal places. * * @return string */ public function getTotal() { return $this->total; } /** * Additional details of the payment amount. * * @param \PayPal\Api\Details $details * * @return $this */ public function setDetails($details) { $this->details = $details; return $this; } /** * Additional details of the payment amount. * * @return \PayPal\Api\Details */ public function getDetails() { return $this->details; } } rest-api-sdk-php/lib/PayPal/Api/FundingInstrument.php 0000644 00000017071 15213403564 0016506 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class FundingInstrument * * A resource representing a Payer's funding instrument. An instance of this schema is valid if and only if it is valid against exactly one of these supported properties * * @package PayPal\Api * * @property \PayPal\Api\CreditCard credit_card * @property \PayPal\Api\CreditCardToken credit_card_token * @property \PayPal\Api\Billing billing */ class FundingInstrument extends PayPalModel { /** * Credit Card instrument. * * @param \PayPal\Api\CreditCard $credit_card * * @return $this */ public function setCreditCard($credit_card) { $this->credit_card = $credit_card; return $this; } /** * Credit Card instrument. * * @return \PayPal\Api\CreditCard */ public function getCreditCard() { return $this->credit_card; } /** * PayPal vaulted credit Card instrument. * * @param \PayPal\Api\CreditCardToken $credit_card_token * * @return $this */ public function setCreditCardToken($credit_card_token) { $this->credit_card_token = $credit_card_token; return $this; } /** * PayPal vaulted credit Card instrument. * * @return \PayPal\Api\CreditCardToken */ public function getCreditCardToken() { return $this->credit_card_token; } /** * Payment Card information. * * @param \PayPal\Api\PaymentCard $payment_card * * @return $this */ public function setPaymentCard($payment_card) { $this->payment_card = $payment_card; return $this; } /** * Payment Card information. * * @return \PayPal\Api\PaymentCard */ public function getPaymentCard() { return $this->payment_card; } /** * Bank Account information. * @deprecated Not publicly available * @param \PayPal\Api\ExtendedBankAccount $bank_account * * @return $this */ public function setBankAccount($bank_account) { $this->bank_account = $bank_account; return $this; } /** * Bank Account information. * @deprecated Not publicly available * @return \PayPal\Api\ExtendedBankAccount */ public function getBankAccount() { return $this->bank_account; } /** * Vaulted bank account instrument. * @deprecated Not publicly available * @param \PayPal\Api\BankToken $bank_account_token * * @return $this */ public function setBankAccountToken($bank_account_token) { $this->bank_account_token = $bank_account_token; return $this; } /** * Vaulted bank account instrument. * @deprecated Not publicly available * @return \PayPal\Api\BankToken */ public function getBankAccountToken() { return $this->bank_account_token; } /** * PayPal credit funding instrument. * @deprecated Not publicly available * @param \PayPal\Api\Credit $credit * * @return $this */ public function setCredit($credit) { $this->credit = $credit; return $this; } /** * PayPal credit funding instrument. * @deprecated Not publicly available * @return \PayPal\Api\Credit */ public function getCredit() { return $this->credit; } /** * Incentive funding instrument. * @deprecated Not publicly available * @param \PayPal\Api\Incentive $incentive * * @return $this */ public function setIncentive($incentive) { $this->incentive = $incentive; return $this; } /** * Incentive funding instrument. * @deprecated Not publicly available * @return \PayPal\Api\Incentive */ public function getIncentive() { return $this->incentive; } /** * External funding instrument. * @deprecated Not publicly available * @param \PayPal\Api\ExternalFunding $external_funding * * @return $this */ public function setExternalFunding($external_funding) { $this->external_funding = $external_funding; return $this; } /** * External funding instrument. * @deprecated Not publicly available * @return \PayPal\Api\ExternalFunding */ public function getExternalFunding() { return $this->external_funding; } /** * Carrier account token instrument. * @deprecated Not publicly available * @param \PayPal\Api\CarrierAccountToken $carrier_account_token * * @return $this */ public function setCarrierAccountToken($carrier_account_token) { $this->carrier_account_token = $carrier_account_token; return $this; } /** * Carrier account token instrument. * @deprecated Not publicly available * @return \PayPal\Api\CarrierAccountToken */ public function getCarrierAccountToken() { return $this->carrier_account_token; } /** * Carrier account instrument * @deprecated Not publicly available * @param \PayPal\Api\CarrierAccount $carrier_account * * @return $this */ public function setCarrierAccount($carrier_account) { $this->carrier_account = $carrier_account; return $this; } /** * Carrier account instrument * @deprecated Not publicly available * @return \PayPal\Api\CarrierAccount */ public function getCarrierAccount() { return $this->carrier_account; } /** * Private Label Card funding instrument. These are store cards provided by merchants to drive business with value to customer with convenience and rewards. * @deprecated Not publicly available * @param \PayPal\Api\PrivateLabelCard $private_label_card * * @return $this */ public function setPrivateLabelCard($private_label_card) { $this->private_label_card = $private_label_card; return $this; } /** * Private Label Card funding instrument. These are store cards provided by merchants to drive business with value to customer with convenience and rewards. * @deprecated Not publicly available * @return \PayPal\Api\PrivateLabelCard */ public function getPrivateLabelCard() { return $this->private_label_card; } /** * Billing instrument that references pre-approval information for the payment * * @param \PayPal\Api\Billing $billing * * @return $this */ public function setBilling($billing) { $this->billing = $billing; return $this; } /** * Billing instrument that references pre-approval information for the payment * * @return \PayPal\Api\Billing */ public function getBilling() { return $this->billing; } /** * Alternate Payment information - Mostly regional payment providers. For e.g iDEAL in Netherlands * * @deprecated Not publicly available * @param \PayPal\Api\AlternatePayment $alternate_payment * * @return $this */ public function setAlternatePayment($alternate_payment) { $this->alternate_payment = $alternate_payment; return $this; } /** * Alternate Payment information - Mostly regional payment providers. For e.g iDEAL in Netherlands * * @deprecated Not publicly available * @return \PayPal\Api\AlternatePayment */ public function getAlternatePayment() { return $this->alternate_payment; } } rest-api-sdk-php/lib/PayPal/Api/FundingOption.php 0000644 00000011606 15213403564 0015604 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class FundingOption * * specifies the funding option details. * * @package PayPal\Api * * @property string id * @property \PayPal\Api\FundingSource[] funding_sources * @property \PayPal\Api\FundingInstrument backup_funding_instrument * @property \PayPal\Api\CurrencyConversion currency_conversion * @property \PayPal\Api\InstallmentInfo installment_info * @property \PayPal\Api\Links[] links */ class FundingOption extends PayPalModel { /** * id of the funding option. * * @param string $id * * @return $this */ public function setId($id) { $this->id = $id; return $this; } /** * id of the funding option. * * @return string */ public function getId() { return $this->id; } /** * List of funding sources that contributes to a payment. * * @param \PayPal\Api\FundingSource[] $funding_sources * * @return $this */ public function setFundingSources($funding_sources) { $this->funding_sources = $funding_sources; return $this; } /** * List of funding sources that contributes to a payment. * * @return \PayPal\Api\FundingSource[] */ public function getFundingSources() { return $this->funding_sources; } /** * Append FundingSources to the list. * * @param \PayPal\Api\FundingSource $fundingSource * @return $this */ public function addFundingSource($fundingSource) { if (!$this->getFundingSources()) { return $this->setFundingSources(array($fundingSource)); } else { return $this->setFundingSources( array_merge($this->getFundingSources(), array($fundingSource)) ); } } /** * Remove FundingSources from the list. * * @param \PayPal\Api\FundingSource $fundingSource * @return $this */ public function removeFundingSource($fundingSource) { return $this->setFundingSources( array_diff($this->getFundingSources(), array($fundingSource)) ); } /** * Backup funding instrument which will be used for payment if primary fails. * * @param \PayPal\Api\FundingInstrument $backup_funding_instrument * * @return $this */ public function setBackupFundingInstrument($backup_funding_instrument) { $this->backup_funding_instrument = $backup_funding_instrument; return $this; } /** * Backup funding instrument which will be used for payment if primary fails. * * @return \PayPal\Api\FundingInstrument */ public function getBackupFundingInstrument() { return $this->backup_funding_instrument; } /** * Currency conversion applicable to this funding option. * * @param \PayPal\Api\CurrencyConversion $currency_conversion * * @return $this */ public function setCurrencyConversion($currency_conversion) { $this->currency_conversion = $currency_conversion; return $this; } /** * Currency conversion applicable to this funding option. * * @return \PayPal\Api\CurrencyConversion */ public function getCurrencyConversion() { return $this->currency_conversion; } /** * Installment options available for a funding option. * * @param \PayPal\Api\InstallmentInfo $installment_info * * @return $this */ public function setInstallmentInfo($installment_info) { $this->installment_info = $installment_info; return $this; } /** * Installment options available for a funding option. * * @return \PayPal\Api\InstallmentInfo */ public function getInstallmentInfo() { return $this->installment_info; } /** * Sets Links * * @param \PayPal\Api\Links[] $links * * @return $this */ public function setLinks($links) { $this->links = $links; return $this; } /** * Gets Links * * @return \PayPal\Api\Links[] */ public function getLinks() { return $this->links; } /** * Append Links to the list. * * @param \PayPal\Api\Links $links * @return $this */ public function addLink($links) { if (!$this->getLinks()) { return $this->setLinks(array($links)); } else { return $this->setLinks( array_merge($this->getLinks(), array($links)) ); } } /** * Remove Links from the list. * * @param \PayPal\Api\Links $links * @return $this */ public function removeLink($links) { return $this->setLinks( array_diff($this->getLinks(), array($links)) ); } } rest-api-sdk-php/lib/PayPal/Api/PaymentOptions.php 0000644 00000004323 15213403564 0016010 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class PaymentOptions * * Payment options requested for this purchase unit * * @package PayPal\Api * * @property string allowed_payment_method */ class PaymentOptions extends PayPalModel { /** * Payment method requested for this purchase unit * Valid Values: ["UNRESTRICTED", "INSTANT_FUNDING_SOURCE", "IMMEDIATE_PAY"] * * @param string $allowed_payment_method * * @return $this */ public function setAllowedPaymentMethod($allowed_payment_method) { $this->allowed_payment_method = $allowed_payment_method; return $this; } /** * Payment method requested for this purchase unit * * @return string */ public function getAllowedPaymentMethod() { return $this->allowed_payment_method; } /** * Indicator if this payment request is a recurring payment. Only supported when the `payment_method` is set to `credit_card` * @deprecated Not publicly available * @param bool $recurring_flag * * @return $this */ public function setRecurringFlag($recurring_flag) { $this->recurring_flag = $recurring_flag; return $this; } /** * Indicator if this payment request is a recurring payment. Only supported when the `payment_method` is set to `credit_card` * @deprecated Not publicly available * @return bool */ public function getRecurringFlag() { return $this->recurring_flag; } /** * Indicator if fraud management filters (fmf) should be skipped for this transaction. Only supported when the `payment_method` is set to `credit_card` * @deprecated Not publicly available * @param bool $skip_fmf * * @return $this */ public function setSkipFmf($skip_fmf) { $this->skip_fmf = $skip_fmf; return $this; } /** * Indicator if fraud management filters (fmf) should be skipped for this transaction. Only supported when the `payment_method` is set to `credit_card` * @deprecated Not publicly available * @return bool */ public function getSkipFmf() { return $this->skip_fmf; } } rest-api-sdk-php/lib/PayPal/Api/FileAttachment.php 0000644 00000002162 15213403564 0015706 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; use PayPal\Validation\UrlValidator; /** * Class FileAttachment * * File attached to an invoice or template * * @package PayPal\Api * * @property string name * @property string url */ class FileAttachment extends PayPalModel { /** * Name of the file attached. * * @param string $name * * @return $this */ public function setName($name) { $this->name = $name; return $this; } /** * Name of the file attached. * * @return string */ public function getName() { return $this->name; } /** * URL of the attached file that can be downloaded. * * @param string $url * @throws \InvalidArgumentException * @return $this */ public function setUrl($url) { UrlValidator::validate($url, "Url"); $this->url = $url; return $this; } /** * URL of the attached file that can be downloaded. * * @return string */ public function getUrl() { return $this->url; } } rest-api-sdk-php/lib/PayPal/Api/AlternatePayment.php 0000644 00000004266 15213403564 0016302 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class AlternatePayment * * A resource representing a alternate payment account that can be used to fund a payment. * * @package PayPal\Api * * @deprecated Used for limited release only. * * @property string alternate_payment_account_id * @property string external_customer_id * @property string alternate_payment_provider_id */ class AlternatePayment extends PayPalModel { /** * The unique identifier of the alternate payment account. * * @param string $alternate_payment_account_id * * @return $this */ public function setAlternatePaymentAccountId($alternate_payment_account_id) { $this->alternate_payment_account_id = $alternate_payment_account_id; return $this; } /** * The unique identifier of the alternate payment account. * * @return string */ public function getAlternatePaymentAccountId() { return $this->alternate_payment_account_id; } /** * The unique identifier of the payer * * @param string $external_customer_id * * @return $this */ public function setExternalCustomerId($external_customer_id) { $this->external_customer_id = $external_customer_id; return $this; } /** * The unique identifier of the payer * * @return string */ public function getExternalCustomerId() { return $this->external_customer_id; } /** * Alternate Payment provider id. This is an optional attribute needed only for certain alternate providers e.g Ideal * * @param string $alternate_payment_provider_id * * @return $this */ public function setAlternatePaymentProviderId($alternate_payment_provider_id) { $this->alternate_payment_provider_id = $alternate_payment_provider_id; return $this; } /** * Alternate Payment provider id. This is an optional attribute needed only for certain alternate providers e.g Ideal * * @return string */ public function getAlternatePaymentProviderId() { return $this->alternate_payment_provider_id; } } rest-api-sdk-php/lib/PayPal/Api/Template.php 0000644 00000017264 15213403564 0014602 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalResourceModel; use PayPal\Rest\ApiContext; use PayPal\Transport\PayPalRestCall; use PayPal\Validation\ArgumentValidator; /** * Class Template * * Invoicing Template * * @package PayPal\Api * * @property string template_id * @property string name * @property bool default * @property \PayPal\Api\TemplateData template_data * @property \PayPal\Api\TemplateSettings[] settings * @property string unit_of_measure * @property bool custom */ class Template extends PayPalResourceModel { /** * Unique identifier id of the template. * * @param string $template_id * * @return $this */ public function setTemplateId($template_id) { $this->template_id = $template_id; return $this; } /** * Unique identifier id of the template. * * @return string */ public function getTemplateId() { return $this->template_id; } /** * Name of the template. * * @param string $name * * @return $this */ public function setName($name) { $this->name = $name; return $this; } /** * Name of the template. * * @return string */ public function getName() { return $this->name; } /** * Indicates that this template is merchant's default. There can be only one template which can be a default. * * @param bool $default * * @return $this */ public function setDefault($default) { $this->default = $default; return $this; } /** * Indicates that this template is merchant's default. There can be only one template which can be a default. * * @return bool */ public function getDefault() { return $this->default; } /** * Customized invoice data which is saved as template * * @param \PayPal\Api\TemplateData $template_data * * @return $this */ public function setTemplateData($template_data) { $this->template_data = $template_data; return $this; } /** * Customized invoice data which is saved as template * * @return \PayPal\Api\TemplateData */ public function getTemplateData() { return $this->template_data; } /** * Settings for each template * * @param \PayPal\Api\TemplateSettings[] $settings * * @return $this */ public function setSettings($settings) { $this->settings = $settings; return $this; } /** * Settings for each template * * @return \PayPal\Api\TemplateSettings[] */ public function getSettings() { return $this->settings; } /** * Append Settings to the list. * * @param \PayPal\Api\TemplateSettings $templateSettings * @return $this */ public function addSetting($templateSettings) { if (!$this->getSettings()) { return $this->setSettings(array($templateSettings)); } else { return $this->setSettings( array_merge($this->getSettings(), array($templateSettings)) ); } } /** * Remove Settings from the list. * * @param \PayPal\Api\TemplateSettings $templateSettings * @return $this */ public function removeSetting($templateSettings) { return $this->setSettings( array_diff($this->getSettings(), array($templateSettings)) ); } /** * Unit of measure for the template, possible values are Quantity, Hours, Amount. * * @param string $unit_of_measure * * @return $this */ public function setUnitOfMeasure($unit_of_measure) { $this->unit_of_measure = $unit_of_measure; return $this; } /** * Unit of measure for the template, possible values are Quantity, Hours, Amount. * * @return string */ public function getUnitOfMeasure() { return $this->unit_of_measure; } /** * Indicates whether this is a custom template created by the merchant. Non custom templates are system generated * * @param bool $custom * * @return $this */ public function setCustom($custom) { $this->custom = $custom; return $this; } /** * Indicates whether this is a custom template created by the merchant. Non custom templates are system generated * * @return bool */ public function getCustom() { return $this->custom; } /** * Retrieve the details for a particular template by passing the template ID to the request URI. * * @param string $templateId * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return Template */ public static function get($templateId, $apiContext = null, $restCall = null) { ArgumentValidator::validate($templateId, 'templateId'); $payLoad = ""; $json = self::executeCall( "/v1/invoicing/templates/$templateId", "GET", $payLoad, null, $apiContext, $restCall ); $ret = new Template(); $ret->fromJson($json); return $ret; } /** * Delete a particular template by passing the template ID to the request URI. * * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return bool */ public function delete($apiContext = null, $restCall = null) { ArgumentValidator::validate($this->getTemplateId(), "Id"); $payLoad = ""; self::executeCall( "/v1/invoicing/templates/{$this->getTemplateId()}", "DELETE", $payLoad, null, $apiContext, $restCall ); return true; } /** * Creates a template. * * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return Template */ public function create($apiContext = null, $restCall = null) { $json = self::executeCall( "/v1/invoicing/templates", "POST", $this->toJSON(), null, $apiContext, $restCall ); $this->fromJson($json); return $this; } /** * Update an existing template by passing the template ID to the request URI. In addition, pass a complete template object in the request JSON. Partial updates are not supported. * * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return Template */ public function update($apiContext = null, $restCall = null) { ArgumentValidator::validate($this->getTemplateId(), "Id"); $payLoad = $this->toJSON(); $json = self::executeCall( "/v1/invoicing/templates/{$this->getTemplateId()}", "PUT", $payLoad, null, $apiContext, $restCall ); $this->fromJson($json); return $this; } } rest-api-sdk-php/lib/PayPal/Api/PayoutItem.php 0000644 00000014465 15213403564 0015127 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalResourceModel; use PayPal\Rest\ApiContext; use PayPal\Transport\PayPalRestCall; use PayPal\Validation\ArgumentValidator; /** * Class PayoutItem * * A sender-created definition of a payout to a single recipient. * * @package PayPal\Api * * @property string recipient_type * @property \PayPal\Api\Currency amount * @property string note * @property string receiver * @property string sender_item_id */ class PayoutItem extends PayPalResourceModel { /** * The type of ID that identifies the payment receiver. Value is:<ul><code>EMAIL</code>. Unencrypted email. Value is a string of up to 127 single-byte characters.</li><li><code>PHONE</code>. Unencrypted phone number.<blockquote><strong>Note:</strong> The PayPal sandbox does not support the <code>PHONE</code> recipient type.</blockquote></li><li><code>PAYPAL_ID</code>. Encrypted PayPal account number.</li></ul>If the <code>sender_batch_header</code> includes the <code>recipient_type</code> attribute, any payout item without its own <code>recipient_type</code> attribute uses the <code>recipient_type</code> value from <code>sender_batch_header</code>. If the <code>sender_batch_header</code> omits the <code>recipient_type</code> attribute, each payout item must include its own <code>recipient_type</code> value. * * @param string $recipient_type * * @return $this */ public function setRecipientType($recipient_type) { $this->recipient_type = $recipient_type; return $this; } /** * The type of ID that identifies the payment receiver. Value is:<ul><code>EMAIL</code>. Unencrypted email. Value is a string of up to 127 single-byte characters.</li><li><code>PHONE</code>. Unencrypted phone number.<blockquote><strong>Note:</strong> The PayPal sandbox does not support the <code>PHONE</code> recipient type.</blockquote></li><li><code>PAYPAL_ID</code>. Encrypted PayPal account number.</li></ul>If the <code>sender_batch_header</code> includes the <code>recipient_type</code> attribute, any payout item without its own <code>recipient_type</code> attribute uses the <code>recipient_type</code> value from <code>sender_batch_header</code>. If the <code>sender_batch_header</code> omits the <code>recipient_type</code> attribute, each payout item must include its own <code>recipient_type</code> value. * * @return string */ public function getRecipientType() { return $this->recipient_type; } /** * The amount of money to pay the receiver. * * @param \PayPal\Api\Currency $amount * * @return $this */ public function setAmount($amount) { $this->amount = $amount; return $this; } /** * The amount of money to pay the receiver. * * @return \PayPal\Api\Currency */ public function getAmount() { return $this->amount; } /** * Optional. A sender-specified note for notifications. Value is any string value. * * @param string $note * * @return $this */ public function setNote($note) { $this->note = $note; return $this; } /** * Optional. A sender-specified note for notifications. Value is any string value. * * @return string */ public function getNote() { return $this->note; } /** * The receiver of the payment. Corresponds to the `recipient_type` value in the request. * * @param string $receiver * * @return $this */ public function setReceiver($receiver) { $this->receiver = $receiver; return $this; } /** * The receiver of the payment. Corresponds to the `recipient_type` value in the request. * * @return string */ public function getReceiver() { return $this->receiver; } /** * A sender-specified ID number. Tracks the batch payout in an accounting system. * * @param string $sender_item_id * * @return $this */ public function setSenderItemId($sender_item_id) { $this->sender_item_id = $sender_item_id; return $this; } /** * A sender-specified ID number. Tracks the batch payout in an accounting system. * * @return string */ public function getSenderItemId() { return $this->sender_item_id; } /** * Obtain the status of a payout item by passing the item ID to the request URI. * * @param string $payoutItemId * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return PayoutItemDetails */ public static function get($payoutItemId, $apiContext = null, $restCall = null) { ArgumentValidator::validate($payoutItemId, 'payoutItemId'); $payLoad = ""; $json = self::executeCall( "/v1/payments/payouts-item/$payoutItemId", "GET", $payLoad, null, $apiContext, $restCall ); $ret = new PayoutItemDetails(); $ret->fromJson($json); return $ret; } /** * Cancels the unclaimed payment using the items id passed in the request URI. If an unclaimed item is not claimed within 30 days, the funds will be automatically returned to the sender. This call can be used to cancel the unclaimed item prior to the automatic 30-day return. * * @param string $payoutItemId * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return PayoutItemDetails */ public static function cancel($payoutItemId, $apiContext = null, $restCall = null) { ArgumentValidator::validate($payoutItemId, 'payoutItemId'); $payLoad = ""; $json = self::executeCall( "/v1/payments/payouts-item/$payoutItemId/cancel", "POST", $payLoad, null, $apiContext, $restCall ); $ret = new PayoutItemDetails(); $ret->fromJson($json); return $ret; } } rest-api-sdk-php/lib/PayPal/Api/InvoiceAddress.php 0000644 00000001233 15213403564 0015716 0 ustar 00 <?php namespace PayPal\Api; /** * Class InvoiceAddress * * Base Address object used as billing address in a payment or extended for Shipping Address. * * @package PayPal\Api * * @property \PayPal\Api\Phone phone */ class InvoiceAddress extends BaseAddress { /** * Phone number in E.123 format. * * @param \PayPal\Api\Phone $phone * * @return $this */ public function setPhone($phone) { $this->phone = $phone; return $this; } /** * Phone number in E.123 format. * * @return \PayPal\Api\Phone */ public function getPhone() { return $this->phone; } } rest-api-sdk-php/lib/PayPal/Api/Agreement.php 0000644 00000050041 15213403564 0014724 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalResourceModel; use PayPal\Core\PayPalConstants; use PayPal\Rest\ApiContext; use PayPal\Transport\PayPalRestCall; use PayPal\Validation\ArgumentValidator; /** * Class Agreement * * A resource representing an agreement. * * @package PayPal\Api * * @property string id * @property string state * @property string name * @property string description * @property string start_date * @property \PayPal\Api\Payer payer * @property \PayPal\Api\Address shipping_address * @property \PayPal\Api\MerchantPreferences override_merchant_preferences * @property \PayPal\Api\OverrideChargeModel[] override_charge_models * @property \PayPal\Api\Plan plan * @property string create_time * @property string update_time * @property \PayPal\Api\AgreementDetails agreement_details */ class Agreement extends PayPalResourceModel { /** * Identifier of the agreement. * * @param string $id * * @return $this */ public function setId($id) { $this->id = $id; return $this; } /** * Identifier of the agreement. * * @return string */ public function getId() { return $this->id; } /** * State of the agreement. * * @param string $state * * @return $this */ public function setState($state) { $this->state = $state; return $this; } /** * State of the agreement. * * @return string */ public function getState() { return $this->state; } /** * Name of the agreement. * * @param string $name * * @return $this */ public function setName($name) { $this->name = $name; return $this; } /** * Name of the agreement. * * @return string */ public function getName() { return $this->name; } /** * Description of the agreement. * * @param string $description * * @return $this */ public function setDescription($description) { $this->description = $description; return $this; } /** * Description of the agreement. * * @return string */ public function getDescription() { return $this->description; } /** * Start date of the agreement. Date format yyyy-MM-dd z, as defined in [ISO8601](http://tools.ietf.org/html/rfc3339#section-5.6). * * @param string $start_date * * @return $this */ public function setStartDate($start_date) { $this->start_date = $start_date; return $this; } /** * Start date of the agreement. Date format yyyy-MM-dd z, as defined in [ISO8601](http://tools.ietf.org/html/rfc3339#section-5.6). * * @return string */ public function getStartDate() { return $this->start_date; } /** * Details of the buyer who is enrolling in this agreement. This information is gathered from execution of the approval URL. * * @param \PayPal\Api\Payer $payer * * @return $this */ public function setPayer($payer) { $this->payer = $payer; return $this; } /** * Details of the buyer who is enrolling in this agreement. This information is gathered from execution of the approval URL. * * @return \PayPal\Api\Payer */ public function getPayer() { return $this->payer; } /** * Shipping address object of the agreement, which should be provided if it is different from the default address. * * @param \PayPal\Api\Address $shipping_address * * @return $this */ public function setShippingAddress($shipping_address) { $this->shipping_address = $shipping_address; return $this; } /** * Shipping address object of the agreement, which should be provided if it is different from the default address. * * @return \PayPal\Api\Address */ public function getShippingAddress() { return $this->shipping_address; } /** * Default merchant preferences from the billing plan are used, unless override preferences are provided here. * * @param \PayPal\Api\MerchantPreferences $override_merchant_preferences * * @return $this */ public function setOverrideMerchantPreferences($override_merchant_preferences) { $this->override_merchant_preferences = $override_merchant_preferences; return $this; } /** * Default merchant preferences from the billing plan are used, unless override preferences are provided here. * * @return \PayPal\Api\MerchantPreferences */ public function getOverrideMerchantPreferences() { return $this->override_merchant_preferences; } /** * Array of override_charge_model for this agreement if needed to change the default models from the billing plan. * * @param \PayPal\Api\OverrideChargeModel[] $override_charge_models * * @return $this */ public function setOverrideChargeModels($override_charge_models) { $this->override_charge_models = $override_charge_models; return $this; } /** * Array of override_charge_model for this agreement if needed to change the default models from the billing plan. * * @return \PayPal\Api\OverrideChargeModel[] */ public function getOverrideChargeModels() { return $this->override_charge_models; } /** * Append OverrideChargeModels to the list. * * @param \PayPal\Api\OverrideChargeModel $overrideChargeModel * @return $this */ public function addOverrideChargeModel($overrideChargeModel) { if (!$this->getOverrideChargeModels()) { return $this->setOverrideChargeModels(array($overrideChargeModel)); } else { return $this->setOverrideChargeModels( array_merge($this->getOverrideChargeModels(), array($overrideChargeModel)) ); } } /** * Remove OverrideChargeModels from the list. * * @param \PayPal\Api\OverrideChargeModel $overrideChargeModel * @return $this */ public function removeOverrideChargeModel($overrideChargeModel) { return $this->setOverrideChargeModels( array_diff($this->getOverrideChargeModels(), array($overrideChargeModel)) ); } /** * Plan details for this agreement. * * @param \PayPal\Api\Plan $plan * * @return $this */ public function setPlan($plan) { $this->plan = $plan; return $this; } /** * Plan details for this agreement. * * @return \PayPal\Api\Plan */ public function getPlan() { return $this->plan; } /** * Date and time that this resource was created. Date format yyyy-MM-dd z, as defined in [ISO8601](http://tools.ietf.org/html/rfc3339#section-5.6). * * @param string $create_time * * @return $this */ public function setCreateTime($create_time) { $this->create_time = $create_time; return $this; } /** * Date and time that this resource was created. Date format yyyy-MM-dd z, as defined in [ISO8601](http://tools.ietf.org/html/rfc3339#section-5.6). * * @return string */ public function getCreateTime() { return $this->create_time; } /** * Date and time that this resource was updated. Date format yyyy-MM-dd z, as defined in [ISO8601](http://tools.ietf.org/html/rfc3339#section-5.6). * * @param string $update_time * * @return $this */ public function setUpdateTime($update_time) { $this->update_time = $update_time; return $this; } /** * Date and time that this resource was updated. Date format yyyy-MM-dd z, as defined in [ISO8601](http://tools.ietf.org/html/rfc3339#section-5.6). * * @return string */ public function getUpdateTime() { return $this->update_time; } /** * Agreement Details * * @param \PayPal\Api\AgreementDetails $agreement_details * * @return $this */ public function setAgreementDetails($agreement_details) { $this->agreement_details = $agreement_details; return $this; } /** * Agreement Details * * @return \PayPal\Api\AgreementDetails */ public function getAgreementDetails() { return $this->agreement_details; } /** * Get Approval Link * * @return null|string */ public function getApprovalLink() { return $this->getLink(PayPalConstants::APPROVAL_URL); } /** * Create a new billing agreement by passing the details for the agreement, including the name, description, start date, payer, and billing plan in the request JSON. * * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return Agreement */ public function create($apiContext = null, $restCall = null) { $payLoad = $this->toJSON(); $json = self::executeCall( "/v1/payments/billing-agreements/", "POST", $payLoad, null, $apiContext, $restCall ); $this->fromJson($json); return $this; } /** * Execute a billing agreement after buyer approval by passing the payment token to the request URI. * * @param $paymentToken * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return Agreement */ public function execute($paymentToken, $apiContext = null, $restCall = null) { ArgumentValidator::validate($paymentToken, 'paymentToken'); $payLoad = ""; $json = self::executeCall( "/v1/payments/billing-agreements/$paymentToken/agreement-execute", "POST", $payLoad, null, $apiContext, $restCall ); $this->fromJson($json); return $this; } /** * Retrieve details for a particular billing agreement by passing the ID of the agreement to the request URI. * * @param string $agreementId * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return Agreement */ public static function get($agreementId, $apiContext = null, $restCall = null) { ArgumentValidator::validate($agreementId, 'agreementId'); $payLoad = ""; $json = self::executeCall( "/v1/payments/billing-agreements/$agreementId", "GET", $payLoad, null, $apiContext, $restCall ); $ret = new Agreement(); $ret->fromJson($json); return $ret; } /** * Update details of a billing agreement, such as the description, shipping address, and start date, by passing the ID of the agreement to the request URI. * * @param PatchRequest $patchRequest * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return bool */ public function update($patchRequest, $apiContext = null, $restCall = null) { ArgumentValidator::validate($this->getId(), "Id"); ArgumentValidator::validate($patchRequest, 'patchRequest'); $payLoad = $patchRequest->toJSON(); self::executeCall( "/v1/payments/billing-agreements/{$this->getId()}", "PATCH", $payLoad, null, $apiContext, $restCall ); return true; } /** * Suspend a particular billing agreement by passing the ID of the agreement to the request URI. * * @param AgreementStateDescriptor $agreementStateDescriptor * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return bool */ public function suspend($agreementStateDescriptor, $apiContext = null, $restCall = null) { ArgumentValidator::validate($this->getId(), "Id"); ArgumentValidator::validate($agreementStateDescriptor, 'agreementStateDescriptor'); $payLoad = $agreementStateDescriptor->toJSON(); self::executeCall( "/v1/payments/billing-agreements/{$this->getId()}/suspend", "POST", $payLoad, null, $apiContext, $restCall ); return true; } /** * Reactivate a suspended billing agreement by passing the ID of the agreement to the appropriate URI. In addition, pass an agreement_state_descriptor object in the request JSON that includes a note about the reason for changing the state of the agreement and the amount and currency for the agreement. * * @param AgreementStateDescriptor $agreementStateDescriptor * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return bool */ public function reActivate($agreementStateDescriptor, $apiContext = null, $restCall = null) { ArgumentValidator::validate($this->getId(), "Id"); ArgumentValidator::validate($agreementStateDescriptor, 'agreementStateDescriptor'); $payLoad = $agreementStateDescriptor->toJSON(); self::executeCall( "/v1/payments/billing-agreements/{$this->getId()}/re-activate", "POST", $payLoad, null, $apiContext, $restCall ); return true; } /** * Cancel a billing agreement by passing the ID of the agreement to the request URI. In addition, pass an agreement_state_descriptor object in the request JSON that includes a note about the reason for changing the state of the agreement and the amount and currency for the agreement. * * @param AgreementStateDescriptor $agreementStateDescriptor * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return bool */ public function cancel($agreementStateDescriptor, $apiContext = null, $restCall = null) { ArgumentValidator::validate($this->getId(), "Id"); ArgumentValidator::validate($agreementStateDescriptor, 'agreementStateDescriptor'); $payLoad = $agreementStateDescriptor->toJSON(); self::executeCall( "/v1/payments/billing-agreements/{$this->getId()}/cancel", "POST", $payLoad, null, $apiContext, $restCall ); return true; } /** * Bill an outstanding amount for an agreement by passing the ID of the agreement to the request URI. In addition, pass an agreement_state_descriptor object in the request JSON that includes a note about the reason for changing the state of the agreement and the amount and currency for the agreement. * * @param AgreementStateDescriptor $agreementStateDescriptor * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return bool */ public function billBalance($agreementStateDescriptor, $apiContext = null, $restCall = null) { ArgumentValidator::validate($this->getId(), "Id"); ArgumentValidator::validate($agreementStateDescriptor, 'agreementStateDescriptor'); $payLoad = $agreementStateDescriptor->toJSON(); self::executeCall( "/v1/payments/billing-agreements/{$this->getId()}/bill-balance", "POST", $payLoad, null, $apiContext, $restCall ); return true; } /** * Set the balance for an agreement by passing the ID of the agreement to the request URI. In addition, pass a common_currency object in the request JSON that specifies the currency type and value of the balance. * * @param Currency $currency * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return bool */ public function setBalance($currency, $apiContext = null, $restCall = null) { ArgumentValidator::validate($this->getId(), "Id"); ArgumentValidator::validate($currency, 'currency'); $payLoad = $currency->toJSON(); self::executeCall( "/v1/payments/billing-agreements/{$this->getId()}/set-balance", "POST", $payLoad, null, $apiContext, $restCall ); return true; } /** * List transactions for a billing agreement by passing the ID of the agreement, as well as the start and end dates of the range of transactions to list, to the request URI. * * @deprecated Please use searchTransactions Instead * @param string $agreementId * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return AgreementTransactions */ public static function transactions($agreementId, $apiContext = null, $restCall = null) { ArgumentValidator::validate($agreementId, 'agreementId'); $payLoad = ""; $json = self::executeCall( "/v1/payments/billing-agreements/$agreementId/transactions", "GET", $payLoad, null, $apiContext, $restCall ); $ret = new AgreementTransactions(); $ret->fromJson($json); return $ret; } /** * List transactions for a billing agreement by passing the ID of the agreement, as well as the start and end dates of the range of transactions to list, to the request URI. * * @param string $agreementId * @param array $params Parameters for search string. Options: start_date, and end_date * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return AgreementTransactions */ public static function searchTransactions($agreementId, $params = array(), $apiContext = null, $restCall = null) { ArgumentValidator::validate($agreementId, 'agreementId'); ArgumentValidator::validate($params, 'params'); $allowedParams = array( 'start_date' => 1, 'end_date' => 1, ); $payLoad = ""; $json = self::executeCall( "/v1/payments/billing-agreements/$agreementId/transactions?" . http_build_query(array_intersect_key($params, $allowedParams)), "GET", $payLoad, null, $apiContext, $restCall ); $ret = new AgreementTransactions(); $ret->fromJson($json); return $ret; } } rest-api-sdk-php/lib/PayPal/Api/ExternalFunding.php 0000644 00000006370 15213403564 0016120 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class ExternalFunding * * A resource representing an external funding object. * * @package PayPal\Api * * @property string reference_id * @property string code * @property string funding_account_id * @property string display_text * @property \PayPal\Api\Amount amount * @property string funding_instruction */ class ExternalFunding extends PayPalModel { /** * Unique identifier for the external funding * * @param string $reference_id * * @return $this */ public function setReferenceId($reference_id) { $this->reference_id = $reference_id; return $this; } /** * Unique identifier for the external funding * * @return string */ public function getReferenceId() { return $this->reference_id; } /** * Generic identifier for the external funding * * @param string $code * * @return $this */ public function setCode($code) { $this->code = $code; return $this; } /** * Generic identifier for the external funding * * @return string */ public function getCode() { return $this->code; } /** * Encrypted PayPal Account identifier for the funding account * * @param string $funding_account_id * * @return $this */ public function setFundingAccountId($funding_account_id) { $this->funding_account_id = $funding_account_id; return $this; } /** * Encrypted PayPal Account identifier for the funding account * * @return string */ public function getFundingAccountId() { return $this->funding_account_id; } /** * Description of the external funding being applied * * @param string $display_text * * @return $this */ public function setDisplayText($display_text) { $this->display_text = $display_text; return $this; } /** * Description of the external funding being applied * * @return string */ public function getDisplayText() { return $this->display_text; } /** * Amount being funded by the external funding account * * @param \PayPal\Api\Amount $amount * * @return $this */ public function setAmount($amount) { $this->amount = $amount; return $this; } /** * Amount being funded by the external funding account * * @return \PayPal\Api\Amount */ public function getAmount() { return $this->amount; } /** * Indicates that the Payment should be fully funded by External Funded Incentive * Valid Values: ["FULLY_FUNDED"] * * @param string $funding_instruction * * @return $this */ public function setFundingInstruction($funding_instruction) { $this->funding_instruction = $funding_instruction; return $this; } /** * Indicates that the Payment should be fully funded by External Funded Incentive * * @return string */ public function getFundingInstruction() { return $this->funding_instruction; } } rest-api-sdk-php/lib/PayPal/Api/OpenIdError.php 0000644 00000003474 15213403564 0015215 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class OpenIdError * * Error resource * * @property string error * @property string error_description * @property string error_uri */ class OpenIdError extends PayPalModel { /** * A single ASCII error code from the following enum. * * @param string $error * @return self */ public function setError($error) { $this->error = $error; return $this; } /** * A single ASCII error code from the following enum. * * @return string */ public function getError() { return $this->error; } /** * A resource ID that indicates the starting resource in the returned results. * * @param string $error_description * @return self */ public function setErrorDescription($error_description) { $this->error_description = $error_description; return $this; } /** * A resource ID that indicates the starting resource in the returned results. * * @return string */ public function getErrorDescription() { return $this->error_description; } /** * A URI identifying a human-readable web page with information about the error, used to provide the client developer with additional information about the error. * * @param string $error_uri * @return self */ public function setErrorUri($error_uri) { $this->error_uri = $error_uri; return $this; } /** * A URI identifying a human-readable web page with information about the error, used to provide the client developer with additional information about the error. * * @return string */ public function getErrorUri() { return $this->error_uri; } } rest-api-sdk-php/lib/PayPal/Api/FuturePayment.php 0000644 00000003030 15213403564 0015621 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Rest\ApiContext; use PayPal\Transport\PayPalRestCall; /** * Class FuturePayment * * @package PayPal\Api */ class FuturePayment extends Payment { /** * Extends the Payment object to create future payments * * @param null $apiContext * @param string|null $clientMetadataId * @param PayPalRestCall|null $restCall is the Rest Call Service that is used to make rest calls * @return $this */ public function create($apiContext = null, $clientMetadataId = null, $restCall = null) { $headers = array(); if ($clientMetadataId != null) { $headers = array( 'PAYPAL-CLIENT-METADATA-ID' => $clientMetadataId ); } $payLoad = $this->toJSON(); $json = self::executeCall( "/v1/payments/payment", "POST", $payLoad, $headers, $apiContext, $restCall ); $this->fromJson($json); return $this; } /** * Get a Refresh Token from Authorization Code * * @param $authorizationCode * @param ApiContext $apiContext * @return string|null refresh token */ public static function getRefreshToken($authorizationCode, $apiContext = null) { $apiContext = $apiContext ? $apiContext : new ApiContext(self::$credential); $credential = $apiContext->getCredential(); return $credential->getRefreshToken($apiContext->getConfig(), $authorizationCode); } } rest-api-sdk-php/lib/PayPal/Api/PayoutBatch.php 0000644 00000004601 15213403564 0015241 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class PayoutBatch * * The PayPal-generated batch status. * * @package PayPal\Api * * @property \PayPal\Api\PayoutBatchHeader batch_header * @property \PayPal\Api\PayoutItemDetails[] items * @property \PayPal\Api\Links[] links */ class PayoutBatch extends PayPalModel { /** * A batch header. Includes the generated batch status. * * @param \PayPal\Api\PayoutBatchHeader $batch_header * * @return $this */ public function setBatchHeader($batch_header) { $this->batch_header = $batch_header; return $this; } /** * A batch header. Includes the generated batch status. * * @return \PayPal\Api\PayoutBatchHeader */ public function getBatchHeader() { return $this->batch_header; } /** * An array of items in a batch payout. * * @param \PayPal\Api\PayoutItemDetails[] $items * * @return $this */ public function setItems($items) { $this->items = $items; return $this; } /** * An array of items in a batch payout. * * @return \PayPal\Api\PayoutItemDetails[] */ public function getItems() { return $this->items; } /** * Append Items to the list. * * @param \PayPal\Api\PayoutItemDetails $payoutItemDetails * @return $this */ public function addItem($payoutItemDetails) { if (!$this->getItems()) { return $this->setItems(array($payoutItemDetails)); } else { return $this->setItems( array_merge($this->getItems(), array($payoutItemDetails)) ); } } /** * Remove Items from the list. * * @param \PayPal\Api\PayoutItemDetails $payoutItemDetails * @return $this */ public function removeItem($payoutItemDetails) { return $this->setItems( array_diff($this->getItems(), array($payoutItemDetails)) ); } /** * Sets Links * * @param \PayPal\Api\Links[] $links * * @return $this */ public function setLinks($links) { $this->links = $links; return $this; } /** * Gets Links * * @return \PayPal\Api\Links[] */ public function getLinks() { return $this->links; } } rest-api-sdk-php/lib/PayPal/Api/InstallmentInfo.php 0000644 00000006042 15213403564 0016125 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class InstallmentInfo * * A resource representing installment information available for a transaction * * @package PayPal\Api * * @property string installment_id * @property string network * @property string issuer * @property \PayPal\Api\InstallmentOption[] installment_options */ class InstallmentInfo extends PayPalModel { /** * Installment id. * * @param string $installment_id * * @return $this */ public function setInstallmentId($installment_id) { $this->installment_id = $installment_id; return $this; } /** * Installment id. * * @return string */ public function getInstallmentId() { return $this->installment_id; } /** * Credit card network. * Valid Values: ["VISA", "MASTERCARD"] * * @param string $network * * @return $this */ public function setNetwork($network) { $this->network = $network; return $this; } /** * Credit card network. * * @return string */ public function getNetwork() { return $this->network; } /** * Credit card issuer. * * @param string $issuer * * @return $this */ public function setIssuer($issuer) { $this->issuer = $issuer; return $this; } /** * Credit card issuer. * * @return string */ public function getIssuer() { return $this->issuer; } /** * List of available installment options and the cost associated with each one. * * @param \PayPal\Api\InstallmentOption[] $installment_options * * @return $this */ public function setInstallmentOptions($installment_options) { $this->installment_options = $installment_options; return $this; } /** * List of available installment options and the cost associated with each one. * * @return \PayPal\Api\InstallmentOption[] */ public function getInstallmentOptions() { return $this->installment_options; } /** * Append InstallmentOptions to the list. * * @param \PayPal\Api\InstallmentOption $installmentOption * @return $this */ public function addInstallmentOption($installmentOption) { if (!$this->getInstallmentOptions()) { return $this->setInstallmentOptions(array($installmentOption)); } else { return $this->setInstallmentOptions( array_merge($this->getInstallmentOptions(), array($installmentOption)) ); } } /** * Remove InstallmentOptions from the list. * * @param \PayPal\Api\InstallmentOption $installmentOption * @return $this */ public function removeInstallmentOption($installmentOption) { return $this->setInstallmentOptions( array_diff($this->getInstallmentOptions(), array($installmentOption)) ); } } rest-api-sdk-php/lib/PayPal/Api/InstallmentOption.php 0000644 00000004215 15213403564 0016502 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class InstallmentOption * * A resource describing an installment * * @package PayPal\Api * * @property int term * @property \PayPal\Api\Currency monthly_payment * @property \PayPal\Api\Currency discount_amount * @property string discount_percentage */ class InstallmentOption extends PayPalModel { /** * Number of installments * * @param int $term * * @return $this */ public function setTerm($term) { $this->term = $term; return $this; } /** * Number of installments * * @return int */ public function getTerm() { return $this->term; } /** * Monthly payment * * @param \PayPal\Api\Currency $monthly_payment * * @return $this */ public function setMonthlyPayment($monthly_payment) { $this->monthly_payment = $monthly_payment; return $this; } /** * Monthly payment * * @return \PayPal\Api\Currency */ public function getMonthlyPayment() { return $this->monthly_payment; } /** * Discount amount applied to the payment, if any * * @param \PayPal\Api\Currency $discount_amount * * @return $this */ public function setDiscountAmount($discount_amount) { $this->discount_amount = $discount_amount; return $this; } /** * Discount amount applied to the payment, if any * * @return \PayPal\Api\Currency */ public function getDiscountAmount() { return $this->discount_amount; } /** * Discount percentage applied to the payment, if any * * @param string $discount_percentage * * @return $this */ public function setDiscountPercentage($discount_percentage) { $this->discount_percentage = $discount_percentage; return $this; } /** * Discount percentage applied to the payment, if any * * @return string */ public function getDiscountPercentage() { return $this->discount_percentage; } } rest-api-sdk-php/lib/PayPal/Api/PaymentExecution.php 0000644 00000005401 15213403564 0016316 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class PaymentExecution * * Let's you execute a PayPal Account based Payment resource with the payer_id obtained from web approval url. * * @package PayPal\Api * * @property string payer_id * @property \PayPal\Api\Transaction[] transactions */ class PaymentExecution extends PayPalModel { /** * The ID of the Payer, passed in the `return_url` by PayPal. * * @param string $payer_id * * @return $this */ public function setPayerId($payer_id) { $this->payer_id = $payer_id; return $this; } /** * The ID of the Payer, passed in the `return_url` by PayPal. * * @return string */ public function getPayerId() { return $this->payer_id; } /** * Carrier account id for a carrier billing payment. For a carrier billing payment, payer_id is not applicable. * @deprecated Not publicly available * @param string $carrier_account_id * * @return $this */ public function setCarrierAccountId($carrier_account_id) { $this->carrier_account_id = $carrier_account_id; return $this; } /** * Carrier account id for a carrier billing payment. For a carrier billing payment, payer_id is not applicable. * @deprecated Not publicly available * @return string */ public function getCarrierAccountId() { return $this->carrier_account_id; } /** * Transactional details including the amount and item details. * * @param \PayPal\Api\Transaction[] $transactions * * @return $this */ public function setTransactions($transactions) { $this->transactions = $transactions; return $this; } /** * Transactional details including the amount and item details. * * @return \PayPal\Api\Transaction[] */ public function getTransactions() { return $this->transactions; } /** * Append Transactions to the list. * * @param \PayPal\Api\Transaction $transaction * @return $this */ public function addTransaction($transaction) { if (!$this->getTransactions()) { return $this->setTransactions(array($transaction)); } else { return $this->setTransactions( array_merge($this->getTransactions(), array($transaction)) ); } } /** * Remove Transactions from the list. * * @param \PayPal\Api\Transaction $transaction * @return $this */ public function removeTransaction($transaction) { return $this->setTransactions( array_diff($this->getTransactions(), array($transaction)) ); } } rest-api-sdk-php/lib/PayPal/Api/AgreementTransaction.php 0000644 00000011435 15213403564 0017136 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class AgreementTransaction * * A resource representing an agreement_transaction that is returned during a transaction search. * * @package PayPal\Api * * @property string transaction_id * @property string status * @property string transaction_type * @property \PayPal\Api\Currency amount * @property \PayPal\Api\Currency fee_amount * @property \PayPal\Api\Currency net_amount * @property string payer_email * @property string payer_name * @property string time_stamp * @property string time_zone */ class AgreementTransaction extends PayPalModel { /** * Id corresponding to this transaction. * * @param string $transaction_id * * @return $this */ public function setTransactionId($transaction_id) { $this->transaction_id = $transaction_id; return $this; } /** * Id corresponding to this transaction. * * @return string */ public function getTransactionId() { return $this->transaction_id; } /** * State of the subscription at this time. * * @param string $status * * @return $this */ public function setStatus($status) { $this->status = $status; return $this; } /** * State of the subscription at this time. * * @return string */ public function getStatus() { return $this->status; } /** * Type of transaction, usually Recurring Payment. * * @param string $transaction_type * * @return $this */ public function setTransactionType($transaction_type) { $this->transaction_type = $transaction_type; return $this; } /** * Type of transaction, usually Recurring Payment. * * @return string */ public function getTransactionType() { return $this->transaction_type; } /** * Amount for this transaction. * * @param \PayPal\Api\Currency $amount * * @return $this */ public function setAmount($amount) { $this->amount = $amount; return $this; } /** * Amount for this transaction. * * @return \PayPal\Api\Currency */ public function getAmount() { return $this->amount; } /** * Fee amount for this transaction. * * @param \PayPal\Api\Currency $fee_amount * * @return $this */ public function setFeeAmount($fee_amount) { $this->fee_amount = $fee_amount; return $this; } /** * Fee amount for this transaction. * * @return \PayPal\Api\Currency */ public function getFeeAmount() { return $this->fee_amount; } /** * Net amount for this transaction. * * @param \PayPal\Api\Currency $net_amount * * @return $this */ public function setNetAmount($net_amount) { $this->net_amount = $net_amount; return $this; } /** * Net amount for this transaction. * * @return \PayPal\Api\Currency */ public function getNetAmount() { return $this->net_amount; } /** * Email id of payer. * * @param string $payer_email * * @return $this */ public function setPayerEmail($payer_email) { $this->payer_email = $payer_email; return $this; } /** * Email id of payer. * * @return string */ public function getPayerEmail() { return $this->payer_email; } /** * Business name of payer. * * @param string $payer_name * * @return $this */ public function setPayerName($payer_name) { $this->payer_name = $payer_name; return $this; } /** * Business name of payer. * * @return string */ public function getPayerName() { return $this->payer_name; } /** * Time at which this transaction happened. * * @param string $time_stamp * * @return $this */ public function setTimeStamp($time_stamp) { $this->time_stamp = $time_stamp; return $this; } /** * Time at which this transaction happened. * * @return string */ public function getTimeStamp() { return $this->time_stamp; } /** * Time zone of time_updated field. * * @param string $time_zone * * @return $this */ public function setTimeZone($time_zone) { $this->time_zone = $time_zone; return $this; } /** * Time zone of time_updated field. * * @return string */ public function getTimeZone() { return $this->time_zone; } } rest-api-sdk-php/lib/PayPal/Api/Transaction.php 0000644 00000002572 15213403564 0015310 0 ustar 00 <?php namespace PayPal\Api; /** * Class Transaction * * A transaction defines the contract of a payment - what is the payment for and who is fulfilling it. * * @package PayPal\Api * */ class Transaction extends TransactionBase { /** * Additional transactions for complex payment scenarios. * * * @param self $transactions * * @return $this */ public function setTransactions($transactions) { $this->transactions = $transactions; return $this; } /** * Additional transactions for complex payment scenarios. * * @return self[] */ public function getTransactions() { return $this->transactions; } /** * Identifier to the purchase unit corresponding to this sale transaction * * @param string $purchase_unit_reference_id * @deprecated Use #setReferenceId instead * @return $this */ public function setPurchaseUnitReferenceId($purchase_unit_reference_id) { $this->purchase_unit_reference_id = $purchase_unit_reference_id; return $this; } /** * Identifier to the purchase unit corresponding to this sale transaction * * @deprecated Use #getReferenceId instead * @return string */ public function getPurchaseUnitReferenceId() { return $this->purchase_unit_reference_id; } } rest-api-sdk-php/lib/PayPal/Api/WebProfile.php 0000644 00000020743 15213403564 0015061 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalResourceModel; use PayPal\Rest\ApiContext; use PayPal\Transport\PayPalRestCall; use PayPal\Validation\ArgumentValidator; /** * Class WebProfile * * Payment web experience profile resource * * @package PayPal\Api * * @property string id * @property string name * @property bool temporary * @property \PayPal\Api\FlowConfig flow_config * @property \PayPal\Api\InputFields input_fields * @property \PayPal\Api\Presentation presentation */ class WebProfile extends PayPalResourceModel { /** * The unique ID of the web experience profile. * * @param string $id * * @return $this */ public function setId($id) { $this->id = $id; return $this; } /** * The unique ID of the web experience profile. * * @return string */ public function getId() { return $this->id; } /** * The web experience profile name. Unique for a specified merchant's profiles. * * @param string $name * * @return $this */ public function setName($name) { $this->name = $name; return $this; } /** * The web experience profile name. Unique for a specified merchant's profiles. * * @return string */ public function getName() { return $this->name; } /** * Indicates whether the profile persists for three hours or permanently. Set to `false` to persist the profile permanently. Set to `true` to persist the profile for three hours. * * @param bool $temporary * * @return $this */ public function setTemporary($temporary) { $this->temporary = $temporary; return $this; } /** * Indicates whether the profile persists for three hours or permanently. Set to `false` to persist the profile permanently. Set to `true` to persist the profile for three hours. * * @return bool */ public function getTemporary() { return $this->temporary; } /** * Parameters for flow configuration. * * @param \PayPal\Api\FlowConfig $flow_config * * @return $this */ public function setFlowConfig($flow_config) { $this->flow_config = $flow_config; return $this; } /** * Parameters for flow configuration. * * @return \PayPal\Api\FlowConfig */ public function getFlowConfig() { return $this->flow_config; } /** * Parameters for input fields customization. * * @param \PayPal\Api\InputFields $input_fields * * @return $this */ public function setInputFields($input_fields) { $this->input_fields = $input_fields; return $this; } /** * Parameters for input fields customization. * * @return \PayPal\Api\InputFields */ public function getInputFields() { return $this->input_fields; } /** * Parameters for style and presentation. * * @param \PayPal\Api\Presentation $presentation * * @return $this */ public function setPresentation($presentation) { $this->presentation = $presentation; return $this; } /** * Parameters for style and presentation. * * @return \PayPal\Api\Presentation */ public function getPresentation() { return $this->presentation; } /** * Creates a web experience profile. Pass the profile name and details in the JSON request body. * * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return CreateProfileResponse */ public function create($apiContext = null, $restCall = null) { $payLoad = $this->toJSON(); $json = self::executeCall( "/v1/payment-experience/web-profiles/", "POST", $payLoad, null, $apiContext, $restCall ); $ret = new CreateProfileResponse(); $ret->fromJson($json); return $ret; } /** * Updates a web experience profile. Pass the ID of the profile to the request URI and pass the profile details in the JSON request body. If your request omits any profile detail fields, the operation removes the previously set values for those fields. * * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return bool */ public function update($apiContext = null, $restCall = null) { ArgumentValidator::validate($this->getId(), "Id"); $payLoad = $this->toJSON(); self::executeCall( "/v1/payment-experience/web-profiles/{$this->getId()}", "PUT", $payLoad, null, $apiContext, $restCall ); return true; } /** * Partially-updates a web experience profile. Pass the profile ID to the request URI. Pass a patch object with the operation, path of the profile location to update, and, if needed, a new value to complete the operation in the JSON request body. * * @param Patch[] $patch * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return bool */ public function partial_update($patch, $apiContext = null, $restCall = null) { ArgumentValidator::validate($this->getId(), "Id"); ArgumentValidator::validate($patch, 'patch'); $payload = array(); foreach ($patch as $patchObject) { $payload[] = $patchObject->toArray(); } $payLoad = json_encode($payload); self::executeCall( "/v1/payment-experience/web-profiles/{$this->getId()}", "PATCH", $payLoad, null, $apiContext, $restCall ); return true; } /** * Shows details for a web experience profile, by ID. * * @param string $profileId * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return WebProfile */ public static function get($profileId, $apiContext = null, $restCall = null) { ArgumentValidator::validate($profileId, 'profileId'); $payLoad = ""; $json = self::executeCall( "/v1/payment-experience/web-profiles/$profileId", "GET", $payLoad, null, $apiContext, $restCall ); $ret = new WebProfile(); $ret->fromJson($json); return $ret; } /** * Lists all web experience profiles for a merchant or subject. * * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return WebProfile[] */ public static function get_list($apiContext = null, $restCall = null) { $payLoad = ""; $json = self::executeCall( "/v1/payment-experience/web-profiles/", "GET", $payLoad, null, $apiContext, $restCall ); return WebProfile::getList($json); } /** * Deletes a web experience profile, by ID. * * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return bool */ public function delete($apiContext = null, $restCall = null) { ArgumentValidator::validate($this->getId(), "Id"); $payLoad = ""; self::executeCall( "/v1/payment-experience/web-profiles/{$this->getId()}", "DELETE", $payLoad, null, $apiContext, $restCall ); return true; } } rest-api-sdk-php/lib/PayPal/Api/Capture.php 0000644 00000021576 15213403564 0014433 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalResourceModel; use PayPal\Transport\PayPalRestCall; use PayPal\Validation\ArgumentValidator; use PayPal\Rest\ApiContext; /** * Class Capture * * A capture transaction. * * @package PayPal\Api * * @property string id * @property \PayPal\Api\Amount amount * @property bool is_final_capture * @property string state * @property string reason_code * @property string parent_payment * @property string invoice_number * @property \PayPal\Api\Currency transaction_fee * @property string create_time * @property string update_time * @property \PayPal\Api\Links[] links */ class Capture extends PayPalResourceModel { /** * The ID of the capture transaction. * * @param string $id * * @return $this */ public function setId($id) { $this->id = $id; return $this; } /** * The ID of the capture transaction. * * @return string */ public function getId() { return $this->id; } /** * The amount to capture. If the amount matches the orginally authorized amount, the state of the authorization changes to `captured`. If not, the state of the authorization changes to `partially_captured`. * * @param \PayPal\Api\Amount $amount * * @return $this */ public function setAmount($amount) { $this->amount = $amount; return $this; } /** * The amount to capture. If the amount matches the orginally authorized amount, the state of the authorization changes to `captured`. If not, the state of the authorization changes to `partially_captured`. * * @return \PayPal\Api\Amount */ public function getAmount() { return $this->amount; } /** * Indicates whether to release all remaining funds that the authorization holds in the funding instrument. Default is `false`. * * @param bool $is_final_capture * * @return $this */ public function setIsFinalCapture($is_final_capture) { $this->is_final_capture = $is_final_capture; return $this; } /** * Indicates whether to release all remaining funds that the authorization holds in the funding instrument. Default is `false`. * * @return bool */ public function getIsFinalCapture() { return $this->is_final_capture; } /** * The state of the capture. * Valid Values: ["pending", "completed", "refunded", "partially_refunded"] * * @param string $state * * @return $this */ public function setState($state) { $this->state = $state; return $this; } /** * The state of the capture. * * @return string */ public function getState() { return $this->state; } /** * The reason code that describes why the transaction state is pending or reversed. * Valid Values: ["CHARGEBACK", "GUARANTEE", "BUYER_COMPLAINT", "REFUND", "UNCONFIRMED_SHIPPING_ADDRESS", "ECHECK", "INTERNATIONAL_WITHDRAWAL", "RECEIVING_PREFERENCE_MANDATES_MANUAL_ACTION", "PAYMENT_REVIEW", "REGULATORY_REVIEW", "UNILATERAL", "VERIFICATION_REQUIRED", "TRANSACTION_APPROVED_AWAITING_FUNDING"] * * @param string $reason_code * * @return $this */ public function setReasonCode($reason_code) { $this->reason_code = $reason_code; return $this; } /** * The reason code that describes why the transaction state is pending or reversed. * * @return string */ public function getReasonCode() { return $this->reason_code; } /** * The ID of the payment on which this transaction is based. * * @param string $parent_payment * * @return $this */ public function setParentPayment($parent_payment) { $this->parent_payment = $parent_payment; return $this; } /** * The ID of the payment on which this transaction is based. * * @return string */ public function getParentPayment() { return $this->parent_payment; } /** * The invoice number to track this payment. * * @param string $invoice_number * * @return $this */ public function setInvoiceNumber($invoice_number) { $this->invoice_number = $invoice_number; return $this; } /** * The invoice number to track this payment. * * @return string */ public function getInvoiceNumber() { return $this->invoice_number; } /** * The transaction fee for this payment. * * @param \PayPal\Api\Currency $transaction_fee * * @return $this */ public function setTransactionFee($transaction_fee) { $this->transaction_fee = $transaction_fee; return $this; } /** * The transaction fee for this payment. * * @return \PayPal\Api\Currency */ public function getTransactionFee() { return $this->transaction_fee; } /** * The date and time of capture, as defined in [RFC 3339 Section 5.6](http://tools.ietf.org/html/rfc3339#section-5.6). * * @param string $create_time * * @return $this */ public function setCreateTime($create_time) { $this->create_time = $create_time; return $this; } /** * The date and time of capture, as defined in [RFC 3339 Section 5.6](http://tools.ietf.org/html/rfc3339#section-5.6). * * @return string */ public function getCreateTime() { return $this->create_time; } /** * The date and time when the resource was last updated. * * @param string $update_time * * @return $this */ public function setUpdateTime($update_time) { $this->update_time = $update_time; return $this; } /** * The date and time when the resource was last updated. * * @return string */ public function getUpdateTime() { return $this->update_time; } /** * Shows details for a captured payment, by ID. * * @param string $captureId * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return Capture */ public static function get($captureId, $apiContext = null, $restCall = null) { ArgumentValidator::validate($captureId, 'captureId'); $payLoad = ""; $json = self::executeCall( "/v1/payments/capture/$captureId", "GET", $payLoad, null, $apiContext, $restCall ); $ret = new Capture(); $ret->fromJson($json); return $ret; } /** * Refund a captured payment by passing the capture_id in the request URI. In addition, include an amount object in the body of the request JSON. * * @deprecated Please use #refundCapturedPayment instead. * @param Refund $refund * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return Refund */ public function refund($refund, $apiContext = null, $restCall = null) { ArgumentValidator::validate($this->getId(), "Id"); ArgumentValidator::validate($refund, 'refund'); $payLoad = $refund->toJSON(); $json = self::executeCall( "/v1/payments/capture/{$this->getId()}/refund", "POST", $payLoad, null, $apiContext, $restCall ); $ret = new Refund(); $ret->fromJson($json); return $ret; } /** * Refunds a captured payment, by ID. Include an `amount` object in the JSON request body. * * @param RefundRequest $refundRequest * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return DetailedRefund */ public function refundCapturedPayment($refundRequest, $apiContext = null, $restCall = null) { ArgumentValidator::validate($this->getId(), "Id"); ArgumentValidator::validate($refundRequest, 'refundRequest'); $payLoad = $refundRequest->toJSON(); $json = self::executeCall( "/v1/payments/capture/{$this->getId()}/refund", "POST", $payLoad, null, $apiContext, $restCall ); $ret = new DetailedRefund(); $ret->fromJson($json); return $ret; } } rest-api-sdk-php/lib/PayPal/Api/PaymentDefinition.php 0000644 00000011636 15213403564 0016452 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class PaymentDefinition * * Resource representing payment definition scheduling information. * * @package PayPal\Api * * @property string id * @property string name * @property string type * @property string frequency_interval * @property string frequency * @property string cycles * @property \PayPal\Api\Currency amount * @property \PayPal\Api\ChargeModel[] charge_models */ class PaymentDefinition extends PayPalModel { /** * Identifier of the payment_definition. 128 characters max. * * @param string $id * * @return $this */ public function setId($id) { $this->id = $id; return $this; } /** * Identifier of the payment_definition. 128 characters max. * * @return string */ public function getId() { return $this->id; } /** * Name of the payment definition. 128 characters max. * * @param string $name * * @return $this */ public function setName($name) { $this->name = $name; return $this; } /** * Name of the payment definition. 128 characters max. * * @return string */ public function getName() { return $this->name; } /** * Type of the payment definition. Allowed values: `TRIAL`, `REGULAR`. * * @param string $type * * @return $this */ public function setType($type) { $this->type = $type; return $this; } /** * Type of the payment definition. Allowed values: `TRIAL`, `REGULAR`. * * @return string */ public function getType() { return $this->type; } /** * How frequently the customer should be charged. * * @param string $frequency_interval * * @return $this */ public function setFrequencyInterval($frequency_interval) { $this->frequency_interval = $frequency_interval; return $this; } /** * How frequently the customer should be charged. * * @return string */ public function getFrequencyInterval() { return $this->frequency_interval; } /** * Frequency of the payment definition offered. Allowed values: `WEEK`, `DAY`, `YEAR`, `MONTH`. * * @param string $frequency * * @return $this */ public function setFrequency($frequency) { $this->frequency = $frequency; return $this; } /** * Frequency of the payment definition offered. Allowed values: `WEEK`, `DAY`, `YEAR`, `MONTH`. * * @return string */ public function getFrequency() { return $this->frequency; } /** * Number of cycles in this payment definition. * * @param string $cycles * * @return $this */ public function setCycles($cycles) { $this->cycles = $cycles; return $this; } /** * Number of cycles in this payment definition. * * @return string */ public function getCycles() { return $this->cycles; } /** * Amount that will be charged at the end of each cycle for this payment definition. * * @param \PayPal\Api\Currency $amount * * @return $this */ public function setAmount($amount) { $this->amount = $amount; return $this; } /** * Amount that will be charged at the end of each cycle for this payment definition. * * @return \PayPal\Api\Currency */ public function getAmount() { return $this->amount; } /** * Array of charge_models for this payment definition. * * @param \PayPal\Api\ChargeModel[] $charge_models * * @return $this */ public function setChargeModels($charge_models) { $this->charge_models = $charge_models; return $this; } /** * Array of charge_models for this payment definition. * * @return \PayPal\Api\ChargeModel[] */ public function getChargeModels() { return $this->charge_models; } /** * Append ChargeModels to the list. * * @param \PayPal\Api\ChargeModel $chargeModel * @return $this */ public function addChargeModel($chargeModel) { if (!$this->getChargeModels()) { return $this->setChargeModels(array($chargeModel)); } else { return $this->setChargeModels( array_merge($this->getChargeModels(), array($chargeModel)) ); } } /** * Remove ChargeModels from the list. * * @param \PayPal\Api\ChargeModel $chargeModel * @return $this */ public function removeChargeModel($chargeModel) { return $this->setChargeModels( array_diff($this->getChargeModels(), array($chargeModel)) ); } } rest-api-sdk-php/lib/PayPal/Api/PrivateLabelCard.php 0000644 00000006056 15213403564 0016170 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class PrivateLabelCard * * A resource representing a type of merchant branded payment card. To promote customer value (convenience and earning rewards) and retailer value (merchants drive business using the store cards), PayPal will support as payment method. * * @package PayPal\Api * * @property string id * @property string card_number * @property string issuer_id * @property string issuer_name * @property string image_key */ class PrivateLabelCard extends PayPalModel { /** * encrypted identifier of the private label card instrument. * * @param string $id * * @return $this */ public function setId($id) { $this->id = $id; return $this; } /** * encrypted identifier of the private label card instrument. * * @return string */ public function getId() { return $this->id; } /** * last 4 digits of the card number. * * @param string $card_number * * @return $this */ public function setCardNumber($card_number) { $this->card_number = $card_number; return $this; } /** * last 4 digits of the card number. * * @return string */ public function getCardNumber() { return $this->card_number; } /** * Merchants providing private label store cards have associated issuer account. This value indicates encrypted account number of the associated issuer account. * * @param string $issuer_id * * @return $this */ public function setIssuerId($issuer_id) { $this->issuer_id = $issuer_id; return $this; } /** * Merchants providing private label store cards have associated issuer account. This value indicates encrypted account number of the associated issuer account. * * @return string */ public function getIssuerId() { return $this->issuer_id; } /** * Merchants providing private label store cards have associated issuer account. This value indicates name on the issuer account. * * @param string $issuer_name * * @return $this */ public function setIssuerName($issuer_name) { $this->issuer_name = $issuer_name; return $this; } /** * Merchants providing private label store cards have associated issuer account. This value indicates name on the issuer account. * * @return string */ public function getIssuerName() { return $this->issuer_name; } /** * This value indicates URL to access PLCC program logo image * * @param string $image_key * * @return $this */ public function setImageKey($image_key) { $this->image_key = $image_key; return $this; } /** * This value indicates URL to access PLCC program logo image * * @return string */ public function getImageKey() { return $this->image_key; } } rest-api-sdk-php/lib/PayPal/Api/AgreementStateDescriptor.php 0000644 00000002175 15213403564 0017771 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class AgreementStateDescriptor * * Description of the current state of the agreement. * * @package PayPal\Api * * @property string note * @property \PayPal\Api\Currency amount */ class AgreementStateDescriptor extends PayPalModel { /** * Reason for changing the state of the agreement. * * @param string $note * * @return $this */ public function setNote($note) { $this->note = $note; return $this; } /** * Reason for changing the state of the agreement. * * @return string */ public function getNote() { return $this->note; } /** * The amount and currency of the agreement. * * @param \PayPal\Api\Currency $amount * * @return $this */ public function setAmount($amount) { $this->amount = $amount; return $this; } /** * The amount and currency of the agreement. * * @return \PayPal\Api\Currency */ public function getAmount() { return $this->amount; } } rest-api-sdk-php/lib/PayPal/Api/ExtendedBankAccount.php 0000644 00000001722 15213403564 0016670 0 ustar 00 <?php namespace PayPal\Api; /** * Class ExtendedBankAccount * * A resource representing a bank account that can be used to fund a payment including support for SEPA. * * @package PayPal\Api * */ class ExtendedBankAccount extends BankAccount { /** * Identifier of the direct debit mandate to validate. Currently supported only for EU bank accounts(SEPA). * @deprecated Not publicly available * @param string $mandate_reference_number * * @return $this */ public function setMandateReferenceNumber($mandate_reference_number) { $this->mandate_reference_number = $mandate_reference_number; return $this; } /** * Identifier of the direct debit mandate to validate. Currently supported only for EU bank accounts(SEPA). * @deprecated Not publicly available * @return string */ public function getMandateReferenceNumber() { return $this->mandate_reference_number; } } rest-api-sdk-php/lib/PayPal/Api/OverrideChargeModel.php 0000644 00000002250 15213403564 0016666 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class OverrideChargeModel * * A resource representing an override_charge_model to be used during creation of the agreement. * * @package PayPal\Api * * @property string charge_id * @property \PayPal\Api\Currency amount */ class OverrideChargeModel extends PayPalModel { /** * ID of charge model. * * @param string $charge_id * * @return $this */ public function setChargeId($charge_id) { $this->charge_id = $charge_id; return $this; } /** * ID of charge model. * * @return string */ public function getChargeId() { return $this->charge_id; } /** * Updated Amount to be associated with this charge model. * * @param \PayPal\Api\Currency $amount * * @return $this */ public function setAmount($amount) { $this->amount = $amount; return $this; } /** * Updated Amount to be associated with this charge model. * * @return \PayPal\Api\Currency */ public function getAmount() { return $this->amount; } } rest-api-sdk-php/lib/PayPal/Api/CreditCardHistory.php 0000644 00000003471 15213403564 0016410 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class CreditCardHistory * * A list of Credit Card Resources * * @package PayPal\Api * * @property \PayPal\Api\CreditCard[] credit_cards * @property int count * @property string next_id */ class CreditCardHistory extends PayPalModel { /** * A list of credit card resources * * * @param \PayPal\Api\CreditCard[] $credit_cards * @return $this */ public function setCreditCards($credit_cards) { $this->{"credit-cards"} = $credit_cards; return $this; } /** * A list of credit card resources * * @return \PayPal\Api\CreditCard */ public function getCreditCards() { return $this->{"credit-cards"}; } /** * Number of items returned in each range of results. Note that the last results range could have fewer items than the requested number of items. * * * @param int $count * * @return $this */ public function setCount($count) { $this->count = $count; return $this; } /** * Number of items returned in each range of results. Note that the last results range could have fewer items than the requested number of items. * * @return int */ public function getCount() { return $this->count; } /** * Identifier of the next element to get the next range of results. * * * @param string $next_id * * @return $this */ public function setNextId($next_id) { $this->next_id = $next_id; return $this; } /** * Identifier of the next element to get the next range of results. * * @return string */ public function getNextId() { return $this->next_id; } } rest-api-sdk-php/lib/PayPal/Api/Image.php 0000644 00000001763 15213403564 0014046 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class Image * * @package PayPal\Api * * @property string image */ class Image extends PayPalModel { /** * List of invoices belonging to a merchant. * * @param string $imageBase64String * * @return $this */ public function setImage($imageBase64String) { $this->image = $imageBase64String; return $this; } /** * Get Image as Base-64 encoded String * * @return string */ public function getImage() { return $this->image; } /** * Stores the Image to file * * @param string $name File Name * @return string File name */ public function saveToFile($name = null) { // Self Generate File Location if (!$name) { $name = uniqid() . '.png'; } // Save to File file_put_contents($name, base64_decode($this->getImage())); return $name; } } rest-api-sdk-php/lib/PayPal/Api/Credit.php 0000644 00000002101 15213403564 0014221 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class Credit * * A resource representing a credit instrument. * * @package PayPal\Api * * @property string id * @property string type */ class Credit extends PayPalModel { /** * Unique identifier of credit resource. * * @param string $id * * @return $this */ public function setId($id) { $this->id = $id; return $this; } /** * Unique identifier of credit resource. * * @return string */ public function getId() { return $this->id; } /** * specifies type of credit * Valid Values: ["BILL_ME_LATER", "PAYPAL_EXTRAS_MASTERCARD", "EBAY_MASTERCARD", "PAYPAL_SMART_CONNECT"] * * @param string $type * * @return $this */ public function setType($type) { $this->type = $type; return $this; } /** * specifies type of credit * * @return string */ public function getType() { return $this->type; } } rest-api-sdk-php/lib/PayPal/Api/CreditFinancingOffered.php 0000644 00000007625 15213403564 0017351 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class CreditFinancingOffered * * Credit financing offered to customer on PayPal side with opt-in/opt-out status * * @package PayPal\Api * * @property \PayPal\Api\Currency total_cost * @property \PayPal\Api\number term * @property \PayPal\Api\Currency monthly_payment * @property \PayPal\Api\Currency total_interest * @property bool payer_acceptance * @property bool cart_amount_immutable */ class CreditFinancingOffered extends PayPalModel { /** * This is the estimated total payment amount including interest and fees the user will pay during the lifetime of the loan. * * @param \PayPal\Api\Currency $total_cost * * @return $this */ public function setTotalCost($total_cost) { $this->total_cost = $total_cost; return $this; } /** * This is the estimated total payment amount including interest and fees the user will pay during the lifetime of the loan. * * @return \PayPal\Api\Currency */ public function getTotalCost() { return $this->total_cost; } /** * Length of financing terms in month * * @param \PayPal\Api\number $term * * @return $this */ public function setTerm($term) { $this->term = $term; return $this; } /** * Length of financing terms in month * * @return \PayPal\Api\number */ public function getTerm() { return $this->term; } /** * This is the estimated amount per month that the customer will need to pay including fees and interest. * * @param \PayPal\Api\Currency $monthly_payment * * @return $this */ public function setMonthlyPayment($monthly_payment) { $this->monthly_payment = $monthly_payment; return $this; } /** * This is the estimated amount per month that the customer will need to pay including fees and interest. * * @return \PayPal\Api\Currency */ public function getMonthlyPayment() { return $this->monthly_payment; } /** * Estimated interest or fees amount the payer will have to pay during the lifetime of the loan. * * @param \PayPal\Api\Currency $total_interest * * @return $this */ public function setTotalInterest($total_interest) { $this->total_interest = $total_interest; return $this; } /** * Estimated interest or fees amount the payer will have to pay during the lifetime of the loan. * * @return \PayPal\Api\Currency */ public function getTotalInterest() { return $this->total_interest; } /** * Status on whether the customer ultimately was approved for and chose to make the payment using the approved installment credit. * * @param bool $payer_acceptance * * @return $this */ public function setPayerAcceptance($payer_acceptance) { $this->payer_acceptance = $payer_acceptance; return $this; } /** * Status on whether the customer ultimately was approved for and chose to make the payment using the approved installment credit. * * @return bool */ public function getPayerAcceptance() { return $this->payer_acceptance; } /** * Indicates whether the cart amount is editable after payer's acceptance on PayPal side * * @param bool $cart_amount_immutable * * @return $this */ public function setCartAmountImmutable($cart_amount_immutable) { $this->cart_amount_immutable = $cart_amount_immutable; return $this; } /** * Indicates whether the cart amount is editable after payer's acceptance on PayPal side * * @return bool */ public function getCartAmountImmutable() { return $this->cart_amount_immutable; } } rest-api-sdk-php/lib/PayPal/Api/CreditCardToken.php 0000644 00000007700 15213403564 0016026 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class CreditCardToken * * A resource representing a credit card that can be used to fund a payment. * * @package PayPal\Api * * @property string credit_card_id * @property string payer_id * @property string last4 * @property string type * @property int expire_month * @property int expire_year */ class CreditCardToken extends PayPalModel { /** * ID of credit card previously stored using `/vault/credit-card`. * * @param string $credit_card_id * * @return $this */ public function setCreditCardId($credit_card_id) { $this->credit_card_id = $credit_card_id; return $this; } /** * ID of credit card previously stored using `/vault/credit-card`. * * @return string */ public function getCreditCardId() { return $this->credit_card_id; } /** * A unique identifier that you can assign and track when storing a credit card or using a stored credit card. This ID can help to avoid unintentional use or misuse of credit cards. This ID can be any value you would like to associate with the saved card, such as a UUID, username, or email address. **Required when using a stored credit card if a payer_id was originally provided when storing the credit card in vault.** * * @param string $payer_id * * @return $this */ public function setPayerId($payer_id) { $this->payer_id = $payer_id; return $this; } /** * A unique identifier that you can assign and track when storing a credit card or using a stored credit card. This ID can help to avoid unintentional use or misuse of credit cards. This ID can be any value you would like to associate with the saved card, such as a UUID, username, or email address. **Required when using a stored credit card if a payer_id was originally provided when storing the credit card in vault.** * * @return string */ public function getPayerId() { return $this->payer_id; } /** * Last four digits of the stored credit card number. * * @param string $last4 * * @return $this */ public function setLast4($last4) { $this->last4 = $last4; return $this; } /** * Last four digits of the stored credit card number. * * @return string */ public function getLast4() { return $this->last4; } /** * Credit card type. Valid types are: `visa`, `mastercard`, `discover`, `amex`. Values are presented in lowercase and not should not be used for display. * * @param string $type * * @return $this */ public function setType($type) { $this->type = $type; return $this; } /** * Credit card type. Valid types are: `visa`, `mastercard`, `discover`, `amex`. Values are presented in lowercase and not should not be used for display. * * @return string */ public function getType() { return $this->type; } /** * Expiration month with no leading zero. Acceptable values are 1 through 12. * * @param int $expire_month * * @return $this */ public function setExpireMonth($expire_month) { $this->expire_month = $expire_month; return $this; } /** * Expiration month with no leading zero. Acceptable values are 1 through 12. * * @return int */ public function getExpireMonth() { return $this->expire_month; } /** * 4-digit expiration year. * * @param int $expire_year * * @return $this */ public function setExpireYear($expire_year) { $this->expire_year = $expire_year; return $this; } /** * 4-digit expiration year. * * @return int */ public function getExpireYear() { return $this->expire_year; } } rest-api-sdk-php/lib/PayPal/Api/Authorization.php 0000644 00000036671 15213403564 0015672 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalResourceModel; use PayPal\Validation\ArgumentValidator; use PayPal\Rest\ApiContext; /** * Class Authorization * * An authorization transaction. * * @package PayPal\Api * * @property string id * @property \PayPal\Api\Amount amount * @property string payment_mode * @property string state * @property string reason_code * @property string pending_reason * @property string protection_eligibility * @property string protection_eligibility_type * @property \PayPal\Api\FmfDetails fmf_details * @property string parent_payment * @property \PayPal\Api\ProcessorResponse processor_response * @property string valid_until * @property string create_time * @property string update_time * @property string reference_id * @property string receipt_id * @property \PayPal\Api\Links[] links */ class Authorization extends PayPalResourceModel { /** * ID of the authorization transaction. * * @param string $id * * @return $this */ public function setId($id) { $this->id = $id; return $this; } /** * ID of the authorization transaction. * * @return string */ public function getId() { return $this->id; } /** * Amount being authorized. * * @param \PayPal\Api\Amount $amount * * @return $this */ public function setAmount($amount) { $this->amount = $amount; return $this; } /** * Amount being authorized. * * @return \PayPal\Api\Amount */ public function getAmount() { return $this->amount; } /** * Specifies the payment mode of the transaction. * Valid Values: ["INSTANT_TRANSFER"] * * @param string $payment_mode * * @return $this */ public function setPaymentMode($payment_mode) { $this->payment_mode = $payment_mode; return $this; } /** * Specifies the payment mode of the transaction. * * @return string */ public function getPaymentMode() { return $this->payment_mode; } /** * State of the authorization. * Valid Values: ["pending", "authorized", "partially_captured", "captured", "expired", "voided"] * * @param string $state * * @return $this */ public function setState($state) { $this->state = $state; return $this; } /** * State of the authorization. * * @return string */ public function getState() { return $this->state; } /** * Reason code, `AUTHORIZATION`, for a transaction state of `pending`. * Valid Values: ["AUTHORIZATION"] * * @param string $reason_code * * @return $this */ public function setReasonCode($reason_code) { $this->reason_code = $reason_code; return $this; } /** * Reason code, `AUTHORIZATION`, for a transaction state of `pending`. * * @return string */ public function getReasonCode() { return $this->reason_code; } /** * [DEPRECATED] Reason code for the transaction state being Pending.Obsolete. use reason_code field instead. * Valid Values: ["AUTHORIZATION"] * * @param string $pending_reason * * @return $this */ public function setPendingReason($pending_reason) { $this->pending_reason = $pending_reason; return $this; } /** * @deprecated [DEPRECATED] Reason code for the transaction state being Pending.Obsolete. use reason_code field instead. * * @return string */ public function getPendingReason() { return $this->pending_reason; } /** * The level of seller protection in force for the transaction. Only supported when the `payment_method` is set to `paypal`. Allowed values:<br> `ELIGIBLE`- Merchant is protected by PayPal's Seller Protection Policy for Unauthorized Payments and Item Not Received.<br> `PARTIALLY_ELIGIBLE`- Merchant is protected by PayPal's Seller Protection Policy for Item Not Received or Unauthorized Payments. Refer to `protection_eligibility_type` for specifics. <br> `INELIGIBLE`- Merchant is not protected under the Seller Protection Policy. * Valid Values: ["ELIGIBLE", "PARTIALLY_ELIGIBLE", "INELIGIBLE"] * * @param string $protection_eligibility * * @return $this */ public function setProtectionEligibility($protection_eligibility) { $this->protection_eligibility = $protection_eligibility; return $this; } /** * The level of seller protection in force for the transaction. Only supported when the `payment_method` is set to `paypal`. Allowed values:<br> `ELIGIBLE`- Merchant is protected by PayPal's Seller Protection Policy for Unauthorized Payments and Item Not Received.<br> `PARTIALLY_ELIGIBLE`- Merchant is protected by PayPal's Seller Protection Policy for Item Not Received or Unauthorized Payments. Refer to `protection_eligibility_type` for specifics. <br> `INELIGIBLE`- Merchant is not protected under the Seller Protection Policy. * * @return string */ public function getProtectionEligibility() { return $this->protection_eligibility; } /** * The kind of seller protection in force for the transaction. This property is returned only when the `protection_eligibility` property is set to `ELIGIBLE`or `PARTIALLY_ELIGIBLE`. Only supported when the `payment_method` is set to `paypal`. Allowed values:<br> `ITEM_NOT_RECEIVED_ELIGIBLE`- Sellers are protected against claims for items not received.<br> `UNAUTHORIZED_PAYMENT_ELIGIBLE`- Sellers are protected against claims for unauthorized payments.<br> One or both of the allowed values can be returned. * Valid Values: ["ITEM_NOT_RECEIVED_ELIGIBLE", "UNAUTHORIZED_PAYMENT_ELIGIBLE", "ITEM_NOT_RECEIVED_ELIGIBLE,UNAUTHORIZED_PAYMENT_ELIGIBLE"] * * @param string $protection_eligibility_type * * @return $this */ public function setProtectionEligibilityType($protection_eligibility_type) { $this->protection_eligibility_type = $protection_eligibility_type; return $this; } /** * The kind of seller protection in force for the transaction. This property is returned only when the `protection_eligibility` property is set to `ELIGIBLE`or `PARTIALLY_ELIGIBLE`. Only supported when the `payment_method` is set to `paypal`. Allowed values:<br> `ITEM_NOT_RECEIVED_ELIGIBLE`- Sellers are protected against claims for items not received.<br> `UNAUTHORIZED_PAYMENT_ELIGIBLE`- Sellers are protected against claims for unauthorized payments.<br> One or both of the allowed values can be returned. * * @return string */ public function getProtectionEligibilityType() { return $this->protection_eligibility_type; } /** * Fraud Management Filter (FMF) details applied for the payment that could result in accept, deny, or pending action. Returned in a payment response only if the merchant has enabled FMF in the profile settings and one of the fraud filters was triggered based on those settings. See [Fraud Management Filters Summary](https://developer.paypal.com/docs/classic/fmf/integration-guide/FMFSummary/) for more information. * * @param \PayPal\Api\FmfDetails $fmf_details * * @return $this */ public function setFmfDetails($fmf_details) { $this->fmf_details = $fmf_details; return $this; } /** * Fraud Management Filter (FMF) details applied for the payment that could result in accept, deny, or pending action. Returned in a payment response only if the merchant has enabled FMF in the profile settings and one of the fraud filters was triggered based on those settings. See [Fraud Management Filters Summary](https://developer.paypal.com/docs/classic/fmf/integration-guide/FMFSummary/) for more information. * * @return \PayPal\Api\FmfDetails */ public function getFmfDetails() { return $this->fmf_details; } /** * ID of the Payment resource that this transaction is based on. * * @param string $parent_payment * * @return $this */ public function setParentPayment($parent_payment) { $this->parent_payment = $parent_payment; return $this; } /** * ID of the Payment resource that this transaction is based on. * * @return string */ public function getParentPayment() { return $this->parent_payment; } /** * Response codes returned by the processor concerning the submitted payment. Only supported when the `payment_method` is set to `credit_card`. * * @param \PayPal\Api\ProcessorResponse $processor_response * * @return $this */ public function setProcessorResponse($processor_response) { $this->processor_response = $processor_response; return $this; } /** * Response codes returned by the processor concerning the submitted payment. Only supported when the `payment_method` is set to `credit_card`. * * @return \PayPal\Api\ProcessorResponse */ public function getProcessorResponse() { return $this->processor_response; } /** * Authorization expiration time and date as defined in [RFC 3339 Section 5.6](http://tools.ietf.org/html/rfc3339#section-5.6). * * @param string $valid_until * * @return $this */ public function setValidUntil($valid_until) { $this->valid_until = $valid_until; return $this; } /** * Authorization expiration time and date as defined in [RFC 3339 Section 5.6](http://tools.ietf.org/html/rfc3339#section-5.6). * * @return string */ public function getValidUntil() { return $this->valid_until; } /** * Time of authorization as defined in [RFC 3339 Section 5.6](http://tools.ietf.org/html/rfc3339#section-5.6). * * @param string $create_time * * @return $this */ public function setCreateTime($create_time) { $this->create_time = $create_time; return $this; } /** * Time of authorization as defined in [RFC 3339 Section 5.6](http://tools.ietf.org/html/rfc3339#section-5.6). * * @return string */ public function getCreateTime() { return $this->create_time; } /** * Time that the resource was last updated. * * @param string $update_time * * @return $this */ public function setUpdateTime($update_time) { $this->update_time = $update_time; return $this; } /** * Time that the resource was last updated. * * @return string */ public function getUpdateTime() { return $this->update_time; } /** * Identifier to the purchase or transaction unit corresponding to this authorization transaction. * * @param string $reference_id * * @return $this */ public function setReferenceId($reference_id) { $this->reference_id = $reference_id; return $this; } /** * Identifier to the purchase or transaction unit corresponding to this authorization transaction. * * @return string */ public function getReferenceId() { return $this->reference_id; } /** * Receipt id is 16 digit number payment identification number returned for guest users to identify the payment. * * @param string $receipt_id * * @return $this */ public function setReceiptId($receipt_id) { $this->receipt_id = $receipt_id; return $this; } /** * Receipt id is 16 digit number payment identification number returned for guest users to identify the payment. * * @return string */ public function getReceiptId() { return $this->receipt_id; } /** * Shows details for an authorization, by ID. * * @param string $authorizationId * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return Authorization */ public static function get($authorizationId, $apiContext = null, $restCall = null) { ArgumentValidator::validate($authorizationId, 'authorizationId'); $payLoad = ""; $json = self::executeCall( "/v1/payments/authorization/$authorizationId", "GET", $payLoad, null, $apiContext, $restCall ); $ret = new Authorization(); $ret->fromJson($json); return $ret; } /** * Captures and processes an authorization, by ID. To use this call, the original payment call must specify an intent of `authorize`. * * @param Capture $capture * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return Capture */ public function capture($capture, $apiContext = null, $restCall = null) { ArgumentValidator::validate($this->getId(), "Id"); ArgumentValidator::validate($capture, 'capture'); $payLoad = $capture->toJSON(); $json = self::executeCall( "/v1/payments/authorization/{$this->getId()}/capture", "POST", $payLoad, null, $apiContext, $restCall ); $ret = new Capture(); $ret->fromJson($json); return $ret; } /** * Voids, or cancels, an authorization, by ID. You cannot void a fully captured authorization. * * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return Authorization */ public function void($apiContext = null, $restCall = null) { ArgumentValidator::validate($this->getId(), "Id"); $payLoad = ""; $json = self::executeCall( "/v1/payments/authorization/{$this->getId()}/void", "POST", $payLoad, null, $apiContext, $restCall ); $this->fromJson($json); return $this; } /** * Reauthorizes a PayPal account payment, by authorization ID. To ensure that funds are still available, reauthorize a payment after the initial three-day honor period. Supports only the `amount` request parameter. * * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return Authorization */ public function reauthorize($apiContext = null, $restCall = null) { ArgumentValidator::validate($this->getId(), "Id"); $payLoad = $this->toJSON(); $json = self::executeCall( "/v1/payments/authorization/{$this->getId()}/reauthorize", "POST", $payLoad, null, $apiContext, $restCall ); $this->fromJson($json); return $this; } } rest-api-sdk-php/lib/PayPal/Api/PayoutSenderBatchHeader.php 0000644 00000012203 15213403564 0017510 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class PayoutSenderBatchHeader * * The sender-provided batch header for a batch payout request. * * @package PayPal\Api * * @property string sender_batch_id * @property string email_subject * @property string recipient_type * @property string batch_status */ class PayoutSenderBatchHeader extends PayPalModel { /** * A sender-specified ID number. Tracks the batch payout in an accounting system.<blockquote><strong>Note:</strong> PayPal prevents duplicate batches from being processed. If you specify a `sender_batch_id` that was used in the last 30 days, the API rejects the request and returns an error message that indicates the duplicate `sender_batch_id` and includes a HATEOAS link to the original batch payout with the same `sender_batch_id`. If you receive a HTTP `5nn` status code, you can safely retry the request with the same `sender_batch_id`. In any case, the API completes a payment only once for a specific `sender_batch_id` that is used within 30 days.</blockquote> * * @param string $sender_batch_id * * @return $this */ public function setSenderBatchId($sender_batch_id) { $this->sender_batch_id = $sender_batch_id; return $this; } /** * A sender-specified ID number. Tracks the batch payout in an accounting system.<blockquote><strong>Note:</strong> PayPal prevents duplicate batches from being processed. If you specify a `sender_batch_id` that was used in the last 30 days, the API rejects the request and returns an error message that indicates the duplicate `sender_batch_id` and includes a HATEOAS link to the original batch payout with the same `sender_batch_id`. If you receive a HTTP `5nn` status code, you can safely retry the request with the same `sender_batch_id`. In any case, the API completes a payment only once for a specific `sender_batch_id` that is used within 30 days.</blockquote> * * @return string */ public function getSenderBatchId() { return $this->sender_batch_id; } /** * The subject line text for the email that PayPal sends when a payout item completes. The subject line is the same for all recipients. Value is an alphanumeric string with a maximum length of 255 single-byte characters. * * @param string $email_subject * * @return $this */ public function setEmailSubject($email_subject) { $this->email_subject = $email_subject; return $this; } /** * The subject line text for the email that PayPal sends when a payout item completes. The subject line is the same for all recipients. Value is an alphanumeric string with a maximum length of 255 single-byte characters. * * @return string */ public function getEmailSubject() { return $this->email_subject; } /** * The type of ID that identifies the payment receiver. Value is:<ul><code>EMAIL</code>. Unencrypted email. Value is a string of up to 127 single-byte characters.</li><li><code>PHONE</code>. Unencrypted phone number.<blockquote><strong>Note:</strong> The PayPal sandbox does not support the <code>PHONE</code> recipient type.</blockquote></li><li><code>PAYPAL_ID</code>. Encrypted PayPal account number.</li></ul>If the <code>sender_batch_header</code> includes the <code>recipient_type</code> attribute, any payout item without its own <code>recipient_type</code> attribute uses the <code>recipient_type</code> value from <code>sender_batch_header</code>. If the <code>sender_batch_header</code> omits the <code>recipient_type</code> attribute, each payout item must include its own <code>recipient_type</code> value. * * @param string $recipient_type * * @return $this */ public function setRecipientType($recipient_type) { $this->recipient_type = $recipient_type; return $this; } /** * The type of ID that identifies the payment receiver. Value is:<ul><code>EMAIL</code>. Unencrypted email. Value is a string of up to 127 single-byte characters.</li><li><code>PHONE</code>. Unencrypted phone number.<blockquote><strong>Note:</strong> The PayPal sandbox does not support the <code>PHONE</code> recipient type.</blockquote></li><li><code>PAYPAL_ID</code>. Encrypted PayPal account number.</li></ul>If the <code>sender_batch_header</code> includes the <code>recipient_type</code> attribute, any payout item without its own <code>recipient_type</code> attribute uses the <code>recipient_type</code> value from <code>sender_batch_header</code>. If the <code>sender_batch_header</code> omits the <code>recipient_type</code> attribute, each payout item must include its own <code>recipient_type</code> value. * * @return string */ public function getRecipientType() { return $this->recipient_type; } /** * @deprecated This property is unused */ public function setBatchStatus($batch_status) { $this->batch_status = $batch_status; return $this; } /** * @deprecated This property is unused */ public function getBatchStatus() { return $this->batch_status; } } rest-api-sdk-php/lib/PayPal/Api/PotentialPayerInfo.php 0000644 00000004612 15213403564 0016574 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class PotentialPayerInfo * * A resource representing a information about a potential Payer. * * @package PayPal\Api * */ class PotentialPayerInfo extends PayPalModel { /** * Email address representing the potential payer. * @deprecated Not publicly available * @param string $email * * @return $this */ public function setEmail($email) { $this->email = $email; return $this; } /** * Email address representing the potential payer. * @deprecated Not publicly available * @return string */ public function getEmail() { return $this->email; } /** * ExternalRememberMe id representing the potential payer * @deprecated Not publicly available * @param string $external_remember_me_id * * @return $this */ public function setExternalRememberMeId($external_remember_me_id) { $this->external_remember_me_id = $external_remember_me_id; return $this; } /** * ExternalRememberMe id representing the potential payer * @deprecated Not publicly available * @return string */ public function getExternalRememberMeId() { return $this->external_remember_me_id; } /** * Account Number representing the potential payer * @deprecated Not publicly available * @param string $account_number * * @return $this */ public function setAccountNumber($account_number) { $this->account_number = $account_number; return $this; } /** * Account Number representing the potential payer * @deprecated Not publicly available * @return string */ public function getAccountNumber() { return $this->account_number; } /** * Billing address of the potential payer. * @deprecated Not publicly available * @param \PayPal\Api\Address $billing_address * * @return $this */ public function setBillingAddress($billing_address) { $this->billing_address = $billing_address; return $this; } /** * Billing address of the potential payer. * @deprecated Not publicly available * @return \PayPal\Api\Address */ public function getBillingAddress() { return $this->billing_address; } } rest-api-sdk-php/lib/PayPal/Api/ProcessorResponse.php 0000644 00000007300 15213403564 0016513 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class ProcessorResponse * * Collection of payment response related fields returned from a payment request * * @package PayPal\Api * * @property string response_code * @property string avs_code * @property string cvv_code * @property string advice_code * @property string eci_submitted * @property string vpas */ class ProcessorResponse extends PayPalModel { /** * Paypal normalized response code, generated from the processor's specific response code * * @param string $response_code * * @return $this */ public function setResponseCode($response_code) { $this->response_code = $response_code; return $this; } /** * Paypal normalized response code, generated from the processor's specific response code * * @return string */ public function getResponseCode() { return $this->response_code; } /** * Address Verification System response code. https://developer.paypal.com/docs/classic/api/AVSResponseCodes/ * * @param string $avs_code * * @return $this */ public function setAvsCode($avs_code) { $this->avs_code = $avs_code; return $this; } /** * Address Verification System response code. https://developer.paypal.com/docs/classic/api/AVSResponseCodes/ * * @return string */ public function getAvsCode() { return $this->avs_code; } /** * CVV System response code. https://developer.paypal.com/docs/classic/api/AVSResponseCodes/ * * @param string $cvv_code * * @return $this */ public function setCvvCode($cvv_code) { $this->cvv_code = $cvv_code; return $this; } /** * CVV System response code. https://developer.paypal.com/docs/classic/api/AVSResponseCodes/ * * @return string */ public function getCvvCode() { return $this->cvv_code; } /** * Provides merchant advice on how to handle declines related to recurring payments * Valid Values: ["01_NEW_ACCOUNT_INFORMATION", "02_TRY_AGAIN_LATER", "02_STOP_SPECIFIC_PAYMENT", "03_DO_NOT_TRY_AGAIN", "03_REVOKE_AUTHORIZATION_FOR_FUTURE_PAYMENT", "21_DO_NOT_TRY_AGAIN_CARD_HOLDER_CANCELLED_RECURRRING_CHARGE", "21_CANCEL_ALL_RECURRING_PAYMENTS"] * * @param string $advice_code * * @return $this */ public function setAdviceCode($advice_code) { $this->advice_code = $advice_code; return $this; } /** * Provides merchant advice on how to handle declines related to recurring payments * * @return string */ public function getAdviceCode() { return $this->advice_code; } /** * Response back from the authorization. Provided by the processor * * @param string $eci_submitted * * @return $this */ public function setEciSubmitted($eci_submitted) { $this->eci_submitted = $eci_submitted; return $this; } /** * Response back from the authorization. Provided by the processor * * @return string */ public function getEciSubmitted() { return $this->eci_submitted; } /** * Visa Payer Authentication Service status. Will be return from processor * * @param string $vpas * * @return $this */ public function setVpas($vpas) { $this->vpas = $vpas; return $this; } /** * Visa Payer Authentication Service status. Will be return from processor * * @return string */ public function getVpas() { return $this->vpas; } } rest-api-sdk-php/lib/PayPal/Api/WebhookList.php 0000644 00000002500 15213403564 0015244 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class WebhookList * * List of webhooks. * * @package PayPal\Api * * @property \PayPal\Api\Webhook[] webhooks */ class WebhookList extends PayPalModel { /** * A list of webhooks. * * @param \PayPal\Api\Webhook[] $webhooks * * @return $this */ public function setWebhooks($webhooks) { $this->webhooks = $webhooks; return $this; } /** * A list of webhooks. * * @return \PayPal\Api\Webhook[] */ public function getWebhooks() { return $this->webhooks; } /** * Append Webhooks to the list. * * @param \PayPal\Api\Webhook $webhook * @return $this */ public function addWebhook($webhook) { if (!$this->getWebhooks()) { return $this->setWebhooks(array($webhook)); } else { return $this->setWebhooks( array_merge($this->getWebhooks(), array($webhook)) ); } } /** * Remove Webhooks from the list. * * @param \PayPal\Api\Webhook $webhook * @return $this */ public function removeWebhook($webhook) { return $this->setWebhooks( array_diff($this->getWebhooks(), array($webhook)) ); } } rest-api-sdk-php/lib/PayPal/Api/ChargeModel.php 0000644 00000003042 15213403564 0015166 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class ChargeModel * * A resource representing a charge model for a payment definition. * * @package PayPal\Api * * @property string id * @property string type * @property \PayPal\Api\Currency amount */ class ChargeModel extends PayPalModel { /** * Identifier of the charge model. 128 characters max. * * @param string $id * * @return $this */ public function setId($id) { $this->id = $id; return $this; } /** * Identifier of the charge model. 128 characters max. * * @return string */ public function getId() { return $this->id; } /** * Type of charge model. Allowed values: `SHIPPING`, `TAX`. * * @param string $type * * @return $this */ public function setType($type) { $this->type = $type; return $this; } /** * Type of charge model. Allowed values: `SHIPPING`, `TAX`. * * @return string */ public function getType() { return $this->type; } /** * Specific amount for this charge model. * * @param \PayPal\Api\Currency $amount * * @return $this */ public function setAmount($amount) { $this->amount = $amount; return $this; } /** * Specific amount for this charge model. * * @return \PayPal\Api\Currency */ public function getAmount() { return $this->amount; } } rest-api-sdk-php/lib/PayPal/Api/ShippingInfo.php 0000644 00000005700 15213403564 0015414 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class ShippingInfo * * Shipping information for the invoice recipient. * * @package PayPal\Api * * @property string first_name * @property string last_name * @property string business_name * @property \PayPal\Api\Phone phone * @property \PayPal\Api\InvoiceAddress address */ class ShippingInfo extends PayPalModel { /** * The invoice recipient first name. Maximum length is 30 characters. * * @param string $first_name * * @return $this */ public function setFirstName($first_name) { $this->first_name = $first_name; return $this; } /** * The invoice recipient first name. Maximum length is 30 characters. * * @return string */ public function getFirstName() { return $this->first_name; } /** * The invoice recipient last name. Maximum length is 30 characters. * * @param string $last_name * * @return $this */ public function setLastName($last_name) { $this->last_name = $last_name; return $this; } /** * The invoice recipient last name. Maximum length is 30 characters. * * @return string */ public function getLastName() { return $this->last_name; } /** * The invoice recipient company business name. Maximum length is 100 characters. * * @param string $business_name * * @return $this */ public function setBusinessName($business_name) { $this->business_name = $business_name; return $this; } /** * The invoice recipient company business name. Maximum length is 100 characters. * * @return string */ public function getBusinessName() { return $this->business_name; } /** * * * @param \PayPal\Api\Phone $phone * @return $this */ public function setPhone($phone) { $this->phone = $phone; return $this; } /** * * * @return \PayPal\Api\Phone */ public function getPhone() { return $this->phone; } /** * @deprecated Not used anymore * * @param string $email * @return $this */ public function setEmail($email) { $this->email = $email; return $this; } /** * @deprecated Not used anymore * * @return string */ public function getEmail() { return $this->email; } /** * Address of the invoice recipient. * * @param \PayPal\Api\InvoiceAddress $address * * @return $this */ public function setAddress($address) { $this->address = $address; return $this; } /** * The invoice recipient address. * * @return \PayPal\Api\InvoiceAddress */ public function getAddress() { return $this->address; } } rest-api-sdk-php/lib/PayPal/Api/Order.php 0000644 00000032406 15213403564 0014075 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalResourceModel; use PayPal\Validation\ArgumentValidator; use PayPal\Rest\ApiContext; /** * Class Order * * An order transaction. * * @package PayPal\Api * * @property string id * @property string reference_id * @property \PayPal\Api\Amount amount * @property string payment_mode * @property string state * @property string reason_code * @property string pending_reason * @property string protection_eligibility * @property string protection_eligibility_type * @property string parent_payment * @property \PayPal\Api\FmfDetails fmf_details * @property string create_time * @property string update_time * @property \PayPal\Api\Links[] links */ class Order extends PayPalResourceModel { /** * Identifier of the order transaction. * * @param string $id * * @return $this */ public function setId($id) { $this->id = $id; return $this; } /** * Identifier of the order transaction. * * @return string */ public function getId() { return $this->id; } /** * Identifier to the purchase unit associated with this object. Obsolete. Use one in cart_base. * * @deprecated Use #setReferenceId instead * * @param string $purchase_unit_reference_id * * @return $this */ public function setPurchaseUnitReferenceId($purchase_unit_reference_id) { $this->purchase_unit_reference_id = $purchase_unit_reference_id; return $this; } /** * Identifier to the purchase unit associated with this object. Obsolete. Use one in cart_base. * @deprecated Use #getReferenceId instead * * @return string */ public function getPurchaseUnitReferenceId() { return $this->purchase_unit_reference_id; } /** * Identifier to the purchase unit associated with this object. Obsolete. Use one in cart_base. * * @param string $reference_id * * @return $this */ public function setReferenceId($reference_id) { $this->reference_id = $reference_id; return $this; } /** * Identifier to the purchase unit associated with this object. Obsolete. Use one in cart_base. * * @return string */ public function getReferenceId() { return $this->reference_id; } /** * Amount being collected. * * @param \PayPal\Api\Amount $amount * * @return $this */ public function setAmount($amount) { $this->amount = $amount; return $this; } /** * Amount being collected. * * @return \PayPal\Api\Amount */ public function getAmount() { return $this->amount; } /** * specifies payment mode of the transaction * Valid Values: ["INSTANT_TRANSFER", "MANUAL_BANK_TRANSFER", "DELAYED_TRANSFER", "ECHECK"] * * @param string $payment_mode * * @return $this */ public function setPaymentMode($payment_mode) { $this->payment_mode = $payment_mode; return $this; } /** * specifies payment mode of the transaction * * @return string */ public function getPaymentMode() { return $this->payment_mode; } /** * State of the order transaction. * Valid Values: ["pending", "completed", "voided", "authorized", "captured"] * * @param string $state * * @return $this */ public function setState($state) { $this->state = $state; return $this; } /** * State of the order transaction. * * @return string */ public function getState() { return $this->state; } /** * Reason code for the transaction state being Pending or Reversed. This field will replace pending_reason field eventually. Only supported when the `payment_method` is set to `paypal`. * Valid Values: ["PAYER_SHIPPING_UNCONFIRMED", "MULTI_CURRENCY", "RISK_REVIEW", "REGULATORY_REVIEW", "VERIFICATION_REQUIRED", "ORDER", "OTHER"] * * @param string $reason_code * * @return $this */ public function setReasonCode($reason_code) { $this->reason_code = $reason_code; return $this; } /** * Reason code for the transaction state being Pending or Reversed. This field will replace pending_reason field eventually. Only supported when the `payment_method` is set to `paypal`. * * @return string */ public function getReasonCode() { return $this->reason_code; } /** * [DEPRECATED] Reason code for the transaction state being Pending. Obsolete. Retained for backward compatability. Use reason_code field above instead. * Valid Values: ["payer_shipping_unconfirmed", "multi_currency", "risk_review", "regulatory_review", "verification_required", "order", "other"] * * @param string $pending_reason * * @return $this */ public function setPendingReason($pending_reason) { $this->pending_reason = $pending_reason; return $this; } /** * @deprecated [DEPRECATED] Reason code for the transaction state being Pending. Obsolete. Retained for backward compatability. Use reason_code field above instead. * * @return string */ public function getPendingReason() { return $this->pending_reason; } /** * The level of seller protection in force for the transaction. * Valid Values: ["ELIGIBLE", "PARTIALLY_ELIGIBLE", "INELIGIBLE"] * * @param string $protection_eligibility * * @return $this */ public function setProtectionEligibility($protection_eligibility) { $this->protection_eligibility = $protection_eligibility; return $this; } /** * The level of seller protection in force for the transaction. * * @return string */ public function getProtectionEligibility() { return $this->protection_eligibility; } /** * The kind of seller protection in force for the transaction. This property is returned only when the `protection_eligibility` property is set to `ELIGIBLE`or `PARTIALLY_ELIGIBLE`. Only supported when the `payment_method` is set to `paypal`. Allowed values:<br> `ITEM_NOT_RECEIVED_ELIGIBLE`- Sellers are protected against claims for items not received.<br> `UNAUTHORIZED_PAYMENT_ELIGIBLE`- Sellers are protected against claims for unauthorized payments.<br> One or both of the allowed values can be returned. * Valid Values: ["ITEM_NOT_RECEIVED_ELIGIBLE", "UNAUTHORIZED_PAYMENT_ELIGIBLE", "ITEM_NOT_RECEIVED_ELIGIBLE,UNAUTHORIZED_PAYMENT_ELIGIBLE"] * * @param string $protection_eligibility_type * * @return $this */ public function setProtectionEligibilityType($protection_eligibility_type) { $this->protection_eligibility_type = $protection_eligibility_type; return $this; } /** * The kind of seller protection in force for the transaction. This property is returned only when the `protection_eligibility` property is set to `ELIGIBLE`or `PARTIALLY_ELIGIBLE`. Only supported when the `payment_method` is set to `paypal`. Allowed values:<br> `ITEM_NOT_RECEIVED_ELIGIBLE`- Sellers are protected against claims for items not received.<br> `UNAUTHORIZED_PAYMENT_ELIGIBLE`- Sellers are protected against claims for unauthorized payments.<br> One or both of the allowed values can be returned. * * @return string */ public function getProtectionEligibilityType() { return $this->protection_eligibility_type; } /** * ID of the Payment resource that this transaction is based on. * * @param string $parent_payment * * @return $this */ public function setParentPayment($parent_payment) { $this->parent_payment = $parent_payment; return $this; } /** * ID of the Payment resource that this transaction is based on. * * @return string */ public function getParentPayment() { return $this->parent_payment; } /** * Fraud Management Filter (FMF) details applied for the payment that could result in accept/deny/pending action. * * @param \PayPal\Api\FmfDetails $fmf_details * * @return $this */ public function setFmfDetails($fmf_details) { $this->fmf_details = $fmf_details; return $this; } /** * Fraud Management Filter (FMF) details applied for the payment that could result in accept/deny/pending action. * * @return \PayPal\Api\FmfDetails */ public function getFmfDetails() { return $this->fmf_details; } /** * Time the resource was created in UTC ISO8601 format. * * @param string $create_time * * @return $this */ public function setCreateTime($create_time) { $this->create_time = $create_time; return $this; } /** * Time the resource was created in UTC ISO8601 format. * * @return string */ public function getCreateTime() { return $this->create_time; } /** * Time the resource was last updated in UTC ISO8601 format. * * @param string $update_time * * @return $this */ public function setUpdateTime($update_time) { $this->update_time = $update_time; return $this; } /** * Time the resource was last updated in UTC ISO8601 format. * * @return string */ public function getUpdateTime() { return $this->update_time; } /** * Shows details for an order, by ID. * * @param string $orderId * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return Order */ public static function get($orderId, $apiContext = null, $restCall = null) { ArgumentValidator::validate($orderId, 'orderId'); $payLoad = ""; $json = self::executeCall( "/v1/payments/orders/$orderId", "GET", $payLoad, null, $apiContext, $restCall ); $ret = new Order(); $ret->fromJson($json); return $ret; } /** * Captures a payment for an order, by ID. To use this call, the original payment call must specify an intent of `order`. In the JSON request body, include the payment amount and indicate whether this capture is the final capture for the authorization. * * @param Capture $capture * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return Capture */ public function capture($capture, $apiContext = null, $restCall = null) { ArgumentValidator::validate($this->getId(), "Id"); ArgumentValidator::validate($capture, 'capture'); $payLoad = $capture->toJSON(); $json = self::executeCall( "/v1/payments/orders/{$this->getId()}/capture", "POST", $payLoad, null, $apiContext, $restCall ); $ret = new Capture(); $ret->fromJson($json); return $ret; } /** * Voids, or cancels, an order, by ID. You cannot void an order if a payment has already been partially or fully captured. * * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return Order */ public function void($apiContext = null, $restCall = null) { ArgumentValidator::validate($this->getId(), "Id"); $payLoad = ""; $json = self::executeCall( "/v1/payments/orders/{$this->getId()}/do-void", "POST", $payLoad, null, $apiContext, $restCall ); $this->fromJson($json); return $this; } /** * Authorizes an order, by ID. Include an `amount` object in the JSON request body. * * @param Authorization $authorization Authorization Object with Amount value to be authorized * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return Authorization */ public function authorize($authorization, $apiContext = null, $restCall = null) { ArgumentValidator::validate($this->getId(), "Id"); ArgumentValidator::validate($authorization, 'Authorization'); $payLoad = $authorization->toJSON(); $json = self::executeCall( "/v1/payments/orders/{$this->getId()}/authorize", "POST", $payLoad, null, $apiContext, $restCall ); $ret = new Authorization(); $ret->fromJson($json); return $ret; } } rest-api-sdk-php/lib/PayPal/Api/Refund.php 0000644 00000015754 15213403564 0014254 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalResourceModel; use PayPal\Validation\ArgumentValidator; use PayPal\Rest\ApiContext; /** * Class Refund * * A refund transaction. * * @package PayPal\Api * * @property string id * @property \PayPal\Api\Amount amount * @property string state * @property string reason * @property string invoice_number * @property string sale_id * @property string capture_id * @property string parent_payment * @property string description * @property string create_time * @property string update_time * @property string reason_code * @property \PayPal\Api\Links[] links */ class Refund extends PayPalResourceModel { /** * ID of the refund transaction. 17 characters max. * * @param string $id * * @return $this */ public function setId($id) { $this->id = $id; return $this; } /** * ID of the refund transaction. 17 characters max. * * @return string */ public function getId() { return $this->id; } /** * Details including both refunded amount (to payer) and refunded fee (to payee). 10 characters max. * * @param \PayPal\Api\Amount $amount * * @return $this */ public function setAmount($amount) { $this->amount = $amount; return $this; } /** * Details including both refunded amount (to payer) and refunded fee (to payee). 10 characters max. * * @return \PayPal\Api\Amount */ public function getAmount() { return $this->amount; } /** * State of the refund. * Valid Values: ["pending", "completed", "failed"] * * @param string $state * * @return $this */ public function setState($state) { $this->state = $state; return $this; } /** * State of the refund. * * @return string */ public function getState() { return $this->state; } /** * Reason description for the Sale transaction being refunded. * * @param string $reason * * @return $this */ public function setReason($reason) { $this->reason = $reason; return $this; } /** * Reason description for the Sale transaction being refunded. * * @return string */ public function getReason() { return $this->reason; } /** * Your own invoice or tracking ID number. Character length and limitations: 127 single-byte alphanumeric characters. * * @param string $invoice_number * * @return $this */ public function setInvoiceNumber($invoice_number) { $this->invoice_number = $invoice_number; return $this; } /** * Your own invoice or tracking ID number. Character length and limitations: 127 single-byte alphanumeric characters. * * @return string */ public function getInvoiceNumber() { return $this->invoice_number; } /** * ID of the Sale transaction being refunded. * * @param string $sale_id * * @return $this */ public function setSaleId($sale_id) { $this->sale_id = $sale_id; return $this; } /** * ID of the Sale transaction being refunded. * * @return string */ public function getSaleId() { return $this->sale_id; } /** * ID of the sale transaction being refunded. * * @param string $capture_id * * @return $this */ public function setCaptureId($capture_id) { $this->capture_id = $capture_id; return $this; } /** * ID of the sale transaction being refunded. * * @return string */ public function getCaptureId() { return $this->capture_id; } /** * ID of the payment resource on which this transaction is based. * * @param string $parent_payment * * @return $this */ public function setParentPayment($parent_payment) { $this->parent_payment = $parent_payment; return $this; } /** * ID of the payment resource on which this transaction is based. * * @return string */ public function getParentPayment() { return $this->parent_payment; } /** * Description of what is being refunded for. * * @param string $description * * @return $this */ public function setDescription($description) { $this->description = $description; return $this; } /** * Description of what is being refunded for. * * @return string */ public function getDescription() { return $this->description; } /** * Time of refund as defined in [RFC 3339 Section 5.6](http://tools.ietf.org/html/rfc3339#section-5.6). * * @param string $create_time * * @return $this */ public function setCreateTime($create_time) { $this->create_time = $create_time; return $this; } /** * Time of refund as defined in [RFC 3339 Section 5.6](http://tools.ietf.org/html/rfc3339#section-5.6). * * @return string */ public function getCreateTime() { return $this->create_time; } /** * Time that the resource was last updated. * * @param string $update_time * * @return $this */ public function setUpdateTime($update_time) { $this->update_time = $update_time; return $this; } /** * Time that the resource was last updated. * * @return string */ public function getUpdateTime() { return $this->update_time; } /** * The reason code for the refund state being pending * Valid Values: ["ECHECK"] * * @param string $reason_code * * @return $this */ public function setReasonCode($reason_code) { $this->reason_code = $reason_code; return $this; } /** * The reason code for the refund state being pending * * @return string */ public function getReasonCode() { return $this->reason_code; } /** * Shows details for a refund, by ID. * * @param string $refundId * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return Refund */ public static function get($refundId, $apiContext = null, $restCall = null) { ArgumentValidator::validate($refundId, 'refundId'); $payLoad = ""; $json = self::executeCall( "/v1/payments/refund/$refundId", "GET", $payLoad, null, $apiContext, $restCall ); $ret = new Refund(); $ret->fromJson($json); return $ret; } } rest-api-sdk-php/lib/PayPal/Api/Billing.php 0000644 00000001432 15213403564 0014375 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class Billing * * Billing instrument used to charge the payer. * * @package PayPal\Api * * @deprecated Used internally only. * * @property string billing_agreement_id */ class Billing extends PayPalModel { /** * Identifier of the instrument in PayPal Wallet * * @param string $billing_agreement_id * * @return $this */ public function setBillingAgreementId($billing_agreement_id) { $this->billing_agreement_id = $billing_agreement_id; return $this; } /** * Identifier of the instrument in PayPal Wallet * * @return string */ public function getBillingAgreementId() { return $this->billing_agreement_id; } } rest-api-sdk-php/lib/PayPal/Api/Invoice.php 0000644 00000110260 15213403564 0014411 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalResourceModel; use PayPal\Rest\ApiContext; use PayPal\Transport\PayPalRestCall; use PayPal\Validation\ArgumentValidator; use PayPal\Validation\UrlValidator; /** * Class Invoice * * Detailed invoice information. * * @package PayPal\Api * * @property string id * @property string number * @property string template_id * @property string uri * @property string status * @property \PayPal\Api\MerchantInfo merchant_info * @property \PayPal\Api\BillingInfo[] billing_info * @property \PayPal\Api\Participant[] cc_info * @property \PayPal\Api\ShippingInfo shipping_info * @property \PayPal\Api\InvoiceItem[] items * @property string invoice_date * @property \PayPal\Api\PaymentTerm payment_term * @property string reference * @property \PayPal\Api\Cost discount * @property \PayPal\Api\ShippingCost shipping_cost * @property \PayPal\Api\CustomAmount custom * @property bool allow_partial_payment * @property \PayPal\Api\Currency minimum_amount_due * @property bool tax_calculated_after_discount * @property bool tax_inclusive * @property string terms * @property string note * @property string merchant_memo * @property string logo_url * @property \PayPal\Api\Currency total_amount * @property \PayPal\Api\PaymentDetail[] payments * @property \PayPal\Api\RefundDetail[] refunds * @property \PayPal\Api\Metadata metadata * @property \PayPal\Api\PaymentSummary paid_amount * @property \PayPal\Api\PaymentSummary refunded_amount * @property \PayPal\Api\FileAttachment[] attachments */ class Invoice extends PayPalResourceModel { /** * The unique invoice resource identifier. * * @param string $id * * @return $this */ public function setId($id) { $this->id = $id; return $this; } /** * The unique invoice resource identifier. * * @return string */ public function getId() { return $this->id; } /** * Unique number that appears on the invoice. If left blank will be auto-incremented from the last number. 25 characters max. * * @param string $number * * @return $this */ public function setNumber($number) { $this->number = $number; return $this; } /** * Unique number that appears on the invoice. If left blank will be auto-incremented from the last number. 25 characters max. * * @return string */ public function getNumber() { return $this->number; } /** * The template ID used for the invoice. Useful for copy functionality. * * @param string $template_id * * @return $this */ public function setTemplateId($template_id) { $this->template_id = $template_id; return $this; } /** * The template ID used for the invoice. Useful for copy functionality. * * @return string */ public function getTemplateId() { return $this->template_id; } /** * URI of the invoice resource. * * @param string $uri * * @return $this */ public function setUri($uri) { $this->uri = $uri; return $this; } /** * URI of the invoice resource. * * @return string */ public function getUri() { return $this->uri; } /** * Status of the invoice. * Valid Values: ["DRAFT", "SENT", "PAID", "MARKED_AS_PAID", "CANCELLED", "REFUNDED", "PARTIALLY_REFUNDED", "MARKED_AS_REFUNDED", "UNPAID", "PAYMENT_PENDING"] * * @param string $status * * @return $this */ public function setStatus($status) { $this->status = $status; return $this; } /** * Status of the invoice. * * @return string */ public function getStatus() { return $this->status; } /** * Information about the merchant who is sending the invoice. * * @param \PayPal\Api\MerchantInfo $merchant_info * * @return $this */ public function setMerchantInfo($merchant_info) { $this->merchant_info = $merchant_info; return $this; } /** * Information about the merchant who is sending the invoice. * * @return \PayPal\Api\MerchantInfo */ public function getMerchantInfo() { return $this->merchant_info; } /** * The required invoice recipient email address and any optional billing information. One recipient is supported. * * @param \PayPal\Api\BillingInfo[] $billing_info * * @return $this */ public function setBillingInfo($billing_info) { $this->billing_info = $billing_info; return $this; } /** * The required invoice recipient email address and any optional billing information. One recipient is supported. * * @return \PayPal\Api\BillingInfo[] */ public function getBillingInfo() { return $this->billing_info; } /** * Append BillingInfo to the list. * * @param \PayPal\Api\BillingInfo $billingInfo * @return $this */ public function addBillingInfo($billingInfo) { if (!$this->getBillingInfo()) { return $this->setBillingInfo(array($billingInfo)); } else { return $this->setBillingInfo( array_merge($this->getBillingInfo(), array($billingInfo)) ); } } /** * Remove BillingInfo from the list. * * @param \PayPal\Api\BillingInfo $billingInfo * @return $this */ public function removeBillingInfo($billingInfo) { return $this->setBillingInfo( array_diff($this->getBillingInfo(), array($billingInfo)) ); } /** * For invoices sent by email, one or more email addresses to which to send a Cc: copy of the notification. Supports only email addresses under participant. * * @param \PayPal\Api\Participant[] $cc_info * * @return $this */ public function setCcInfo($cc_info) { $this->cc_info = $cc_info; return $this; } /** * For invoices sent by email, one or more email addresses to which to send a Cc: copy of the notification. Supports only email addresses under participant. * * @return \PayPal\Api\Participant[] */ public function getCcInfo() { return $this->cc_info; } /** * Append CcInfo to the list. * * @param \PayPal\Api\Participant $participant * @return $this */ public function addCcInfo($participant) { if (!$this->getCcInfo()) { return $this->setCcInfo(array($participant)); } else { return $this->setCcInfo( array_merge($this->getCcInfo(), array($participant)) ); } } /** * Remove CcInfo from the list. * * @param \PayPal\Api\Participant $participant * @return $this */ public function removeCcInfo($participant) { return $this->setCcInfo( array_diff($this->getCcInfo(), array($participant)) ); } /** * The shipping information for entities to whom items are being shipped. * * @param \PayPal\Api\ShippingInfo $shipping_info * * @return $this */ public function setShippingInfo($shipping_info) { $this->shipping_info = $shipping_info; return $this; } /** * The shipping information for entities to whom items are being shipped. * * @return \PayPal\Api\ShippingInfo */ public function getShippingInfo() { return $this->shipping_info; } /** * The list of items to include in the invoice. Maximum value is 100 items per invoice. * * @param \PayPal\Api\InvoiceItem[] $items * * @return $this */ public function setItems($items) { $this->items = $items; return $this; } /** * The list of items to include in the invoice. Maximum value is 100 items per invoice. * * @return \PayPal\Api\InvoiceItem[] */ public function getItems() { return $this->items; } /** * Append Items to the list. * * @param \PayPal\Api\InvoiceItem $invoiceItem * @return $this */ public function addItem($invoiceItem) { if (!$this->getItems()) { return $this->setItems(array($invoiceItem)); } else { return $this->setItems( array_merge($this->getItems(), array($invoiceItem)) ); } } /** * Remove Items from the list. * * @param \PayPal\Api\InvoiceItem $invoiceItem * @return $this */ public function removeItem($invoiceItem) { return $this->setItems( array_diff($this->getItems(), array($invoiceItem)) ); } /** * The date when the invoice was enabled. The date format is *yyyy*-*MM*-*dd* *z* as defined in [Internet Date/Time Format](http://tools.ietf.org/html/rfc3339#section-5.6). * * @param string $invoice_date * * @return $this */ public function setInvoiceDate($invoice_date) { $this->invoice_date = $invoice_date; return $this; } /** * The date when the invoice was enabled. The date format is *yyyy*-*MM*-*dd* *z* as defined in [Internet Date/Time Format](http://tools.ietf.org/html/rfc3339#section-5.6). * * @return string */ public function getInvoiceDate() { return $this->invoice_date; } /** * Optional. The payment deadline for the invoice. Value is either `term_type` or `due_date` but not both. * * @param \PayPal\Api\PaymentTerm $payment_term * * @return $this */ public function setPaymentTerm($payment_term) { $this->payment_term = $payment_term; return $this; } /** * Optional. The payment deadline for the invoice. Value is either `term_type` or `due_date` but not both. * * @return \PayPal\Api\PaymentTerm */ public function getPaymentTerm() { return $this->payment_term; } /** * Reference data, such as PO number, to add to the invoice. Maximum length is 60 characters. * * @param string $reference * * @return $this */ public function setReference($reference) { $this->reference = $reference; return $this; } /** * Reference data, such as PO number, to add to the invoice. Maximum length is 60 characters. * * @return string */ public function getReference() { return $this->reference; } /** * The invoice level discount, as a percent or an amount value. * * @param \PayPal\Api\Cost $discount * * @return $this */ public function setDiscount($discount) { $this->discount = $discount; return $this; } /** * The invoice level discount, as a percent or an amount value. * * @return \PayPal\Api\Cost */ public function getDiscount() { return $this->discount; } /** * The shipping cost, as a percent or an amount value. * * @param \PayPal\Api\ShippingCost $shipping_cost * * @return $this */ public function setShippingCost($shipping_cost) { $this->shipping_cost = $shipping_cost; return $this; } /** * The shipping cost, as a percent or an amount value. * * @return \PayPal\Api\ShippingCost */ public function getShippingCost() { return $this->shipping_cost; } /** * The custom amount to apply on an invoice. If you include a label, the amount cannot be empty. * * @param \PayPal\Api\CustomAmount $custom * * @return $this */ public function setCustom($custom) { $this->custom = $custom; return $this; } /** * The custom amount to apply on an invoice. If you include a label, the amount cannot be empty. * * @return \PayPal\Api\CustomAmount */ public function getCustom() { return $this->custom; } /** * Indicates whether the invoice allows a partial payment. If set to `false`, invoice must be paid in full. If set to `true`, the invoice allows partial payments. Default is `false`. * * @param bool $allow_partial_payment * * @return $this */ public function setAllowPartialPayment($allow_partial_payment) { $this->allow_partial_payment = $allow_partial_payment; return $this; } /** * Indicates whether the invoice allows a partial payment. If set to `false`, invoice must be paid in full. If set to `true`, the invoice allows partial payments. Default is `false`. * * @return bool */ public function getAllowPartialPayment() { return $this->allow_partial_payment; } /** * If `allow_partial_payment` is set to `true`, the minimum amount allowed for a partial payment. * * @param \PayPal\Api\Currency $minimum_amount_due * * @return $this */ public function setMinimumAmountDue($minimum_amount_due) { $this->minimum_amount_due = $minimum_amount_due; return $this; } /** * If `allow_partial_payment` is set to `true`, the minimum amount allowed for a partial payment. * * @return \PayPal\Api\Currency */ public function getMinimumAmountDue() { return $this->minimum_amount_due; } /** * Indicates whether tax is calculated before or after a discount. If set to `false`, the tax is calculated before a discount. If set to `true`, the tax is calculated after a discount. Default is `false`. * * @param bool $tax_calculated_after_discount * * @return $this */ public function setTaxCalculatedAfterDiscount($tax_calculated_after_discount) { $this->tax_calculated_after_discount = $tax_calculated_after_discount; return $this; } /** * Indicates whether tax is calculated before or after a discount. If set to `false`, the tax is calculated before a discount. If set to `true`, the tax is calculated after a discount. Default is `false`. * * @return bool */ public function getTaxCalculatedAfterDiscount() { return $this->tax_calculated_after_discount; } /** * Indicates whether the unit price includes tax. Default is `false`. * * @param bool $tax_inclusive * * @return $this */ public function setTaxInclusive($tax_inclusive) { $this->tax_inclusive = $tax_inclusive; return $this; } /** * Indicates whether the unit price includes tax. Default is `false`. * * @return bool */ public function getTaxInclusive() { return $this->tax_inclusive; } /** * General terms of the invoice. 4000 characters max. * * @param string $terms * * @return $this */ public function setTerms($terms) { $this->terms = $terms; return $this; } /** * General terms of the invoice. 4000 characters max. * * @return string */ public function getTerms() { return $this->terms; } /** * Note to the payer. 4000 characters max. * * @param string $note * * @return $this */ public function setNote($note) { $this->note = $note; return $this; } /** * Note to the payer. 4000 characters max. * * @return string */ public function getNote() { return $this->note; } /** * A private bookkeeping memo for the merchant. Maximum length is 150 characters. * * @param string $merchant_memo * * @return $this */ public function setMerchantMemo($merchant_memo) { $this->merchant_memo = $merchant_memo; return $this; } /** * A private bookkeeping memo for the merchant. Maximum length is 150 characters. * * @return string */ public function getMerchantMemo() { return $this->merchant_memo; } /** * Full URL of an external image to use as the logo. Maximum length is 4000 characters. * * @param string $logo_url * @throws \InvalidArgumentException * @return $this */ public function setLogoUrl($logo_url) { UrlValidator::validate($logo_url, "LogoUrl"); $this->logo_url = $logo_url; return $this; } /** * Full URL of an external image to use as the logo. Maximum length is 4000 characters. * * @return string */ public function getLogoUrl() { return $this->logo_url; } /** * The total amount of the invoice. * * @param \PayPal\Api\Currency $total_amount * * @return $this */ public function setTotalAmount($total_amount) { $this->total_amount = $total_amount; return $this; } /** * The total amount of the invoice. * * @return \PayPal\Api\Currency */ public function getTotalAmount() { return $this->total_amount; } /** * List of payment details for the invoice. * * @param \PayPal\Api\PaymentDetail[] $payments * * @return $this */ public function setPayments($payments) { $this->payments = $payments; return $this; } /** * List of payment details for the invoice. * * @return \PayPal\Api\PaymentDetail[] */ public function getPayments() { return $this->payments; } /** * Append Payments to the list. * * @param \PayPal\Api\PaymentDetail $paymentDetail * @return $this */ public function addPayment($paymentDetail) { if (!$this->getPayments()) { return $this->setPayments(array($paymentDetail)); } else { return $this->setPayments( array_merge($this->getPayments(), array($paymentDetail)) ); } } /** * Remove Payments from the list. * * @param \PayPal\Api\PaymentDetail $paymentDetail * @return $this */ public function removePayment($paymentDetail) { return $this->setPayments( array_diff($this->getPayments(), array($paymentDetail)) ); } /** * List of refund details for the invoice. * * @param \PayPal\Api\RefundDetail[] $refunds * * @return $this */ public function setRefunds($refunds) { $this->refunds = $refunds; return $this; } /** * List of refund details for the invoice. * * @return \PayPal\Api\RefundDetail[] */ public function getRefunds() { return $this->refunds; } /** * Append Refunds to the list. * * @param \PayPal\Api\RefundDetail $refundDetail * @return $this */ public function addRefund($refundDetail) { if (!$this->getRefunds()) { return $this->setRefunds(array($refundDetail)); } else { return $this->setRefunds( array_merge($this->getRefunds(), array($refundDetail)) ); } } /** * Remove Refunds from the list. * * @param \PayPal\Api\RefundDetail $refundDetail * @return $this */ public function removeRefund($refundDetail) { return $this->setRefunds( array_diff($this->getRefunds(), array($refundDetail)) ); } /** * Audit information for the invoice. * * @param \PayPal\Api\Metadata $metadata * * @return $this */ public function setMetadata($metadata) { $this->metadata = $metadata; return $this; } /** * Audit information for the invoice. * * @return \PayPal\Api\Metadata */ public function getMetadata() { return $this->metadata; } /** * Any miscellaneous invoice data. Maximum length is 4000 characters. * @deprecated Not publicly available * @param string $additional_data * * @return $this */ public function setAdditionalData($additional_data) { $this->additional_data = $additional_data; return $this; } /** * Any miscellaneous invoice data. Maximum length is 4000 characters. * @deprecated Not publicly available * @return string */ public function getAdditionalData() { return $this->additional_data; } /** * Payment summary of the invoice including amount paid through PayPal and other sources. * * @param \PayPal\Api\PaymentSummary $paid_amount * * @return $this */ public function setPaidAmount($paid_amount) { $this->paid_amount = $paid_amount; return $this; } /** * Payment summary of the invoice including amount paid through PayPal and other sources. * * @return \PayPal\Api\PaymentSummary */ public function getPaidAmount() { return $this->paid_amount; } /** * Payment summary of the invoice including amount refunded through PayPal and other sources. * * @param \PayPal\Api\PaymentSummary $refunded_amount * * @return $this */ public function setRefundedAmount($refunded_amount) { $this->refunded_amount = $refunded_amount; return $this; } /** * Payment summary of the invoice including amount refunded through PayPal and other sources. * * @return \PayPal\Api\PaymentSummary */ public function getRefundedAmount() { return $this->refunded_amount; } /** * List of files attached to the invoice. * * @param \PayPal\Api\FileAttachment[] $attachments * * @return $this */ public function setAttachments($attachments) { $this->attachments = $attachments; return $this; } /** * List of files attached to the invoice. * * @return \PayPal\Api\FileAttachment[] */ public function getAttachments() { return $this->attachments; } /** * Append Attachments to the list. * * @param \PayPal\Api\FileAttachment $fileAttachment * @return $this */ public function addAttachment($fileAttachment) { if (!$this->getAttachments()) { return $this->setAttachments(array($fileAttachment)); } else { return $this->setAttachments( array_merge($this->getAttachments(), array($fileAttachment)) ); } } /** * Remove Attachments from the list. * * @param \PayPal\Api\FileAttachment $fileAttachment * @return $this */ public function removeAttachment($fileAttachment) { return $this->setAttachments( array_diff($this->getAttachments(), array($fileAttachment)) ); } /** * Creates an invoice. Include invoice details including merchant information in the request. * * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return Invoice */ public function create($apiContext = null, $restCall = null) { $payLoad = $this->toJSON(); $json = self::executeCall( "/v1/invoicing/invoices", "POST", $payLoad, null, $apiContext, $restCall ); $this->fromJson($json); return $this; } /** * Searches for an invoice or invoices. Include a search object that specifies your search criteria in the request. * * @param Search $search * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return InvoiceSearchResponse */ public static function search($search, $apiContext = null, $restCall = null) { ArgumentValidator::validate($search, 'search'); $payLoad = $search->toJSON(); $json = self::executeCall( "/v1/invoicing/search", "POST", $payLoad, null, $apiContext, $restCall ); $ret = new InvoiceSearchResponse(); $ret->fromJson($json); return $ret; } /** * Sends an invoice, by ID, to a recipient. Optionally, set the `notify_merchant` query parameter to send the merchant an invoice update notification. By default, `notify_merchant` is `true`. * * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return bool */ public function send($apiContext = null, $restCall = null) { ArgumentValidator::validate($this->getId(), "Id"); $payLoad = ""; self::executeCall( "/v1/invoicing/invoices/{$this->getId()}/send", "POST", $payLoad, null, $apiContext, $restCall ); return true; } /** * Sends a reminder about a specific invoice, by ID, to a recipient. Include a notification object that defines the reminder subject and other details in the JSON request body. * * @param Notification $notification * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return bool */ public function remind($notification, $apiContext = null, $restCall = null) { ArgumentValidator::validate($this->getId(), "Id"); ArgumentValidator::validate($notification, 'notification'); $payLoad = $notification->toJSON(); self::executeCall( "/v1/invoicing/invoices/{$this->getId()}/remind", "POST", $payLoad, null, $apiContext, $restCall ); return true; } /** * Cancels an invoice, by ID. * * @param CancelNotification $cancelNotification * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return bool */ public function cancel($cancelNotification, $apiContext = null, $restCall = null) { ArgumentValidator::validate($this->getId(), "Id"); ArgumentValidator::validate($cancelNotification, 'cancelNotification'); $payLoad = $cancelNotification->toJSON(); self::executeCall( "/v1/invoicing/invoices/{$this->getId()}/cancel", "POST", $payLoad, null, $apiContext, $restCall ); return true; } /** * Marks the status of a specified invoice, by ID, as paid. Include a payment detail object that defines the payment method and other details in the JSON request body. * * @param PaymentDetail $paymentDetail * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return bool */ public function recordPayment($paymentDetail, $apiContext = null, $restCall = null) { ArgumentValidator::validate($this->getId(), "Id"); ArgumentValidator::validate($paymentDetail, 'paymentDetail'); $payLoad = $paymentDetail->toJSON(); self::executeCall( "/v1/invoicing/invoices/{$this->getId()}/record-payment", "POST", $payLoad, null, $apiContext, $restCall ); return true; } /** * Marks the status of a specified invoice, by ID, as refunded. Include a refund detail object that defines the refund type and other details in the JSON request body. * * @param RefundDetail $refundDetail * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return bool */ public function recordRefund($refundDetail, $apiContext = null, $restCall = null) { ArgumentValidator::validate($this->getId(), "Id"); ArgumentValidator::validate($refundDetail, 'refundDetail'); $payLoad = $refundDetail->toJSON(); self::executeCall( "/v1/invoicing/invoices/{$this->getId()}/record-refund", "POST", $payLoad, null, $apiContext, $restCall ); return true; } /** * Gets the details for a specified invoice, by ID. * * @param string $invoiceId * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return Invoice */ public static function get($invoiceId, $apiContext = null, $restCall = null) { ArgumentValidator::validate($invoiceId, 'invoiceId'); $payLoad = ""; $json = self::executeCall( "/v1/invoicing/invoices/$invoiceId", "GET", $payLoad, null, $apiContext, $restCall ); $ret = new Invoice(); $ret->fromJson($json); return $ret; } /** * Lists some or all merchant invoices. Filters the response by any specified optional query string parameters. * * @param array $params * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return InvoiceSearchResponse */ public static function getAll($params = array(), $apiContext = null, $restCall = null) { ArgumentValidator::validate($params, 'params'); $allowedParams = array( 'page' => 1, 'page_size' => 1, 'total_count_required' => 1 ); $payLoad = ""; $json = self::executeCall( "/v1/invoicing/invoices/?" . http_build_query(array_intersect_key($params, $allowedParams)), "GET", $payLoad, null, $apiContext, $restCall ); $ret = new InvoiceSearchResponse(); $ret->fromJson($json); return $ret; } /** * Fully updates an invoice by passing the invoice ID to the request URI. In addition, pass a complete invoice object in the request JSON. Partial updates are not supported. * * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return Invoice */ public function update($apiContext = null, $restCall = null) { ArgumentValidator::validate($this->getId(), "Id"); $payLoad = $this->toJSON(); $json = self::executeCall( "/v1/invoicing/invoices/{$this->getId()}", "PUT", $payLoad, null, $apiContext, $restCall ); $this->fromJson($json); return $this; } /** * Delete a particular invoice by passing the invoice ID to the request URI. * * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return bool */ public function delete($apiContext = null, $restCall = null) { ArgumentValidator::validate($this->getId(), "Id"); $payLoad = ""; self::executeCall( "/v1/invoicing/invoices/{$this->getId()}", "DELETE", $payLoad, null, $apiContext, $restCall ); return true; } /** * Delete external payment. * * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return bool */ public function deleteExternalPayment($transactionId, $apiContext = null, $restCall = null) { ArgumentValidator::validate($this->getId(), "Id"); ArgumentValidator::validate($transactionId, "TransactionId"); $payLoad = ""; self::executeCall( "/v1/invoicing/invoices/{$this->getId()}/payment-records/{$transactionId}", "DELETE", $payLoad, null, $apiContext, $restCall ); return true; } /** * Delete external refund. * * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return bool */ public function deleteExternalRefund($transactionId, $apiContext = null, $restCall = null) { ArgumentValidator::validate($this->getId(), "Id"); ArgumentValidator::validate($transactionId, "TransactionId"); $payLoad = ""; self::executeCall( "/v1/invoicing/invoices/{$this->getId()}/refund-records/{$transactionId}", "DELETE", $payLoad, null, $apiContext, $restCall ); return true; } /** * Generate a QR code for an invoice by passing the invoice ID to the request URI. The request generates a QR code that is 500 pixels in width and height. You can change the dimensions of the returned code by specifying optional query parameters. * * @param array $params * @param string $invoiceId * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return Image */ public static function qrCode($invoiceId, $params = array(), $apiContext = null, $restCall = null) { ArgumentValidator::validate($invoiceId, 'invoiceId'); ArgumentValidator::validate($params, 'params'); $allowedParams = array( 'width' => 1, 'height' => 1, 'action' => 1 ); $payLoad = ""; $json = self::executeCall( "/v1/invoicing/invoices/$invoiceId/qr-code?" . http_build_query(array_intersect_key($params, $allowedParams)), "GET", $payLoad, null, $apiContext, $restCall ); $ret = new Image(); $ret->fromJson($json); return $ret; } /** * Generates the successive invoice number. * * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return InvoiceNumber */ public static function generateNumber($apiContext = null, $restCall = null) { $payLoad = ""; $json = self::executeCall( "/v1/invoicing/invoices/next-invoice-number", "POST", $payLoad, null, $apiContext, $restCall ); $ret = new InvoiceNumber(); $ret->fromJson($json); return $ret; } } rest-api-sdk-php/lib/PayPal/Api/Measurement.php 0000644 00000002064 15213403564 0015304 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class Measurement * * Measurement to represent item dimensions like length, width, height and weight etc. * * @package PayPal\Api * * @property string value * @property string unit */ class Measurement extends PayPalModel { /** * Value this measurement represents. * * @param string $value * * @return $this */ public function setValue($value) { $this->value = $value; return $this; } /** * Value this measurement represents. * * @return string */ public function getValue() { return $this->value; } /** * Unit in which the value is represented. * * @param string $unit * * @return $this */ public function setUnit($unit) { $this->unit = $unit; return $this; } /** * Unit in which the value is represented. * * @return string */ public function getUnit() { return $this->unit; } } rest-api-sdk-php/lib/PayPal/Api/TemplateSettingsMetadata.php 0000644 00000001301 15213403564 0017745 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class TemplateSettingsMetadata * * Settings Metadata per field in template * * @package PayPal\Api * * @property bool hidden */ class TemplateSettingsMetadata extends PayPalModel { /** * Indicates whether this field should be hidden. default is false * * @param bool $hidden * * @return $this */ public function setHidden($hidden) { $this->hidden = $hidden; return $this; } /** * Indicates whether this field should be hidden. default is false * * @return bool */ public function getHidden() { return $this->hidden; } } rest-api-sdk-php/lib/PayPal/Api/CreateProfileResponse.php 0000644 00000001133 15213403564 0017256 0 ustar 00 <?php namespace PayPal\Api; /** * Class CreateProfileResponse * * Response schema for create profile api * * @package PayPal\Api * * @property string id */ class CreateProfileResponse extends WebProfile { /** * ID of the payment web experience profile. * * * @param string $id * * @return $this */ public function setId($id) { $this->id = $id; return $this; } /** * ID of the payment web experience profile. * * @return string */ public function getId() { return $this->id; } } rest-api-sdk-php/lib/PayPal/Api/CreditCard.php 0000644 00000036066 15213403564 0015034 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalResourceModel; use PayPal\Rest\ApiContext; use PayPal\Transport\PayPalRestCall; use PayPal\Validation\ArgumentValidator; /** * Class CreditCard * * @package PayPal\Api * * @property string number * @property string type * @property int expire_month * @property int expire_year * @property string cvv2 * @property string first_name * @property string last_name * @property \PayPal\Api\Address billing_address * @property string external_customer_id * @property string state * @property string valid_until * @property \PayPal\Api\Links[] links */ class CreditCard extends PayPalResourceModel { /** * ID of the credit card. This ID is provided in the response when storing credit cards. **Required if using a stored credit card.** * * @deprecated Not publicly available * @param string $id * * @return $this */ public function setId($id) { $this->id = $id; return $this; } /** * ID of the credit card. This ID is provided in the response when storing credit cards. **Required if using a stored credit card.** * * @deprecated Not publicly available * @return string */ public function getId() { return $this->id; } /** * Credit card number. Numeric characters only with no spaces or punctuation. The string must conform with modulo and length required by each credit card type. *Redacted in responses.* * * @param string $number * * @return $this */ public function setNumber($number) { $this->number = $number; return $this; } /** * Credit card number. Numeric characters only with no spaces or punctuation. The string must conform with modulo and length required by each credit card type. *Redacted in responses.* * * @return string */ public function getNumber() { return $this->number; } /** * Credit card type. Valid types are: `visa`, `mastercard`, `discover`, `amex` * * @param string $type * * @return $this */ public function setType($type) { $this->type = $type; return $this; } /** * Credit card type. Valid types are: `visa`, `mastercard`, `discover`, `amex` * * @return string */ public function getType() { return $this->type; } /** * Expiration month with no leading zero. Acceptable values are 1 through 12. * * @param int $expire_month * * @return $this */ public function setExpireMonth($expire_month) { $this->expire_month = $expire_month; return $this; } /** * Expiration month with no leading zero. Acceptable values are 1 through 12. * * @return int */ public function getExpireMonth() { return $this->expire_month; } /** * 4-digit expiration year. * * @param int $expire_year * * @return $this */ public function setExpireYear($expire_year) { $this->expire_year = $expire_year; return $this; } /** * 4-digit expiration year. * * @return int */ public function getExpireYear() { return $this->expire_year; } /** * 3-4 digit card validation code. * * @param string $cvv2 * * @return $this */ public function setCvv2($cvv2) { $this->cvv2 = $cvv2; return $this; } /** * 3-4 digit card validation code. * * @return string */ public function getCvv2() { return $this->cvv2; } /** * Cardholder's first name. * * @param string $first_name * * @return $this */ public function setFirstName($first_name) { $this->first_name = $first_name; return $this; } /** * Cardholder's first name. * * @return string */ public function getFirstName() { return $this->first_name; } /** * Cardholder's last name. * * @param string $last_name * * @return $this */ public function setLastName($last_name) { $this->last_name = $last_name; return $this; } /** * Cardholder's last name. * * @return string */ public function getLastName() { return $this->last_name; } /** * Billing Address associated with this card. * * @param \PayPal\Api\Address $billing_address * * @return $this */ public function setBillingAddress($billing_address) { $this->billing_address = $billing_address; return $this; } /** * Billing Address associated with this card. * * @return \PayPal\Api\Address */ public function getBillingAddress() { return $this->billing_address; } /** * A unique identifier of the customer to whom this bank account belongs. Generated and provided by the facilitator. **This is now used in favor of `payer_id` when creating or using a stored funding instrument in the vault.** * * @param string $external_customer_id * * @return $this */ public function setExternalCustomerId($external_customer_id) { $this->external_customer_id = $external_customer_id; return $this; } /** * A unique identifier of the customer to whom this bank account belongs. Generated and provided by the facilitator. **This is now used in favor of `payer_id` when creating or using a stored funding instrument in the vault.** * * @return string */ public function getExternalCustomerId() { return $this->external_customer_id; } /** * A user provided, optional convenvience field that functions as a unique identifier for the merchant on behalf of whom this credit card is being stored for. Note that this has no relation to PayPal merchant id * * @param string $merchant_id * * @return $this */ public function setMerchantId($merchant_id) { $this->merchant_id = $merchant_id; return $this; } /** * A user provided, optional convenvience field that functions as a unique identifier for the merchant on behalf of whom this credit card is being stored for. Note that this has no relation to PayPal merchant id * * @return string */ public function getMerchantId() { return $this->merchant_id; } /** * A unique identifier that you can assign and track when storing a credit card or using a stored credit card. This ID can help to avoid unintentional use or misuse of credit cards. This ID can be any value you would like to associate with the saved card, such as a UUID, username, or email address. Required when using a stored credit card if a payer_id was originally provided when storing the credit card in vault. * * @deprecated This is being deprecated in favor of the `external_customer_id` property. * @param string $payer_id * * @return $this */ public function setPayerId($payer_id) { $this->payer_id = $payer_id; return $this; } /** * A unique identifier that you can assign and track when storing a credit card or using a stored credit card. This ID can help to avoid unintentional use or misuse of credit cards. This ID can be any value you would like to associate with the saved card, such as a UUID, username, or email address. Required when using a stored credit card if a payer_id was originally provided when storing the credit card in vault. * * @deprecated This is being deprecated in favor of the `external_customer_id` property. * @return string */ public function getPayerId() { return $this->payer_id; } /** * A unique identifier of the bank account resource. Generated and provided by the facilitator so it can be used to restrict the usage of the bank account to the specific merchant. * * @param string $external_card_id * * @return $this */ public function setExternalCardId($external_card_id) { $this->external_card_id = $external_card_id; return $this; } /** * A unique identifier of the bank account resource. Generated and provided by the facilitator so it can be used to restrict the usage of the bank account to the specific merchant. * * @return string */ public function getExternalCardId() { return $this->external_card_id; } /** * State of the credit card funding instrument. * Valid Values: ["expired", "ok"] * * @param string $state * * @return $this */ public function setState($state) { $this->state = $state; return $this; } /** * State of the credit card funding instrument. * * @return string */ public function getState() { return $this->state; } /** * Funding instrument expiration date. * * @param string $create_time * * @return $this */ public function setCreateTime($create_time) { $this->create_time = $create_time; return $this; } /** * Resource creation time as ISO8601 date-time format (ex: 1994-11-05T13:15:30Z) that indicates creation time. * * @return string */ public function getCreateTime() { return $this->create_time; } /** * Resource creation time as ISO8601 date-time format (ex: 1994-11-05T13:15:30Z) that indicates the updation time. * * @param string $update_time * * @return $this */ public function setUpdateTime($update_time) { $this->update_time = $update_time; return $this; } /** * Resource creation time as ISO8601 date-time format (ex: 1994-11-05T13:15:30Z) that indicates the updation time. * * @return string */ public function getUpdateTime() { return $this->update_time; } /** * Date/Time until this resource can be used fund a payment. * * @param string $valid_until * * @return $this */ public function setValidUntil($valid_until) { $this->valid_until = $valid_until; return $this; } /** * Funding instrument expiration date. * * @return string */ public function getValidUntil() { return $this->valid_until; } /** * Creates a new Credit Card Resource (aka Tokenize). * * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return CreditCard */ public function create($apiContext = null, $restCall = null) { $payLoad = $this->toJSON(); $json = self::executeCall( "/v1/vault/credit-cards", "POST", $payLoad, null, $apiContext, $restCall ); $this->fromJson($json); return $this; } /** * Obtain the Credit Card resource for the given identifier. * * @param string $creditCardId * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return CreditCard */ public static function get($creditCardId, $apiContext = null, $restCall = null) { ArgumentValidator::validate($creditCardId, 'creditCardId'); $payLoad = ""; $json = self::executeCall( "/v1/vault/credit-cards/$creditCardId", "GET", $payLoad, null, $apiContext, $restCall ); $ret = new CreditCard(); $ret->fromJson($json); return $ret; } /** * Delete the Credit Card resource for the given identifier. * * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return bool */ public function delete($apiContext = null, $restCall = null) { ArgumentValidator::validate($this->getId(), "Id"); $payLoad = ""; self::executeCall( "/v1/vault/credit-cards/{$this->getId()}", "DELETE", $payLoad, null, $apiContext, $restCall ); return true; } /** * Update information in a previously saved card. Only the modified fields need to be passed in the request. * * @param PatchRequest $patchRequest * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return CreditCard */ public function update($patchRequest, $apiContext = null, $restCall = null) { ArgumentValidator::validate($this->getId(), "Id"); ArgumentValidator::validate($patchRequest, 'patch'); $payload = $patchRequest->toJSON(); $json = self::executeCall( "/v1/vault/credit-cards/{$this->getId()}", "PATCH", $payload, null, $apiContext, $restCall ); $this->fromJson($json); return $this; } /** * Retrieves a list of Credit Card resources. * * @param array $params * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return CreditCardList */ public static function all($params, $apiContext = null, $restCall = null) { if (is_null($params)) { $params = array(); } ArgumentValidator::validate($params, 'params'); $payLoad = ""; $allowedParams = array( 'page_size' => 1, 'page' => 1, 'start_time' => 1, 'end_time' => 1, 'sort_order' => 1, 'sort_by' => 1, 'merchant_id' => 1, 'external_card_id' => 1, 'external_customer_id' => 1, 'total_required' => 1 ); $json = self::executeCall( "/v1/vault/credit-cards" . "?" . http_build_query(array_intersect_key($params, $allowedParams)), "GET", $payLoad, null, $apiContext, $restCall ); $ret = new CreditCardList(); $ret->fromJson($json); return $ret; } } rest-api-sdk-php/lib/PayPal/Api/Payer.php 0000644 00000017226 15213403564 0014105 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class Payer * * A resource representing a Payer that funds a payment. * * @package PayPal\Api * * @property string payment_method * @property string status * @property \PayPal\Api\FundingInstrument[] funding_instruments * @property string external_selected_funding_instrument_type * @property \PayPal\Api\PayerInfo payer_info */ class Payer extends PayPalModel { /** * Payment method being used. "credit_card" is not available for general use. * Please ensure that you have acquired the approval for using "credit_card" for your live * credentials. * Valid Values: ["credit_card", "paypal"] * * @param string $payment_method * * @return $this */ public function setPaymentMethod($payment_method) { $this->payment_method = $payment_method; return $this; } /** * Payment method being used - PayPal Wallet payment, Bank Direct Debit or Direct Credit card. * * @return string */ public function getPaymentMethod() { return $this->payment_method; } /** * Status of payer's PayPal Account. * Valid Values: ["VERIFIED", "UNVERIFIED"] * * @param string $status * * @return $this */ public function setStatus($status) { $this->status = $status; return $this; } /** * Status of payer's PayPal Account. * * @return string */ public function getStatus() { return $this->status; } /** * Type of account relationship payer has with PayPal. * Valid Values: ["BUSINESS", "PERSONAL", "PREMIER"] * @deprecated Not publicly available * @param string $account_type * * @return $this */ public function setAccountType($account_type) { $this->account_type = $account_type; return $this; } /** * Type of account relationship payer has with PayPal. * @deprecated Not publicly available * @return string */ public function getAccountType() { return $this->account_type; } /** * Duration since the payer established account relationship with PayPal in days. * @deprecated Not publicly available * @param string $account_age * * @return $this */ public function setAccountAge($account_age) { $this->account_age = $account_age; return $this; } /** * Duration since the payer established account relationship with PayPal in days. * @deprecated Not publicly available * @return string */ public function getAccountAge() { return $this->account_age; } /** * List of funding instruments to fund the payment. 'OneOf' funding_instruments,funding_option_id to be used to identify the specifics of payment method passed. * * @param \PayPal\Api\FundingInstrument[] $funding_instruments * * @return $this */ public function setFundingInstruments($funding_instruments) { $this->funding_instruments = $funding_instruments; return $this; } /** * List of funding instruments to fund the payment. 'OneOf' funding_instruments,funding_option_id to be used to identify the specifics of payment method passed. * * @return \PayPal\Api\FundingInstrument[] */ public function getFundingInstruments() { return $this->funding_instruments; } /** * Append FundingInstruments to the list. * * @param \PayPal\Api\FundingInstrument $fundingInstrument * @return $this */ public function addFundingInstrument($fundingInstrument) { if (!$this->getFundingInstruments()) { return $this->setFundingInstruments(array($fundingInstrument)); } else { return $this->setFundingInstruments( array_merge($this->getFundingInstruments(), array($fundingInstrument)) ); } } /** * Remove FundingInstruments from the list. * * @param \PayPal\Api\FundingInstrument $fundingInstrument * @return $this */ public function removeFundingInstrument($fundingInstrument) { return $this->setFundingInstruments( array_diff($this->getFundingInstruments(), array($fundingInstrument)) ); } /** * Id of user selected funding option for the payment.'OneOf' funding_instruments,funding_option_id to be used to identify the specifics of payment method passed. * @deprecated Not publicly available * @param string $funding_option_id * * @return $this */ public function setFundingOptionId($funding_option_id) { $this->funding_option_id = $funding_option_id; return $this; } /** * Id of user selected funding option for the payment.'OneOf' funding_instruments,funding_option_id to be used to identify the specifics of payment method passed. * @deprecated Not publicly available * @return string */ public function getFundingOptionId() { return $this->funding_option_id; } /** * Default funding option available for the payment * @deprecated Not publicly available * @param \PayPal\Api\FundingOption $funding_option * * @return $this */ public function setFundingOption($funding_option) { $this->funding_option = $funding_option; return $this; } /** * Default funding option available for the payment * @deprecated Not publicly available * @return \PayPal\Api\FundingOption */ public function getFundingOption() { return $this->funding_option; } /** * Instrument type pre-selected by the user outside of PayPal and passed along the payment creation. This param is used in cases such as PayPal Credit Second Button * Valid Values: ["CREDIT", "PAY_UPON_INVOICE"] * * @param string $external_selected_funding_instrument_type * * @return $this */ public function setExternalSelectedFundingInstrumentType($external_selected_funding_instrument_type) { $this->external_selected_funding_instrument_type = $external_selected_funding_instrument_type; return $this; } /** * Instrument type pre-selected by the user outside of PayPal and passed along the payment creation. This param is used in cases such as PayPal Credit Second Button * * @return string */ public function getExternalSelectedFundingInstrumentType() { return $this->external_selected_funding_instrument_type; } /** * Funding option related to default funding option. * @deprecated Not publicly available * @param \PayPal\Api\FundingOption $related_funding_option * * @return $this */ public function setRelatedFundingOption($related_funding_option) { $this->related_funding_option = $related_funding_option; return $this; } /** * Funding option related to default funding option. * @deprecated Not publicly available * @return \PayPal\Api\FundingOption */ public function getRelatedFundingOption() { return $this->related_funding_option; } /** * Information related to the Payer. * * @param \PayPal\Api\PayerInfo $payer_info * * @return $this */ public function setPayerInfo($payer_info) { $this->payer_info = $payer_info; return $this; } /** * Information related to the Payer. * * @return \PayPal\Api\PayerInfo */ public function getPayerInfo() { return $this->payer_info; } } rest-api-sdk-php/lib/PayPal/Api/CancelNotification.php 0000644 00000007140 15213403564 0016553 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class CancelNotification * * Email/SMS notification. * * @package PayPal\Api * * @property string subject * @property string note * @property bool send_to_merchant * @property bool send_to_payer * @property string[] cc_emails */ class CancelNotification extends PayPalModel { /** * Subject of the notification. * * @param string $subject * * @return $this */ public function setSubject($subject) { $this->subject = $subject; return $this; } /** * Subject of the notification. * * @return string */ public function getSubject() { return $this->subject; } /** * Note to the payer. * * @param string $note * * @return $this */ public function setNote($note) { $this->note = $note; return $this; } /** * Note to the payer. * * @return string */ public function getNote() { return $this->note; } /** * Indicates whether to send a copy of the notification to the merchant. * * @param bool $send_to_merchant * * @return $this */ public function setSendToMerchant($send_to_merchant) { $this->send_to_merchant = $send_to_merchant; return $this; } /** * Indicates whether to send a copy of the notification to the merchant. * * @return bool */ public function getSendToMerchant() { return $this->send_to_merchant; } /** * Indicates whether to send a copy of the notification to the payer. * * @param bool $send_to_payer * * @return $this */ public function setSendToPayer($send_to_payer) { $this->send_to_payer = $send_to_payer; return $this; } /** * Indicates whether to send a copy of the notification to the payer. * * @return bool */ public function getSendToPayer() { return $this->send_to_payer; } /** * Applicable for invoices created with Cc emails. If this field is not in the body, all the cc email addresses added as part of the invoice shall be notified else this field can be used to limit the list of email addresses. Note: additional email addresses are not supported. * * @param string[] $cc_emails * * @return $this */ public function setCcEmails($cc_emails) { $this->cc_emails = $cc_emails; return $this; } /** * Applicable for invoices created with Cc emails. If this field is not in the body, all the cc email addresses added as part of the invoice shall be notified else this field can be used to limit the list of email addresses. Note: additional email addresses are not supported. * * @return string[] */ public function getCcEmails() { return $this->cc_emails; } /** * Append CcEmails to the list. * * @param string $string * @return $this */ public function addCcEmail($string) { if (!$this->getCcEmails()) { return $this->setCcEmails(array($string)); } else { return $this->setCcEmails( array_merge($this->getCcEmails(), array($string)) ); } } /** * Remove CcEmails from the list. * * @param string $string * @return $this */ public function removeCcEmail($string) { return $this->setCcEmails( array_diff($this->getCcEmails(), array($string)) ); } } rest-api-sdk-php/lib/PayPal/Api/Notification.php 0000644 00000006065 15213403564 0015452 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class Notification * * Email/SMS notification. * * @package PayPal\Api * * @property string subject * @property string note * @property bool send_to_merchant * @property string[] cc_emails */ class Notification extends PayPalModel { /** * Subject of the notification. * * @param string $subject * * @return $this */ public function setSubject($subject) { $this->subject = $subject; return $this; } /** * Subject of the notification. * * @return string */ public function getSubject() { return $this->subject; } /** * Note to the payer. * * @param string $note * * @return $this */ public function setNote($note) { $this->note = $note; return $this; } /** * Note to the payer. * * @return string */ public function getNote() { return $this->note; } /** * Indicates whether to send a copy of the email to the merchant. * * @param bool $send_to_merchant * * @return $this */ public function setSendToMerchant($send_to_merchant) { $this->send_to_merchant = $send_to_merchant; return $this; } /** * Indicates whether to send a copy of the email to the merchant. * * @return bool */ public function getSendToMerchant() { return $this->send_to_merchant; } /** * Applicable for invoices created with Cc emails. If this field is not in the body, all the cc email addresses added as part of the invoice shall be notified else this field can be used to limit the list of email addresses. Note: additional email addresses are not supported. * * @param string[] $cc_emails * * @return $this */ public function setCcEmails($cc_emails) { $this->cc_emails = $cc_emails; return $this; } /** * Applicable for invoices created with Cc emails. If this field is not in the body, all the cc email addresses added as part of the invoice shall be notified else this field can be used to limit the list of email addresses. Note: additional email addresses are not supported. * * @return string[] */ public function getCcEmails() { return $this->cc_emails; } /** * Append CcEmails to the list. * * @param string $string * @return $this */ public function addCcEmail($string) { if (!$this->getCcEmails()) { return $this->setCcEmails(array($string)); } else { return $this->setCcEmails( array_merge($this->getCcEmails(), array($string)) ); } } /** * Remove CcEmails from the list. * * @param string $string * @return $this */ public function removeCcEmail($string) { return $this->setCcEmails( array_diff($this->getCcEmails(), array($string)) ); } } rest-api-sdk-php/lib/PayPal/Api/PayoutItemDetails.php 0000644 00000013472 15213403564 0016432 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class PayoutItemDetails * * The payout item status and other details. * * @package PayPal\Api * * @property string payout_item_id * @property string transaction_id * @property string transaction_status * @property \PayPal\Api\Currency payout_item_fee * @property string payout_batch_id * @property string sender_batch_id * @property \PayPal\Api\PayoutItem payout_item * @property string time_processed * @property \PayPal\Api\Error errors * @property \PayPal\Api\Links[] links */ class PayoutItemDetails extends PayPalModel { /** * The ID for the payout item. Viewable when you show details for a batch payout. * * @param string $payout_item_id * * @return $this */ public function setPayoutItemId($payout_item_id) { $this->payout_item_id = $payout_item_id; return $this; } /** * The ID for the payout item. Viewable when you show details for a batch payout. * * @return string */ public function getPayoutItemId() { return $this->payout_item_id; } /** * The PayPal-generated ID for the transaction. * * @param string $transaction_id * * @return $this */ public function setTransactionId($transaction_id) { $this->transaction_id = $transaction_id; return $this; } /** * The PayPal-generated ID for the transaction. * * @return string */ public function getTransactionId() { return $this->transaction_id; } /** * The transaction status. * * @param string $transaction_status * * @return $this */ public function setTransactionStatus($transaction_status) { $this->transaction_status = $transaction_status; return $this; } /** * The transaction status. * * @return string */ public function getTransactionStatus() { return $this->transaction_status; } /** * The amount of money, in U.S. dollars, for fees. * * @param \PayPal\Api\Currency $payout_item_fee * * @return $this */ public function setPayoutItemFee($payout_item_fee) { $this->payout_item_fee = $payout_item_fee; return $this; } /** * The amount of money, in U.S. dollars, for fees. * * @return \PayPal\Api\Currency */ public function getPayoutItemFee() { return $this->payout_item_fee; } /** * The PayPal-generated ID for the batch payout. * * @param string $payout_batch_id * * @return $this */ public function setPayoutBatchId($payout_batch_id) { $this->payout_batch_id = $payout_batch_id; return $this; } /** * The PayPal-generated ID for the batch payout. * * @return string */ public function getPayoutBatchId() { return $this->payout_batch_id; } /** * A sender-specified ID number. Tracks the batch payout in an accounting system. * * @param string $sender_batch_id * * @return $this */ public function setSenderBatchId($sender_batch_id) { $this->sender_batch_id = $sender_batch_id; return $this; } /** * A sender-specified ID number. Tracks the batch payout in an accounting system. * * @return string */ public function getSenderBatchId() { return $this->sender_batch_id; } /** * The sender-provided information for the payout item. * * @param \PayPal\Api\PayoutItem $payout_item * * @return $this */ public function setPayoutItem($payout_item) { $this->payout_item = $payout_item; return $this; } /** * The sender-provided information for the payout item. * * @return \PayPal\Api\PayoutItem */ public function getPayoutItem() { return $this->payout_item; } /** * The date and time when this item was last processed. * * @param string $time_processed * * @return $this */ public function setTimeProcessed($time_processed) { $this->time_processed = $time_processed; return $this; } /** * The date and time when this item was last processed. * * @return string */ public function getTimeProcessed() { return $this->time_processed; } /** * Sets Errors * * @param \PayPal\Api\Error $errors * * @return $this */ public function setErrors($errors) { $this->errors = $errors; return $this; } /** * Gets Errors * * @return \PayPal\Api\Error */ public function getErrors() { return $this->errors; } /** * Sets Links * * @param \PayPal\Api\Links[] $links * * @return $this */ public function setLinks($links) { $this->links = $links; return $this; } /** * Gets Links * * @return \PayPal\Api\Links[] */ public function getLinks() { return $this->links; } /** * Append Links to the list. * * @param \PayPal\Api\Links $links * @return $this */ public function addLink($links) { if (!$this->getLinks()) { return $this->setLinks(array($links)); } else { return $this->setLinks( array_merge($this->getLinks(), array($links)) ); } } /** * Remove Links from the list. * * @param \PayPal\Api\Links $links * @return $this */ public function removeLink($links) { return $this->setLinks( array_diff($this->getLinks(), array($links)) ); } } rest-api-sdk-php/lib/PayPal/Api/PlanList.php 0000644 00000006261 15213403564 0014550 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class PlanList * * Resource representing a list of billing plans with basic information and get link. * * @package PayPal\Api * * @property \PayPal\Api\Plan[] plans * @property string total_items * @property string total_pages * @property \PayPal\Api\Links[] links */ class PlanList extends PayPalModel { /** * Array of billing plans. * * @param \PayPal\Api\Plan[] $plans * * @return $this */ public function setPlans($plans) { $this->plans = $plans; return $this; } /** * Array of billing plans. * * @return \PayPal\Api\Plan[] */ public function getPlans() { return $this->plans; } /** * Append Plans to the list. * * @param \PayPal\Api\Plan $plan * @return $this */ public function addPlan($plan) { if (!$this->getPlans()) { return $this->setPlans(array($plan)); } else { return $this->setPlans( array_merge($this->getPlans(), array($plan)) ); } } /** * Remove Plans from the list. * * @param \PayPal\Api\Plan $plan * @return $this */ public function removePlan($plan) { return $this->setPlans( array_diff($this->getPlans(), array($plan)) ); } /** * Total number of items. * * @param string $total_items * * @return $this */ public function setTotalItems($total_items) { $this->total_items = $total_items; return $this; } /** * Total number of items. * * @return string */ public function getTotalItems() { return $this->total_items; } /** * Total number of pages. * * @param string $total_pages * * @return $this */ public function setTotalPages($total_pages) { $this->total_pages = $total_pages; return $this; } /** * Total number of pages. * * @return string */ public function getTotalPages() { return $this->total_pages; } /** * Sets Links * * @param \PayPal\Api\Links[] $links * * @return $this */ public function setLinks($links) { $this->links = $links; return $this; } /** * Gets Links * * @return \PayPal\Api\Links[] */ public function getLinks() { return $this->links; } /** * Append Links to the list. * * @param \PayPal\Api\Links $links * @return $this */ public function addLink($links) { if (!$this->getLinks()) { return $this->setLinks(array($links)); } else { return $this->setLinks( array_merge($this->getLinks(), array($links)) ); } } /** * Remove Links from the list. * * @param \PayPal\Api\Links $links * @return $this */ public function removeLink($links) { return $this->setLinks( array_diff($this->getLinks(), array($links)) ); } } rest-api-sdk-php/lib/PayPal/Api/PaymentCard.php 0000644 00000023505 15213403564 0015231 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class PaymentCard * * A payment card that can fund a payment. * * @package PayPal\Api * * @property string id * @property string number * @property string type * @property string expire_month * @property string expire_year * @property string start_month * @property string start_year * @property string cvv2 * @property string first_name * @property string last_name * @property string billing_country * @property \PayPal\Api\Address billing_address * @property string external_customer_id * @property string status * @property string card_product_class * @property string valid_until * @property string issue_number * @property \PayPal\Api\Links[] links */ class PaymentCard extends PayPalModel { /** * The ID of a credit card to save for later use. * * @param string $id * * @return $this */ public function setId($id) { $this->id = $id; return $this; } /** * The ID of a credit card to save for later use. * * @return string */ public function getId() { return $this->id; } /** * The card number. * * @param string $number * * @return $this */ public function setNumber($number) { $this->number = $number; return $this; } /** * The card number. * * @return string */ public function getNumber() { return $this->number; } /** * The card type. * Valid Values: ["VISA", "AMEX", "SOLO", "JCB", "STAR", "DELTA", "DISCOVER", "SWITCH", "MAESTRO", "CB_NATIONALE", "CONFINOGA", "COFIDIS", "ELECTRON", "CETELEM", "CHINA_UNION_PAY", "MASTERCARD"] * * @param string $type * * @return $this */ public function setType($type) { $this->type = $type; return $this; } /** * The card type. * * @return string */ public function getType() { return $this->type; } /** * The two-digit expiry month for the card. * * @param string $expire_month * * @return $this */ public function setExpireMonth($expire_month) { $this->expire_month = $expire_month; return $this; } /** * The two-digit expiry month for the card. * * @return string */ public function getExpireMonth() { return $this->expire_month; } /** * The four-digit expiry year for the card. * * @param string $expire_year * * @return $this */ public function setExpireYear($expire_year) { $this->expire_year = $expire_year; return $this; } /** * The four-digit expiry year for the card. * * @return string */ public function getExpireYear() { return $this->expire_year; } /** * The two-digit start month for the card. Required for UK Maestro cards. * * @param string $start_month * * @return $this */ public function setStartMonth($start_month) { $this->start_month = $start_month; return $this; } /** * The two-digit start month for the card. Required for UK Maestro cards. * * @return string */ public function getStartMonth() { return $this->start_month; } /** * The four-digit start year for the card. Required for UK Maestro cards. * * @param string $start_year * * @return $this */ public function setStartYear($start_year) { $this->start_year = $start_year; return $this; } /** * The four-digit start year for the card. Required for UK Maestro cards. * * @return string */ public function getStartYear() { return $this->start_year; } /** * The validation code for the card. Supported for payments but not for saving payment cards for future use. * * @param string $cvv2 * * @return $this */ public function setCvv2($cvv2) { $this->cvv2 = $cvv2; return $this; } /** * The validation code for the card. Supported for payments but not for saving payment cards for future use. * * @return string */ public function getCvv2() { return $this->cvv2; } /** * The first name of the card holder. * * @param string $first_name * * @return $this */ public function setFirstName($first_name) { $this->first_name = $first_name; return $this; } /** * The first name of the card holder. * * @return string */ public function getFirstName() { return $this->first_name; } /** * The last name of the card holder. * * @param string $last_name * * @return $this */ public function setLastName($last_name) { $this->last_name = $last_name; return $this; } /** * The last name of the card holder. * * @return string */ public function getLastName() { return $this->last_name; } /** * The two-letter country code. * * @param string $billing_country * * @return $this */ public function setBillingCountry($billing_country) { $this->billing_country = $billing_country; return $this; } /** * The two-letter country code. * * @return string */ public function getBillingCountry() { return $this->billing_country; } /** * The billing address for the card. * * @param \PayPal\Api\Address $billing_address * * @return $this */ public function setBillingAddress($billing_address) { $this->billing_address = $billing_address; return $this; } /** * The billing address for the card. * * @return \PayPal\Api\Address */ public function getBillingAddress() { return $this->billing_address; } /** * The ID of the customer who owns this card account. The facilitator generates and provides this ID. Required when you create or use a stored funding instrument in the PayPal vault. * * @param string $external_customer_id * * @return $this */ public function setExternalCustomerId($external_customer_id) { $this->external_customer_id = $external_customer_id; return $this; } /** * The ID of the customer who owns this card account. The facilitator generates and provides this ID. Required when you create or use a stored funding instrument in the PayPal vault. * * @return string */ public function getExternalCustomerId() { return $this->external_customer_id; } /** * The state of the funding instrument. * Valid Values: ["EXPIRED", "ACTIVE"] * * @param string $status * * @return $this */ public function setStatus($status) { $this->status = $status; return $this; } /** * The state of the funding instrument. * * @return string */ public function getStatus() { return $this->status; } /** * The product class of the financial instrument issuer. * Valid Values: ["CREDIT", "DEBIT", "GIFT", "PAYPAL_PREPAID", "PREPAID", "UNKNOWN"] * * @param string $card_product_class * * @return $this */ public function setCardProductClass($card_product_class) { $this->card_product_class = $card_product_class; return $this; } /** * The product class of the financial instrument issuer. * * @return string */ public function getCardProductClass() { return $this->card_product_class; } /** * The date and time until when this instrument can be used fund a payment. * * @param string $valid_until * * @return $this */ public function setValidUntil($valid_until) { $this->valid_until = $valid_until; return $this; } /** * The date and time until when this instrument can be used fund a payment. * * @return string */ public function getValidUntil() { return $this->valid_until; } /** * The one- to two-digit card issue number. Required for UK Maestro cards. * * @param string $issue_number * * @return $this */ public function setIssueNumber($issue_number) { $this->issue_number = $issue_number; return $this; } /** * The one- to two-digit card issue number. Required for UK Maestro cards. * * @return string */ public function getIssueNumber() { return $this->issue_number; } /** * Sets Links * * @param \PayPal\Api\Links[] $links * * @return $this */ public function setLinks($links) { $this->links = $links; return $this; } /** * Gets Links * * @return \PayPal\Api\Links[] */ public function getLinks() { return $this->links; } /** * Append Links to the list. * * @param \PayPal\Api\Links $links * @return $this */ public function addLink($links) { if (!$this->getLinks()) { return $this->setLinks(array($links)); } else { return $this->setLinks( array_merge($this->getLinks(), array($links)) ); } } /** * Remove Links from the list. * * @param \PayPal\Api\Links $links * @return $this */ public function removeLink($links) { return $this->setLinks( array_diff($this->getLinks(), array($links)) ); } } rest-api-sdk-php/lib/PayPal/Api/Links.php 0000644 00000004725 15213403564 0014105 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class Links * * * * @package PayPal\Api * * @property string href * @property string rel * @property \PayPal\Api\HyperSchema targetSchema * @property string method * @property string enctype * @property \PayPal\Api\HyperSchema schema */ class Links extends PayPalModel { /** * Sets Href * * @param string $href * * @return $this */ public function setHref($href) { $this->href = $href; return $this; } /** * Gets Href * * @return string */ public function getHref() { return $this->href; } /** * Sets Rel * * @param string $rel * * @return $this */ public function setRel($rel) { $this->rel = $rel; return $this; } /** * Gets Rel * * @return string */ public function getRel() { return $this->rel; } /** * Sets TargetSchema * * @param \PayPal\Api\HyperSchema $targetSchema * * @return $this */ public function setTargetSchema($targetSchema) { $this->targetSchema = $targetSchema; return $this; } /** * Gets TargetSchema * * @return \PayPal\Api\HyperSchema */ public function getTargetSchema() { return $this->targetSchema; } /** * Sets Method * * @param string $method * * @return $this */ public function setMethod($method) { $this->method = $method; return $this; } /** * Gets Method * * @return string */ public function getMethod() { return $this->method; } /** * Sets Enctype * * @param string $enctype * * @return $this */ public function setEnctype($enctype) { $this->enctype = $enctype; return $this; } /** * Gets Enctype * * @return string */ public function getEnctype() { return $this->enctype; } /** * Sets Schema * * @param \PayPal\Api\HyperSchema $schema * * @return $this */ public function setSchema($schema) { $this->schema = $schema; return $this; } /** * Gets Schema * * @return \PayPal\Api\HyperSchema */ public function getSchema() { return $this->schema; } } rest-api-sdk-php/lib/PayPal/Api/InvoiceItem.php 0000644 00000011775 15213403564 0015243 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; use PayPal\Converter\FormatConverter; use PayPal\Validation\NumericValidator; use PayPal\Validation\UrlValidator; /** * Class InvoiceItem * * Information about a single line item. * * @package PayPal\Api * * @property string name * @property string description * @property \PayPal\Api\number quantity * @property \PayPal\Api\Currency unit_price * @property \PayPal\Api\Tax tax * @property string date * @property \PayPal\Api\Cost discount * @property string unit_of_measure */ class InvoiceItem extends PayPalModel { /** * Name of the item. 200 characters max. * * @param string $name * * @return $this */ public function setName($name) { $this->name = $name; return $this; } /** * Name of the item. 200 characters max. * * @return string */ public function getName() { return $this->name; } /** * Description of the item. 1000 characters max. * * @param string $description * * @return $this */ public function setDescription($description) { $this->description = $description; return $this; } /** * Description of the item. 1000 characters max. * * @return string */ public function getDescription() { return $this->description; } /** * Quantity of the item. Range of -10000 to 10000. * * @param string|double $quantity * * @return $this */ public function setQuantity($quantity) { NumericValidator::validate($quantity, "Quantity"); $quantity = FormatConverter::formatToPrice($quantity); $this->quantity = $quantity; return $this; } /** * Quantity of the item. Range of -10000 to 10000. * * @return string */ public function getQuantity() { return $this->quantity; } /** * Unit price of the item. Range of -1,000,000 to 1,000,000. * * @param \PayPal\Api\Currency $unit_price * * @return $this */ public function setUnitPrice($unit_price) { $this->unit_price = $unit_price; return $this; } /** * Unit price of the item. Range of -1,000,000 to 1,000,000. * * @return \PayPal\Api\Currency */ public function getUnitPrice() { return $this->unit_price; } /** * Tax associated with the item. * * @param \PayPal\Api\Tax $tax * * @return $this */ public function setTax($tax) { $this->tax = $tax; return $this; } /** * Tax associated with the item. * * @return \PayPal\Api\Tax */ public function getTax() { return $this->tax; } /** * The date when the item or service was provided. The date format is *yyyy*-*MM*-*dd* *z* as defined in [Internet Date/Time Format](http://tools.ietf.org/html/rfc3339#section-5.6). * * @param string $date * * @return $this */ public function setDate($date) { $this->date = $date; return $this; } /** * The date when the item or service was provided. The date format is *yyyy*-*MM*-*dd* *z* as defined in [Internet Date/Time Format](http://tools.ietf.org/html/rfc3339#section-5.6). * * @return string */ public function getDate() { return $this->date; } /** * The item discount, as a percent or an amount value. * * @param \PayPal\Api\Cost $discount * * @return $this */ public function setDiscount($discount) { $this->discount = $discount; return $this; } /** * The item discount, as a percent or an amount value. * * @return \PayPal\Api\Cost */ public function getDiscount() { return $this->discount; } /** * The image URL. Maximum length is 4000 characters. * @deprecated Not publicly available * @param string $image_url * @throws \InvalidArgumentException * @return $this */ public function setImageUrl($image_url) { UrlValidator::validate($image_url, "ImageUrl"); $this->image_url = $image_url; return $this; } /** * The image URL. Maximum length is 4000 characters. * @deprecated Not publicly available * @return string */ public function getImageUrl() { return $this->image_url; } /** * The unit of measure of the item being invoiced. * Valid Values: ["QUANTITY", "HOURS", "AMOUNT"] * * @param string $unit_of_measure * * @return $this */ public function setUnitOfMeasure($unit_of_measure) { $this->unit_of_measure = $unit_of_measure; return $this; } /** * The unit of measure of the item being invoiced. * * @return string */ public function getUnitOfMeasure() { return $this->unit_of_measure; } } rest-api-sdk-php/lib/PayPal/Api/InvoiceSearchResponse.php 0000644 00000003435 15213403564 0017263 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class InvoiceSearchResponse * * * * @package PayPal\Api * * @property int total_count * @property \PayPal\Api\Invoice[] invoices */ class InvoiceSearchResponse extends PayPalModel { /** * Total number of invoices. * * @param int $total_count * * @return $this */ public function setTotalCount($total_count) { $this->total_count = $total_count; return $this; } /** * Total number of invoices. * * @return int */ public function getTotalCount() { return $this->total_count; } /** * List of invoices belonging to a merchant. * * @param \PayPal\Api\Invoice[] $invoices * * @return $this */ public function setInvoices($invoices) { $this->invoices = $invoices; return $this; } /** * List of invoices belonging to a merchant. * * @return \PayPal\Api\Invoice[] */ public function getInvoices() { return $this->invoices; } /** * Append Invoices to the list. * * @param \PayPal\Api\Invoice $invoice * @return $this */ public function addInvoice($invoice) { if (!$this->getInvoices()) { return $this->setInvoices(array($invoice)); } else { return $this->setInvoices( array_merge($this->getInvoices(), array($invoice)) ); } } /** * Remove Invoices from the list. * * @param \PayPal\Api\Invoice $invoice * @return $this */ public function removeInvoice($invoice) { return $this->setInvoices( array_diff($this->getInvoices(), array($invoice)) ); } } rest-api-sdk-php/lib/PayPal/Api/ShippingCost.php 0000644 00000002233 15213403564 0015427 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class ShippingCost * * Shipping cost, as a percent or an amount. * * @package PayPal\Api * * @property \PayPal\Api\Currency amount * @property \PayPal\Api\Tax tax */ class ShippingCost extends PayPalModel { /** * The shipping cost, as an amount. Valid range is from 0 to 999999.99. * * @param \PayPal\Api\Currency $amount * * @return $this */ public function setAmount($amount) { $this->amount = $amount; return $this; } /** * The shipping cost, as an amount. Valid range is from 0 to 999999.99. * * @return \PayPal\Api\Currency */ public function getAmount() { return $this->amount; } /** * The tax percentage on the shipping amount. * * @param \PayPal\Api\Tax $tax * * @return $this */ public function setTax($tax) { $this->tax = $tax; return $this; } /** * The tax percentage on the shipping amount. * * @return \PayPal\Api\Tax */ public function getTax() { return $this->tax; } } rest-api-sdk-php/lib/PayPal/Api/ErrorDetails.php 0000644 00000004054 15213403564 0015417 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class ErrorDetails * * Details about a specific error. * * @package PayPal\Api * * @property string field * @property string issue */ class ErrorDetails extends PayPalModel { /** * Name of the field that caused the error. * * @param string $field * * @return $this */ public function setField($field) { $this->field = $field; return $this; } /** * Name of the field that caused the error. * * @return string */ public function getField() { return $this->field; } /** * Reason for the error. * * @param string $issue * * @return $this */ public function setIssue($issue) { $this->issue = $issue; return $this; } /** * Reason for the error. * * @return string */ public function getIssue() { return $this->issue; } /** * Reference ID of the purchase_unit associated with this error * @deprecated Not publicly available * @param string $purchase_unit_reference_id * * @return $this */ public function setPurchaseUnitReferenceId($purchase_unit_reference_id) { $this->purchase_unit_reference_id = $purchase_unit_reference_id; return $this; } /** * Reference ID of the purchase_unit associated with this error * @deprecated Not publicly available * @return string */ public function getPurchaseUnitReferenceId() { return $this->purchase_unit_reference_id; } /** * PayPal internal error code. * @deprecated Not publicly available * @param string $code * * @return $this */ public function setCode($code) { $this->code = $code; return $this; } /** * PayPal internal error code. * @deprecated Not publicly available * @return string */ public function getCode() { return $this->code; } } rest-api-sdk-php/lib/PayPal/Api/FundingDetail.php 0000644 00000004514 15213403564 0015536 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class FundingDetail * * Additional detail of the funding. * * @package PayPal\Api * * @property string clearing_time * @property string payment_hold_date * @property string payment_debit_date * @property string processing_type */ class FundingDetail extends PayPalModel { /** * Expected clearing time * * @param string $clearing_time * * @return $this */ public function setClearingTime($clearing_time) { $this->clearing_time = $clearing_time; return $this; } /** * Expected clearing time * * @return string */ public function getClearingTime() { return $this->clearing_time; } /** * [DEPRECATED] Hold-off duration of the payment. payment_debit_date should be used instead. * * @param string $payment_hold_date * * @return $this */ public function setPaymentHoldDate($payment_hold_date) { $this->payment_hold_date = $payment_hold_date; return $this; } /** * @deprecated [DEPRECATED] Hold-off duration of the payment. payment_debit_date should be used instead. * * @return string */ public function getPaymentHoldDate() { return $this->payment_hold_date; } /** * Date when funds will be debited from the payer's account * * @param string $payment_debit_date * * @return $this */ public function setPaymentDebitDate($payment_debit_date) { $this->payment_debit_date = $payment_debit_date; return $this; } /** * Date when funds will be debited from the payer's account * * @return string */ public function getPaymentDebitDate() { return $this->payment_debit_date; } /** * Processing type of the payment card * Valid Values: ["CUP_SECURE", "PINLESS_DEBIT"] * * @param string $processing_type * * @return $this */ public function setProcessingType($processing_type) { $this->processing_type = $processing_type; return $this; } /** * Processing type of the payment card * * @return string */ public function getProcessingType() { return $this->processing_type; } } rest-api-sdk-php/lib/PayPal/Api/OpenIdTokeninfo.php 0000644 00000020114 15213403564 0016046 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalResourceModel; use PayPal\Rest\ApiContext; use PayPal\Transport\PayPalRestCall; /** * Class OpenIdTokeninfo * * Token grant resource * * @property string scope * @property string access_token * @property string refresh_token * @property string token_type * @property string id_token * @property int expires_in */ class OpenIdTokeninfo extends PayPalResourceModel { /** * OPTIONAL, if identical to the scope requested by the client; otherwise, REQUIRED. * * @param string $scope * @return self */ public function setScope($scope) { $this->scope = $scope; return $this; } /** * OPTIONAL, if identical to the scope requested by the client; otherwise, REQUIRED. * * @return string */ public function getScope() { return $this->scope; } /** * The access token issued by the authorization server. * * @param string $access_token * @return self */ public function setAccessToken($access_token) { $this->access_token = $access_token; return $this; } /** * The access token issued by the authorization server. * * @return string */ public function getAccessToken() { return $this->access_token; } /** * The refresh token, which can be used to obtain new access tokens using the same authorization grant as described in OAuth2.0 RFC6749 in Section 6. * * @param string $refresh_token * @return self */ public function setRefreshToken($refresh_token) { $this->refresh_token = $refresh_token; return $this; } /** * The refresh token, which can be used to obtain new access tokens using the same authorization grant as described in OAuth2.0 RFC6749 in Section 6. * * @return string */ public function getRefreshToken() { return $this->refresh_token; } /** * The type of the token issued as described in OAuth2.0 RFC6749 (Section 7.1). Value is case insensitive. * * @param string $token_type * @return self */ public function setTokenType($token_type) { $this->token_type = $token_type; return $this; } /** * The type of the token issued as described in OAuth2.0 RFC6749 (Section 7.1). Value is case insensitive. * * @return string */ public function getTokenType() { return $this->token_type; } /** * The id_token is a session token assertion that denotes the user's authentication status * * @param string $id_token * @return self */ public function setIdToken($id_token) { $this->id_token = $id_token; return $this; } /** * The id_token is a session token assertion that denotes the user's authentication status * * @return string */ public function getIdToken() { return $this->id_token; } /** * The lifetime in seconds of the access token. * * @param integer $expires_in * @return self */ public function setExpiresIn($expires_in) { $this->expires_in = $expires_in; return $this; } /** * The lifetime in seconds of the access token. * * @return integer */ public function getExpiresIn() { return $this->expires_in; } /** * Creates an Access Token from an Authorization Code. * * @path /v1/identity/openidconnect/tokenservice * @method POST * @param array $params (allowed values are client_id, client_secret, grant_type, code and redirect_uri) * (required) client_id from developer portal * (required) client_secret from developer portal * (required) code is Authorization code previously received from the authorization server * (required) redirect_uri Redirection endpoint that must match the one provided during the * authorization request that ended in receiving the authorization code. * (optional) grant_type is the Token grant type. Defaults to authorization_code * @param string $clientId * @param string $clientSecret * @param ApiContext $apiContext Optional API Context * @param PayPalRestCall $restCall * @return OpenIdTokeninfo */ public static function createFromAuthorizationCode($params, $clientId = null, $clientSecret = null, $apiContext = null, $restCall = null) { static $allowedParams = array('grant_type' => 1, 'code' => 1, 'redirect_uri' => 1); if (!array_key_exists('grant_type', $params)) { $params['grant_type'] = 'authorization_code'; } $apiContext = $apiContext ? $apiContext : new ApiContext(self::$credential); if (sizeof($apiContext->get($clientId)) > 0) { $clientId = $apiContext->get($clientId); } if (sizeof($apiContext->get($clientSecret)) > 0) { $clientSecret = $apiContext->get($clientSecret); } $clientId = $clientId ? $clientId : $apiContext->getCredential()->getClientId(); $clientSecret = $clientSecret ? $clientSecret : $apiContext->getCredential()->getClientSecret(); $json = self::executeCall( "/v1/identity/openidconnect/tokenservice", "POST", http_build_query(array_intersect_key($params, $allowedParams)), array( 'Content-Type' => 'application/x-www-form-urlencoded', 'Authorization' => 'Basic ' . base64_encode($clientId . ":" . $clientSecret) ), $apiContext, $restCall ); $token = new OpenIdTokeninfo(); $token->fromJson($json); return $token; } /** * Creates an Access Token from an Refresh Token. * * @path /v1/identity/openidconnect/tokenservice * @method POST * @param array $params (allowed values are grant_type and scope) * (required) client_id from developer portal * (required) client_secret from developer portal * (optional) refresh_token refresh token. If one is not passed, refresh token from the current object is used. * (optional) grant_type is the Token grant type. Defaults to refresh_token * (optional) scope is an array that either the same or a subset of the scope passed to the authorization request * @param APIContext $apiContext Optional API Context * @param PayPalRestCall $restCall * @return OpenIdTokeninfo */ public function createFromRefreshToken($params, $apiContext = null, $restCall = null) { static $allowedParams = array('grant_type' => 1, 'refresh_token' => 1, 'scope' => 1); $apiContext = $apiContext ? $apiContext : new ApiContext(self::$credential); if (!array_key_exists('grant_type', $params)) { $params['grant_type'] = 'refresh_token'; } if (!array_key_exists('refresh_token', $params)) { $params['refresh_token'] = $this->getRefreshToken(); } $clientId = isset($params['client_id']) ? $params['client_id'] : $apiContext->getCredential()->getClientId(); $clientSecret = isset($params['client_secret']) ? $params['client_secret'] : $apiContext->getCredential()->getClientSecret(); $json = self::executeCall( "/v1/identity/openidconnect/tokenservice", "POST", http_build_query(array_intersect_key($params, $allowedParams)), array( 'Content-Type' => 'application/x-www-form-urlencoded', 'Authorization' => 'Basic ' . base64_encode($clientId . ":" . $clientSecret) ), $apiContext, $restCall ); $this->fromJson($json); return $this; } } rest-api-sdk-php/lib/PayPal/Api/RefundRequest.php 0000644 00000007210 15213403564 0015611 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class RefundRequest * * A refund transaction. * * @package PayPal\Api * * @property \PayPal\Api\Amount amount * @property string description * @property string refund_source * @property string reason * @property string invoice_number * @property bool refund_advice */ class RefundRequest extends PayPalModel { /** * Details including both refunded amount (to payer) and refunded fee (to payee). * * @param \PayPal\Api\Amount $amount * * @return $this */ public function setAmount($amount) { $this->amount = $amount; return $this; } /** * Details including both refunded amount (to payer) and refunded fee (to payee). * * @return \PayPal\Api\Amount */ public function getAmount() { return $this->amount; } /** * Description of what is being refunded for. Character length and limitations: 255 single-byte alphanumeric characters. * * @param string $description * * @return $this */ public function setDescription($description) { $this->description = $description; return $this; } /** * Description of what is being refunded for. Character length and limitations: 255 single-byte alphanumeric characters. * * @return string */ public function getDescription() { return $this->description; } /** * Type of PayPal funding source (balance or eCheck) that can be used for auto refund. * Valid Values: ["INSTANT_FUNDING_SOURCE", "ECHECK", "UNRESTRICTED"] * * @param string $refund_source * * @return $this */ public function setRefundSource($refund_source) { $this->refund_source = $refund_source; return $this; } /** * Type of PayPal funding source (balance or eCheck) that can be used for auto refund. * * @return string */ public function getRefundSource() { return $this->refund_source; } /** * Reason description for the Sale transaction being refunded. * * @param string $reason * * @return $this */ public function setReason($reason) { $this->reason = $reason; return $this; } /** * Reason description for the Sale transaction being refunded. * * @return string */ public function getReason() { return $this->reason; } /** * The invoice number that is used to track this payment. Character length and limitations: 127 single-byte alphanumeric characters. * * @param string $invoice_number * * @return $this */ public function setInvoiceNumber($invoice_number) { $this->invoice_number = $invoice_number; return $this; } /** * The invoice number that is used to track this payment. Character length and limitations: 127 single-byte alphanumeric characters. * * @return string */ public function getInvoiceNumber() { return $this->invoice_number; } /** * Flag to indicate that the buyer was already given store credit for a given transaction. * * @param bool $refund_advice * * @return $this */ public function setRefundAdvice($refund_advice) { $this->refund_advice = $refund_advice; return $this; } /** * Flag to indicate that the buyer was already given store credit for a given transaction. * * @return bool */ public function getRefundAdvice() { return $this->refund_advice; } } rest-api-sdk-php/lib/PayPal/Api/ShippingAddress.php 0000644 00000004250 15213403564 0016105 0 ustar 00 <?php namespace PayPal\Api; /** * Class ShippingAddress * * Extended Address object used as shipping address in a payment. * * @package PayPal\Api * * @property string recipient_name */ class ShippingAddress extends Address { /** * Address ID assigned in PayPal system. * @deprecated Not publicly available * @param string $id * * @return $this */ public function setId($id) { $this->id = $id; return $this; } /** * Address ID assigned in PayPal system. * @deprecated Not publicly available * @return string */ public function getId() { return $this->id; } /** * Name of the recipient at this address. * * @param string $recipient_name * * @return $this */ public function setRecipientName($recipient_name) { $this->recipient_name = $recipient_name; return $this; } /** * Name of the recipient at this address. * * @return string */ public function getRecipientName() { return $this->recipient_name; } /** * Default shipping address of the Payer. * @deprecated Not publicly available * @param bool $default_address * * @return $this */ public function setDefaultAddress($default_address) { $this->default_address = $default_address; return $this; } /** * Default shipping address of the Payer. * @deprecated Not publicly available * @return bool */ public function getDefaultAddress() { return $this->default_address; } /** * Shipping Address marked as preferred by Payer. * @deprecated Not publicly available * @param bool $preferred_address * * @return $this */ public function setPreferredAddress($preferred_address) { $this->preferred_address = $preferred_address; return $this; } /** * Shipping Address marked as preferred by Payer. * @deprecated Not publicly available * @return bool */ public function getPreferredAddress() { return $this->preferred_address; } } rest-api-sdk-php/lib/PayPal/Api/BillingAgreementToken.php 0000644 00000000466 15213403564 0017234 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class BillingAgreementToken * * PayPal generated billing agreement token. It is a token returned by /v1/billing-agreements/agreement-token API end point. * * @package PayPal\Api * */ class BillingAgreementToken extends PayPalModel { } rest-api-sdk-php/lib/PayPal/Api/DetailedRefund.php 0000644 00000010706 15213403564 0015700 0 ustar 00 <?php namespace PayPal\Api; /** * Class DetailedRefund * * A refund transaction. This is the resource that is returned on GET /refund * * @package PayPal\Api * * @property string custom * @property \PayPal\Api\Currency refund_to_payer * @property \PayPal\Api\ExternalFunding[] refund_to_external_funding * @property \PayPal\Api\Currency refund_from_transaction_fee * @property \PayPal\Api\Currency refund_from_received_amount * @property \PayPal\Api\Currency total_refunded_amount */ class DetailedRefund extends Refund { /** * free-form field for the use of clients * * @param string $custom * * @return $this */ public function setCustom($custom) { $this->custom = $custom; return $this; } /** * free-form field for the use of clients * * @return string */ public function getCustom() { return $this->custom; } /** * Amount refunded to payer of the original transaction, in the current Refund call * * @param \PayPal\Api\Currency $refund_to_payer * * @return $this */ public function setRefundToPayer($refund_to_payer) { $this->refund_to_payer = $refund_to_payer; return $this; } /** * Amount refunded to payer of the original transaction, in the current Refund call * * @return \PayPal\Api\Currency */ public function getRefundToPayer() { return $this->refund_to_payer; } /** * List of external funding that were refunded by the Refund call. Each external_funding unit should have a unique reference_id * * @param \PayPal\Api\ExternalFunding[] $refund_to_external_funding * * @return $this */ public function setRefundToExternalFunding($refund_to_external_funding) { $this->refund_to_external_funding = $refund_to_external_funding; return $this; } /** * List of external funding that were refunded by the Refund call. Each external_funding unit should have a unique reference_id * * @return \PayPal\Api\ExternalFunding[] */ public function getRefundToExternalFunding() { return $this->refund_to_external_funding; } /** * Transaction fee refunded to original recipient of payment. * * @param \PayPal\Api\Currency $refund_from_transaction_fee * * @return $this */ public function setRefundFromTransactionFee($refund_from_transaction_fee) { $this->refund_from_transaction_fee = $refund_from_transaction_fee; return $this; } /** * Transaction fee refunded to original recipient of payment. * * @return \PayPal\Api\Currency */ public function getRefundFromTransactionFee() { return $this->refund_from_transaction_fee; } /** * Amount subtracted from PayPal balance of the original recipient of payment, to make this refund. * * @param \PayPal\Api\Currency $refund_from_received_amount * * @return $this */ public function setRefundFromReceivedAmount($refund_from_received_amount) { $this->refund_from_received_amount = $refund_from_received_amount; return $this; } /** * Amount subtracted from PayPal balance of the original recipient of payment, to make this refund. * * @return \PayPal\Api\Currency */ public function getRefundFromReceivedAmount() { return $this->refund_from_received_amount; } /** * Total amount refunded so far from the original purchase. Say, for example, a buyer makes $100 purchase, the buyer was refunded $20 a week ago and is refunded $30 in this transaction. The gross refund amount is $30 (in this transaction). The total refunded amount is $50. * * @param \PayPal\Api\Currency $total_refunded_amount * * @return $this */ public function setTotalRefundedAmount($total_refunded_amount) { $this->total_refunded_amount = $total_refunded_amount; return $this; } /** * Total amount refunded so far from the original purchase. Say, for example, a buyer makes $100 purchase, the buyer was refunded $20 a week ago and is refunded $30 in this transaction. The gross refund amount is $30 (in this transaction). The total refunded amount is $50. * * @return \PayPal\Api\Currency */ public function getTotalRefundedAmount() { return $this->total_refunded_amount; } } rest-api-sdk-php/lib/PayPal/Api/BankAccountsList.php 0000644 00000005110 15213403564 0016221 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class BankAccountsList * * A list of Bank Account Resources * * @package PayPal\Api * * @property \PayPal\Api\BankAccount[] bank_accounts * @property int count * @property string next_id */ class BankAccountsList extends PayPalModel { /** * A list of bank account resources * * @param \PayPal\Api\BankAccount[] $bank_accounts * * @return $this */ public function setBankAccounts($bank_accounts) { $this->{"bank-accounts"} = $bank_accounts; return $this; } /** * A list of bank account resources * * @return \PayPal\Api\BankAccount[] */ public function getBankAccounts() { return $this->{"bank-accounts"}; } /** * Append BankAccounts to the list. * * @param \PayPal\Api\BankAccount $bankAccount * @return $this */ public function addBankAccount($bankAccount) { if (!$this->getBankAccounts()) { return $this->setBankAccounts(array($bankAccount)); } else { return $this->setBankAccounts( array_merge($this->getBankAccounts(), array($bankAccount)) ); } } /** * Remove BankAccounts from the list. * * @param \PayPal\Api\BankAccount $bankAccount * @return $this */ public function removeBankAccount($bankAccount) { return $this->setBankAccounts( array_diff($this->getBankAccounts(), array($bankAccount)) ); } /** * Number of items returned in each range of results. Note that the last results range could have fewer items than the requested number of items. * * @param int $count * * @return $this */ public function setCount($count) { $this->count = $count; return $this; } /** * Number of items returned in each range of results. Note that the last results range could have fewer items than the requested number of items. * * @return int */ public function getCount() { return $this->count; } /** * Identifier of the next element to get the next range of results. * * @param string $next_id * * @return $this */ public function setNextId($next_id) { $this->next_id = $next_id; return $this; } /** * Identifier of the next element to get the next range of results. * * @return string */ public function getNextId() { return $this->next_id; } } rest-api-sdk-php/lib/PayPal/Api/FmfDetails.php 0000644 00000004545 15213403564 0015043 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class FmfDetails * * Details of Fraud Management Filter (FMF). * * @package PayPal\Api * * @property string filter_type * @property string filter_id * @property string name * @property string description */ class FmfDetails extends PayPalModel { /** * Type of filter. * Valid Values: ["ACCEPT", "PENDING", "DENY", "REPORT"] * * @param string $filter_type * * @return $this */ public function setFilterType($filter_type) { $this->filter_type = $filter_type; return $this; } /** * Type of filter. * * @return string */ public function getFilterType() { return $this->filter_type; } /** * Filter Identifier. * Valid Values: ["AVS_NO_MATCH", "AVS_PARTIAL_MATCH", "AVS_UNAVAILABLE_OR_UNSUPPORTED", "CARD_SECURITY_CODE_MISMATCH", "MAXIMUM_TRANSACTION_AMOUNT", "UNCONFIRMED_ADDRESS", "COUNTRY_MONITOR", "LARGE_ORDER_NUMBER", "BILLING_OR_SHIPPING_ADDRESS_MISMATCH", "RISKY_ZIP_CODE", "SUSPECTED_FREIGHT_FORWARDER_CHECK", "TOTAL_PURCHASE_PRICE_MINIMUM", "IP_ADDRESS_VELOCITY", "RISKY_EMAIL_ADDRESS_DOMAIN_CHECK", "RISKY_BANK_IDENTIFICATION_NUMBER_CHECK", "RISKY_IP_ADDRESS_RANGE", "PAYPAL_FRAUD_MODEL"] * * @param string $filter_id * * @return $this */ public function setFilterId($filter_id) { $this->filter_id = $filter_id; return $this; } /** * Filter Identifier. * * @return string */ public function getFilterId() { return $this->filter_id; } /** * Name of the filter * * @param string $name * * @return $this */ public function setName($name) { $this->name = $name; return $this; } /** * Name of the filter * * @return string */ public function getName() { return $this->name; } /** * Description of the filter. * * @param string $description * * @return $this */ public function setDescription($description) { $this->description = $description; return $this; } /** * Description of the filter. * * @return string */ public function getDescription() { return $this->description; } } rest-api-sdk-php/lib/PayPal/Api/CarrierAccount.php 0000644 00000005742 15213403564 0015731 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class CarrierAccount * * Payment instrument that enables carrier billing. * * @package PayPal\Api * * @property string id * @property string phone_number * @property string external_customer_id * @property string phone_source * @property \PayPal\Api\CountryCode country_code */ class CarrierAccount extends PayPalModel { /** * The ID of the carrier account of the payer. Use in subsequent REST API calls. For example, to make payments. * * @param string $id * * @return $this */ public function setId($id) { $this->id = $id; return $this; } /** * The ID of the carrier account of the payer. Use in subsequent REST API calls. For example, to make payments. * * @return string */ public function getId() { return $this->id; } /** * The phone number of the payer, in E.164 format. * * @param string $phone_number * * @return $this */ public function setPhoneNumber($phone_number) { $this->phone_number = $phone_number; return $this; } /** * The phone number of the payer, in E.164 format. * * @return string */ public function getPhoneNumber() { return $this->phone_number; } /** * The ID of the customer, as created by the merchant. * * @param string $external_customer_id * * @return $this */ public function setExternalCustomerId($external_customer_id) { $this->external_customer_id = $external_customer_id; return $this; } /** * The ID of the customer, as created by the merchant. * * @return string */ public function getExternalCustomerId() { return $this->external_customer_id; } /** * The method used to obtain the phone number. Value is `READ_FROM_DEVICE` or `USER_PROVIDED`. * Valid Values: ["READ_FROM_DEVICE", "USER_PROVIDED"] * * @param string $phone_source * * @return $this */ public function setPhoneSource($phone_source) { $this->phone_source = $phone_source; return $this; } /** * The method used to obtain the phone number. Value is `READ_FROM_DEVICE` or `USER_PROVIDED`. * * @return string */ public function getPhoneSource() { return $this->phone_source; } /** * The ISO 3166-1 alpha-2 country code where the phone number is registered. * * @param \PayPal\Api\CountryCode $country_code * * @return $this */ public function setCountryCode($country_code) { $this->country_code = $country_code; return $this; } /** * The ISO 3166-1 alpha-2 country code where the phone number is registered. * * @return \PayPal\Api\CountryCode */ public function getCountryCode() { return $this->country_code; } } rest-api-sdk-php/lib/PayPal/Api/Plan.php 0000644 00000027503 15213403564 0013716 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; use PayPal\Common\PayPalResourceModel; use PayPal\Rest\ApiContext; use PayPal\Transport\PayPalRestCall; use PayPal\Validation\ArgumentValidator; /** * Class Plan * * Billing plan resource that will be used to create a billing agreement. * * @package PayPal\Api * * @property string id * @property string name * @property string description * @property string type * @property string state * @property string create_time * @property string update_time * @property \PayPal\Api\PaymentDefinition[] payment_definitions * @property \PayPal\Api\Terms[] terms * @property \PayPal\Api\MerchantPreferences merchant_preferences */ class Plan extends PayPalResourceModel { /** * Identifier of the billing plan. 128 characters max. * * @param string $id * * @return $this */ public function setId($id) { $this->id = $id; return $this; } /** * Identifier of the billing plan. 128 characters max. * * @return string */ public function getId() { return $this->id; } /** * Name of the billing plan. 128 characters max. * * @param string $name * * @return $this */ public function setName($name) { $this->name = $name; return $this; } /** * Name of the billing plan. 128 characters max. * * @return string */ public function getName() { return $this->name; } /** * Description of the billing plan. 128 characters max. * * @param string $description * * @return $this */ public function setDescription($description) { $this->description = $description; return $this; } /** * Description of the billing plan. 128 characters max. * * @return string */ public function getDescription() { return $this->description; } /** * Type of the billing plan. Allowed values: `FIXED`, `INFINITE`. * * @param string $type * * @return $this */ public function setType($type) { $this->type = $type; return $this; } /** * Type of the billing plan. Allowed values: `FIXED`, `INFINITE`. * * @return string */ public function getType() { return $this->type; } /** * Status of the billing plan. Allowed values: `CREATED`, `ACTIVE`, `INACTIVE`, and `DELETED`. * * @param string $state * * @return $this */ public function setState($state) { $this->state = $state; return $this; } /** * Status of the billing plan. Allowed values: `CREATED`, `ACTIVE`, `INACTIVE`, and `DELETED`. * * @return string */ public function getState() { return $this->state; } /** * Time when the billing plan was created. Format YYYY-MM-DDTimeTimezone, as defined in [ISO8601](http://tools.ietf.org/html/rfc3339#section-5.6). * * @param string $create_time * * @return $this */ public function setCreateTime($create_time) { $this->create_time = $create_time; return $this; } /** * Time when the billing plan was created. Format YYYY-MM-DDTimeTimezone, as defined in [ISO8601](http://tools.ietf.org/html/rfc3339#section-5.6). * * @return string */ public function getCreateTime() { return $this->create_time; } /** * Time when this billing plan was updated. Format YYYY-MM-DDTimeTimezone, as defined in [ISO8601](http://tools.ietf.org/html/rfc3339#section-5.6). * * @param string $update_time * * @return $this */ public function setUpdateTime($update_time) { $this->update_time = $update_time; return $this; } /** * Time when this billing plan was updated. Format YYYY-MM-DDTimeTimezone, as defined in [ISO8601](http://tools.ietf.org/html/rfc3339#section-5.6). * * @return string */ public function getUpdateTime() { return $this->update_time; } /** * Array of payment definitions for this billing plan. * * @param \PayPal\Api\PaymentDefinition[] $payment_definitions * * @return $this */ public function setPaymentDefinitions($payment_definitions) { $this->payment_definitions = $payment_definitions; return $this; } /** * Array of payment definitions for this billing plan. * * @return \PayPal\Api\PaymentDefinition[] */ public function getPaymentDefinitions() { return $this->payment_definitions; } /** * Append PaymentDefinitions to the list. * * @param \PayPal\Api\PaymentDefinition $paymentDefinition * @return $this */ public function addPaymentDefinition($paymentDefinition) { if (!$this->getPaymentDefinitions()) { return $this->setPaymentDefinitions(array($paymentDefinition)); } else { return $this->setPaymentDefinitions( array_merge($this->getPaymentDefinitions(), array($paymentDefinition)) ); } } /** * Remove PaymentDefinitions from the list. * * @param \PayPal\Api\PaymentDefinition $paymentDefinition * @return $this */ public function removePaymentDefinition($paymentDefinition) { return $this->setPaymentDefinitions( array_diff($this->getPaymentDefinitions(), array($paymentDefinition)) ); } /** * Array of terms for this billing plan. * * @param \PayPal\Api\Terms[] $terms * * @return $this */ public function setTerms($terms) { $this->terms = $terms; return $this; } /** * Array of terms for this billing plan. * * @return \PayPal\Api\Terms[] */ public function getTerms() { return $this->terms; } /** * Append Terms to the list. * * @param \PayPal\Api\Terms $terms * @return $this */ public function addTerm($terms) { if (!$this->getTerms()) { return $this->setTerms(array($terms)); } else { return $this->setTerms( array_merge($this->getTerms(), array($terms)) ); } } /** * Remove Terms from the list. * * @param \PayPal\Api\Terms $terms * @return $this */ public function removeTerm($terms) { return $this->setTerms( array_diff($this->getTerms(), array($terms)) ); } /** * Specific preferences such as: set up fee, max fail attempts, autobill amount, and others that are configured for this billing plan. * * @param \PayPal\Api\MerchantPreferences $merchant_preferences * * @return $this */ public function setMerchantPreferences($merchant_preferences) { $this->merchant_preferences = $merchant_preferences; return $this; } /** * Specific preferences such as: set up fee, max fail attempts, autobill amount, and others that are configured for this billing plan. * * @return \PayPal\Api\MerchantPreferences */ public function getMerchantPreferences() { return $this->merchant_preferences; } /** * Retrieve the details for a particular billing plan by passing the billing plan ID to the request URI. * * @param string $planId * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return Plan */ public static function get($planId, $apiContext = null, $restCall = null) { ArgumentValidator::validate($planId, 'planId'); $payLoad = ""; $json = self::executeCall( "/v1/payments/billing-plans/$planId", "GET", $payLoad, null, $apiContext, $restCall ); $ret = new Plan(); $ret->fromJson($json); return $ret; } /** * Create a new billing plan by passing the details for the plan, including the plan name, description, and type, to the request URI. * * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return Plan */ public function create($apiContext = null, $restCall = null) { $payLoad = $this->toJSON(); $json = self::executeCall( "/v1/payments/billing-plans/", "POST", $payLoad, null, $apiContext, $restCall ); $this->fromJson($json); return $this; } /** * Replace specific fields within a billing plan by passing the ID of the billing plan to the request URI. In addition, pass a patch object in the request JSON that specifies the operation to perform, field to update, and new value for each update. * * @param PatchRequest $patchRequest * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return bool */ public function update($patchRequest, $apiContext = null, $restCall = null) { ArgumentValidator::validate($this->getId(), "Id"); ArgumentValidator::validate($patchRequest, 'patchRequest'); $payLoad = $patchRequest->toJSON(); self::executeCall( "/v1/payments/billing-plans/{$this->getId()}", "PATCH", $payLoad, null, $apiContext, $restCall ); return true; } /** * Delete a billing plan by passing the ID of the billing plan to the request URI. * * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return bool */ public function delete($apiContext = null, $restCall = null) { ArgumentValidator::validate($this->getId(), "Id"); $patchRequest = new PatchRequest(); $patch = new Patch(); $value = new PayPalModel('{ "state":"DELETED" }'); $patch->setOp('replace') ->setPath('/') ->setValue($value); $patchRequest->addPatch($patch); return $this->update($patchRequest, $apiContext, $restCall); } /** * List billing plans according to optional query string parameters specified. * * @param array $params * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return PlanList */ public static function all($params, $apiContext = null, $restCall = null) { ArgumentValidator::validate($params, 'params'); $payLoad = ""; $allowedParams = array( 'page_size' => 1, 'status' => 1, 'page' => 1, 'total_required' => 1 ); $json = self::executeCall( "/v1/payments/billing-plans/" . "?" . http_build_query(array_intersect_key($params, $allowedParams)), "GET", $payLoad, null, $apiContext, $restCall ); $ret = new PlanList(); $ret->fromJson($json); return $ret; } } rest-api-sdk-php/lib/PayPal/Api/Patch.php 0000644 00000004271 15213403564 0014060 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class Patch * * A JSON patch object that you can use to apply partial updates to resources. * * @package PayPal\Api * * @property string op * @property string path * @property mixed value * @property string from */ class Patch extends PayPalModel { /** * The operation to perform. * Valid Values: ["add", "remove", "replace", "move", "copy", "test"] * * @param string $op * * @return $this */ public function setOp($op) { $this->op = $op; return $this; } /** * The operation to perform. * * @return string */ public function getOp() { return $this->op; } /** * A JSON pointer that references a location in the target document where the operation is performed. A `string` value. * * @param string $path * * @return $this */ public function setPath($path) { $this->path = $path; return $this; } /** * A JSON pointer that references a location in the target document where the operation is performed. A `string` value. * * @return string */ public function getPath() { return $this->path; } /** * New value to apply based on the operation. * * @param mixed $value * * @return $this */ public function setValue($value) { $this->value = $value; return $this; } /** * New value to apply based on the operation. * * @return mixed */ public function getValue() { return $this->value; } /** * A string containing a JSON Pointer value that references the location in the target document to move the value from. * * @param string $from * * @return $this */ public function setFrom($from) { $this->from = $from; return $this; } /** * A string containing a JSON Pointer value that references the location in the target document to move the value from. * * @return string */ public function getFrom() { return $this->from; } } rest-api-sdk-php/lib/PayPal/Api/AgreementTransactions.php 0000644 00000003617 15213403564 0017324 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class AgreementTransactions * * A resource representing agreement_transactions that is returned during a transaction search. * * @package PayPal\Api * * @property \PayPal\Api\AgreementTransaction[] agreement_transaction_list */ class AgreementTransactions extends PayPalModel { /** * Array of agreement_transaction object. * * @param \PayPal\Api\AgreementTransaction[] $agreement_transaction_list * * @return $this */ public function setAgreementTransactionList($agreement_transaction_list) { $this->agreement_transaction_list = $agreement_transaction_list; return $this; } /** * Array of agreement_transaction object. * * @return \PayPal\Api\AgreementTransaction[] */ public function getAgreementTransactionList() { return $this->agreement_transaction_list; } /** * Append AgreementTransactionList to the list. * * @param \PayPal\Api\AgreementTransaction $agreementTransaction * @return $this */ public function addAgreementTransactionList($agreementTransaction) { if (!$this->getAgreementTransactionList()) { return $this->setAgreementTransactionList(array($agreementTransaction)); } else { return $this->setAgreementTransactionList( array_merge($this->getAgreementTransactionList(), array($agreementTransaction)) ); } } /** * Remove AgreementTransactionList from the list. * * @param \PayPal\Api\AgreementTransaction $agreementTransaction * @return $this */ public function removeAgreementTransactionList($agreementTransaction) { return $this->setAgreementTransactionList( array_diff($this->getAgreementTransactionList(), array($agreementTransaction)) ); } } rest-api-sdk-php/lib/PayPal/Api/InvoiceNumber.php 0000644 00000001111 15213403564 0015554 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class InvoiceNumber * * The next invoice number * * @package PayPal\Api * * @property string number */ class InvoiceNumber extends PayPalModel { /** * The next invoice number. * * @param string $number * * @return $this */ public function setNumber($number) { $this->number = $number; return $this; } /** * The next invoice number. * * @return string */ public function getNumber() { return $this->number; } } rest-api-sdk-php/lib/PayPal/Api/BankToken.php 0000644 00000003764 15213403564 0014703 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class BankToken * * A resource representing a bank that can be used to fund a payment. * * @package PayPal\Api * * @property string bank_id * @property string external_customer_id * @property string mandate_reference_number */ class BankToken extends PayPalModel { /** * ID of a previously saved Bank resource using /vault/bank API. * * @param string $bank_id * * @return $this */ public function setBankId($bank_id) { $this->bank_id = $bank_id; return $this; } /** * ID of a previously saved Bank resource using /vault/bank API. * * @return string */ public function getBankId() { return $this->bank_id; } /** * The unique identifier of the payer used when saving this bank using /vault/bank API. * * @param string $external_customer_id * * @return $this */ public function setExternalCustomerId($external_customer_id) { $this->external_customer_id = $external_customer_id; return $this; } /** * The unique identifier of the payer used when saving this bank using /vault/bank API. * * @return string */ public function getExternalCustomerId() { return $this->external_customer_id; } /** * Identifier of the direct debit mandate to validate. Currently supported only for EU bank accounts(SEPA). * * @param string $mandate_reference_number * * @return $this */ public function setMandateReferenceNumber($mandate_reference_number) { $this->mandate_reference_number = $mandate_reference_number; return $this; } /** * Identifier of the direct debit mandate to validate. Currently supported only for EU bank accounts(SEPA). * * @return string */ public function getMandateReferenceNumber() { return $this->mandate_reference_number; } } rest-api-sdk-php/lib/PayPal/Api/WebhookEvent.php 0000644 00000022131 15213403564 0015414 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalResourceModel; use PayPal\Exception\PayPalConnectionException; use PayPal\Rest\ApiContext; use PayPal\Transport\PayPalRestCall; use PayPal\Validation\ArgumentValidator; use PayPal\Validation\JsonValidator; /** * Class WebhookEvent * * A webhook event notification. * * @package PayPal\Api * * @property string id * @property string create_time * @property string resource_type * @property string event_version * @property string event_type * @property string summary * @property \PayPal\Common\PayPalModel resource * @property string status * @property mixed[] transmissions */ class WebhookEvent extends PayPalResourceModel { /** * The ID of the webhook event notification. * * @param string $id * * @return $this */ public function setId($id) { $this->id = $id; return $this; } /** * The ID of the webhook event notification. * * @return string */ public function getId() { return $this->id; } /** * The date and time when the webhook event notification was created. * * @param string $create_time * * @return $this */ public function setCreateTime($create_time) { $this->create_time = $create_time; return $this; } /** * The date and time when the webhook event notification was created. * * @return string */ public function getCreateTime() { return $this->create_time; } /** * The name of the resource related to the webhook notification event. * * @param string $resource_type * * @return $this */ public function setResourceType($resource_type) { $this->resource_type = $resource_type; return $this; } /** * The name of the resource related to the webhook notification event. * * @return string */ public function getResourceType() { return $this->resource_type; } /** * The version of the event. * * @param string $event_version * * @return $this */ public function setEventVersion($event_version) { $this->event_version = $event_version; return $this; } /** * The version of the event. * * @return string */ public function getEventVersion() { return $this->event_version; } /** * The event that triggered the webhook event notification. * * @param string $event_type * * @return $this */ public function setEventType($event_type) { $this->event_type = $event_type; return $this; } /** * The event that triggered the webhook event notification. * * @return string */ public function getEventType() { return $this->event_type; } /** * A summary description for the event notification. For example, `A payment authorization was created.` * * @param string $summary * * @return $this */ public function setSummary($summary) { $this->summary = $summary; return $this; } /** * A summary description for the event notification. For example, `A payment authorization was created.` * * @return string */ public function getSummary() { return $this->summary; } /** * The resource that triggered the webhook event notification. * * @param \PayPal\Common\PayPalModel $resource * * @return $this */ public function setResource($resource) { $this->resource = $resource; return $this; } /** * The resource that triggered the webhook event notification. * * @return \PayPal\Common\PayPalModel */ public function getResource() { return $this->resource; } /** * Validates Received Event from Webhook, and returns the webhook event object. Because security verifications by verifying certificate chain is not enabled in PHP yet, * we need to fallback to default behavior of retrieving the ID attribute of the data, and make a separate GET call to PayPal APIs, to retrieve the data. * This is important to do again, as hacker could have faked the data, and the retrieved data cannot be trusted without either doing client side security validation, or making a separate call * to PayPal APIs to retrieve the actual data. This limits the hacker to mimick a fake data, as hacker wont be able to predict the Id correctly. * * NOTE: PLEASE DO NOT USE THE DATA PROVIDED IN WEBHOOK DIRECTLY, AS HACKER COULD PASS IN FAKE DATA. IT IS VERY IMPORTANT THAT YOU RETRIEVE THE ID AND MAKE A SEPARATE CALL TO PAYPAL API. * * @deprecated Please use `VerifyWebhookSignature->post()` instead. * * @param string $body * @param ApiContext $apiContext * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return WebhookEvent * @throws \InvalidArgumentException if input arguments are incorrect, or Id is not found. * @throws PayPalConnectionException if any exception from PayPal APIs other than not found is sent. */ public static function validateAndGetReceivedEvent($body, $apiContext = null, $restCall = null) { if ($body == null | empty($body)){ throw new \InvalidArgumentException("Body cannot be null or empty"); } if (!JsonValidator::validate($body, true)) { throw new \InvalidArgumentException("Request Body is not a valid JSON."); } $object = new WebhookEvent($body); if ($object->getId() == null) { throw new \InvalidArgumentException("Id attribute not found in JSON. Possible reason could be invalid JSON Object"); } try { return self::get($object->getId(), $apiContext, $restCall); } catch(PayPalConnectionException $ex) { if ($ex->getCode() == 404) { // It means that the given webhook event Id is not found for this merchant. throw new \InvalidArgumentException("Webhook Event Id provided in the data is incorrect. This could happen if anyone other than PayPal is faking the incoming webhook data."); } throw $ex; } } /** * Retrieves the Webhooks event resource identified by event_id. Can be used to retrieve the payload for an event. * * @param string $eventId * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return WebhookEvent */ public static function get($eventId, $apiContext = null, $restCall = null) { ArgumentValidator::validate($eventId, 'eventId'); $payLoad = ""; $json = self::executeCall( "/v1/notifications/webhooks-events/$eventId", "GET", $payLoad, null, $apiContext, $restCall ); $ret = new WebhookEvent(); $ret->fromJson($json); return $ret; } /** * Resends a webhook event notification, by ID. Any pending notifications are not resent. * * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return WebhookEvent */ public function resend($apiContext = null, $restCall = null) { ArgumentValidator::validate($this->getId(), "Id"); $payLoad = ""; $json = self::executeCall( "/v1/notifications/webhooks-events/{$this->getId()}/resend", "POST", $payLoad, null, $apiContext, $restCall ); $this->fromJson($json); return $this; } /** * Lists webhook event notifications. Use query parameters to filter the response. * * @param array $params * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return WebhookEventList */ public static function all($params, $apiContext = null, $restCall = null) { ArgumentValidator::validate($params, 'params'); $payLoad = ""; $allowedParams = array( 'page_size' => 1, 'start_time' => 1, 'end_time' => 1, 'transaction_id' => 1, 'event_type' => 1, ); $json = self::executeCall( "/v1/notifications/webhooks-events" . "?" . http_build_query(array_intersect_key($params, $allowedParams)), "GET", $payLoad, null, $apiContext, $restCall ); $ret = new WebhookEventList(); $ret->fromJson($json); return $ret; } } rest-api-sdk-php/lib/PayPal/Api/NameValuePair.php 0000644 00000002241 15213403564 0015505 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class NameValuePair * * Used to define a type for name-value pairs. The use of name value pairs in an API should be limited and approved by architecture. * * @package PayPal\Api * * @property string name * @property string value */ class NameValuePair extends PayPalModel { /** * Key for the name value pair. The value name types should be correlated * * @param string $name * * @return $this */ public function setName($name) { $this->name = $name; return $this; } /** * Key for the name value pair. The value name types should be correlated * * @return string */ public function getName() { return $this->name; } /** * Value for the name value pair. * * @param string $value * * @return $this */ public function setValue($value) { $this->value = $value; return $this; } /** * Value for the name value pair. * * @return string */ public function getValue() { return $this->value; } } rest-api-sdk-php/lib/PayPal/Api/Search.php 0000644 00000030375 15213403564 0014232 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class Search * * Invoice search parameters. * * @package PayPal\Api * * @property string email * @property string recipient_first_name * @property string recipient_last_name * @property string recipient_business_name * @property string number * @property string status * @property \PayPal\Api\Currency lower_total_amount * @property \PayPal\Api\Currency upper_total_amount * @property string start_invoice_date * @property string end_invoice_date * @property string start_due_date * @property string end_due_date * @property string start_payment_date * @property string end_payment_date * @property string start_creation_date * @property string end_creation_date * @property \PayPal\Api\number page * @property \PayPal\Api\number page_size * @property bool total_count_required * @property bool archived */ class Search extends PayPalModel { /** * The initial letters of the email address. * * @param string $email * * @return $this */ public function setEmail($email) { $this->email = $email; return $this; } /** * The initial letters of the email address. * * @return string */ public function getEmail() { return $this->email; } /** * The initial letters of the recipient's first name. * * @param string $recipient_first_name * * @return $this */ public function setRecipientFirstName($recipient_first_name) { $this->recipient_first_name = $recipient_first_name; return $this; } /** * The initial letters of the recipient's first name. * * @return string */ public function getRecipientFirstName() { return $this->recipient_first_name; } /** * The initial letters of the recipient's last name. * * @param string $recipient_last_name * * @return $this */ public function setRecipientLastName($recipient_last_name) { $this->recipient_last_name = $recipient_last_name; return $this; } /** * The initial letters of the recipient's last name. * * @return string */ public function getRecipientLastName() { return $this->recipient_last_name; } /** * The initial letters of the recipient's business name. * * @param string $recipient_business_name * * @return $this */ public function setRecipientBusinessName($recipient_business_name) { $this->recipient_business_name = $recipient_business_name; return $this; } /** * The initial letters of the recipient's business name. * * @return string */ public function getRecipientBusinessName() { return $this->recipient_business_name; } /** * The invoice number. * * @param string $number * * @return $this */ public function setNumber($number) { $this->number = $number; return $this; } /** * The invoice number. * * @return string */ public function getNumber() { return $this->number; } /** * The invoice status. * Valid Values: ["DRAFT", "SENT", "PAID", "MARKED_AS_PAID", "CANCELLED", "REFUNDED", "PARTIALLY_REFUNDED", "MARKED_AS_REFUNDED"] * * @param string $status * * @return $this */ public function setStatus($status) { $this->status = $status; return $this; } /** * The invoice status. * * @return string */ public function getStatus() { return $this->status; } /** * The lower limit of the total amount. * * @param \PayPal\Api\Currency $lower_total_amount * * @return $this */ public function setLowerTotalAmount($lower_total_amount) { $this->lower_total_amount = $lower_total_amount; return $this; } /** * The lower limit of the total amount. * * @return \PayPal\Api\Currency */ public function getLowerTotalAmount() { return $this->lower_total_amount; } /** * The upper limit of total amount. * * @param \PayPal\Api\Currency $upper_total_amount * * @return $this */ public function setUpperTotalAmount($upper_total_amount) { $this->upper_total_amount = $upper_total_amount; return $this; } /** * The upper limit of total amount. * * @return \PayPal\Api\Currency */ public function getUpperTotalAmount() { return $this->upper_total_amount; } /** * The start date for the invoice. Date format is *yyyy*-*MM*-*dd* *z*, as defined in [Internet Date/Time Format](http://tools.ietf.org/html/rfc3339#section-5.6). * * @param string $start_invoice_date * * @return $this */ public function setStartInvoiceDate($start_invoice_date) { $this->start_invoice_date = $start_invoice_date; return $this; } /** * The start date for the invoice. Date format is *yyyy*-*MM*-*dd* *z*, as defined in [Internet Date/Time Format](http://tools.ietf.org/html/rfc3339#section-5.6). * * @return string */ public function getStartInvoiceDate() { return $this->start_invoice_date; } /** * The end date for the invoice. Date format is *yyyy*-*MM*-*dd* *z*, as defined in [Internet Date/Time Format](http://tools.ietf.org/html/rfc3339#section-5.6). * * @param string $end_invoice_date * * @return $this */ public function setEndInvoiceDate($end_invoice_date) { $this->end_invoice_date = $end_invoice_date; return $this; } /** * The end date for the invoice. Date format is *yyyy*-*MM*-*dd* *z*, as defined in [Internet Date/Time Format](http://tools.ietf.org/html/rfc3339#section-5.6). * * @return string */ public function getEndInvoiceDate() { return $this->end_invoice_date; } /** * The start due date for the invoice. Date format is *yyyy*-*MM*-*dd* *z*, as defined in [Internet Date/Time Format](http://tools.ietf.org/html/rfc3339#section-5.6). * * @param string $start_due_date * * @return $this */ public function setStartDueDate($start_due_date) { $this->start_due_date = $start_due_date; return $this; } /** * The start due date for the invoice. Date format is *yyyy*-*MM*-*dd* *z*, as defined in [Internet Date/Time Format](http://tools.ietf.org/html/rfc3339#section-5.6). * * @return string */ public function getStartDueDate() { return $this->start_due_date; } /** * The end due date for the invoice. Date format is *yyyy*-*MM*-*dd* *z*, as defined in [Internet Date/Time Format](http://tools.ietf.org/html/rfc3339#section-5.6). * * @param string $end_due_date * * @return $this */ public function setEndDueDate($end_due_date) { $this->end_due_date = $end_due_date; return $this; } /** * The end due date for the invoice. Date format is *yyyy*-*MM*-*dd* *z*, as defined in [Internet Date/Time Format](http://tools.ietf.org/html/rfc3339#section-5.6). * * @return string */ public function getEndDueDate() { return $this->end_due_date; } /** * The start payment date for the invoice. Date format is *yyyy*-*MM*-*dd* *z*, as defined in [Internet Date/Time Format](http://tools.ietf.org/html/rfc3339#section-5.6). * * @param string $start_payment_date * * @return $this */ public function setStartPaymentDate($start_payment_date) { $this->start_payment_date = $start_payment_date; return $this; } /** * The start payment date for the invoice. Date format is *yyyy*-*MM*-*dd* *z*, as defined in [Internet Date/Time Format](http://tools.ietf.org/html/rfc3339#section-5.6). * * @return string */ public function getStartPaymentDate() { return $this->start_payment_date; } /** * The end payment date for the invoice. Date format is *yyyy*-*MM*-*dd* *z*, as defined in [Internet Date/Time Format](http://tools.ietf.org/html/rfc3339#section-5.6). * * @param string $end_payment_date * * @return $this */ public function setEndPaymentDate($end_payment_date) { $this->end_payment_date = $end_payment_date; return $this; } /** * The end payment date for the invoice. Date format is *yyyy*-*MM*-*dd* *z*, as defined in [Internet Date/Time Format](http://tools.ietf.org/html/rfc3339#section-5.6). * * @return string */ public function getEndPaymentDate() { return $this->end_payment_date; } /** * The start creation date for the invoice. Date format is *yyyy*-*MM*-*dd* *z*, as defined in [Internet Date/Time Format](http://tools.ietf.org/html/rfc3339#section-5.6). * * @param string $start_creation_date * * @return $this */ public function setStartCreationDate($start_creation_date) { $this->start_creation_date = $start_creation_date; return $this; } /** * The start creation date for the invoice. Date format is *yyyy*-*MM*-*dd* *z*, as defined in [Internet Date/Time Format](http://tools.ietf.org/html/rfc3339#section-5.6). * * @return string */ public function getStartCreationDate() { return $this->start_creation_date; } /** * The end creation date for the invoice. Date format is *yyyy*-*MM*-*dd* *z*, as defined in [Internet Date/Time Format](http://tools.ietf.org/html/rfc3339#section-5.6). * * @param string $end_creation_date * * @return $this */ public function setEndCreationDate($end_creation_date) { $this->end_creation_date = $end_creation_date; return $this; } /** * The end creation date for the invoice. Date format is *yyyy*-*MM*-*dd* *z*, as defined in [Internet Date/Time Format](http://tools.ietf.org/html/rfc3339#section-5.6). * * @return string */ public function getEndCreationDate() { return $this->end_creation_date; } /** * The offset for the search results. * * @param \PayPal\Api\number $page * * @return $this */ public function setPage($page) { $this->page = $page; return $this; } /** * The offset for the search results. * * @return \PayPal\Api\number */ public function getPage() { return $this->page; } /** * The page size for the search results. * * @param \PayPal\Api\number $page_size * * @return $this */ public function setPageSize($page_size) { $this->page_size = $page_size; return $this; } /** * The page size for the search results. * * @return \PayPal\Api\number */ public function getPageSize() { return $this->page_size; } /** * Indicates whether the total count appears in the response. Default is `false`. * * @param bool $total_count_required * * @return $this */ public function setTotalCountRequired($total_count_required) { $this->total_count_required = $total_count_required; return $this; } /** * Indicates whether the total count appears in the response. Default is `false`. * * @return bool */ public function getTotalCountRequired() { return $this->total_count_required; } /** * A flag indicating whether search is on invoices archived by merchant. true - returns archived / false returns unarchived / null returns all. * * @param bool $archived * * @return $this */ public function setArchived($archived) { $this->archived = $archived; return $this; } /** * A flag indicating whether search is on invoices archived by merchant. true - returns archived / false returns unarchived / null returns all. * * @return bool */ public function getArchived() { return $this->archived; } } rest-api-sdk-php/lib/PayPal/Api/CustomAmount.php 0000644 00000002343 15213403564 0015455 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class CustomAmount * * The custom amount applied on an invoice. If you include a label, the amount cannot be empty. * * @package PayPal\Api * * @property string label * @property \PayPal\Api\Currency amount */ class CustomAmount extends PayPalModel { /** * The custom amount label. Maximum length is 25 characters. * * @param string $label * * @return $this */ public function setLabel($label) { $this->label = $label; return $this; } /** * The custom amount label. Maximum length is 25 characters. * * @return string */ public function getLabel() { return $this->label; } /** * The custom amount value. Valid range is from -999999.99 to 999999.99. * * @param \PayPal\Api\Currency $amount * * @return $this */ public function setAmount($amount) { $this->amount = $amount; return $this; } /** * The custom amount value. Valid range is from -999999.99 to 999999.99. * * @return \PayPal\Api\Currency */ public function getAmount() { return $this->amount; } } rest-api-sdk-php/lib/PayPal/Api/PaymentCardToken.php 0000644 00000006502 15213403564 0016230 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class PaymentCardToken * * A resource representing a payment card that can be used to fund a payment. * * @package PayPal\Api * * @property string payment_card_id * @property string external_customer_id * @property string last4 * @property string type * @property int expire_month * @property int expire_year */ class PaymentCardToken extends PayPalModel { /** * ID of a previously saved Payment Card resource. * * @param string $payment_card_id * * @return $this */ public function setPaymentCardId($payment_card_id) { $this->payment_card_id = $payment_card_id; return $this; } /** * ID of a previously saved Payment Card resource. * * @return string */ public function getPaymentCardId() { return $this->payment_card_id; } /** * The unique identifier of the payer used when saving this payment card. * * @param string $external_customer_id * * @return $this */ public function setExternalCustomerId($external_customer_id) { $this->external_customer_id = $external_customer_id; return $this; } /** * The unique identifier of the payer used when saving this payment card. * * @return string */ public function getExternalCustomerId() { return $this->external_customer_id; } /** * Last 4 digits of the card number from the saved card. * * @param string $last4 * * @return $this */ public function setLast4($last4) { $this->last4 = $last4; return $this; } /** * Last 4 digits of the card number from the saved card. * * @return string */ public function getLast4() { return $this->last4; } /** * Type of the Card. * Valid Values: ["VISA", "AMEX", "SOLO", "JCB", "STAR", "DELTA", "DISCOVER", "SWITCH", "MAESTRO", "CB_NATIONALE", "CONFINOGA", "COFIDIS", "ELECTRON", "CETELEM", "CHINA_UNION_PAY", "MASTERCARD"] * * @param string $type * * @return $this */ public function setType($type) { $this->type = $type; return $this; } /** * Type of the Card. * * @return string */ public function getType() { return $this->type; } /** * Expiry month from the saved card with value 1 - 12. * * @param int $expire_month * * @return $this */ public function setExpireMonth($expire_month) { $this->expire_month = $expire_month; return $this; } /** * Expiry month from the saved card with value 1 - 12. * * @return int */ public function getExpireMonth() { return $this->expire_month; } /** * Four digit expiry year from the saved card, represented as YYYY format. * * @param int $expire_year * * @return $this */ public function setExpireYear($expire_year) { $this->expire_year = $expire_year; return $this; } /** * Four digit expiry year from the saved card, represented as YYYY format. * * @return int */ public function getExpireYear() { return $this->expire_year; } } rest-api-sdk-php/lib/PayPal/Api/RelatedResources.php 0000644 00000004643 15213403564 0016277 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class RelatedResources * * Each one representing a financial transaction (Sale, Authorization, Capture, Refund) related to the payment. * * @package PayPal\Api * * @property \PayPal\Api\Sale sale * @property \PayPal\Api\Authorization authorization * @property \PayPal\Api\Order order * @property \PayPal\Api\Capture capture * @property \PayPal\Api\Refund refund */ class RelatedResources extends PayPalModel { /** * Sale transaction * * @param \PayPal\Api\Sale $sale * * @return $this */ public function setSale($sale) { $this->sale = $sale; return $this; } /** * Sale transaction * * @return \PayPal\Api\Sale */ public function getSale() { return $this->sale; } /** * Authorization transaction * * @param \PayPal\Api\Authorization $authorization * * @return $this */ public function setAuthorization($authorization) { $this->authorization = $authorization; return $this; } /** * Authorization transaction * * @return \PayPal\Api\Authorization */ public function getAuthorization() { return $this->authorization; } /** * Order transaction * * @param \PayPal\Api\Order $order * * @return $this */ public function setOrder($order) { $this->order = $order; return $this; } /** * Order transaction * * @return \PayPal\Api\Order */ public function getOrder() { return $this->order; } /** * Capture transaction * * @param \PayPal\Api\Capture $capture * * @return $this */ public function setCapture($capture) { $this->capture = $capture; return $this; } /** * Capture transaction * * @return \PayPal\Api\Capture */ public function getCapture() { return $this->capture; } /** * Refund transaction * * @param \PayPal\Api\Refund $refund * * @return $this */ public function setRefund($refund) { $this->refund = $refund; return $this; } /** * Refund transaction * * @return \PayPal\Api\Refund */ public function getRefund() { return $this->refund; } } rest-api-sdk-php/lib/PayPal/Api/CurrencyConversion.php 0000644 00000012635 15213403564 0016664 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; use PayPal\Validation\UrlValidator; /** * Class CurrencyConversion * * Object used to store the currency conversion rate. * * @package PayPal\Api * * @property string conversion_date * @property string from_currency * @property string from_amount * @property string to_currency * @property string to_amount * @property string conversion_type * @property bool conversion_type_changeable * @property \PayPal\Api\Links[] links */ class CurrencyConversion extends PayPalModel { /** * Date of validity for the conversion rate. * * @param string $conversion_date * * @return $this */ public function setConversionDate($conversion_date) { $this->conversion_date = $conversion_date; return $this; } /** * Date of validity for the conversion rate. * * @return string */ public function getConversionDate() { return $this->conversion_date; } /** * 3 letter currency code * * @param string $from_currency * * @return $this */ public function setFromCurrency($from_currency) { $this->from_currency = $from_currency; return $this; } /** * 3 letter currency code * * @return string */ public function getFromCurrency() { return $this->from_currency; } /** * Amount participating in currency conversion, set to 1 as default * * @param string $from_amount * * @return $this */ public function setFromAmount($from_amount) { $this->from_amount = $from_amount; return $this; } /** * Amount participating in currency conversion, set to 1 as default * * @return string */ public function getFromAmount() { return $this->from_amount; } /** * 3 letter currency code * * @param string $to_currency * * @return $this */ public function setToCurrency($to_currency) { $this->to_currency = $to_currency; return $this; } /** * 3 letter currency code * * @return string */ public function getToCurrency() { return $this->to_currency; } /** * Amount resulting from currency conversion. * * @param string $to_amount * * @return $this */ public function setToAmount($to_amount) { $this->to_amount = $to_amount; return $this; } /** * Amount resulting from currency conversion. * * @return string */ public function getToAmount() { return $this->to_amount; } /** * Field indicating conversion type applied. * Valid Values: ["PAYPAL", "VENDOR"] * * @param string $conversion_type * * @return $this */ public function setConversionType($conversion_type) { $this->conversion_type = $conversion_type; return $this; } /** * Field indicating conversion type applied. * * @return string */ public function getConversionType() { return $this->conversion_type; } /** * Allow Payer to change conversion type. * * @param bool $conversion_type_changeable * * @return $this */ public function setConversionTypeChangeable($conversion_type_changeable) { $this->conversion_type_changeable = $conversion_type_changeable; return $this; } /** * Allow Payer to change conversion type. * * @return bool */ public function getConversionTypeChangeable() { return $this->conversion_type_changeable; } /** * Base URL to web applications endpoint * Valid Values: ["https://www.paypal.com/{country_code}/webapps/xocspartaweb/webflow/sparta/proxwebflow", "https://www.paypal.com/{country_code}/proxflow"] * @deprecated Not publicly available * @param string $web_url * @throws \InvalidArgumentException * @return $this */ public function setWebUrl($web_url) { UrlValidator::validate($web_url, "WebUrl"); $this->web_url = $web_url; return $this; } /** * Base URL to web applications endpoint * @deprecated Not publicly available * @return string */ public function getWebUrl() { return $this->web_url; } /** * Sets Links * * @param \PayPal\Api\Links[] $links * * @return $this */ public function setLinks($links) { $this->links = $links; return $this; } /** * Gets Links * * @return \PayPal\Api\Links[] */ public function getLinks() { return $this->links; } /** * Append Links to the list. * * @param \PayPal\Api\Links $links * @return $this */ public function addLink($links) { if (!$this->getLinks()) { return $this->setLinks(array($links)); } else { return $this->setLinks( array_merge($this->getLinks(), array($links)) ); } } /** * Remove Links from the list. * * @param \PayPal\Api\Links $links * @return $this */ public function removeLink($links) { return $this->setLinks( array_diff($this->getLinks(), array($links)) ); } } rest-api-sdk-php/lib/PayPal/Api/Cost.php 0000644 00000002611 15213403564 0013725 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; use PayPal\Converter\FormatConverter; use PayPal\Validation\NumericValidator; /** * Class Cost * * Cost as a percent or an amount. For example, to specify 10%, enter `10`. Alternatively, to specify an amount of 5, enter `5`. * * @package PayPal\Api * * @property string percent * @property \PayPal\Api\Currency amount */ class Cost extends PayPalModel { /** * Cost in percent. Range of 0 to 100. * * @param string $percent * * @return $this */ public function setPercent($percent) { NumericValidator::validate($percent, "Percent"); $percent = FormatConverter::formatToNumber($percent); $this->percent = $percent; return $this; } /** * Cost in percent. Range of 0 to 100. * * @return string */ public function getPercent() { return $this->percent; } /** * The cost, as an amount. Valid range is from 0 to 1,000,000. * * @param \PayPal\Api\Currency $amount * * @return $this */ public function setAmount($amount) { $this->amount = $amount; return $this; } /** * The cost, as an amount. Valid range is from 0 to 1,000,000. * * @return \PayPal\Api\Currency */ public function getAmount() { return $this->amount; } } rest-api-sdk-php/lib/PayPal/Api/PayerInfo.php 0000644 00000022017 15213403564 0014713 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class PayerInfo * * A resource representing a information about Payer. * * @package PayPal\Api * * @property string email * @property string external_remember_me_id * @property string buyer_account_number * @property string salutation * @property string first_name * @property string middle_name * @property string last_name * @property string suffix * @property string payer_id * @property string phone * @property string phone_type * @property string birth_date * @property string tax_id * @property string tax_id_type * @property string country_code * @property \PayPal\Api\Address billing_address */ class PayerInfo extends PayPalModel { /** * Email address representing the payer. 127 characters max. * * @param string $email * * @return $this */ public function setEmail($email) { $this->email = $email; return $this; } /** * Email address representing the payer. 127 characters max. * * @return string */ public function getEmail() { return $this->email; } /** * External Remember Me id representing the payer * * @param string $external_remember_me_id * * @return $this */ public function setExternalRememberMeId($external_remember_me_id) { $this->external_remember_me_id = $external_remember_me_id; return $this; } /** * External Remember Me id representing the payer * * @return string */ public function getExternalRememberMeId() { return $this->external_remember_me_id; } /** * Account Number representing the Payer * * @deprecated Use #setBuyerAccountNumberInstead * @param string $account_number * * @return $this */ public function setAccountNumber($account_number) { $this->account_number = $account_number; return $this; } /** * Account Number representing the Payer * * @deprecated Use #getBuyerAccountNumberInstead * * @deprecated Not publicly available * @return string */ public function getAccountNumber() { return $this->account_number; } /** * Account Number representing the Payer * * @param string $buyer_account_number * * @return $this */ public function setBuyerAccountNumber($buyer_account_number) { $this->buyer_account_number = $buyer_account_number; return $this; } /** * Account Number representing the Payer * * @return string */ public function getBuyerAccountNumber() { return $this->buyer_account_number; } /** * Salutation of the payer. * * @param string $salutation * * @return $this */ public function setSalutation($salutation) { $this->salutation = $salutation; return $this; } /** * Salutation of the payer. * * @return string */ public function getSalutation() { return $this->salutation; } /** * First name of the payer. * * @param string $first_name * * @return $this */ public function setFirstName($first_name) { $this->first_name = $first_name; return $this; } /** * First name of the payer. * * @return string */ public function getFirstName() { return $this->first_name; } /** * Middle name of the payer. * * @param string $middle_name * * @return $this */ public function setMiddleName($middle_name) { $this->middle_name = $middle_name; return $this; } /** * Middle name of the payer. * * @return string */ public function getMiddleName() { return $this->middle_name; } /** * Last name of the payer. * * @param string $last_name * * @return $this */ public function setLastName($last_name) { $this->last_name = $last_name; return $this; } /** * Last name of the payer. * * @return string */ public function getLastName() { return $this->last_name; } /** * Suffix of the payer. * * @param string $suffix * * @return $this */ public function setSuffix($suffix) { $this->suffix = $suffix; return $this; } /** * Suffix of the payer. * * @return string */ public function getSuffix() { return $this->suffix; } /** * PayPal assigned encrypted Payer ID. * * @param string $payer_id * * @return $this */ public function setPayerId($payer_id) { $this->payer_id = $payer_id; return $this; } /** * PayPal assigned encrypted Payer ID. * * @return string */ public function getPayerId() { return $this->payer_id; } /** * Phone number representing the payer. 20 characters max. * * @param string $phone * * @return $this */ public function setPhone($phone) { $this->phone = $phone; return $this; } /** * Phone number representing the payer. 20 characters max. * * @return string */ public function getPhone() { return $this->phone; } /** * Phone type * Valid Values: ["HOME", "WORK", "MOBILE", "OTHER"] * * @param string $phone_type * * @return $this */ public function setPhoneType($phone_type) { $this->phone_type = $phone_type; return $this; } /** * Phone type * * @return string */ public function getPhoneType() { return $this->phone_type; } /** * Birth date of the Payer in ISO8601 format (yyyy-mm-dd). * * @param string $birth_date * * @return $this */ public function setBirthDate($birth_date) { $this->birth_date = $birth_date; return $this; } /** * Birth date of the Payer in ISO8601 format (yyyy-mm-dd). * * @return string */ public function getBirthDate() { return $this->birth_date; } /** * Payer’s tax ID. Only supported when the `payment_method` is set to `paypal`. * * @param string $tax_id * * @return $this */ public function setTaxId($tax_id) { $this->tax_id = $tax_id; return $this; } /** * Payer’s tax ID. Only supported when the `payment_method` is set to `paypal`. * * @return string */ public function getTaxId() { return $this->tax_id; } /** * Payer’s tax ID type. Allowed values: `BR_CPF` or `BR_CNPJ`. Only supported when the `payment_method` is set to `paypal`. * Valid Values: ["BR_CPF", "BR_CNPJ"] * * @param string $tax_id_type * * @return $this */ public function setTaxIdType($tax_id_type) { $this->tax_id_type = $tax_id_type; return $this; } /** * Payer’s tax ID type. Allowed values: `BR_CPF` or `BR_CNPJ`. Only supported when the `payment_method` is set to `paypal`. * * @return string */ public function getTaxIdType() { return $this->tax_id_type; } /** * Two-letter registered country code of the payer to identify the buyer country. * * @param string $country_code * * @return $this */ public function setCountryCode($country_code) { $this->country_code = $country_code; return $this; } /** * Two-letter registered country code of the payer to identify the buyer country. * * @return string */ public function getCountryCode() { return $this->country_code; } /** * Billing address of the Payer. * * @param \PayPal\Api\Address $billing_address * * @return $this */ public function setBillingAddress($billing_address) { $this->billing_address = $billing_address; return $this; } /** * Billing address of the Payer. * * @return \PayPal\Api\Address */ public function getBillingAddress() { return $this->billing_address; } /** * @deprecated [DEPRECATED] Use shipping address present in purchase unit or at root level of checkout Session. * * @param \PayPal\Api\ShippingAddress $shipping_address * * @return $this */ public function setShippingAddress($shipping_address) { $this->shipping_address = $shipping_address; return $this; } /** * @deprecated [DEPRECATED] Use shipping address present in purchase unit or at root level of checkout Session. * * @return \PayPal\Api\ShippingAddress */ public function getShippingAddress() { return $this->shipping_address; } } rest-api-sdk-php/lib/PayPal/Api/Payee.php 0000644 00000006713 15213403564 0014067 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class Payee * * A resource representing a Payee who receives the funds and fulfills the order. * * @package PayPal\Api * * @property string email * @property string merchant_id */ class Payee extends PayPalModel { /** * Email Address associated with the Payee's PayPal Account. If the provided email address is not associated with any PayPal Account, the payee can only receive PayPal Wallet Payments. Direct Credit Card Payments will be denied due to card compliance requirements. * * @param string $email * * @return $this */ public function setEmail($email) { $this->email = $email; return $this; } /** * Email Address associated with the Payee's PayPal Account. If the provided email address is not associated with any PayPal Account, the payee can only receive PayPal Wallet Payments. Direct Credit Card Payments will be denied due to card compliance requirements. * * @return string */ public function getEmail() { return $this->email; } /** * Encrypted PayPal account identifier for the Payee. * * @param string $merchant_id * * @return $this */ public function setMerchantId($merchant_id) { $this->merchant_id = $merchant_id; return $this; } /** * Encrypted PayPal account identifier for the Payee. * * @return string */ public function getMerchantId() { return $this->merchant_id; } /** * First Name of the Payee. * @deprecated Not publicly available * @param string $first_name * * @return $this */ public function setFirstName($first_name) { $this->first_name = $first_name; return $this; } /** * First Name of the Payee. * @deprecated Not publicly available * @return string */ public function getFirstName() { return $this->first_name; } /** * Last Name of the Payee. * @deprecated Not publicly available * @param string $last_name * * @return $this */ public function setLastName($last_name) { $this->last_name = $last_name; return $this; } /** * Last Name of the Payee. * @deprecated Not publicly available * @return string */ public function getLastName() { return $this->last_name; } /** * Unencrypted PayPal account Number of the Payee * @deprecated Not publicly available * @param string $account_number * * @return $this */ public function setAccountNumber($account_number) { $this->account_number = $account_number; return $this; } /** * Unencrypted PayPal account Number of the Payee * @deprecated Not publicly available * @return string */ public function getAccountNumber() { return $this->account_number; } /** * Information related to the Payee. * @deprecated Not publicly available * @param \PayPal\Api\Phone $phone * * @return $this */ public function setPhone($phone) { $this->phone = $phone; return $this; } /** * Information related to the Payee. * @deprecated Not publicly available * @return \PayPal\Api\Phone */ public function getPhone() { return $this->phone; } } rest-api-sdk-php/lib/PayPal/Api/PaymentInstruction.php 0000644 00000011066 15213403564 0016700 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalResourceModel; use PayPal\Rest\ApiContext; use PayPal\Validation\ArgumentValidator; /** * Class PaymentInstruction * * Contain details of how and when the payment should be made to PayPal in cases of manual bank transfer. * * @package PayPal\Api * * @property string reference_number * @property string instruction_type * @property \PayPal\Api\RecipientBankingInstruction recipient_banking_instruction * @property \PayPal\Api\Currency amount * @property string payment_due_date * @property string note * @property \PayPal\Api\Links[] links */ class PaymentInstruction extends PayPalResourceModel { /** * ID of payment instruction * * @param string $reference_number * * @return $this */ public function setReferenceNumber($reference_number) { $this->reference_number = $reference_number; return $this; } /** * ID of payment instruction * * @return string */ public function getReferenceNumber() { return $this->reference_number; } /** * Type of payment instruction * Valid Values: ["MANUAL_BANK_TRANSFER", "PAY_UPON_INVOICE"] * * @param string $instruction_type * * @return $this */ public function setInstructionType($instruction_type) { $this->instruction_type = $instruction_type; return $this; } /** * Type of payment instruction * * @return string */ public function getInstructionType() { return $this->instruction_type; } /** * Recipient bank Details. * * @param \PayPal\Api\RecipientBankingInstruction $recipient_banking_instruction * * @return $this */ public function setRecipientBankingInstruction($recipient_banking_instruction) { $this->recipient_banking_instruction = $recipient_banking_instruction; return $this; } /** * Recipient bank Details. * * @return \PayPal\Api\RecipientBankingInstruction */ public function getRecipientBankingInstruction() { return $this->recipient_banking_instruction; } /** * Amount to be transferred * * @param \PayPal\Api\Currency $amount * * @return $this */ public function setAmount($amount) { $this->amount = $amount; return $this; } /** * Amount to be transferred * * @return \PayPal\Api\Currency */ public function getAmount() { return $this->amount; } /** * Date by which payment should be received * * @param string $payment_due_date * * @return $this */ public function setPaymentDueDate($payment_due_date) { $this->payment_due_date = $payment_due_date; return $this; } /** * Date by which payment should be received * * @return string */ public function getPaymentDueDate() { return $this->payment_due_date; } /** * Additional text regarding payment handling * * @param string $note * * @return $this */ public function setNote($note) { $this->note = $note; return $this; } /** * Additional text regarding payment handling * * @return string */ public function getNote() { return $this->note; } /** * Retrieve a payment instruction by passing the payment_id in the request URI. Use this request if you are implementing a solution that includes delayed payment like Pay Upon Invoice (PUI). * * @param string $paymentId * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return PaymentInstruction */ public static function get($paymentId, $apiContext = null, $restCall = null) { ArgumentValidator::validate($paymentId, 'paymentId'); $payLoad = ""; $json = self::executeCall( "/v1/payments/payment/$paymentId/payment-instruction", "GET", $payLoad, null, $apiContext, $restCall ); $ret = new PaymentInstruction(); $ret->fromJson($json); return $ret; } } rest-api-sdk-php/lib/PayPal/Api/PatchRequest.php 0000644 00000003467 15213403564 0015437 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class PatchRequest * * A JSON patch request. * * @package PayPal\Api * * @property \PayPal\Api\Patch[] patches */ class PatchRequest extends PayPalModel { /** * Placeholder for holding array of patch objects * * @param \PayPal\Api\Patch[] $patches * * @return $this */ public function setPatches($patches) { $this->patches = $patches; return $this; } /** * Placeholder for holding array of patch objects * * @return \PayPal\Api\Patch[] */ public function getPatches() { return $this->patches; } /** * Append Patches to the list. * * @param \PayPal\Api\Patch $patch * @return $this */ public function addPatch($patch) { if (!$this->getPatches()) { return $this->setPatches(array($patch)); } else { return $this->setPatches( array_merge($this->getPatches(), array($patch)) ); } } /** * Remove Patches from the list. * * @param \PayPal\Api\Patch $patch * @return $this */ public function removePatch($patch) { return $this->setPatches( array_diff($this->getPatches(), array($patch)) ); } /** * As PatchRequest holds the array of Patch object, we would override the json conversion to return * a json representation of array of Patch objects. * * @param int $options * @return mixed|string */ public function toJSON($options = 0) { $json = array(); foreach ($this->getPatches() as $patch) { $json[] = $patch->toArray(); } return str_replace('\\/', '/', json_encode($json, $options)); } } rest-api-sdk-php/lib/PayPal/Api/BankAccount.php 0000644 00000034014 15213403564 0015207 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class BankAccount * * A resource representing a bank account that can be used to fund a payment. * @deprecated Deprecated. It is for internal use only. It may be removed in next major revision. * * @package PayPal\Api * * @property string account_number * @property string account_number_type * @property string routing_number * @property string account_type * @property string account_name * @property string check_type * @property string auth_type * @property string auth_capture_timestamp * @property string bank_name * @property string country_code * @property string first_name * @property string last_name * @property string birth_date * @property \PayPal\Api\Address billing_address * @property string state * @property string confirmation_status * @property string payer_id * @property string external_customer_id * @property string merchant_id * @property string create_time * @property string update_time * @property string valid_until * @property \PayPal\Api\Links[] links */ class BankAccount extends PayPalModel { /** * ID of the bank account being saved for later use. * @deprecated Not publicly available * @param string $id * * @return $this */ public function setId($id) { $this->id = $id; return $this; } /** * ID of the bank account being saved for later use. * @deprecated Not publicly available * @return string */ public function getId() { return $this->id; } /** * Account number in either IBAN (max length 34) or BBAN (max length 17) format. * * @param string $account_number * * @return $this */ public function setAccountNumber($account_number) { $this->account_number = $account_number; return $this; } /** * Account number in either IBAN (max length 34) or BBAN (max length 17) format. * * @return string */ public function getAccountNumber() { return $this->account_number; } /** * Type of the bank account number (International or Basic Bank Account Number). For more information refer to http://en.wikipedia.org/wiki/International_Bank_Account_Number. * Valid Values: ["BBAN", "IBAN"] * * @param string $account_number_type * * @return $this */ public function setAccountNumberType($account_number_type) { $this->account_number_type = $account_number_type; return $this; } /** * Type of the bank account number (International or Basic Bank Account Number). For more information refer to http://en.wikipedia.org/wiki/International_Bank_Account_Number. * * @return string */ public function getAccountNumberType() { return $this->account_number_type; } /** * Routing transit number (aka Bank Code) of the bank (typically for domestic use only - for international use, IBAN includes bank code). For more information refer to http://en.wikipedia.org/wiki/Bank_code. * * @param string $routing_number * * @return $this */ public function setRoutingNumber($routing_number) { $this->routing_number = $routing_number; return $this; } /** * Routing transit number (aka Bank Code) of the bank (typically for domestic use only - for international use, IBAN includes bank code). For more information refer to http://en.wikipedia.org/wiki/Bank_code. * * @return string */ public function getRoutingNumber() { return $this->routing_number; } /** * Type of the bank account. * Valid Values: ["CHECKING", "SAVINGS"] * * @param string $account_type * * @return $this */ public function setAccountType($account_type) { $this->account_type = $account_type; return $this; } /** * Type of the bank account. * * @return string */ public function getAccountType() { return $this->account_type; } /** * A customer designated name. * * @param string $account_name * * @return $this */ public function setAccountName($account_name) { $this->account_name = $account_name; return $this; } /** * A customer designated name. * * @return string */ public function getAccountName() { return $this->account_name; } /** * Type of the check when this information was obtained through a check by the facilitator or merchant. * Valid Values: ["PERSONAL", "COMPANY"] * * @param string $check_type * * @return $this */ public function setCheckType($check_type) { $this->check_type = $check_type; return $this; } /** * Type of the check when this information was obtained through a check by the facilitator or merchant. * * @return string */ public function getCheckType() { return $this->check_type; } /** * How the check was obtained from the customer, if check was the source of the information provided. * Valid Values: ["CCD", "PPD", "TEL", "POP", "ARC", "RCK", "WEB"] * * @param string $auth_type * * @return $this */ public function setAuthType($auth_type) { $this->auth_type = $auth_type; return $this; } /** * How the check was obtained from the customer, if check was the source of the information provided. * * @return string */ public function getAuthType() { return $this->auth_type; } /** * Time at which the authorization (or check) was captured. Use this field if the user authorization needs to be captured due to any privacy requirements. * * @param string $auth_capture_timestamp * * @return $this */ public function setAuthCaptureTimestamp($auth_capture_timestamp) { $this->auth_capture_timestamp = $auth_capture_timestamp; return $this; } /** * Time at which the authorization (or check) was captured. Use this field if the user authorization needs to be captured due to any privacy requirements. * * @return string */ public function getAuthCaptureTimestamp() { return $this->auth_capture_timestamp; } /** * Name of the bank. * * @param string $bank_name * * @return $this */ public function setBankName($bank_name) { $this->bank_name = $bank_name; return $this; } /** * Name of the bank. * * @return string */ public function getBankName() { return $this->bank_name; } /** * 2 letter country code of the Bank. * * @param string $country_code * * @return $this */ public function setCountryCode($country_code) { $this->country_code = $country_code; return $this; } /** * 2 letter country code of the Bank. * * @return string */ public function getCountryCode() { return $this->country_code; } /** * Account holder's first name. * * @param string $first_name * * @return $this */ public function setFirstName($first_name) { $this->first_name = $first_name; return $this; } /** * Account holder's first name. * * @return string */ public function getFirstName() { return $this->first_name; } /** * Account holder's last name. * * @param string $last_name * * @return $this */ public function setLastName($last_name) { $this->last_name = $last_name; return $this; } /** * Account holder's last name. * * @return string */ public function getLastName() { return $this->last_name; } /** * Birth date of the bank account holder. * * @param string $birth_date * * @return $this */ public function setBirthDate($birth_date) { $this->birth_date = $birth_date; return $this; } /** * Birth date of the bank account holder. * * @return string */ public function getBirthDate() { return $this->birth_date; } /** * Billing address. * * @param \PayPal\Api\Address $billing_address * * @return $this */ public function setBillingAddress($billing_address) { $this->billing_address = $billing_address; return $this; } /** * Billing address. * * @return \PayPal\Api\Address */ public function getBillingAddress() { return $this->billing_address; } /** * State of this funding instrument. * Valid Values: ["ACTIVE", "INACTIVE", "DELETED"] * * @param string $state * * @return $this */ public function setState($state) { $this->state = $state; return $this; } /** * State of this funding instrument. * * @return string */ public function getState() { return $this->state; } /** * Confirmation status of a bank account. * Valid Values: ["UNCONFIRMED", "CONFIRMED"] * * @param string $confirmation_status * * @return $this */ public function setConfirmationStatus($confirmation_status) { $this->confirmation_status = $confirmation_status; return $this; } /** * Confirmation status of a bank account. * * @return string */ public function getConfirmationStatus() { return $this->confirmation_status; } /** * [DEPRECATED] Use external_customer_id instead. * * @param string $payer_id * * @return $this */ public function setPayerId($payer_id) { $this->payer_id = $payer_id; return $this; } /** * @deprecated [DEPRECATED] Use external_customer_id instead. * * @return string */ public function getPayerId() { return $this->payer_id; } /** * A unique identifier of the customer to whom this bank account belongs to. Generated and provided by the facilitator. This is required when creating or using a stored funding instrument in vault. * * @param string $external_customer_id * * @return $this */ public function setExternalCustomerId($external_customer_id) { $this->external_customer_id = $external_customer_id; return $this; } /** * A unique identifier of the customer to whom this bank account belongs to. Generated and provided by the facilitator. This is required when creating or using a stored funding instrument in vault. * * @return string */ public function getExternalCustomerId() { return $this->external_customer_id; } /** * A unique identifier of the merchant for which this bank account has been stored for. Generated and provided by the facilitator so it can be used to restrict the usage of the bank account to the specific merchant. * * @param string $merchant_id * * @return $this */ public function setMerchantId($merchant_id) { $this->merchant_id = $merchant_id; return $this; } /** * A unique identifier of the merchant for which this bank account has been stored for. Generated and provided by the facilitator so it can be used to restrict the usage of the bank account to the specific merchant. * * @return string */ public function getMerchantId() { return $this->merchant_id; } /** * Time the resource was created. * * @param string $create_time * * @return $this */ public function setCreateTime($create_time) { $this->create_time = $create_time; return $this; } /** * Time the resource was created. * * @return string */ public function getCreateTime() { return $this->create_time; } /** * Time the resource was last updated. * * @param string $update_time * * @return $this */ public function setUpdateTime($update_time) { $this->update_time = $update_time; return $this; } /** * Time the resource was last updated. * * @return string */ public function getUpdateTime() { return $this->update_time; } /** * Date/Time until this resource can be used to fund a payment. * * @param string $valid_until * * @return $this */ public function setValidUntil($valid_until) { $this->valid_until = $valid_until; return $this; } /** * Date/Time until this resource can be used to fund a payment. * * @return string */ public function getValidUntil() { return $this->valid_until; } /** * Sets Links * * @param \PayPal\Api\Links[] $links * * @return $this */ public function setLinks($links) { $this->links = $links; return $this; } /** * Gets Links * * @return \PayPal\Api\Links[] */ public function getLinks() { return $this->links; } /** * Append Links to the list. * * @param \PayPal\Api\Links $links * @return $this */ public function addLink($links) { if (!$this->getLinks()) { return $this->setLinks(array($links)); } else { return $this->setLinks( array_merge($this->getLinks(), array($links)) ); } } /** * Remove Links from the list. * * @param \PayPal\Api\Links $links * @return $this */ public function removeLink($links) { return $this->setLinks( array_diff($this->getLinks(), array($links)) ); } } rest-api-sdk-php/lib/PayPal/Api/OpenIdSession.php 0000644 00000007307 15213403564 0015546 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Core\PayPalConstants; use PayPal\Rest\ApiContext; class OpenIdSession { /** * Returns the PayPal URL to which the user must be redirected to * start the authentication / authorization process. * * @param string $redirectUri Uri on merchant website to where * the user must be redirected to post paypal login * @param array $scope The access privilges that you are requesting for * from the user. Pass empty array for all scopes. * @param string $clientId client id from developer portal * See https://developer.paypal.com/docs/integration/direct/log-in-with-paypal/detailed/#attributes for more * @param null $nonce * @param null $state * @param ApiContext $apiContext Optional API Context * @return string Authorization URL */ public static function getAuthorizationUrl($redirectUri, $scope, $clientId, $nonce = null, $state = null, $apiContext = null) { $apiContext = $apiContext ? $apiContext : new ApiContext(); $config = $apiContext->getConfig(); if ($apiContext->get($clientId)) { $clientId = $apiContext->get($clientId); } $clientId = $clientId ? $clientId : $apiContext->getCredential()->getClientId(); $scope = count($scope) != 0 ? $scope : array('openid', 'profile', 'address', 'email', 'phone', 'https://uri.paypal.com/services/paypalattributes', 'https://uri.paypal.com/services/expresscheckout'); if (!in_array('openid', $scope)) { $scope[] = 'openid'; } $params = array( 'client_id' => $clientId, 'response_type' => 'code', 'scope' => implode(" ", $scope), 'redirect_uri' => $redirectUri ); if ($nonce) { $params['nonce'] = $nonce; } if ($state) { $params['state'] = $state; } return sprintf("%s/signin/authorize?%s", self::getBaseUrl($config), http_build_query($params)); } /** * Returns the URL to which the user must be redirected to * logout from the OpenID provider (i.e. PayPal) * * @param string $redirectUri Uri on merchant website to where * the user must be redirected to post logout * @param string $idToken id_token from the TokenInfo object * @param ApiContext $apiContext Optional API Context * @return string logout URL */ public static function getLogoutUrl($redirectUri, $idToken, $apiContext = null) { if (is_null($apiContext)) { $apiContext = new ApiContext(); } $config = $apiContext->getConfig(); $params = array( 'id_token' => $idToken, 'redirect_uri' => $redirectUri, 'logout' => 'true' ); return sprintf("%s/webapps/auth/protocol/openidconnect/v1/endsession?%s", self::getBaseUrl($config), http_build_query($params)); } /** * Gets the base URL for the Redirect URI * * @param $config * @return null|string */ private static function getBaseUrl($config) { if (array_key_exists('openid.RedirectUri', $config)) { return $config['openid.RedirectUri']; } else if (array_key_exists('mode', $config)) { switch (strtoupper($config['mode'])) { case 'SANDBOX': return PayPalConstants::OPENID_REDIRECT_SANDBOX_URL; case 'LIVE': return PayPalConstants::OPENID_REDIRECT_LIVE_URL; } } return null; } } rest-api-sdk-php/lib/PayPal/Api/PayoutBatchHeader.php 0000644 00000012530 15213403564 0016352 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class PayoutBatchHeader * * Batch header resource. * * @package PayPal\Api * * @property string payout_batch_id * @property string batch_status * @property string time_created * @property string time_completed * @property \PayPal\Api\PayoutSenderBatchHeader sender_batch_header * @property \PayPal\Api\Currency amount * @property \PayPal\Api\Currency fees * @property \PayPal\Api\Error errors * @property \PayPal\Api\Links[] links */ class PayoutBatchHeader extends PayPalModel { /** * The PayPal-generated ID for a batch payout. * * @param string $payout_batch_id * * @return $this */ public function setPayoutBatchId($payout_batch_id) { $this->payout_batch_id = $payout_batch_id; return $this; } /** * The PayPal-generated ID for a batch payout. * * @return string */ public function getPayoutBatchId() { return $this->payout_batch_id; } /** * The PayPal-generated batch payout status. If the batch payout passes the preliminary checks, the status is `PENDING`. * * @param string $batch_status * * @return $this */ public function setBatchStatus($batch_status) { $this->batch_status = $batch_status; return $this; } /** * The PayPal-generated batch payout status. If the batch payout passes the preliminary checks, the status is `PENDING`. * * @return string */ public function getBatchStatus() { return $this->batch_status; } /** * The time the batch entered processing. * * @param string $time_created * * @return $this */ public function setTimeCreated($time_created) { $this->time_created = $time_created; return $this; } /** * The time the batch entered processing. * * @return string */ public function getTimeCreated() { return $this->time_created; } /** * The time that processing for the batch was completed. * * @param string $time_completed * * @return $this */ public function setTimeCompleted($time_completed) { $this->time_completed = $time_completed; return $this; } /** * The time that processing for the batch was completed. * * @return string */ public function getTimeCompleted() { return $this->time_completed; } /** * The original batch header as provided by the payment sender. * * @param \PayPal\Api\PayoutSenderBatchHeader $sender_batch_header * * @return $this */ public function setSenderBatchHeader($sender_batch_header) { $this->sender_batch_header = $sender_batch_header; return $this; } /** * The sender-provided batch payout header. * * @return \PayPal\Api\PayoutSenderBatchHeader */ public function getSenderBatchHeader() { return $this->sender_batch_header; } /** * Total amount, in U.S. dollars, requested for the applicable payouts. * * @param \PayPal\Api\Currency $amount * * @return $this */ public function setAmount($amount) { $this->amount = $amount; return $this; } /** * Total amount, in U.S. dollars, requested for the applicable payouts. * * @return \PayPal\Api\Currency */ public function getAmount() { return $this->amount; } /** * Total estimate in U.S. dollars for the applicable payouts fees. * * @param \PayPal\Api\Currency $fees * * @return $this */ public function setFees($fees) { $this->fees = $fees; return $this; } /** * Total estimate in U.S. dollars for the applicable payouts fees. * * @return \PayPal\Api\Currency */ public function getFees() { return $this->fees; } /** * Sets Errors * * @param \PayPal\Api\Error $errors * * @return $this */ public function setErrors($errors) { $this->errors = $errors; return $this; } /** * Gets Errors * * @return \PayPal\Api\Error */ public function getErrors() { return $this->errors; } /** * Sets Links * * @param \PayPal\Api\Links[] $links * * @return $this */ public function setLinks($links) { $this->links = $links; return $this; } /** * Gets Links * * @return \PayPal\Api\Links[] */ public function getLinks() { return $this->links; } /** * Append Links to the list. * * @param \PayPal\Api\Links $links * @return $this */ public function addLink($links) { if (!$this->getLinks()) { return $this->setLinks(array($links)); } else { return $this->setLinks( array_merge($this->getLinks(), array($links)) ); } } /** * Remove Links from the list. * * @param \PayPal\Api\Links $links * @return $this */ public function removeLink($links) { return $this->setLinks( array_diff($this->getLinks(), array($links)) ); } } rest-api-sdk-php/lib/PayPal/Api/Metadata.php 0000644 00000012512 15213403564 0014536 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; use PayPal\Validation\UrlValidator; /** * Class Metadata * * Audit information for the resource. * * @package PayPal\Api * * @property string created_date * @property string created_by * @property string cancelled_date * @property string cancelled_by * @property string last_updated_date * @property string last_updated_by * @property string first_sent_date * @property string last_sent_date * @property string last_sent_by * @property string payer_view_url */ class Metadata extends PayPalModel { /** * The date and time when the resource was created. * * @param string $created_date * * @return $this */ public function setCreatedDate($created_date) { $this->created_date = $created_date; return $this; } /** * The date and time when the resource was created. * * @return string */ public function getCreatedDate() { return $this->created_date; } /** * The email address of the account that created the resource. * * @param string $created_by * * @return $this */ public function setCreatedBy($created_by) { $this->created_by = $created_by; return $this; } /** * The email address of the account that created the resource. * * @return string */ public function getCreatedBy() { return $this->created_by; } /** * The date and time when the resource was cancelled. * * @param string $cancelled_date * * @return $this */ public function setCancelledDate($cancelled_date) { $this->cancelled_date = $cancelled_date; return $this; } /** * The date and time when the resource was cancelled. * * @return string */ public function getCancelledDate() { return $this->cancelled_date; } /** * The actor who cancelled the resource. * * @param string $cancelled_by * * @return $this */ public function setCancelledBy($cancelled_by) { $this->cancelled_by = $cancelled_by; return $this; } /** * The actor who cancelled the resource. * * @return string */ public function getCancelledBy() { return $this->cancelled_by; } /** * The date and time when the resource was last edited. * * @param string $last_updated_date * * @return $this */ public function setLastUpdatedDate($last_updated_date) { $this->last_updated_date = $last_updated_date; return $this; } /** * The date and time when the resource was last edited. * * @return string */ public function getLastUpdatedDate() { return $this->last_updated_date; } /** * The email address of the account that last edited the resource. * * @param string $last_updated_by * * @return $this */ public function setLastUpdatedBy($last_updated_by) { $this->last_updated_by = $last_updated_by; return $this; } /** * The email address of the account that last edited the resource. * * @return string */ public function getLastUpdatedBy() { return $this->last_updated_by; } /** * The date and time when the resource was first sent. * * @param string $first_sent_date * * @return $this */ public function setFirstSentDate($first_sent_date) { $this->first_sent_date = $first_sent_date; return $this; } /** * The date and time when the resource was first sent. * * @return string */ public function getFirstSentDate() { return $this->first_sent_date; } /** * The date and time when the resource was last sent. * * @param string $last_sent_date * * @return $this */ public function setLastSentDate($last_sent_date) { $this->last_sent_date = $last_sent_date; return $this; } /** * The date and time when the resource was last sent. * * @return string */ public function getLastSentDate() { return $this->last_sent_date; } /** * The email address of the account that last sent the resource. * * @param string $last_sent_by * * @return $this */ public function setLastSentBy($last_sent_by) { $this->last_sent_by = $last_sent_by; return $this; } /** * The email address of the account that last sent the resource. * * @return string */ public function getLastSentBy() { return $this->last_sent_by; } /** * URL representing the payer's view of the invoice. * * @param string $payer_view_url * @throws \InvalidArgumentException * @return $this */ public function setPayerViewUrl($payer_view_url) { UrlValidator::validate($payer_view_url, "PayerViewUrl"); $this->payer_view_url = $payer_view_url; return $this; } /** * URL representing the payer's view of the invoice. * * @return string */ public function getPayerViewUrl() { return $this->payer_view_url; } } rest-api-sdk-php/lib/PayPal/Api/MerchantInfo.php 0000644 00000013006 15213403564 0015372 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class MerchantInfo * * Merchant business information that appears on the invoice. * * @package PayPal\Api * * @property string email * @property string first_name * @property string last_name * @property \PayPal\Api\InvoiceAddress address * @property string business_name * @property \PayPal\Api\Phone phone * @property \PayPal\Api\Phone fax * @property string website * @property string tax_id * @property string additional_info_label * @property string additional_info */ class MerchantInfo extends PayPalModel { /** * The merchant email address. Maximum length is 260 characters. * * @param string $email * * @return $this */ public function setEmail($email) { $this->email = $email; return $this; } /** * The merchant email address. Maximum length is 260 characters. * * @return string */ public function getEmail() { return $this->email; } /** * The merchant first name. Maximum length is 30 characters. * * @param string $first_name * * @return $this */ public function setFirstName($first_name) { $this->first_name = $first_name; return $this; } /** * The merchant first name. Maximum length is 30 characters. * * @return string */ public function getFirstName() { return $this->first_name; } /** * The merchant last name. Maximum length is 30 characters. * * @param string $last_name * * @return $this */ public function setLastName($last_name) { $this->last_name = $last_name; return $this; } /** * The merchant last name. Maximum length is 30 characters. * * @return string */ public function getLastName() { return $this->last_name; } /** * The merchant address. * * @param \PayPal\Api\InvoiceAddress $address * * @return $this */ public function setAddress($address) { $this->address = $address; return $this; } /** * The merchant address. * * @return \PayPal\Api\InvoiceAddress */ public function getAddress() { return $this->address; } /** * The merchant company business name. Maximum length is 100 characters. * * @param string $business_name * * @return $this */ public function setBusinessName($business_name) { $this->business_name = $business_name; return $this; } /** * The merchant company business name. Maximum length is 100 characters. * * @return string */ public function getBusinessName() { return $this->business_name; } /** * The merchant phone number. * * @param \PayPal\Api\Phone $phone * * @return $this */ public function setPhone($phone) { $this->phone = $phone; return $this; } /** * The merchant phone number. * * @return \PayPal\Api\Phone */ public function getPhone() { return $this->phone; } /** * The merchant fax number. * * @param \PayPal\Api\Phone $fax * * @return $this */ public function setFax($fax) { $this->fax = $fax; return $this; } /** * The merchant fax number. * * @return \PayPal\Api\Phone */ public function getFax() { return $this->fax; } /** * The merchant website. Maximum length is 2048 characters. * * @param string $website * * @return $this */ public function setWebsite($website) { $this->website = $website; return $this; } /** * The merchant website. Maximum length is 2048 characters. * * @return string */ public function getWebsite() { return $this->website; } /** * The merchant tax ID. Maximum length is 100 characters. * * @param string $tax_id * * @return $this */ public function setTaxId($tax_id) { $this->tax_id = $tax_id; return $this; } /** * The merchant tax ID. Maximum length is 100 characters. * * @return string */ public function getTaxId() { return $this->tax_id; } /** * Option to provide a label to the additional_info field. 40 characters max. * * @param string $additional_info_label * * @return $this */ public function setAdditionalInfoLabel($additional_info_label) { $this->additional_info_label = $additional_info_label; return $this; } /** * Option to provide a label to the additional_info field. 40 characters max. * * @return string */ public function getAdditionalInfoLabel() { return $this->additional_info_label; } /** * Additional information, such as business hours. Maximum length is 40 characters. * * @param string $additional_info * * @return $this */ public function setAdditionalInfo($additional_info) { $this->additional_info = $additional_info; return $this; } /** * Additional information, such as business hours. Maximum length is 40 characters. * * @return string */ public function getAdditionalInfo() { return $this->additional_info; } } rest-api-sdk-php/lib/PayPal/Api/Phone.php 0000644 00000003047 15213403564 0014072 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class Phone * * Information related to the Payee. * * @package PayPal\Api * * @property string country_code * @property string national_number * @property string extension */ class Phone extends PayPalModel { /** * Country code (from in E.164 format) * * @param string $country_code * * @return $this */ public function setCountryCode($country_code) { $this->country_code = $country_code; return $this; } /** * Country code (from in E.164 format) * * @return string */ public function getCountryCode() { return $this->country_code; } /** * In-country phone number (from in E.164 format) * * @param string $national_number * * @return $this */ public function setNationalNumber($national_number) { $this->national_number = $national_number; return $this; } /** * In-country phone number (from in E.164 format) * * @return string */ public function getNationalNumber() { return $this->national_number; } /** * Phone extension * * @param string $extension * * @return $this */ public function setExtension($extension) { $this->extension = $extension; return $this; } /** * Phone extension * * @return string */ public function getExtension() { return $this->extension; } } rest-api-sdk-php/lib/PayPal/Api/WebhookEventType.php 0000644 00000006426 15213403564 0016267 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalResourceModel; use PayPal\Validation\ArgumentValidator; use PayPal\Api\WebhookEventTypeList; use PayPal\Rest\ApiContext; /** * Class WebhookEventType * * A list of events. * * @package PayPal\Api * * @property string name * @property string description * @property string status */ class WebhookEventType extends PayPalResourceModel { /** * The unique event name. * * @param string $name * * @return $this */ public function setName($name) { $this->name = $name; return $this; } /** * The unique event name. * * @return string */ public function getName() { return $this->name; } /** * A human-readable description of the event. * * @param string $description * * @return $this */ public function setDescription($description) { $this->description = $description; return $this; } /** * A human-readable description of the event. * * @return string */ public function getDescription() { return $this->description; } /** * The status of a webhook event. * * @param string $status * * @return $this */ public function setStatus($status) { $this->status = $status; return $this; } /** * The status of a webhook event. * * @return string */ public function getStatus() { return $this->status; } /** * Lists event subscriptions for a webhook, by ID. * * @param string $webhookId * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return WebhookEventTypeList */ public static function subscribedEventTypes($webhookId, $apiContext = null, $restCall = null) { ArgumentValidator::validate($webhookId, 'webhookId'); $payLoad = ""; $json = self::executeCall( "/v1/notifications/webhooks/$webhookId/event-types", "GET", $payLoad, null, $apiContext, $restCall ); $ret = new WebhookEventTypeList(); $ret->fromJson($json); return $ret; } /** * Lists available events to which any webhook can subscribe. For a list of supported events, see [Webhook events](/docs/integration/direct/rest/webhooks/webhook-events/). * * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return WebhookEventTypeList */ public static function availableEventTypes($apiContext = null, $restCall = null) { $payLoad = ""; $json = self::executeCall( "/v1/notifications/webhooks-event-types", "GET", $payLoad, null, $apiContext, $restCall ); $ret = new WebhookEventTypeList(); $ret->fromJson($json); return $ret; } } rest-api-sdk-php/lib/PayPal/Api/PaymentTerm.php 0000644 00000003161 15213403564 0015263 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class PaymentTerm * * The payment term of the invoice. If you specify `term_type`, you cannot specify `due_date` and vice versa. * * @package PayPal\Api * * @property string term_type * @property string due_date */ class PaymentTerm extends PayPalModel { /** * The terms by which the invoice payment is due. * Valid Values: ["DUE_ON_RECEIPT", "DUE_ON_DATE_SPECIFIED", "NET_10", "NET_15", "NET_30", "NET_45", "NET_60", "NET_90", "NO_DUE_DATE"] * * @param string $term_type * * @return $this */ public function setTermType($term_type) { $this->term_type = $term_type; return $this; } /** * The terms by which the invoice payment is due. * * @return string */ public function getTermType() { return $this->term_type; } /** * The date when the invoice payment is due. This date must be a future date. Date format is *yyyy*-*MM*-*dd* *z*, as defined in [Internet Date/Time Format](http://tools.ietf.org/html/rfc3339#section-5.6). * * @param string $due_date * * @return $this */ public function setDueDate($due_date) { $this->due_date = $due_date; return $this; } /** * The date when the invoice payment is due. This date must be a future date. Date format is *yyyy*-*MM*-*dd* *z*, as defined in [Internet Date/Time Format](http://tools.ietf.org/html/rfc3339#section-5.6). * * @return string */ public function getDueDate() { return $this->due_date; } } rest-api-sdk-php/lib/PayPal/Api/InputFields.php 0000644 00000006040 15213403564 0015243 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class InputFields * * Parameters for input fields customization. * * @package PayPal\Api * * @property bool allow_note * @property int no_shipping * @property int address_override */ class InputFields extends PayPalModel { /** * Indicates whether the buyer can enter a note to the merchant on the PayPal page during checkout. * * @param bool $allow_note * * @return $this */ public function setAllowNote($allow_note) { $this->allow_note = $allow_note; return $this; } /** * Indicates whether the buyer can enter a note to the merchant on the PayPal page during checkout. * * @return bool */ public function getAllowNote() { return $this->allow_note; } /** * Indicates whether PayPal displays shipping address fields on the experience pages. Valid value is `0`, `1`, or `2`. Set to `0` to display the shipping address on the PayPal pages. Set to `1` to redact shipping address fields from the PayPal pages. Set to `2` to not pass the shipping address but instead get it from the buyer's account profile. For digital goods, this field is required and value must be `1`. * * @param int $no_shipping * * @return $this */ public function setNoShipping($no_shipping) { $this->no_shipping = $no_shipping; return $this; } /** * Indicates whether PayPal displays shipping address fields on the experience pages. Valid value is `0`, `1`, or `2`. Set to `0` to display the shipping address on the PayPal pages. Set to `1` to redact shipping address fields from the PayPal pages. Set to `2` to not pass the shipping address but instead get it from the buyer's account profile. For digital goods, this field is required and value must be `1`. * * @return int */ public function getNoShipping() { return $this->no_shipping; } /** * Indicates whether to display the shipping address that is passed to this call rather than the one on file with PayPal for this buyer on the PayPal experience pages. Valid value is `0` or `1`. Set to `0` to display the shipping address on file. Set to `1` to display the shipping address supplied to this call; the buyer cannot edit this shipping address. * * @param int $address_override * * @return $this */ public function setAddressOverride($address_override) { $this->address_override = $address_override; return $this; } /** * Indicates whether to display the shipping address that is passed to this call rather than the one on file with PayPal for this buyer on the PayPal experience pages. Valid value is `0` or `1`. Set to `0` to display the shipping address on file. Set to `1` to display the shipping address supplied to this call; the buyer cannot edit this shipping address. * * @return int */ public function getAddressOverride() { return $this->address_override; } } rest-api-sdk-php/lib/PayPal/Api/PaymentSummary.php 0000644 00000002166 15213403564 0016015 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class PaymentSummary * * Payment/Refund break up * * @package PayPal\Api * * @property \PayPal\Api\Currency paypal * @property \PayPal\Api\Currency other */ class PaymentSummary extends PayPalModel { /** * Total Amount paid/refunded via PayPal. * * @param \PayPal\Api\Currency $paypal * * @return $this */ public function setPaypal($paypal) { $this->paypal = $paypal; return $this; } /** * Total Amount paid/refunded via PayPal. * * @return \PayPal\Api\Currency */ public function getPaypal() { return $this->paypal; } /** * Total Amount paid/refunded via other sources. * * @param \PayPal\Api\Currency $other * * @return $this */ public function setOther($other) { $this->other = $other; return $this; } /** * Total Amount paid/refunded via other sources. * * @return \PayPal\Api\Currency */ public function getOther() { return $this->other; } } rest-api-sdk-php/lib/PayPal/Api/AgreementDetails.php 0000644 00000011263 15213403564 0016235 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class AgreementDetails * * A resource representing the agreement details. * * @package PayPal\Api * * @property \PayPal\Api\Currency outstanding_balance * @property string cycles_remaining * @property string cycles_completed * @property string next_billing_date * @property string last_payment_date * @property \PayPal\Api\Currency last_payment_amount * @property string final_payment_date * @property string failed_payment_count */ class AgreementDetails extends PayPalModel { /** * The outstanding balance for this agreement. * * @param \PayPal\Api\Currency $outstanding_balance * * @return $this */ public function setOutstandingBalance($outstanding_balance) { $this->outstanding_balance = $outstanding_balance; return $this; } /** * The outstanding balance for this agreement. * * @return \PayPal\Api\Currency */ public function getOutstandingBalance() { return $this->outstanding_balance; } /** * Number of cycles remaining for this agreement. * * @param string $cycles_remaining * * @return $this */ public function setCyclesRemaining($cycles_remaining) { $this->cycles_remaining = $cycles_remaining; return $this; } /** * Number of cycles remaining for this agreement. * * @return string */ public function getCyclesRemaining() { return $this->cycles_remaining; } /** * Number of cycles completed for this agreement. * * @param string $cycles_completed * * @return $this */ public function setCyclesCompleted($cycles_completed) { $this->cycles_completed = $cycles_completed; return $this; } /** * Number of cycles completed for this agreement. * * @return string */ public function getCyclesCompleted() { return $this->cycles_completed; } /** * The next billing date for this agreement, represented as 2014-02-19T10:00:00Z format. * * @param string $next_billing_date * * @return $this */ public function setNextBillingDate($next_billing_date) { $this->next_billing_date = $next_billing_date; return $this; } /** * The next billing date for this agreement, represented as 2014-02-19T10:00:00Z format. * * @return string */ public function getNextBillingDate() { return $this->next_billing_date; } /** * Last payment date for this agreement, represented as 2014-06-09T09:42:31Z format. * * @param string $last_payment_date * * @return $this */ public function setLastPaymentDate($last_payment_date) { $this->last_payment_date = $last_payment_date; return $this; } /** * Last payment date for this agreement, represented as 2014-06-09T09:42:31Z format. * * @return string */ public function getLastPaymentDate() { return $this->last_payment_date; } /** * Last payment amount for this agreement. * * @param \PayPal\Api\Currency $last_payment_amount * * @return $this */ public function setLastPaymentAmount($last_payment_amount) { $this->last_payment_amount = $last_payment_amount; return $this; } /** * Last payment amount for this agreement. * * @return \PayPal\Api\Currency */ public function getLastPaymentAmount() { return $this->last_payment_amount; } /** * Last payment date for this agreement, represented as 2015-02-19T10:00:00Z format. * * @param string $final_payment_date * * @return $this */ public function setFinalPaymentDate($final_payment_date) { $this->final_payment_date = $final_payment_date; return $this; } /** * Last payment date for this agreement, represented as 2015-02-19T10:00:00Z format. * * @return string */ public function getFinalPaymentDate() { return $this->final_payment_date; } /** * Total number of failed payments for this agreement. * * @param string $failed_payment_count * * @return $this */ public function setFailedPaymentCount($failed_payment_count) { $this->failed_payment_count = $failed_payment_count; return $this; } /** * Total number of failed payments for this agreement. * * @return string */ public function getFailedPaymentCount() { return $this->failed_payment_count; } } rest-api-sdk-php/lib/PayPal/Api/Webhook.php 0000644 00000017766 15213403564 0014434 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalResourceModel; use PayPal\Validation\ArgumentValidator; use PayPal\Api\WebhookList; use PayPal\Rest\ApiContext; use PayPal\Validation\UrlValidator; /** * Class Webhook * * One or more webhook objects. * * @package PayPal\Api * * @property string id * @property string url * @property \PayPal\Api\WebhookEventType[] event_types */ class Webhook extends PayPalResourceModel { /** * The ID of the webhook. * * @param string $id * * @return $this */ public function setId($id) { $this->id = $id; return $this; } /** * The ID of the webhook. * * @return string */ public function getId() { return $this->id; } /** * The URL that is configured to listen on `localhost` for incoming `POST` notification messages that contain event information. * * @param string $url * @throws \InvalidArgumentException * @return $this */ public function setUrl($url) { UrlValidator::validate($url, "Url"); $this->url = $url; return $this; } /** * The URL that is configured to listen on `localhost` for incoming `POST` notification messages that contain event information. * * @return string */ public function getUrl() { return $this->url; } /** * A list of up to ten events to which to subscribe your webhook. To subscribe to all events including new events as they are added, specify the asterisk (`*`) wildcard. To replace the `event_types` array, specify the `*` wildcard. To see all supported events, [list available events](#available-event-type.list). * * @param \PayPal\Api\WebhookEventType[] $event_types * * @return $this */ public function setEventTypes($event_types) { $this->event_types = $event_types; return $this; } /** * A list of up to ten events to which to subscribe your webhook. To subscribe to all events including new events as they are added, specify the asterisk (`*`) wildcard. To replace the `event_types` array, specify the `*` wildcard. To see all supported events, [list available events](#available-event-type.list). * * @return \PayPal\Api\WebhookEventType[] */ public function getEventTypes() { return $this->event_types; } /** * Append EventTypes to the list. * * @param \PayPal\Api\WebhookEventType $webhookEventType * @return $this */ public function addEventType($webhookEventType) { if (!$this->getEventTypes()) { return $this->setEventTypes(array($webhookEventType)); } else { return $this->setEventTypes( array_merge($this->getEventTypes(), array($webhookEventType)) ); } } /** * Remove EventTypes from the list. * * @param \PayPal\Api\WebhookEventType $webhookEventType * @return $this */ public function removeEventType($webhookEventType) { return $this->setEventTypes( array_diff($this->getEventTypes(), array($webhookEventType)) ); } /** * Subscribes your webhook listener to events. A successful call returns a [`webhook`](/docs/api/webhooks/#definition-webhook) object, which includes the webhook ID for later use. * * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return Webhook */ public function create($apiContext = null, $restCall = null) { $payLoad = $this->toJSON(); $json = self::executeCall( "/v1/notifications/webhooks", "POST", $payLoad, null, $apiContext, $restCall ); $this->fromJson($json); return $this; } /** * Shows details for a webhook, by ID. * * @param string $webhookId * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return Webhook */ public static function get($webhookId, $apiContext = null, $restCall = null) { ArgumentValidator::validate($webhookId, 'webhookId'); $payLoad = ""; $json = self::executeCall( "/v1/notifications/webhooks/$webhookId", "GET", $payLoad, null, $apiContext, $restCall ); $ret = new Webhook(); $ret->fromJson($json); return $ret; } /** * Retrieves all Webhooks for the application associated with access token. * * @deprecated Please use Webhook#getAllWithParams instead. * * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return WebhookList */ public static function getAll($apiContext = null, $restCall = null) { return self::getAllWithParams(array(), $apiContext, $restCall); } /** * Lists all webhooks for an app. * * @param array $params * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return WebhookList */ public static function getAllWithParams($params = array(), $apiContext = null, $restCall = null) { ArgumentValidator::validate($params, 'params'); $payLoad = ""; $allowedParams = array( 'anchor_type' => 1, ); $json = self::executeCall( "/v1/notifications/webhooks?" . http_build_query(array_intersect_key($params, $allowedParams)), "GET", $payLoad, null, $apiContext, $restCall ); $ret = new WebhookList(); $ret->fromJson($json); return $ret; } /** * Replaces webhook fields with new values. Pass a `json_patch` object with `replace` operation and `path`, which is `/url` for a URL or `/event_types` for events. The `value` is either the URL or a list of events. * * @param PatchRequest $patchRequest * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return Webhook */ public function update($patchRequest, $apiContext = null, $restCall = null) { ArgumentValidator::validate($this->getId(), "Id"); ArgumentValidator::validate($patchRequest, 'patchRequest'); $payLoad = $patchRequest->toJSON(); $json = self::executeCall( "/v1/notifications/webhooks/{$this->getId()}", "PATCH", $payLoad, null, $apiContext, $restCall ); $this->fromJson($json); return $this; } /** * Deletes a webhook, by ID. * * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return bool */ public function delete($apiContext = null, $restCall = null) { ArgumentValidator::validate($this->getId(), "Id"); $payLoad = ""; self::executeCall( "/v1/notifications/webhooks/{$this->getId()}", "DELETE", $payLoad, null, $apiContext, $restCall ); return true; } } rest-api-sdk-php/lib/PayPal/Api/Transactions.php 0000644 00000001144 15213403564 0015465 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class Transactions * * * * @package PayPal\Api * * @property \PayPal\Api\Amount amount */ class Transactions extends PayPalModel { /** * Amount being collected. * * * @param \PayPal\Api\Amount $amount * * @return $this */ public function setAmount($amount) { $this->amount = $amount; return $this; } /** * Amount being collected. * * @return \PayPal\Api\Amount */ public function getAmount() { return $this->amount; } } rest-api-sdk-php/lib/PayPal/Api/FundingSource.php 0000644 00000014332 15213403564 0015573 0 ustar 00 <?php namespace PayPal\Api; use PayPal\Common\PayPalModel; /** * Class FundingSource * * specifies the funding source details. * * @package PayPal\Api * * @property string funding_mode * @property string funding_instrument_type * @property string soft_descriptor * @property \PayPal\Api\Currency amount * @property \PayPal\Api\Currency negative_balance_amount * @property string legal_text * @property \PayPal\Api\FundingDetail funding_detail * @property string additional_text * @property \PayPal\Api\Links[] links */ class FundingSource extends FundingInstrument { /** * specifies funding mode of the instrument * Valid Values: ["INSTANT_TRANSFER", "MANUAL_BANK_TRANSFER", "DELAYED_TRANSFER", "ECHECK", "PAY_UPON_INVOICE"] * * @param string $funding_mode * * @return $this */ public function setFundingMode($funding_mode) { $this->funding_mode = $funding_mode; return $this; } /** * specifies funding mode of the instrument * * @return string */ public function getFundingMode() { return $this->funding_mode; } /** * Instrument type for this funding source * Valid Values: ["BALANCE", "PAYMENT_CARD", "BANK_ACCOUNT", "CREDIT", "INCENTIVE", "EXTERNAL_FUNDING", "TAB"] * * @param string $funding_instrument_type * * @return $this */ public function setFundingInstrumentType($funding_instrument_type) { $this->funding_instrument_type = $funding_instrument_type; return $this; } /** * Instrument type for this funding source * * @return string */ public function getFundingInstrumentType() { return $this->funding_instrument_type; } /** * Soft descriptor used when charging this funding source. * * @param string $soft_descriptor * * @return $this */ public function setSoftDescriptor($soft_descriptor) { $this->soft_descriptor = $soft_descriptor; return $this; } /** * Soft descriptor used when charging this funding source. * * @return string */ public function getSoftDescriptor() { return $this->soft_descriptor; } /** * Total anticipated amount of money to be pulled from instrument. * * @param \PayPal\Api\Currency $amount * * @return $this */ public function setAmount($amount) { $this->amount = $amount; return $this; } /** * Total anticipated amount of money to be pulled from instrument. * * @return \PayPal\Api\Currency */ public function getAmount() { return $this->amount; } /** * Additional amount to be pulled from the instrument to recover a negative balance on the buyer's account that is owed to PayPal. * * @param \PayPal\Api\Currency $negative_balance_amount * * @return $this */ public function setNegativeBalanceAmount($negative_balance_amount) { $this->negative_balance_amount = $negative_balance_amount; return $this; } /** * Additional amount to be pulled from the instrument to recover a negative balance on the buyer's account that is owed to PayPal. * * @return \PayPal\Api\Currency */ public function getNegativeBalanceAmount() { return $this->negative_balance_amount; } /** * Localized legal text relevant to funding source. * * @param string $legal_text * * @return $this */ public function setLegalText($legal_text) { $this->legal_text = $legal_text; return $this; } /** * Localized legal text relevant to funding source. * * @return string */ public function getLegalText() { return $this->legal_text; } /** * Additional detail of the funding. * * @param \PayPal\Api\FundingDetail $funding_detail * * @return $this */ public function setFundingDetail($funding_detail) { $this->funding_detail = $funding_detail; return $this; } /** * Additional detail of the funding. * * @return \PayPal\Api\FundingDetail */ public function getFundingDetail() { return $this->funding_detail; } /** * Additional text relevant to funding source. * * @param string $additional_text * * @return $this */ public function setAdditionalText($additional_text) { $this->additional_text = $additional_text; return $this; } /** * Additional text relevant to funding source. * * @return string */ public function getAdditionalText() { return $this->additional_text; } /** * Sets Extends * * @param \PayPal\Api\FundingInstrument $extends * * @deprecated Unused * * @return $this */ public function setExtends($extends) { $this->extends = $extends; return $this; } /** * Gets Extends * * @deprecated Unused * * @return \PayPal\Api\FundingInstrument */ public function getExtends() { return $this->extends; } /** * Sets Links * * @param \PayPal\Api\Links[] $links * * @return $this */ public function setLinks($links) { $this->links = $links; return $this; } /** * Gets Links * * @return \PayPal\Api\Links[] */ public function getLinks() { return $this->links; } /** * Append Links to the list. * * @param \PayPal\Api\Links $links * @return $this */ public function addLink($links) { if (!$this->getLinks()) { return $this->setLinks(array($links)); } else { return $this->setLinks( array_merge($this->getLinks(), array($links)) ); } } /** * Remove Links from the list. * * @param \PayPal\Api\Links $links * @return $this */ public function removeLink($links) { return $this->setLinks( array_diff($this->getLinks(), array($links)) ); } } rest-api-sdk-php/lib/PayPal/Log/PayPalLogger.php 0000644 00000004341 15213403564 0015355 0 ustar 00 <?php namespace PayPal\Log; use PayPal\Core\PayPalConfigManager; use Psr\Log\AbstractLogger; use Psr\Log\LogLevel; class PayPalLogger extends AbstractLogger { /** * @var array Indexed list of all log levels. */ private $loggingLevels = array( LogLevel::EMERGENCY, LogLevel::ALERT, LogLevel::CRITICAL, LogLevel::ERROR, LogLevel::WARNING, LogLevel::NOTICE, LogLevel::INFO, LogLevel::DEBUG ); /** * Configured Logging Level * * @var LogLevel $loggingLevel */ private $loggingLevel; /** * Configured Logging File * * @var string */ private $loggerFile; /** * Log Enabled * * @var bool */ private $isLoggingEnabled; /** * Logger Name. Generally corresponds to class name * * @var string */ private $loggerName; public function __construct($className) { $this->loggerName = $className; $this->initialize(); } public function initialize() { $config = PayPalConfigManager::getInstance()->getConfigHashmap(); if (!empty($config)) { $this->isLoggingEnabled = (array_key_exists('log.LogEnabled', $config) && $config['log.LogEnabled'] == '1'); if ($this->isLoggingEnabled) { $this->loggerFile = ($config['log.FileName']) ? $config['log.FileName'] : ini_get('error_log'); $loggingLevel = strtoupper($config['log.LogLevel']); $this->loggingLevel = (isset($loggingLevel) && defined("\\Psr\\Log\\LogLevel::$loggingLevel")) ? constant("\\Psr\\Log\\LogLevel::$loggingLevel") : LogLevel::INFO; } } } public function log($level, $message, array $context = array()) { if ($this->isLoggingEnabled) { // Checks if the message is at level below configured logging level if (array_search($level, $this->loggingLevels) <= array_search($this->loggingLevel, $this->loggingLevels)) { error_log("[" . date('d-m-Y H:i:s') . "] " . $this->loggerName . " : " . strtoupper($level) . ": $message\n", 3, $this->loggerFile); } } } } rest-api-sdk-php/lib/PayPal/Log/PayPalDefaultLogFactory.php 0000644 00000001053 15213403564 0017511 0 ustar 00 <?php namespace PayPal\Log; use Psr\Log\LoggerInterface; /** * Class PayPalDefaultLogFactory * * This factory is the default implementation of Log factory. * * @package PayPal\Log */ class PayPalDefaultLogFactory implements PayPalLogFactory { /** * Returns logger instance implementing LoggerInterface. * * @param string $className * @return LoggerInterface instance of logger object implementing LoggerInterface */ public function getLogger($className) { return new PayPalLogger($className); } } rest-api-sdk-php/lib/PayPal/Log/PayPalLogFactory.php 0000644 00000000520 15213403564 0016202 0 ustar 00 <?php namespace PayPal\Log; use Psr\Log\LoggerInterface; interface PayPalLogFactory { /** * Returns logger instance implementing LoggerInterface. * * @param string $className * @return LoggerInterface instance of logger object implementing LoggerInterface */ public function getLogger($className); } rest-api-sdk-php/lib/PayPal/Core/PayPalConfigManager.php 0000644 00000007262 15213403564 0017012 0 ustar 00 <?php namespace PayPal\Core; /** * Class PayPalConfigManager * * PayPalConfigManager loads the SDK configuration file and * hands out appropriate config params to other classes * * @package PayPal\Core */ class PayPalConfigManager { /** * Configuration Options * * @var array */ private $configs = array( ); /** * Singleton Object * * @var $this */ private static $instance; /** * Private Constructor */ private function __construct() { if (defined('PP_CONFIG_PATH')) { $configFile = constant('PP_CONFIG_PATH') . '/sdk_config.ini'; } else { $configFile = implode(DIRECTORY_SEPARATOR, array(dirname(__FILE__), "..", "config", "sdk_config.ini")); } if (file_exists($configFile)) { $this->addConfigFromIni($configFile); } } /** * Returns the singleton object * * @return $this */ public static function getInstance() { if (!isset(self::$instance)) { self::$instance = new self(); } return self::$instance; } /** * Add Configuration from configuration.ini files * * @param string $fileName * @return $this */ public function addConfigFromIni($fileName) { if ($configs = parse_ini_file($fileName)) { $this->addConfigs($configs); } return $this; } /** * If a configuration exists in both arrays, * then the element from the first array will be used and * the matching key's element from the second array will be ignored. * * @param array $configs * @return $this */ public function addConfigs($configs = array()) { $this->configs = $configs + $this->configs; return $this; } /** * Simple getter for configuration params * If an exact match for key is not found, * does a "contains" search on the key * * @param string $searchKey * @return array */ public function get($searchKey) { if (array_key_exists($searchKey, $this->configs)) { return $this->configs[$searchKey]; } else { $arr = array(); if ($searchKey !== '') { foreach ($this->configs as $k => $v) { if (strstr($k, $searchKey)) { $arr[$k] = $v; } } } return $arr; } } /** * Utility method for handling account configuration * return config key corresponding to the API userId passed in * * If $userId is null, returns config keys corresponding to * all configured accounts * * @param string|null $userId * @return array|string */ public function getIniPrefix($userId = null) { if ($userId == null) { $arr = array(); foreach ($this->configs as $key => $value) { $pos = strpos($key, '.'); if (strstr($key, "acct")) { $arr[] = substr($key, 0, $pos); } } return array_unique($arr); } else { $iniPrefix = array_search($userId, $this->configs); $pos = strpos($iniPrefix, '.'); $acct = substr($iniPrefix, 0, $pos); return $acct; } } /** * returns the config file hashmap */ public function getConfigHashmap() { return $this->configs; } /** * Disabling __clone call */ public function __clone() { trigger_error('Clone is not allowed.', E_USER_ERROR); } } rest-api-sdk-php/lib/PayPal/Core/cacert.pem 0000644 00000026145 15213403564 0014437 0 ustar 00 Verisign Class 3 Public Primary Certification Authority ======================================================= -----BEGIN CERTIFICATE----- MIICPDCCAaUCEHC65B0Q2Sk0tjjKewPMur8wDQYJKoZIhvcNAQECBQAwXzELMAkGA1UEBhMCVVMx FzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFzcyAzIFB1YmxpYyBQcmltYXJ5 IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTk2MDEyOTAwMDAwMFoXDTI4MDgwMTIzNTk1OVow XzELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFzcyAz IFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIGfMA0GCSqGSIb3DQEBAQUA A4GNADCBiQKBgQDJXFme8huKARS0EN8EQNvjV69qRUCPhAwL0TPZ2RHP7gJYHyX3KqhEBarsAx94 f56TuZoAqiN91qyFomNFx3InzPRMxnVx0jnvT0Lwdd8KkMaOIG+YD/isI19wKTakyYbnsZogy1Ol hec9vn2a/iRFM9x2Fe0PonFkTGUugWhFpwIDAQABMA0GCSqGSIb3DQEBAgUAA4GBALtMEivPLCYA TxQT3ab7/AoRhIzzKBxnki98tsX63/Dolbwdj2wsqFHMc9ikwFPwTtYmwHYBV4GSXiHx0bH/59Ah WM1pF+NEHJwZRDmJXNycAA9WjQKZ7aKQRUzkuxCkPfAyAw7xzvjoyVGM5mKf5p/AfbdynMk2Omuf Tqj/ZA1k -----END CERTIFICATE----- Verisign Class 3 Public Primary Certification Authority - G2 ============================================================ -----BEGIN CERTIFICATE----- MIIDAjCCAmsCEH3Z/gfPqB63EHln+6eJNMYwDQYJKoZIhvcNAQEFBQAwgcExCzAJBgNVBAYTAlVT MRcwFQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE8MDoGA1UECxMzQ2xhc3MgMyBQdWJsaWMgUHJpbWFy eSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEcyMTowOAYDVQQLEzEoYykgMTk5OCBWZXJpU2ln biwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVzZSBvbmx5MR8wHQYDVQQLExZWZXJpU2lnbiBUcnVz dCBOZXR3b3JrMB4XDTk4MDUxODAwMDAwMFoXDTI4MDgwMTIzNTk1OVowgcExCzAJBgNVBAYTAlVT MRcwFQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE8MDoGA1UECxMzQ2xhc3MgMyBQdWJsaWMgUHJpbWFy eSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEcyMTowOAYDVQQLEzEoYykgMTk5OCBWZXJpU2ln biwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVzZSBvbmx5MR8wHQYDVQQLExZWZXJpU2lnbiBUcnVz dCBOZXR3b3JrMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDMXtERXVxp0KvTuWpMmR9ZmDCO FoUgRm1HP9SFIIThbbP4pO0M8RcPO/mn+SXXwc+EY/J8Y8+iR/LGWzOOZEAEaMGAuWQcRXfH2G71 lSk8UOg013gfqLptQ5GVj0VXXn7F+8qkBOvqlzdUMG+7AUcyM83cV5tkaWH4mx0ciU9cZwIDAQAB MA0GCSqGSIb3DQEBBQUAA4GBAFFNzb5cy5gZnBWyATl4Lk0PZ3BwmcYQWpSkU01UbSuvDV1Ai2TT 1+7eVmGSX6bEHRBhNtMsJzzoKQm5EWR0zLVznxxIqbxhAe7iF6YM40AIOw7n60RzKprxaZLvcRTD Oaxxp5EJb+RxBrO6WVcmeQD2+A2iMzAo1KpYoJ2daZH9 -----END CERTIFICATE----- Verisign Class 3 Public Primary Certification Authority - G3 ============================================================ -----BEGIN CERTIFICATE----- MIIEGjCCAwICEQCbfgZJoz5iudXukEhxKe9XMA0GCSqGSIb3DQEBBQUAMIHKMQswCQYDVQQGEwJV UzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdv cmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNl IG9ubHkxRTBDBgNVBAMTPFZlcmlTaWduIENsYXNzIDMgUHVibGljIFByaW1hcnkgQ2VydGlmaWNh dGlvbiBBdXRob3JpdHkgLSBHMzAeFw05OTEwMDEwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMIHKMQsw CQYDVQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRy dXN0IE5ldHdvcmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhv cml6ZWQgdXNlIG9ubHkxRTBDBgNVBAMTPFZlcmlTaWduIENsYXNzIDMgUHVibGljIFByaW1hcnkg Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC ggEBAMu6nFL8eB8aHm8bN3O9+MlrlBIwT/A2R/XQkQr1F8ilYcEWQE37imGQ5XYgwREGfassbqb1 EUGO+i2tKmFZpGcmTNDovFJbcCAEWNF6yaRpvIMXZK0Fi7zQWM6NjPXr8EJJC52XJ2cybuGukxUc cLwgTS8Y3pKI6GyFVxEa6X7jJhFUokWWVYPKMIno3Nij7SqAP395ZVc+FSBmCC+Vk7+qRy+oRpfw EuL+wgorUeZ25rdGt+INpsyow0xZVYnm6FNcHOqd8GIWC6fJXwzw3sJ2zq/3avL6QaaiMxTJ5Xpj 055iN9WFZZ4O5lMkdBteHRJTW8cs54NJOxWuimi5V5cCAwEAATANBgkqhkiG9w0BAQUFAAOCAQEA ERSWwauSCPc/L8my/uRan2Te2yFPhpk0djZX3dAVL8WtfxUfN2JzPtTnX84XA9s1+ivbrmAJXx5f j267Cz3qWhMeDGBvtcC1IyIuBwvLqXTLR7sdwdela8wv0kL9Sd2nic9TutoAWii/gt/4uhMdUIaC /Y4wjylGsB49Ndo4YhYYSq3mtlFs3q9i6wHQHiT+eo8SGhJouPtmmRQURVyu565pF4ErWjfJXir0 xuKhXFSbplQAz/DxwceYMBo7Nhbbo27q/a2ywtrvAkcTisDxszGtTxzhT5yvDwyd93gN2PQ1VoDa t20Xj50egWTh/sVFuq1ruQp6Tk9LhO5L8X3dEQ== -----END CERTIFICATE----- Verisign Class 4 Public Primary Certification Authority - G3 ============================================================ -----BEGIN CERTIFICATE----- MIIEGjCCAwICEQDsoKeLbnVqAc/EfMwvlF7XMA0GCSqGSIb3DQEBBQUAMIHKMQswCQYDVQQGEwJV UzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdv cmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNl IG9ubHkxRTBDBgNVBAMTPFZlcmlTaWduIENsYXNzIDQgUHVibGljIFByaW1hcnkgQ2VydGlmaWNh dGlvbiBBdXRob3JpdHkgLSBHMzAeFw05OTEwMDEwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMIHKMQsw CQYDVQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRy dXN0IE5ldHdvcmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhv cml6ZWQgdXNlIG9ubHkxRTBDBgNVBAMTPFZlcmlTaWduIENsYXNzIDQgUHVibGljIFByaW1hcnkg Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC ggEBAK3LpRFpxlmr8Y+1GQ9Wzsy1HyDkniYlS+BzZYlZ3tCD5PUPtbut8XzoIfzk6AzufEUiGXaS tBO3IFsJ+mGuqPKljYXCKtbeZjbSmwL0qJJgfJxptI8kHtCGUvYynEFYHiK9zUVilQhu0GbdU6LM 8BDcVHOLBKFGMzNcF0C5nk3T875Vg+ixiY5afJqWIpA7iCXy0lOIAgwLePLmNxdLMEYH5IBtptiW Lugs+BGzOA1mppvqySNb247i8xOOGlktqgLw7KSHZtzBP/XYufTsgsbSPZUd5cBPhMnZo0QoBmrX Razwa2rvTl/4EYIeOGM0ZlDUPpNz+jDDZq3/ky2X7wMCAwEAATANBgkqhkiG9w0BAQUFAAOCAQEA j/ola09b5KROJ1WrIhVZPMq1CtRK26vdoV9TxaBXOcLORyu+OshWv8LZJxA6sQU8wHcxuzrTBXtt mhwwjIDLk5Mqg6sFUYICABFna/OIYUdfA5PVWw3g8dShMjWFsjrbsIKr0csKvE+MW8VLADsfKoKm fjaF3H48ZwC15DtS4KjrXRX5xm3wrR0OhbepmnMUWluPQSjA1egtTaRezarZ7c7c2NU8Qh0XwRJd RTjDOPP8hS6DRkiy1yBfkjaP53kPmF6Z6PDQpLv1U70qzlmwr25/bLvSHgCwIe34QWKCudiyxLtG UPMxxY8BqHTr9Xgn2uf3ZkPznoM+IKrDNWCRzg== -----END CERTIFICATE----- VeriSign Class 3 Public Primary Certification Authority - G5 ============================================================ -----BEGIN CERTIFICATE----- MIIE0zCCA7ugAwIBAgIQGNrRniZ96LtKIVjNzGs7SjANBgkqhkiG9w0BAQUFADCByjELMAkGA1UE BhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBO ZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVk IHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRp ZmljYXRpb24gQXV0aG9yaXR5IC0gRzUwHhcNMDYxMTA4MDAwMDAwWhcNMzYwNzE2MjM1OTU5WjCB yjELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2ln biBUcnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJpU2lnbiwgSW5jLiAtIEZvciBh dXRob3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmlt YXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw ggEKAoIBAQCvJAgIKXo1nmAMqudLO07cfLw8RRy7K+D+KQL5VwijZIUVJ/XxrcgxiV0i6CqqpkKz j/i5Vbext0uz/o9+B1fs70PbZmIVYc9gDaTY3vjgw2IIPVQT60nKWVSFJuUrjxuf6/WhkcIzSdhD Y2pSS9KP6HBRTdGJaXvHcPaz3BJ023tdS1bTlr8Vd6Gw9KIl8q8ckmcY5fQGBO+QueQA5N06tRn/ Arr0PO7gi+s3i+z016zy9vA9r911kTMZHRxAy3QkGSGT2RT+rCpSx4/VBEnkjWNHiDxpg8v+R70r fk/Fla4OndTRQ8Bnc+MUCH7lP59zuDMKz10/NIeWiu5T6CUVAgMBAAGjgbIwga8wDwYDVR0TAQH/ BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwbQYIKwYBBQUHAQwEYTBfoV2gWzBZMFcwVRYJaW1hZ2Uv Z2lmMCEwHzAHBgUrDgMCGgQUj+XTGoasjY5rw8+AatRIGCx7GS4wJRYjaHR0cDovL2xvZ28udmVy aXNpZ24uY29tL3ZzbG9nby5naWYwHQYDVR0OBBYEFH/TZafC3ey78DAJ80M5+gKvMzEzMA0GCSqG SIb3DQEBBQUAA4IBAQCTJEowX2LP2BqYLz3q3JktvXf2pXkiOOzEp6B4Eq1iDkVwZMXnl2YtmAl+ X6/WzChl8gGqCBpH3vn5fJJaCGkgDdk+bW48DW7Y5gaRQBi5+MHt39tBquCWIMnNZBU4gcmU7qKE KQsTb47bDN0lAtukixlE0kF6BWlKWE9gyn6CagsCqiUXObXbf+eEZSqVir2G3l6BFoMtEMze/aiC Km0oHw0LxOXnGiYZ4fQRbxC1lfznQgUy286dUV4otp6F01vvpX1FQHKOtw5rDgb7MzVIcbidJ4vE ZV8NhnacRHr2lVz2XTIIM6RUthg/aFzyQkqFOFSDX9HoLPKsEdao7WNq -----END CERTIFICATE----- VeriSign Universal Root Certification Authority =============================================== -----BEGIN CERTIFICATE----- MIIEuTCCA6GgAwIBAgIQQBrEZCGzEyEDDrvkEhrFHTANBgkqhkiG9w0BAQsFADCBvTELMAkGA1UE BhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBO ZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwOCBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVk IHVzZSBvbmx5MTgwNgYDVQQDEy9WZXJpU2lnbiBVbml2ZXJzYWwgUm9vdCBDZXJ0aWZpY2F0aW9u IEF1dGhvcml0eTAeFw0wODA0MDIwMDAwMDBaFw0zNzEyMDEyMzU5NTlaMIG9MQswCQYDVQQGEwJV UzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdv cmsxOjA4BgNVBAsTMShjKSAyMDA4IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNl IG9ubHkxODA2BgNVBAMTL1ZlcmlTaWduIFVuaXZlcnNhbCBSb290IENlcnRpZmljYXRpb24gQXV0 aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAx2E3XrEBNNti1xWb/1hajCMj 1mCOkdeQmIN65lgZOIzF9uVkhbSicfvtvbnazU0AtMgtc6XHaXGVHzk8skQHnOgO+k1KxCHfKWGP MiJhgsWHH26MfF8WIFFE0XBPV+rjHOPMee5Y2A7Cs0WTwCznmhcrewA3ekEzeOEz4vMQGn+HLL72 9fdC4uW/h2KJXwBL38Xd5HVEMkE6HnFuacsLdUYI0crSK5XQz/u5QGtkjFdN/BMReYTtXlT2NJ8I AfMQJQYXStrxHXpma5hgZqTZ79IugvHw7wnqRMkVauIDbjPTrJ9VAMf2CGqUuV/c4DPxhGD5WycR tPwW8rtWaoAljQIDAQABo4GyMIGvMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMG0G CCsGAQUFBwEMBGEwX6FdoFswWTBXMFUWCWltYWdlL2dpZjAhMB8wBwYFKw4DAhoEFI/l0xqGrI2O a8PPgGrUSBgsexkuMCUWI2h0dHA6Ly9sb2dvLnZlcmlzaWduLmNvbS92c2xvZ28uZ2lmMB0GA1Ud DgQWBBS2d/ppSEefUxLVwuoHMnYH0ZcHGTANBgkqhkiG9w0BAQsFAAOCAQEASvj4sAPmLGd75JR3 Y8xuTPl9Dg3cyLk1uXBPY/ok+myDjEedO2Pzmvl2MpWRsXe8rJq+seQxIcaBlVZaDrHC1LGmWazx Y8u4TB1ZkErvkBYoH1quEPuBUDgMbMzxPcP1Y+Oz4yHJJDnp/RVmRvQbEdBNc6N9Rvk97ahfYtTx P/jgdFcrGJ2BtMQo2pSXpXDrrB2+BxHw1dvd5Yzw1TKwg+ZX4o+/vqGqvz0dtdQ46tewXDpPaj+P wGZsY6rp2aQW9IHRlRQOfc2VNNnSj3BzgXucfr2YYdhFh5iQxeuGMMY1v/D/w1WIg0vvBZIGcfK4 mJO37M2CYfE45k+XmCpajQ== -----END CERTIFICATE----- VeriSign Class 3 Public Primary Certification Authority - G4 ============================================================ -----BEGIN CERTIFICATE----- MIIDhDCCAwqgAwIBAgIQL4D+I4wOIg9IZxIokYesszAKBggqhkjOPQQDAzCByjELMAkGA1UEBhMC VVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBOZXR3 b3JrMTowOAYDVQQLEzEoYykgMjAwNyBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVz ZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmlj YXRpb24gQXV0aG9yaXR5IC0gRzQwHhcNMDcxMTA1MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCByjEL MAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBU cnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNyBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRo b3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5 IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzQwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAASnVnp8 Utpkmw4tXNherJI9/gHmGUo9FANL+mAnINmDiWn6VMaaGF5VKmTeBvaNSjutEDxlPZCIBIngMGGz rl0Bp3vefLK+ymVhAIau2o970ImtTR1ZmkGxvEeA3J5iw/mjgbIwga8wDwYDVR0TAQH/BAUwAwEB /zAOBgNVHQ8BAf8EBAMCAQYwbQYIKwYBBQUHAQwEYTBfoV2gWzBZMFcwVRYJaW1hZ2UvZ2lmMCEw HzAHBgUrDgMCGgQUj+XTGoasjY5rw8+AatRIGCx7GS4wJRYjaHR0cDovL2xvZ28udmVyaXNpZ24u Y29tL3ZzbG9nby5naWYwHQYDVR0OBBYEFLMWkf3upm7ktS5Jj4d4gYDs5bG1MAoGCCqGSM49BAMD A2gAMGUCMGYhDBgmYFo4e1ZC4Kf8NoRRkSAsdk1DPcQdhCPQrNZ8NQbOzWm9kA3bbEhCHQ6qQgIx AJw9SDkjOVgaFRJZap7v1VmyHVIsmXHNxynfGyphe3HR3vPA5Q06Sqotp9iGKt0uEA== -----END CERTIFICATE----- Verisign Class 3 Public Primary Certification Authority ======================================================= -----BEGIN CERTIFICATE----- MIICPDCCAaUCEDyRMcsf9tAbDpq40ES/Er4wDQYJKoZIhvcNAQEFBQAwXzELMAkGA1UEBhMCVVMx FzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFzcyAzIFB1YmxpYyBQcmltYXJ5 IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTk2MDEyOTAwMDAwMFoXDTI4MDgwMjIzNTk1OVow XzELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFzcyAz IFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIGfMA0GCSqGSIb3DQEBAQUA A4GNADCBiQKBgQDJXFme8huKARS0EN8EQNvjV69qRUCPhAwL0TPZ2RHP7gJYHyX3KqhEBarsAx94 f56TuZoAqiN91qyFomNFx3InzPRMxnVx0jnvT0Lwdd8KkMaOIG+YD/isI19wKTakyYbnsZogy1Ol hec9vn2a/iRFM9x2Fe0PonFkTGUugWhFpwIDAQABMA0GCSqGSIb3DQEBBQUAA4GBABByUqkFFBky CEHwxWsKzH4PIRnN5GfcX6kb5sroc50i2JhucwNhkcV8sEVAbkSdjbCxlnRhLQ2pRdKkkirWmnWX bj9T/UWZYB2oK0z5XqcJ2HUw19JlYD1n1khVdWk/kfVIC0dpImmClr7JyDiGSnoscxlIaU5rfGW/ D/xwzoiQ -----END CERTIFICATE----- rest-api-sdk-php/lib/PayPal/Core/PayPalHttpConnection.php 0000644 00000015742 15213403564 0017253 0 ustar 00 <?php namespace PayPal\Core; use PayPal\Exception\PayPalConfigurationException; use PayPal\Exception\PayPalConnectionException; /** * A wrapper class based on the curl extension. * Requires the PHP curl module to be enabled. * See for full requirements the PHP manual: http://php.net/curl */ class PayPalHttpConnection { /** * @var PayPalHttpConfig */ private $httpConfig; /** * LoggingManager * * @var PayPalLoggingManager */ private $logger; /** * @var array */ private $responseHeaders = array(); /** * @var bool */ private $skippedHttpStatusLine = false; /** * Default Constructor * * @param PayPalHttpConfig $httpConfig * @param array $config * @throws PayPalConfigurationException */ public function __construct(PayPalHttpConfig $httpConfig, array $config) { if (!function_exists("curl_init")) { throw new PayPalConfigurationException("Curl module is not available on this system"); } $this->httpConfig = $httpConfig; $this->logger = PayPalLoggingManager::getInstance(__CLASS__); } /** * Gets all Http Headers * * @return array */ private function getHttpHeaders() { $ret = array(); foreach ($this->httpConfig->getHeaders() as $k => $v) { $ret[] = "$k: $v"; } return $ret; } /** * Parses the response headers for debugging. * * @param resource $ch * @param string $data * @return int */ protected function parseResponseHeaders($ch, $data) { if (!$this->skippedHttpStatusLine) { $this->skippedHttpStatusLine = true; return strlen($data); } $trimmedData = trim($data); if (strlen($trimmedData) == 0) { return strlen($data); } // Added condition to ignore extra header which dont have colon ( : ) if (strpos($trimmedData, ":") == false) { return strlen($data); } list($key, $value) = explode(":", $trimmedData, 2); $key = trim($key); $value = trim($value); // This will skip over the HTTP Status Line and any other lines // that don't look like header lines with values if (strlen($key) > 0 && strlen($value) > 0) { // This is actually a very basic way of looking at response headers // and may miss a few repeated headers with different (appended) // values but this should work for debugging purposes. $this->responseHeaders[$key] = $value; } return strlen($data); } /** * Implodes a key/value array for printing. * * @param array $arr * @return string */ protected function implodeArray($arr) { $retStr = ''; foreach($arr as $key => $value) { $retStr .= $key . ': ' . $value . ', '; } rtrim($retStr, ', '); return $retStr; } /** * Executes an HTTP request * * @param string $data query string OR POST content as a string * @return mixed * @throws PayPalConnectionException */ public function execute($data) { //Initialize the logger $this->logger->info($this->httpConfig->getMethod() . ' ' . $this->httpConfig->getUrl()); //Initialize Curl Options $ch = curl_init($this->httpConfig->getUrl()); $options = $this->httpConfig->getCurlOptions(); if (empty($options[CURLOPT_HTTPHEADER])) { unset($options[CURLOPT_HTTPHEADER]); } curl_setopt_array($ch, $options); curl_setopt($ch, CURLOPT_URL, $this->httpConfig->getUrl()); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLINFO_HEADER_OUT, true); curl_setopt($ch, CURLOPT_HTTPHEADER, $this->getHttpHeaders()); //Determine Curl Options based on Method switch ($this->httpConfig->getMethod()) { case 'POST': curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); break; case 'PUT': case 'PATCH': case 'DELETE': curl_setopt($ch, CURLOPT_POSTFIELDS, $data); break; } //Default Option if Method not of given types in switch case if ($this->httpConfig->getMethod() != null) { curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $this->httpConfig->getMethod()); } $this->responseHeaders = array(); $this->skippedHttpStatusLine = false; curl_setopt($ch, CURLOPT_HEADERFUNCTION, array($this, 'parseResponseHeaders')); //Execute Curl Request $result = curl_exec($ch); //Retrieve Response Status $httpStatus = curl_getinfo($ch, CURLINFO_HTTP_CODE); //Retry if Certificate Exception if (curl_errno($ch) == 60) { $this->logger->info("Invalid or no certificate authority found - Retrying using bundled CA certs file"); curl_setopt($ch, CURLOPT_CAINFO, dirname(__FILE__) . '/cacert.pem'); $result = curl_exec($ch); //Retrieve Response Status $httpStatus = curl_getinfo($ch, CURLINFO_HTTP_CODE); } //Throw Exception if Retries and Certificates doenst work if (curl_errno($ch)) { $ex = new PayPalConnectionException( $this->httpConfig->getUrl(), curl_error($ch), curl_errno($ch) ); curl_close($ch); throw $ex; } // Get Request and Response Headers $requestHeaders = curl_getinfo($ch, CURLINFO_HEADER_OUT); $this->logger->debug("Request Headers \t: " . str_replace("\r\n", ", ", $requestHeaders)); $this->logger->debug(($data && $data != '' ? "Request Data\t\t: " . $data : "No Request Payload") . "\n" . str_repeat('-', 128) . "\n"); $this->logger->info("Response Status \t: " . $httpStatus); $this->logger->debug("Response Headers\t: " . $this->implodeArray($this->responseHeaders)); //Close the curl request curl_close($ch); //More Exceptions based on HttpStatus Code if ($httpStatus < 200 || $httpStatus >= 300) { $ex = new PayPalConnectionException( $this->httpConfig->getUrl(), "Got Http response code $httpStatus when accessing {$this->httpConfig->getUrl()}.", $httpStatus ); $ex->setData($result); $this->logger->error("Got Http response code $httpStatus when accessing {$this->httpConfig->getUrl()}. " . $result); $this->logger->debug("\n\n" . str_repeat('=', 128) . "\n"); throw $ex; } $this->logger->debug(($result && $result != '' ? "Response Data \t: " . $result : "No Response Body") . "\n\n" . str_repeat('=', 128) . "\n"); //Return result object return $result; } } rest-api-sdk-php/lib/PayPal/Core/PayPalConstants.php 0000644 00000001107 15213403564 0016256 0 ustar 00 <?php namespace PayPal\Core; /** * Class PayPalConstants * Placeholder for Paypal Constants * * @package PayPal\Core */ class PayPalConstants { const SDK_NAME = 'PayPal-PHP-SDK'; const SDK_VERSION = '1.14.0'; /** * Approval URL for Payment */ const APPROVAL_URL = 'approval_url'; const REST_SANDBOX_ENDPOINT = "https://api.sandbox.paypal.com/"; const OPENID_REDIRECT_SANDBOX_URL = "https://www.sandbox.paypal.com"; const REST_LIVE_ENDPOINT = "https://api.paypal.com/"; const OPENID_REDIRECT_LIVE_URL = "https://www.paypal.com"; } rest-api-sdk-php/lib/PayPal/Core/PayPalLoggingManager.php 0000644 00000005443 15213403564 0017172 0 ustar 00 <?php namespace PayPal\Core; use PayPal\Log\PayPalLogFactory; use Psr\Log\LoggerInterface; /** * Simple Logging Manager. * This does an error_log for now * Potential frameworks to use are PEAR logger, log4php from Apache */ class PayPalLoggingManager { /** * @var array of logging manager instances with class name as key */ private static $instances = array(); /** * The logger to be used for all messages * * @var LoggerInterface */ private $logger; /** * Logger Name * * @var string */ private $loggerName; /** * Returns the singleton object * * @param string $loggerName * @return $this */ public static function getInstance($loggerName = __CLASS__) { if (array_key_exists($loggerName, PayPalLoggingManager::$instances)) { return PayPalLoggingManager::$instances[$loggerName]; } $instance = new self($loggerName); PayPalLoggingManager::$instances[$loggerName] = $instance; return $instance; } /** * Default Constructor * * @param string $loggerName Generally represents the class name. */ private function __construct($loggerName) { $config = PayPalConfigManager::getInstance()->getConfigHashmap(); // Checks if custom factory defined, and is it an implementation of @PayPalLogFactory $factory = array_key_exists('log.AdapterFactory', $config) && in_array('PayPal\Log\PayPalLogFactory', class_implements($config['log.AdapterFactory'])) ? $config['log.AdapterFactory'] : '\PayPal\Log\PayPalDefaultLogFactory'; /** @var PayPalLogFactory $factoryInstance */ $factoryInstance = new $factory(); $this->logger = $factoryInstance->getLogger($loggerName); $this->loggerName = $loggerName; } /** * Log Error * * @param string $message */ public function error($message) { $this->logger->error($message); } /** * Log Warning * * @param string $message */ public function warning($message) { $this->logger->warning($message); } /** * Log Info * * @param string $message */ public function info($message) { $this->logger->info($message); } /** * Log Fine * * @param string $message */ public function fine($message) { $this->info($message); } /** * Log Debug * * @param string $message */ public function debug($message) { $config = PayPalConfigManager::getInstance()->getConfigHashmap(); // Disable debug in live mode. if (array_key_exists('mode', $config) && $config['mode'] != 'live') { $this->logger->debug($message); } } } rest-api-sdk-php/lib/PayPal/Core/PayPalHttpConfig.php 0000644 00000015776 15213403564 0016370 0 ustar 00 <?php namespace PayPal\Core; use PayPal\Exception\PayPalConfigurationException; /** * Class PayPalHttpConfig * Http Configuration Class * * @package PayPal\Core */ class PayPalHttpConfig { /** * Some default options for curl * These are typically overridden by PayPalConnectionManager * * @var array */ public static $defaultCurlOptions = array( CURLOPT_SSLVERSION => 6, CURLOPT_CONNECTTIMEOUT => 10, CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 60, // maximum number of seconds to allow cURL functions to execute CURLOPT_USERAGENT => 'PayPal-PHP-SDK', CURLOPT_HTTPHEADER => array(), CURLOPT_SSL_VERIFYHOST => 2, CURLOPT_SSL_VERIFYPEER => 1, CURLOPT_SSL_CIPHER_LIST => 'TLSv1:TLSv1.2' //Allowing TLSv1 cipher list. //Adding it like this for backward compatibility with older versions of curl ); const HEADER_SEPARATOR = ';'; const HTTP_GET = 'GET'; const HTTP_POST = 'POST'; private $headers = array(); private $curlOptions; private $url; private $method; /*** * Number of times to retry a failed HTTP call */ private $retryCount = 0; /** * Default Constructor * * @param string $url * @param string $method HTTP method (GET, POST etc) defaults to POST * @param array $configs All Configurations */ public function __construct($url = null, $method = self::HTTP_POST, $configs = array()) { $this->url = $url; $this->method = $method; $this->curlOptions = $this->getHttpConstantsFromConfigs($configs, 'http.') + self::$defaultCurlOptions; // Update the Cipher List based on OpenSSL or NSS settings $curl = curl_version(); $sslVersion = isset($curl['ssl_version']) ? $curl['ssl_version'] : ''; if($sslVersion && substr_compare($sslVersion, "NSS/", 0, strlen("NSS/")) === 0) { //Remove the Cipher List for NSS $this->removeCurlOption(CURLOPT_SSL_CIPHER_LIST); } } /** * Gets Url * * @return null|string */ public function getUrl() { return $this->url; } /** * Gets Method * * @return string */ public function getMethod() { return $this->method; } /** * Gets all Headers * * @return array */ public function getHeaders() { return $this->headers; } /** * Get Header by Name * * @param $name * @return string|null */ public function getHeader($name) { if (array_key_exists($name, $this->headers)) { return $this->headers[$name]; } return null; } /** * Sets Url * * @param $url */ public function setUrl($url) { $this->url = $url; } /** * Set Headers * * @param array $headers */ public function setHeaders(array $headers = array()) { $this->headers = $headers; } /** * Adds a Header * * @param $name * @param $value * @param bool $overWrite allows you to override header value */ public function addHeader($name, $value, $overWrite = true) { if (!array_key_exists($name, $this->headers) || $overWrite) { $this->headers[$name] = $value; } else { $this->headers[$name] = $this->headers[$name] . self::HEADER_SEPARATOR . $value; } } /** * Removes a Header * * @param $name */ public function removeHeader($name) { unset($this->headers[$name]); } /** * Gets all curl options * * @return array */ public function getCurlOptions() { return $this->curlOptions; } /** * Add Curl Option * * @param string $name * @param mixed $value */ public function addCurlOption($name, $value) { $this->curlOptions[$name] = $value; } /** * Removes a curl option from the list * * @param $name */ public function removeCurlOption($name) { unset($this->curlOptions[$name]); } /** * Set Curl Options. Overrides all curl options * * @param $options */ public function setCurlOptions($options) { $this->curlOptions = $options; } /** * Set ssl parameters for certificate based client authentication * * @param $certPath * @param null $passPhrase */ public function setSSLCert($certPath, $passPhrase = null) { $this->curlOptions[CURLOPT_SSLCERT] = realpath($certPath); if (isset($passPhrase) && trim($passPhrase) != "") { $this->curlOptions[CURLOPT_SSLCERTPASSWD] = $passPhrase; } } /** * Set connection timeout in seconds * * @param integer $timeout */ public function setHttpTimeout($timeout) { $this->curlOptions[CURLOPT_CONNECTTIMEOUT] = $timeout; } /** * Set HTTP proxy information * * @param string $proxy * @throws PayPalConfigurationException */ public function setHttpProxy($proxy) { $urlParts = parse_url($proxy); if ($urlParts == false || !array_key_exists("host", $urlParts)) { throw new PayPalConfigurationException("Invalid proxy configuration " . $proxy); } $this->curlOptions[CURLOPT_PROXY] = $urlParts["host"]; if (isset($urlParts["port"])) { $this->curlOptions[CURLOPT_PROXY] .= ":" . $urlParts["port"]; } if (isset($urlParts["user"])) { $this->curlOptions[CURLOPT_PROXYUSERPWD] = $urlParts["user"] . ":" . $urlParts["pass"]; } } /** * Set Http Retry Counts * * @param int $retryCount */ public function setHttpRetryCount($retryCount) { $this->retryCount = $retryCount; } /** * Get Http Retry Counts * * @return int */ public function getHttpRetryCount() { return $this->retryCount; } /** * Sets the User-Agent string on the HTTP request * * @param string $userAgentString */ public function setUserAgent($userAgentString) { $this->curlOptions[CURLOPT_USERAGENT] = $userAgentString; } /** * Retrieves an array of constant key, and value based on Prefix * * @param array $configs * @param $prefix * @return array */ public function getHttpConstantsFromConfigs($configs = array(), $prefix) { $arr = array(); if ($prefix != null && is_array($configs)) { foreach ($configs as $k => $v) { // Check if it startsWith if (substr($k, 0, strlen($prefix)) === $prefix) { $newKey = ltrim($k, $prefix); if (defined($newKey)) { $arr[constant($newKey)] = $v; } } } } return $arr; } } rest-api-sdk-php/lib/PayPal/Core/PayPalCredentialManager.php 0000644 00000011215 15213403564 0017650 0 ustar 00 <?php namespace PayPal\Core; use PayPal\Auth\OAuthTokenCredential; use PayPal\Exception\PayPalInvalidCredentialException; /** * Class PayPalCredentialManager * * PayPalCredentialManager holds all the credential information in one place. * * @package PayPal\Core */ class PayPalCredentialManager { /** * Singleton Object * * @var PayPalCredentialManager */ private static $instance; /** * Hashmap to contain credentials for accounts. * * @var array */ private $credentialHashmap = array(); /** * Contains the API username of the default account to use * when authenticating API calls * * @var string */ private $defaultAccountName; /** * Constructor initialize credential for multiple accounts specified in property file * * @param $config * @throws \Exception */ private function __construct($config) { try { $this->initCredential($config); } catch (\Exception $e) { $this->credentialHashmap = array(); throw $e; } } /** * Create singleton instance for this class. * * @param array|null $config * @return PayPalCredentialManager */ public static function getInstance($config = null) { if (!self::$instance) { self::$instance = new self($config == null ? PayPalConfigManager::getInstance()->getConfigHashmap() : $config); } return self::$instance; } /** * Load credentials for multiple accounts, with priority given to Signature credential. * * @param array $config */ private function initCredential($config) { $suffix = 1; $prefix = "acct"; $arr = array(); foreach ($config as $k => $v) { if (strstr($k, $prefix)) { $arr[$k] = $v; } } $credArr = $arr; $arr = array(); foreach ($config as $key => $value) { $pos = strpos($key, '.'); if (strstr($key, "acct")) { $arr[] = substr($key, 0, $pos); } } $arrayPartKeys = array_unique($arr); $key = $prefix . $suffix; $userName = null; while (in_array($key, $arrayPartKeys)) { if (isset($credArr[$key . ".ClientId"]) && isset($credArr[$key . ".ClientSecret"])) { $userName = $key; $this->credentialHashmap[$userName] = new OAuthTokenCredential( $credArr[$key . ".ClientId"], $credArr[$key . ".ClientSecret"] ); } if ($userName && $this->defaultAccountName == null) { if (array_key_exists($key . '.UserName', $credArr)) { $this->defaultAccountName = $credArr[$key . '.UserName']; } else { $this->defaultAccountName = $key; } } $suffix++; $key = $prefix . $suffix; } } /** * Sets credential object for users * * @param \PayPal\Auth\OAuthTokenCredential $credential * @param string|null $userId User Id associated with the account * @param bool $default If set, it would make it as a default credential for all requests * * @return $this */ public function setCredentialObject(OAuthTokenCredential $credential, $userId = null, $default = true) { $key = $userId == null ? 'default' : $userId; $this->credentialHashmap[$key] = $credential; if ($default) { $this->defaultAccountName = $key; } return $this; } /** * Obtain Credential Object based on UserId provided. * * @param null $userId * @return OAuthTokenCredential * @throws PayPalInvalidCredentialException */ public function getCredentialObject($userId = null) { if ($userId == null && array_key_exists($this->defaultAccountName, $this->credentialHashmap)) { $credObj = $this->credentialHashmap[$this->defaultAccountName]; } elseif (array_key_exists($userId, $this->credentialHashmap)) { $credObj = $this->credentialHashmap[$userId]; } if (empty($credObj)) { throw new PayPalInvalidCredentialException("Credential not found for " . ($userId ? $userId : " default user") . ". Please make sure your configuration/APIContext has credential information"); } return $credObj; } /** * Disabling __clone call */ public function __clone() { trigger_error('Clone is not allowed.', E_USER_ERROR); } } rest-api-sdk-php/lib/PayPal/Common/PayPalUserAgent.php 0000644 00000002727 15213403564 0016550 0 ustar 00 <?php namespace PayPal\Common; /** * Class PayPalUserAgent * PayPalUserAgent generates User Agent for curl requests * * @package PayPal\Common */ class PayPalUserAgent { /** * Returns the value of the User-Agent header * Add environment values and php version numbers * * @param string $sdkName * @param string $sdkVersion * @return string */ public static function getValue($sdkName, $sdkVersion) { $featureList = array( 'platform-ver=' . PHP_VERSION, 'bit=' . self::_getPHPBit(), 'os=' . str_replace(' ', '_', php_uname('s') . ' ' . php_uname('r')), 'machine=' . php_uname('m') ); if (defined('OPENSSL_VERSION_TEXT')) { $opensslVersion = explode(' ', OPENSSL_VERSION_TEXT); $featureList[] = 'crypto-lib-ver=' . $opensslVersion[1]; } if (function_exists('curl_version')) { $curlVersion = curl_version(); $featureList[] = 'curl=' . $curlVersion['version']; } return sprintf("PayPalSDK/%s %s (%s)", $sdkName, $sdkVersion, implode('; ', $featureList)); } /** * Gets PHP Bit version * * @return int|string */ private static function _getPHPBit() { switch (PHP_INT_SIZE) { case 4: return '32'; case 8: return '64'; default: return PHP_INT_SIZE; } } } rest-api-sdk-php/lib/PayPal/Common/PayPalResourceModel.php 0000644 00000005711 15213403564 0017417 0 ustar 00 <?php namespace PayPal\Common; use PayPal\Rest\ApiContext; use PayPal\Rest\IResource; use PayPal\Transport\PayPalRestCall; /** * Class PayPalResourceModel * An Executable PayPalModel Class * * @property \PayPal\Api\Links[] links * @package PayPal\Common */ class PayPalResourceModel extends PayPalModel implements IResource { /** * Sets Links * * @param \PayPal\Api\Links[] $links * * @return $this */ public function setLinks($links) { $this->links = $links; return $this; } /** * Gets Links * * @return \PayPal\Api\Links[] */ public function getLinks() { return $this->links; } public function getLink($rel) { if (is_array($this->links)) { foreach ($this->links as $link) { if ($link->getRel() == $rel) { return $link->getHref(); } } } return null; } /** * Append Links to the list. * * @param \PayPal\Api\Links $links * @return $this */ public function addLink($links) { if (!$this->getLinks()) { return $this->setLinks(array($links)); } else { return $this->setLinks( array_merge($this->getLinks(), array($links)) ); } } /** * Remove Links from the list. * * @param \PayPal\Api\Links $links * @return $this */ public function removeLink($links) { return $this->setLinks( array_diff($this->getLinks(), array($links)) ); } /** * Execute SDK Call to Paypal services * * @param string $url * @param string $method * @param string $payLoad * @param array $headers * @param ApiContext $apiContext * @param PayPalRestCall $restCall * @param array $handlers * @return string json response of the object */ protected static function executeCall($url, $method, $payLoad, $headers = array(), $apiContext = null, $restCall = null, $handlers = array('PayPal\Handler\RestHandler')) { //Initialize the context and rest call object if not provided explicitly $apiContext = $apiContext ? $apiContext : new ApiContext(self::$credential); $restCall = $restCall ? $restCall : new PayPalRestCall($apiContext); //Make the execution call $json = $restCall->execute($handlers, $url, $method, $payLoad, $headers); return $json; } /** * Updates Access Token using long lived refresh token * * @param string|null $refreshToken * @param ApiContext $apiContext * @return void */ public function updateAccessToken($refreshToken, $apiContext) { $apiContext = $apiContext ? $apiContext : new ApiContext(self::$credential); $apiContext->getCredential()->updateAccessToken($apiContext->getConfig(), $refreshToken); } } rest-api-sdk-php/lib/PayPal/Common/ReflectionUtil.php 0000644 00000011133 15213403564 0016463 0 ustar 00 <?php namespace PayPal\Common; use PayPal\Exception\PayPalConfigurationException; /** * Class ReflectionUtil * * @package PayPal\Common */ class ReflectionUtil { /** * Reflection Methods * * @var \ReflectionMethod[] */ private static $propertiesRefl = array(); /** * Properties Type * * @var string[] */ private static $propertiesType = array(); /** * Gets Property Class of the given property. * If the class is null, it returns null. * If the property is not found, it returns null. * * @param $class * @param $propertyName * @return null|string * @throws PayPalConfigurationException */ public static function getPropertyClass($class, $propertyName) { if ($class == get_class(new PayPalModel())) { // Make it generic if PayPalModel is used for generating this return get_class(new PayPalModel()); } // If the class doesn't exist, or the method doesn't exist, return null. if (!class_exists($class) || !method_exists($class, self::getter($class, $propertyName))) { return null; } if (($annotations = self::propertyAnnotations($class, $propertyName)) && isset($annotations['return'])) { $param = $annotations['return']; } if (isset($param)) { $anno = preg_split("/[\s\[\]]+/", $param); return $anno[0]; } else { throw new PayPalConfigurationException("Getter function for '$propertyName' in '$class' class should have a proper return type."); } } /** * Checks if the Property is of type array or an object * * @param $class * @param $propertyName * @return null|boolean * @throws PayPalConfigurationException */ public static function isPropertyClassArray($class, $propertyName) { // If the class doesn't exist, or the method doesn't exist, return null. if (!class_exists($class) || !method_exists($class, self::getter($class, $propertyName))) { return null; } if (($annotations = self::propertyAnnotations($class, $propertyName)) && isset($annotations['return'])) { $param = $annotations['return']; } if (isset($param)) { return substr($param, -strlen('[]'))==='[]'; } else { throw new PayPalConfigurationException("Getter function for '$propertyName' in '$class' class should have a proper return type."); } } /** * Retrieves Annotations of each property * * @param $class * @param $propertyName * @throws \RuntimeException * @return mixed */ public static function propertyAnnotations($class, $propertyName) { $class = is_object($class) ? get_class($class) : $class; if (!class_exists('ReflectionProperty')) { throw new \RuntimeException("Property type of " . $class . "::{$propertyName} cannot be resolved"); } if ($annotations =& self::$propertiesType[$class][$propertyName]) { return $annotations; } if (!($refl =& self::$propertiesRefl[$class][$propertyName])) { $getter = self::getter($class, $propertyName); $refl = new \ReflectionMethod($class, $getter); self::$propertiesRefl[$class][$propertyName] = $refl; } // todo: smarter regexp if (!preg_match_all( '~\@([^\s@\(]+)[\t ]*(?:\(?([^\n@]+)\)?)?~i', $refl->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; } /** * preg_replace_callback callback function * * @param $match * @return string */ private static function replace_callback($match) { return ucwords($match[2]); } /** * Returns the properly formatted getter function name based on class name and property * Formats the property name to a standard getter function * * @param string $class * @param string $propertyName * @return string getter function name */ public static function getter($class, $propertyName) { return method_exists($class, "get" . ucfirst($propertyName)) ? "get" . ucfirst($propertyName) : "get" . preg_replace_callback("/([_\-\s]?([a-z0-9]+))/", "self::replace_callback", $propertyName); } } rest-api-sdk-php/lib/PayPal/Common/PayPalModel.php 0000644 00000020747 15213403564 0015715 0 ustar 00 <?php namespace PayPal\Common; use PayPal\Validation\JsonValidator; /** * Generic Model class that all API domain classes extend * Stores all member data in a Hashmap that enables easy * JSON encoding/decoding */ class PayPalModel { private $_propMap = array(); /** * OAuth Credentials to use for this call * * @var \PayPal\Auth\OAuthTokenCredential $credential */ protected static $credential; /** * Sets Credential * * @deprecated Pass ApiContext to create/get methods instead * @param \PayPal\Auth\OAuthTokenCredential $credential */ public static function setCredential($credential) { self::$credential = $credential; } /** * Default Constructor * * You can pass data as a json representation or array object. This argument eliminates the need * to do $obj->fromJson($data) later after creating the object. * * @param array|string|null $data * @throws \InvalidArgumentException */ public function __construct($data = null) { switch (gettype($data)) { case "NULL": break; case "string": JsonValidator::validate($data); $this->fromJson($data); break; case "array": $this->fromArray($data); break; default: } } /** * Returns a list of Object from Array or Json String. It is generally used when your json * contains an array of this object * * @param mixed $data Array object or json string representation * @return array */ public static function getList($data) { // Return Null if Null if ($data === null) { return null; } if (is_a($data, get_class(new \stdClass()))) { //This means, root element is object return new static(json_encode($data)); } $list = array(); if (is_array($data)) { $data = json_encode($data); } if (JsonValidator::validate($data)) { // It is valid JSON $decoded = json_decode($data); if ($decoded === null) { return $list; } if (is_array($decoded)) { foreach ($decoded as $k => $v) { $list[] = self::getList($v); } } if (is_a($decoded, get_class(new \stdClass()))) { //This means, root element is object $list[] = new static(json_encode($decoded)); } } return $list; } /** * Magic Get Method * * @param $key * @return mixed */ public function __get($key) { if ($this->__isset($key)) { return $this->_propMap[$key]; } return null; } /** * Magic Set Method * * @param $key * @param $value */ public function __set($key, $value) { if (!is_array($value) && $value === null) { $this->__unset($key); } else { $this->_propMap[$key] = $value; } } /** * Converts the input key into a valid Setter Method Name * * @param $key * @return mixed */ private function convertToCamelCase($key) { return str_replace(' ', '', ucwords(str_replace(array('_', '-'), ' ', $key))); } /** * Magic isSet Method * * @param $key * @return bool */ public function __isset($key) { return isset($this->_propMap[$key]); } /** * Magic Unset Method * * @param $key */ public function __unset($key) { unset($this->_propMap[$key]); } /** * Converts Params to Array * * @param $param * @return array */ private function _convertToArray($param) { $ret = array(); foreach ($param as $k => $v) { if ($v instanceof PayPalModel) { $ret[$k] = $v->toArray(); } elseif (is_array($v) && sizeof($v) <= 0) { $ret[$k] = array(); } elseif (is_array($v)) { $ret[$k] = $this->_convertToArray($v); } else { $ret[$k] = $v; } } // If the array is empty, which means an empty object, // we need to convert array to StdClass object to properly // represent JSON String if (sizeof($ret) <= 0) { $ret = new PayPalModel(); } return $ret; } /** * Fills object value from Array list * * @param $arr * @return $this */ public function fromArray($arr) { if (!empty($arr)) { // Iterate over each element in array foreach ($arr as $k => $v) { // If the value is an array, it means, it is an object after conversion if (is_array($v)) { // Determine the class of the object if (($clazz = ReflectionUtil::getPropertyClass(get_class($this), $k)) != null) { // If the value is an associative array, it means, its an object. Just make recursive call to it. if (empty($v)) { if (ReflectionUtil::isPropertyClassArray(get_class($this), $k)) { // It means, it is an array of objects. $this->assignValue($k, array()); continue; } $o = new $clazz(); //$arr = array(); $this->assignValue($k, $o); } elseif (ArrayUtil::isAssocArray($v)) { /** @var self $o */ $o = new $clazz(); $o->fromArray($v); $this->assignValue($k, $o); } else { // Else, value is an array of object/data $arr = array(); // Iterate through each element in that array. foreach ($v as $nk => $nv) { if (is_array($nv)) { $o = new $clazz(); $o->fromArray($nv); $arr[$nk] = $o; } else { $arr[$nk] = $nv; } } $this->assignValue($k, $arr); } } else { $this->assignValue($k, $v); } } else { $this->assignValue($k, $v); } } } return $this; } private function assignValue($key, $value) { $setter = 'set'. $this->convertToCamelCase($key); // If we find the setter, use that, otherwise use magic method. if (method_exists($this, $setter)) { $this->$setter($value); } else { $this->__set($key, $value); } } /** * Fills object value from Json string * * @param $json * @return $this */ public function fromJson($json) { return $this->fromArray(json_decode($json, true)); } /** * Returns array representation of object * * @return array */ public function toArray() { return $this->_convertToArray($this->_propMap); } /** * Returns object JSON representation * * @param int $options http://php.net/manual/en/json.constants.php * @return string */ public function toJSON($options = 0) { // Because of PHP Version 5.3, we cannot use JSON_UNESCAPED_SLASHES option // Instead we would use the str_replace command for now. // TODO: Replace this code with return json_encode($this->toArray(), $options | 64); once we support PHP >= 5.4 if (version_compare(phpversion(), '5.4.0', '>=') === true) { return json_encode($this->toArray(), $options | 64); } return str_replace('\\/', '/', json_encode($this->toArray(), $options)); } /** * Magic Method for toString * * @return string */ public function __toString() { return $this->toJSON(128); } } rest-api-sdk-php/lib/PayPal/Common/ArrayUtil.php 0000644 00000000670 15213403564 0015453 0 ustar 00 <?php namespace PayPal\Common; /** * Class ArrayUtil * Util Class for Arrays * * @package PayPal\Common */ class ArrayUtil { /** * * @param array $arr * @return true if $arr is an associative array */ public static function isAssocArray(array $arr) { foreach ($arr as $k => $v) { if (is_int($k)) { return false; } } return true; } } rest-api-sdk-php/lib/PayPal/Handler/RestHandler.php 0000644 00000010131 15213403564 0016070 0 ustar 00 <?php /** * API handler for all REST API calls */ namespace PayPal\Handler; use PayPal\Auth\OAuthTokenCredential; use PayPal\Common\PayPalUserAgent; use PayPal\Core\PayPalConstants; use PayPal\Core\PayPalCredentialManager; use PayPal\Core\PayPalHttpConfig; use PayPal\Exception\PayPalConfigurationException; use PayPal\Exception\PayPalInvalidCredentialException; use PayPal\Exception\PayPalMissingCredentialException; /** * Class RestHandler */ class RestHandler implements IPayPalHandler { /** * Private Variable * * @var \Paypal\Rest\ApiContext $apiContext */ private $apiContext; /** * Construct * * @param \Paypal\Rest\ApiContext $apiContext */ public function __construct($apiContext) { $this->apiContext = $apiContext; } /** * @param PayPalHttpConfig $httpConfig * @param string $request * @param mixed $options * @return mixed|void * @throws PayPalConfigurationException * @throws PayPalInvalidCredentialException * @throws PayPalMissingCredentialException */ public function handle($httpConfig, $request, $options) { $credential = $this->apiContext->getCredential(); $config = $this->apiContext->getConfig(); if ($credential == null) { // Try picking credentials from the config file $credMgr = PayPalCredentialManager::getInstance($config); $credValues = $credMgr->getCredentialObject(); if (!is_array($credValues)) { throw new PayPalMissingCredentialException("Empty or invalid credentials passed"); } $credential = new OAuthTokenCredential($credValues['clientId'], $credValues['clientSecret']); } if ($credential == null || !($credential instanceof OAuthTokenCredential)) { throw new PayPalInvalidCredentialException("Invalid credentials passed"); } $httpConfig->setUrl( rtrim(trim($this->_getEndpoint($config)), '/') . (isset($options['path']) ? $options['path'] : '') ); // Overwrite Expect Header to disable 100 Continue Issue $httpConfig->addHeader("Expect", null); if (!array_key_exists("User-Agent", $httpConfig->getHeaders())) { $httpConfig->addHeader("User-Agent", PayPalUserAgent::getValue(PayPalConstants::SDK_NAME, PayPalConstants::SDK_VERSION)); } if (!is_null($credential) && $credential instanceof OAuthTokenCredential && is_null($httpConfig->getHeader('Authorization'))) { $httpConfig->addHeader('Authorization', "Bearer " . $credential->getAccessToken($config), false); } if (($httpConfig->getMethod() == 'POST' || $httpConfig->getMethod() == 'PUT') && !is_null($this->apiContext->getRequestId())) { $httpConfig->addHeader('PayPal-Request-Id', $this->apiContext->getRequestId()); } // Add any additional Headers that they may have provided $headers = $this->apiContext->getRequestHeaders(); foreach ($headers as $key => $value) { $httpConfig->addHeader($key, $value); } } /** * End Point * * @param array $config * * @return string * @throws \PayPal\Exception\PayPalConfigurationException */ private function _getEndpoint($config) { if (isset($config['service.EndPoint'])) { return $config['service.EndPoint']; } elseif (isset($config['mode'])) { switch (strtoupper($config['mode'])) { case 'SANDBOX': return PayPalConstants::REST_SANDBOX_ENDPOINT; break; case 'LIVE': return PayPalConstants::REST_LIVE_ENDPOINT; break; default: throw new PayPalConfigurationException('The mode config parameter must be set to either sandbox/live'); break; } } else { // Defaulting to Sandbox return PayPalConstants::REST_SANDBOX_ENDPOINT; } } } rest-api-sdk-php/lib/PayPal/Handler/OauthHandler.php 0000644 00000006155 15213403564 0016246 0 ustar 00 <?php /** * API handler for OAuth Token Request REST API calls */ namespace PayPal\Handler; use PayPal\Common\PayPalUserAgent; use PayPal\Core\PayPalConstants; use PayPal\Core\PayPalHttpConfig; use PayPal\Exception\PayPalConfigurationException; use PayPal\Exception\PayPalInvalidCredentialException; use PayPal\Exception\PayPalMissingCredentialException; /** * Class OauthHandler */ class OauthHandler implements IPayPalHandler { /** * Private Variable * * @var \Paypal\Rest\ApiContext $apiContext */ private $apiContext; /** * Construct * * @param \Paypal\Rest\ApiContext $apiContext */ public function __construct($apiContext) { $this->apiContext = $apiContext; } /** * @param PayPalHttpConfig $httpConfig * @param string $request * @param mixed $options * @return mixed|void * @throws PayPalConfigurationException * @throws PayPalInvalidCredentialException * @throws PayPalMissingCredentialException */ public function handle($httpConfig, $request, $options) { $config = $this->apiContext->getConfig(); $httpConfig->setUrl( rtrim(trim($this->_getEndpoint($config)), '/') . (isset($options['path']) ? $options['path'] : '') ); $headers = array( "User-Agent" => PayPalUserAgent::getValue(PayPalConstants::SDK_NAME, PayPalConstants::SDK_VERSION), "Authorization" => "Basic " . base64_encode($options['clientId'] . ":" . $options['clientSecret']), "Accept" => "*/*" ); $httpConfig->setHeaders($headers); // Add any additional Headers that they may have provided $headers = $this->apiContext->getRequestHeaders(); foreach ($headers as $key => $value) { $httpConfig->addHeader($key, $value); } } /** * Get HttpConfiguration object for OAuth API * * @param array $config * * @return PayPalHttpConfig * @throws \PayPal\Exception\PayPalConfigurationException */ private static function _getEndpoint($config) { if (isset($config['oauth.EndPoint'])) { $baseEndpoint = $config['oauth.EndPoint']; } elseif (isset($config['service.EndPoint'])) { $baseEndpoint = $config['service.EndPoint']; } elseif (isset($config['mode'])) { switch (strtoupper($config['mode'])) { case 'SANDBOX': $baseEndpoint = PayPalConstants::REST_SANDBOX_ENDPOINT; break; case 'LIVE': $baseEndpoint = PayPalConstants::REST_LIVE_ENDPOINT; break; default: throw new PayPalConfigurationException('The mode config parameter must be set to either sandbox/live'); } } else { // Defaulting to Sandbox $baseEndpoint = PayPalConstants::REST_SANDBOX_ENDPOINT; } $baseEndpoint = rtrim(trim($baseEndpoint), '/') . "/v1/oauth2/token"; return $baseEndpoint; } } rest-api-sdk-php/lib/PayPal/Handler/IPayPalHandler.php 0000644 00000000535 15213403564 0016461 0 ustar 00 <?php namespace PayPal\Handler; /** * Interface IPayPalHandler * * @package PayPal\Handler */ interface IPayPalHandler { /** * * @param \Paypal\Core\PayPalHttpConfig $httpConfig * @param string $request * @param mixed $options * @return mixed */ public function handle($httpConfig, $request, $options); } rest-api-sdk-php/lib/PayPal/Transport/PayPalRestCall.php 0000644 00000004325 15213403564 0017124 0 ustar 00 <?php namespace PayPal\Transport; use PayPal\Core\PayPalHttpConfig; use PayPal\Core\PayPalHttpConnection; use PayPal\Core\PayPalLoggingManager; use PayPal\Rest\ApiContext; /** * Class PayPalRestCall * * @package PayPal\Transport */ class PayPalRestCall { /** * Paypal Logger * * @var PayPalLoggingManager logger interface */ private $logger; /** * API Context * * @var ApiContext */ private $apiContext; /** * Default Constructor * * @param ApiContext $apiContext */ public function __construct(ApiContext $apiContext) { $this->apiContext = $apiContext; $this->logger = PayPalLoggingManager::getInstance(__CLASS__); } /** * @param array $handlers Array of handlers * @param string $path Resource path relative to base service endpoint * @param string $method HTTP method - one of GET, POST, PUT, DELETE, PATCH etc * @param string $data Request payload * @param array $headers HTTP headers * @return mixed * @throws \PayPal\Exception\PayPalConnectionException */ public function execute($handlers = array(), $path, $method, $data = '', $headers = array()) { $config = $this->apiContext->getConfig(); $httpConfig = new PayPalHttpConfig(null, $method, $config); $headers = $headers ? $headers : array(); $httpConfig->setHeaders($headers + array( 'Content-Type' => 'application/json' ) ); // if proxy set via config, add it if (!empty($config['http.Proxy'])) { $httpConfig->setHttpProxy($config['http.Proxy']); } /** @var \Paypal\Handler\IPayPalHandler $handler */ foreach ($handlers as $handler) { if (!is_object($handler)) { $fullHandler = "\\" . (string)$handler; $handler = new $fullHandler($this->apiContext); } $handler->handle($httpConfig, $data, array('path' => $path, 'apiContext' => $this->apiContext)); } $connection = new PayPalHttpConnection($httpConfig, $config); $response = $connection->execute($data); return $response; } } rest-api-sdk-php/lib/PayPal/Security/Cipher.php 0000644 00000002467 15213403564 0015336 0 ustar 00 <?php namespace PayPal\Security; /** * Class Cipher * * Helper class to encrypt/decrypt data with secret key * * @package PayPal\Security */ class Cipher { private $secretKey; /** * Fixed IV Size */ const IV_SIZE = 16; public function __construct($secretKey) { $this->secretKey = $secretKey; } /** * Encrypts the input text using the cipher key * * @param $input * @return string */ public function encrypt($input) { // Create a random IV. Not using mcrypt to generate one, as to not have a dependency on it. $iv = substr(uniqid("", true), 0, Cipher::IV_SIZE); // Encrypt the data $encrypted = openssl_encrypt($input, "AES-256-CBC", $this->secretKey, 0, $iv); // Encode the data with IV as prefix return base64_encode($iv . $encrypted); } /** * Decrypts the input text from the cipher key * * @param $input * @return string */ public function decrypt($input) { // Decode the IV + data $input = base64_decode($input); // Remove the IV $iv = substr($input, 0, Cipher::IV_SIZE); // Return Decrypted Data return openssl_decrypt(substr($input, Cipher::IV_SIZE), "AES-256-CBC", $this->secretKey, 0, $iv); } } rest-api-sdk-php/lib/PayPal/Converter/FormatConverter.php 0000644 00000003622 15213403564 0017376 0 ustar 00 <?php namespace PayPal\Converter; class FormatConverter { /** * Format the data based on the input formatter value * * @param $value * @param $formatter * @return string */ public static function format($value, $formatter) { return sprintf($formatter, $value); } /** * Format the input data with decimal places * * Defaults to 2 decimal places * * @param $value * @param int $decimals * @return null|string */ public static function formatToNumber($value, $decimals = 2) { if (trim($value) != null) { return number_format($value, $decimals, '.', ''); } return null; } /** * Helper method to format price values with associated currency information. * * It covers the cases where certain currencies does not accept decimal values. We will be adding * any specific currency level rules as required here. * * @param $value * @param null $currency * @return null|string */ public static function formatToPrice($value, $currency = null) { $decimals = 2; $currencyDecimals = array('JPY' => 0, 'TWD' => 0, 'HUF' => 0); if ($currency && array_key_exists($currency, $currencyDecimals)) { if (strpos($value, ".") !== false && (floor($value) != $value)) { //throw exception if it has decimal values for JPY, TWD and HUF which does not ends with .00 throw new \InvalidArgumentException("value cannot have decimals for $currency currency"); } $decimals = $currencyDecimals[$currency]; } elseif (strpos($value, ".") === false) { // Check if value has decimal values. If not no need to assign 2 decimals with .00 at the end $decimals = 0; } return self::formatToNumber($value, $decimals); } } rest-api-sdk-php/lib/PayPal/Cache/AuthorizationCache.php 0000644 00000007560 15213403564 0017103 0 ustar 00 <?php namespace PayPal\Cache; use PayPal\Core\PayPalConfigManager; use PayPal\Validation\JsonValidator; abstract class AuthorizationCache { public static $CACHE_PATH = '/../../../var/auth.cache'; /** * A pull method which would read the persisted data based on clientId. * If clientId is not provided, an array with all the tokens would be passed. * * @param array|null $config * @param string $clientId * @return mixed|null */ public static function pull($config = null, $clientId = null) { // Return if not enabled if (!self::isEnabled($config)) { return null; } $tokens = null; $cachePath = self::cachePath($config); if (file_exists($cachePath)) { // Read from the file $cachedToken = file_get_contents($cachePath); if ($cachedToken && JsonValidator::validate($cachedToken, true)) { $tokens = json_decode($cachedToken, true); if ($clientId && is_array($tokens) && array_key_exists($clientId, $tokens)) { // If client Id is found, just send in that data only return $tokens[$clientId]; } elseif ($clientId) { // If client Id is provided, but no key in persisted data found matching it. return null; } } } return $tokens; } /** * Persists the data into a cache file provided in $CACHE_PATH * * @param array|null $config * @param $clientId * @param $accessToken * @param $tokenCreateTime * @param $tokenExpiresIn * @throws \Exception */ public static function push($config = null, $clientId, $accessToken, $tokenCreateTime, $tokenExpiresIn) { // Return if not enabled if (!self::isEnabled($config)) { return; } $cachePath = self::cachePath($config); if (!is_dir(dirname($cachePath))) { if (mkdir(dirname($cachePath), 0755, true) == false) { throw new \Exception("Failed to create directory at $cachePath"); } } // Reads all the existing persisted data $tokens = self::pull(); $tokens = $tokens ? $tokens : array(); if (is_array($tokens)) { $tokens[$clientId] = array( 'clientId' => $clientId, 'accessTokenEncrypted' => $accessToken, 'tokenCreateTime' => $tokenCreateTime, 'tokenExpiresIn' => $tokenExpiresIn ); } if (!file_put_contents($cachePath, json_encode($tokens))) { throw new \Exception("Failed to write cache"); }; } /** * Determines from the Configuration if caching is currently enabled/disabled * * @param $config * @return bool */ public static function isEnabled($config) { $value = self::getConfigValue('cache.enabled', $config); return empty($value) ? false : ((trim($value) == true || trim($value) == 'true')); } /** * Returns the cache file path * * @param $config * @return string */ public static function cachePath($config) { $cachePath = self::getConfigValue('cache.FileName', $config); return empty($cachePath) ? __DIR__ . self::$CACHE_PATH : $cachePath; } /** * Returns the Value of the key if found in given config, or from PayPal Config Manager * Returns null if not found * * @param $key * @param $config * @return null|string */ private static function getConfigValue($key, $config) { $config = ($config && is_array($config)) ? $config : PayPalConfigManager::getInstance()->getConfigHashmap(); return (array_key_exists($key, $config)) ? trim($config[$key]) : null; } } rest-api-sdk-php/lib/PayPal/Validation/ArgumentValidator.php 0000644 00000001675 15213403564 0020037 0 ustar 00 <?php namespace PayPal\Validation; /** * Class ArgumentValidator * * @package PayPal\Validation */ class ArgumentValidator { /** * Helper method for validating an argument that will be used by this API in any requests. * * @param $argument mixed The object to be validated * @param $argumentName string|null The name of the argument. * This will be placed in the exception message for easy reference * @return bool */ public static function validate($argument, $argumentName = null) { if ($argument === null) { // Error if Object Null throw new \InvalidArgumentException("$argumentName cannot be null"); } elseif (gettype($argument) == 'string' && trim($argument) == '') { // Error if String Empty throw new \InvalidArgumentException("$argumentName string cannot be empty"); } return true; } } rest-api-sdk-php/lib/PayPal/Validation/UrlValidator.php 0000644 00000001071 15213403564 0017005 0 ustar 00 <?php namespace PayPal\Validation; /** * Class UrlValidator * * @package PayPal\Validation */ class UrlValidator { /** * Helper method for validating URLs that will be used by this API in any requests. * * @param $url * @param string|null $urlName * @throws \InvalidArgumentException */ public static function validate($url, $urlName = null) { if (filter_var($url, FILTER_VALIDATE_URL) === false) { throw new \InvalidArgumentException("$urlName is not a fully qualified URL"); } } } rest-api-sdk-php/lib/PayPal/Validation/NumericValidator.php 0000644 00000001112 15213403564 0017641 0 ustar 00 <?php namespace PayPal\Validation; /** * Class NumericValidator * * @package PayPal\Validation */ class NumericValidator { /** * Helper method for validating an argument if it is numeric * * @param mixed $argument * @param string|null $argumentName * @return bool */ public static function validate($argument, $argumentName = null) { if (trim($argument) != null && !is_numeric($argument)) { throw new \InvalidArgumentException("$argumentName is not a valid numeric value"); } return true; } } rest-api-sdk-php/lib/PayPal/Validation/JsonValidator.php 0000644 00000001550 15213403564 0017156 0 ustar 00 <?php namespace PayPal\Validation; /** * Class JsonValidator * * @package PayPal\Validation */ class JsonValidator { /** * Helper method for validating if string provided is a valid json. * * @param string $string String representation of Json object * @param bool $silent Flag to not throw \InvalidArgumentException * @return bool */ public static function validate($string, $silent = false) { @json_decode($string); if (json_last_error() != JSON_ERROR_NONE) { if ($string === '' || $string === null) { return true; } if ($silent == false) { //Throw an Exception for string or array throw new \InvalidArgumentException("Invalid JSON String"); } return false; } return true; } } rest-api-sdk-php/lib/PayPal/Exception/PayPalConnectionException.php 0000644 00000002110 15213403564 0021321 0 ustar 00 <?php namespace PayPal\Exception; /** * Class PayPalConnectionException * * @package PayPal\Exception */ class PayPalConnectionException extends \Exception { /** * The url that was being connected to when the exception occured * * @var string */ private $url; /** * Any response data that was returned by the server * * @var string */ private $data; /** * Default Constructor * * @param string $url * @param string $message * @param int $code */ public function __construct($url, $message, $code = 0) { parent::__construct($message, $code); $this->url = $url; } /** * Sets Data * * @param $data */ public function setData($data) { $this->data = $data; } /** * Gets Data * * @return string */ public function getData() { return $this->data; } /** * Gets Url * * @return string */ public function getUrl() { return $this->url; } } rest-api-sdk-php/lib/PayPal/Exception/PayPalConfigurationException.php 0000644 00000000621 15213403564 0022036 0 ustar 00 <?php namespace PayPal\Exception; /** * Class PayPalConfigurationException * * @package PayPal\Exception */ class PayPalConfigurationException extends \Exception { /** * Default Constructor * * @param string|null $message * @param int $code */ public function __construct($message = null, $code = 0) { parent::__construct($message, $code); } } rest-api-sdk-php/lib/PayPal/Exception/PayPalMissingCredentialException.php 0000644 00000001262 15213403564 0022635 0 ustar 00 <?php namespace PayPal\Exception; /** * Class PayPalMissingCredentialException * * @package PayPal\Exception */ class PayPalMissingCredentialException extends \Exception { /** * Default Constructor * * @param string $message * @param int $code */ public function __construct($message = null, $code = 0) { parent::__construct($message, $code); } /** * prints error message * * @return string */ public function errorMessage() { $errorMsg = 'Error on line ' . $this->getLine() . ' in ' . $this->getFile() . ': <b>' . $this->getMessage() . '</b>'; return $errorMsg; } } rest-api-sdk-php/lib/PayPal/Exception/PayPalInvalidCredentialException.php 0000644 00000001266 15213403564 0022616 0 ustar 00 <?php namespace PayPal\Exception; /** * Class PayPalInvalidCredentialException * * @package PayPal\Exception */ class PayPalInvalidCredentialException extends \Exception { /** * Default Constructor * * @param string|null $message * @param int $code */ public function __construct($message = null, $code = 0) { parent::__construct($message, $code); } /** * prints error message * * @return string */ public function errorMessage() { $errorMsg = 'Error on line ' . $this->getLine() . ' in ' . $this->getFile() . ': <b>' . $this->getMessage() . '</b>'; return $errorMsg; } } rest-api-sdk-php/lib/PayPal/Rest/ApiContext.php 0000644 00000010237 15213403564 0015302 0 ustar 00 <?php namespace PayPal\Rest; use PayPal\Core\PayPalConfigManager; use PayPal\Core\PayPalCredentialManager; /** * Class ApiContext * * Call level parameters such as request id, credentials etc * * @package PayPal\Rest */ class ApiContext { /** * Unique request id to be used for this call * The user can either generate one as per application * needs or let the SDK generate one * * @var null|string $requestId */ private $requestId; /** * This is a placeholder for holding credential for the request * If the value is not set, it would get the value from @\PayPal\Core\PayPalCredentialManager * * @var \PayPal\Auth\OAuthTokenCredential */ private $credential; /** * Construct * * @param \PayPal\Auth\OAuthTokenCredential $credential * @param string|null $requestId */ public function __construct($credential = null, $requestId = null) { $this->requestId = $requestId; $this->credential = $credential; } /** * Get Credential * * @return \PayPal\Auth\OAuthTokenCredential */ public function getCredential() { if ($this->credential == null) { return PayPalCredentialManager::getInstance()->getCredentialObject(); } return $this->credential; } public function getRequestHeaders() { $result = PayPalConfigManager::getInstance()->get('http.headers'); $headers = array(); foreach ($result as $header => $value) { $headerName = ltrim($header, 'http.headers'); $headers[$headerName] = $value; } return $headers; } public function addRequestHeader($name, $value) { // Determine if the name already has a 'http.headers' prefix. If not, add one. if (!(substr($name, 0, strlen('http.headers')) === 'http.headers')) { $name = 'http.headers.' . $name; } PayPalConfigManager::getInstance()->addConfigs(array($name => $value)); } /** * Get Request ID * * @return string */ public function getRequestId() { return $this->requestId; } /** * Sets the request ID * * @param string $requestId the PayPal-Request-Id value to use */ public function setRequestId($requestId) { $this->requestId = $requestId; } /** * Resets the requestId that can be used to set the PayPal-request-id * header used for idempotency. In cases where you need to make multiple create calls * using the same ApiContext object, you need to reset request Id. * @deprecated Call setRequestId with a unique value. * * @return string */ public function resetRequestId() { $this->requestId = $this->generateRequestId(); return $this->getRequestId(); } /** * Sets Config * * @param array $config SDK configuration parameters */ public function setConfig(array $config) { PayPalConfigManager::getInstance()->addConfigs($config); } /** * Gets Configurations * * @return array */ public function getConfig() { return PayPalConfigManager::getInstance()->getConfigHashmap(); } /** * Gets a specific configuration from key * * @param $searchKey * @return mixed */ public function get($searchKey) { return PayPalConfigManager::getInstance()->get($searchKey); } /** * Generates a unique per request id that * can be used to set the PayPal-Request-Id header * that is used for idempotency * @deprecated * * @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); } } rest-api-sdk-php/lib/PayPal/Rest/IResource.php 0000644 00000000161 15213403564 0015117 0 ustar 00 <?php namespace PayPal\Rest; /** * Interface IResource * * @package PayPal\Rest */ interface IResource { } rest-api-sdk-php/lib/PayPal/Auth/OAuthTokenCredential.php 0000644 00000022340 15213403564 0017222 0 ustar 00 <?php namespace PayPal\Auth; use PayPal\Cache\AuthorizationCache; use PayPal\Common\PayPalResourceModel; use PayPal\Core\PayPalHttpConfig; use PayPal\Core\PayPalHttpConnection; use PayPal\Core\PayPalLoggingManager; use PayPal\Exception\PayPalConfigurationException; use PayPal\Exception\PayPalConnectionException; use PayPal\Handler\IPayPalHandler; use PayPal\Rest\ApiContext; use PayPal\Security\Cipher; /** * Class OAuthTokenCredential */ class OAuthTokenCredential extends PayPalResourceModel { public static $CACHE_PATH = '/../../../var/auth.cache'; /** * @var string Default Auth Handler */ public static $AUTH_HANDLER = 'PayPal\Handler\OauthHandler'; /** * Private Variable * * @var int $expiryBufferTime */ public static $expiryBufferTime = 120; /** * Client ID as obtained from the developer portal * * @var string $clientId */ private $clientId; /** * Client secret as obtained from the developer portal * * @var string $clientSecret */ private $clientSecret; /** * Target subject */ private $targetSubject; /** * Generated Access Token * * @var string $accessToken */ private $accessToken; /** * Seconds for with access token is valid * * @var $tokenExpiresIn */ private $tokenExpiresIn; /** * Last time (in milliseconds) when access token was generated * * @var $tokenCreateTime */ private $tokenCreateTime; /** * Instance of cipher used to encrypt/decrypt data while storing in cache. * * @var Cipher */ private $cipher; /** * Construct * * @param string $clientId client id obtained from the developer portal * @param string $clientSecret client secret obtained from the developer portal */ public function __construct($clientId, $clientSecret, $targetSubject = null) { $this->clientId = $clientId; $this->clientSecret = $clientSecret; $this->cipher = new Cipher($this->clientSecret); $this->targetSubject = $targetSubject; } /** * Get Client ID * * @return string */ public function getClientId() { return $this->clientId; } /** * Get Client Secret * * @return string */ public function getClientSecret() { return $this->clientSecret; } /** * Get AccessToken * * @param $config * * @return null|string */ public function getAccessToken($config) { // Check if we already have accessToken in Cache if ($this->accessToken && (time() - $this->tokenCreateTime) < ($this->tokenExpiresIn - self::$expiryBufferTime)) { return $this->accessToken; } // Check for persisted data first $token = AuthorizationCache::pull($config, $this->clientId); if ($token) { // We found it // This code block is for backward compatibility only. if (array_key_exists('accessToken', $token)) { $this->accessToken = $token['accessToken']; } $this->tokenCreateTime = $token['tokenCreateTime']; $this->tokenExpiresIn = $token['tokenExpiresIn']; // Case where we have an old unencrypted cache file if (!array_key_exists('accessTokenEncrypted', $token)) { AuthorizationCache::push($config, $this->clientId, $this->encrypt($this->accessToken), $this->tokenCreateTime, $this->tokenExpiresIn); } else { $this->accessToken = $this->decrypt($token['accessTokenEncrypted']); } } // 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) { // Get a new one by making calls to API $this->updateAccessToken($config); AuthorizationCache::push($config, $this->clientId, $this->encrypt($this->accessToken), $this->tokenCreateTime, $this->tokenExpiresIn); } return $this->accessToken; } /** * Get a Refresh Token from Authorization Code * * @param $config * @param $authorizationCode * @param array $params optional arrays to override defaults * @return string|null */ public function getRefreshToken($config, $authorizationCode = null, $params = array()) { static $allowedParams = array( 'grant_type' => 'authorization_code', 'code' => 1, 'redirect_uri' => 'urn:ietf:wg:oauth:2.0:oob', 'response_type' => 'token' ); $params = is_array($params) ? $params : array(); if ($authorizationCode) { //Override the authorizationCode if value is explicitly set $params['code'] = $authorizationCode; } $payload = http_build_query(array_merge($allowedParams, array_intersect_key($params, $allowedParams))); $response = $this->getToken($config, $this->clientId, $this->clientSecret, $payload); if ($response != null && isset($response["refresh_token"])) { return $response['refresh_token']; } return null; } /** * Updates Access Token based on given input * * @param array $config * @param string|null $refreshToken * @return string */ public function updateAccessToken($config, $refreshToken = null) { $this->generateAccessToken($config, $refreshToken); return $this->accessToken; } /** * Retrieves the token based on the input configuration * * @param array $config * @param string $clientId * @param string $clientSecret * @param string $payload * @return mixed * @throws PayPalConfigurationException * @throws \PayPal\Exception\PayPalConnectionException */ protected function getToken($config, $clientId, $clientSecret, $payload) { $httpConfig = new PayPalHttpConfig(null, 'POST', $config); // if proxy set via config, add it if (!empty($config['http.Proxy'])) { $httpConfig->setHttpProxy($config['http.Proxy']); } $handlers = array(self::$AUTH_HANDLER); /** @var IPayPalHandler $handler */ foreach ($handlers as $handler) { if (!is_object($handler)) { $fullHandler = "\\" . (string)$handler; $handler = new $fullHandler(new ApiContext($this)); } $handler->handle($httpConfig, $payload, array('clientId' => $clientId, 'clientSecret' => $clientSecret)); } $connection = new PayPalHttpConnection($httpConfig, $config); $res = $connection->execute($payload); $response = json_decode($res, true); return $response; } /** * Generates a new access token * * @param array $config * @param null|string $refreshToken * @return null * @throws PayPalConnectionException */ private function generateAccessToken($config, $refreshToken = null) { $params = array('grant_type' => 'client_credentials'); if ($refreshToken != null) { // If the refresh token is provided, it would get access token using refresh token // Used for Future Payments $params['grant_type'] = 'refresh_token'; $params['refresh_token'] = $refreshToken; } if ($this->targetSubject != null) { $params['target_subject'] = $this->targetSubject; } $payload = http_build_query($params); $response = $this->getToken($config, $this->clientId, $this->clientSecret, $payload); if ($response == null || !isset($response["access_token"]) || !isset($response["expires_in"])) { $this->accessToken = null; $this->tokenExpiresIn = null; PayPalLoggingManager::getInstance(__CLASS__)->warning("Could not generate new Access token. Invalid response from server: "); throw new PayPalConnectionException(null, "Could not generate new Access token. Invalid response from server: "); } else { $this->accessToken = $response["access_token"]; $this->tokenExpiresIn = $response["expires_in"]; } $this->tokenCreateTime = time(); return $this->accessToken; } /** * Helper method to encrypt data using clientSecret as key * * @param $data * @return string */ public function encrypt($data) { return $this->cipher->encrypt($data); } /** * Helper method to decrypt data using clientSecret as key * * @param $data * @return string */ public function decrypt($data) { return $this->cipher->decrypt($data); } }
| ver. 1.4 |
Github
|
.
| PHP 8.2.31 | Generation time: 1.8 |
proxy
|
phpinfo
|
Settings