Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefano Franco committed Oct 5, 2023
0 parents commit 35b31cd
Show file tree
Hide file tree
Showing 150 changed files with 11,655 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

build
.DS_Store
*.log
.idea

# IDE
.project
.settings
.buildpath
*.bak

# Composer
vendor
composer.lock
38 changes: 38 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
### CHANGELOG

####Version 3.9.2 - Apr 8, 2016

- Removed Duplicate Directories.

####Version 3.9.1 - Dec 9, 2015

- Added TLSv1.2 Endpoint support

####Version 3.9.0 - Sep 22, 2015

- Updated IPN Endpoint

####Version 3.6.106 - August 22, 2013

- Updated stubs.
- Updated samples to showcase dynamic configuration.

You can see source code of this release in github under https://github.com/paypal/adaptivepayments-sdk-php/tree/v3.6.106
--------------------------------------------------------------------------------------------------

####Version 3.5.103 - June 11, 2013

- Updated stubs for 103 release.
- Removed deprecated methods like setAccessToken, getAccessToken from baseService in core.
- Added correct thirdparty auth header in core.
- Updated install script in samples to handle wildcard tag names.

You can see source code of this release in github under https://github.com/paypal/adaptivepayments-sdk-php/tree/v3.5.103

--------------------------------------------------------------------------------------------------

#### Version 3.4.102 - May 20, 2013

- Updating SDK to use NameSpaces, Supported from PHP 5.3 and above

You can see source code of this release in github under https://github.com/paypal/adaptivepayments-sdk-php/tree/v3.4.102
86 changes: 86 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
The PayPal 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.
162 changes: 162 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@

# PayPal PHP Adaptive Payments SDK

