recreate project

This commit is contained in:
root
2026-02-10 22:11:06 -05:00
commit 663c0cdbda
10149 changed files with 1379710 additions and 0 deletions
+6
View File
@@ -0,0 +1,6 @@
# .coveralls.yml configuration
# for php-coveralls
src_dir: lib
coverage_clover: build/coverage/clover.xml
json_path: build/coverage/coveralls-upload.json
+11
View File
@@ -0,0 +1,11 @@
# EditorConfig: Manage project indentation rules. http://EditorConfig.org
root = true
[*]
end_of_line = lf
insert_final_newline = true
[*.php]
indent_style = space
indent_size = 4
+21
View File
@@ -0,0 +1,21 @@
build
.DS_Store
phpunit.local.xml
*.log
# IDE
.idea
.project
.settings
.buildpath
atlassian-ide-plugin.xml
*.bak
# Composer
vendor
composer.lock
# Project
var
tools
+32
View File
@@ -0,0 +1,32 @@
sudo: false
language: php
php:
- 5.3
- 5.4
- 5.5
- 5.6
- 7.0
- hhvm
matrix:
allow_failures:
- php: hhvm
fast_finish: true
before_script:
- composer self-update
- composer install --dev
- composer require satooshi/php-coveralls:* --dev
script:
- mkdir build
- mkdir build/coverage
- phpunit
after_success:
- php vendor/bin/coveralls -v -c .coveralls.yml
- if [ $TRAVIS_PHP_VERSION = '5.6' ] && [ $TRAVIS_BRANCH = 'master' ] && [ $TRAVIS_PULL_REQUEST = 'false' ]; then sh generate-api.sh; fi
notifications:
email:
recipients:
- DL-PP-PHP-SDK@paypal.com
on_success: change
env:
global:
secure: UazgSLMJmrhmO+Do9TDiu8EKop06Xc2Ghi9F/8rx/CLz2FDZ5UDdzDD8uetjfdOnmMV7oadq13FGxJb9YCqTiJPZFpKsGtEr/IcCdpkO2krluLuWw5Veh8YxRG4rcZ+UWS0JpfQ72L9Zp4dMqPRo8SzcfiZV3HMG1uKYKpTSKnM=
+41
View File
@@ -0,0 +1,41 @@
PAYPAL, INC.
SDK LICENSE
NOTICE TO USER: PayPal, Inc. is providing the Software and Documentation for use under the terms of this Agreement. Any use, reproduction, modification or distribution of the Software or Documentation, or any derivatives or portions hereof, constitutes your acceptance of this Agreement.
As used in this Agreement, "PayPal" means PayPal, Inc. "Software" means the software code accompanying this agreement. "Documentation" means the documents, specifications and all other items accompanying this Agreement other than the Software.
1. LICENSE GRANT Subject to the terms of this Agreement, PayPal hereby grants you a non-exclusive, worldwide, royalty free license to use, reproduce, prepare derivative works from, publicly display, publicly perform, distribute and sublicense the Software for any purpose, provided the copyright notice below appears in a conspicuous location within the source code of the distributed Software and this license is distributed in the supporting documentation of the Software you distribute. Furthermore, you must comply with all third party licenses in order to use the third party software contained in the Software.
Subject to the terms of this Agreement, PayPal hereby grants you a non-exclusive, worldwide, royalty free license to use, reproduce, publicly display, publicly perform, distribute and sublicense the Documentation for any purpose. You may not modify the Documentation.
No title to the intellectual property in the Software or Documentation is transferred to you under the terms of this Agreement. You do not acquire any rights to the Software or the Documentation except as expressly set forth in this Agreement.
If you choose to distribute the Software in a commercial product, you do so with the understanding that you agree to defend, indemnify and hold harmless PayPal and its suppliers against any losses, damages and costs arising from the claims, lawsuits or other legal actions arising out of such distribution. You may distribute the Software in object code form under your own license, provided that your license agreement:
(a) complies with the terms and conditions of this license agreement;
(b) effectively disclaims all warranties and conditions, express or implied, on behalf of PayPal;
(c) effectively excludes all liability for damages on behalf of PayPal;
(d) states that any provisions that differ from this Agreement are offered by you alone and not PayPal; and
(e) states that the Software is available from you or PayPal and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange.
2. DISCLAIMER OF WARRANTY
PAYPAL LICENSES THE SOFTWARE AND DOCUMENTATION TO YOU ONLY ON AN "AS IS" BASIS WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. PAYPAL MAKES NO WARRANTY THAT THE SOFTWARE OR DOCUMENTATION WILL BE ERROR-FREE. Each user of the Software or Documentation is solely responsible for determining the appropriateness of using and distributing the Software and Documentation and assumes all risks associated with its exercise of rights under this Agreement, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs, or equipment, and unavailability or interruption of operations. Use of the Software and Documentation is made with the understanding that PayPal will not provide you with any technical or customer support or maintenance. Some states or jurisdictions do not allow the exclusion of implied warranties or limitations on how long an implied warranty may last, so the above limitations may not apply to you. To the extent permissible, any implied warranties are limited to ninety (90) days.
3. LIMITATION OF LIABILITY
PAYPAL AND ITS SUPPLIERS SHALL NOT BE LIABLE FOR LOSS OR DAMAGE ARISING OUT OF THIS AGREEMENT OR FROM THE USE OF THE SOFTWARE OR DOCUMENTATION. IN NO EVENT WILL PAYPAL OR ITS SUPPLIERS BE LIABLE TO YOU OR ANY THIRD PARTY FOR ANY DIRECT, INDIRECT, CONSEQUENTIAL, INCIDENTAL, OR SPECIAL DAMAGES INCLUDING LOST PROFITS, LOST SAVINGS, COSTS, FEES, OR EXPENSES OF ANY KIND ARISING OUT OF ANY PROVISION OF THIS AGREEMENT OR THE USE OR THE INABILITY TO USE THE SOFTWARE OR DOCUMENTATION, HOWEVER CAUSED AND UNDER ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. PAYPAL'S AGGREGATE LIABILITY AND THAT OF ITS SUPPLIERS UNDER OR IN CONNECTION WITH THIS AGREEMENT SHALL BE LIMITED TO THE AMOUNT PAID BY YOU FOR THE SOFTWARE AND DOCUMENTATION.
4. TRADEMARK USAGE
PayPal is a trademark PayPal, Inc. in the United States and other countries. Such trademarks may not be used to endorse or promote any product unless expressly permitted under separate agreement with PayPal.
5. TERM
Your rights under this Agreement shall terminate if you fail to comply with any of the material terms or conditions of this Agreement and do not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all your rights under this Agreement terminate, you agree to cease use and distribution of the Software and Documentation as soon as reasonably practicable.
6. GOVERNING LAW AND JURISDICTION. This Agreement is governed by the statutes and laws of the State of California, without regard to the conflicts of law principles thereof. If any part of this Agreement is found void and unenforceable, it will not affect the validity of the balance of the Agreement, which shall remain valid and enforceable according to its terms. Any dispute arising out of or related to this Agreement shall be brought in the courts of Santa Clara County, California, USA.
+48
View File
@@ -0,0 +1,48 @@
# REST API SDK for PHP
![Home Image](https://raw.githubusercontent.com/wiki/paypal/PayPal-PHP-SDK/images/homepage.jpg)
[![Build Status](https://travis-ci.org/paypal/PayPal-PHP-SDK.png?branch=master)](https://travis-ci.org/paypal/PayPal-PHP-SDK)
[![Coverage Status](https://coveralls.io/repos/paypal/PayPal-PHP-SDK/badge.svg?branch=master)](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.
> **Before starting to use the sdk, please be aware of the [existing issues and currently unavailable or upcoming features](https://github.com/paypal/rest-api-sdk-python/wiki/Existing-Issues-and-Unavailable%5CUpcoming-features) for the REST APIs. (which the sdks are based on)**
## Please Note
> **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**
> **If you have the SDK v1.6.2 or higher installed, you can easily test this by running the [TLSCheck sample](sample/tls/TlsCheck.php).**
## 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 ](http://paypal.github.io/PayPal-PHP-SDK/)
* [ Wiki ](https://github.com/paypal/PayPal-PHP-SDK/wiki)
* [ Samples ](http://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
- 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](http://paypal.github.io/PayPal-PHP-SDK/), that helps you find all helpful resources building applications using PayPal-PHP-SDK.
## Prerequisites
- PHP 5.3 or above
- [curl](http://php.net/manual/en/book.curl.php), [json](http://php.net/manual/en/book.json.php) & [openssl](http://php.net/manual/en/book.openssl.php) extensions must be enabled
## 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/webapps/developer/docs/api/)
* [Reporting Issues / Feature Requests] (https://github.com/paypal/PayPal-PHP-SDK/issues)
* [Pizza App Using Paypal REST API] (https://github.com/paypal/rest-api-sample-app-php)
+27
View File
@@ -0,0 +1,27 @@
{
"name": "paypal/rest-api-sdk-php",
"description": "PayPal's PHP SDK for REST APIs",
"keywords": ["paypal", "payments", "rest", "sdk"],
"type": "library",
"license": "Apache2",
"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": "*"
},
"require-dev": {
"phpunit/phpunit": "3.7.*"
},
"autoload": {
"psr-0": {
"PayPal": "lib/"
}
}
}
+122
View File
@@ -0,0 +1,122 @@
/* Sticky footer styles
-------------------------------------------------- */
html {
position: relative;
min-height: 100%;
}
body {
/* Margin bottom by footer height */
margin-bottom: 60px;
}
.footer {
position: absolute;
bottom: 0;
width: 100%;
/* Set the fixed height of the footer here */
height: 60px;
background-color: #f5f5f5;
}
/* Footer
--------------------------------------------------- */
.footer-links, .footer-links li {
display: inline-block;
font-size: 110%;
padding-left: 0;
padding-right: 0;
}
.footer-links li {
padding-top: 5px;
padding-left: 5px;
}
.footer-links a {
color: #428bca;
}
/* Custom CSS
--------------------------------------------------- */
.body-content {
margin: 0;
padding: 0;
}
body {
font-family: Menlo,Monaco,Consolas,"Courier New",monospace;
background: #fff url("https://www.paypalobjects.com/webstatic/developer/banners/Braintree_desktop_BG_2X.jpg") repeat-y top right;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
.content {
margin-top: 30px;
}
.content .lead {
color: #666;
}
.content .col-md-4 .well {
min-height: 175px;
background-color: #FDFDFD;
border: 1px solid;
}
.content .col-md-4 .sprite {
width: 60px;
height: 70px;
}
.content .col-md-4 .sprite {
float: left;
margin: 0 5px 0 0;
}
.content .col-md-4 .box {
float: left;
width: 75%;
}
.content .col-md-4 .box h3 {
color: #428bca;
font-size: 24px;
margin: 5px;
}
.content a:hover .col-md-4 .box h3{
color: #23527c;
}
.content a:hover .col-md-4 .well{
background-color: #f5f5f5;
}
.content .col-md-4 .box hr {
margin: 0;
}
.content a:hover {
text-decoration: none
}
.content a:hover .mobile {
background-position: -90px -124px
}
.content a:hover .api {
background-position: -90px -234px
}
.content a:hover .sandbox {
background-position: -90px -344px
}
.content .col-md-4 .box p {
margin: 5px;
color: #666;
display: block;
}
+132
View File
@@ -0,0 +1,132 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="https://www.paypalobjects.com/webstatic/icon/favicon.ico">
<title>PayPal PHP SDK - Welcome</title>
<!-- Bootstrap core CSS -->
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
<!-- Custom styles for this template -->
<link href="cover.css" rel="stylesheet">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container-fluid body-content">
<div class="row-fluid header">
<img src="https://raw.githubusercontent.com/wiki/paypal/PayPal-PHP-SDK/images/homepage.jpg"
class="img-responsive">
</div>
<div class="container content">
<div class="row-fluid">
<h2>// PayPal PHP SDK <a href="https://github.com/paypal/PayPal-PHP-SDK" title="Github Repository"><i class="fa fa-github"></i></a></h2><hr />
<p class="lead">
PayPal PHP SDK is our official Open Source PHP SDK for supporting PayPal Rest APIs. Checkout all the supporting documents, samples, codebase from the following links
</p>
</div><br /><br />
<div class="row clearfix">
<a href="https://github.com/paypal/PayPal-PHP-SDK/wiki">
<div class="col-md-4">
<div class="well clearfix">
<div class="sprite"><i class="fa fa-book fa-4x"></i></div>
<div class="box"><h3>PHP SDK Wiki</h3>
<hr/>
<p> Find everything from Installing, running Samples, Configurations in PHP SDK Wiki </p>
</div>
</div>
</div>
</a>
<a href="http://paypal.github.io/PayPal-PHP-SDK/docs/">
<div class="col-md-4">
<div class="well clearfix">
<div class="sprite"><i class="fa fa-code fa-4x"></i></div>
<div class="box"><h3>PHP Source Docs</h3>
<hr/>
<p> Check out PHP Source Documentation, to see the internals of PHP SDK. </p></div>
</div>
</div>
</a>
<a href="http://paypal.github.io/PayPal-PHP-SDK/sample/">
<div class="col-md-4">
<div class="well clearfix">
<div class="sprite"><i class="fa fa-terminal fa-4x"></i></div>
<div class="box"><h3>PHP Sample Code</h3>
<hr/>
<p> Check out the sample code for using SDKs to call all PayPal APIs. </p></div>
</div>
</div>
</a>
</div>
<div class="row clearfix">
<a href="https://developer.paypal.com/webapps/developer/docs/api/">
<div class="col-md-4">
<div class="well clearfix">
<div class="sprite"><i class="fa fa-paypal fa-4x"></i></div>
<div class="box"><h3>PayPal API Reference</h3>
<hr/>
<p> Checkout the Official PayPal REST API Reference, explaining all API Models</p></div>
</div>
</div>
</a>
<a href="https://github.com/paypal/PayPal-PHP-SDK/releases">
<div class="col-md-4">
<div class="well clearfix">
<div class="sprite"><i class="fa fa-tags fa-4x"></i></div>
<div class="box"><h3>PHP SDK Releases</h3>
<hr/>
<p>Download the latest PHP SDK Release</p></div>
</div>
</div>
</a>
<a href="https://github.com/paypal/rest-api-sample-app-php">
<div class="col-md-4">
<div class="well clearfix">
<div class="sprite"><i class="fa fa-shopping-cart fa-4x"></i></div>
<div class="box"><h3>Sample Application</h3>
<hr/>
<p>Explore a Pizza Store developed using PayPal PHP SDK</p></div>
</div>
</div>
</a>
</div>
</div>
</div>
<footer class="footer">
<div class="container">
<div class="footer-div">
<ul class="footer-links">
<li>
<a href="https://github.com/paypal/PayPal-PHP-SDK" target="_blank"><i
class="fa fa-github"></i>
Github</a></li>
<li>
<a href="https://developer.paypal.com/webapps/developer/docs/api/" target="_blank"><i
class="fa fa-book"></i> PayPal API Reference</a>
</li>
<li>
<a href="https://github.com/paypal/PayPal-PHP-SDK/issues" target="_blank"><i
class="fa fa-exclamation-triangle"></i> Report Issues </a>
</li>
</ul>
</div>
</div>
</footer>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>
</body>
</html>
+30
View File
@@ -0,0 +1,30 @@
#!/bin/sh
# Get ApiGen.phar
wget http://www.apigen.org/apigen.phar
# Generate SDK Docs
php apigen.phar generate --template-theme="bootstrap" -s lib -d ../gh-pages/docs
# Copy Home Page from Master Branch to Gh-Pages folder
cp -r docs/* ../gh-pages/
# Copy samples
cp -r sample ../gh-pages/sample
# As PHP is not allowed in Github
cp sample/index.php ../gh-pages/sample/index.html
cd ../gh-pages
# Set identity
git config --global user.email "travis@travis-ci.org"
git config --global user.name "Travis"
# Add branch
git init
git remote add origin https://${GH_TOKEN}@github.com/paypal/PayPal-PHP-SDK.git > /dev/null
git checkout -B gh-pages
# Push generated files
git add .
git commit -m "Docs updated by Travis"
git push origin gh-pages -fq > /dev/null
@@ -0,0 +1,39 @@
<?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
*/
class Address extends BaseAddress
{
/**
* Phone number in E.123 format.
*
* @param string $phone
*
* @return $this
*/
public function setPhone($phone)
{
$this->phone = $phone;
return $this;
}
/**
* Phone number in E.123 format.
*
* @return string
*/
public function getPhone()
{
return $this->phone;
}
}
@@ -0,0 +1,647 @@
<?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;
}
}
@@ -0,0 +1,209 @@
<?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;
}
}
@@ -0,0 +1,65 @@
<?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;
}
}
@@ -0,0 +1,257 @@
<?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;
}
}
@@ -0,0 +1,71 @@
<?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))
);
}
}
@@ -0,0 +1,89 @@
<?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
*
* @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;
}
}
@@ -0,0 +1,93 @@
<?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;
}
}
@@ -0,0 +1,459 @@
<?php
namespace PayPal\Api;
use PayPal\Common\PayPalResourceModel;
use PayPal\Rest\ApiContext;
use PayPal\Validation\ArgumentValidator;
/**
* 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 \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;
}
/**
* Retrieve details about a previously created authorization by passing the authorization_id in the request URI.
*
* @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;
}
/**
* Capture and process a previously created authorization by passing the authorization_id in the request URI. To use this request, the original payment call must have the intent set to 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;
}
/**
* Void (cancel) a previously authorized payment by passing the authorization_id in the request URI. Note that a fully captured authorization cannot be voided.
*
* @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;
}
/**
* Reauthorize a PayPal account payment by passing the authorization_id in the request URI. You should reauthorize a payment after the initial 3-day honor period to ensure that funds are still available. Request supports only amount field
*
* @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;
}
}
@@ -0,0 +1,630 @@
<?php
namespace PayPal\Api;
use PayPal\Common\PayPalModel;
/**
* Class BankAccount
*
* A resource representing a bank account that can be used to fund a payment.
*
* @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 merchnt.
*
* @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 merchnt.
*
* @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))
);
}
}
@@ -0,0 +1,119 @@
<?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;
}
}
@@ -0,0 +1,89 @@
<?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;
}
}
@@ -0,0 +1,211 @@
<?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;
}
}
@@ -0,0 +1,41 @@
<?php
namespace PayPal\Api;
use PayPal\Common\PayPalModel;
/**
* Class Billing
*
* Billing instrument used to charge the payer.
*
* @package PayPal\Api
*
* @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;
}
}
@@ -0,0 +1,17 @@
<?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
{
}
@@ -0,0 +1,235 @@
<?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
{
/**
* Email address of the invoice recipient. 260 characters max.
*
* @param string $email
*
* @return $this
*/
public function setEmail($email)
{
$this->email = $email;
return $this;
}
/**
* Email address of the invoice recipient. 260 characters max.
*
* @return string
*/
public function getEmail()
{
return $this->email;
}
/**
* First name of the invoice recipient. 30 characters max.
*
* @param string $first_name
*
* @return $this
*/
public function setFirstName($first_name)
{
$this->first_name = $first_name;
return $this;
}
/**
* First name of the invoice recipient. 30 characters max.
*
* @return string
*/
public function getFirstName()
{
return $this->first_name;
}
/**
* Last name of the invoice recipient. 30 characters max.
*
* @param string $last_name
*
* @return $this
*/
public function setLastName($last_name)
{
$this->last_name = $last_name;
return $this;
}
/**
* Last name of the invoice recipient. 30 characters max.
*
* @return string
*/
public function getLastName()
{
return $this->last_name;
}
/**
* Company business name of the invoice recipient. 100 characters max.
*
* @param string $business_name
*
* @return $this
*/
public function setBusinessName($business_name)
{
$this->business_name = $business_name;
return $this;
}
/**
* Company business name of the invoice recipient. 100 characters max.
*
* @return string
*/
public function getBusinessName()
{
return $this->business_name;
}
/**
* Address of the invoice recipient.
*
* @param \PayPal\Api\InvoiceAddress $address
*
* @return $this
*/
public function setAddress($address)
{
$this->address = $address;
return $this;
}
/**
* Address of the invoice recipient.
*
* @return \PayPal\Api\InvoiceAddress
*/
public function getAddress()
{
return $this->address;
}
/**
* Language of the email sent to the payer. Will only be used if payer doesn't 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;
}
/**
* Language of the email sent to the payer. Will only be used if payer doesn't have a PayPal account.
*
* @return string
*/
public function getLanguage()
{
return $this->language;
}
/**
* Option to display additional information such as business hours. 40 characters max.
*
* @param string $additional_info
*
* @return $this
*/
public function setAdditionalInfo($additional_info)
{
$this->additional_info = $additional_info;
return $this;
}
/**
* Option to display additional information such as business hours. 40 characters max.
*
* @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;
}
}
@@ -0,0 +1,113 @@
<?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
*/
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;
}
/**
* A flag indicating whether a copy of the email has to be sent 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;
}
/**
* A flag indicating whether a copy of the email has to be sent to the merchant.
*
* @return bool
*/
public function getSendToMerchant()
{
return $this->send_to_merchant;
}
/**
* A flag indicating whether a copy of the email has to be sent 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;
}
/**
* A flag indicating whether a copy of the email has to be sent to the payer.
*
* @return bool
*/
public function getSendToPayer()
{
return $this->send_to_payer;
}
}
@@ -0,0 +1,264 @@
<?php
namespace PayPal\Api;
use PayPal\Common\PayPalResourceModel;
use PayPal\Rest\ApiContext;
use PayPal\Validation\ArgumentValidator;
/**
* 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 parent_payment
* @property \PayPal\Api\Currency transaction_fee
* @property string create_time
* @property string update_time
* @property \PayPal\Api\Links[] links
*/
class Capture extends PayPalResourceModel
{
/**
* ID of the capture transaction.
*
* @param string $id
*
* @return $this
*/
public function setId($id)
{
$this->id = $id;
return $this;
}
/**
* ID of the capture transaction.
*
* @return string
*/
public function getId()
{
return $this->id;
}
/**
* Amount being captured. 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;
}
/**
* Amount being captured. 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;
}
/**
* If set to `true`, all remaining funds held by the authorization will be released in the funding instrument.
*
* @param bool $is_final_capture
*
* @return $this
*/
public function setIsFinalCapture($is_final_capture)
{
$this->is_final_capture = $is_final_capture;
return $this;
}
/**
* If set to `true`, all remaining funds held by the authorization will be released in the funding instrument.
*
* @return bool
*/
public function getIsFinalCapture()
{
return $this->is_final_capture;
}
/**
* 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;
}
/**
* State of the capture.
*
* @return string
*/
public function getState()
{
return $this->state;
}
/**
* 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;
}
/**
* 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;
}
/**
* 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;
}
/**
* 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;
}
/**
* 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;
}
/**
* Retrieve details about a captured payment by passing the capture_id in the request URI.
*
* @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.
*
* @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;
}
}
@@ -0,0 +1,138 @@
<?php
namespace PayPal\Api;
use PayPal\Common\PayPalModel;
/**
* Class CarrierAccount
*
* Payment Instrument that facilitates 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
{
/**
* ID that identifies the payers carrier account. Can be used in subsequent REST API calls, e.g. for making payments.
*
* @param string $id
*
* @return $this
*/
public function setId($id)
{
$this->id = $id;
return $this;
}
/**
* ID that identifies the payers carrier account. Can be used in subsequent REST API calls, e.g. for making payments.
*
* @return string
*/
public function getId()
{
return $this->id;
}
/**
* The payers phone number in E.164 format.
*
* @param string $phone_number
*
* @return $this
*/
public function setPhoneNumber($phone_number)
{
$this->phone_number = $phone_number;
return $this;
}
/**
* The payers phone number in E.164 format.
*
* @return string
*/
public function getPhoneNumber()
{
return $this->phone_number;
}
/**
* User identifier 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;
}
/**
* User identifier as created by the merchant.
*
* @return string
*/
public function getExternalCustomerId()
{
return $this->external_customer_id;
}
/**
* The method of obtaining the phone number (USER_PROVIDED or READ_FROM_DEVICE).
* 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 of obtaining the phone number (USER_PROVIDED or READ_FROM_DEVICE).
*
* @return string
*/
public function getPhoneSource()
{
return $this->phone_source;
}
/**
* The country where the phone number is registered. Specified in 2-character IS0-3166-1 format.
*
* @param \PayPal\Api\CountryCode $country_code
*
* @return $this
*/
public function setCountryCode($country_code)
{
$this->country_code = $country_code;
return $this;
}
/**
* The country where the phone number is registered. Specified in 2-character IS0-3166-1 format.
*
* @return \PayPal\Api\CountryCode
*/
public function getCountryCode()
{
return $this->country_code;
}
}
@@ -0,0 +1,65 @@
<?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;
}
}
@@ -0,0 +1,391 @@
<?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 string description
* @property string note_to_payee
* @property string custom
* @property string invoice_number
* @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.
*
* @deprecated Not publicly available
* @param \PayPal\Api\Payee $payee
*
* @return $this
*/
public function setPayee($payee)
{
$this->payee = $payee;
return $this;
}
/**
* Recipient of the funds in this transaction.
*
* @deprecated Not publicly available
* @return \PayPal\Api\Payee
*/
public function getPayee()
{
return $this->payee;
}
/**
* Description of transaction.
*
* @param string $description
*
* @return $this
*/
public function setDescription($description)
{
$this->description = $description;
return $this;
}
/**
* Description of transaction.
*
* @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. Only supported when the `payment_method` is set to `paypal`.
*
* @param string $custom
*
* @return $this
*/
public function setCustom($custom)
{
$this->custom = $custom;
return $this;
}
/**
* Free-form field for the use of clients. Only supported when the `payment_method` is set to `paypal`.
*
* @return string
*/
public function getCustom()
{
return $this->custom;
}
/**
* Invoice number used to track the payment. Only supported when the `payment_method` is set to `paypal`.
*
* @param string $invoice_number
*
* @return $this
*/
public function setInvoiceNumber($invoice_number)
{
$this->invoice_number = $invoice_number;
return $this;
}
/**
* Invoice number used to track the payment. Only supported when the `payment_method` is set to `paypal`.
*
* @return string
*/
public function getInvoiceNumber()
{
return $this->invoice_number;
}
/**
* 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;
}
/**
* Items and related shipping address within a transaction.
*
* @param \PayPal\Api\ItemList $item_list
*
* @return $this
*/
public function setItemList($item_list)
{
$this->item_list = $item_list;
return $this;
}
/**
* Items and related shipping address within a transaction.
*
* @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))
);
}
}
@@ -0,0 +1,89 @@
<?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;
}
}
+69
View File
@@ -0,0 +1,69 @@
<?php
namespace PayPal\Api;
use PayPal\Common\PayPalModel;
use PayPal\Converter\FormatConverter;
use PayPal\Validation\NumericValidator;
/**
* Class Cost
*
* Cost as a percent. For example, 10% should be entered as 10. Alternatively, cost as an amount. For example, an amount of 5 should be entered as 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;
}
/**
* Cost in amount. Range of 0 to 999999.99.
*
* @param \PayPal\Api\Currency $amount
*
* @return $this
*/
public function setAmount($amount)
{
$this->amount = $amount;
return $this;
}
/**
* Cost in amount. Range of 0 to 999999.99.
*
* @return \PayPal\Api\Currency
*/
public function getAmount()
{
return $this->amount;
}
}
@@ -0,0 +1,41 @@
<?php
namespace PayPal\Api;
use PayPal\Common\PayPalModel;
/**
* Class CountryCode
*
* Representation of a country code.
*
* @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;
}
}
@@ -0,0 +1,40 @@
<?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;
}
}
@@ -0,0 +1,66 @@
<?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;
}
}
@@ -0,0 +1,559 @@
<?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 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,
);
$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;
}
}
@@ -0,0 +1,91 @@
<?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;
}
}
@@ -0,0 +1,120 @@
<?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;
}
}
@@ -0,0 +1,161 @@
<?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;
}
}
@@ -0,0 +1,161 @@
<?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;
}
}
@@ -0,0 +1,69 @@
<?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;
}
}
@@ -0,0 +1,268 @@
<?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))
);
}
}
@@ -0,0 +1,65 @@
<?php
namespace PayPal\Api;
use PayPal\Common\PayPalModel;
/**
* Class CustomAmount
*
* Custom amount applied on an invoice. If a label is included then the amount cannot be empty.
*
* @package PayPal\Api
*
* @property string label
* @property \PayPal\Api\Currency amount
*/
class CustomAmount extends PayPalModel
{
/**
* Custom amount label. 25 characters max.
*
* @param string $label
*
* @return $this
*/
public function setLabel($label)
{
$this->label = $label;
return $this;
}
/**
* Custom amount label. 25 characters max.
*
* @return string
*/
public function getLabel()
{
return $this->label;
}
/**
* Custom amount value. Range of 0 to 999999.99.
*
* @param \PayPal\Api\Currency $amount
*
* @return $this
*/
public function setAmount($amount)
{
$this->amount = $amount;
return $this;
}
/**
* Custom amount value. Range of 0 to 999999.99.
*
* @return \PayPal\Api\Currency
*/
public function getAmount()
{
return $this->amount;
}
}
@@ -0,0 +1,227 @@
<?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;
}
}
+321
View File
@@ -0,0 +1,321 @@
<?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;
}
/**
* 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;
}
/**
* 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;
}
/**
* 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;
}
/**
* 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;
}
/**
* 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;
}
/**
* 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))
);
}
}
@@ -0,0 +1,115 @@
<?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;
}
}
@@ -0,0 +1,40 @@
<?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;
}
}
@@ -0,0 +1,137 @@
<?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
*/
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;
}
}
@@ -0,0 +1,69 @@
<?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
*/
class FlowConfig extends PayPalModel
{
/**
* Type of PayPal page to be displayed when a user lands on the PayPal site for checkout. Allowed values: `Billing` or `Login`. When set to `Billing`, the Non-PayPal account landing page is used. When set to `Login`, the PayPal account login landing page is used.
*
*
* @param string $landing_page_type
*
* @return $this
*/
public function setLandingPageType($landing_page_type)
{
$this->landing_page_type = $landing_page_type;
return $this;
}
/**
* Type of PayPal page to be displayed when a user lands on the PayPal site for checkout. Allowed values: `Billing` or `Login`. When set to `Billing`, the Non-PayPal account landing page is used. When set to `Login`, the PayPal account login landing page is used.
*
* @return string
*/
public function getLandingPageType()
{
return $this->landing_page_type;
}
/**
* The URL on the merchant site for transferring to after a bank transfer payment.
*
*
* @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 URL on the merchant site for transferring to after a bank transfer payment.
*
* @return string
*/
public function getBankTxnPendingUrl()
{
return $this->bank_txn_pending_url;
}
}
@@ -0,0 +1,115 @@
<?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;
}
}
@@ -0,0 +1,114 @@
<?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: ["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;
}
}
@@ -0,0 +1,339 @@
<?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.
*
* @deprecated Not publicly available
* @param \PayPal\Api\PaymentCard $payment_card
*
* @return $this
*/
public function setPaymentCard($payment_card)
{
$this->payment_card = $payment_card;
return $this;
}
/**
* Payment Card information.
*
* @deprecated Not publicly available
* @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;
}
}
@@ -0,0 +1,221 @@
<?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))
);
}
}
@@ -0,0 +1,289 @@
<?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\FundingInstrument extends
* @property \PayPal\Api\Links[] links
*/
class FundingSource extends PayPalModel
{
/**
* specifies funding mode of the instrument
* Valid Values: ["INSTANT_TRANSFER", "MANUAL_BANK_TRANSFER", "DELAYED_TRANSFER", "ECHECK"]
*
* @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"]
*
* @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
*
* @param \PayPal\Api\Currency $amount
*
* @return $this
*/
public function setNegativeBalanceAmount($amount)
{
$this->amount = $amount;
return $this;
}
/**
* Additional amount to be pulled from the instrument to recover a negative balance on the buyer
*
* @return \PayPal\Api\Currency
*/
public function getNegativeBalanceAmount()
{
return $this->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
*
* @return $this
*/
public function setExtends($extends)
{
$this->extends = $extends;
return $this;
}
/**
* Gets Extends
*
* @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))
);
}
}
@@ -0,0 +1,75 @@
<?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
* @return $this
*/
public function create($apiContext = null, $clientMetadataId = null)
{
if ($apiContext == null) {
$apiContext = new ApiContext(self::$credential);
}
$headers = array();
if ($clientMetadataId != null) {
$headers = array(
'PAYPAL-CLIENT-METADATA-ID' => $clientMetadataId
);
}
$payLoad = $this->toJSON();
$call = new PayPalRestCall($apiContext);
$json = $call->execute(
array('PayPal\Handler\RestHandler'),
"/v1/payments/payment",
"POST",
$payLoad,
$headers
);
$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);
}
/**
* 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);
}
}
@@ -0,0 +1,191 @@
<?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;
}
}
+56
View File
@@ -0,0 +1,56 @@
<?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;
}
}
@@ -0,0 +1,236 @@
<?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;
}
}
@@ -0,0 +1,92 @@
<?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
{
/**
* Enables the buyer to 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;
}
/**
* Enables the buyer to enter a note to the merchant on the PayPal page during checkout.
*
* @return bool
*/
public function getAllowNote()
{
return $this->allow_note;
}
/**
* Determines whether or not PayPal displays shipping address fields on the experience pages. Allowed values: `0`, `1`, or `2`. When set to `0`, PayPal displays the shipping address on the PayPal pages. When set to `1`, PayPal does not display shipping address fields whatsoever. When set to `2`, if you do not pass the shipping address, PayPal obtains it from the buyer's account profile. For digital goods, this field is required, and you must set it to `1`.
*
*
* @param int $no_shipping
*
* @return $this
*/
public function setNoShipping($no_shipping)
{
$this->no_shipping = $no_shipping;
return $this;
}
/**
* Determines whether or not PayPal displays shipping address fields on the experience pages. Allowed values: `0`, `1`, or `2`. When set to `0`, PayPal displays the shipping address on the PayPal pages. When set to `1`, PayPal does not display shipping address fields whatsoever. When set to `2`, if you do not pass the shipping address, PayPal obtains it from the buyer's account profile. For digital goods, this field is required, and you must set it to `1`.
*
* @return int
*/
public function getNoShipping()
{
return $this->no_shipping;
}
/**
* Determines whether or not the PayPal pages should display the shipping address and not the shipping address on file with PayPal for this buyer. Displaying the PayPal street address on file does not allow the buyer to edit that address. Allowed values: `0` or `1`. When set to `0`, the PayPal pages should not display the shipping address. When set to `1`, the PayPal pages should display the shipping address.
*
*
* @param int $address_override
*
* @return $this
*/
public function setAddressOverride($address_override)
{
$this->address_override = $address_override;
return $this;
}
/**
* Determines whether or not the PayPal pages should display the shipping address and not the shipping address on file with PayPal for this buyer. Displaying the PayPal street address on file does not allow the buyer to edit that address. Allowed values: `0` or `1`. When set to `0`, the PayPal pages should not display the shipping address. When set to `1`, the PayPal pages should display the shipping address.
*
* @return int
*/
public function getAddressOverride()
{
return $this->address_override;
}
}
@@ -0,0 +1,144 @@
<?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))
);
}
}
@@ -0,0 +1,113 @@
<?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;
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,39 @@
<?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;
}
}
@@ -0,0 +1,189 @@
<?php
namespace PayPal\Api;
use PayPal\Common\PayPalModel;
use PayPal\Converter\FormatConverter;
use PayPal\Validation\NumericValidator;
/**
* 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
*/
class InvoiceItem extends PayPalModel
{
/**
* Name of the item. 60 characters max.
*
* @param string $name
*
* @return $this
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* Name of the item. 60 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 0 to 9999.999.
*
* @param string|double $quantity
*
* @return $this
*/
public function setQuantity($quantity)
{
NumericValidator::validate($quantity, "Percent");
$quantity = FormatConverter::formatToPrice($quantity);
$this->quantity = $quantity;
return $this;
}
/**
* Quantity of the item. Range of 0 to 9999.999.
*
* @return string
*/
public function getQuantity()
{
return $this->quantity;
}
/**
* Unit price of the item. Range of -999999.99 to 999999.99.
*
* @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 -999999.99 to 999999.99.
*
* @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;
}
/**
* Date on which the item or service was provided. Date format yyyy-MM-dd z, as defined in [ISO8601](http://tools.ietf.org/html/rfc3339#section-5.6).
*
* @param string $date
*
* @return $this
*/
public function setDate($date)
{
$this->date = $date;
return $this;
}
/**
* Date on which the item or service was provided. Date format yyyy-MM-dd z, as defined in [ISO8601](http://tools.ietf.org/html/rfc3339#section-5.6).
*
* @return string
*/
public function getDate()
{
return $this->date;
}
/**
* Item discount in percent or amount.
*
* @param \PayPal\Api\Cost $discount
*
* @return $this
*/
public function setDiscount($discount)
{
$this->discount = $discount;
return $this;
}
/**
* Item discount in percent or amount.
*
* @return \PayPal\Api\Cost
*/
public function getDiscount()
{
return $this->discount;
}
}
@@ -0,0 +1,95 @@
<?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))
);
}
}
+456
View File
@@ -0,0 +1,456 @@
<?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
* @property string category
*/
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"]
*
* @param string $category
*
* @return $this
*/
public function setCategory($category)
{
$this->category = $category;
return $this;
}
/**
* Category type of the item.
*
* @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))
);
}
}
@@ -0,0 +1,143 @@
<?php
namespace PayPal\Api;
use PayPal\Common\PayPalModel;
/**
* Class ItemList
*
* Items and related shipping address within a transaction.
*
* @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 = $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, if different than the payer address.
*
* @param \PayPal\Api\ShippingAddress $shipping_address
*
* @return $this
*/
public function setShippingAddress($shipping_address)
{
$this->shipping_address = $shipping_address;
return $this;
}
/**
* Shipping address, if different than the payer 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 payers 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 Payers 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 payers 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 Payers 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;
}
}
+161
View File
@@ -0,0 +1,161 @@
<?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;
}
}
@@ -0,0 +1,65 @@
<?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;
}
}
@@ -0,0 +1,257 @@
<?php
namespace PayPal\Api;
use PayPal\Common\PayPalModel;
/**
* Class MerchantInfo
*
* Business information of the merchant that will appear 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
*/
class MerchantInfo extends PayPalModel
{
/**
* Email address of the merchant. 260 characters max.
*
* @param string $email
*
* @return $this
*/
public function setEmail($email)
{
$this->email = $email;
return $this;
}
/**
* Email address of the merchant. 260 characters max.
*
* @return string
*/
public function getEmail()
{
return $this->email;
}
/**
* First name of the merchant. 30 characters max.
*
* @param string $first_name
*
* @return $this
*/
public function setFirstName($first_name)
{
$this->first_name = $first_name;
return $this;
}
/**
* First name of the merchant. 30 characters max.
*
* @return string
*/
public function getFirstName()
{
return $this->first_name;
}
/**
* Last name of the merchant. 30 characters max.
*
* @param string $last_name
*
* @return $this
*/
public function setLastName($last_name)
{
$this->last_name = $last_name;
return $this;
}
/**
* Last name of the merchant. 30 characters max.
*
* @return string
*/
public function getLastName()
{
return $this->last_name;
}
/**
* Address of the merchant.
*
* @param \PayPal\Api\InvoiceAddress $address
*
* @return $this
*/
public function setAddress($address)
{
$this->address = $address;
return $this;
}
/**
* Address of the merchant.
*
* @return \PayPal\Api\InvoiceAddress
*/
public function getAddress()
{
return $this->address;
}
/**
* Company business name of the merchant. 100 characters max.
*
* @param string $business_name
*
* @return $this
*/
public function setBusinessName($business_name)
{
$this->business_name = $business_name;
return $this;
}
/**
* Company business name of the merchant. 100 characters max.
*
* @return string
*/
public function getBusinessName()
{
return $this->business_name;
}
/**
* Phone number of the merchant.
*
* @param \PayPal\Api\Phone $phone
*
* @return $this
*/
public function setPhone($phone)
{
$this->phone = $phone;
return $this;
}
/**
* Phone number of the merchant.
*
* @return \PayPal\Api\Phone
*/
public function getPhone()
{
return $this->phone;
}
/**
* Fax number of the merchant.
*
* @param \PayPal\Api\Phone $fax
*
* @return $this
*/
public function setFax($fax)
{
$this->fax = $fax;
return $this;
}
/**
* Fax number of the merchant.
*
* @return \PayPal\Api\Phone
*/
public function getFax()
{
return $this->fax;
}
/**
* Website of the merchant. 2048 characters max.
*
* @param string $website
*
* @return $this
*/
public function setWebsite($website)
{
$this->website = $website;
return $this;
}
/**
* Website of the merchant. 2048 characters max.
*
* @return string
*/
public function getWebsite()
{
return $this->website;
}
/**
* Tax ID of the merchant. 100 characters max.
*
* @param string $tax_id
*
* @return $this
*/
public function setTaxId($tax_id)
{
$this->tax_id = $tax_id;
return $this;
}
/**
* Tax ID of the merchant. 100 characters max.
*
* @return string
*/
public function getTaxId()
{
return $this->tax_id;
}
/**
* Option to display additional information such as business hours. 40 characters max.
*
* @param string $additional_info
*
* @return $this
*/
public function setAdditionalInfo($additional_info)
{
$this->additional_info = $additional_info;
return $this;
}
/**
* Option to display additional information such as business hours. 40 characters max.
*
* @return string
*/
public function getAdditionalInfo()
{
return $this->additional_info;
}
}
@@ -0,0 +1,261 @@
<?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;
}
}
@@ -0,0 +1,259 @@
<?php
namespace PayPal\Api;
use PayPal\Common\PayPalModel;
use PayPal\Validation\UrlValidator;
/**
* Class Metadata
*
* Audit information of 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
{
/**
* Date when the resource was created.
*
* @param string $created_date
*
* @return $this
*/
public function setCreatedDate($created_date)
{
$this->created_date = $created_date;
return $this;
}
/**
* Date when the resource was created.
*
* @return string
*/
public function getCreatedDate()
{
return $this->created_date;
}
/**
* 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;
}
/**
* Email address of the account that created the resource.
*
* @return string
*/
public function getCreatedBy()
{
return $this->created_by;
}
/**
* Date when the resource was cancelled.
*
* @param string $cancelled_date
*
* @return $this
*/
public function setCancelledDate($cancelled_date)
{
$this->cancelled_date = $cancelled_date;
return $this;
}
/**
* Date when the resource was cancelled.
*
* @return string
*/
public function getCancelledDate()
{
return $this->cancelled_date;
}
/**
* Actor who cancelled the resource.
*
* @param string $cancelled_by
*
* @return $this
*/
public function setCancelledBy($cancelled_by)
{
$this->cancelled_by = $cancelled_by;
return $this;
}
/**
* Actor who cancelled the resource.
*
* @return string
*/
public function getCancelledBy()
{
return $this->cancelled_by;
}
/**
* Date 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;
}
/**
* Date when the resource was last edited.
*
* @return string
*/
public function getLastUpdatedDate()
{
return $this->last_updated_date;
}
/**
* 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;
}
/**
* Email address of the account that last edited the resource.
*
* @return string
*/
public function getLastUpdatedBy()
{
return $this->last_updated_by;
}
/**
* Date 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;
}
/**
* Date when the resource was first sent.
*
* @return string
*/
public function getFirstSentDate()
{
return $this->first_sent_date;
}
/**
* Date 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;
}
/**
* Date when the resource was last sent.
*
* @return string
*/
public function getLastSentDate()
{
return $this->last_sent_date;
}
/**
* 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;
}
/**
* 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;
}
}
@@ -0,0 +1,65 @@
<?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;
}
}
@@ -0,0 +1,89 @@
<?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
*/
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;
}
/**
* A flag indicating whether a copy of the email has to be sent 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;
}
/**
* A flag indicating whether a copy of the email has to be sent to the merchant.
*
* @return bool
*/
public function getSendToMerchant()
{
return $this->send_to_merchant;
}
}
@@ -0,0 +1,133 @@
<?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;
}
}
@@ -0,0 +1,85 @@
<?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;
}
}
@@ -0,0 +1,107 @@
<?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/webapps/developer/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/v1/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/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;
}
}
@@ -0,0 +1,253 @@
<?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
* @return OpenIdTokeninfo
*/
public function createFromRefreshToken($params, $apiContext = 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
);
$this->fromJson($json);
return $this;
}
}
@@ -0,0 +1,538 @@
<?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
* @return OpenIdUserinfo
*/
public static function getUserinfo($params, $apiContext = 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
);
$ret = new OpenIdUserinfo();
$ret->fromJson($json);
return $ret;
}
}
+438
View File
@@ -0,0 +1,438 @@
<?php
namespace PayPal\Api;
use PayPal\Common\PayPalResourceModel;
use PayPal\Rest\ApiContext;
use PayPal\Validation\ArgumentValidator;
/**
* Class Order
*
* An order transaction.
*
* @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 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.
*
* @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.
*
* @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
* 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", "refunded", "partially_refunded", "voided"]
*
* @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. 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. Only supported when the `payment_method` is set to `paypal`.
*
* @return string
*/
public function getReasonCode()
{
return $this->reason_code;
}
/**
* [DEPRECATED] Reason the transaction is in pending state. 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 the transaction is in pending state. 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;
}
/**
* Retrieve details about an order by passing the order_id in the request URI.
*
* @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;
}
/**
* Capture a payment. In addition, include the amount of the payment and indicate whether this is a final capture for the given authorization in the body of the request JSON.
*
* @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;
}
/**
* Void (cancel) an order by passing the order_id in the request URI. Note that an order cannot be voided if 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;
}
/**
* Authorize an order by passing the order_id in the request URI. In addition, include an amount object in the body of the request JSON.
*
* @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;
}
}
@@ -0,0 +1,65 @@
<?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;
}
}
+114
View File
@@ -0,0 +1,114 @@
<?php
namespace PayPal\Api;
use PayPal\Common\PayPalModel;
/**
* Class Patch
*
* A JSON patch object used for applying 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;
}
/**
* String containing a JSON Pointer value that references a location within the target document where the operation is performed.
*
* @param string $path
*
* @return $this
*/
public function setPath($path)
{
$this->path = $path;
return $this;
}
/**
* String containing a JSON Pointer value that references a location within the target document where the operation is performed.
*
* @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;
}
}
@@ -0,0 +1,86 @@
<?php
namespace PayPal\Api;
use PayPal\Common\PayPalModel;
/**
* Class PatchRequest
*
* Request object used for a JSON Patch.
*
* @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));
}
}
+165
View File
@@ -0,0 +1,165 @@
<?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 receiver 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 receiver 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 Payer. In case of PayPal Wallet payment, this information will be filled in by PayPal after the user approves the payment using their PayPal Wallet.
*
* @deprecated Not publicly available
* @param \PayPal\Api\Phone $phone
*
* @return $this
*/
public function setPhone($phone)
{
$this->phone = $phone;
return $this;
}
/**
* Information related to the Payer. In case of PayPal Wallet payment, this information will be filled in by PayPal after the user approves the payment using their PayPal Wallet.
*
* @deprecated Not publicly available
* @return \PayPal\Api\Phone
*/
public function getPhone()
{
return $this->phone;
}
}
+270
View File
@@ -0,0 +1,270 @@
<?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 funding_option_id
* @property \PayPal\Api\PayerInfo payer_info
*/
class Payer extends PayPalModel
{
/**
* Payment method being used - PayPal Wallet payment, Bank Direct Debit or Direct Credit card.
* Valid Values: ["credit_card", "bank", "paypal", "pay_upon_invoice", "carrier", "alternate_payment"]
*
* @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.
*
* @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.
*
* @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;
}
/**
* 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;
}
}
@@ -0,0 +1,428 @@
<?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 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
* @property \PayPal\Api\ShippingAddress shipping_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 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 Payer
*
* @deprecated Not publicly available
* @return string
*/
public function getAccountNumber()
{
return $this->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;
}
/**
* Payers 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;
}
/**
* Payers tax ID. Only supported when the `payment_method` is set to `paypal`.
*
* @return string
*/
public function getTaxId()
{
return $this->tax_id;
}
/**
* Payers 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;
}
/**
* Payers 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;
}
/**
* Shipping address of payer PayPal account.
*
* @param \PayPal\Api\ShippingAddress $shipping_address
*
* @return $this
*/
public function setShippingAddress($shipping_address)
{
$this->shipping_address = $shipping_address;
return $this;
}
/**
* Shipping address of payer PayPal account.
*
* @return \PayPal\Api\ShippingAddress
*/
public function getShippingAddress()
{
return $this->shipping_address;
}
}
@@ -0,0 +1,693 @@
<?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 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\PotentialPayerInfo potential_payer_info
* @property \PayPal\Api\Payee payee
* @property \PayPal\Api\Transaction[] transactions
* @property string[] billing_agreement_tokens
* @property \PayPal\Api\PaymentInstruction payment_instruction
* @property string state
* @property string experience_profile_id
* @property string note_to_payer
* @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
{
/**
* ID of the created payment, the 'transaction ID'
*
* @param string $id
*
* @return $this
*/
public function setId($id)
{
$this->id = $id;
return $this;
}
/**
* ID of the created payment, the 'transaction ID'
*
* @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.
*
* @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.
*
* @return \PayPal\Api\PotentialPayerInfo
*/
public function getPotentialPayerInfo()
{
return $this->potential_payer_info;
}
/**
* Receiver of funds for this payment. **Readonly for PayPal external REST payments.**
*
* @param \PayPal\Api\Payee $payee
*
* @return $this
*/
public function setPayee($payee)
{
$this->payee = $payee;
return $this;
}
/**
* Receiver of funds for this payment. **Readonly for PayPal external REST payments.**
*
* @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.
*
* @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.
*
* @return string[]
*/
public function getBillingAgreementTokens()
{
return $this->billing_agreement_tokens;
}
/**
* Append BillingAgreementTokens to the list.
*
* @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.
*
* @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.
*
* @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.
*
* @return \PayPal\Api\PaymentInstruction
*/
public function getPaymentInstruction()
{
return $this->payment_instruction;
}
/**
* Payment state.
* Valid Values: ["created", "approved", "failed", "partially_completed", "in_progress"]
*
* @param string $state
*
* @return $this
*/
public function setState($state)
{
$this->state = $state;
return $this;
}
/**
* Payment state.
*
* @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/webapps/developer/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/webapps/developer/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);
}
/**
* Create and process a payment by passing a payment object that includes the intent, payer, and transactions in the body of the request JSON. 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;
}
/**
* Look up a particular payment resource by passing the payment_id in the request URI.
*
* @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;
}
/**
* Use this call to partially update the payment resource for the given identifier. Allowed objects are amount, shipping_address, invoice_id and custom. Please note that it is not possible to 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;
}
/**
* Execute (complete) a PayPal payment that has been approved by the payer. Optionally update selective payment information when executing the 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 in any state (created, approved, failed, etc.). Payments returned are the payments made to the merchant issuing the request.
*
* @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;
}
}
@@ -0,0 +1,457 @@
<?php
namespace PayPal\Api;
use PayPal\Common\PayPalModel;
/**
* Class PaymentCard
*
* A resource representing a payment card that can be used to 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 valid_until
* @property string issue_number
* @property \PayPal\Api\Links[] links
*/
class PaymentCard extends PayPalModel
{
/**
* ID of the credit card being saved for later use.
*
* @param string $id
*
* @return $this
*/
public function setId($id)
{
$this->id = $id;
return $this;
}
/**
* ID of the credit card being saved for later use.
*
* @return string
*/
public function getId()
{
return $this->id;
}
/**
* Card number.
*
* @param string $number
*
* @return $this
*/
public function setNumber($number)
{
$this->number = $number;
return $this;
}
/**
* Card number.
*
* @return string
*/
public function getNumber()
{
return $this->number;
}
/**
* 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;
}
/**
* 2 digit card expiry month.
*
* @param string $expire_month
*
* @return $this
*/
public function setExpireMonth($expire_month)
{
$this->expire_month = $expire_month;
return $this;
}
/**
* 2 digit card expiry month.
*
* @return string
*/
public function getExpireMonth()
{
return $this->expire_month;
}
/**
* 4 digit card expiry year
*
* @param string $expire_year
*
* @return $this
*/
public function setExpireYear($expire_year)
{
$this->expire_year = $expire_year;
return $this;
}
/**
* 4 digit card expiry year
*
* @return string
*/
public function getExpireYear()
{
return $this->expire_year;
}
/**
* 2 digit card start month. Needed for UK Maestro Card.
*
* @param string $start_month
*
* @return $this
*/
public function setStartMonth($start_month)
{
$this->start_month = $start_month;
return $this;
}
/**
* 2 digit card start month. Needed for UK Maestro Card.
*
* @return string
*/
public function getStartMonth()
{
return $this->start_month;
}
/**
* 4 digit card start year. Needed for UK Maestro Card.
*
* @param string $start_year
*
* @return $this
*/
public function setStartYear($start_year)
{
$this->start_year = $start_year;
return $this;
}
/**
* 4 digit card start year. Needed for UK Maestro Card.
*
* @return string
*/
public function getStartYear()
{
return $this->start_year;
}
/**
* Card validation code. Only supported when making a Payment but not when saving a payment card for future use.
*
* @param string $cvv2
*
* @return $this
*/
public function setCvv2($cvv2)
{
$this->cvv2 = $cvv2;
return $this;
}
/**
* Card validation code. Only supported when making a Payment but not when saving a payment card for future use.
*
* @return string
*/
public function getCvv2()
{
return $this->cvv2;
}
/**
* Card holder's first name.
*
* @param string $first_name
*
* @return $this
*/
public function setFirstName($first_name)
{
$this->first_name = $first_name;
return $this;
}
/**
* Card holder's first name.
*
* @return string
*/
public function getFirstName()
{
return $this->first_name;
}
/**
* Card holder's last name.
*
* @param string $last_name
*
* @return $this
*/
public function setLastName($last_name)
{
$this->last_name = $last_name;
return $this;
}
/**
* Card holder's last name.
*
* @return string
*/
public function getLastName()
{
return $this->last_name;
}
/**
* 2 letter country code
*
* @param string $billing_country
*
* @return $this
*/
public function setBillingCountry($billing_country)
{
$this->billing_country = $billing_country;
return $this;
}
/**
* 2 letter country code
*
* @return string
*/
public function getBillingCountry()
{
return $this->billing_country;
}
/**
* 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 card 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 card 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;
}
/**
* State of the funding instrument.
* Valid Values: ["EXPIRED", "ACTIVE"]
*
* @param string $status
*
* @return $this
*/
public function setStatus($status)
{
$this->status = $status;
return $this;
}
/**
* State of the funding instrument.
*
* @return string
*/
public function getStatus()
{
return $this->status;
}
/**
* 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;
}
/**
* Date/Time until this resource can be used fund a payment.
*
* @return string
*/
public function getValidUntil()
{
return $this->valid_until;
}
/**
* 1-2 digit card issue number. Needed for UK Maestro Card.
*
* @param string $issue_number
*
* @return $this
*/
public function setIssueNumber($issue_number)
{
$this->issue_number = $issue_number;
return $this;
}
/**
* 1-2 digit card issue number. Needed for UK Maestro Card.
*
* @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))
);
}
}
@@ -0,0 +1,162 @@
<?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;
}
}
@@ -0,0 +1,239 @@
<?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))
);
}
}
@@ -0,0 +1,164 @@
<?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
*/
class PaymentDetail extends PayPalModel
{
/**
* PayPal payment detail indicating whether payment was made in an invoicing flow via PayPal or externally. In the case of the mark-as-paid API, payment type is EXTERNAL and this is what is now supported. The PAYPAL value is provided for backward compatibility.
* Valid Values: ["PAYPAL", "EXTERNAL"]
*
* @param string $type
*
* @return $this
*/
public function setType($type)
{
$this->type = $type;
return $this;
}
/**
* PayPal payment detail indicating whether payment was made in an invoicing flow via PayPal or externally. In the case of the mark-as-paid API, payment type is EXTERNAL and this is what is now supported. The PAYPAL value is provided for backward compatibility.
*
* @return string
*/
public function getType()
{
return $this->type;
}
/**
* PayPal payment transaction id. Mandatory field in case the type value is PAYPAL.
*
* @param string $transaction_id
*
* @return $this
*/
public function setTransactionId($transaction_id)
{
$this->transaction_id = $transaction_id;
return $this;
}
/**
* PayPal payment transaction id. Mandatory field in case the type value is PAYPAL.
*
* @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;
}
/**
* Date when the invoice was paid. Date format yyyy-MM-dd z, as defined in [ISO8601](http://tools.ietf.org/html/rfc3339#section-5.6).
*
* @param string $date
*
* @return $this
*/
public function setDate($date)
{
$this->date = $date;
return $this;
}
/**
* Date when the invoice was paid. Date format yyyy-MM-dd z, as defined in [ISO8601](http://tools.ietf.org/html/rfc3339#section-5.6).
*
* @return string
*/
public function getDate()
{
return $this->date;
}
/**
* Payment mode or method. This field is mandatory if the value of the type field is EXTERNAL.
* 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;
}
/**
* Payment mode or method. This field is mandatory if the value of the type field is EXTERNAL.
*
* @return string
*/
public function getMethod()
{
return $this->method;
}
/**
* Optional note associated with the payment.
*
* @param string $note
*
* @return $this
*/
public function setNote($note)
{
$this->note = $note;
return $this;
}
/**
* Optional note associated with the payment.
*
* @return string
*/
public function getNote()
{
return $this->note;
}
}
@@ -0,0 +1,119 @@
<?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 string carrier_account_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.
*
* @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.
*
* @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))
);
}
}
@@ -0,0 +1,119 @@
<?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.
*
* @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;
}
}
@@ -0,0 +1,190 @@
<?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;
}
}
@@ -0,0 +1,92 @@
<?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
{
/**
* Optional payment method type. If specified, the transaction will go through for only instant payment. Only for use with the paypal payment_method, not relevant for the credit_card payment_method.
* 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;
}
/**
* Optional payment method type. If specified, the transaction will go through for only instant payment. Only for use with the paypal payment_method, not relevant for the credit_card payment_method.
*
* @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;
}
}
@@ -0,0 +1,66 @@
<?php
namespace PayPal\Api;
use PayPal\Common\PayPalModel;
/**
* Class PaymentTerm
*
* Payment term of the invoice. If term_type is present, due_date must not be present and vice versa.
*
* @package PayPal\Api
*
* @property string term_type
* @property string due_date
*/
class PaymentTerm extends PayPalModel
{
/**
* Terms by which the invoice payment is due.
* Valid Values: ["DUE_ON_RECEIPT", "NET_10", "NET_15", "NET_30", "NET_45"]
*
* @param string $term_type
*
* @return $this
*/
public function setTermType($term_type)
{
$this->term_type = $term_type;
return $this;
}
/**
* Terms by which the invoice payment is due.
*
* @return string
*/
public function getTermType()
{
return $this->term_type;
}
/**
* Date on which invoice payment is due. It must be always a future date. Date format yyyy-MM-dd z, as defined in [ISO8601](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;
}
/**
* Date on which invoice payment is due. It must be always a future date. Date format yyyy-MM-dd z, as defined in [ISO8601](http://tools.ietf.org/html/rfc3339#section-5.6).
*
* @return string
*/
public function getDueDate()
{
return $this->due_date;
}
}
+166
View File
@@ -0,0 +1,166 @@
<?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;
}
}
@@ -0,0 +1,120 @@
<?php
namespace PayPal\Api;
use PayPal\Common\PayPalModel;
/**
* Class PayoutBatch
*
* The batch status as generated by PayPal.
*
* @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 that 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 that includes the generated batch status.
*
* @return \PayPal\Api\PayoutBatchHeader
*/
public function getBatchHeader()
{
return $this->batch_header;
}
/**
* Array of the items in a batch payout.
*
* @param \PayPal\Api\PayoutItemDetails[] $items
*
* @return $this
*/
public function setItems($items)
{
$this->items = $items;
return $this;
}
/**
* Array of the 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;
}
}
@@ -0,0 +1,263 @@
<?php
namespace PayPal\Api;
use PayPal\Common\PayPalModel;
/**
* Class PayoutBatchHeader
*
* This object enables you to get payout header information for an entire batch request. This object represents payout header data, and can be the response to a batch header request.
*
* @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
{
/**
* An ID for the batch payout. Generated by PayPal. 30 characters max.
*
* @param string $payout_batch_id
*
* @return $this
*/
public function setPayoutBatchId($payout_batch_id)
{
$this->payout_batch_id = $payout_batch_id;
return $this;
}
/**
* An ID for the batch payout. Generated by PayPal. 30 characters max.
*
* @return string
*/
public function getPayoutBatchId()
{
return $this->payout_batch_id;
}
/**
* Generated batch status.
*
* @param string $batch_status
*
* @return $this
*/
public function setBatchStatus($batch_status)
{
$this->batch_status = $batch_status;
return $this;
}
/**
* Generated batch status.
*
* @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 original batch header as provided by the payment sender.
*
* @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))
);
}
}

Some files were not shown because too many files have changed in this diff Show More