## TLSv1.2 Update
> **The Payment Card Industry (PCI) Council has [mandated](http://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**
> A new `mode` has been created to test if your server/machine handles TLSv1.2 connections. Please use `tls` mode instead of `sandbox` to verify. You can return back to `sandbox` mode once you have verified. Please have a look at this [Sample Configuration](https://github.com/paypal/adaptivepayments-sdk-php/blob/namespace-php5.3/samples/Configuration.php#L10-15).
## POODLE Update
- Because of the Poodle vulnerability, PayPal has disabled SSLv3.
- To enable TLS encryption, the changes were made to [PPHttpConfig.php](https://github.com/paypal/sdk-core-php/blob/namespace-5.3/lib/PayPal/Core/PPHttpConfig.php#L11) in [SDK Core](https://github.com/paypal/sdk-core-php/tree/namespace-5.3) to use a cipher list specific to TLS encryption.
``` php
/**
* Some default options for curl
* These are typically overridden by PPConnectionManager
*/
public static $DEFAULT_CURL_OPTS = array(
CURLOPT_SSLVERSION => 1,
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',
);
```
- There are two primary changes done to curl options:
- CURLOPT_SSLVERSION is set to 1 . See [here](http://curl.haxx.se/libcurl/c/CURLOPT_SSLVERSION.html) for more information
- CURLOPT_SSL_CIPHER_LIST was set to TLSv1, See [here](http://curl.haxx.se/libcurl/c/CURLOPT_SSL_CIPHER_LIST.html) for more information

All these changes are included in the recent release, along with many other bug fixes. We highly encourage you to update your versions, by either using `composer` or running this command shown below:

```
curl -L https://raw.github.com/paypal/adaptivepayments-sdk-php/stable-php5.3/samples/install.php | php
OR
wget https://raw.github.com/paypal/adaptivepayments-sdk-php/stable-php5.3/samples/install.php
php install.php
```

## Prerequisites

PayPal's PHP Adaptive Payments SDK requires

* PHP 5.3 and above
* curl/openssl PHP extensions

## Running the sample

To run the bundled sample, first copy the samples folder to your web server root. You will then need to install the SDK as a dependency using either composer (PHP V5.3+ only).


run `composer update` from the samples folder.

## Using the SDK


To use the SDK,

* Create a composer.json file with the following contents.
```json
{
"name": "me/shopping-cart-app",
"require": {
"paypal/adaptivepayments-sdk-php":"v3.6.106"
}
}
```

* Install the SDK as a dependency using composer.
* Require `vendor/autoload.php` OR `PPBootStrap.php` in your application.
* Choose how you would like to configure the SDK - You can either
* Create a hashmap containing configuration parameters and pass it to the service object OR
* Create a `sdk_config.ini` file and set the PP_CONFIG_PATH constant to point to the directory where this file exists.
* Instantiate a service wrapper object and a request object as per your project's needs.
* Invoke the appropriate method on the service object.

For example,

```php
// Sets config file path(if config file is used) and registers the classloader
require("PPBootStrap.php");

// Array containing credentials and confiuration parameters. (not required if config file is used)
$config = array(
'mode' => 'sandbox',
'acct1.UserName' => 'jb-us-seller_api1.paypal.com',
'acct1.Password' => 'WX4WTU3S8MY44S7F'
.....
);

$payRequest = new PayRequest($requestEnvelope, $actionType, $cancelUrl,
$currencyCode, $receiverList, $returnUrl);
// Add optional params
if($_POST["feesPayer"] != "") {
$payRequest->feesPayer = $_POST["feesPayer"];
}
......

$service = new AdaptivePaymentsService($config);
$response = $service->Pay($payRequest);
if(strtoupper($response->responseEnvelope->ack == 'SUCCESS') {
// Success
}
```

## Authentication

The SDK provides multiple ways to authenticate your API call.

```php
$service = new AdaptivePaymentsService($config);

// Use the default account (the first account) configured in sdk_config.ini or config hashmap
$response = $service->Pay($payRequest);

// Use a specific account configured in sdk_config.ini or config hashmap
$response = $service->Pay($payRequest, 'jb-us-seller_api1.paypal.com');

// Pass in a dynamically created API credential object
$cred = new PPCertificateCredential("username", "password", "path-to-pem-file");
$cred->setThirdPartyAuthorization(new PPTokenAuthorization("accessToken", "tokenSecret"));
$response = $service->Pay($payRequest, $cred);
```

## SDK Configuration


The SDK allows you to configure the following parameters.

* Integration mode (sandbox / live)
* (Multiple) API account credentials.
* HTTP connection parameters
* Logging

Dynamic configuration values can be set by passing a map of credential and config values (if config map is passed the config file is ignored)
```php
$config = array(
'mode' => 'sandbox',
'acct1.UserName' => 'jb-us-seller_api1.paypal.com',
'acct1.Password' => 'WX4WTU3S8MY44S7F'
.....
);
$service = new AdaptivePaymentsService($config);
```
Alternatively, you can configure the SDK via the sdk_config.ini file.
```php
define('PP_CONFIG_PATH', '/directory/that/contains/sdk_config.ini');
$service = new AdaptivePaymentsService();
```

You can refer full list of configuration parameters in [wiki](https://github.com/paypal/sdk-core-php/wiki/Configuring-the-SDK) page.

## Instant Payment Notification (IPN)

Please refer to the IPN-README in the 'samples/IPN' directory.

## Links

* API Reference - https://developer.paypal.com/webapps/developer/docs/classic/api/#ap
* If you need help using the SDK, a new feature that you need or have a issue to report, please visit https://github.com/paypal/adaptivepayments-sdk-php/issues
24 changes: 24 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "skuola/paypal-adaptivepayments-sdk-php",
"description": "PayPal adaptivepayments SDK for PHP",
"keywords": ["paypal", "php", "sdk"],
"homepage": "https://developer.paypal.com",
"license": "Apache2",
"authors": [
{
"name": "PayPal",
"homepage": "https://gitlab.skuola.net/skuola/paypal-adaptivepayments-sdk-php/contributors"
}
],
"require": {
"php": ">=5.3.0",
"ext-curl": "*",
"skuola/paypal-sdk-core-php":"dev-master"
},
"autoload": {
"psr-0": {
"PayPal\\Service": "lib/",
"PayPal\\Types": "lib/"
}
}
}
Loading

0 comments on commit 35b31cd

Please sign in to comment.