Removing Dependency from SDK Core Project

- Copied files required for Rest API SDK
- Removed PPApiContext and directly connected APIContext with PPConfigManager
- Removed duplicate data storage of configuration and credentials.
- Code Style Fixes
- Remove build.xml file as it is not required anymore
- Updated the samples
- Updated the documentations
This commit is contained in:
japatel
2014-10-06 11:16:47 -05:00
parent bb7654b0b8
commit 49b80f76af
150 changed files with 10975 additions and 6525 deletions

View File

@@ -128,5 +128,5 @@ There are two kinds of tests that we include in our sdk package. Unit tests, and
* [API Reference](https://developer.paypal.com/webapps/developer/docs/api/) * [API Reference](https://developer.paypal.com/webapps/developer/docs/api/)
* [Reporting issues / feature requests] (https://github.com/paypal/rest-api-sdk-php/issues) * [Reporting issues / feature requests] (https://github.com/paypal/rest-api-sdk-php/issues)
* [Pizza App Using Paypal REST API] (https://github.com/paypal/rest-api-sample-app-php)
[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/paypal/rest-api-sample-app-php/trend.png)](https://bitdeli.com/free "Bitdeli Badge") [![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/paypal/rest-api-sample-app-php/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

View File

@@ -1,67 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="paypal-rest-sdk-php" basedir="." default="all">
<property name="basedir" value="." />
<property name="release.dir" value="${basedir}/release" />
<property name="output.dir" value="${basedir}/build" />
<property name="phplint.out" value="${output.dir}/phplint.txt" />
<property name="phploc.out" value="${output.dir}/phploc.xml" />
<property name="coverage.dir" value="${output.dir}/coverage" />
<property name="coverage.out" value="${coverage.dir}/junit.xml" />
<property name="clover.out" value="${coverage.dir}/clover.xml" />
<property name="test.dir" value="${output.dir}/test" />
<fileset id="src.files" dir="${basedir}/lib" includes="**/*.php" />
<target name="composer-init" description="Downloads composer.phar if not available locally">
<if>
<available file="composer.phar" />
<then>
<echo>Composer is installed</echo>
</then>
<else>
<echo message="Installing composer" />
<exec command="curl -s http://getcomposer.org/installer | php" />
<exec command="php composer.phar install --dev" />
</else>
</if>
</target>
<target name="phplint">
<delete file="${phplint.out}"/>
<apply executable="php" failonerror="true" output="${phplint.out}" append="true">
<arg value="-l" />
<fileset refid="src.files" />
</apply>
</target>
<target name="phploc">
<exec command="phploc --log-xml ${phploc.out} ." dir="${basedir}/lib" />
</target>
<target name="coverage">
<mkdir dir="${output.dir}/coverage"/>
<exec command="phpunit --coverage-html=${coverage.dir} --coverage-clover=${clover.out} --log-junit=${coverage.out} --exclude-group=PayPal\\Api\\*" />
</target>
<target name="clean" description="Deletes build artifacts">
<delete dir="${output.dir}"/>
<mkdir dir="${output.dir}"/>
</target>
<target name="test" description="Runs test cases">
<exec command="phpunit --testdox-html=${test.dir}/testdox.html --log-junit=${test.dir}/junit.xml"/>
</target>
<!-- Requires phing -->
<target name="convert-test-report" >
<mkdir dir="build/test/report"/>
<phpunitreport infile="${coverage.out}"
format="frames"
todir="build/test/report" />
</target>
<target name="build" depends="test" description="Builds SDK" />
<target name="report" depends="phplint, coverage, phploc" description="Runs code checks and coverage reports" />
<target name="all" depends="clean, test, build, report" description="Do everything" />
</project>

View File

@@ -14,8 +14,7 @@
"require": { "require": {
"php": ">=5.3.0", "php": ">=5.3.0",
"ext-curl": "*", "ext-curl": "*",
"ext-json": "*", "ext-json": "*"
"paypal/sdk-core-php": "2.5.*"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "3.7.*" "phpunit/phpunit": "3.7.*"

View File

@@ -4,13 +4,15 @@ namespace PayPal\Api;
use PayPal\Common\PPModel; use PayPal\Common\PPModel;
use PayPal\Rest\ApiContext; use PayPal\Rest\ApiContext;
class BillingInfo extends PPModel { class BillingInfo extends PPModel
{
/** /**
* Email address of the invoice recipient. 260 characters max. * Email address of the invoice recipient. 260 characters max.
* *
* @param string $email * @param string $email
*/ */
public function setEmail($email) { public function setEmail($email)
{
$this->email = $email; $this->email = $email;
return $this; return $this;
} }
@@ -20,7 +22,8 @@ class BillingInfo extends PPModel {
* *
* @return string * @return string
*/ */
public function getEmail() { public function getEmail()
{
return $this->email; return $this->email;
} }
@@ -30,7 +33,8 @@ class BillingInfo extends PPModel {
* *
* @param string $first_name * @param string $first_name
*/ */
public function setFirstName($first_name) { public function setFirstName($first_name)
{
$this->first_name = $first_name; $this->first_name = $first_name;
return $this; return $this;
} }
@@ -40,7 +44,8 @@ class BillingInfo extends PPModel {
* *
* @return string * @return string
*/ */
public function getFirstName() { public function getFirstName()
{
return $this->first_name; return $this->first_name;
} }
@@ -50,17 +55,20 @@ class BillingInfo extends PPModel {
* @param string $first_name * @param string $first_name
* @deprecated. Instead use setFirstName * @deprecated. Instead use setFirstName
*/ */
public function setFirst_name($first_name) { public function setFirst_name($first_name)
{
$this->first_name = $first_name; $this->first_name = $first_name;
return $this; return $this;
} }
/** /**
* First name of the invoice recipient. 30 characters max. * First name of the invoice recipient. 30 characters max.
* *
* @return string * @return string
* @deprecated. Instead use getFirstName * @deprecated. Instead use getFirstName
*/ */
public function getFirst_name() { public function getFirst_name()
{
return $this->first_name; return $this->first_name;
} }
@@ -69,7 +77,8 @@ class BillingInfo extends PPModel {
* *
* @param string $last_name * @param string $last_name
*/ */
public function setLastName($last_name) { public function setLastName($last_name)
{
$this->last_name = $last_name; $this->last_name = $last_name;
return $this; return $this;
} }
@@ -79,7 +88,8 @@ class BillingInfo extends PPModel {
* *
* @return string * @return string
*/ */
public function getLastName() { public function getLastName()
{
return $this->last_name; return $this->last_name;
} }
@@ -89,17 +99,20 @@ class BillingInfo extends PPModel {
* @param string $last_name * @param string $last_name
* @deprecated. Instead use setLastName * @deprecated. Instead use setLastName
*/ */
public function setLast_name($last_name) { public function setLast_name($last_name)
{
$this->last_name = $last_name; $this->last_name = $last_name;
return $this; return $this;
} }
/** /**
* Last name of the invoice recipient. 30 characters max. * Last name of the invoice recipient. 30 characters max.
* *
* @return string * @return string
* @deprecated. Instead use getLastName * @deprecated. Instead use getLastName
*/ */
public function getLast_name() { public function getLast_name()
{
return $this->last_name; return $this->last_name;
} }
@@ -108,7 +121,8 @@ class BillingInfo extends PPModel {
* *
* @param string $business_name * @param string $business_name
*/ */
public function setBusinessName($business_name) { public function setBusinessName($business_name)
{
$this->business_name = $business_name; $this->business_name = $business_name;
return $this; return $this;
} }
@@ -118,7 +132,8 @@ class BillingInfo extends PPModel {
* *
* @return string * @return string
*/ */
public function getBusinessName() { public function getBusinessName()
{
return $this->business_name; return $this->business_name;
} }
@@ -128,17 +143,20 @@ class BillingInfo extends PPModel {
* @param string $business_name * @param string $business_name
* @deprecated. Instead use setBusinessName * @deprecated. Instead use setBusinessName
*/ */
public function setBusiness_name($business_name) { public function setBusiness_name($business_name)
{
$this->business_name = $business_name; $this->business_name = $business_name;
return $this; return $this;
} }
/** /**
* Company business name of the invoice recipient. 100 characters max. * Company business name of the invoice recipient. 100 characters max.
* *
* @return string * @return string
* @deprecated. Instead use getBusinessName * @deprecated. Instead use getBusinessName
*/ */
public function getBusiness_name() { public function getBusiness_name()
{
return $this->business_name; return $this->business_name;
} }
@@ -147,7 +165,8 @@ class BillingInfo extends PPModel {
* *
* @param PayPal\Api\Address $address * @param PayPal\Api\Address $address
*/ */
public function setAddress($address) { public function setAddress($address)
{
$this->address = $address; $this->address = $address;
return $this; return $this;
} }
@@ -157,7 +176,8 @@ class BillingInfo extends PPModel {
* *
* @return PayPal\Api\Address * @return PayPal\Api\Address
*/ */
public function getAddress() { public function getAddress()
{
return $this->address; return $this->address;
} }
@@ -167,7 +187,8 @@ class BillingInfo extends PPModel {
* *
* @param string $language * @param string $language
*/ */
public function setLanguage($language) { public function setLanguage($language)
{
$this->language = $language; $this->language = $language;
return $this; return $this;
} }
@@ -177,7 +198,8 @@ class BillingInfo extends PPModel {
* *
* @return string * @return string
*/ */
public function getLanguage() { public function getLanguage()
{
return $this->language; return $this->language;
} }
@@ -187,7 +209,8 @@ class BillingInfo extends PPModel {
* *
* @param string $additional_info * @param string $additional_info
*/ */
public function setAdditionalInfo($additional_info) { public function setAdditionalInfo($additional_info)
{
$this->additional_info = $additional_info; $this->additional_info = $additional_info;
return $this; return $this;
} }
@@ -197,7 +220,8 @@ class BillingInfo extends PPModel {
* *
* @return string * @return string
*/ */
public function getAdditionalInfo() { public function getAdditionalInfo()
{
return $this->additional_info; return $this->additional_info;
} }
@@ -207,17 +231,20 @@ class BillingInfo extends PPModel {
* @param string $additional_info * @param string $additional_info
* @deprecated. Instead use setAdditionalInfo * @deprecated. Instead use setAdditionalInfo
*/ */
public function setAdditional_info($additional_info) { public function setAdditional_info($additional_info)
{
$this->additional_info = $additional_info; $this->additional_info = $additional_info;
return $this; return $this;
} }
/** /**
* Option to display additional information such as business hours. 40 characters max. * Option to display additional information such as business hours. 40 characters max.
* *
* @return string * @return string
* @deprecated. Instead use getAdditionalInfo * @deprecated. Instead use getAdditionalInfo
*/ */
public function getAdditional_info() { public function getAdditional_info()
{
return $this->additional_info; return $this->additional_info;
} }

View File

@@ -4,13 +4,15 @@ namespace PayPal\Api;
use PayPal\Common\PPModel; use PayPal\Common\PPModel;
use PayPal\Rest\ApiContext; use PayPal\Rest\ApiContext;
class CancelNotification extends PPModel { class CancelNotification extends PPModel
{
/** /**
* Subject of the notification. * Subject of the notification.
* *
* @param string $subject * @param string $subject
*/ */
public function setSubject($subject) { public function setSubject($subject)
{
$this->subject = $subject; $this->subject = $subject;
return $this; return $this;
} }
@@ -20,7 +22,8 @@ class CancelNotification extends PPModel {
* *
* @return string * @return string
*/ */
public function getSubject() { public function getSubject()
{
return $this->subject; return $this->subject;
} }
@@ -30,7 +33,8 @@ class CancelNotification extends PPModel {
* *
* @param string $note * @param string $note
*/ */
public function setNote($note) { public function setNote($note)
{
$this->note = $note; $this->note = $note;
return $this; return $this;
} }
@@ -40,7 +44,8 @@ class CancelNotification extends PPModel {
* *
* @return string * @return string
*/ */
public function getNote() { public function getNote()
{
return $this->note; return $this->note;
} }
@@ -50,7 +55,8 @@ class CancelNotification extends PPModel {
* *
* @param boolean $send_to_merchant * @param boolean $send_to_merchant
*/ */
public function setSendToMerchant($send_to_merchant) { public function setSendToMerchant($send_to_merchant)
{
$this->send_to_merchant = $send_to_merchant; $this->send_to_merchant = $send_to_merchant;
return $this; return $this;
} }
@@ -60,7 +66,8 @@ class CancelNotification extends PPModel {
* *
* @return boolean * @return boolean
*/ */
public function getSendToMerchant() { public function getSendToMerchant()
{
return $this->send_to_merchant; return $this->send_to_merchant;
} }
@@ -70,17 +77,20 @@ class CancelNotification extends PPModel {
* @param boolean $send_to_merchant * @param boolean $send_to_merchant
* @deprecated. Instead use setSendToMerchant * @deprecated. Instead use setSendToMerchant
*/ */
public function setSend_to_merchant($send_to_merchant) { public function setSend_to_merchant($send_to_merchant)
{
$this->send_to_merchant = $send_to_merchant; $this->send_to_merchant = $send_to_merchant;
return $this; return $this;
} }
/** /**
* A flag indicating whether a copy of the email has to be sent to the merchant. * A flag indicating whether a copy of the email has to be sent to the merchant.
* *
* @return boolean * @return boolean
* @deprecated. Instead use getSendToMerchant * @deprecated. Instead use getSendToMerchant
*/ */
public function getSend_to_merchant() { public function getSend_to_merchant()
{
return $this->send_to_merchant; return $this->send_to_merchant;
} }
@@ -89,7 +99,8 @@ class CancelNotification extends PPModel {
* *
* @param boolean $send_to_payer * @param boolean $send_to_payer
*/ */
public function setSendToPayer($send_to_payer) { public function setSendToPayer($send_to_payer)
{
$this->send_to_payer = $send_to_payer; $this->send_to_payer = $send_to_payer;
return $this; return $this;
} }
@@ -99,7 +110,8 @@ class CancelNotification extends PPModel {
* *
* @return boolean * @return boolean
*/ */
public function getSendToPayer() { public function getSendToPayer()
{
return $this->send_to_payer; return $this->send_to_payer;
} }
@@ -109,17 +121,20 @@ class CancelNotification extends PPModel {
* @param boolean $send_to_payer * @param boolean $send_to_payer
* @deprecated. Instead use setSendToPayer * @deprecated. Instead use setSendToPayer
*/ */
public function setSend_to_payer($send_to_payer) { public function setSend_to_payer($send_to_payer)
{
$this->send_to_payer = $send_to_payer; $this->send_to_payer = $send_to_payer;
return $this; return $this;
} }
/** /**
* A flag indicating whether a copy of the email has to be sent to the payer. * A flag indicating whether a copy of the email has to be sent to the payer.
* *
* @return boolean * @return boolean
* @deprecated. Instead use getSendToPayer * @deprecated. Instead use getSendToPayer
*/ */
public function getSend_to_payer() { public function getSend_to_payer()
{
return $this->send_to_payer; return $this->send_to_payer;
} }

View File

@@ -4,13 +4,15 @@ namespace PayPal\Api;
use PayPal\Common\PPModel; use PayPal\Common\PPModel;
use PayPal\Rest\ApiContext; use PayPal\Rest\ApiContext;
class Cost extends PPModel { class Cost extends PPModel
{
/** /**
* Cost in percent. Range of 0 to 100. * Cost in percent. Range of 0 to 100.
* *
* @param PayPal\Api\number $percent * @param PayPal\Api\number $percent
*/ */
public function setPercent($percent) { public function setPercent($percent)
{
$this->percent = $percent; $this->percent = $percent;
return $this; return $this;
} }
@@ -20,7 +22,8 @@ class Cost extends PPModel {
* *
* @return PayPal\Api\number * @return PayPal\Api\number
*/ */
public function getPercent() { public function getPercent()
{
return $this->percent; return $this->percent;
} }
@@ -30,7 +33,8 @@ class Cost extends PPModel {
* *
* @param PayPal\Api\Currency $amount * @param PayPal\Api\Currency $amount
*/ */
public function setAmount($amount) { public function setAmount($amount)
{
$this->amount = $amount; $this->amount = $amount;
return $this; return $this;
} }
@@ -40,7 +44,8 @@ class Cost extends PPModel {
* *
* @return PayPal\Api\Currency * @return PayPal\Api\Currency
*/ */
public function getAmount() { public function getAmount()
{
return $this->amount; return $this->amount;
} }

View File

@@ -4,13 +4,15 @@ namespace PayPal\Api;
use PayPal\Common\PPModel; use PayPal\Common\PPModel;
use PayPal\Rest\ApiContext; use PayPal\Rest\ApiContext;
class Currency extends PPModel { class Currency extends PPModel
{
/** /**
* 3 letter currency code * 3 letter currency code
* *
* @param string $currency * @param string $currency
*/ */
public function setCurrency($currency) { public function setCurrency($currency)
{
$this->currency = $currency; $this->currency = $currency;
return $this; return $this;
} }
@@ -20,7 +22,8 @@ class Currency extends PPModel {
* *
* @return string * @return string
*/ */
public function getCurrency() { public function getCurrency()
{
return $this->currency; return $this->currency;
} }
@@ -30,7 +33,8 @@ class Currency extends PPModel {
* *
* @param string $value * @param string $value
*/ */
public function setValue($value) { public function setValue($value)
{
$this->value = $value; $this->value = $value;
return $this; return $this;
} }
@@ -40,7 +44,8 @@ class Currency extends PPModel {
* *
* @return string * @return string
*/ */
public function getValue() { public function getValue()
{
return $this->value; return $this->value;
} }

View File

@@ -4,13 +4,15 @@ namespace PayPal\Api;
use PayPal\Common\PPModel; use PayPal\Common\PPModel;
use PayPal\Rest\ApiContext; use PayPal\Rest\ApiContext;
class CustomAmount extends PPModel { class CustomAmount extends PPModel
{
/** /**
* Custom amount label. 25 characters max. * Custom amount label. 25 characters max.
* *
* @param string $label * @param string $label
*/ */
public function setLabel($label) { public function setLabel($label)
{
$this->label = $label; $this->label = $label;
return $this; return $this;
} }
@@ -20,7 +22,8 @@ class CustomAmount extends PPModel {
* *
* @return string * @return string
*/ */
public function getLabel() { public function getLabel()
{
return $this->label; return $this->label;
} }
@@ -30,7 +33,8 @@ class CustomAmount extends PPModel {
* *
* @param PayPal\Api\Currency $amount * @param PayPal\Api\Currency $amount
*/ */
public function setAmount($amount) { public function setAmount($amount)
{
$this->amount = $amount; $this->amount = $amount;
return $this; return $this;
} }
@@ -40,7 +44,8 @@ class CustomAmount extends PPModel {
* *
* @return PayPal\Api\Currency * @return PayPal\Api\Currency
*/ */
public function getAmount() { public function getAmount()
{
return $this->amount; return $this->amount;
} }

View File

@@ -4,13 +4,15 @@ namespace PayPal\Api;
use PayPal\Common\PPModel; use PayPal\Common\PPModel;
use PayPal\Rest\ApiContext; use PayPal\Rest\ApiContext;
class Error extends PPModel { class Error extends PPModel
{
/** /**
* Human readable, unique name of the error. * Human readable, unique name of the error.
* *
* @param string $name * @param string $name
*/ */
public function setName($name) { public function setName($name)
{
$this->name = $name; $this->name = $name;
return $this; return $this;
} }
@@ -20,7 +22,8 @@ class Error extends PPModel {
* *
* @return string * @return string
*/ */
public function getName() { public function getName()
{
return $this->name; return $this->name;
} }
@@ -30,7 +33,8 @@ class Error extends PPModel {
* *
* @param string $debug_id * @param string $debug_id
*/ */
public function setDebugId($debug_id) { public function setDebugId($debug_id)
{
$this->debug_id = $debug_id; $this->debug_id = $debug_id;
return $this; return $this;
} }
@@ -40,7 +44,8 @@ class Error extends PPModel {
* *
* @return string * @return string
*/ */
public function getDebugId() { public function getDebugId()
{
return $this->debug_id; return $this->debug_id;
} }
@@ -50,17 +55,20 @@ class Error extends PPModel {
* @param string $debug_id * @param string $debug_id
* @deprecated. Instead use setDebugId * @deprecated. Instead use setDebugId
*/ */
public function setDebug_id($debug_id) { public function setDebug_id($debug_id)
{
$this->debug_id = $debug_id; $this->debug_id = $debug_id;
return $this; return $this;
} }
/** /**
* PayPal internal identifier used for correlation purposes. * PayPal internal identifier used for correlation purposes.
* *
* @return string * @return string
* @deprecated. Instead use getDebugId * @deprecated. Instead use getDebugId
*/ */
public function getDebug_id() { public function getDebug_id()
{
return $this->debug_id; return $this->debug_id;
} }
@@ -69,7 +77,8 @@ class Error extends PPModel {
* *
* @param string $message * @param string $message
*/ */
public function setMessage($message) { public function setMessage($message)
{
$this->message = $message; $this->message = $message;
return $this; return $this;
} }
@@ -79,7 +88,8 @@ class Error extends PPModel {
* *
* @return string * @return string
*/ */
public function getMessage() { public function getMessage()
{
return $this->message; return $this->message;
} }
@@ -89,7 +99,8 @@ class Error extends PPModel {
* *
* @param string $information_link * @param string $information_link
*/ */
public function setInformationLink($information_link) { public function setInformationLink($information_link)
{
$this->information_link = $information_link; $this->information_link = $information_link;
return $this; return $this;
} }
@@ -99,7 +110,8 @@ class Error extends PPModel {
* *
* @return string * @return string
*/ */
public function getInformationLink() { public function getInformationLink()
{
return $this->information_link; return $this->information_link;
} }
@@ -109,17 +121,20 @@ class Error extends PPModel {
* @param string $information_link * @param string $information_link
* @deprecated. Instead use setInformationLink * @deprecated. Instead use setInformationLink
*/ */
public function setInformation_link($information_link) { public function setInformation_link($information_link)
{
$this->information_link = $information_link; $this->information_link = $information_link;
return $this; return $this;
} }
/** /**
* URI for detailed information related to this error for the developer. * URI for detailed information related to this error for the developer.
* *
* @return string * @return string
* @deprecated. Instead use getInformationLink * @deprecated. Instead use getInformationLink
*/ */
public function getInformation_link() { public function getInformation_link()
{
return $this->information_link; return $this->information_link;
} }
@@ -128,7 +143,8 @@ class Error extends PPModel {
* *
* @param PayPal\Api\ErrorDetails $details * @param PayPal\Api\ErrorDetails $details
*/ */
public function setDetails($details) { public function setDetails($details)
{
$this->details = $details; $this->details = $details;
return $this; return $this;
} }
@@ -138,7 +154,8 @@ class Error extends PPModel {
* *
* @return PayPal\Api\ErrorDetails * @return PayPal\Api\ErrorDetails
*/ */
public function getDetails() { public function getDetails()
{
return $this->details; return $this->details;
} }

View File

@@ -4,13 +4,15 @@ namespace PayPal\Api;
use PayPal\Common\PPModel; use PayPal\Common\PPModel;
use PayPal\Rest\ApiContext; use PayPal\Rest\ApiContext;
class ErrorDetails extends PPModel { class ErrorDetails extends PPModel
{
/** /**
* Name of the field that caused the error. * Name of the field that caused the error.
* *
* @param string $field * @param string $field
*/ */
public function setField($field) { public function setField($field)
{
$this->field = $field; $this->field = $field;
return $this; return $this;
} }
@@ -20,7 +22,8 @@ class ErrorDetails extends PPModel {
* *
* @return string * @return string
*/ */
public function getField() { public function getField()
{
return $this->field; return $this->field;
} }
@@ -30,7 +33,8 @@ class ErrorDetails extends PPModel {
* *
* @param string $issue * @param string $issue
*/ */
public function setIssue($issue) { public function setIssue($issue)
{
$this->issue = $issue; $this->issue = $issue;
return $this; return $this;
} }
@@ -40,7 +44,8 @@ class ErrorDetails extends PPModel {
* *
* @return string * @return string
*/ */
public function getIssue() { public function getIssue()
{
return $this->issue; return $this->issue;
} }

View File

@@ -7,7 +7,8 @@ use PayPal\Rest\IResource;
use PayPal\Api\Invoices; use PayPal\Api\Invoices;
use PayPal\Transport\PPRestCall; use PayPal\Transport\PPRestCall;
class Invoice extends PPModel implements IResource { class Invoice extends PPModel implements IResource
{
private static $credential; private static $credential;
@@ -15,7 +16,8 @@ class Invoice extends PPModel implements IResource {
* *
* @deprecated. Pass ApiContext to create/get methods instead * @deprecated. Pass ApiContext to create/get methods instead
*/ */
public static function setCredential($credential) { public static function setCredential($credential)
{
self::$credential = $credential; self::$credential = $credential;
} }
@@ -24,7 +26,8 @@ class Invoice extends PPModel implements IResource {
* *
* @param string $id * @param string $id
*/ */
public function setId($id) { public function setId($id)
{
$this->id = $id; $this->id = $id;
return $this; return $this;
} }
@@ -34,7 +37,8 @@ class Invoice extends PPModel implements IResource {
* *
* @return string * @return string
*/ */
public function getId() { public function getId()
{
return $this->id; return $this->id;
} }
@@ -44,7 +48,8 @@ class Invoice extends PPModel implements IResource {
* *
* @param string $number * @param string $number
*/ */
public function setNumber($number) { public function setNumber($number)
{
$this->number = $number; $this->number = $number;
return $this; return $this;
} }
@@ -54,7 +59,8 @@ class Invoice extends PPModel implements IResource {
* *
* @return string * @return string
*/ */
public function getNumber() { public function getNumber()
{
return $this->number; return $this->number;
} }
@@ -64,7 +70,8 @@ class Invoice extends PPModel implements IResource {
* *
* @param string $uri * @param string $uri
*/ */
public function setUri($uri) { public function setUri($uri)
{
$this->uri = $uri; $this->uri = $uri;
return $this; return $this;
} }
@@ -74,7 +81,8 @@ class Invoice extends PPModel implements IResource {
* *
* @return string * @return string
*/ */
public function getUri() { public function getUri()
{
return $this->uri; return $this->uri;
} }
@@ -84,7 +92,8 @@ class Invoice extends PPModel implements IResource {
* *
* @param string $status * @param string $status
*/ */
public function setStatus($status) { public function setStatus($status)
{
$this->status = $status; $this->status = $status;
return $this; return $this;
} }
@@ -94,7 +103,8 @@ class Invoice extends PPModel implements IResource {
* *
* @return string * @return string
*/ */
public function getStatus() { public function getStatus()
{
return $this->status; return $this->status;
} }
@@ -104,7 +114,8 @@ class Invoice extends PPModel implements IResource {
* *
* @param PayPal\Api\MerchantInfo $merchant_info * @param PayPal\Api\MerchantInfo $merchant_info
*/ */
public function setMerchantInfo($merchant_info) { public function setMerchantInfo($merchant_info)
{
$this->merchant_info = $merchant_info; $this->merchant_info = $merchant_info;
return $this; return $this;
} }
@@ -114,7 +125,8 @@ class Invoice extends PPModel implements IResource {
* *
* @return PayPal\Api\MerchantInfo * @return PayPal\Api\MerchantInfo
*/ */
public function getMerchantInfo() { public function getMerchantInfo()
{
return $this->merchant_info; return $this->merchant_info;
} }
@@ -124,17 +136,20 @@ class Invoice extends PPModel implements IResource {
* @param PayPal\Api\MerchantInfo $merchant_info * @param PayPal\Api\MerchantInfo $merchant_info
* @deprecated. Instead use setMerchantInfo * @deprecated. Instead use setMerchantInfo
*/ */
public function setMerchant_info($merchant_info) { public function setMerchant_info($merchant_info)
{
$this->merchant_info = $merchant_info; $this->merchant_info = $merchant_info;
return $this; return $this;
} }
/** /**
* Information about the merchant who is sending the invoice. * Information about the merchant who is sending the invoice.
* *
* @return PayPal\Api\MerchantInfo * @return PayPal\Api\MerchantInfo
* @deprecated. Instead use getMerchantInfo * @deprecated. Instead use getMerchantInfo
*/ */
public function getMerchant_info() { public function getMerchant_info()
{
return $this->merchant_info; return $this->merchant_info;
} }
@@ -143,7 +158,8 @@ class Invoice extends PPModel implements IResource {
* *
* @param PayPal\Api\BillingInfo $billing_info * @param PayPal\Api\BillingInfo $billing_info
*/ */
public function setBillingInfo($billing_info) { public function setBillingInfo($billing_info)
{
$this->billing_info = $billing_info; $this->billing_info = $billing_info;
return $this; return $this;
} }
@@ -153,7 +169,8 @@ class Invoice extends PPModel implements IResource {
* *
* @return PayPal\Api\BillingInfo * @return PayPal\Api\BillingInfo
*/ */
public function getBillingInfo() { public function getBillingInfo()
{
return $this->billing_info; return $this->billing_info;
} }
@@ -163,17 +180,20 @@ class Invoice extends PPModel implements IResource {
* @param PayPal\Api\BillingInfo $billing_info * @param PayPal\Api\BillingInfo $billing_info
* @deprecated. Instead use setBillingInfo * @deprecated. Instead use setBillingInfo
*/ */
public function setBilling_info($billing_info) { public function setBilling_info($billing_info)
{
$this->billing_info = $billing_info; $this->billing_info = $billing_info;
return $this; return $this;
} }
/** /**
* Email address of invoice recipient (required) and optional billing information. (Note: We currently only allow one recipient). * Email address of invoice recipient (required) and optional billing information. (Note: We currently only allow one recipient).
* *
* @return PayPal\Api\BillingInfo * @return PayPal\Api\BillingInfo
* @deprecated. Instead use getBillingInfo * @deprecated. Instead use getBillingInfo
*/ */
public function getBilling_info() { public function getBilling_info()
{
return $this->billing_info; return $this->billing_info;
} }
@@ -182,7 +202,8 @@ class Invoice extends PPModel implements IResource {
* *
* @param PayPal\Api\ShippingInfo $shipping_info * @param PayPal\Api\ShippingInfo $shipping_info
*/ */
public function setShippingInfo($shipping_info) { public function setShippingInfo($shipping_info)
{
$this->shipping_info = $shipping_info; $this->shipping_info = $shipping_info;
return $this; return $this;
} }
@@ -192,7 +213,8 @@ class Invoice extends PPModel implements IResource {
* *
* @return PayPal\Api\ShippingInfo * @return PayPal\Api\ShippingInfo
*/ */
public function getShippingInfo() { public function getShippingInfo()
{
return $this->shipping_info; return $this->shipping_info;
} }
@@ -202,17 +224,20 @@ class Invoice extends PPModel implements IResource {
* @param PayPal\Api\ShippingInfo $shipping_info * @param PayPal\Api\ShippingInfo $shipping_info
* @deprecated. Instead use setShippingInfo * @deprecated. Instead use setShippingInfo
*/ */
public function setShipping_info($shipping_info) { public function setShipping_info($shipping_info)
{
$this->shipping_info = $shipping_info; $this->shipping_info = $shipping_info;
return $this; return $this;
} }
/** /**
* Shipping information for entities to whom items are being shipped. * Shipping information for entities to whom items are being shipped.
* *
* @return PayPal\Api\ShippingInfo * @return PayPal\Api\ShippingInfo
* @deprecated. Instead use getShippingInfo * @deprecated. Instead use getShippingInfo
*/ */
public function getShipping_info() { public function getShipping_info()
{
return $this->shipping_info; return $this->shipping_info;
} }
@@ -221,7 +246,8 @@ class Invoice extends PPModel implements IResource {
* *
* @param PayPal\Api\InvoiceItem $items * @param PayPal\Api\InvoiceItem $items
*/ */
public function setItems($items) { public function setItems($items)
{
$this->items = $items; $this->items = $items;
return $this; return $this;
} }
@@ -231,7 +257,8 @@ class Invoice extends PPModel implements IResource {
* *
* @return PayPal\Api\InvoiceItem * @return PayPal\Api\InvoiceItem
*/ */
public function getItems() { public function getItems()
{
return $this->items; return $this->items;
} }
@@ -241,7 +268,8 @@ class Invoice extends PPModel implements IResource {
* *
* @param string $invoice_date * @param string $invoice_date
*/ */
public function setInvoiceDate($invoice_date) { public function setInvoiceDate($invoice_date)
{
$this->invoice_date = $invoice_date; $this->invoice_date = $invoice_date;
return $this; return $this;
} }
@@ -251,7 +279,8 @@ class Invoice extends PPModel implements IResource {
* *
* @return string * @return string
*/ */
public function getInvoiceDate() { public function getInvoiceDate()
{
return $this->invoice_date; return $this->invoice_date;
} }
@@ -261,17 +290,20 @@ class Invoice extends PPModel implements IResource {
* @param string $invoice_date * @param string $invoice_date
* @deprecated. Instead use setInvoiceDate * @deprecated. Instead use setInvoiceDate
*/ */
public function setInvoice_date($invoice_date) { public function setInvoice_date($invoice_date)
{
$this->invoice_date = $invoice_date; $this->invoice_date = $invoice_date;
return $this; return $this;
} }
/** /**
* Date on which the invoice was enabled. Date format: yyyy-MM-dd z. For example, 2014-02-27 PST * Date on which the invoice was enabled. Date format: yyyy-MM-dd z. For example, 2014-02-27 PST
* *
* @return string * @return string
* @deprecated. Instead use getInvoiceDate * @deprecated. Instead use getInvoiceDate
*/ */
public function getInvoice_date() { public function getInvoice_date()
{
return $this->invoice_date; return $this->invoice_date;
} }
@@ -280,7 +312,8 @@ class Invoice extends PPModel implements IResource {
* *
* @param PayPal\Api\PaymentTerm $payment_term * @param PayPal\Api\PaymentTerm $payment_term
*/ */
public function setPaymentTerm($payment_term) { public function setPaymentTerm($payment_term)
{
$this->payment_term = $payment_term; $this->payment_term = $payment_term;
return $this; return $this;
} }
@@ -290,7 +323,8 @@ class Invoice extends PPModel implements IResource {
* *
* @return PayPal\Api\PaymentTerm * @return PayPal\Api\PaymentTerm
*/ */
public function getPaymentTerm() { public function getPaymentTerm()
{
return $this->payment_term; return $this->payment_term;
} }
@@ -300,17 +334,20 @@ class Invoice extends PPModel implements IResource {
* @param PayPal\Api\PaymentTerm $payment_term * @param PayPal\Api\PaymentTerm $payment_term
* @deprecated. Instead use setPaymentTerm * @deprecated. Instead use setPaymentTerm
*/ */
public function setPayment_term($payment_term) { public function setPayment_term($payment_term)
{
$this->payment_term = $payment_term; $this->payment_term = $payment_term;
return $this; return $this;
} }
/** /**
* Optional field to pass payment deadline for the invoice. Either term_type or due_date can be passed, but not both. * Optional field to pass payment deadline for the invoice. Either term_type or due_date can be passed, but not both.
* *
* @return PayPal\Api\PaymentTerm * @return PayPal\Api\PaymentTerm
* @deprecated. Instead use getPaymentTerm * @deprecated. Instead use getPaymentTerm
*/ */
public function getPayment_term() { public function getPayment_term()
{
return $this->payment_term; return $this->payment_term;
} }
@@ -319,7 +356,8 @@ class Invoice extends PPModel implements IResource {
* *
* @param PayPal\Api\Cost $discount * @param PayPal\Api\Cost $discount
*/ */
public function setDiscount($discount) { public function setDiscount($discount)
{
$this->discount = $discount; $this->discount = $discount;
return $this; return $this;
} }
@@ -329,7 +367,8 @@ class Invoice extends PPModel implements IResource {
* *
* @return PayPal\Api\Cost * @return PayPal\Api\Cost
*/ */
public function getDiscount() { public function getDiscount()
{
return $this->discount; return $this->discount;
} }
@@ -339,7 +378,8 @@ class Invoice extends PPModel implements IResource {
* *
* @param PayPal\Api\ShippingCost $shipping_cost * @param PayPal\Api\ShippingCost $shipping_cost
*/ */
public function setShippingCost($shipping_cost) { public function setShippingCost($shipping_cost)
{
$this->shipping_cost = $shipping_cost; $this->shipping_cost = $shipping_cost;
return $this; return $this;
} }
@@ -349,7 +389,8 @@ class Invoice extends PPModel implements IResource {
* *
* @return PayPal\Api\ShippingCost * @return PayPal\Api\ShippingCost
*/ */
public function getShippingCost() { public function getShippingCost()
{
return $this->shipping_cost; return $this->shipping_cost;
} }
@@ -359,17 +400,20 @@ class Invoice extends PPModel implements IResource {
* @param PayPal\Api\ShippingCost $shipping_cost * @param PayPal\Api\ShippingCost $shipping_cost
* @deprecated. Instead use setShippingCost * @deprecated. Instead use setShippingCost
*/ */
public function setShipping_cost($shipping_cost) { public function setShipping_cost($shipping_cost)
{
$this->shipping_cost = $shipping_cost; $this->shipping_cost = $shipping_cost;
return $this; return $this;
} }
/** /**
* Shipping cost in percent or amount. * Shipping cost in percent or amount.
* *
* @return PayPal\Api\ShippingCost * @return PayPal\Api\ShippingCost
* @deprecated. Instead use getShippingCost * @deprecated. Instead use getShippingCost
*/ */
public function getShipping_cost() { public function getShipping_cost()
{
return $this->shipping_cost; return $this->shipping_cost;
} }
@@ -378,7 +422,8 @@ class Invoice extends PPModel implements IResource {
* *
* @param PayPal\Api\CustomAmount $custom * @param PayPal\Api\CustomAmount $custom
*/ */
public function setCustom($custom) { public function setCustom($custom)
{
$this->custom = $custom; $this->custom = $custom;
return $this; return $this;
} }
@@ -388,7 +433,8 @@ class Invoice extends PPModel implements IResource {
* *
* @return PayPal\Api\CustomAmount * @return PayPal\Api\CustomAmount
*/ */
public function getCustom() { public function getCustom()
{
return $this->custom; return $this->custom;
} }
@@ -398,7 +444,8 @@ class Invoice extends PPModel implements IResource {
* *
* @param boolean $tax_calculated_after_discount * @param boolean $tax_calculated_after_discount
*/ */
public function setTaxCalculatedAfterDiscount($tax_calculated_after_discount) { public function setTaxCalculatedAfterDiscount($tax_calculated_after_discount)
{
$this->tax_calculated_after_discount = $tax_calculated_after_discount; $this->tax_calculated_after_discount = $tax_calculated_after_discount;
return $this; return $this;
} }
@@ -408,7 +455,8 @@ class Invoice extends PPModel implements IResource {
* *
* @return boolean * @return boolean
*/ */
public function getTaxCalculatedAfterDiscount() { public function getTaxCalculatedAfterDiscount()
{
return $this->tax_calculated_after_discount; return $this->tax_calculated_after_discount;
} }
@@ -418,17 +466,20 @@ class Invoice extends PPModel implements IResource {
* @param boolean $tax_calculated_after_discount * @param boolean $tax_calculated_after_discount
* @deprecated. Instead use setTaxCalculatedAfterDiscount * @deprecated. Instead use setTaxCalculatedAfterDiscount
*/ */
public function setTax_calculated_after_discount($tax_calculated_after_discount) { public function setTax_calculated_after_discount($tax_calculated_after_discount)
{
$this->tax_calculated_after_discount = $tax_calculated_after_discount; $this->tax_calculated_after_discount = $tax_calculated_after_discount;
return $this; return $this;
} }
/** /**
* Indicates whether tax is calculated before or after a discount. If false (the default), the tax is calculated before a discount. If true, the tax is calculated after a discount. * Indicates whether tax is calculated before or after a discount. If false (the default), the tax is calculated before a discount. If true, the tax is calculated after a discount.
* *
* @return boolean * @return boolean
* @deprecated. Instead use getTaxCalculatedAfterDiscount * @deprecated. Instead use getTaxCalculatedAfterDiscount
*/ */
public function getTax_calculated_after_discount() { public function getTax_calculated_after_discount()
{
return $this->tax_calculated_after_discount; return $this->tax_calculated_after_discount;
} }
@@ -437,7 +488,8 @@ class Invoice extends PPModel implements IResource {
* *
* @param boolean $tax_inclusive * @param boolean $tax_inclusive
*/ */
public function setTaxInclusive($tax_inclusive) { public function setTaxInclusive($tax_inclusive)
{
$this->tax_inclusive = $tax_inclusive; $this->tax_inclusive = $tax_inclusive;
return $this; return $this;
} }
@@ -447,7 +499,8 @@ class Invoice extends PPModel implements IResource {
* *
* @return boolean * @return boolean
*/ */
public function getTaxInclusive() { public function getTaxInclusive()
{
return $this->tax_inclusive; return $this->tax_inclusive;
} }
@@ -457,17 +510,20 @@ class Invoice extends PPModel implements IResource {
* @param boolean $tax_inclusive * @param boolean $tax_inclusive
* @deprecated. Instead use setTaxInclusive * @deprecated. Instead use setTaxInclusive
*/ */
public function setTax_inclusive($tax_inclusive) { public function setTax_inclusive($tax_inclusive)
{
$this->tax_inclusive = $tax_inclusive; $this->tax_inclusive = $tax_inclusive;
return $this; return $this;
} }
/** /**
* A flag indicating whether the unit price includes tax. Default is false * A flag indicating whether the unit price includes tax. Default is false
* *
* @return boolean * @return boolean
* @deprecated. Instead use getTaxInclusive * @deprecated. Instead use getTaxInclusive
*/ */
public function getTax_inclusive() { public function getTax_inclusive()
{
return $this->tax_inclusive; return $this->tax_inclusive;
} }
@@ -476,7 +532,8 @@ class Invoice extends PPModel implements IResource {
* *
* @param string $terms * @param string $terms
*/ */
public function setTerms($terms) { public function setTerms($terms)
{
$this->terms = $terms; $this->terms = $terms;
return $this; return $this;
} }
@@ -486,7 +543,8 @@ class Invoice extends PPModel implements IResource {
* *
* @return string * @return string
*/ */
public function getTerms() { public function getTerms()
{
return $this->terms; return $this->terms;
} }
@@ -496,7 +554,8 @@ class Invoice extends PPModel implements IResource {
* *
* @param string $note * @param string $note
*/ */
public function setNote($note) { public function setNote($note)
{
$this->note = $note; $this->note = $note;
return $this; return $this;
} }
@@ -506,7 +565,8 @@ class Invoice extends PPModel implements IResource {
* *
* @return string * @return string
*/ */
public function getNote() { public function getNote()
{
return $this->note; return $this->note;
} }
@@ -516,7 +576,8 @@ class Invoice extends PPModel implements IResource {
* *
* @param string $merchant_memo * @param string $merchant_memo
*/ */
public function setMerchantMemo($merchant_memo) { public function setMerchantMemo($merchant_memo)
{
$this->merchant_memo = $merchant_memo; $this->merchant_memo = $merchant_memo;
return $this; return $this;
} }
@@ -526,7 +587,8 @@ class Invoice extends PPModel implements IResource {
* *
* @return string * @return string
*/ */
public function getMerchantMemo() { public function getMerchantMemo()
{
return $this->merchant_memo; return $this->merchant_memo;
} }
@@ -536,17 +598,20 @@ class Invoice extends PPModel implements IResource {
* @param string $merchant_memo * @param string $merchant_memo
* @deprecated. Instead use setMerchantMemo * @deprecated. Instead use setMerchantMemo
*/ */
public function setMerchant_memo($merchant_memo) { public function setMerchant_memo($merchant_memo)
{
$this->merchant_memo = $merchant_memo; $this->merchant_memo = $merchant_memo;
return $this; return $this;
} }
/** /**
* Bookkeeping memo that is private to the merchant. 150 characters max. * Bookkeeping memo that is private to the merchant. 150 characters max.
* *
* @return string * @return string
* @deprecated. Instead use getMerchantMemo * @deprecated. Instead use getMerchantMemo
*/ */
public function getMerchant_memo() { public function getMerchant_memo()
{
return $this->merchant_memo; return $this->merchant_memo;
} }
@@ -555,7 +620,8 @@ class Invoice extends PPModel implements IResource {
* *
* @param string $logo_url * @param string $logo_url
*/ */
public function setLogoUrl($logo_url) { public function setLogoUrl($logo_url)
{
$this->logo_url = $logo_url; $this->logo_url = $logo_url;
return $this; return $this;
} }
@@ -565,7 +631,8 @@ class Invoice extends PPModel implements IResource {
* *
* @return string * @return string
*/ */
public function getLogoUrl() { public function getLogoUrl()
{
return $this->logo_url; return $this->logo_url;
} }
@@ -575,17 +642,20 @@ class Invoice extends PPModel implements IResource {
* @param string $logo_url * @param string $logo_url
* @deprecated. Instead use setLogoUrl * @deprecated. Instead use setLogoUrl
*/ */
public function setLogo_url($logo_url) { public function setLogo_url($logo_url)
{
$this->logo_url = $logo_url; $this->logo_url = $logo_url;
return $this; return $this;
} }
/** /**
* Full URL of an external image to use as the logo. 4000 characters max. * Full URL of an external image to use as the logo. 4000 characters max.
* *
* @return string * @return string
* @deprecated. Instead use getLogoUrl * @deprecated. Instead use getLogoUrl
*/ */
public function getLogo_url() { public function getLogo_url()
{
return $this->logo_url; return $this->logo_url;
} }
@@ -594,7 +664,8 @@ class Invoice extends PPModel implements IResource {
* *
* @param PayPal\Api\Currency $total_amount * @param PayPal\Api\Currency $total_amount
*/ */
public function setTotalAmount($total_amount) { public function setTotalAmount($total_amount)
{
$this->total_amount = $total_amount; $this->total_amount = $total_amount;
return $this; return $this;
} }
@@ -604,7 +675,8 @@ class Invoice extends PPModel implements IResource {
* *
* @return PayPal\Api\Currency * @return PayPal\Api\Currency
*/ */
public function getTotalAmount() { public function getTotalAmount()
{
return $this->total_amount; return $this->total_amount;
} }
@@ -614,17 +686,20 @@ class Invoice extends PPModel implements IResource {
* @param PayPal\Api\Currency $total_amount * @param PayPal\Api\Currency $total_amount
* @deprecated. Instead use setTotalAmount * @deprecated. Instead use setTotalAmount
*/ */
public function setTotal_amount($total_amount) { public function setTotal_amount($total_amount)
{
$this->total_amount = $total_amount; $this->total_amount = $total_amount;
return $this; return $this;
} }
/** /**
* The total amount of the invoice. * The total amount of the invoice.
* *
* @return PayPal\Api\Currency * @return PayPal\Api\Currency
* @deprecated. Instead use getTotalAmount * @deprecated. Instead use getTotalAmount
*/ */
public function getTotal_amount() { public function getTotal_amount()
{
return $this->total_amount; return $this->total_amount;
} }
@@ -659,7 +734,8 @@ class Invoice extends PPModel implements IResource {
* *
* @param PayPal\Api\PaymentDetail $payment_details * @param PayPal\Api\PaymentDetail $payment_details
*/ */
public function setPaymentDetails($payment_details) { public function setPaymentDetails($payment_details)
{
$this->payment_details = $payment_details; $this->payment_details = $payment_details;
return $this; return $this;
} }
@@ -669,7 +745,8 @@ class Invoice extends PPModel implements IResource {
* *
* @return PayPal\Api\PaymentDetail * @return PayPal\Api\PaymentDetail
*/ */
public function getPaymentDetails() { public function getPaymentDetails()
{
return $this->payment_details; return $this->payment_details;
} }
@@ -679,17 +756,20 @@ class Invoice extends PPModel implements IResource {
* @param PayPal\Api\PaymentDetail $payment_details * @param PayPal\Api\PaymentDetail $payment_details
* @deprecated. Instead use setPaymentDetails * @deprecated. Instead use setPaymentDetails
*/ */
public function setPayment_details($payment_details) { public function setPayment_details($payment_details)
{
$this->payment_details = $payment_details; $this->payment_details = $payment_details;
return $this; return $this;
} }
/** /**
* List of payment details for the invoice. * List of payment details for the invoice.
* *
* @return PayPal\Api\PaymentDetail * @return PayPal\Api\PaymentDetail
* @deprecated. Instead use getPaymentDetails * @deprecated. Instead use getPaymentDetails
*/ */
public function getPayment_details() { public function getPayment_details()
{
return $this->payment_details; return $this->payment_details;
} }
@@ -698,7 +778,8 @@ class Invoice extends PPModel implements IResource {
* *
* @param PayPal\Api\RefundDetail $refund_details * @param PayPal\Api\RefundDetail $refund_details
*/ */
public function setRefundDetails($refund_details) { public function setRefundDetails($refund_details)
{
$this->refund_details = $refund_details; $this->refund_details = $refund_details;
return $this; return $this;
} }
@@ -708,7 +789,8 @@ class Invoice extends PPModel implements IResource {
* *
* @return PayPal\Api\RefundDetail * @return PayPal\Api\RefundDetail
*/ */
public function getRefundDetails() { public function getRefundDetails()
{
return $this->refund_details; return $this->refund_details;
} }
@@ -718,17 +800,20 @@ class Invoice extends PPModel implements IResource {
* @param PayPal\Api\RefundDetail $refund_details * @param PayPal\Api\RefundDetail $refund_details
* @deprecated. Instead use setRefundDetails * @deprecated. Instead use setRefundDetails
*/ */
public function setRefund_details($refund_details) { public function setRefund_details($refund_details)
{
$this->refund_details = $refund_details; $this->refund_details = $refund_details;
return $this; return $this;
} }
/** /**
* List of refund details for the invoice. * List of refund details for the invoice.
* *
* @return PayPal\Api\RefundDetail * @return PayPal\Api\RefundDetail
* @deprecated. Instead use getRefundDetails * @deprecated. Instead use getRefundDetails
*/ */
public function getRefund_details() { public function getRefund_details()
{
return $this->refund_details; return $this->refund_details;
} }
@@ -737,7 +822,8 @@ class Invoice extends PPModel implements IResource {
* *
* @param PayPal\Api\Metadata $metadata * @param PayPal\Api\Metadata $metadata
*/ */
public function setMetadata($metadata) { public function setMetadata($metadata)
{
$this->metadata = $metadata; $this->metadata = $metadata;
return $this; return $this;
} }
@@ -747,19 +833,20 @@ class Invoice extends PPModel implements IResource {
* *
* @return PayPal\Api\Metadata * @return PayPal\Api\Metadata
*/ */
public function getMetadata() { public function getMetadata()
{
return $this->metadata; return $this->metadata;
} }
/* /*
* Creates a new invoice Resource. * Creates a new invoice Resource.
* *
* @param PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
* @return Invoice * @return Invoice
*/ */
public function create($apiContext = null) { public function create($apiContext = null)
{
$payLoad = $this->toJSON(); $payLoad = $this->toJSON();
if ($apiContext == null) { if ($apiContext == null) {
$apiContext = new ApiContext(self::$credential); $apiContext = new ApiContext(self::$credential);
@@ -777,7 +864,8 @@ class Invoice extends PPModel implements IResource {
* @param PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
* @return Invoices * @return Invoices
*/ */
public function search($search, $apiContext = null) { public function search($search, $apiContext = null)
{
if (($search == null)) { if (($search == null)) {
throw new \InvalidArgumentException("search cannot be null or empty"); throw new \InvalidArgumentException("search cannot be null or empty");
} }
@@ -798,7 +886,8 @@ class Invoice extends PPModel implements IResource {
* @param PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
* @return void * @return void
*/ */
public function send($apiContext = null) { public function send($apiContext = null)
{
if ($this->getId() == null) { if ($this->getId() == null) {
throw new \InvalidArgumentException("Id cannot be null"); throw new \InvalidArgumentException("Id cannot be null");
} }
@@ -818,7 +907,8 @@ class Invoice extends PPModel implements IResource {
* @param PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
* @return void * @return void
*/ */
public function remind($notification, $apiContext = null) { public function remind($notification, $apiContext = null)
{
if ($this->getId() == null) { if ($this->getId() == null) {
throw new \InvalidArgumentException("Id cannot be null"); throw new \InvalidArgumentException("Id cannot be null");
} }
@@ -841,7 +931,8 @@ class Invoice extends PPModel implements IResource {
* @param PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
* @return void * @return void
*/ */
public function cancel($cancelNotification, $apiContext = null) { public function cancel($cancelNotification, $apiContext = null)
{
if ($this->getId() == null) { if ($this->getId() == null) {
throw new \InvalidArgumentException("Id cannot be null"); throw new \InvalidArgumentException("Id cannot be null");
} }
@@ -864,7 +955,8 @@ class Invoice extends PPModel implements IResource {
* @param PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
* @return void * @return void
*/ */
public function record_payment($paymentDetail, $apiContext = null) { public function record_payment($paymentDetail, $apiContext = null)
{
if ($this->getId() == null) { if ($this->getId() == null) {
throw new \InvalidArgumentException("Id cannot be null"); throw new \InvalidArgumentException("Id cannot be null");
} }
@@ -887,7 +979,8 @@ class Invoice extends PPModel implements IResource {
* @param PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
* @return void * @return void
*/ */
public function record_refund($refundDetail, $apiContext = null) { public function record_refund($refundDetail, $apiContext = null)
{
if ($this->getId() == null) { if ($this->getId() == null) {
throw new \InvalidArgumentException("Id cannot be null"); throw new \InvalidArgumentException("Id cannot be null");
} }
@@ -910,7 +1003,8 @@ class Invoice extends PPModel implements IResource {
* @param PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
* @return Invoice * @return Invoice
*/ */
public static function get($invoiceId, $apiContext = null) { public static function get($invoiceId, $apiContext = null)
{
if (($invoiceId == null) || (strlen($invoiceId) <= 0)) { if (($invoiceId == null) || (strlen($invoiceId) <= 0)) {
throw new \InvalidArgumentException("invoiceId cannot be null or empty"); throw new \InvalidArgumentException("invoiceId cannot be null or empty");
} }
@@ -931,7 +1025,8 @@ class Invoice extends PPModel implements IResource {
* @param PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
* @return Invoices * @return Invoices
*/ */
public static function get_all($apiContext = null) { public static function get_all($apiContext = null)
{
$payLoad = ""; $payLoad = "";
if ($apiContext == null) { if ($apiContext == null) {
$apiContext = new ApiContext(self::$credential); $apiContext = new ApiContext(self::$credential);
@@ -949,7 +1044,8 @@ class Invoice extends PPModel implements IResource {
* @param PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
* @return Invoice * @return Invoice
*/ */
public function update($apiContext = null) { public function update($apiContext = null)
{
if ($this->getId() == null) { if ($this->getId() == null) {
throw new \InvalidArgumentException("Id cannot be null"); throw new \InvalidArgumentException("Id cannot be null");
} }
@@ -969,7 +1065,8 @@ class Invoice extends PPModel implements IResource {
* @param PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
* @return void * @return void
*/ */
public function delete($apiContext = null) { public function delete($apiContext = null)
{
if ($this->getId() == null) { if ($this->getId() == null) {
throw new \InvalidArgumentException("Id cannot be null"); throw new \InvalidArgumentException("Id cannot be null");
} }

View File

@@ -4,13 +4,15 @@ namespace PayPal\Api;
use PayPal\Common\PPModel; use PayPal\Common\PPModel;
use PayPal\Rest\ApiContext; use PayPal\Rest\ApiContext;
class InvoiceItem extends PPModel { class InvoiceItem extends PPModel
{
/** /**
* Name of the item. 60 characters max. * Name of the item. 60 characters max.
* *
* @param string $name * @param string $name
*/ */
public function setName($name) { public function setName($name)
{
$this->name = $name; $this->name = $name;
return $this; return $this;
} }
@@ -20,7 +22,8 @@ class InvoiceItem extends PPModel {
* *
* @return string * @return string
*/ */
public function getName() { public function getName()
{
return $this->name; return $this->name;
} }
@@ -30,7 +33,8 @@ class InvoiceItem extends PPModel {
* *
* @param string $description * @param string $description
*/ */
public function setDescription($description) { public function setDescription($description)
{
$this->description = $description; $this->description = $description;
return $this; return $this;
} }
@@ -40,7 +44,8 @@ class InvoiceItem extends PPModel {
* *
* @return string * @return string
*/ */
public function getDescription() { public function getDescription()
{
return $this->description; return $this->description;
} }
@@ -50,7 +55,8 @@ class InvoiceItem extends PPModel {
* *
* @param PayPal\Api\number $quantity * @param PayPal\Api\number $quantity
*/ */
public function setQuantity($quantity) { public function setQuantity($quantity)
{
$this->quantity = $quantity; $this->quantity = $quantity;
return $this; return $this;
} }
@@ -60,7 +66,8 @@ class InvoiceItem extends PPModel {
* *
* @return PayPal\Api\number * @return PayPal\Api\number
*/ */
public function getQuantity() { public function getQuantity()
{
return $this->quantity; return $this->quantity;
} }
@@ -70,7 +77,8 @@ class InvoiceItem extends PPModel {
* *
* @param PayPal\Api\Currency $unit_price * @param PayPal\Api\Currency $unit_price
*/ */
public function setUnitPrice($unit_price) { public function setUnitPrice($unit_price)
{
$this->unit_price = $unit_price; $this->unit_price = $unit_price;
return $this; return $this;
} }
@@ -80,7 +88,8 @@ class InvoiceItem extends PPModel {
* *
* @return PayPal\Api\Currency * @return PayPal\Api\Currency
*/ */
public function getUnitPrice() { public function getUnitPrice()
{
return $this->unit_price; return $this->unit_price;
} }
@@ -90,17 +99,20 @@ class InvoiceItem extends PPModel {
* @param PayPal\Api\Currency $unit_price * @param PayPal\Api\Currency $unit_price
* @deprecated. Instead use setUnitPrice * @deprecated. Instead use setUnitPrice
*/ */
public function setUnit_price($unit_price) { public function setUnit_price($unit_price)
{
$this->unit_price = $unit_price; $this->unit_price = $unit_price;
return $this; return $this;
} }
/** /**
* Unit price of the item. Range of -999999.99 to 999999.99. * Unit price of the item. Range of -999999.99 to 999999.99.
* *
* @return PayPal\Api\Currency * @return PayPal\Api\Currency
* @deprecated. Instead use getUnitPrice * @deprecated. Instead use getUnitPrice
*/ */
public function getUnit_price() { public function getUnit_price()
{
return $this->unit_price; return $this->unit_price;
} }
@@ -109,7 +121,8 @@ class InvoiceItem extends PPModel {
* *
* @param PayPal\Api\Tax $tax * @param PayPal\Api\Tax $tax
*/ */
public function setTax($tax) { public function setTax($tax)
{
$this->tax = $tax; $this->tax = $tax;
return $this; return $this;
} }
@@ -119,7 +132,8 @@ class InvoiceItem extends PPModel {
* *
* @return PayPal\Api\Tax * @return PayPal\Api\Tax
*/ */
public function getTax() { public function getTax()
{
return $this->tax; return $this->tax;
} }
@@ -129,7 +143,8 @@ class InvoiceItem extends PPModel {
* *
* @param string $date * @param string $date
*/ */
public function setDate($date) { public function setDate($date)
{
$this->date = $date; $this->date = $date;
return $this; return $this;
} }
@@ -139,7 +154,8 @@ class InvoiceItem extends PPModel {
* *
* @return string * @return string
*/ */
public function getDate() { public function getDate()
{
return $this->date; return $this->date;
} }
@@ -149,7 +165,8 @@ class InvoiceItem extends PPModel {
* *
* @param PayPal\Api\Cost $discount * @param PayPal\Api\Cost $discount
*/ */
public function setDiscount($discount) { public function setDiscount($discount)
{
$this->discount = $discount; $this->discount = $discount;
return $this; return $this;
} }
@@ -159,7 +176,8 @@ class InvoiceItem extends PPModel {
* *
* @return PayPal\Api\Cost * @return PayPal\Api\Cost
*/ */
public function getDiscount() { public function getDiscount()
{
return $this->discount; return $this->discount;
} }

View File

@@ -4,13 +4,15 @@ namespace PayPal\Api;
use PayPal\Common\PPModel; use PayPal\Common\PPModel;
use PayPal\Rest\ApiContext; use PayPal\Rest\ApiContext;
class Invoices extends PPModel { class Invoices extends PPModel
{
/** /**
* *
* *
* @param integer $total_count * @param integer $total_count
*/ */
public function setTotalCount($total_count) { public function setTotalCount($total_count)
{
$this->total_count = $total_count; $this->total_count = $total_count;
return $this; return $this;
} }
@@ -20,7 +22,8 @@ class Invoices extends PPModel {
* *
* @return integer * @return integer
*/ */
public function getTotalCount() { public function getTotalCount()
{
return $this->total_count; return $this->total_count;
} }
@@ -30,17 +33,20 @@ class Invoices extends PPModel {
* @param integer $total_count * @param integer $total_count
* @deprecated. Instead use setTotalCount * @deprecated. Instead use setTotalCount
*/ */
public function setTotal_count($total_count) { public function setTotal_count($total_count)
{
$this->total_count = $total_count; $this->total_count = $total_count;
return $this; return $this;
} }
/** /**
* *
* *
* @return integer * @return integer
* @deprecated. Instead use getTotalCount * @deprecated. Instead use getTotalCount
*/ */
public function getTotal_count() { public function getTotal_count()
{
return $this->total_count; return $this->total_count;
} }
@@ -49,7 +55,8 @@ class Invoices extends PPModel {
* *
* @param PayPal\Api\Invoice $invoices * @param PayPal\Api\Invoice $invoices
*/ */
public function setInvoices($invoices) { public function setInvoices($invoices)
{
$this->invoices = $invoices; $this->invoices = $invoices;
return $this; return $this;
} }
@@ -59,7 +66,8 @@ class Invoices extends PPModel {
* *
* @return PayPal\Api\Invoice * @return PayPal\Api\Invoice
*/ */
public function getInvoices() { public function getInvoices()
{
return $this->invoices; return $this->invoices;
} }

View File

@@ -4,13 +4,15 @@ namespace PayPal\Api;
use PayPal\Common\PPModel; use PayPal\Common\PPModel;
use PayPal\Rest\ApiContext; use PayPal\Rest\ApiContext;
class InvoicingMetaData extends PPModel { class InvoicingMetaData extends PPModel
{
/** /**
* Date when the resource was created. * Date when the resource was created.
* *
* @param string $created_date * @param string $created_date
*/ */
public function setCreatedDate($created_date) { public function setCreatedDate($created_date)
{
$this->created_date = $created_date; $this->created_date = $created_date;
return $this; return $this;
} }
@@ -20,7 +22,8 @@ class InvoicingMetaData extends PPModel {
* *
* @return string * @return string
*/ */
public function getCreatedDate() { public function getCreatedDate()
{
return $this->created_date; return $this->created_date;
} }
@@ -30,17 +33,20 @@ class InvoicingMetaData extends PPModel {
* @param string $created_date * @param string $created_date
* @deprecated. Instead use setCreatedDate * @deprecated. Instead use setCreatedDate
*/ */
public function setCreated_date($created_date) { public function setCreated_date($created_date)
{
$this->created_date = $created_date; $this->created_date = $created_date;
return $this; return $this;
} }
/** /**
* Date when the resource was created. * Date when the resource was created.
* *
* @return string * @return string
* @deprecated. Instead use getCreatedDate * @deprecated. Instead use getCreatedDate
*/ */
public function getCreated_date() { public function getCreated_date()
{
return $this->created_date; return $this->created_date;
} }
@@ -49,7 +55,8 @@ class InvoicingMetaData extends PPModel {
* *
* @param string $created_by * @param string $created_by
*/ */
public function setCreatedBy($created_by) { public function setCreatedBy($created_by)
{
$this->created_by = $created_by; $this->created_by = $created_by;
return $this; return $this;
} }
@@ -59,7 +66,8 @@ class InvoicingMetaData extends PPModel {
* *
* @return string * @return string
*/ */
public function getCreatedBy() { public function getCreatedBy()
{
return $this->created_by; return $this->created_by;
} }
@@ -69,17 +77,20 @@ class InvoicingMetaData extends PPModel {
* @param string $created_by * @param string $created_by
* @deprecated. Instead use setCreatedBy * @deprecated. Instead use setCreatedBy
*/ */
public function setCreated_by($created_by) { public function setCreated_by($created_by)
{
$this->created_by = $created_by; $this->created_by = $created_by;
return $this; return $this;
} }
/** /**
* Email address of the account that created the resource. * Email address of the account that created the resource.
* *
* @return string * @return string
* @deprecated. Instead use getCreatedBy * @deprecated. Instead use getCreatedBy
*/ */
public function getCreated_by() { public function getCreated_by()
{
return $this->created_by; return $this->created_by;
} }
@@ -88,7 +99,8 @@ class InvoicingMetaData extends PPModel {
* *
* @param string $cancelled_date * @param string $cancelled_date
*/ */
public function setCancelledDate($cancelled_date) { public function setCancelledDate($cancelled_date)
{
$this->cancelled_date = $cancelled_date; $this->cancelled_date = $cancelled_date;
return $this; return $this;
} }
@@ -98,7 +110,8 @@ class InvoicingMetaData extends PPModel {
* *
* @return string * @return string
*/ */
public function getCancelledDate() { public function getCancelledDate()
{
return $this->cancelled_date; return $this->cancelled_date;
} }
@@ -108,17 +121,20 @@ class InvoicingMetaData extends PPModel {
* @param string $cancelled_date * @param string $cancelled_date
* @deprecated. Instead use setCancelledDate * @deprecated. Instead use setCancelledDate
*/ */
public function setCancelled_date($cancelled_date) { public function setCancelled_date($cancelled_date)
{
$this->cancelled_date = $cancelled_date; $this->cancelled_date = $cancelled_date;
return $this; return $this;
} }
/** /**
* Date when the resource was cancelled. * Date when the resource was cancelled.
* *
* @return string * @return string
* @deprecated. Instead use getCancelledDate * @deprecated. Instead use getCancelledDate
*/ */
public function getCancelled_date() { public function getCancelled_date()
{
return $this->cancelled_date; return $this->cancelled_date;
} }
@@ -127,7 +143,8 @@ class InvoicingMetaData extends PPModel {
* *
* @param string $cancelled_by * @param string $cancelled_by
*/ */
public function setCancelledBy($cancelled_by) { public function setCancelledBy($cancelled_by)
{
$this->cancelled_by = $cancelled_by; $this->cancelled_by = $cancelled_by;
return $this; return $this;
} }
@@ -137,7 +154,8 @@ class InvoicingMetaData extends PPModel {
* *
* @return string * @return string
*/ */
public function getCancelledBy() { public function getCancelledBy()
{
return $this->cancelled_by; return $this->cancelled_by;
} }
@@ -147,17 +165,20 @@ class InvoicingMetaData extends PPModel {
* @param string $cancelled_by * @param string $cancelled_by
* @deprecated. Instead use setCancelledBy * @deprecated. Instead use setCancelledBy
*/ */
public function setCancelled_by($cancelled_by) { public function setCancelled_by($cancelled_by)
{
$this->cancelled_by = $cancelled_by; $this->cancelled_by = $cancelled_by;
return $this; return $this;
} }
/** /**
* Actor who cancelled the resource. * Actor who cancelled the resource.
* *
* @return string * @return string
* @deprecated. Instead use getCancelledBy * @deprecated. Instead use getCancelledBy
*/ */
public function getCancelled_by() { public function getCancelled_by()
{
return $this->cancelled_by; return $this->cancelled_by;
} }
@@ -166,7 +187,8 @@ class InvoicingMetaData extends PPModel {
* *
* @param string $last_updated_date * @param string $last_updated_date
*/ */
public function setLastUpdatedDate($last_updated_date) { public function setLastUpdatedDate($last_updated_date)
{
$this->last_updated_date = $last_updated_date; $this->last_updated_date = $last_updated_date;
return $this; return $this;
} }
@@ -176,7 +198,8 @@ class InvoicingMetaData extends PPModel {
* *
* @return string * @return string
*/ */
public function getLastUpdatedDate() { public function getLastUpdatedDate()
{
return $this->last_updated_date; return $this->last_updated_date;
} }
@@ -186,17 +209,20 @@ class InvoicingMetaData extends PPModel {
* @param string $last_updated_date * @param string $last_updated_date
* @deprecated. Instead use setLastUpdatedDate * @deprecated. Instead use setLastUpdatedDate
*/ */
public function setLast_updated_date($last_updated_date) { public function setLast_updated_date($last_updated_date)
{
$this->last_updated_date = $last_updated_date; $this->last_updated_date = $last_updated_date;
return $this; return $this;
} }
/** /**
* Date when the resource was last edited. * Date when the resource was last edited.
* *
* @return string * @return string
* @deprecated. Instead use getLastUpdatedDate * @deprecated. Instead use getLastUpdatedDate
*/ */
public function getLast_updated_date() { public function getLast_updated_date()
{
return $this->last_updated_date; return $this->last_updated_date;
} }
@@ -205,7 +231,8 @@ class InvoicingMetaData extends PPModel {
* *
* @param string $last_updated_by * @param string $last_updated_by
*/ */
public function setLastUpdatedBy($last_updated_by) { public function setLastUpdatedBy($last_updated_by)
{
$this->last_updated_by = $last_updated_by; $this->last_updated_by = $last_updated_by;
return $this; return $this;
} }
@@ -215,7 +242,8 @@ class InvoicingMetaData extends PPModel {
* *
* @return string * @return string
*/ */
public function getLastUpdatedBy() { public function getLastUpdatedBy()
{
return $this->last_updated_by; return $this->last_updated_by;
} }
@@ -225,17 +253,20 @@ class InvoicingMetaData extends PPModel {
* @param string $last_updated_by * @param string $last_updated_by
* @deprecated. Instead use setLastUpdatedBy * @deprecated. Instead use setLastUpdatedBy
*/ */
public function setLast_updated_by($last_updated_by) { public function setLast_updated_by($last_updated_by)
{
$this->last_updated_by = $last_updated_by; $this->last_updated_by = $last_updated_by;
return $this; return $this;
} }
/** /**
* Email address of the account that last edited the resource. * Email address of the account that last edited the resource.
* *
* @return string * @return string
* @deprecated. Instead use getLastUpdatedBy * @deprecated. Instead use getLastUpdatedBy
*/ */
public function getLast_updated_by() { public function getLast_updated_by()
{
return $this->last_updated_by; return $this->last_updated_by;
} }
@@ -244,7 +275,8 @@ class InvoicingMetaData extends PPModel {
* *
* @param string $first_sent_date * @param string $first_sent_date
*/ */
public function setFirstSentDate($first_sent_date) { public function setFirstSentDate($first_sent_date)
{
$this->first_sent_date = $first_sent_date; $this->first_sent_date = $first_sent_date;
return $this; return $this;
} }
@@ -254,7 +286,8 @@ class InvoicingMetaData extends PPModel {
* *
* @return string * @return string
*/ */
public function getFirstSentDate() { public function getFirstSentDate()
{
return $this->first_sent_date; return $this->first_sent_date;
} }
@@ -264,17 +297,20 @@ class InvoicingMetaData extends PPModel {
* @param string $first_sent_date * @param string $first_sent_date
* @deprecated. Instead use setFirstSentDate * @deprecated. Instead use setFirstSentDate
*/ */
public function setFirst_sent_date($first_sent_date) { public function setFirst_sent_date($first_sent_date)
{
$this->first_sent_date = $first_sent_date; $this->first_sent_date = $first_sent_date;
return $this; return $this;
} }
/** /**
* Date when the resource was first sent. * Date when the resource was first sent.
* *
* @return string * @return string
* @deprecated. Instead use getFirstSentDate * @deprecated. Instead use getFirstSentDate
*/ */
public function getFirst_sent_date() { public function getFirst_sent_date()
{
return $this->first_sent_date; return $this->first_sent_date;
} }
@@ -283,7 +319,8 @@ class InvoicingMetaData extends PPModel {
* *
* @param string $last_sent_date * @param string $last_sent_date
*/ */
public function setLastSentDate($last_sent_date) { public function setLastSentDate($last_sent_date)
{
$this->last_sent_date = $last_sent_date; $this->last_sent_date = $last_sent_date;
return $this; return $this;
} }
@@ -293,7 +330,8 @@ class InvoicingMetaData extends PPModel {
* *
* @return string * @return string
*/ */
public function getLastSentDate() { public function getLastSentDate()
{
return $this->last_sent_date; return $this->last_sent_date;
} }
@@ -303,17 +341,20 @@ class InvoicingMetaData extends PPModel {
* @param string $last_sent_date * @param string $last_sent_date
* @deprecated. Instead use setLastSentDate * @deprecated. Instead use setLastSentDate
*/ */
public function setLast_sent_date($last_sent_date) { public function setLast_sent_date($last_sent_date)
{
$this->last_sent_date = $last_sent_date; $this->last_sent_date = $last_sent_date;
return $this; return $this;
} }
/** /**
* Date when the resource was last sent. * Date when the resource was last sent.
* *
* @return string * @return string
* @deprecated. Instead use getLastSentDate * @deprecated. Instead use getLastSentDate
*/ */
public function getLast_sent_date() { public function getLast_sent_date()
{
return $this->last_sent_date; return $this->last_sent_date;
} }
@@ -322,7 +363,8 @@ class InvoicingMetaData extends PPModel {
* *
* @param string $last_sent_by * @param string $last_sent_by
*/ */
public function setLastSentBy($last_sent_by) { public function setLastSentBy($last_sent_by)
{
$this->last_sent_by = $last_sent_by; $this->last_sent_by = $last_sent_by;
return $this; return $this;
} }
@@ -332,7 +374,8 @@ class InvoicingMetaData extends PPModel {
* *
* @return string * @return string
*/ */
public function getLastSentBy() { public function getLastSentBy()
{
return $this->last_sent_by; return $this->last_sent_by;
} }
@@ -342,17 +385,20 @@ class InvoicingMetaData extends PPModel {
* @param string $last_sent_by * @param string $last_sent_by
* @deprecated. Instead use setLastSentBy * @deprecated. Instead use setLastSentBy
*/ */
public function setLast_sent_by($last_sent_by) { public function setLast_sent_by($last_sent_by)
{
$this->last_sent_by = $last_sent_by; $this->last_sent_by = $last_sent_by;
return $this; return $this;
} }
/** /**
* Email address of the account that last sent the resource. * Email address of the account that last sent the resource.
* *
* @return string * @return string
* @deprecated. Instead use getLastSentBy * @deprecated. Instead use getLastSentBy
*/ */
public function getLast_sent_by() { public function getLast_sent_by()
{
return $this->last_sent_by; return $this->last_sent_by;
} }

View File

@@ -4,13 +4,15 @@ namespace PayPal\Api;
use PayPal\Common\PPModel; use PayPal\Common\PPModel;
use PayPal\Rest\ApiContext; use PayPal\Rest\ApiContext;
class InvoicingNotification extends PPModel { class InvoicingNotification extends PPModel
{
/** /**
* Subject of the notification. * Subject of the notification.
* *
* @param string $subject * @param string $subject
*/ */
public function setSubject($subject) { public function setSubject($subject)
{
$this->subject = $subject; $this->subject = $subject;
return $this; return $this;
} }
@@ -20,7 +22,8 @@ class InvoicingNotification extends PPModel {
* *
* @return string * @return string
*/ */
public function getSubject() { public function getSubject()
{
return $this->subject; return $this->subject;
} }
@@ -30,7 +33,8 @@ class InvoicingNotification extends PPModel {
* *
* @param string $note * @param string $note
*/ */
public function setNote($note) { public function setNote($note)
{
$this->note = $note; $this->note = $note;
return $this; return $this;
} }
@@ -40,7 +44,8 @@ class InvoicingNotification extends PPModel {
* *
* @return string * @return string
*/ */
public function getNote() { public function getNote()
{
return $this->note; return $this->note;
} }
@@ -50,7 +55,8 @@ class InvoicingNotification extends PPModel {
* *
* @param boolean $send_to_merchant * @param boolean $send_to_merchant
*/ */
public function setSendToMerchant($send_to_merchant) { public function setSendToMerchant($send_to_merchant)
{
$this->send_to_merchant = $send_to_merchant; $this->send_to_merchant = $send_to_merchant;
return $this; return $this;
} }
@@ -60,7 +66,8 @@ class InvoicingNotification extends PPModel {
* *
* @return boolean * @return boolean
*/ */
public function getSendToMerchant() { public function getSendToMerchant()
{
return $this->send_to_merchant; return $this->send_to_merchant;
} }
@@ -70,17 +77,20 @@ class InvoicingNotification extends PPModel {
* @param boolean $send_to_merchant * @param boolean $send_to_merchant
* @deprecated. Instead use setSendToMerchant * @deprecated. Instead use setSendToMerchant
*/ */
public function setSend_to_merchant($send_to_merchant) { public function setSend_to_merchant($send_to_merchant)
{
$this->send_to_merchant = $send_to_merchant; $this->send_to_merchant = $send_to_merchant;
return $this; return $this;
} }
/** /**
* A flag indicating whether a copy of the email has to be sent to the merchant. * A flag indicating whether a copy of the email has to be sent to the merchant.
* *
* @return boolean * @return boolean
* @deprecated. Instead use getSendToMerchant * @deprecated. Instead use getSendToMerchant
*/ */
public function getSend_to_merchant() { public function getSend_to_merchant()
{
return $this->send_to_merchant; return $this->send_to_merchant;
} }

View File

@@ -4,13 +4,15 @@ namespace PayPal\Api;
use PayPal\Common\PPModel; use PayPal\Common\PPModel;
use PayPal\Rest\ApiContext; use PayPal\Rest\ApiContext;
class InvoicingPaymentDetail extends PPModel { class InvoicingPaymentDetail extends PPModel
{
/** /**
* 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. * 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.
* *
* @param string $type * @param string $type
*/ */
public function setType($type) { public function setType($type)
{
$this->type = $type; $this->type = $type;
return $this; return $this;
} }
@@ -20,7 +22,8 @@ class InvoicingPaymentDetail extends PPModel {
* *
* @return string * @return string
*/ */
public function getType() { public function getType()
{
return $this->type; return $this->type;
} }
@@ -30,7 +33,8 @@ class InvoicingPaymentDetail extends PPModel {
* *
* @param string $transaction_id * @param string $transaction_id
*/ */
public function setTransactionId($transaction_id) { public function setTransactionId($transaction_id)
{
$this->transaction_id = $transaction_id; $this->transaction_id = $transaction_id;
return $this; return $this;
} }
@@ -40,7 +44,8 @@ class InvoicingPaymentDetail extends PPModel {
* *
* @return string * @return string
*/ */
public function getTransactionId() { public function getTransactionId()
{
return $this->transaction_id; return $this->transaction_id;
} }
@@ -50,17 +55,20 @@ class InvoicingPaymentDetail extends PPModel {
* @param string $transaction_id * @param string $transaction_id
* @deprecated. Instead use setTransactionId * @deprecated. Instead use setTransactionId
*/ */
public function setTransaction_id($transaction_id) { public function setTransaction_id($transaction_id)
{
$this->transaction_id = $transaction_id; $this->transaction_id = $transaction_id;
return $this; return $this;
} }
/** /**
* PayPal payment transaction id. Mandatory field in case the type value is PAYPAL. * PayPal payment transaction id. Mandatory field in case the type value is PAYPAL.
* *
* @return string * @return string
* @deprecated. Instead use getTransactionId * @deprecated. Instead use getTransactionId
*/ */
public function getTransaction_id() { public function getTransaction_id()
{
return $this->transaction_id; return $this->transaction_id;
} }
@@ -69,7 +77,8 @@ class InvoicingPaymentDetail extends PPModel {
* *
* @param string $transaction_type * @param string $transaction_type
*/ */
public function setTransactionType($transaction_type) { public function setTransactionType($transaction_type)
{
$this->transaction_type = $transaction_type; $this->transaction_type = $transaction_type;
return $this; return $this;
} }
@@ -79,7 +88,8 @@ class InvoicingPaymentDetail extends PPModel {
* *
* @return string * @return string
*/ */
public function getTransactionType() { public function getTransactionType()
{
return $this->transaction_type; return $this->transaction_type;
} }
@@ -89,17 +99,20 @@ class InvoicingPaymentDetail extends PPModel {
* @param string $transaction_type * @param string $transaction_type
* @deprecated. Instead use setTransactionType * @deprecated. Instead use setTransactionType
*/ */
public function setTransaction_type($transaction_type) { public function setTransaction_type($transaction_type)
{
$this->transaction_type = $transaction_type; $this->transaction_type = $transaction_type;
return $this; return $this;
} }
/** /**
* Type of the transaction. * Type of the transaction.
* *
* @return string * @return string
* @deprecated. Instead use getTransactionType * @deprecated. Instead use getTransactionType
*/ */
public function getTransaction_type() { public function getTransaction_type()
{
return $this->transaction_type; return $this->transaction_type;
} }
@@ -108,7 +121,8 @@ class InvoicingPaymentDetail extends PPModel {
* *
* @param string $date * @param string $date
*/ */
public function setDate($date) { public function setDate($date)
{
$this->date = $date; $this->date = $date;
return $this; return $this;
} }
@@ -118,7 +132,8 @@ class InvoicingPaymentDetail extends PPModel {
* *
* @return string * @return string
*/ */
public function getDate() { public function getDate()
{
return $this->date; return $this->date;
} }
@@ -128,7 +143,8 @@ class InvoicingPaymentDetail extends PPModel {
* *
* @param string $method * @param string $method
*/ */
public function setMethod($method) { public function setMethod($method)
{
$this->method = $method; $this->method = $method;
return $this; return $this;
} }
@@ -138,7 +154,8 @@ class InvoicingPaymentDetail extends PPModel {
* *
* @return string * @return string
*/ */
public function getMethod() { public function getMethod()
{
return $this->method; return $this->method;
} }
@@ -148,7 +165,8 @@ class InvoicingPaymentDetail extends PPModel {
* *
* @param string $note * @param string $note
*/ */
public function setNote($note) { public function setNote($note)
{
$this->note = $note; $this->note = $note;
return $this; return $this;
} }
@@ -158,7 +176,8 @@ class InvoicingPaymentDetail extends PPModel {
* *
* @return string * @return string
*/ */
public function getNote() { public function getNote()
{
return $this->note; return $this->note;
} }

View File

@@ -4,13 +4,15 @@ namespace PayPal\Api;
use PayPal\Common\PPModel; use PayPal\Common\PPModel;
use PayPal\Rest\ApiContext; use PayPal\Rest\ApiContext;
class InvoicingRefundDetail extends PPModel { class InvoicingRefundDetail extends PPModel
{
/** /**
* PayPal refund type indicating whether refund was done in invoicing flow via PayPal or externally. In the case of the mark-as-refunded API, refund type is EXTERNAL and this is what is now supported. The PAYPAL value is provided for backward compatibility. * PayPal refund type indicating whether refund was done in invoicing flow via PayPal or externally. In the case of the mark-as-refunded API, refund type is EXTERNAL and this is what is now supported. The PAYPAL value is provided for backward compatibility.
* *
* @param string $type * @param string $type
*/ */
public function setType($type) { public function setType($type)
{
$this->type = $type; $this->type = $type;
return $this; return $this;
} }
@@ -20,7 +22,8 @@ class InvoicingRefundDetail extends PPModel {
* *
* @return string * @return string
*/ */
public function getType() { public function getType()
{
return $this->type; return $this->type;
} }
@@ -30,7 +33,8 @@ class InvoicingRefundDetail extends PPModel {
* *
* @param string $date * @param string $date
*/ */
public function setDate($date) { public function setDate($date)
{
$this->date = $date; $this->date = $date;
return $this; return $this;
} }
@@ -40,7 +44,8 @@ class InvoicingRefundDetail extends PPModel {
* *
* @return string * @return string
*/ */
public function getDate() { public function getDate()
{
return $this->date; return $this->date;
} }
@@ -50,7 +55,8 @@ class InvoicingRefundDetail extends PPModel {
* *
* @param string $note * @param string $note
*/ */
public function setNote($note) { public function setNote($note)
{
$this->note = $note; $this->note = $note;
return $this; return $this;
} }
@@ -60,7 +66,8 @@ class InvoicingRefundDetail extends PPModel {
* *
* @return string * @return string
*/ */
public function getNote() { public function getNote()
{
return $this->note; return $this->note;
} }

View File

@@ -4,13 +4,15 @@ namespace PayPal\Api;
use PayPal\Common\PPModel; use PayPal\Common\PPModel;
use PayPal\Rest\ApiContext; use PayPal\Rest\ApiContext;
class InvoicingSearch extends PPModel { class InvoicingSearch extends PPModel
{
/** /**
* Initial letters of the email address. * Initial letters of the email address.
* *
* @param string $email * @param string $email
*/ */
public function setEmail($email) { public function setEmail($email)
{
$this->email = $email; $this->email = $email;
return $this; return $this;
} }
@@ -20,7 +22,8 @@ class InvoicingSearch extends PPModel {
* *
* @return string * @return string
*/ */
public function getEmail() { public function getEmail()
{
return $this->email; return $this->email;
} }
@@ -30,7 +33,8 @@ class InvoicingSearch extends PPModel {
* *
* @param string $recipient_first_name * @param string $recipient_first_name
*/ */
public function setRecipientFirstName($recipient_first_name) { public function setRecipientFirstName($recipient_first_name)
{
$this->recipient_first_name = $recipient_first_name; $this->recipient_first_name = $recipient_first_name;
return $this; return $this;
} }
@@ -40,7 +44,8 @@ class InvoicingSearch extends PPModel {
* *
* @return string * @return string
*/ */
public function getRecipientFirstName() { public function getRecipientFirstName()
{
return $this->recipient_first_name; return $this->recipient_first_name;
} }
@@ -50,17 +55,20 @@ class InvoicingSearch extends PPModel {
* @param string $recipient_first_name * @param string $recipient_first_name
* @deprecated. Instead use setRecipientFirstName * @deprecated. Instead use setRecipientFirstName
*/ */
public function setRecipient_first_name($recipient_first_name) { public function setRecipient_first_name($recipient_first_name)
{
$this->recipient_first_name = $recipient_first_name; $this->recipient_first_name = $recipient_first_name;
return $this; return $this;
} }
/** /**
* Initial letters of the recipient's first name. * Initial letters of the recipient's first name.
* *
* @return string * @return string
* @deprecated. Instead use getRecipientFirstName * @deprecated. Instead use getRecipientFirstName
*/ */
public function getRecipient_first_name() { public function getRecipient_first_name()
{
return $this->recipient_first_name; return $this->recipient_first_name;
} }
@@ -69,7 +77,8 @@ class InvoicingSearch extends PPModel {
* *
* @param string $recipient_last_name * @param string $recipient_last_name
*/ */
public function setRecipientLastName($recipient_last_name) { public function setRecipientLastName($recipient_last_name)
{
$this->recipient_last_name = $recipient_last_name; $this->recipient_last_name = $recipient_last_name;
return $this; return $this;
} }
@@ -79,7 +88,8 @@ class InvoicingSearch extends PPModel {
* *
* @return string * @return string
*/ */
public function getRecipientLastName() { public function getRecipientLastName()
{
return $this->recipient_last_name; return $this->recipient_last_name;
} }
@@ -89,17 +99,20 @@ class InvoicingSearch extends PPModel {
* @param string $recipient_last_name * @param string $recipient_last_name
* @deprecated. Instead use setRecipientLastName * @deprecated. Instead use setRecipientLastName
*/ */
public function setRecipient_last_name($recipient_last_name) { public function setRecipient_last_name($recipient_last_name)
{
$this->recipient_last_name = $recipient_last_name; $this->recipient_last_name = $recipient_last_name;
return $this; return $this;
} }
/** /**
* Initial letters of the recipient's last name. * Initial letters of the recipient's last name.
* *
* @return string * @return string
* @deprecated. Instead use getRecipientLastName * @deprecated. Instead use getRecipientLastName
*/ */
public function getRecipient_last_name() { public function getRecipient_last_name()
{
return $this->recipient_last_name; return $this->recipient_last_name;
} }
@@ -108,7 +121,8 @@ class InvoicingSearch extends PPModel {
* *
* @param string $recipient_business_name * @param string $recipient_business_name
*/ */
public function setRecipientBusinessName($recipient_business_name) { public function setRecipientBusinessName($recipient_business_name)
{
$this->recipient_business_name = $recipient_business_name; $this->recipient_business_name = $recipient_business_name;
return $this; return $this;
} }
@@ -118,7 +132,8 @@ class InvoicingSearch extends PPModel {
* *
* @return string * @return string
*/ */
public function getRecipientBusinessName() { public function getRecipientBusinessName()
{
return $this->recipient_business_name; return $this->recipient_business_name;
} }
@@ -128,17 +143,20 @@ class InvoicingSearch extends PPModel {
* @param string $recipient_business_name * @param string $recipient_business_name
* @deprecated. Instead use setRecipientBusinessName * @deprecated. Instead use setRecipientBusinessName
*/ */
public function setRecipient_business_name($recipient_business_name) { public function setRecipient_business_name($recipient_business_name)
{
$this->recipient_business_name = $recipient_business_name; $this->recipient_business_name = $recipient_business_name;
return $this; return $this;
} }
/** /**
* Initial letters of the recipient's business name. * Initial letters of the recipient's business name.
* *
* @return string * @return string
* @deprecated. Instead use getRecipientBusinessName * @deprecated. Instead use getRecipientBusinessName
*/ */
public function getRecipient_business_name() { public function getRecipient_business_name()
{
return $this->recipient_business_name; return $this->recipient_business_name;
} }
@@ -147,7 +165,8 @@ class InvoicingSearch extends PPModel {
* *
* @param string $number * @param string $number
*/ */
public function setNumber($number) { public function setNumber($number)
{
$this->number = $number; $this->number = $number;
return $this; return $this;
} }
@@ -157,7 +176,8 @@ class InvoicingSearch extends PPModel {
* *
* @return string * @return string
*/ */
public function getNumber() { public function getNumber()
{
return $this->number; return $this->number;
} }
@@ -167,7 +187,8 @@ class InvoicingSearch extends PPModel {
* *
* @param string $status * @param string $status
*/ */
public function setStatus($status) { public function setStatus($status)
{
$this->status = $status; $this->status = $status;
return $this; return $this;
} }
@@ -177,7 +198,8 @@ class InvoicingSearch extends PPModel {
* *
* @return string * @return string
*/ */
public function getStatus() { public function getStatus()
{
return $this->status; return $this->status;
} }
@@ -187,7 +209,8 @@ class InvoicingSearch extends PPModel {
* *
* @param PayPal\Api\Currency $lower_total_amount * @param PayPal\Api\Currency $lower_total_amount
*/ */
public function setLowerTotalAmount($lower_total_amount) { public function setLowerTotalAmount($lower_total_amount)
{
$this->lower_total_amount = $lower_total_amount; $this->lower_total_amount = $lower_total_amount;
return $this; return $this;
} }
@@ -197,7 +220,8 @@ class InvoicingSearch extends PPModel {
* *
* @return PayPal\Api\Currency * @return PayPal\Api\Currency
*/ */
public function getLowerTotalAmount() { public function getLowerTotalAmount()
{
return $this->lower_total_amount; return $this->lower_total_amount;
} }
@@ -207,17 +231,20 @@ class InvoicingSearch extends PPModel {
* @param PayPal\Api\Currency $lower_total_amount * @param PayPal\Api\Currency $lower_total_amount
* @deprecated. Instead use setLowerTotalAmount * @deprecated. Instead use setLowerTotalAmount
*/ */
public function setLower_total_amount($lower_total_amount) { public function setLower_total_amount($lower_total_amount)
{
$this->lower_total_amount = $lower_total_amount; $this->lower_total_amount = $lower_total_amount;
return $this; return $this;
} }
/** /**
* Lower limit of total amount. * Lower limit of total amount.
* *
* @return PayPal\Api\Currency * @return PayPal\Api\Currency
* @deprecated. Instead use getLowerTotalAmount * @deprecated. Instead use getLowerTotalAmount
*/ */
public function getLower_total_amount() { public function getLower_total_amount()
{
return $this->lower_total_amount; return $this->lower_total_amount;
} }
@@ -226,7 +253,8 @@ class InvoicingSearch extends PPModel {
* *
* @param PayPal\Api\Currency $upper_total_amount * @param PayPal\Api\Currency $upper_total_amount
*/ */
public function setUpperTotalAmount($upper_total_amount) { public function setUpperTotalAmount($upper_total_amount)
{
$this->upper_total_amount = $upper_total_amount; $this->upper_total_amount = $upper_total_amount;
return $this; return $this;
} }
@@ -236,7 +264,8 @@ class InvoicingSearch extends PPModel {
* *
* @return PayPal\Api\Currency * @return PayPal\Api\Currency
*/ */
public function getUpperTotalAmount() { public function getUpperTotalAmount()
{
return $this->upper_total_amount; return $this->upper_total_amount;
} }
@@ -246,17 +275,20 @@ class InvoicingSearch extends PPModel {
* @param PayPal\Api\Currency $upper_total_amount * @param PayPal\Api\Currency $upper_total_amount
* @deprecated. Instead use setUpperTotalAmount * @deprecated. Instead use setUpperTotalAmount
*/ */
public function setUpper_total_amount($upper_total_amount) { public function setUpper_total_amount($upper_total_amount)
{
$this->upper_total_amount = $upper_total_amount; $this->upper_total_amount = $upper_total_amount;
return $this; return $this;
} }
/** /**
* Upper limit of total amount. * Upper limit of total amount.
* *
* @return PayPal\Api\Currency * @return PayPal\Api\Currency
* @deprecated. Instead use getUpperTotalAmount * @deprecated. Instead use getUpperTotalAmount
*/ */
public function getUpper_total_amount() { public function getUpper_total_amount()
{
return $this->upper_total_amount; return $this->upper_total_amount;
} }
@@ -265,7 +297,8 @@ class InvoicingSearch extends PPModel {
* *
* @param string $start_invoice_date * @param string $start_invoice_date
*/ */
public function setStartInvoiceDate($start_invoice_date) { public function setStartInvoiceDate($start_invoice_date)
{
$this->start_invoice_date = $start_invoice_date; $this->start_invoice_date = $start_invoice_date;
return $this; return $this;
} }
@@ -275,7 +308,8 @@ class InvoicingSearch extends PPModel {
* *
* @return string * @return string
*/ */
public function getStartInvoiceDate() { public function getStartInvoiceDate()
{
return $this->start_invoice_date; return $this->start_invoice_date;
} }
@@ -285,17 +319,20 @@ class InvoicingSearch extends PPModel {
* @param string $start_invoice_date * @param string $start_invoice_date
* @deprecated. Instead use setStartInvoiceDate * @deprecated. Instead use setStartInvoiceDate
*/ */
public function setStart_invoice_date($start_invoice_date) { public function setStart_invoice_date($start_invoice_date)
{
$this->start_invoice_date = $start_invoice_date; $this->start_invoice_date = $start_invoice_date;
return $this; return $this;
} }
/** /**
* Start invoice date. * Start invoice date.
* *
* @return string * @return string
* @deprecated. Instead use getStartInvoiceDate * @deprecated. Instead use getStartInvoiceDate
*/ */
public function getStart_invoice_date() { public function getStart_invoice_date()
{
return $this->start_invoice_date; return $this->start_invoice_date;
} }
@@ -304,7 +341,8 @@ class InvoicingSearch extends PPModel {
* *
* @param string $end_invoice_date * @param string $end_invoice_date
*/ */
public function setEndInvoiceDate($end_invoice_date) { public function setEndInvoiceDate($end_invoice_date)
{
$this->end_invoice_date = $end_invoice_date; $this->end_invoice_date = $end_invoice_date;
return $this; return $this;
} }
@@ -314,7 +352,8 @@ class InvoicingSearch extends PPModel {
* *
* @return string * @return string
*/ */
public function getEndInvoiceDate() { public function getEndInvoiceDate()
{
return $this->end_invoice_date; return $this->end_invoice_date;
} }
@@ -324,17 +363,20 @@ class InvoicingSearch extends PPModel {
* @param string $end_invoice_date * @param string $end_invoice_date
* @deprecated. Instead use setEndInvoiceDate * @deprecated. Instead use setEndInvoiceDate
*/ */
public function setEnd_invoice_date($end_invoice_date) { public function setEnd_invoice_date($end_invoice_date)
{
$this->end_invoice_date = $end_invoice_date; $this->end_invoice_date = $end_invoice_date;
return $this; return $this;
} }
/** /**
* End invoice date. * End invoice date.
* *
* @return string * @return string
* @deprecated. Instead use getEndInvoiceDate * @deprecated. Instead use getEndInvoiceDate
*/ */
public function getEnd_invoice_date() { public function getEnd_invoice_date()
{
return $this->end_invoice_date; return $this->end_invoice_date;
} }
@@ -343,7 +385,8 @@ class InvoicingSearch extends PPModel {
* *
* @param string $start_due_date * @param string $start_due_date
*/ */
public function setStartDueDate($start_due_date) { public function setStartDueDate($start_due_date)
{
$this->start_due_date = $start_due_date; $this->start_due_date = $start_due_date;
return $this; return $this;
} }
@@ -353,7 +396,8 @@ class InvoicingSearch extends PPModel {
* *
* @return string * @return string
*/ */
public function getStartDueDate() { public function getStartDueDate()
{
return $this->start_due_date; return $this->start_due_date;
} }
@@ -363,17 +407,20 @@ class InvoicingSearch extends PPModel {
* @param string $start_due_date * @param string $start_due_date
* @deprecated. Instead use setStartDueDate * @deprecated. Instead use setStartDueDate
*/ */
public function setStart_due_date($start_due_date) { public function setStart_due_date($start_due_date)
{
$this->start_due_date = $start_due_date; $this->start_due_date = $start_due_date;
return $this; return $this;
} }
/** /**
* Start invoice due date. * Start invoice due date.
* *
* @return string * @return string
* @deprecated. Instead use getStartDueDate * @deprecated. Instead use getStartDueDate
*/ */
public function getStart_due_date() { public function getStart_due_date()
{
return $this->start_due_date; return $this->start_due_date;
} }
@@ -382,7 +429,8 @@ class InvoicingSearch extends PPModel {
* *
* @param string $end_due_date * @param string $end_due_date
*/ */
public function setEndDueDate($end_due_date) { public function setEndDueDate($end_due_date)
{
$this->end_due_date = $end_due_date; $this->end_due_date = $end_due_date;
return $this; return $this;
} }
@@ -392,7 +440,8 @@ class InvoicingSearch extends PPModel {
* *
* @return string * @return string
*/ */
public function getEndDueDate() { public function getEndDueDate()
{
return $this->end_due_date; return $this->end_due_date;
} }
@@ -402,17 +451,20 @@ class InvoicingSearch extends PPModel {
* @param string $end_due_date * @param string $end_due_date
* @deprecated. Instead use setEndDueDate * @deprecated. Instead use setEndDueDate
*/ */
public function setEnd_due_date($end_due_date) { public function setEnd_due_date($end_due_date)
{
$this->end_due_date = $end_due_date; $this->end_due_date = $end_due_date;
return $this; return $this;
} }
/** /**
* End invoice due date. * End invoice due date.
* *
* @return string * @return string
* @deprecated. Instead use getEndDueDate * @deprecated. Instead use getEndDueDate
*/ */
public function getEnd_due_date() { public function getEnd_due_date()
{
return $this->end_due_date; return $this->end_due_date;
} }
@@ -421,7 +473,8 @@ class InvoicingSearch extends PPModel {
* *
* @param string $start_payment_date * @param string $start_payment_date
*/ */
public function setStartPaymentDate($start_payment_date) { public function setStartPaymentDate($start_payment_date)
{
$this->start_payment_date = $start_payment_date; $this->start_payment_date = $start_payment_date;
return $this; return $this;
} }
@@ -431,7 +484,8 @@ class InvoicingSearch extends PPModel {
* *
* @return string * @return string
*/ */
public function getStartPaymentDate() { public function getStartPaymentDate()
{
return $this->start_payment_date; return $this->start_payment_date;
} }
@@ -441,17 +495,20 @@ class InvoicingSearch extends PPModel {
* @param string $start_payment_date * @param string $start_payment_date
* @deprecated. Instead use setStartPaymentDate * @deprecated. Instead use setStartPaymentDate
*/ */
public function setStart_payment_date($start_payment_date) { public function setStart_payment_date($start_payment_date)
{
$this->start_payment_date = $start_payment_date; $this->start_payment_date = $start_payment_date;
return $this; return $this;
} }
/** /**
* Start invoice payment date. * Start invoice payment date.
* *
* @return string * @return string
* @deprecated. Instead use getStartPaymentDate * @deprecated. Instead use getStartPaymentDate
*/ */
public function getStart_payment_date() { public function getStart_payment_date()
{
return $this->start_payment_date; return $this->start_payment_date;
} }
@@ -460,7 +517,8 @@ class InvoicingSearch extends PPModel {
* *
* @param string $end_payment_date * @param string $end_payment_date
*/ */
public function setEndPaymentDate($end_payment_date) { public function setEndPaymentDate($end_payment_date)
{
$this->end_payment_date = $end_payment_date; $this->end_payment_date = $end_payment_date;
return $this; return $this;
} }
@@ -470,7 +528,8 @@ class InvoicingSearch extends PPModel {
* *
* @return string * @return string
*/ */
public function getEndPaymentDate() { public function getEndPaymentDate()
{
return $this->end_payment_date; return $this->end_payment_date;
} }
@@ -480,17 +539,20 @@ class InvoicingSearch extends PPModel {
* @param string $end_payment_date * @param string $end_payment_date
* @deprecated. Instead use setEndPaymentDate * @deprecated. Instead use setEndPaymentDate
*/ */
public function setEnd_payment_date($end_payment_date) { public function setEnd_payment_date($end_payment_date)
{
$this->end_payment_date = $end_payment_date; $this->end_payment_date = $end_payment_date;
return $this; return $this;
} }
/** /**
* End invoice payment date. * End invoice payment date.
* *
* @return string * @return string
* @deprecated. Instead use getEndPaymentDate * @deprecated. Instead use getEndPaymentDate
*/ */
public function getEnd_payment_date() { public function getEnd_payment_date()
{
return $this->end_payment_date; return $this->end_payment_date;
} }
@@ -499,7 +561,8 @@ class InvoicingSearch extends PPModel {
* *
* @param string $start_creation_date * @param string $start_creation_date
*/ */
public function setStartCreationDate($start_creation_date) { public function setStartCreationDate($start_creation_date)
{
$this->start_creation_date = $start_creation_date; $this->start_creation_date = $start_creation_date;
return $this; return $this;
} }
@@ -509,7 +572,8 @@ class InvoicingSearch extends PPModel {
* *
* @return string * @return string
*/ */
public function getStartCreationDate() { public function getStartCreationDate()
{
return $this->start_creation_date; return $this->start_creation_date;
} }
@@ -519,17 +583,20 @@ class InvoicingSearch extends PPModel {
* @param string $start_creation_date * @param string $start_creation_date
* @deprecated. Instead use setStartCreationDate * @deprecated. Instead use setStartCreationDate
*/ */
public function setStart_creation_date($start_creation_date) { public function setStart_creation_date($start_creation_date)
{
$this->start_creation_date = $start_creation_date; $this->start_creation_date = $start_creation_date;
return $this; return $this;
} }
/** /**
* Start invoice creation date. * Start invoice creation date.
* *
* @return string * @return string
* @deprecated. Instead use getStartCreationDate * @deprecated. Instead use getStartCreationDate
*/ */
public function getStart_creation_date() { public function getStart_creation_date()
{
return $this->start_creation_date; return $this->start_creation_date;
} }
@@ -538,7 +605,8 @@ class InvoicingSearch extends PPModel {
* *
* @param string $end_creation_date * @param string $end_creation_date
*/ */
public function setEndCreationDate($end_creation_date) { public function setEndCreationDate($end_creation_date)
{
$this->end_creation_date = $end_creation_date; $this->end_creation_date = $end_creation_date;
return $this; return $this;
} }
@@ -548,7 +616,8 @@ class InvoicingSearch extends PPModel {
* *
* @return string * @return string
*/ */
public function getEndCreationDate() { public function getEndCreationDate()
{
return $this->end_creation_date; return $this->end_creation_date;
} }
@@ -558,17 +627,20 @@ class InvoicingSearch extends PPModel {
* @param string $end_creation_date * @param string $end_creation_date
* @deprecated. Instead use setEndCreationDate * @deprecated. Instead use setEndCreationDate
*/ */
public function setEnd_creation_date($end_creation_date) { public function setEnd_creation_date($end_creation_date)
{
$this->end_creation_date = $end_creation_date; $this->end_creation_date = $end_creation_date;
return $this; return $this;
} }
/** /**
* End invoice creation date. * End invoice creation date.
* *
* @return string * @return string
* @deprecated. Instead use getEndCreationDate * @deprecated. Instead use getEndCreationDate
*/ */
public function getEnd_creation_date() { public function getEnd_creation_date()
{
return $this->end_creation_date; return $this->end_creation_date;
} }
@@ -577,7 +649,8 @@ class InvoicingSearch extends PPModel {
* *
* @param PayPal\Api\number $page * @param PayPal\Api\number $page
*/ */
public function setPage($page) { public function setPage($page)
{
$this->page = $page; $this->page = $page;
return $this; return $this;
} }
@@ -587,7 +660,8 @@ class InvoicingSearch extends PPModel {
* *
* @return PayPal\Api\number * @return PayPal\Api\number
*/ */
public function getPage() { public function getPage()
{
return $this->page; return $this->page;
} }
@@ -597,7 +671,8 @@ class InvoicingSearch extends PPModel {
* *
* @param PayPal\Api\number $page_size * @param PayPal\Api\number $page_size
*/ */
public function setPageSize($page_size) { public function setPageSize($page_size)
{
$this->page_size = $page_size; $this->page_size = $page_size;
return $this; return $this;
} }
@@ -607,7 +682,8 @@ class InvoicingSearch extends PPModel {
* *
* @return PayPal\Api\number * @return PayPal\Api\number
*/ */
public function getPageSize() { public function getPageSize()
{
return $this->page_size; return $this->page_size;
} }
@@ -617,17 +693,20 @@ class InvoicingSearch extends PPModel {
* @param PayPal\Api\number $page_size * @param PayPal\Api\number $page_size
* @deprecated. Instead use setPageSize * @deprecated. Instead use setPageSize
*/ */
public function setPage_size($page_size) { public function setPage_size($page_size)
{
$this->page_size = $page_size; $this->page_size = $page_size;
return $this; return $this;
} }
/** /**
* Page size of the search results. * Page size of the search results.
* *
* @return PayPal\Api\number * @return PayPal\Api\number
* @deprecated. Instead use getPageSize * @deprecated. Instead use getPageSize
*/ */
public function getPage_size() { public function getPage_size()
{
return $this->page_size; return $this->page_size;
} }
@@ -636,7 +715,8 @@ class InvoicingSearch extends PPModel {
* *
* @param boolean $total_count_required * @param boolean $total_count_required
*/ */
public function setTotalCountRequired($total_count_required) { public function setTotalCountRequired($total_count_required)
{
$this->total_count_required = $total_count_required; $this->total_count_required = $total_count_required;
return $this; return $this;
} }
@@ -646,7 +726,8 @@ class InvoicingSearch extends PPModel {
* *
* @return boolean * @return boolean
*/ */
public function getTotalCountRequired() { public function getTotalCountRequired()
{
return $this->total_count_required; return $this->total_count_required;
} }
@@ -656,17 +737,20 @@ class InvoicingSearch extends PPModel {
* @param boolean $total_count_required * @param boolean $total_count_required
* @deprecated. Instead use setTotalCountRequired * @deprecated. Instead use setTotalCountRequired
*/ */
public function setTotal_count_required($total_count_required) { public function setTotal_count_required($total_count_required)
{
$this->total_count_required = $total_count_required; $this->total_count_required = $total_count_required;
return $this; return $this;
} }
/** /**
* A flag indicating whether total count is required in the response. * A flag indicating whether total count is required in the response.
* *
* @return boolean * @return boolean
* @deprecated. Instead use getTotalCountRequired * @deprecated. Instead use getTotalCountRequired
*/ */
public function getTotal_count_required() { public function getTotal_count_required()
{
return $this->total_count_required; return $this->total_count_required;
} }

View File

@@ -156,7 +156,8 @@ class Item extends PPModel
* *
* @return $this * @return $this
*/ */
public function setDescription($description) { public function setDescription($description)
{
$this->description = $description; $this->description = $description;
return $this; return $this;
@@ -168,7 +169,8 @@ class Item extends PPModel
* *
* @return string * @return string
*/ */
public function getDescription() { public function getDescription()
{
return $this->description; return $this->description;
} }
@@ -180,7 +182,8 @@ class Item extends PPModel
* *
* @return $this * @return $this
*/ */
public function setTax($tax) { public function setTax($tax)
{
$this->tax = $tax; $this->tax = $tax;
return $this; return $this;
@@ -192,7 +195,8 @@ class Item extends PPModel
* *
* @return string * @return string
*/ */
public function getTax() { public function getTax()
{
return $this->tax; return $this->tax;
} }
} }

View File

@@ -17,14 +17,16 @@ class ItemList extends PPModel
/** /**
* Construct an empty list. * Construct an empty list.
*/ */
function __construct() { function __construct()
{
$this->items = array(); $this->items = array();
} }
/** /**
* Is this list empty? * Is this list empty?
*/ */
public function isEmpty() { public function isEmpty()
{
return empty($this->items); return empty($this->items);
} }
@@ -69,9 +71,11 @@ class ItemList extends PPModel
/** /**
* Append an item to the list. * Append an item to the list.
*
* @return PayPal\Api\Item * @return PayPal\Api\Item
*/ */
public function addItem($item) { public function addItem($item)
{
return $this->setItems( return $this->setItems(
array_merge($this->items, array($item)) array_merge($this->items, array($item))
); );
@@ -80,9 +84,11 @@ class ItemList extends PPModel
/** /**
* Remove an item from the list. * Remove an item from the list.
* Items are compared using === comparision (PHP.net) * Items are compared using === comparision (PHP.net)
*
* @return PayPal\Api\Item * @return PayPal\Api\Item
*/ */
public function removeItem($item) { public function removeItem($item)
{
return $this->setItems( return $this->setItems(
array_diff($this->items, array($item)) array_diff($this->items, array($item))
); );

View File

@@ -4,13 +4,15 @@ namespace PayPal\Api;
use PayPal\Common\PPModel; use PayPal\Common\PPModel;
use PayPal\Rest\ApiContext; use PayPal\Rest\ApiContext;
class MerchantInfo extends PPModel { class MerchantInfo extends PPModel
{
/** /**
* Email address of the merchant. 260 characters max. * Email address of the merchant. 260 characters max.
* *
* @param string $email * @param string $email
*/ */
public function setEmail($email) { public function setEmail($email)
{
$this->email = $email; $this->email = $email;
return $this; return $this;
} }
@@ -20,7 +22,8 @@ class MerchantInfo extends PPModel {
* *
* @return string * @return string
*/ */
public function getEmail() { public function getEmail()
{
return $this->email; return $this->email;
} }
@@ -30,7 +33,8 @@ class MerchantInfo extends PPModel {
* *
* @param string $first_name * @param string $first_name
*/ */
public function setFirstName($first_name) { public function setFirstName($first_name)
{
$this->first_name = $first_name; $this->first_name = $first_name;
return $this; return $this;
} }
@@ -40,7 +44,8 @@ class MerchantInfo extends PPModel {
* *
* @return string * @return string
*/ */
public function getFirstName() { public function getFirstName()
{
return $this->first_name; return $this->first_name;
} }
@@ -50,17 +55,20 @@ class MerchantInfo extends PPModel {
* @param string $first_name * @param string $first_name
* @deprecated. Instead use setFirstName * @deprecated. Instead use setFirstName
*/ */
public function setFirst_name($first_name) { public function setFirst_name($first_name)
{
$this->first_name = $first_name; $this->first_name = $first_name;
return $this; return $this;
} }
/** /**
* First name of the merchant. 30 characters max. * First name of the merchant. 30 characters max.
* *
* @return string * @return string
* @deprecated. Instead use getFirstName * @deprecated. Instead use getFirstName
*/ */
public function getFirst_name() { public function getFirst_name()
{
return $this->first_name; return $this->first_name;
} }
@@ -69,7 +77,8 @@ class MerchantInfo extends PPModel {
* *
* @param string $last_name * @param string $last_name
*/ */
public function setLastName($last_name) { public function setLastName($last_name)
{
$this->last_name = $last_name; $this->last_name = $last_name;
return $this; return $this;
} }
@@ -79,7 +88,8 @@ class MerchantInfo extends PPModel {
* *
* @return string * @return string
*/ */
public function getLastName() { public function getLastName()
{
return $this->last_name; return $this->last_name;
} }
@@ -89,17 +99,20 @@ class MerchantInfo extends PPModel {
* @param string $last_name * @param string $last_name
* @deprecated. Instead use setLastName * @deprecated. Instead use setLastName
*/ */
public function setLast_name($last_name) { public function setLast_name($last_name)
{
$this->last_name = $last_name; $this->last_name = $last_name;
return $this; return $this;
} }
/** /**
* Last name of the merchant. 30 characters max. * Last name of the merchant. 30 characters max.
* *
* @return string * @return string
* @deprecated. Instead use getLastName * @deprecated. Instead use getLastName
*/ */
public function getLast_name() { public function getLast_name()
{
return $this->last_name; return $this->last_name;
} }
@@ -108,7 +121,8 @@ class MerchantInfo extends PPModel {
* *
* @param PayPal\Api\Address $address * @param PayPal\Api\Address $address
*/ */
public function setAddress($address) { public function setAddress($address)
{
$this->address = $address; $this->address = $address;
return $this; return $this;
} }
@@ -118,7 +132,8 @@ class MerchantInfo extends PPModel {
* *
* @return PayPal\Api\Address * @return PayPal\Api\Address
*/ */
public function getAddress() { public function getAddress()
{
return $this->address; return $this->address;
} }
@@ -128,7 +143,8 @@ class MerchantInfo extends PPModel {
* *
* @param string $business_name * @param string $business_name
*/ */
public function setBusinessName($business_name) { public function setBusinessName($business_name)
{
$this->business_name = $business_name; $this->business_name = $business_name;
return $this; return $this;
} }
@@ -138,7 +154,8 @@ class MerchantInfo extends PPModel {
* *
* @return string * @return string
*/ */
public function getBusinessName() { public function getBusinessName()
{
return $this->business_name; return $this->business_name;
} }
@@ -148,17 +165,20 @@ class MerchantInfo extends PPModel {
* @param string $business_name * @param string $business_name
* @deprecated. Instead use setBusinessName * @deprecated. Instead use setBusinessName
*/ */
public function setBusiness_name($business_name) { public function setBusiness_name($business_name)
{
$this->business_name = $business_name; $this->business_name = $business_name;
return $this; return $this;
} }
/** /**
* Company business name of the merchant. 100 characters max. * Company business name of the merchant. 100 characters max.
* *
* @return string * @return string
* @deprecated. Instead use getBusinessName * @deprecated. Instead use getBusinessName
*/ */
public function getBusiness_name() { public function getBusiness_name()
{
return $this->business_name; return $this->business_name;
} }
@@ -167,7 +187,8 @@ class MerchantInfo extends PPModel {
* *
* @param PayPal\Api\Phone $phone * @param PayPal\Api\Phone $phone
*/ */
public function setPhone($phone) { public function setPhone($phone)
{
$this->phone = $phone; $this->phone = $phone;
return $this; return $this;
} }
@@ -177,7 +198,8 @@ class MerchantInfo extends PPModel {
* *
* @return PayPal\Api\Phone * @return PayPal\Api\Phone
*/ */
public function getPhone() { public function getPhone()
{
return $this->phone; return $this->phone;
} }
@@ -187,7 +209,8 @@ class MerchantInfo extends PPModel {
* *
* @param PayPal\Api\Phone $fax * @param PayPal\Api\Phone $fax
*/ */
public function setFax($fax) { public function setFax($fax)
{
$this->fax = $fax; $this->fax = $fax;
return $this; return $this;
} }
@@ -197,7 +220,8 @@ class MerchantInfo extends PPModel {
* *
* @return PayPal\Api\Phone * @return PayPal\Api\Phone
*/ */
public function getFax() { public function getFax()
{
return $this->fax; return $this->fax;
} }
@@ -207,7 +231,8 @@ class MerchantInfo extends PPModel {
* *
* @param string $website * @param string $website
*/ */
public function setWebsite($website) { public function setWebsite($website)
{
$this->website = $website; $this->website = $website;
return $this; return $this;
} }
@@ -217,7 +242,8 @@ class MerchantInfo extends PPModel {
* *
* @return string * @return string
*/ */
public function getWebsite() { public function getWebsite()
{
return $this->website; return $this->website;
} }
@@ -227,7 +253,8 @@ class MerchantInfo extends PPModel {
* *
* @param string $tax_id * @param string $tax_id
*/ */
public function setTaxId($tax_id) { public function setTaxId($tax_id)
{
$this->tax_id = $tax_id; $this->tax_id = $tax_id;
return $this; return $this;
} }
@@ -237,7 +264,8 @@ class MerchantInfo extends PPModel {
* *
* @return string * @return string
*/ */
public function getTaxId() { public function getTaxId()
{
return $this->tax_id; return $this->tax_id;
} }
@@ -247,17 +275,20 @@ class MerchantInfo extends PPModel {
* @param string $tax_id * @param string $tax_id
* @deprecated. Instead use setTaxId * @deprecated. Instead use setTaxId
*/ */
public function setTax_id($tax_id) { public function setTax_id($tax_id)
{
$this->tax_id = $tax_id; $this->tax_id = $tax_id;
return $this; return $this;
} }
/** /**
* Tax ID of the merchant. 100 characters max. * Tax ID of the merchant. 100 characters max.
* *
* @return string * @return string
* @deprecated. Instead use getTaxId * @deprecated. Instead use getTaxId
*/ */
public function getTax_id() { public function getTax_id()
{
return $this->tax_id; return $this->tax_id;
} }
@@ -266,7 +297,8 @@ class MerchantInfo extends PPModel {
* *
* @param string $additional_info * @param string $additional_info
*/ */
public function setAdditionalInfo($additional_info) { public function setAdditionalInfo($additional_info)
{
$this->additional_info = $additional_info; $this->additional_info = $additional_info;
return $this; return $this;
} }
@@ -276,7 +308,8 @@ class MerchantInfo extends PPModel {
* *
* @return string * @return string
*/ */
public function getAdditionalInfo() { public function getAdditionalInfo()
{
return $this->additional_info; return $this->additional_info;
} }
@@ -286,17 +319,20 @@ class MerchantInfo extends PPModel {
* @param string $additional_info * @param string $additional_info
* @deprecated. Instead use setAdditionalInfo * @deprecated. Instead use setAdditionalInfo
*/ */
public function setAdditional_info($additional_info) { public function setAdditional_info($additional_info)
{
$this->additional_info = $additional_info; $this->additional_info = $additional_info;
return $this; return $this;
} }
/** /**
* Option to display additional information such as business hours. 40 characters max. * Option to display additional information such as business hours. 40 characters max.
* *
* @return string * @return string
* @deprecated. Instead use getAdditionalInfo * @deprecated. Instead use getAdditionalInfo
*/ */
public function getAdditional_info() { public function getAdditional_info()
{
return $this->additional_info; return $this->additional_info;
} }

View File

@@ -4,13 +4,15 @@ namespace PayPal\Api;
use PayPal\Common\PPModel; use PayPal\Common\PPModel;
use PayPal\Rest\ApiContext; use PayPal\Rest\ApiContext;
class Metadata extends PPModel { class Metadata extends PPModel
{
/** /**
* Date when the resource was created. * Date when the resource was created.
* *
* @param string $created_date * @param string $created_date
*/ */
public function setCreatedDate($created_date) { public function setCreatedDate($created_date)
{
$this->created_date = $created_date; $this->created_date = $created_date;
return $this; return $this;
} }
@@ -20,7 +22,8 @@ class Metadata extends PPModel {
* *
* @return string * @return string
*/ */
public function getCreatedDate() { public function getCreatedDate()
{
return $this->created_date; return $this->created_date;
} }
@@ -30,17 +33,20 @@ class Metadata extends PPModel {
* @param string $created_date * @param string $created_date
* @deprecated. Instead use setCreatedDate * @deprecated. Instead use setCreatedDate
*/ */
public function setCreated_date($created_date) { public function setCreated_date($created_date)
{
$this->created_date = $created_date; $this->created_date = $created_date;
return $this; return $this;
} }
/** /**
* Date when the resource was created. * Date when the resource was created.
* *
* @return string * @return string
* @deprecated. Instead use getCreatedDate * @deprecated. Instead use getCreatedDate
*/ */
public function getCreated_date() { public function getCreated_date()
{
return $this->created_date; return $this->created_date;
} }
@@ -49,7 +55,8 @@ class Metadata extends PPModel {
* *
* @param string $created_by * @param string $created_by
*/ */
public function setCreatedBy($created_by) { public function setCreatedBy($created_by)
{
$this->created_by = $created_by; $this->created_by = $created_by;
return $this; return $this;
} }
@@ -59,7 +66,8 @@ class Metadata extends PPModel {
* *
* @return string * @return string
*/ */
public function getCreatedBy() { public function getCreatedBy()
{
return $this->created_by; return $this->created_by;
} }
@@ -69,17 +77,20 @@ class Metadata extends PPModel {
* @param string $created_by * @param string $created_by
* @deprecated. Instead use setCreatedBy * @deprecated. Instead use setCreatedBy
*/ */
public function setCreated_by($created_by) { public function setCreated_by($created_by)
{
$this->created_by = $created_by; $this->created_by = $created_by;
return $this; return $this;
} }
/** /**
* Email address of the account that created the resource. * Email address of the account that created the resource.
* *
* @return string * @return string
* @deprecated. Instead use getCreatedBy * @deprecated. Instead use getCreatedBy
*/ */
public function getCreated_by() { public function getCreated_by()
{
return $this->created_by; return $this->created_by;
} }
@@ -88,7 +99,8 @@ class Metadata extends PPModel {
* *
* @param string $cancelled_date * @param string $cancelled_date
*/ */
public function setCancelledDate($cancelled_date) { public function setCancelledDate($cancelled_date)
{
$this->cancelled_date = $cancelled_date; $this->cancelled_date = $cancelled_date;
return $this; return $this;
} }
@@ -98,7 +110,8 @@ class Metadata extends PPModel {
* *
* @return string * @return string
*/ */
public function getCancelledDate() { public function getCancelledDate()
{
return $this->cancelled_date; return $this->cancelled_date;
} }
@@ -108,17 +121,20 @@ class Metadata extends PPModel {
* @param string $cancelled_date * @param string $cancelled_date
* @deprecated. Instead use setCancelledDate * @deprecated. Instead use setCancelledDate
*/ */
public function setCancelled_date($cancelled_date) { public function setCancelled_date($cancelled_date)
{
$this->cancelled_date = $cancelled_date; $this->cancelled_date = $cancelled_date;
return $this; return $this;
} }
/** /**
* Date when the resource was cancelled. * Date when the resource was cancelled.
* *
* @return string * @return string
* @deprecated. Instead use getCancelledDate * @deprecated. Instead use getCancelledDate
*/ */
public function getCancelled_date() { public function getCancelled_date()
{
return $this->cancelled_date; return $this->cancelled_date;
} }
@@ -127,7 +143,8 @@ class Metadata extends PPModel {
* *
* @param string $cancelled_by * @param string $cancelled_by
*/ */
public function setCancelledBy($cancelled_by) { public function setCancelledBy($cancelled_by)
{
$this->cancelled_by = $cancelled_by; $this->cancelled_by = $cancelled_by;
return $this; return $this;
} }
@@ -137,7 +154,8 @@ class Metadata extends PPModel {
* *
* @return string * @return string
*/ */
public function getCancelledBy() { public function getCancelledBy()
{
return $this->cancelled_by; return $this->cancelled_by;
} }
@@ -147,17 +165,20 @@ class Metadata extends PPModel {
* @param string $cancelled_by * @param string $cancelled_by
* @deprecated. Instead use setCancelledBy * @deprecated. Instead use setCancelledBy
*/ */
public function setCancelled_by($cancelled_by) { public function setCancelled_by($cancelled_by)
{
$this->cancelled_by = $cancelled_by; $this->cancelled_by = $cancelled_by;
return $this; return $this;
} }
/** /**
* Actor who cancelled the resource. * Actor who cancelled the resource.
* *
* @return string * @return string
* @deprecated. Instead use getCancelledBy * @deprecated. Instead use getCancelledBy
*/ */
public function getCancelled_by() { public function getCancelled_by()
{
return $this->cancelled_by; return $this->cancelled_by;
} }
@@ -166,7 +187,8 @@ class Metadata extends PPModel {
* *
* @param string $last_updated_date * @param string $last_updated_date
*/ */
public function setLastUpdatedDate($last_updated_date) { public function setLastUpdatedDate($last_updated_date)
{
$this->last_updated_date = $last_updated_date; $this->last_updated_date = $last_updated_date;
return $this; return $this;
} }
@@ -176,7 +198,8 @@ class Metadata extends PPModel {
* *
* @return string * @return string
*/ */
public function getLastUpdatedDate() { public function getLastUpdatedDate()
{
return $this->last_updated_date; return $this->last_updated_date;
} }
@@ -186,17 +209,20 @@ class Metadata extends PPModel {
* @param string $last_updated_date * @param string $last_updated_date
* @deprecated. Instead use setLastUpdatedDate * @deprecated. Instead use setLastUpdatedDate
*/ */
public function setLast_updated_date($last_updated_date) { public function setLast_updated_date($last_updated_date)
{
$this->last_updated_date = $last_updated_date; $this->last_updated_date = $last_updated_date;
return $this; return $this;
} }
/** /**
* Date when the resource was last edited. * Date when the resource was last edited.
* *
* @return string * @return string
* @deprecated. Instead use getLastUpdatedDate * @deprecated. Instead use getLastUpdatedDate
*/ */
public function getLast_updated_date() { public function getLast_updated_date()
{
return $this->last_updated_date; return $this->last_updated_date;
} }
@@ -205,7 +231,8 @@ class Metadata extends PPModel {
* *
* @param string $last_updated_by * @param string $last_updated_by
*/ */
public function setLastUpdatedBy($last_updated_by) { public function setLastUpdatedBy($last_updated_by)
{
$this->last_updated_by = $last_updated_by; $this->last_updated_by = $last_updated_by;
return $this; return $this;
} }
@@ -215,7 +242,8 @@ class Metadata extends PPModel {
* *
* @return string * @return string
*/ */
public function getLastUpdatedBy() { public function getLastUpdatedBy()
{
return $this->last_updated_by; return $this->last_updated_by;
} }
@@ -225,17 +253,20 @@ class Metadata extends PPModel {
* @param string $last_updated_by * @param string $last_updated_by
* @deprecated. Instead use setLastUpdatedBy * @deprecated. Instead use setLastUpdatedBy
*/ */
public function setLast_updated_by($last_updated_by) { public function setLast_updated_by($last_updated_by)
{
$this->last_updated_by = $last_updated_by; $this->last_updated_by = $last_updated_by;
return $this; return $this;
} }
/** /**
* Email address of the account that last edited the resource. * Email address of the account that last edited the resource.
* *
* @return string * @return string
* @deprecated. Instead use getLastUpdatedBy * @deprecated. Instead use getLastUpdatedBy
*/ */
public function getLast_updated_by() { public function getLast_updated_by()
{
return $this->last_updated_by; return $this->last_updated_by;
} }
@@ -244,7 +275,8 @@ class Metadata extends PPModel {
* *
* @param string $first_sent_date * @param string $first_sent_date
*/ */
public function setFirstSentDate($first_sent_date) { public function setFirstSentDate($first_sent_date)
{
$this->first_sent_date = $first_sent_date; $this->first_sent_date = $first_sent_date;
return $this; return $this;
} }
@@ -254,7 +286,8 @@ class Metadata extends PPModel {
* *
* @return string * @return string
*/ */
public function getFirstSentDate() { public function getFirstSentDate()
{
return $this->first_sent_date; return $this->first_sent_date;
} }
@@ -264,17 +297,20 @@ class Metadata extends PPModel {
* @param string $first_sent_date * @param string $first_sent_date
* @deprecated. Instead use setFirstSentDate * @deprecated. Instead use setFirstSentDate
*/ */
public function setFirst_sent_date($first_sent_date) { public function setFirst_sent_date($first_sent_date)
{
$this->first_sent_date = $first_sent_date; $this->first_sent_date = $first_sent_date;
return $this; return $this;
} }
/** /**
* Date when the resource was first sent. * Date when the resource was first sent.
* *
* @return string * @return string
* @deprecated. Instead use getFirstSentDate * @deprecated. Instead use getFirstSentDate
*/ */
public function getFirst_sent_date() { public function getFirst_sent_date()
{
return $this->first_sent_date; return $this->first_sent_date;
} }
@@ -283,7 +319,8 @@ class Metadata extends PPModel {
* *
* @param string $last_sent_date * @param string $last_sent_date
*/ */
public function setLastSentDate($last_sent_date) { public function setLastSentDate($last_sent_date)
{
$this->last_sent_date = $last_sent_date; $this->last_sent_date = $last_sent_date;
return $this; return $this;
} }
@@ -293,7 +330,8 @@ class Metadata extends PPModel {
* *
* @return string * @return string
*/ */
public function getLastSentDate() { public function getLastSentDate()
{
return $this->last_sent_date; return $this->last_sent_date;
} }
@@ -303,17 +341,20 @@ class Metadata extends PPModel {
* @param string $last_sent_date * @param string $last_sent_date
* @deprecated. Instead use setLastSentDate * @deprecated. Instead use setLastSentDate
*/ */
public function setLast_sent_date($last_sent_date) { public function setLast_sent_date($last_sent_date)
{
$this->last_sent_date = $last_sent_date; $this->last_sent_date = $last_sent_date;
return $this; return $this;
} }
/** /**
* Date when the resource was last sent. * Date when the resource was last sent.
* *
* @return string * @return string
* @deprecated. Instead use getLastSentDate * @deprecated. Instead use getLastSentDate
*/ */
public function getLast_sent_date() { public function getLast_sent_date()
{
return $this->last_sent_date; return $this->last_sent_date;
} }
@@ -322,7 +363,8 @@ class Metadata extends PPModel {
* *
* @param string $last_sent_by * @param string $last_sent_by
*/ */
public function setLastSentBy($last_sent_by) { public function setLastSentBy($last_sent_by)
{
$this->last_sent_by = $last_sent_by; $this->last_sent_by = $last_sent_by;
return $this; return $this;
} }
@@ -332,7 +374,8 @@ class Metadata extends PPModel {
* *
* @return string * @return string
*/ */
public function getLastSentBy() { public function getLastSentBy()
{
return $this->last_sent_by; return $this->last_sent_by;
} }
@@ -342,17 +385,20 @@ class Metadata extends PPModel {
* @param string $last_sent_by * @param string $last_sent_by
* @deprecated. Instead use setLastSentBy * @deprecated. Instead use setLastSentBy
*/ */
public function setLast_sent_by($last_sent_by) { public function setLast_sent_by($last_sent_by)
{
$this->last_sent_by = $last_sent_by; $this->last_sent_by = $last_sent_by;
return $this; return $this;
} }
/** /**
* Email address of the account that last sent the resource. * Email address of the account that last sent the resource.
* *
* @return string * @return string
* @deprecated. Instead use getLastSentBy * @deprecated. Instead use getLastSentBy
*/ */
public function getLast_sent_by() { public function getLast_sent_by()
{
return $this->last_sent_by; return $this->last_sent_by;
} }

View File

@@ -4,13 +4,15 @@ namespace PayPal\Api;
use PayPal\Common\PPModel; use PayPal\Common\PPModel;
use PayPal\Rest\ApiContext; use PayPal\Rest\ApiContext;
class Notification extends PPModel { class Notification extends PPModel
{
/** /**
* Subject of the notification. * Subject of the notification.
* *
* @param string $subject * @param string $subject
*/ */
public function setSubject($subject) { public function setSubject($subject)
{
$this->subject = $subject; $this->subject = $subject;
return $this; return $this;
} }
@@ -20,7 +22,8 @@ class Notification extends PPModel {
* *
* @return string * @return string
*/ */
public function getSubject() { public function getSubject()
{
return $this->subject; return $this->subject;
} }
@@ -30,7 +33,8 @@ class Notification extends PPModel {
* *
* @param string $note * @param string $note
*/ */
public function setNote($note) { public function setNote($note)
{
$this->note = $note; $this->note = $note;
return $this; return $this;
} }
@@ -40,7 +44,8 @@ class Notification extends PPModel {
* *
* @return string * @return string
*/ */
public function getNote() { public function getNote()
{
return $this->note; return $this->note;
} }
@@ -50,7 +55,8 @@ class Notification extends PPModel {
* *
* @param boolean $send_to_merchant * @param boolean $send_to_merchant
*/ */
public function setSendToMerchant($send_to_merchant) { public function setSendToMerchant($send_to_merchant)
{
$this->send_to_merchant = $send_to_merchant; $this->send_to_merchant = $send_to_merchant;
return $this; return $this;
} }
@@ -60,7 +66,8 @@ class Notification extends PPModel {
* *
* @return boolean * @return boolean
*/ */
public function getSendToMerchant() { public function getSendToMerchant()
{
return $this->send_to_merchant; return $this->send_to_merchant;
} }
@@ -70,17 +77,20 @@ class Notification extends PPModel {
* @param boolean $send_to_merchant * @param boolean $send_to_merchant
* @deprecated. Instead use setSendToMerchant * @deprecated. Instead use setSendToMerchant
*/ */
public function setSend_to_merchant($send_to_merchant) { public function setSend_to_merchant($send_to_merchant)
{
$this->send_to_merchant = $send_to_merchant; $this->send_to_merchant = $send_to_merchant;
return $this; return $this;
} }
/** /**
* A flag indicating whether a copy of the email has to be sent to the merchant. * A flag indicating whether a copy of the email has to be sent to the merchant.
* *
* @return boolean * @return boolean
* @deprecated. Instead use getSendToMerchant * @deprecated. Instead use getSendToMerchant
*/ */
public function getSend_to_merchant() { public function getSend_to_merchant()
{
return $this->send_to_merchant; return $this->send_to_merchant;
} }

View File

@@ -4,13 +4,15 @@ namespace PayPal\Api;
use PayPal\Common\PPModel; use PayPal\Common\PPModel;
use PayPal\Rest\ApiContext; use PayPal\Rest\ApiContext;
class PaymentDetail extends PPModel { class PaymentDetail extends PPModel
{
/** /**
* 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. * 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.
* *
* @param string $type * @param string $type
*/ */
public function setType($type) { public function setType($type)
{
$this->type = $type; $this->type = $type;
return $this; return $this;
} }
@@ -20,7 +22,8 @@ class PaymentDetail extends PPModel {
* *
* @return string * @return string
*/ */
public function getType() { public function getType()
{
return $this->type; return $this->type;
} }
@@ -30,7 +33,8 @@ class PaymentDetail extends PPModel {
* *
* @param string $transaction_id * @param string $transaction_id
*/ */
public function setTransactionId($transaction_id) { public function setTransactionId($transaction_id)
{
$this->transaction_id = $transaction_id; $this->transaction_id = $transaction_id;
return $this; return $this;
} }
@@ -40,7 +44,8 @@ class PaymentDetail extends PPModel {
* *
* @return string * @return string
*/ */
public function getTransactionId() { public function getTransactionId()
{
return $this->transaction_id; return $this->transaction_id;
} }
@@ -50,17 +55,20 @@ class PaymentDetail extends PPModel {
* @param string $transaction_id * @param string $transaction_id
* @deprecated. Instead use setTransactionId * @deprecated. Instead use setTransactionId
*/ */
public function setTransaction_id($transaction_id) { public function setTransaction_id($transaction_id)
{
$this->transaction_id = $transaction_id; $this->transaction_id = $transaction_id;
return $this; return $this;
} }
/** /**
* PayPal payment transaction id. Mandatory field in case the type value is PAYPAL. * PayPal payment transaction id. Mandatory field in case the type value is PAYPAL.
* *
* @return string * @return string
* @deprecated. Instead use getTransactionId * @deprecated. Instead use getTransactionId
*/ */
public function getTransaction_id() { public function getTransaction_id()
{
return $this->transaction_id; return $this->transaction_id;
} }
@@ -69,7 +77,8 @@ class PaymentDetail extends PPModel {
* *
* @param string $transaction_type * @param string $transaction_type
*/ */
public function setTransactionType($transaction_type) { public function setTransactionType($transaction_type)
{
$this->transaction_type = $transaction_type; $this->transaction_type = $transaction_type;
return $this; return $this;
} }
@@ -79,7 +88,8 @@ class PaymentDetail extends PPModel {
* *
* @return string * @return string
*/ */
public function getTransactionType() { public function getTransactionType()
{
return $this->transaction_type; return $this->transaction_type;
} }
@@ -89,17 +99,20 @@ class PaymentDetail extends PPModel {
* @param string $transaction_type * @param string $transaction_type
* @deprecated. Instead use setTransactionType * @deprecated. Instead use setTransactionType
*/ */
public function setTransaction_type($transaction_type) { public function setTransaction_type($transaction_type)
{
$this->transaction_type = $transaction_type; $this->transaction_type = $transaction_type;
return $this; return $this;
} }
/** /**
* Type of the transaction. * Type of the transaction.
* *
* @return string * @return string
* @deprecated. Instead use getTransactionType * @deprecated. Instead use getTransactionType
*/ */
public function getTransaction_type() { public function getTransaction_type()
{
return $this->transaction_type; return $this->transaction_type;
} }
@@ -108,7 +121,8 @@ class PaymentDetail extends PPModel {
* *
* @param string $date * @param string $date
*/ */
public function setDate($date) { public function setDate($date)
{
$this->date = $date; $this->date = $date;
return $this; return $this;
} }
@@ -118,7 +132,8 @@ class PaymentDetail extends PPModel {
* *
* @return string * @return string
*/ */
public function getDate() { public function getDate()
{
return $this->date; return $this->date;
} }
@@ -128,7 +143,8 @@ class PaymentDetail extends PPModel {
* *
* @param string $method * @param string $method
*/ */
public function setMethod($method) { public function setMethod($method)
{
$this->method = $method; $this->method = $method;
return $this; return $this;
} }
@@ -138,7 +154,8 @@ class PaymentDetail extends PPModel {
* *
* @return string * @return string
*/ */
public function getMethod() { public function getMethod()
{
return $this->method; return $this->method;
} }
@@ -148,7 +165,8 @@ class PaymentDetail extends PPModel {
* *
* @param string $note * @param string $note
*/ */
public function setNote($note) { public function setNote($note)
{
$this->note = $note; $this->note = $note;
return $this; return $this;
} }
@@ -158,7 +176,8 @@ class PaymentDetail extends PPModel {
* *
* @return string * @return string
*/ */
public function getNote() { public function getNote()
{
return $this->note; return $this->note;
} }

View File

@@ -4,13 +4,15 @@ namespace PayPal\Api;
use PayPal\Common\PPModel; use PayPal\Common\PPModel;
use PayPal\Rest\ApiContext; use PayPal\Rest\ApiContext;
class PaymentTerm extends PPModel { class PaymentTerm extends PPModel
{
/** /**
* Terms by which the invoice payment is due. * Terms by which the invoice payment is due.
* *
* @param string $term_type * @param string $term_type
*/ */
public function setTermType($term_type) { public function setTermType($term_type)
{
$this->term_type = $term_type; $this->term_type = $term_type;
return $this; return $this;
} }
@@ -20,7 +22,8 @@ class PaymentTerm extends PPModel {
* *
* @return string * @return string
*/ */
public function getTermType() { public function getTermType()
{
return $this->term_type; return $this->term_type;
} }
@@ -30,17 +33,20 @@ class PaymentTerm extends PPModel {
* @param string $term_type * @param string $term_type
* @deprecated. Instead use setTermType * @deprecated. Instead use setTermType
*/ */
public function setTerm_type($term_type) { public function setTerm_type($term_type)
{
$this->term_type = $term_type; $this->term_type = $term_type;
return $this; return $this;
} }
/** /**
* Terms by which the invoice payment is due. * Terms by which the invoice payment is due.
* *
* @return string * @return string
* @deprecated. Instead use getTermType * @deprecated. Instead use getTermType
*/ */
public function getTerm_type() { public function getTerm_type()
{
return $this->term_type; return $this->term_type;
} }
@@ -49,7 +55,8 @@ class PaymentTerm extends PPModel {
* *
* @param string $due_date * @param string $due_date
*/ */
public function setDueDate($due_date) { public function setDueDate($due_date)
{
$this->due_date = $due_date; $this->due_date = $due_date;
return $this; return $this;
} }
@@ -59,7 +66,8 @@ class PaymentTerm extends PPModel {
* *
* @return string * @return string
*/ */
public function getDueDate() { public function getDueDate()
{
return $this->due_date; return $this->due_date;
} }
@@ -69,17 +77,20 @@ class PaymentTerm extends PPModel {
* @param string $due_date * @param string $due_date
* @deprecated. Instead use setDueDate * @deprecated. Instead use setDueDate
*/ */
public function setDue_date($due_date) { public function setDue_date($due_date)
{
$this->due_date = $due_date; $this->due_date = $due_date;
return $this; return $this;
} }
/** /**
* Date on which invoice payment is due. It must be always a future date. Date format: yyyy-MM-dd z. For example, 2014-02-27 PST * Date on which invoice payment is due. It must be always a future date. Date format: yyyy-MM-dd z. For example, 2014-02-27 PST
* *
* @return string * @return string
* @deprecated. Instead use getDueDate * @deprecated. Instead use getDueDate
*/ */
public function getDue_date() { public function getDue_date()
{
return $this->due_date; return $this->due_date;
} }

View File

@@ -4,13 +4,15 @@ namespace PayPal\Api;
use PayPal\Common\PPModel; use PayPal\Common\PPModel;
use PayPal\Rest\ApiContext; use PayPal\Rest\ApiContext;
class Phone extends PPModel { class Phone extends PPModel
{
/** /**
* Country code (in E.164 format). Assume length is n. * Country code (in E.164 format). Assume length is n.
* *
* @param string $country_code * @param string $country_code
*/ */
public function setCountryCode($country_code) { public function setCountryCode($country_code)
{
$this->country_code = $country_code; $this->country_code = $country_code;
return $this; return $this;
} }
@@ -20,7 +22,8 @@ class Phone extends PPModel {
* *
* @return string * @return string
*/ */
public function getCountryCode() { public function getCountryCode()
{
return $this->country_code; return $this->country_code;
} }
@@ -30,17 +33,20 @@ class Phone extends PPModel {
* @param string $country_code * @param string $country_code
* @deprecated. Instead use setCountryCode * @deprecated. Instead use setCountryCode
*/ */
public function setCountry_code($country_code) { public function setCountry_code($country_code)
{
$this->country_code = $country_code; $this->country_code = $country_code;
return $this; return $this;
} }
/** /**
* Country code (in E.164 format). Assume length is n. * Country code (in E.164 format). Assume length is n.
* *
* @return string * @return string
* @deprecated. Instead use getCountryCode * @deprecated. Instead use getCountryCode
*/ */
public function getCountry_code() { public function getCountry_code()
{
return $this->country_code; return $this->country_code;
} }
@@ -49,7 +55,8 @@ class Phone extends PPModel {
* *
* @param string $national_number * @param string $national_number
*/ */
public function setNationalNumber($national_number) { public function setNationalNumber($national_number)
{
$this->national_number = $national_number; $this->national_number = $national_number;
return $this; return $this;
} }
@@ -59,7 +66,8 @@ class Phone extends PPModel {
* *
* @return string * @return string
*/ */
public function getNationalNumber() { public function getNationalNumber()
{
return $this->national_number; return $this->national_number;
} }
@@ -69,17 +77,20 @@ class Phone extends PPModel {
* @param string $national_number * @param string $national_number
* @deprecated. Instead use setNationalNumber * @deprecated. Instead use setNationalNumber
*/ */
public function setNational_number($national_number) { public function setNational_number($national_number)
{
$this->national_number = $national_number; $this->national_number = $national_number;
return $this; return $this;
} }
/** /**
* In-country phone number (in E.164 format). Maximum (15 - n) digits. * In-country phone number (in E.164 format). Maximum (15 - n) digits.
* *
* @return string * @return string
* @deprecated. Instead use getNationalNumber * @deprecated. Instead use getNationalNumber
*/ */
public function getNational_number() { public function getNational_number()
{
return $this->national_number; return $this->national_number;
} }

View File

@@ -23,8 +23,7 @@ class RedirectUrls extends PPModel
*/ */
public function setReturnUrl($return_url) public function setReturnUrl($return_url)
{ {
if(filter_var($return_url, FILTER_VALIDATE_URL) === false) if (filter_var($return_url, FILTER_VALIDATE_URL) === false) {
{
throw new \InvalidArgumentException("Return URL is not a fully qualified URL"); throw new \InvalidArgumentException("Return URL is not a fully qualified URL");
} }
@@ -84,8 +83,7 @@ class RedirectUrls extends PPModel
*/ */
public function setCancelUrl($cancel_url) public function setCancelUrl($cancel_url)
{ {
if(filter_var($cancel_url, FILTER_VALIDATE_URL) === false) if (filter_var($cancel_url, FILTER_VALIDATE_URL) === false) {
{
throw new \InvalidArgumentException("Cancel URL is not a fully qualified URL"); throw new \InvalidArgumentException("Cancel URL is not a fully qualified URL");
} }
$this->cancel_url = $cancel_url; $this->cancel_url = $cancel_url;

View File

@@ -4,13 +4,15 @@ namespace PayPal\Api;
use PayPal\Common\PPModel; use PayPal\Common\PPModel;
use PayPal\Rest\ApiContext; use PayPal\Rest\ApiContext;
class RefundDetail extends PPModel { class RefundDetail extends PPModel
{
/** /**
* PayPal refund type indicating whether refund was done in invoicing flow via PayPal or externally. In the case of the mark-as-refunded API, refund type is EXTERNAL and this is what is now supported. The PAYPAL value is provided for backward compatibility. * PayPal refund type indicating whether refund was done in invoicing flow via PayPal or externally. In the case of the mark-as-refunded API, refund type is EXTERNAL and this is what is now supported. The PAYPAL value is provided for backward compatibility.
* *
* @param string $type * @param string $type
*/ */
public function setType($type) { public function setType($type)
{
$this->type = $type; $this->type = $type;
return $this; return $this;
} }
@@ -20,7 +22,8 @@ class RefundDetail extends PPModel {
* *
* @return string * @return string
*/ */
public function getType() { public function getType()
{
return $this->type; return $this->type;
} }
@@ -30,7 +33,8 @@ class RefundDetail extends PPModel {
* *
* @param string $date * @param string $date
*/ */
public function setDate($date) { public function setDate($date)
{
$this->date = $date; $this->date = $date;
return $this; return $this;
} }
@@ -40,7 +44,8 @@ class RefundDetail extends PPModel {
* *
* @return string * @return string
*/ */
public function getDate() { public function getDate()
{
return $this->date; return $this->date;
} }
@@ -50,7 +55,8 @@ class RefundDetail extends PPModel {
* *
* @param string $note * @param string $note
*/ */
public function setNote($note) { public function setNote($note)
{
$this->note = $note; $this->note = $note;
return $this; return $this;
} }
@@ -60,7 +66,8 @@ class RefundDetail extends PPModel {
* *
* @return string * @return string
*/ */
public function getNote() { public function getNote()
{
return $this->note; return $this->note;
} }

View File

@@ -4,13 +4,15 @@ namespace PayPal\Api;
use PayPal\Common\PPModel; use PayPal\Common\PPModel;
use PayPal\Rest\ApiContext; use PayPal\Rest\ApiContext;
class Search extends PPModel { class Search extends PPModel
{
/** /**
* Initial letters of the email address. * Initial letters of the email address.
* *
* @param string $email * @param string $email
*/ */
public function setEmail($email) { public function setEmail($email)
{
$this->email = $email; $this->email = $email;
return $this; return $this;
} }
@@ -20,7 +22,8 @@ class Search extends PPModel {
* *
* @return string * @return string
*/ */
public function getEmail() { public function getEmail()
{
return $this->email; return $this->email;
} }
@@ -30,7 +33,8 @@ class Search extends PPModel {
* *
* @param string $recipient_first_name * @param string $recipient_first_name
*/ */
public function setRecipientFirstName($recipient_first_name) { public function setRecipientFirstName($recipient_first_name)
{
$this->recipient_first_name = $recipient_first_name; $this->recipient_first_name = $recipient_first_name;
return $this; return $this;
} }
@@ -40,7 +44,8 @@ class Search extends PPModel {
* *
* @return string * @return string
*/ */
public function getRecipientFirstName() { public function getRecipientFirstName()
{
return $this->recipient_first_name; return $this->recipient_first_name;
} }
@@ -50,17 +55,20 @@ class Search extends PPModel {
* @param string $recipient_first_name * @param string $recipient_first_name
* @deprecated. Instead use setRecipientFirstName * @deprecated. Instead use setRecipientFirstName
*/ */
public function setRecipient_first_name($recipient_first_name) { public function setRecipient_first_name($recipient_first_name)
{
$this->recipient_first_name = $recipient_first_name; $this->recipient_first_name = $recipient_first_name;
return $this; return $this;
} }
/** /**
* Initial letters of the recipient's first name. * Initial letters of the recipient's first name.
* *
* @return string * @return string
* @deprecated. Instead use getRecipientFirstName * @deprecated. Instead use getRecipientFirstName
*/ */
public function getRecipient_first_name() { public function getRecipient_first_name()
{
return $this->recipient_first_name; return $this->recipient_first_name;
} }
@@ -69,7 +77,8 @@ class Search extends PPModel {
* *
* @param string $recipient_last_name * @param string $recipient_last_name
*/ */
public function setRecipientLastName($recipient_last_name) { public function setRecipientLastName($recipient_last_name)
{
$this->recipient_last_name = $recipient_last_name; $this->recipient_last_name = $recipient_last_name;
return $this; return $this;
} }
@@ -79,7 +88,8 @@ class Search extends PPModel {
* *
* @return string * @return string
*/ */
public function getRecipientLastName() { public function getRecipientLastName()
{
return $this->recipient_last_name; return $this->recipient_last_name;
} }
@@ -89,17 +99,20 @@ class Search extends PPModel {
* @param string $recipient_last_name * @param string $recipient_last_name
* @deprecated. Instead use setRecipientLastName * @deprecated. Instead use setRecipientLastName
*/ */
public function setRecipient_last_name($recipient_last_name) { public function setRecipient_last_name($recipient_last_name)
{
$this->recipient_last_name = $recipient_last_name; $this->recipient_last_name = $recipient_last_name;
return $this; return $this;
} }
/** /**
* Initial letters of the recipient's last name. * Initial letters of the recipient's last name.
* *
* @return string * @return string
* @deprecated. Instead use getRecipientLastName * @deprecated. Instead use getRecipientLastName
*/ */
public function getRecipient_last_name() { public function getRecipient_last_name()
{
return $this->recipient_last_name; return $this->recipient_last_name;
} }
@@ -108,7 +121,8 @@ class Search extends PPModel {
* *
* @param string $recipient_business_name * @param string $recipient_business_name
*/ */
public function setRecipientBusinessName($recipient_business_name) { public function setRecipientBusinessName($recipient_business_name)
{
$this->recipient_business_name = $recipient_business_name; $this->recipient_business_name = $recipient_business_name;
return $this; return $this;
} }
@@ -118,7 +132,8 @@ class Search extends PPModel {
* *
* @return string * @return string
*/ */
public function getRecipientBusinessName() { public function getRecipientBusinessName()
{
return $this->recipient_business_name; return $this->recipient_business_name;
} }
@@ -128,17 +143,20 @@ class Search extends PPModel {
* @param string $recipient_business_name * @param string $recipient_business_name
* @deprecated. Instead use setRecipientBusinessName * @deprecated. Instead use setRecipientBusinessName
*/ */
public function setRecipient_business_name($recipient_business_name) { public function setRecipient_business_name($recipient_business_name)
{
$this->recipient_business_name = $recipient_business_name; $this->recipient_business_name = $recipient_business_name;
return $this; return $this;
} }
/** /**
* Initial letters of the recipient's business name. * Initial letters of the recipient's business name.
* *
* @return string * @return string
* @deprecated. Instead use getRecipientBusinessName * @deprecated. Instead use getRecipientBusinessName
*/ */
public function getRecipient_business_name() { public function getRecipient_business_name()
{
return $this->recipient_business_name; return $this->recipient_business_name;
} }
@@ -147,7 +165,8 @@ class Search extends PPModel {
* *
* @param string $number * @param string $number
*/ */
public function setNumber($number) { public function setNumber($number)
{
$this->number = $number; $this->number = $number;
return $this; return $this;
} }
@@ -157,7 +176,8 @@ class Search extends PPModel {
* *
* @return string * @return string
*/ */
public function getNumber() { public function getNumber()
{
return $this->number; return $this->number;
} }
@@ -167,7 +187,8 @@ class Search extends PPModel {
* *
* @param string $status * @param string $status
*/ */
public function setStatus($status) { public function setStatus($status)
{
$this->status = $status; $this->status = $status;
return $this; return $this;
} }
@@ -177,7 +198,8 @@ class Search extends PPModel {
* *
* @return string * @return string
*/ */
public function getStatus() { public function getStatus()
{
return $this->status; return $this->status;
} }
@@ -187,7 +209,8 @@ class Search extends PPModel {
* *
* @param PayPal\Api\Currency $lower_total_amount * @param PayPal\Api\Currency $lower_total_amount
*/ */
public function setLowerTotalAmount($lower_total_amount) { public function setLowerTotalAmount($lower_total_amount)
{
$this->lower_total_amount = $lower_total_amount; $this->lower_total_amount = $lower_total_amount;
return $this; return $this;
} }
@@ -197,7 +220,8 @@ class Search extends PPModel {
* *
* @return PayPal\Api\Currency * @return PayPal\Api\Currency
*/ */
public function getLowerTotalAmount() { public function getLowerTotalAmount()
{
return $this->lower_total_amount; return $this->lower_total_amount;
} }
@@ -207,17 +231,20 @@ class Search extends PPModel {
* @param PayPal\Api\Currency $lower_total_amount * @param PayPal\Api\Currency $lower_total_amount
* @deprecated. Instead use setLowerTotalAmount * @deprecated. Instead use setLowerTotalAmount
*/ */
public function setLower_total_amount($lower_total_amount) { public function setLower_total_amount($lower_total_amount)
{
$this->lower_total_amount = $lower_total_amount; $this->lower_total_amount = $lower_total_amount;
return $this; return $this;
} }
/** /**
* Lower limit of total amount. * Lower limit of total amount.
* *
* @return PayPal\Api\Currency * @return PayPal\Api\Currency
* @deprecated. Instead use getLowerTotalAmount * @deprecated. Instead use getLowerTotalAmount
*/ */
public function getLower_total_amount() { public function getLower_total_amount()
{
return $this->lower_total_amount; return $this->lower_total_amount;
} }
@@ -226,7 +253,8 @@ class Search extends PPModel {
* *
* @param PayPal\Api\Currency $upper_total_amount * @param PayPal\Api\Currency $upper_total_amount
*/ */
public function setUpperTotalAmount($upper_total_amount) { public function setUpperTotalAmount($upper_total_amount)
{
$this->upper_total_amount = $upper_total_amount; $this->upper_total_amount = $upper_total_amount;
return $this; return $this;
} }
@@ -236,7 +264,8 @@ class Search extends PPModel {
* *
* @return PayPal\Api\Currency * @return PayPal\Api\Currency
*/ */
public function getUpperTotalAmount() { public function getUpperTotalAmount()
{
return $this->upper_total_amount; return $this->upper_total_amount;
} }
@@ -246,17 +275,20 @@ class Search extends PPModel {
* @param PayPal\Api\Currency $upper_total_amount * @param PayPal\Api\Currency $upper_total_amount
* @deprecated. Instead use setUpperTotalAmount * @deprecated. Instead use setUpperTotalAmount
*/ */
public function setUpper_total_amount($upper_total_amount) { public function setUpper_total_amount($upper_total_amount)
{
$this->upper_total_amount = $upper_total_amount; $this->upper_total_amount = $upper_total_amount;
return $this; return $this;
} }
/** /**
* Upper limit of total amount. * Upper limit of total amount.
* *
* @return PayPal\Api\Currency * @return PayPal\Api\Currency
* @deprecated. Instead use getUpperTotalAmount * @deprecated. Instead use getUpperTotalAmount
*/ */
public function getUpper_total_amount() { public function getUpper_total_amount()
{
return $this->upper_total_amount; return $this->upper_total_amount;
} }
@@ -265,7 +297,8 @@ class Search extends PPModel {
* *
* @param string $start_invoice_date * @param string $start_invoice_date
*/ */
public function setStartInvoiceDate($start_invoice_date) { public function setStartInvoiceDate($start_invoice_date)
{
$this->start_invoice_date = $start_invoice_date; $this->start_invoice_date = $start_invoice_date;
return $this; return $this;
} }
@@ -275,7 +308,8 @@ class Search extends PPModel {
* *
* @return string * @return string
*/ */
public function getStartInvoiceDate() { public function getStartInvoiceDate()
{
return $this->start_invoice_date; return $this->start_invoice_date;
} }
@@ -285,17 +319,20 @@ class Search extends PPModel {
* @param string $start_invoice_date * @param string $start_invoice_date
* @deprecated. Instead use setStartInvoiceDate * @deprecated. Instead use setStartInvoiceDate
*/ */
public function setStart_invoice_date($start_invoice_date) { public function setStart_invoice_date($start_invoice_date)
{
$this->start_invoice_date = $start_invoice_date; $this->start_invoice_date = $start_invoice_date;
return $this; return $this;
} }
/** /**
* Start invoice date. * Start invoice date.
* *
* @return string * @return string
* @deprecated. Instead use getStartInvoiceDate * @deprecated. Instead use getStartInvoiceDate
*/ */
public function getStart_invoice_date() { public function getStart_invoice_date()
{
return $this->start_invoice_date; return $this->start_invoice_date;
} }
@@ -304,7 +341,8 @@ class Search extends PPModel {
* *
* @param string $end_invoice_date * @param string $end_invoice_date
*/ */
public function setEndInvoiceDate($end_invoice_date) { public function setEndInvoiceDate($end_invoice_date)
{
$this->end_invoice_date = $end_invoice_date; $this->end_invoice_date = $end_invoice_date;
return $this; return $this;
} }
@@ -314,7 +352,8 @@ class Search extends PPModel {
* *
* @return string * @return string
*/ */
public function getEndInvoiceDate() { public function getEndInvoiceDate()
{
return $this->end_invoice_date; return $this->end_invoice_date;
} }
@@ -324,17 +363,20 @@ class Search extends PPModel {
* @param string $end_invoice_date * @param string $end_invoice_date
* @deprecated. Instead use setEndInvoiceDate * @deprecated. Instead use setEndInvoiceDate
*/ */
public function setEnd_invoice_date($end_invoice_date) { public function setEnd_invoice_date($end_invoice_date)
{
$this->end_invoice_date = $end_invoice_date; $this->end_invoice_date = $end_invoice_date;
return $this; return $this;
} }
/** /**
* End invoice date. * End invoice date.
* *
* @return string * @return string
* @deprecated. Instead use getEndInvoiceDate * @deprecated. Instead use getEndInvoiceDate
*/ */
public function getEnd_invoice_date() { public function getEnd_invoice_date()
{
return $this->end_invoice_date; return $this->end_invoice_date;
} }
@@ -343,7 +385,8 @@ class Search extends PPModel {
* *
* @param string $start_due_date * @param string $start_due_date
*/ */
public function setStartDueDate($start_due_date) { public function setStartDueDate($start_due_date)
{
$this->start_due_date = $start_due_date; $this->start_due_date = $start_due_date;
return $this; return $this;
} }
@@ -353,7 +396,8 @@ class Search extends PPModel {
* *
* @return string * @return string
*/ */
public function getStartDueDate() { public function getStartDueDate()
{
return $this->start_due_date; return $this->start_due_date;
} }
@@ -363,17 +407,20 @@ class Search extends PPModel {
* @param string $start_due_date * @param string $start_due_date
* @deprecated. Instead use setStartDueDate * @deprecated. Instead use setStartDueDate
*/ */
public function setStart_due_date($start_due_date) { public function setStart_due_date($start_due_date)
{
$this->start_due_date = $start_due_date; $this->start_due_date = $start_due_date;
return $this; return $this;
} }
/** /**
* Start invoice due date. * Start invoice due date.
* *
* @return string * @return string
* @deprecated. Instead use getStartDueDate * @deprecated. Instead use getStartDueDate
*/ */
public function getStart_due_date() { public function getStart_due_date()
{
return $this->start_due_date; return $this->start_due_date;
} }
@@ -382,7 +429,8 @@ class Search extends PPModel {
* *
* @param string $end_due_date * @param string $end_due_date
*/ */
public function setEndDueDate($end_due_date) { public function setEndDueDate($end_due_date)
{
$this->end_due_date = $end_due_date; $this->end_due_date = $end_due_date;
return $this; return $this;
} }
@@ -392,7 +440,8 @@ class Search extends PPModel {
* *
* @return string * @return string
*/ */
public function getEndDueDate() { public function getEndDueDate()
{
return $this->end_due_date; return $this->end_due_date;
} }
@@ -402,17 +451,20 @@ class Search extends PPModel {
* @param string $end_due_date * @param string $end_due_date
* @deprecated. Instead use setEndDueDate * @deprecated. Instead use setEndDueDate
*/ */
public function setEnd_due_date($end_due_date) { public function setEnd_due_date($end_due_date)
{
$this->end_due_date = $end_due_date; $this->end_due_date = $end_due_date;
return $this; return $this;
} }
/** /**
* End invoice due date. * End invoice due date.
* *
* @return string * @return string
* @deprecated. Instead use getEndDueDate * @deprecated. Instead use getEndDueDate
*/ */
public function getEnd_due_date() { public function getEnd_due_date()
{
return $this->end_due_date; return $this->end_due_date;
} }
@@ -421,7 +473,8 @@ class Search extends PPModel {
* *
* @param string $start_payment_date * @param string $start_payment_date
*/ */
public function setStartPaymentDate($start_payment_date) { public function setStartPaymentDate($start_payment_date)
{
$this->start_payment_date = $start_payment_date; $this->start_payment_date = $start_payment_date;
return $this; return $this;
} }
@@ -431,7 +484,8 @@ class Search extends PPModel {
* *
* @return string * @return string
*/ */
public function getStartPaymentDate() { public function getStartPaymentDate()
{
return $this->start_payment_date; return $this->start_payment_date;
} }
@@ -441,17 +495,20 @@ class Search extends PPModel {
* @param string $start_payment_date * @param string $start_payment_date
* @deprecated. Instead use setStartPaymentDate * @deprecated. Instead use setStartPaymentDate
*/ */
public function setStart_payment_date($start_payment_date) { public function setStart_payment_date($start_payment_date)
{
$this->start_payment_date = $start_payment_date; $this->start_payment_date = $start_payment_date;
return $this; return $this;
} }
/** /**
* Start invoice payment date. * Start invoice payment date.
* *
* @return string * @return string
* @deprecated. Instead use getStartPaymentDate * @deprecated. Instead use getStartPaymentDate
*/ */
public function getStart_payment_date() { public function getStart_payment_date()
{
return $this->start_payment_date; return $this->start_payment_date;
} }
@@ -460,7 +517,8 @@ class Search extends PPModel {
* *
* @param string $end_payment_date * @param string $end_payment_date
*/ */
public function setEndPaymentDate($end_payment_date) { public function setEndPaymentDate($end_payment_date)
{
$this->end_payment_date = $end_payment_date; $this->end_payment_date = $end_payment_date;
return $this; return $this;
} }
@@ -470,7 +528,8 @@ class Search extends PPModel {
* *
* @return string * @return string
*/ */
public function getEndPaymentDate() { public function getEndPaymentDate()
{
return $this->end_payment_date; return $this->end_payment_date;
} }
@@ -480,17 +539,20 @@ class Search extends PPModel {
* @param string $end_payment_date * @param string $end_payment_date
* @deprecated. Instead use setEndPaymentDate * @deprecated. Instead use setEndPaymentDate
*/ */
public function setEnd_payment_date($end_payment_date) { public function setEnd_payment_date($end_payment_date)
{
$this->end_payment_date = $end_payment_date; $this->end_payment_date = $end_payment_date;
return $this; return $this;
} }
/** /**
* End invoice payment date. * End invoice payment date.
* *
* @return string * @return string
* @deprecated. Instead use getEndPaymentDate * @deprecated. Instead use getEndPaymentDate
*/ */
public function getEnd_payment_date() { public function getEnd_payment_date()
{
return $this->end_payment_date; return $this->end_payment_date;
} }
@@ -499,7 +561,8 @@ class Search extends PPModel {
* *
* @param string $start_creation_date * @param string $start_creation_date
*/ */
public function setStartCreationDate($start_creation_date) { public function setStartCreationDate($start_creation_date)
{
$this->start_creation_date = $start_creation_date; $this->start_creation_date = $start_creation_date;
return $this; return $this;
} }
@@ -509,7 +572,8 @@ class Search extends PPModel {
* *
* @return string * @return string
*/ */
public function getStartCreationDate() { public function getStartCreationDate()
{
return $this->start_creation_date; return $this->start_creation_date;
} }
@@ -519,17 +583,20 @@ class Search extends PPModel {
* @param string $start_creation_date * @param string $start_creation_date
* @deprecated. Instead use setStartCreationDate * @deprecated. Instead use setStartCreationDate
*/ */
public function setStart_creation_date($start_creation_date) { public function setStart_creation_date($start_creation_date)
{
$this->start_creation_date = $start_creation_date; $this->start_creation_date = $start_creation_date;
return $this; return $this;
} }
/** /**
* Start invoice creation date. * Start invoice creation date.
* *
* @return string * @return string
* @deprecated. Instead use getStartCreationDate * @deprecated. Instead use getStartCreationDate
*/ */
public function getStart_creation_date() { public function getStart_creation_date()
{
return $this->start_creation_date; return $this->start_creation_date;
} }
@@ -538,7 +605,8 @@ class Search extends PPModel {
* *
* @param string $end_creation_date * @param string $end_creation_date
*/ */
public function setEndCreationDate($end_creation_date) { public function setEndCreationDate($end_creation_date)
{
$this->end_creation_date = $end_creation_date; $this->end_creation_date = $end_creation_date;
return $this; return $this;
} }
@@ -548,7 +616,8 @@ class Search extends PPModel {
* *
* @return string * @return string
*/ */
public function getEndCreationDate() { public function getEndCreationDate()
{
return $this->end_creation_date; return $this->end_creation_date;
} }
@@ -558,17 +627,20 @@ class Search extends PPModel {
* @param string $end_creation_date * @param string $end_creation_date
* @deprecated. Instead use setEndCreationDate * @deprecated. Instead use setEndCreationDate
*/ */
public function setEnd_creation_date($end_creation_date) { public function setEnd_creation_date($end_creation_date)
{
$this->end_creation_date = $end_creation_date; $this->end_creation_date = $end_creation_date;
return $this; return $this;
} }
/** /**
* End invoice creation date. * End invoice creation date.
* *
* @return string * @return string
* @deprecated. Instead use getEndCreationDate * @deprecated. Instead use getEndCreationDate
*/ */
public function getEnd_creation_date() { public function getEnd_creation_date()
{
return $this->end_creation_date; return $this->end_creation_date;
} }
@@ -577,7 +649,8 @@ class Search extends PPModel {
* *
* @param PayPal\Api\number $page * @param PayPal\Api\number $page
*/ */
public function setPage($page) { public function setPage($page)
{
$this->page = $page; $this->page = $page;
return $this; return $this;
} }
@@ -587,7 +660,8 @@ class Search extends PPModel {
* *
* @return PayPal\Api\number * @return PayPal\Api\number
*/ */
public function getPage() { public function getPage()
{
return $this->page; return $this->page;
} }
@@ -597,7 +671,8 @@ class Search extends PPModel {
* *
* @param PayPal\Api\number $page_size * @param PayPal\Api\number $page_size
*/ */
public function setPageSize($page_size) { public function setPageSize($page_size)
{
$this->page_size = $page_size; $this->page_size = $page_size;
return $this; return $this;
} }
@@ -607,7 +682,8 @@ class Search extends PPModel {
* *
* @return PayPal\Api\number * @return PayPal\Api\number
*/ */
public function getPageSize() { public function getPageSize()
{
return $this->page_size; return $this->page_size;
} }
@@ -617,17 +693,20 @@ class Search extends PPModel {
* @param PayPal\Api\number $page_size * @param PayPal\Api\number $page_size
* @deprecated. Instead use setPageSize * @deprecated. Instead use setPageSize
*/ */
public function setPage_size($page_size) { public function setPage_size($page_size)
{
$this->page_size = $page_size; $this->page_size = $page_size;
return $this; return $this;
} }
/** /**
* Page size of the search results. * Page size of the search results.
* *
* @return PayPal\Api\number * @return PayPal\Api\number
* @deprecated. Instead use getPageSize * @deprecated. Instead use getPageSize
*/ */
public function getPage_size() { public function getPage_size()
{
return $this->page_size; return $this->page_size;
} }
@@ -636,7 +715,8 @@ class Search extends PPModel {
* *
* @param boolean $total_count_required * @param boolean $total_count_required
*/ */
public function setTotalCountRequired($total_count_required) { public function setTotalCountRequired($total_count_required)
{
$this->total_count_required = $total_count_required; $this->total_count_required = $total_count_required;
return $this; return $this;
} }
@@ -646,7 +726,8 @@ class Search extends PPModel {
* *
* @return boolean * @return boolean
*/ */
public function getTotalCountRequired() { public function getTotalCountRequired()
{
return $this->total_count_required; return $this->total_count_required;
} }
@@ -656,17 +737,20 @@ class Search extends PPModel {
* @param boolean $total_count_required * @param boolean $total_count_required
* @deprecated. Instead use setTotalCountRequired * @deprecated. Instead use setTotalCountRequired
*/ */
public function setTotal_count_required($total_count_required) { public function setTotal_count_required($total_count_required)
{
$this->total_count_required = $total_count_required; $this->total_count_required = $total_count_required;
return $this; return $this;
} }
/** /**
* A flag indicating whether total count is required in the response. * A flag indicating whether total count is required in the response.
* *
* @return boolean * @return boolean
* @deprecated. Instead use getTotalCountRequired * @deprecated. Instead use getTotalCountRequired
*/ */
public function getTotal_count_required() { public function getTotal_count_required()
{
return $this->total_count_required; return $this->total_count_required;
} }

View File

@@ -4,13 +4,15 @@ namespace PayPal\Api;
use PayPal\Common\PPModel; use PayPal\Common\PPModel;
use PayPal\Rest\ApiContext; use PayPal\Rest\ApiContext;
class ShippingCost extends PPModel { class ShippingCost extends PPModel
{
/** /**
* Shipping cost in amount. Range of 0 to 999999.99. * Shipping cost in amount. Range of 0 to 999999.99.
* *
* @param PayPal\Api\Currency $amount * @param PayPal\Api\Currency $amount
*/ */
public function setAmount($amount) { public function setAmount($amount)
{
$this->amount = $amount; $this->amount = $amount;
return $this; return $this;
} }
@@ -20,7 +22,8 @@ class ShippingCost extends PPModel {
* *
* @return PayPal\Api\Currency * @return PayPal\Api\Currency
*/ */
public function getAmount() { public function getAmount()
{
return $this->amount; return $this->amount;
} }
@@ -30,7 +33,8 @@ class ShippingCost extends PPModel {
* *
* @param PayPal\Api\Tax $tax * @param PayPal\Api\Tax $tax
*/ */
public function setTax($tax) { public function setTax($tax)
{
$this->tax = $tax; $this->tax = $tax;
return $this; return $this;
} }
@@ -40,7 +44,8 @@ class ShippingCost extends PPModel {
* *
* @return PayPal\Api\Tax * @return PayPal\Api\Tax
*/ */
public function getTax() { public function getTax()
{
return $this->tax; return $this->tax;
} }

View File

@@ -4,13 +4,15 @@ namespace PayPal\Api;
use PayPal\Common\PPModel; use PayPal\Common\PPModel;
use PayPal\Rest\ApiContext; use PayPal\Rest\ApiContext;
class ShippingInfo extends PPModel { class ShippingInfo extends PPModel
{
/** /**
* First name of the invoice recipient. 30 characters max. * First name of the invoice recipient. 30 characters max.
* *
* @param string $first_name * @param string $first_name
*/ */
public function setFirstName($first_name) { public function setFirstName($first_name)
{
$this->first_name = $first_name; $this->first_name = $first_name;
return $this; return $this;
} }
@@ -20,7 +22,8 @@ class ShippingInfo extends PPModel {
* *
* @return string * @return string
*/ */
public function getFirstName() { public function getFirstName()
{
return $this->first_name; return $this->first_name;
} }
@@ -30,17 +33,20 @@ class ShippingInfo extends PPModel {
* @param string $first_name * @param string $first_name
* @deprecated. Instead use setFirstName * @deprecated. Instead use setFirstName
*/ */
public function setFirst_name($first_name) { public function setFirst_name($first_name)
{
$this->first_name = $first_name; $this->first_name = $first_name;
return $this; return $this;
} }
/** /**
* First name of the invoice recipient. 30 characters max. * First name of the invoice recipient. 30 characters max.
* *
* @return string * @return string
* @deprecated. Instead use getFirstName * @deprecated. Instead use getFirstName
*/ */
public function getFirst_name() { public function getFirst_name()
{
return $this->first_name; return $this->first_name;
} }
@@ -49,7 +55,8 @@ class ShippingInfo extends PPModel {
* *
* @param string $last_name * @param string $last_name
*/ */
public function setLastName($last_name) { public function setLastName($last_name)
{
$this->last_name = $last_name; $this->last_name = $last_name;
return $this; return $this;
} }
@@ -59,7 +66,8 @@ class ShippingInfo extends PPModel {
* *
* @return string * @return string
*/ */
public function getLastName() { public function getLastName()
{
return $this->last_name; return $this->last_name;
} }
@@ -69,17 +77,20 @@ class ShippingInfo extends PPModel {
* @param string $last_name * @param string $last_name
* @deprecated. Instead use setLastName * @deprecated. Instead use setLastName
*/ */
public function setLast_name($last_name) { public function setLast_name($last_name)
{
$this->last_name = $last_name; $this->last_name = $last_name;
return $this; return $this;
} }
/** /**
* Last name of the invoice recipient. 30 characters max. * Last name of the invoice recipient. 30 characters max.
* *
* @return string * @return string
* @deprecated. Instead use getLastName * @deprecated. Instead use getLastName
*/ */
public function getLast_name() { public function getLast_name()
{
return $this->last_name; return $this->last_name;
} }
@@ -88,7 +99,8 @@ class ShippingInfo extends PPModel {
* *
* @param string $business_name * @param string $business_name
*/ */
public function setBusinessName($business_name) { public function setBusinessName($business_name)
{
$this->business_name = $business_name; $this->business_name = $business_name;
return $this; return $this;
} }
@@ -98,7 +110,8 @@ class ShippingInfo extends PPModel {
* *
* @return string * @return string
*/ */
public function getBusinessName() { public function getBusinessName()
{
return $this->business_name; return $this->business_name;
} }
@@ -108,17 +121,20 @@ class ShippingInfo extends PPModel {
* @param string $business_name * @param string $business_name
* @deprecated. Instead use setBusinessName * @deprecated. Instead use setBusinessName
*/ */
public function setBusiness_name($business_name) { public function setBusiness_name($business_name)
{
$this->business_name = $business_name; $this->business_name = $business_name;
return $this; return $this;
} }
/** /**
* Company business name of the invoice recipient. 100 characters max. * Company business name of the invoice recipient. 100 characters max.
* *
* @return string * @return string
* @deprecated. Instead use getBusinessName * @deprecated. Instead use getBusinessName
*/ */
public function getBusiness_name() { public function getBusiness_name()
{
return $this->business_name; return $this->business_name;
} }
@@ -127,7 +143,8 @@ class ShippingInfo extends PPModel {
* *
* @param PayPal\Api\Phone $phone * @param PayPal\Api\Phone $phone
*/ */
public function setPhone($phone) { public function setPhone($phone)
{
$this->phone = $phone; $this->phone = $phone;
return $this; return $this;
} }
@@ -137,7 +154,8 @@ class ShippingInfo extends PPModel {
* *
* @return PayPal\Api\Phone * @return PayPal\Api\Phone
*/ */
public function getPhone() { public function getPhone()
{
return $this->phone; return $this->phone;
} }
@@ -147,7 +165,8 @@ class ShippingInfo extends PPModel {
* *
* @param PayPal\Api\Address $address * @param PayPal\Api\Address $address
*/ */
public function setAddress($address) { public function setAddress($address)
{
$this->address = $address; $this->address = $address;
return $this; return $this;
} }
@@ -157,7 +176,8 @@ class ShippingInfo extends PPModel {
* *
* @return PayPal\Api\Address * @return PayPal\Api\Address
*/ */
public function getAddress() { public function getAddress()
{
return $this->address; return $this->address;
} }

View File

@@ -4,13 +4,15 @@ namespace PayPal\Api;
use PayPal\Common\PPModel; use PayPal\Common\PPModel;
use PayPal\Rest\ApiContext; use PayPal\Rest\ApiContext;
class Tax extends PPModel { class Tax extends PPModel
{
/** /**
* Identifier of the resource. * Identifier of the resource.
* *
* @param string $id * @param string $id
*/ */
public function setId($id) { public function setId($id)
{
$this->id = $id; $this->id = $id;
return $this; return $this;
} }
@@ -20,7 +22,8 @@ class Tax extends PPModel {
* *
* @return string * @return string
*/ */
public function getId() { public function getId()
{
return $this->id; return $this->id;
} }
@@ -30,7 +33,8 @@ class Tax extends PPModel {
* *
* @param string $name * @param string $name
*/ */
public function setName($name) { public function setName($name)
{
$this->name = $name; $this->name = $name;
return $this; return $this;
} }
@@ -40,7 +44,8 @@ class Tax extends PPModel {
* *
* @return string * @return string
*/ */
public function getName() { public function getName()
{
return $this->name; return $this->name;
} }
@@ -50,7 +55,8 @@ class Tax extends PPModel {
* *
* @param PayPal\Api\number $percent * @param PayPal\Api\number $percent
*/ */
public function setPercent($percent) { public function setPercent($percent)
{
$this->percent = $percent; $this->percent = $percent;
return $this; return $this;
} }
@@ -60,7 +66,8 @@ class Tax extends PPModel {
* *
* @return PayPal\Api\number * @return PayPal\Api\number
*/ */
public function getPercent() { public function getPercent()
{
return $this->percent; return $this->percent;
} }
@@ -70,7 +77,8 @@ class Tax extends PPModel {
* *
* @param PayPal\Api\Currency $amount * @param PayPal\Api\Currency $amount
*/ */
public function setAmount($amount) { public function setAmount($amount)
{
$this->amount = $amount; $this->amount = $amount;
return $this; return $this;
} }
@@ -80,7 +88,8 @@ class Tax extends PPModel {
* *
* @return PayPal\Api\Currency * @return PayPal\Api\Currency
*/ */
public function getAmount() { public function getAmount()
{
return $this->amount; return $this->amount;
} }

View File

@@ -0,0 +1,28 @@
<?php
namespace PayPal\Common;
/**
* Class PPArrayUtil
* Util Class for Arrays
*
* @package PayPal\Common
*/
class PPArrayUtil
{
/**
*
* @param array $arr
* @return true if $arr is an associative array
*/
public static function isAssocArray(array $arr)
{
foreach ($arr as $k => $v) {
if (is_int($k)) {
return false;
}
}
return true;
}
}

View File

@@ -0,0 +1,148 @@
<?php
namespace PayPal\Common;
/**
* Generic Model class that all API domain classes extend
* Stores all member data in a Hashmap that enables easy
* JSON encoding/decoding
*/
class PPModel
{
private $_propMap = array();
/**
* Magic Get Method
*
* @param $key
* @return mixed
*/
public function __get($key)
{
return $this->_propMap[$key];
}
/**
* Magic Set Method
*
* @param $key
* @param $value
*/
public function __set($key, $value)
{
$this->_propMap[$key] = $value;
}
/**
* Magic isSet Method
*
* @param $key
* @return bool
*/
public function __isset($key)
{
return isset($this->_propMap[$key]);
}
/**
* Magic Unset Method
*
* @param $key
*/
public function __unset($key)
{
unset($this->_propMap[$key]);
}
/**
* Converts Params to Array
*
* @param $param
* @return array
*/
private function _convertToArray($param)
{
$ret = array();
foreach ($param as $k => $v) {
if ($v instanceof PPModel) {
$ret[$k] = $v->toArray();
} else if (is_array($v)) {
$ret[$k] = $this->_convertToArray($v);
} else {
$ret[$k] = $v;
}
}
return $ret;
}
/**
* Fills object value from Array list
*
* @param $arr
* @return $this
*/
public function fromArray($arr)
{
foreach ($arr as $k => $v) {
if (is_array($v)) {
$clazz = PPReflectionUtil::getPropertyClass(get_class($this), $k);
if (PPArrayUtil::isAssocArray($v)) {
/** @var self $o */
$o = new $clazz();
$o->fromArray($v);
$this->__set($k, $o);
} else {
$arr = array();
foreach ($v as $nk => $nv) {
if (is_array($nv)) {
$o = new $clazz();
$o->fromArray($nv);
$arr[$nk] = $o;
} else {
$arr[$nk] = $nv;
}
}
$this->__set($k, $arr);
}
} else {
$this->$k = $v;
}
}
return $this;
}
/**
* Fills object value from Json string
*
* @param $json
* @return $this
*/
public function fromJson($json)
{
return $this->fromArray(json_decode($json, true));
}
/**
* Returns array representation of object
*
* @return array
*/
public function toArray()
{
return $this->_convertToArray($this->_propMap);
}
/**
* Returns object JSON representation
*
* @param int $options http://php.net/manual/en/json.constants.php
* @return string
*/
public function toJSON($options = 0)
{
return json_encode($this->toArray(), $options);
}
}

View File

@@ -0,0 +1,102 @@
<?php
namespace PayPal\Common;
/**
* Class PPReflectionUtil
*
* @package PayPal\Common
*/
class PPReflectionUtil
{
/**
* Reflection Methods
*
* @var \ReflectionMethod[]
*/
private static $propertiesRefl = array();
/**
* Properties Type
*
* @var string[]
*/
private static $propertiesType = array();
/**
* Gets Property Class
*
* @param $class
* @param $propertyName
* @return string
*/
public static function getPropertyClass($class, $propertyName)
{
if (($annotations = self::propertyAnnotations($class, $propertyName)) && isset($annotations['return'])) {
$param = $annotations['return'];
}
if (isset($param)) {
$anno = explode(' ', $param);
return $anno[0];
} else {
return 'string';
}
}
/**
* Retrieves Annotations of each property
*
* @param $class
* @param $propertyName
* @throws \RuntimeException
* @return mixed
*/
public static function propertyAnnotations($class, $propertyName)
{
$class = is_object($class) ? get_class($class) : $class;
if (!class_exists('ReflectionProperty')) {
throw new \RuntimeException("Property type of " . $class . "::{$propertyName} cannot be resolved");
}
if ($annotations =& self::$propertiesType[$class][$propertyName]) {
return $annotations;
}
if (!($refl =& self::$propertiesRefl[$class][$propertyName])) {
$getter = method_exists($class, "get" . ucfirst($propertyName)) ?
"get" . ucfirst($propertyName) :
"get" . preg_replace_callback("/([_\-\s]?([a-z0-9]+))/", "self::replace_callback", $propertyName);
$refl = new \ReflectionMethod($class, $getter);
self::$propertiesRefl[$class][$propertyName] = $refl;
}
// todo: smarter regexp
if ( !preg_match_all(
'~\@([^\s@\(]+)[\t ]*(?:\(?([^\n@]+)\)?)?~i',
$refl->getDocComment(),
$annots,
PREG_PATTERN_ORDER)) {
return null;
}
foreach ($annots[1] as $i => $annot) {
$annotations[strtolower($annot)] = empty($annots[2][$i]) ? TRUE : rtrim($annots[2][$i], " \t\n\r)");
}
return $annotations;
}
/**
* preg_replace_callback callback function
*
* @param $match
* @return string
*/
private static function replace_callback($match)
{
return ucwords($match[2]);
}
}

View File

@@ -0,0 +1,59 @@
<?php
namespace PayPal\Common;
/**
* Class PPUserAgent
* PPUserAgent generates User Agent for curl requests
*
* @package PayPal\Common
*/
class PPUserAgent
{
/**
* Returns the value of the User-Agent header
* Add environment values and php version numbers
*
* @param string $sdkName
* @param string $sdkVersion
* @return string
*/
public static function getValue($sdkName, $sdkVersion)
{
$featureList = array(
'lang=PHP',
'v=' . PHP_VERSION,
'bit=' . self::_getPHPBit(),
'os=' . str_replace(' ', '_', php_uname('s') . ' ' . php_uname('r')),
'machine=' . php_uname('m')
);
if (defined('OPENSSL_VERSION_TEXT')) {
$opensslVersion = explode(' ', OPENSSL_VERSION_TEXT);
$featureList[] = 'openssl=' . $opensslVersion[1];
}
if (function_exists('curl_version')) {
$curlVersion = curl_version();
$featureList[] = 'curl=' . $curlVersion['version'];
}
return sprintf("PayPalSDK/%s %s (%s)", $sdkName, $sdkVersion, implode(';', $featureList));
}
/**
* Gets PHP Bit version
*
* @return int|string
*/
private static function _getPHPBit()
{
switch (PHP_INT_SIZE) {
case 4:
return '32';
case 8:
return '64';
default:
return PHP_INT_SIZE;
}
}
}

View File

@@ -0,0 +1,163 @@
<?php
namespace PayPal\Core;
/**
* Class PPConfigManager
*
* PPConfigManager loads the SDK configuration file and
* hands out appropriate config params to other classes
*
* @package PayPal\Core
*/
class PPConfigManager
{
/**
* Configuration Options
*
* @var array
*/
private $configs = array(
"http.ConnectionTimeOut" => "30",
"http.Retry" => "5",
);
/**
* Singleton Object
*
* @var $this
*/
private static $instance;
/**
* Private Constructor
*/
private function __construct()
{
if (defined('PP_CONFIG_PATH')) {
$configFile = constant('PP_CONFIG_PATH') . '/sdk_config.ini';
} else {
$configFile = implode(DIRECTORY_SEPARATOR,
array(dirname(__FILE__), "..", "config", "sdk_config.ini"));
}
$this->addConfigFromIni($configFile);
}
/**
* Returns the singleton object
*
* @return $this
*/
public static function getInstance()
{
if (!isset(self::$instance)) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Add Configuration from configuration.ini files
*
* @param string $fileName
* @return $this
*/
public function addConfigFromIni($fileName)
{
if ($configs = @parse_ini_file($fileName)) {
$this->addConfigs($configs);
}
return $this;
}
/**
* If a configuration exists in both arrays,
* then the element from the first array will be used and
* the matching key's element from the second array will be ignored.
*
* @param [] $config
* @return $this
*/
public function addConfigs($configs = [])
{
$this->configs = $configs + $this->configs;
return $this;
}
/**
* Simple getter for configuration params
* If an exact match for key is not found,
* does a "contains" search on the key
*
* @param string $searchKey
* @return array
*/
public function get($searchKey)
{
if (array_key_exists($searchKey, $this->configs)) {
return $this->configs[$searchKey];
} else {
$arr = array();
foreach ($this->configs as $k => $v) {
if (strstr($k, $searchKey)) {
$arr[$k] = $v;
}
}
return $arr;
}
}
/**
* Utility method for handling account configuration
* return config key corresponding to the API userId passed in
*
* If $userId is null, returns config keys corresponding to
* all configured accounts
*
* @param string|null $userId
* @return array|string
*/
public function getIniPrefix($userId = null)
{
if ($userId == null) {
$arr = array();
foreach ($this->configs as $key => $value) {
$pos = strpos($key, '.');
if (strstr($key, "acct")) {
$arr[] = substr($key, 0, $pos);
}
}
return array_unique($arr);
} else {
$iniPrefix = array_search($userId, $this->configs);
$pos = strpos($iniPrefix, '.');
$acct = substr($iniPrefix, 0, $pos);
return $acct;
}
}
/**
* returns the config file hashmap
*/
public function getConfigHashmap()
{
return $this->configs;
}
/**
* Disabling __clone call
*/
public function __clone()
{
trigger_error('Clone is not allowed.', E_USER_ERROR);
}
}

View File

@@ -0,0 +1,19 @@
<?php
namespace PayPal\Core;
/**
* Class PPConstants
* Placeholder for Paypal Constants
*
* @package PayPal\Core
*/
class PPConstants
{
const SDK_NAME = 'rest-api-sdk-php';
const SDK_VERSION = '0.11.0';
const REST_SANDBOX_ENDPOINT = "https://api.sandbox.paypal.com/";
const REST_LIVE_ENDPOINT = "https://api.paypal.com/";
}

View File

@@ -0,0 +1,167 @@
<?php
namespace PayPal\Core;
use PayPal\Auth\OAuthTokenCredential;
use PayPal\Exception\PPInvalidCredentialException;
/**
* Class PPCredentialManager
*
* PPCredentialManager holds all the credential information in one place.
*
* @package PayPal\Core
*/
class PPCredentialManager
{
/**
* Singleton Object
*
* @var self
*/
private static $instance;
/**
* Hashmap to contain credentials for accounts.
*
* @var array
*/
private $credentialHashmap = array();
/**
* Contains the API username of the default account to use
* when authenticating API calls
*
* @var string
*/
private $defaultAccountName;
/**
* Constructor initialize credential for multiple accounts specified in property file
*
* @param $config
* @throws \Exception
*/
private function __construct($config)
{
try {
$this->initCredential($config);
} catch (\Exception $e) {
$this->credentialHashmap = array();
throw $e;
}
}
/**
* Create singleton instance for this class.
*
* @param array|null $config
* @return PPCredentialManager
*/
public static function getInstance($config = null)
{
if (!self::$instance) {
self::$instance = new self($config == null ? PPConfigManager::getInstance()->getConfigHashmap() : $config);
}
return self::$instance;
}
/**
* Load credentials for multiple accounts, with priority given to Signature credential.
*
* @param [] $config
*/
private function initCredential($config)
{
$suffix = 1;
$prefix = "acct";
$arr = array();
foreach ($config as $k => $v) {
if (strstr($k, $prefix)) {
$arr[$k] = $v;
}
}
$credArr = $arr;
$arr = array();
foreach ($config as $key => $value) {
$pos = strpos($key, '.');
if (strstr($key, "acct")) {
$arr[] = substr($key, 0, $pos);
}
}
$arrayPartKeys = array_unique($arr);
$key = $prefix . $suffix;
$userName = null;
while (in_array($key, $arrayPartKeys)) {
if (isset($credArr[$key . ".ClientId"]) && isset($credArr[$key . ".ClientId"])) {
$userName = $key;
$this->credentialHashmap[$userName] = new OAuthTokenCredential(
$credArr[$key . ".ClientId"],
$credArr[$key . ".ClientSecret"]
);
}
if ($userName && $this->defaultAccountName == null) {
if (array_key_exists($key . '.UserName', $credArr)) {
$this->defaultAccountName = $credArr[$key . '.UserName'];
} else {
$this->defaultAccountName = $key;
}
}
$suffix++;
$key = $prefix . $suffix;
}
}
/**
* Sets credential object for users
*
* @param \PayPal\Auth\OAuthTokenCredential $credential
* @param string|null $userId User Id associated with the account
* @param bool $default If set, it would make it as a default credential for all requests
*
* @return $this
*/
public function setCredentialObject(OAuthTokenCredential $credential, $userId = null, $default = true)
{
$key = $userId == null ? 'default' : $userId;
$this->credentialHashmap[$key] = $credential;
if ($default) {
$this->defaultAccountName = $key;
}
return $this;
}
/**
* Obtain Credential Object based on UserId provided.
*
* @param null $userId
* @return OAuthTokenCredential
* @throws PPInvalidCredentialException
*/
public function getCredentialObject($userId = null)
{
if ($userId == null) {
$credObj = $this->credentialHashmap[$this->defaultAccountName];
} else if (array_key_exists($userId, $this->credentialHashmap)) {
$credObj = $this->credentialHashmap[$userId];
}
if (empty($credObj)) {
throw new PPInvalidCredentialException("Invalid userId $userId");
}
return $credObj;
}
/**
* Disabling __clone call
*/
public function __clone()
{
trigger_error('Clone is not allowed.', E_USER_ERROR);
}
}

View File

@@ -0,0 +1,258 @@
<?php
namespace PayPal\Core;
use PayPal\Exception\PPConfigurationException;
/**
* Class PPHttpConfig
* Http Configuration Class
*
* @package PayPal\Core
*/
class PPHttpConfig
{
/**
* Some default options for curl
* These are typically overridden by PPConnectionManager
*
* @var array
*/
public static $defaultCurlOptions = array(
CURLOPT_SSLVERSION => 3,
CURLOPT_CONNECTTIMEOUT => 10,
CURLOPT_RETURNTRANSFER => TRUE,
CURLOPT_TIMEOUT => 60, // maximum number of seconds to allow cURL functions to execute
CURLOPT_USERAGENT => 'PayPal-PHP-SDK',
CURLOPT_HTTPHEADER => array(),
CURLOPT_SSL_VERIFYHOST => 2,
CURLOPT_SSL_VERIFYPEER => 1
);
const HEADER_SEPARATOR = ';';
const HTTP_GET = 'GET';
const HTTP_POST = 'POST';
private $headers = array();
private $curlOptions;
private $url;
private $method;
/***
* Number of times to retry a failed HTTP call
*/
private $retryCount = 0;
/**
* Default Constructor
*
* @param string $url
* @param string $method HTTP method (GET, POST etc) defaults to POST
*/
public function __construct($url = null, $method = self::HTTP_POST)
{
$this->url = $url;
$this->method = $method;
$this->curlOptions = self::$defaultCurlOptions;
}
/**
* Gets Url
*
* @return null|string
*/
public function getUrl()
{
return $this->url;
}
/**
* Gets Method
*
* @return string
*/
public function getMethod()
{
return $this->method;
}
/**
* Gets all Headers
*
* @return array
*/
public function getHeaders()
{
return $this->headers;
}
/**
* Get Header by Name
*
* @param $name
* @return string|null
*/
public function getHeader($name)
{
if (array_key_exists($name, $this->headers)) {
return $this->headers[$name];
}
return null;
}
/**
* Sets Url
*
* @param $url
*/
public function setUrl($url)
{
$this->url = $url;
}
/**
* Set Headers
*
* @param array $headers
*/
public function setHeaders(array $headers = [])
{
$this->headers = $headers;
}
/**
* Adds a Header
*
* @param $name
* @param $value
* @param bool $overWrite allows you to override header value
*/
public function addHeader($name, $value, $overWrite = true)
{
if (!array_key_exists($name, $this->headers) || $overWrite) {
$this->headers[$name] = $value;
} else {
$this->headers[$name] = $this->headers[$name] . self::HEADER_SEPARATOR . $value;
}
}
/**
* Removes a Header
*
* @param $name
*/
public function removeHeader($name)
{
unset($this->headers[$name]);
}
/**
* Gets all curl options
*
* @return array
*/
public function getCurlOptions()
{
return $this->curlOptions;
}
/**
* Add Curl Option
*
* @param string $name
* @param mixed $value
*/
public function addCurlOption($name, $value)
{
$this->curlOptions[$name] = $value;
}
/**
* Set Curl Options. Overrides all curl options
*
* @param $options
*/
public function setCurlOptions($options)
{
$this->curlOptions = $options;
}
/**
* Set ssl parameters for certificate based client authentication
*
* @param $certPath
* @param null $passPhrase
*/
public function setSSLCert($certPath, $passPhrase = null)
{
$this->curlOptions[CURLOPT_SSLCERT] = realpath($certPath);
if (isset($passPhrase) && trim($passPhrase) != "") {
$this->curlOptions[CURLOPT_SSLCERTPASSWD] = $passPhrase;
}
}
/**
* Set connection timeout in seconds
*
* @param integer $timeout
*/
public function setHttpTimeout($timeout)
{
$this->curlOptions[CURLOPT_CONNECTTIMEOUT] = $timeout;
}
/**
* Set HTTP proxy information
*
* @param string $proxy
* @throws PPConfigurationException
*/
public function setHttpProxy($proxy)
{
$urlParts = parse_url($proxy);
if ($urlParts == false || !array_key_exists("host", $urlParts)) {
throw new PPConfigurationException("Invalid proxy configuration " . $proxy);
}
$this->curlOptions[CURLOPT_PROXY] = $urlParts["host"];
if (isset($urlParts["port"])) {
$this->curlOptions[CURLOPT_PROXY] .= ":" . $urlParts["port"];
}
if (isset($urlParts["user"])) {
$this->curlOptions[CURLOPT_PROXYUSERPWD] = $urlParts["user"] . ":" . $urlParts["pass"];
}
}
/**
* Set Http Retry Counts
*
* @param int $retryCount
*/
public function setHttpRetryCount($retryCount)
{
$this->retryCount = $retryCount;
}
/**
* Get Http Retry Counts
*
* @return int
*/
public function getHttpRetryCount()
{
return $this->retryCount;
}
/**
* Sets the User-Agent string on the HTTP request
*
* @param string $userAgentString
*/
public function setUserAgent($userAgentString)
{
$this->curlOptions[CURLOPT_USERAGENT] = $userAgentString;
}
}

View File

@@ -0,0 +1,171 @@
<?php
namespace PayPal\Core;
use PayPal\Exception\PPConfigurationException;
use PayPal\Exception\PPConnectionException;
/**
* A wrapper class based on the curl extension.
* Requires the PHP curl module to be enabled.
* See for full requirements the PHP manual: http://php.net/curl
*/
class PPHttpConnection
{
/**
* @var PPHttpConfig
*/
private $httpConfig;
/**
* HTTP status codes for which a retry must be attempted
* retry is currently attempted for Request timeout, Bad Gateway,
* Service Unavailable and Gateway timeout errors.
*/
private static $retryCodes = array('408', '502', '503', '504',);
/**
* LoggingManager
*
* @var PPLoggingManager
*/
private $logger;
/**
* Default Constructor
*
* @param PPHttpConfig $httpConfig
* @param array $config
* @throws PPConfigurationException
*/
public function __construct(PPHttpConfig $httpConfig, array $config)
{
if (!function_exists("curl_init")) {
throw new PPConfigurationException("Curl module is not available on this system");
}
$this->httpConfig = $httpConfig;
$this->logger = new PPLoggingManager(__CLASS__, $config);
}
/**
* Gets all Http Headers
*
* @return array
*/
private function getHttpHeaders()
{
$ret = array();
foreach ($this->httpConfig->getHeaders() as $k => $v) {
$ret[] = "$k: $v";
}
return $ret;
}
/**
* Executes an HTTP request
*
* @param string $data query string OR POST content as a string
* @throws PPConnectionException
*/
/**
* Executes an HTTP request
*
* @param string $data query string OR POST content as a string
* @return mixed
* @throws PPConnectionException
*/
public function execute($data)
{
//Initialize the logger
$this->logger->fine("Connecting to " . $this->httpConfig->getUrl());
$this->logger->fine("Payload " . $data);
//Initialize Curl Options
$ch = curl_init($this->httpConfig->getUrl());
curl_setopt_array($ch, $this->httpConfig->getCurlOptions());
curl_setopt($ch, CURLOPT_URL, $this->httpConfig->getUrl());
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, $this->getHttpHeaders());
//Determine Curl Options based on Method
switch ($this->httpConfig->getMethod()) {
case 'POST':
curl_setopt($ch, CURLOPT_POST, true);
case 'PUT':
case 'PATCH':
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
break;
}
//Default Option if Method not of given types in switch case
if ($this->httpConfig->getMethod() != NULL) {
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $this->httpConfig->getMethod());
}
//Logging Each Headers for debugging purposes
foreach ($this->getHttpHeaders() as $header) {
//TODO: Strip out credentials and other secure info when logging.
$this->logger->info("Adding header $header");
}
//Execute Curl Request
$result = curl_exec($ch);
//Retry if Certificate Exception
if (curl_errno($ch) == 60) {
$this->logger->info("Invalid or no certificate authority found - Retrying using bundled CA certs file");
curl_setopt($ch, CURLOPT_CAINFO, dirname(__FILE__) . '/cacert.pem');
$result = curl_exec($ch);
}
//Retrieve Response Status
$httpStatus = curl_getinfo($ch, CURLINFO_HTTP_CODE);
//Retry if Failing
$retries = 0;
if (in_array($httpStatus, self::$retryCodes) && $this->httpConfig->getHttpRetryCount() != null) {
$this->logger->info("Got $httpStatus response from server. Retrying");
do {
$result = curl_exec($ch);
$httpStatus = curl_getinfo($ch, CURLINFO_HTTP_CODE);
} while (in_array($httpStatus, self::$retryCodes) && (++$retries < $this->httpConfig->getHttpRetryCount()));
}
//Throw Exception if Retries and Certificates doenst work
if (curl_errno($ch)) {
$ex = new PPConnectionException(
$this->httpConfig->getUrl(),
curl_error($ch),
curl_errno($ch)
);
curl_close($ch);
throw $ex;
}
//Close the curl request
curl_close($ch);
//More Exceptions based on HttpStatus Code
if (in_array($httpStatus, self::$retryCodes)) {
$ex = new PPConnectionException(
$this->httpConfig->getUrl(),
"Got Http response code $httpStatus when accessing {$this->httpConfig->getUrl()}. " .
"Retried $retries times."
);
$ex->setData($result);
throw $ex;
} else if ($httpStatus < 200 || $httpStatus >= 300) {
$ex = new PPConnectionException(
$this->httpConfig->getUrl(),
"Got Http response code $httpStatus when accessing {$this->httpConfig->getUrl()}."
);
$ex->setData($result);
throw $ex;
}
//Return result object
return $result;
}
}

View File

@@ -0,0 +1,23 @@
<?php
namespace PayPal\Core;
/**
* Logging Levels.
* Class containing all the constants for Logging Levels.
*/
class PPLoggingLevel
{
// FINE Logging Level
const FINE = 3;
// INFO Logging Level
const INFO = 2;
// WARN Logging Level
const WARN = 1;
// ERROR Logging Level
const ERROR = 0;
}

View File

@@ -0,0 +1,119 @@
<?php
namespace PayPal\Core;
/**
* Simple Logging Manager.
* This does an error_log for now
* Potential frameworks to use are PEAR logger, log4php from Apache
*/
class PPLoggingManager
{
/**
* Default Logging Level
*/
const DEFAULT_LOGGING_LEVEL = 0;
/**
* Logger Name
* @var string
*/
private $loggerName;
/**
* Log Enabled
*
* @var bool
*/
private $isLoggingEnabled;
/**
* Configured Logging Level
*
* @var int|mixed
*/
private $loggingLevel;
/**
* Configured Logging File
*
* @var string
*/
private $loggerFile;
/**
* @param $loggerName
* @param array|null $config
*/
public function __construct($loggerName, $config = null)
{
$this->loggerName = $loggerName;
$config = PPConfigManager::getInstance()->getConfigHashmap();
$this->isLoggingEnabled = (array_key_exists('log.LogEnabled', $config) && $config['log.LogEnabled'] == '1');
if ($this->isLoggingEnabled) {
$this->loggerFile = ($config['log.FileName']) ? $config['log.FileName'] : ini_get('error_log');
$loggingLevel = strtoupper($config['log.LogLevel']);
$this->loggingLevel =
(isset($loggingLevel) && defined(__NAMESPACE__ . "\\PPLoggingLevel::$loggingLevel")) ?
constant(__NAMESPACE__ . "\\PPLoggingLevel::$loggingLevel") :
PPLoggingManager::DEFAULT_LOGGING_LEVEL;
}
}
/**
* Default Logger
*
* @param string $message
* @param int $level
*/
private function log($message, $level = PPLoggingLevel::INFO)
{
if ($this->isLoggingEnabled && ($level <= $this->loggingLevel)) {
error_log($this->loggerName . ": $message\n", 3, $this->loggerFile);
}
}
/**
* Log Error
*
* @param string $message
*/
public function error($message)
{
$this->log($message, PPLoggingLevel::ERROR);
}
/**
* Log Warning
*
* @param string $message
*/
public function warning($message)
{
$this->log($message, PPLoggingLevel::WARN);
}
/**
* Log Info
*
* @param string $message
*/
public function info($message)
{
$this->log($message, PPLoggingLevel::INFO);
}
/**
* Log Fine
*
* @param string $message
*/
public function fine($message)
{
$this->log($message, PPLoggingLevel::FINE);
}
}

View File

@@ -0,0 +1,23 @@
<?php
namespace PayPal\Exception;
/**
* Class PPConfigurationException
*
* @package PayPal\Exception
*/
class PPConfigurationException extends \Exception
{
/**
* Default Constructor
*
* @param string|null $message
* @param int $code
*/
public function __construct($message = null, $code = 0)
{
parent::__construct($message, $code);
}
}

View File

@@ -0,0 +1,68 @@
<?php
namespace PayPal\Exception;
/**
* Class PPConnectionException
*
* @package PayPal\Exception
*/
class PPConnectionException extends \Exception
{
/**
* The url that was being connected to when the exception occured
*
* @var string
*/
private $url;
/**
* Any response data that was returned by the server
*
* @var string
*/
private $data;
/**
* Default Constructor
*
* @param string $url
* @param string $message
* @param int $code
*/
public function __construct($url, $message, $code = 0)
{
parent::__construct($message, $code);
$this->url = $url;
}
/**
* Sets Data
*
* @param $data
*/
public function setData($data)
{
$this->data = $data;
}
/**
* Gets Data
*
* @return string
*/
public function getData()
{
return $this->data;
}
/**
* Gets Url
*
* @return string
*/
public function getUrl()
{
return $this->url;
}
}

View File

@@ -0,0 +1,36 @@
<?php
namespace PayPal\Exception;
/**
* Class PPInvalidCredentialException
*
* @package PayPal\Exception
*/
class PPInvalidCredentialException extends \Exception
{
/**
* Default Constructor
*
* @param string|null $message
* @param int $code
*/
public function __construct($message = null, $code = 0)
{
parent::__construct($message, $code);
}
/**
* prints error message
*
* @return string
*/
public function errorMessage()
{
$errorMsg = 'Error on line ' . $this->getLine() . ' in ' . $this->getFile()
. ': <b>' . $this->getMessage() . '</b>';
return $errorMsg;
}
}

View File

@@ -0,0 +1,37 @@
<?php
namespace PayPal\Exception;
/**
* Class PPMissingCredentialException
*
* @package PayPal\Exception
*/
class PPMissingCredentialException extends \Exception
{
/**
* Default Constructor
*
* @param string $message
* @param int $code
*/
public function __construct($message = null, $code = 0)
{
parent::__construct($message, $code);
}
/**
* prints error message
*
* @return string
*/
public function errorMessage()
{
$errorMsg = 'Error on line ' . $this->getLine() . ' in ' . $this->getFile()
. ': <b>' . $this->getMessage() . '</b>';
return $errorMsg;
}
}

View File

@@ -0,0 +1,20 @@
<?php
namespace PayPal\Handler;
/**
* Interface IPPHandler
*
* @package PayPal\Handler
*/
interface IPPHandler
{
/**
*
* @param \Paypal\Core\PPHttpConfig $httpConfig
* @param string $request
* @param mixed $options
* @return mixed
*/
public function handle($httpConfig, $request, $options);
}

View File

@@ -1,23 +1,19 @@
<?php <?php
/**
* Call level parameters such as request id, credentials etc
*/
namespace PayPal\Rest; namespace PayPal\Rest;
use PayPal\Common\PPApiContext; use PayPal\Core\PPConfigManager;
use PayPal\Core\PPCredentialManager;
/** /**
* Class ApiContext * Class ApiContext
*/
class ApiContext extends PPApiContext
{
/**
* OAuth Credentials to use for this call
* *
* @var \PayPal\Auth\OAuthTokenCredential $credential * Call level parameters such as request id, credentials etc
*
* @package PayPal\Rest
*/ */
private $credential; class ApiContext
{
/** /**
* Unique request id to be used for this call * Unique request id to be used for this call
@@ -28,6 +24,14 @@ class ApiContext extends PPApiContext
*/ */
private $requestId; private $requestId;
/**
* This is a placeholder for holding credential for the request
* If the value is not set, it would get the value from @\PayPal\Core\PPCredentialManager
*
* @var \Paypal\Auth\OAuthTokenCredential
*/
private $credential;
/** /**
* Get Credential * Get Credential
* *
@@ -35,6 +39,9 @@ class ApiContext extends PPApiContext
*/ */
public function getCredential() public function getCredential()
{ {
if ($this->credential == null) {
return PPCredentialManager::getInstance()->getCredentialObject();
}
return $this->credential; return $this->credential;
} }
@@ -58,16 +65,46 @@ class ApiContext extends PPApiContext
* @param \PayPal\Auth\OAuthTokenCredential $credential * @param \PayPal\Auth\OAuthTokenCredential $credential
* @param string|null $requestId * @param string|null $requestId
*/ */
public function __construct($credential, $requestId = null) public function __construct($credential = null, $requestId = null)
{ {
$this->credential = $credential;
$this->requestId = $requestId; $this->requestId = $requestId;
$this->credential = $credential;
}
/**
* Sets Config
*
* @param array $config SDK configuration parameters
*/
public function setConfig(array $config)
{
PPConfigManager::getInstance()->addConfigs($config);
}
/**
* Gets Configurations
*
* @return array
*/
public function getConfig()
{
return PPConfigManager::getInstance()->getConfigHashmap();
}
/**
* Gets a specific configuration from key
*
* @param $searchKey
*/
public function get($searchKey)
{
PPConfigManager::getInstance()->get($searchKey);
} }
/** /**
* Generates a unique per request id that * Generates a unique per request id that
* can be used to set the PayPal-Request-Id header * can be used to set the PayPal-Request-Id header
* that is used for idemptency * that is used for idempotency
* *
* @return string * @return string
*/ */

View File

@@ -4,6 +4,8 @@ namespace PayPal\Rest;
/** /**
* Interface IResource * Interface IResource
*
* @package PayPal\Rest
*/ */
interface IResource interface IResource
{ {

View File

@@ -51,14 +51,13 @@ class RestHandler implements IPPHandler
} }
/** /**
* Handle * @param \Paypal\Core\PPHttpConfig $httpConfig
* * @param string $request
* @param \PayPal\Core\PPHttpConfig $httpConfig * @param mixed $options
* @param \PayPal\Core\PPRequest $request * @return mixed|void
* @param array $options * @throws PPConfigurationException
* * @throws PPInvalidCredentialException
* @throws \PayPal\Exception\PPInvalidCredentialException * @throws PPMissingCredentialException
* @throws \PayPal\Exception\PPMissingCredentialException
*/ */
public function handle($httpConfig, $request, $options) public function handle($httpConfig, $request, $options)
{ {
@@ -125,7 +124,9 @@ class RestHandler implements IPPHandler
break; break;
} }
} else { } else {
throw new PPConfigurationException('You must set one of service.endpoint or mode parameters in your configuration'); throw new PPConfigurationException(
'You must set one of service.endpoint or mode parameters in your configuration'
);
} }
} }
} }

View File

@@ -0,0 +1,78 @@
<?php
namespace PayPal\Transport;
use PayPal\Core\PPLoggingManager;
use PayPal\Core\PPHttpConfig;
use PayPal\Core\PPHttpConnection;
/**
* Class PPRestCall
*
* @package PayPal\Transport
*/
class PPRestCall
{
/**
* Paypal Logger
*
* @var PPLoggingManager logger interface
*/
private $logger;
/**
* API Context
*
* @var \Paypal\Rest\ApiContext
*/
private $apiContext;
/**
* Default Constructor
*
* @param \Paypal\Rest\ApiContext $apiContext
*/
public function __construct(\Paypal\Rest\ApiContext $apiContext)
{
$this->apiContext = $apiContext;
$this->logger = new PPLoggingManager(__CLASS__, $apiContext->getConfig());
}
/**
* @param array $handlers Array of handlers
* @param string $path Resource path relative to base service endpoint
* @param string $method HTTP method - one of GET, POST, PUT, DELETE, PATCH etc
* @param string $data Request payload
* @param array $headers HTTP headers
* @return mixed
* @throws \PayPal\Exception\PPConnectionException
*/
public function execute($handlers = [], $path, $method, $data = '', $headers = array())
{
$config = $this->apiContext->getConfig();
$httpConfig = new PPHttpConfig(null, $method);
$httpConfig->setHeaders($headers +
array(
'Content-Type' => 'application/json'
)
);
/** @var \Paypal\Handler\IPPHandler $handler */
foreach ($handlers as $handler) {
if (!is_object($handler)) {
$fullHandler = "\\" . (string)$handler;
$handler = new $fullHandler($this->apiContext);
}
$handler->handle($httpConfig, $data, array('path' => $path, 'apiContext' => $this->apiContext));
}
$connection = new PPHttpConnection($httpConfig, $config);
$response = $connection->execute($data);
$this->logger->fine($response);
return $response;
}
}

View File

@@ -1,6 +1,11 @@
PayPal PHP SDK release notes PayPal PHP SDK release notes
============================ ============================
v0.11.1
----
* Removed Dependency from SDK Core Project
* Enabled Future Payments
v0.11.0 v0.11.0
---- ----
* Ability for PUT and PATCH requests * Ability for PUT and PATCH requests

View File

@@ -6,8 +6,7 @@
// Include the composer autoloader // Include the composer autoloader
// The location of your project's vendor autoloader. // The location of your project's vendor autoloader.
$composerAutoload = dirname(dirname(dirname(__DIR__))) . '/autoload.php'; $composerAutoload = dirname(dirname(dirname(__DIR__))) . '/autoload.php';
if (!file_exists($composerAutoload)) if (!file_exists($composerAutoload)) {
{
//If the project is used as its own project, it would use rest-api-sdk-php composer autoloader. //If the project is used as its own project, it would use rest-api-sdk-php composer autoloader.
$composerAutoload = dirname(__DIR__) . '/vendor/autoload.php'; $composerAutoload = dirname(__DIR__) . '/vendor/autoload.php';
@@ -32,7 +31,8 @@ $apiContext = getApiContext();
* *
* @return PayPal\Rest\ApiContext * @return PayPal\Rest\ApiContext
*/ */
function getApiContext() { function getApiContext()
{
// ### Api context // ### Api context
// Use an ApiContext object to authenticate // Use an ApiContext object to authenticate
@@ -48,7 +48,6 @@ function getApiContext() {
); );
// #### SDK configuration // #### SDK configuration
// Comment this line out and uncomment the PP_CONFIG_PATH // Comment this line out and uncomment the PP_CONFIG_PATH

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,44 @@
<!DOCTYPE html><html lang="en"><head><title>invoice/CancelInvoice</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="invoice/CancelInvoice"><meta name="groc-project-path" content="sample/invoice/CancelInvoice.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/invoice/CancelInvoice.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="cancel-invoice-sample">Cancel Invoice Sample</h1>
<p>This sample code demonstrate how you can cancel
an invoice.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Invoice</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">CancelNotification</span>;
<span class="hljs-keyword">try</span> {</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="retrieve-invoice">Retrieve Invoice</h3>
<p>Retrieve the invoice object by calling the
static <code>get</code> method
on the Payment class by passing a valid
Invoice ID
(See bootstrap.php for more on <code>ApiContext</code>)</p></div></div><div class="code"><div class="wrapper"> <span class="hljs-variable">$invoice</span> = Invoice::get(<span class="hljs-string">"INV2-CJL7-PF4G-BLQF-5FWG"</span>, <span class="hljs-variable">$apiContext</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="cancel-notification-object">Cancel Notification Object</h3>
<p>This would send a notification to both merchant as well
the payer about the cancellation. The information of
merchant and payer is retrieved from the invoice details</p></div></div><div class="code"><div class="wrapper"> <span class="hljs-variable">$notify</span> = <span class="hljs-keyword">new</span> CancelNotification();
<span class="hljs-variable">$notify</span>
-&gt;setSubject(<span class="hljs-string">"Past due"</span>)
-&gt;setNote(<span class="hljs-string">"Canceling invoice"</span>)
-&gt;setSendToMerchant(<span class="hljs-keyword">true</span>)
-&gt;setSendToPayer(<span class="hljs-keyword">true</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="cancel-invoice">Cancel Invoice</h3>
<p>Cancel invoice object by calling the
static <code>cancel</code> method
on the Invoice class by passing a valid
notification object
(See bootstrap.php for more on <code>ApiContext</code>)</p></div></div><div class="code"><div class="wrapper"> <span class="hljs-variable">$cancelStatus</span> = <span class="hljs-variable">$invoice</span>-&gt;cancel(<span class="hljs-variable">$notify</span>, <span class="hljs-variable">$apiContext</span>);
} <span class="hljs-keyword">catch</span> (PayPal\<span class="hljs-keyword">Exception</span>\PPConnectionException <span class="hljs-variable">$ex</span>) {
<span class="hljs-keyword">echo</span> <span class="hljs-string">"Exception: "</span> . <span class="hljs-variable">$ex</span>-&gt;getMessage() . PHP_EOL;
var_dump(<span class="hljs-variable">$ex</span>-&gt;getData());
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</span>);
}
<span class="hljs-preprocessor">?&gt;</span>
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Cancel Invoice&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div&gt;Cancel Invoice:&lt;/div&gt;
&lt;pre&gt;<span class="hljs-preprocessor">&lt;?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$invoice</span>-&gt;toJSON(JSON_PRETTY_PRINT); <span class="hljs-preprocessor">?&gt;</span>&lt;/pre&gt;
&lt;a href=<span class="hljs-string">'../index.html'</span>&gt;Back&lt;/a&gt;
&lt;/body&gt;
&lt;/html&gt;</div></div></div></div></body></html>

View File

@@ -0,0 +1,95 @@
<!DOCTYPE html><html lang="en"><head><title>invoice/CreateInvoice</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="invoice/CreateInvoice"><meta name="groc-project-path" content="sample/invoice/CreateInvoice.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/invoice/CreateInvoice.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="create-invoice-sample">Create Invoice Sample</h1>
<p>This sample code demonstrate how you can create
an invoice.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Invoice</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">MerchantInfo</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">BillingInfo</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">InvoiceItem</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Phone</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Address</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Currency</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">PaymentTerm</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">ShippingInfo</span>;
<span class="hljs-variable">$invoice</span> = <span class="hljs-keyword">new</span> Invoice();</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="invoice-info">Invoice Info</h3>
<p>Fill in all the information that is
required for invoice APIs</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$invoice</span>
-&gt;setMerchantInfo(<span class="hljs-keyword">new</span> MerchantInfo())
-&gt;setBillingInfo(<span class="hljs-keyword">array</span>(<span class="hljs-keyword">new</span> BillingInfo()))
-&gt;setItems(<span class="hljs-keyword">array</span>(<span class="hljs-keyword">new</span> InvoiceItem()))
-&gt;setNote(<span class="hljs-string">"Medical Invoice 16 Jul, 2013 PST"</span>)
-&gt;setPaymentTerm(<span class="hljs-keyword">new</span> PaymentTerm())
-&gt;setShippingInfo(<span class="hljs-keyword">new</span> ShippingInfo());</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="merchant-info">Merchant Info</h3>
<p>A resource representing merchant information that can be
used to identify merchant</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$invoice</span>-&gt;getMerchantInfo()
-&gt;setEmail(<span class="hljs-string">"PPX.DevNet-facilitator@gmail.com"</span>)
-&gt;setFirstName(<span class="hljs-string">"Dennis"</span>)
-&gt;setLastName(<span class="hljs-string">"Doctor"</span>)
-&gt;setbusinessName(<span class="hljs-string">"Medical Professionals, LLC"</span>)
-&gt;setPhone(<span class="hljs-keyword">new</span> Phone())
-&gt;setAddress(<span class="hljs-keyword">new</span> Address());
<span class="hljs-variable">$invoice</span>-&gt;getMerchantInfo()-&gt;getPhone()
-&gt;setCountryCode(<span class="hljs-string">"001"</span>)
-&gt;setNationalNumber(<span class="hljs-string">"5032141716"</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="address-information">Address Information</h3>
<p>The address used for creating the invoice</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$invoice</span>-&gt;getMerchantInfo()-&gt;getAddress()
-&gt;setLine1(<span class="hljs-string">"1234 Main St."</span>)
-&gt;setCity(<span class="hljs-string">"Portland"</span>)
-&gt;setState(<span class="hljs-string">"OR"</span>)
-&gt;setPostalCode(<span class="hljs-string">"97217"</span>)
-&gt;setCountryCode(<span class="hljs-string">"US"</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="billing-information">Billing Information</h3>
<p>Set the email address for each billing</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$billing</span> = <span class="hljs-variable">$invoice</span>-&gt;getBillingInfo();
<span class="hljs-variable">$billing</span>[<span class="hljs-number">0</span>]
-&gt;setEmail(<span class="hljs-string">"example@example.com"</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="items-list">Items List</h3>
<p>You could provide the list of all items for
detailed breakdown of invoice</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$items</span> = <span class="hljs-variable">$invoice</span>-&gt;getItems();
<span class="hljs-variable">$items</span>[<span class="hljs-number">0</span>]
-&gt;setName(<span class="hljs-string">"Sutures"</span>)
-&gt;setQuantity(<span class="hljs-number">100</span>)
-&gt;setUnitPrice(<span class="hljs-keyword">new</span> Currency());
<span class="hljs-variable">$items</span>[<span class="hljs-number">0</span>]-&gt;getUnitPrice()
-&gt;setCurrency(<span class="hljs-string">"USD"</span>)
-&gt;setValue(<span class="hljs-number">5</span>);
<span class="hljs-variable">$invoice</span>-&gt;getPaymentTerm()
-&gt;setTermType(<span class="hljs-string">"NET_45"</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="shipping-information">Shipping Information</h3></div></div></div><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-variable">$invoice</span>-&gt;getShippingInfo()
-&gt;setFirstName(<span class="hljs-string">"Sally"</span>)
-&gt;setLastName(<span class="hljs-string">"Patient"</span>)
-&gt;setBusinessName(<span class="hljs-string">"Not applicable"</span>)
-&gt;setPhone(<span class="hljs-keyword">new</span> Phone())
-&gt;setAddress(<span class="hljs-keyword">new</span> Address());
<span class="hljs-variable">$invoice</span>-&gt;getShippingInfo()-&gt;getPhone()
-&gt;setCountryCode(<span class="hljs-string">"001"</span>)
-&gt;setNationalNumber(<span class="hljs-string">"5039871234"</span>);
<span class="hljs-variable">$invoice</span>-&gt;getShippingInfo()-&gt;getAddress()
-&gt;setLine1(<span class="hljs-string">"1234 Main St."</span>)
-&gt;setCity(<span class="hljs-string">"Portland"</span>)
-&gt;setState(<span class="hljs-string">"OR"</span>)
-&gt;setPostalCode(<span class="hljs-string">"97217"</span>)
-&gt;setCountryCode(<span class="hljs-string">"US"</span>);
<span class="hljs-keyword">try</span> {</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="create-invoice">Create Invoice</h3>
<p>Create an invoice by calling the invoice-&gt;create() method
with a valid ApiContext (See bootstrap.php for more on <code>ApiContext</code>)</p></div></div><div class="code"><div class="wrapper"> <span class="hljs-variable">$invoice</span>-&gt;create(<span class="hljs-variable">$apiContext</span>);
} <span class="hljs-keyword">catch</span> (PayPal\<span class="hljs-keyword">Exception</span>\PPConnectionException <span class="hljs-variable">$ex</span>) {
<span class="hljs-keyword">echo</span> <span class="hljs-string">"Exception: "</span> . <span class="hljs-variable">$ex</span>-&gt;getMessage() . PHP_EOL;
var_dump(<span class="hljs-variable">$ex</span>-&gt;getData());
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</span>);
}
<span class="hljs-preprocessor">?&gt;</span>
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Invoice Creation&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div&gt;
Created Invoice:
<span class="hljs-preprocessor">&lt;?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$invoice</span>-&gt;getId(); <span class="hljs-preprocessor">?&gt;</span>
&lt;/div&gt;
&lt;pre&gt;<span class="hljs-preprocessor">&lt;?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$invoice</span>-&gt;toJSON(JSON_PRETTY_PRINT); <span class="hljs-preprocessor">?&gt;</span>&lt;/pre&gt;
&lt;a href=<span class="hljs-string">'../index.html'</span>&gt;Back&lt;/a&gt;
&lt;/body&gt;
&lt;/html&gt;</div></div></div></div></body></html>

View File

@@ -0,0 +1,28 @@
<!DOCTYPE html><html lang="en"><head><title>invoice/GetInvoice</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="invoice/GetInvoice"><meta name="groc-project-path" content="sample/invoice/GetInvoice.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/invoice/GetInvoice.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="get-invoice-sample">Get Invoice Sample</h1>
<p>This sample code demonstrate how you can retrieve
an invoice.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Invoice</span>;
<span class="hljs-variable">$invoiceId</span> = <span class="hljs-string">"INV2-9DRB-YTHU-2V9Q-7Q24"</span>;</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="retrieve-invoice">Retrieve Invoice</h3>
<p>Retrieve the invoice object by calling the
static <code>get</code> method
on the Invoice class by passing a valid
Invoice ID
(See bootstrap.php for more on <code>ApiContext</code>)</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">try</span> {
<span class="hljs-variable">$invoice</span> = Invoice::get(<span class="hljs-variable">$invoiceId</span>, <span class="hljs-variable">$apiContext</span>);
} <span class="hljs-keyword">catch</span> (PayPal\<span class="hljs-keyword">Exception</span>\PPConnectionException <span class="hljs-variable">$ex</span>) {
<span class="hljs-keyword">echo</span> <span class="hljs-string">"Exception:"</span> . <span class="hljs-variable">$ex</span>-&gt;getMessage() . PHP_EOL;
var_dump(<span class="hljs-variable">$ex</span>-&gt;getData());
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</span>);
}
<span class="hljs-preprocessor">?&gt;</span>
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Lookup invoice details&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div&gt;Retrieving Invoice: <span class="hljs-preprocessor">&lt;?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$invoiceId</span>;<span class="hljs-preprocessor">?&gt;</span>&lt;/div&gt;
&lt;pre&gt;<span class="hljs-preprocessor">&lt;?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$invoice</span>-&gt;toJSON(JSON_PRETTY_PRINT); <span class="hljs-preprocessor">?&gt;</span>&lt;/pre&gt;
&lt;a href=<span class="hljs-string">'../index.html'</span>&gt;Back&lt;/a&gt;
&lt;/body&gt;
&lt;/html&gt;</div></div></div></div></body></html>

View File

@@ -0,0 +1,26 @@
<!DOCTYPE html><html lang="en"><head><title>invoice/ListInvoice</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="invoice/ListInvoice"><meta name="groc-project-path" content="sample/invoice/ListInvoice.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/invoice/ListInvoice.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="list-invoices-sample">List Invoices Sample</h1>
<p>This sample code demonstrate how you can get
all invoice from history.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Invoice</span>;
<span class="hljs-keyword">try</span> {</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="retrieve-invoices">Retrieve Invoices</h3>
<p>Retrieve the Invoice History object by calling the
static <code>get_all</code> method on the Invoice class.
Refer the method doc for valid values for keys
(See bootstrap.php for more on <code>ApiContext</code>)</p></div></div><div class="code"><div class="wrapper"> <span class="hljs-variable">$invoices</span> = Invoice::get_all(<span class="hljs-variable">$apiContext</span>);
} <span class="hljs-keyword">catch</span> (PayPal\<span class="hljs-keyword">Exception</span>\PPConnectionException <span class="hljs-variable">$ex</span>) {
<span class="hljs-keyword">echo</span> <span class="hljs-string">"Exception:"</span> . <span class="hljs-variable">$ex</span>-&gt;getMessage() . PHP_EOL;
var_dump(<span class="hljs-variable">$ex</span>-&gt;getData());
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</span>);
}
<span class="hljs-preprocessor">?&gt;</span>
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Lookup invoice history&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div&gt;Got invoices &lt;/div&gt;
&lt;pre&gt;<span class="hljs-preprocessor">&lt;?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$invoices</span>-&gt;toJSON(JSON_PRETTY_PRINT); <span class="hljs-preprocessor">?&gt;</span>&lt;/pre&gt;
&lt;a href=<span class="hljs-string">'../index.html'</span>&gt;Back&lt;/a&gt;
&lt;/body&gt;
&lt;/html&gt;</div></div></div></div></body></html>

View File

@@ -0,0 +1,43 @@
<!DOCTYPE html><html lang="en"><head><title>invoice/RemindInvoice</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="invoice/RemindInvoice"><meta name="groc-project-path" content="sample/invoice/RemindInvoice.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/invoice/RemindInvoice.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="remind-invoice-sample">Remind Invoice Sample</h1>
<p>This sample code demonstrate how you can remind
an invoice to the payer</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Invoice</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Notification</span>;
<span class="hljs-keyword">try</span> {</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="retrieve-invoice">Retrieve Invoice</h3>
<p>Retrieve the invoice object by calling the
static <code>get</code> method
on the Invoice class by passing a valid
Invoice ID
(See bootstrap.php for more on <code>ApiContext</code>)</p></div></div><div class="code"><div class="wrapper"> <span class="hljs-variable">$invoice</span> = Invoice::get(<span class="hljs-string">"INV2-9CAH-K5G7-2JPL-G4B4"</span>, <span class="hljs-variable">$apiContext</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="notification-object">Notification Object</h3>
<p>This would send a notification to both merchant as well
the payer. The information of merchant
and payer is retrieved from the invoice details</p></div></div><div class="code"><div class="wrapper"> <span class="hljs-variable">$notify</span> = <span class="hljs-keyword">new</span> Notification();
<span class="hljs-variable">$notify</span>
-&gt;setSubject(<span class="hljs-string">"Past due"</span>)
-&gt;setNote(<span class="hljs-string">"Please pay soon"</span>)
-&gt;setSendToMerchant(<span class="hljs-keyword">true</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="remind-invoice">Remind Invoice</h3>
<p>Remind the notifiers by calling the
<code>remind</code> method
on the Invoice class by passing a valid
notification object
(See bootstrap.php for more on <code>ApiContext</code>)</p></div></div><div class="code"><div class="wrapper"> <span class="hljs-variable">$remindStatus</span> = <span class="hljs-variable">$invoice</span>-&gt;remind(<span class="hljs-variable">$notify</span>, <span class="hljs-variable">$apiContext</span>);
} <span class="hljs-keyword">catch</span> (PayPal\<span class="hljs-keyword">Exception</span>\PPConnectionException <span class="hljs-variable">$ex</span>) {
<span class="hljs-keyword">echo</span> <span class="hljs-string">"Exception: "</span> . <span class="hljs-variable">$ex</span>-&gt;getMessage() . PHP_EOL;
var_dump(<span class="hljs-variable">$ex</span>-&gt;getData());
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</span>);
}
<span class="hljs-preprocessor">?&gt;</span>
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Remind Invoice&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div&gt;Remind Invoice:&lt;/div&gt;
&lt;pre&gt;<span class="hljs-preprocessor">&lt;?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$invoice</span>-&gt;toJSON(JSON_PRETTY_PRINT); <span class="hljs-preprocessor">?&gt;</span>&lt;/pre&gt;
&lt;a href=<span class="hljs-string">'../index.html'</span>&gt;Back&lt;/a&gt;
&lt;/body&gt;
&lt;/html&gt;</div></div></div></div></body></html>

View File

@@ -0,0 +1,31 @@
<!DOCTYPE html><html lang="en"><head><title>invoice/SendInvoice</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="invoice/SendInvoice"><meta name="groc-project-path" content="sample/invoice/SendInvoice.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/invoice/SendInvoice.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="create-invoice-sample">Create Invoice Sample</h1>
<p>This sample code demonstrate how you can send
a legitimate invoice to the payer</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Invoice</span>;
<span class="hljs-keyword">try</span> {</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="retrieve-invoice">Retrieve Invoice</h3>
<p>Retrieve the invoice object by calling the
static <code>get</code> method
on the Invoice class by passing a valid
Invoice ID
(See bootstrap.php for more on <code>ApiContext</code>)</p></div></div><div class="code"><div class="wrapper"> <span class="hljs-variable">$invoice</span> = Invoice::get(<span class="hljs-string">"INV2-9DRB-YTHU-2V9Q-7Q24"</span>, <span class="hljs-variable">$apiContext</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="send-invoice">Send Invoice</h3>
<p>Send a legitimate invoice to the payer
with a valid ApiContext (See bootstrap.php for more on <code>ApiContext</code>)</p></div></div><div class="code"><div class="wrapper"> <span class="hljs-variable">$sendStatus</span> = <span class="hljs-variable">$invoice</span>-&gt;send(<span class="hljs-variable">$apiContext</span>);
} <span class="hljs-keyword">catch</span> (PayPal\<span class="hljs-keyword">Exception</span>\PPConnectionException <span class="hljs-variable">$ex</span>) {
<span class="hljs-keyword">echo</span> <span class="hljs-string">"Exception: "</span> . <span class="hljs-variable">$ex</span>-&gt;getMessage() . PHP_EOL;
var_dump(<span class="hljs-variable">$ex</span>-&gt;getData());
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</span>);
}
<span class="hljs-preprocessor">?&gt;</span>
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Send Invoice&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div&gt;Send Invoice:&lt;/div&gt;
&lt;pre&gt;<span class="hljs-preprocessor">&lt;?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$invoice</span>-&gt;toJSON(JSON_PRETTY_PRINT); <span class="hljs-preprocessor">?&gt;</span>&lt;/pre&gt;
&lt;a href=<span class="hljs-string">'../index.html'</span>&gt;Back&lt;/a&gt;
&lt;/body&gt;
&lt;/html&gt;</div></div></div></div></body></html>

View File

@@ -0,0 +1,39 @@
<!DOCTYPE html><html lang="en"><head><title>payments/AuthorizationCapture</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payments/AuthorizationCapture"><meta name="groc-project-path" content="sample/payments/AuthorizationCapture.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/payments/AuthorizationCapture.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="authorizationcapture">AuthorizationCapture</h1>
<p>This sample code demonstrates how you can capture
a previously authorized payment.
API used: /v1/payments/payment</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Amount</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Capture</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Authorization</span>;</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="capture-payment">Capture Payment</h3>
<p>You can capture and process a previously created authorization
by invoking the $authorization-&gt;capture method
with a valid ApiContext (See bootstrap.php for more on <code>ApiContext</code>)</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">try</span> {</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Create a new authorization to get authorization Id
createAuthorization defined in common.php</p></div></div><div class="code"><div class="wrapper"> <span class="hljs-variable">$authId</span> = createAuthorization(<span class="hljs-variable">$apiContext</span>);
<span class="hljs-variable">$amt</span> = <span class="hljs-keyword">new</span> Amount();
<span class="hljs-variable">$amt</span>-&gt;setCurrency(<span class="hljs-string">"USD"</span>)
-&gt;setTotal(<span class="hljs-string">"1.00"</span>);
<span class="hljs-comment">### Capture</span>
<span class="hljs-variable">$capture</span> = <span class="hljs-keyword">new</span> Capture();
<span class="hljs-variable">$capture</span>-&gt;setId(<span class="hljs-variable">$authId</span>)
-&gt;setAmount(<span class="hljs-variable">$amt</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Lookup the authorization.</p></div></div><div class="code"><div class="wrapper"> <span class="hljs-variable">$authorization</span> = Authorization::get(<span class="hljs-variable">$authId</span>, <span class="hljs-variable">$apiContext</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Perform a capture</p></div></div><div class="code"><div class="wrapper"> <span class="hljs-variable">$getCapture</span> = <span class="hljs-variable">$authorization</span>-&gt;capture(<span class="hljs-variable">$capture</span>, <span class="hljs-variable">$apiContext</span>);
} <span class="hljs-keyword">catch</span> (PayPal\<span class="hljs-keyword">Exception</span>\PPConnectionException <span class="hljs-variable">$ex</span>) {
<span class="hljs-keyword">echo</span> <span class="hljs-string">"Exception: "</span> . <span class="hljs-variable">$ex</span>-&gt;getMessage() . PHP_EOL;
var_dump(<span class="hljs-variable">$ex</span>-&gt;getData());
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</span>);
}
<span class="hljs-preprocessor">?&gt;</span>
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Capturing an authorization&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div&gt;
Captured payment <span class="hljs-preprocessor">&lt;?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$getCapture</span>-&gt;getParentPayment(); <span class="hljs-preprocessor">?&gt;</span>. Capture Id:
<span class="hljs-preprocessor">&lt;?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$getCapture</span>-&gt;getId();<span class="hljs-preprocessor">?&gt;</span>
&lt;/div&gt;
&lt;pre&gt;<span class="hljs-preprocessor">&lt;?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$getCapture</span>-&gt;toJSON(JSON_PRETTY_PRINT);<span class="hljs-preprocessor">?&gt;</span>&lt;/pre&gt;
&lt;a href=<span class="hljs-string">'../index.html'</span>&gt;Back&lt;/a&gt;
&lt;/body&gt;
&lt;/html&gt;</div></div></div></div></body></html>

View File

@@ -0,0 +1,97 @@
<!DOCTYPE html><html lang="en"><head><title>payments/CreatePayment</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payments/CreatePayment"><meta name="groc-project-path" content="sample/payments/CreatePayment.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/payments/CreatePayment.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="createpaymentsample">CreatePaymentSample</h1>
<p>This sample code demonstrate how you can process
a direct credit card payment. Please note that direct
credit card payment and related features using the
REST API is restricted in some countries.
API used: /v1/payments/payment</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Amount</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Details</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Item</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">ItemList</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">CreditCard</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Payer</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Payment</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">FundingInstrument</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Transaction</span>;</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="creditcard">CreditCard</h3>
<p>A resource representing a credit card that can be
used to fund a payment.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$card</span> = <span class="hljs-keyword">new</span> CreditCard();
<span class="hljs-variable">$card</span>-&gt;setType(<span class="hljs-string">"visa"</span>)
-&gt;setNumber(<span class="hljs-string">"4417119669820331"</span>)
-&gt;setExpireMonth(<span class="hljs-string">"11"</span>)
-&gt;setExpireYear(<span class="hljs-string">"2019"</span>)
-&gt;setCvv2(<span class="hljs-string">"012"</span>)
-&gt;setFirstName(<span class="hljs-string">"Joe"</span>)
-&gt;setLastName(<span class="hljs-string">"Shopper"</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="fundinginstrument">FundingInstrument</h3>
<p>A resource representing a Payer&#39;s funding instrument.
For direct credit card payments, set the CreditCard
field on this object.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$fi</span> = <span class="hljs-keyword">new</span> FundingInstrument();
<span class="hljs-variable">$fi</span>-&gt;setCreditCard(<span class="hljs-variable">$card</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="payer">Payer</h3>
<p>A resource representing a Payer that funds a payment
For direct credit card payments, set payment method
to &#39;credit_card&#39; and add an array of funding instruments.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$payer</span> = <span class="hljs-keyword">new</span> Payer();
<span class="hljs-variable">$payer</span>-&gt;setPaymentMethod(<span class="hljs-string">"credit_card"</span>)
-&gt;setFundingInstruments(<span class="hljs-keyword">array</span>(<span class="hljs-variable">$fi</span>));</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="itemized-information">Itemized information</h3>
<p>(Optional) Lets you specify item wise
information</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$item1</span> = <span class="hljs-keyword">new</span> Item();
<span class="hljs-variable">$item1</span>-&gt;setName(<span class="hljs-string">'Ground Coffee 40 oz'</span>)
-&gt;setDescription(<span class="hljs-string">'Ground Coffee 40 oz'</span>)
-&gt;setCurrency(<span class="hljs-string">'USD'</span>)
-&gt;setQuantity(<span class="hljs-number">1</span>)
-&gt;setTax(<span class="hljs-string">'0.30'</span>)
-&gt;setPrice(<span class="hljs-string">'7.50'</span>);
<span class="hljs-variable">$item2</span> = <span class="hljs-keyword">new</span> Item();
<span class="hljs-variable">$item2</span>-&gt;setName(<span class="hljs-string">'Granola bars'</span>)
-&gt;setDescription(<span class="hljs-string">'Granola Bars with Peanuts'</span>)
-&gt;setCurrency(<span class="hljs-string">'USD'</span>)
-&gt;setQuantity(<span class="hljs-number">5</span>)
-&gt;setTax(<span class="hljs-string">'0.20'</span>)
-&gt;setPrice(<span class="hljs-string">'2.00'</span>);
<span class="hljs-variable">$itemList</span> = <span class="hljs-keyword">new</span> ItemList();
<span class="hljs-variable">$itemList</span>-&gt;setItems(<span class="hljs-keyword">array</span>(<span class="hljs-variable">$item1</span>, <span class="hljs-variable">$item2</span>));</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="additional-payment-details">Additional payment details</h3>
<p>Use this optional field to set additional
payment information such as tax, shipping
charges etc.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$details</span> = <span class="hljs-keyword">new</span> Details();
<span class="hljs-variable">$details</span>-&gt;setShipping(<span class="hljs-string">'1.20'</span>)
-&gt;setTax(<span class="hljs-string">'1.30'</span>)
-&gt;setSubtotal(<span class="hljs-string">'17.50'</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="amount">Amount</h3>
<p>Lets you specify a payment amount.
You can also specify additional details
such as shipping, tax.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$amount</span> = <span class="hljs-keyword">new</span> Amount();
<span class="hljs-variable">$amount</span>-&gt;setCurrency(<span class="hljs-string">"USD"</span>)
-&gt;setTotal(<span class="hljs-string">"20.00"</span>)
-&gt;setDetails(<span class="hljs-variable">$details</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="transaction">Transaction</h3>
<p>A transaction defines the contract of a
payment - what is the payment for and who
is fulfilling it. </p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$transaction</span> = <span class="hljs-keyword">new</span> Transaction();
<span class="hljs-variable">$transaction</span>-&gt;setAmount(<span class="hljs-variable">$amount</span>)
-&gt;setItemList(<span class="hljs-variable">$itemList</span>)
-&gt;setDescription(<span class="hljs-string">"Payment description"</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="payment">Payment</h3>
<p>A Payment Resource; create one using
the above types and intent set to sale &#39;sale&#39;</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$payment</span> = <span class="hljs-keyword">new</span> Payment();
<span class="hljs-variable">$payment</span>-&gt;setIntent(<span class="hljs-string">"sale"</span>)
-&gt;setPayer(<span class="hljs-variable">$payer</span>)
-&gt;setTransactions(<span class="hljs-keyword">array</span>(<span class="hljs-variable">$transaction</span>));</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="create-payment">Create Payment</h3>
<p>Create a payment by calling the payment-&gt;create() method
with a valid ApiContext (See bootstrap.php for more on <code>ApiContext</code>)
The return object contains the state.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">try</span> {
<span class="hljs-variable">$payment</span>-&gt;create(<span class="hljs-variable">$apiContext</span>);
} <span class="hljs-keyword">catch</span> (PayPal\<span class="hljs-keyword">Exception</span>\PPConnectionException <span class="hljs-variable">$ex</span>) {
<span class="hljs-keyword">echo</span> <span class="hljs-string">"Exception: "</span> . <span class="hljs-variable">$ex</span>-&gt;getMessage() . PHP_EOL;
var_dump(<span class="hljs-variable">$ex</span>-&gt;getData());
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</span>);
}
<span class="hljs-preprocessor">?&gt;</span>
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Direct Credit card payments&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div&gt;
Created payment:
<span class="hljs-preprocessor">&lt;?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$payment</span>-&gt;getId();<span class="hljs-preprocessor">?&gt;</span>
&lt;/div&gt;
&lt;pre&gt;<span class="hljs-preprocessor">&lt;?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$payment</span>-&gt;toJSON(JSON_PRETTY_PRINT);<span class="hljs-preprocessor">?&gt;</span>&lt;/pre&gt;
&lt;a href=<span class="hljs-string">'../index.html'</span>&gt;Back&lt;/a&gt;
&lt;/body&gt;
&lt;/html&gt;</div></div></div></div></body></html>

View File

@@ -0,0 +1,90 @@
<!DOCTYPE html><html lang="en"><head><title>payments/CreatePaymentUsingPayPal</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payments/CreatePaymentUsingPayPal"><meta name="groc-project-path" content="sample/payments/CreatePaymentUsingPayPal.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/payments/CreatePaymentUsingPayPal.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="create-payment-using-paypal-as-payment-method">Create Payment using PayPal as payment method</h1>
<p>This sample code demonstrates how you can process a
PayPal Account based Payment.
API used: /v1/payments/payment</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Amount</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Details</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Item</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">ItemList</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Payer</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Payment</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">RedirectUrls</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Transaction</span>;
session_start();</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="payer">Payer</h3>
<p>A resource representing a Payer that funds a payment
For paypal account payments, set payment method
to &#39;paypal&#39;.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$payer</span> = <span class="hljs-keyword">new</span> Payer();
<span class="hljs-variable">$payer</span>-&gt;setPaymentMethod(<span class="hljs-string">"paypal"</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="itemized-information">Itemized information</h3>
<p>(Optional) Lets you specify item wise
information</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$item1</span> = <span class="hljs-keyword">new</span> Item();
<span class="hljs-variable">$item1</span>-&gt;setName(<span class="hljs-string">'Ground Coffee 40 oz'</span>)
-&gt;setCurrency(<span class="hljs-string">'USD'</span>)
-&gt;setQuantity(<span class="hljs-number">1</span>)
-&gt;setPrice(<span class="hljs-string">'7.50'</span>);
<span class="hljs-variable">$item2</span> = <span class="hljs-keyword">new</span> Item();
<span class="hljs-variable">$item2</span>-&gt;setName(<span class="hljs-string">'Granola bars'</span>)
-&gt;setCurrency(<span class="hljs-string">'USD'</span>)
-&gt;setQuantity(<span class="hljs-number">5</span>)
-&gt;setPrice(<span class="hljs-string">'2.00'</span>);
<span class="hljs-variable">$itemList</span> = <span class="hljs-keyword">new</span> ItemList();
<span class="hljs-variable">$itemList</span>-&gt;setItems(<span class="hljs-keyword">array</span>(<span class="hljs-variable">$item1</span>, <span class="hljs-variable">$item2</span>));</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="additional-payment-details">Additional payment details</h3>
<p>Use this optional field to set additional
payment information such as tax, shipping
charges etc.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$details</span> = <span class="hljs-keyword">new</span> Details();
<span class="hljs-variable">$details</span>-&gt;setShipping(<span class="hljs-string">'1.20'</span>)
-&gt;setTax(<span class="hljs-string">'1.30'</span>)
-&gt;setSubtotal(<span class="hljs-string">'17.50'</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="amount">Amount</h3>
<p>Lets you specify a payment amount.
You can also specify additional details
such as shipping, tax.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$amount</span> = <span class="hljs-keyword">new</span> Amount();
<span class="hljs-variable">$amount</span>-&gt;setCurrency(<span class="hljs-string">"USD"</span>)
-&gt;setTotal(<span class="hljs-string">"20.00"</span>)
-&gt;setDetails(<span class="hljs-variable">$details</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="transaction">Transaction</h3>
<p>A transaction defines the contract of a
payment - what is the payment for and who
is fulfilling it. </p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$transaction</span> = <span class="hljs-keyword">new</span> Transaction();
<span class="hljs-variable">$transaction</span>-&gt;setAmount(<span class="hljs-variable">$amount</span>)
-&gt;setItemList(<span class="hljs-variable">$itemList</span>)
-&gt;setDescription(<span class="hljs-string">"Payment description"</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="redirect-urls">Redirect urls</h3>
<p>Set the urls that the buyer must be redirected to after
payment approval/ cancellation.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$baseUrl</span> = getBaseUrl();
<span class="hljs-variable">$redirectUrls</span> = <span class="hljs-keyword">new</span> RedirectUrls();
<span class="hljs-variable">$redirectUrls</span>-&gt;setReturnUrl(<span class="hljs-string">"$baseUrl/ExecutePayment.php?success=true"</span>)
-&gt;setCancelUrl(<span class="hljs-string">"$baseUrl/ExecutePayment.php?success=false"</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="payment">Payment</h3>
<p>A Payment Resource; create one using
the above types and intent set to &#39;sale&#39;</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$payment</span> = <span class="hljs-keyword">new</span> Payment();
<span class="hljs-variable">$payment</span>-&gt;setIntent(<span class="hljs-string">"sale"</span>)
-&gt;setPayer(<span class="hljs-variable">$payer</span>)
-&gt;setRedirectUrls(<span class="hljs-variable">$redirectUrls</span>)
-&gt;setTransactions(<span class="hljs-keyword">array</span>(<span class="hljs-variable">$transaction</span>));</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="create-payment">Create Payment</h3>
<p>Create a payment by calling the &#39;create&#39; method
passing it a valid apiContext.
(See bootstrap.php for more on <code>ApiContext</code>)
The return object contains the state and the
url to which the buyer must be redirected to
for payment approval</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">try</span> {
<span class="hljs-variable">$payment</span>-&gt;create(<span class="hljs-variable">$apiContext</span>);
} <span class="hljs-keyword">catch</span> (PayPal\<span class="hljs-keyword">Exception</span>\PPConnectionException <span class="hljs-variable">$ex</span>) {
<span class="hljs-keyword">echo</span> <span class="hljs-string">"Exception: "</span> . <span class="hljs-variable">$ex</span>-&gt;getMessage() . PHP_EOL;
var_dump(<span class="hljs-variable">$ex</span>-&gt;getData());
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</span>);
}</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="get-redirect-url">Get redirect url</h3>
<p>The API response provides the url that you must redirect
the buyer to. Retrieve the url from the $payment-&gt;getLinks()
method</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">foreach</span>(<span class="hljs-variable">$payment</span>-&gt;getLinks() <span class="hljs-keyword">as</span> <span class="hljs-variable">$link</span>) {
<span class="hljs-keyword">if</span>(<span class="hljs-variable">$link</span>-&gt;getRel() == <span class="hljs-string">'approval_url'</span>) {
<span class="hljs-variable">$redirectUrl</span> = <span class="hljs-variable">$link</span>-&gt;getHref();
<span class="hljs-keyword">break</span>;
}
}</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="redirect-buyer-to-paypal-website">Redirect buyer to PayPal website</h3>
<p>Save the payment id so that you can &#39;complete&#39; the payment
once the buyer approves the payment and is redirected
back to your website.
It is not a great idea to store the payment id
in the session. In a real world app, you may want to
store the payment id in a database.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$_SESSION</span>[<span class="hljs-string">'paymentId'</span>] = <span class="hljs-variable">$payment</span>-&gt;getId();
<span class="hljs-keyword">if</span>(<span class="hljs-keyword">isset</span>(<span class="hljs-variable">$redirectUrl</span>)) {
header(<span class="hljs-string">"Location: $redirectUrl"</span>);
<span class="hljs-keyword">exit</span>;
}</div></div></div></div></body></html>

View File

@@ -0,0 +1,86 @@
<!DOCTYPE html><html lang="en"><head><title>payments/CreatePaymentUsingSavedCard</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payments/CreatePaymentUsingSavedCard"><meta name="groc-project-path" content="sample/payments/CreatePaymentUsingSavedCard.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/payments/CreatePaymentUsingSavedCard.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="create-payment-using-a-saved-credit-card">Create payment using a saved credit card</h1>
<p>This sample code demonstrates how you can process a
Payment using a previously stored credit card token.
API used: /v1/payments/payment</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Amount</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Details</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Item</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">ItemList</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">CreditCardToken</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Payer</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Payment</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">FundingInstrument</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Transaction</span>;</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="credit-card-token">Credit card token</h3>
<p>Saved credit card id from a previous call to
CreateCreditCard.php</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$creditCardToken</span> = <span class="hljs-keyword">new</span> CreditCardToken();
<span class="hljs-variable">$creditCardToken</span>-&gt;setCreditCardId(<span class="hljs-string">'CARD-29H07236G1554552FKINPBHQ'</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="fundinginstrument">FundingInstrument</h3>
<p>A resource representing a Payer&#39;s funding instrument.
For stored credit card payments, set the CreditCardToken
field on this object.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$fi</span> = <span class="hljs-keyword">new</span> FundingInstrument();
<span class="hljs-variable">$fi</span>-&gt;setCreditCardToken(<span class="hljs-variable">$creditCardToken</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="payer">Payer</h3>
<p>A resource representing a Payer that funds a payment
For stored credit card payments, set payment method
to &#39;credit_card&#39;.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$payer</span> = <span class="hljs-keyword">new</span> Payer();
<span class="hljs-variable">$payer</span>-&gt;setPaymentMethod(<span class="hljs-string">"credit_card"</span>)
-&gt;setFundingInstruments(<span class="hljs-keyword">array</span>(<span class="hljs-variable">$fi</span>));</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="itemized-information">Itemized information</h3>
<p>(Optional) Lets you specify item wise
information</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$item1</span> = <span class="hljs-keyword">new</span> Item();
<span class="hljs-variable">$item1</span>-&gt;setName(<span class="hljs-string">'Ground Coffee 40 oz'</span>)
-&gt;setCurrency(<span class="hljs-string">'USD'</span>)
-&gt;setQuantity(<span class="hljs-number">1</span>)
-&gt;setPrice(<span class="hljs-string">'7.50'</span>);
<span class="hljs-variable">$item2</span> = <span class="hljs-keyword">new</span> Item();
<span class="hljs-variable">$item2</span>-&gt;setName(<span class="hljs-string">'Granola bars'</span>)
-&gt;setCurrency(<span class="hljs-string">'USD'</span>)
-&gt;setQuantity(<span class="hljs-number">5</span>)
-&gt;setPrice(<span class="hljs-string">'2.00'</span>);
<span class="hljs-variable">$itemList</span> = <span class="hljs-keyword">new</span> ItemList();
<span class="hljs-variable">$itemList</span>-&gt;setItems(<span class="hljs-keyword">array</span>(<span class="hljs-variable">$item1</span>, <span class="hljs-variable">$item2</span>));</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="additional-payment-details">Additional payment details</h3>
<p>Use this optional field to set additional
payment information such as tax, shipping
charges etc.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$details</span> = <span class="hljs-keyword">new</span> Details();
<span class="hljs-variable">$details</span>-&gt;setShipping(<span class="hljs-string">'1.20'</span>)
-&gt;setTax(<span class="hljs-string">'1.30'</span>)
-&gt;setSubtotal(<span class="hljs-string">'17.50'</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="amount">Amount</h3>
<p>Lets you specify a payment amount.
You can also specify additional details
such as shipping, tax.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$amount</span> = <span class="hljs-keyword">new</span> Amount();
<span class="hljs-variable">$amount</span>-&gt;setCurrency(<span class="hljs-string">"USD"</span>)
-&gt;setTotal(<span class="hljs-string">"20.00"</span>)
-&gt;setDetails(<span class="hljs-variable">$details</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="transaction">Transaction</h3>
<p>A transaction defines the contract of a
payment - what is the payment for and who
is fulfilling it. </p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$transaction</span> = <span class="hljs-keyword">new</span> Transaction();
<span class="hljs-variable">$transaction</span>-&gt;setAmount(<span class="hljs-variable">$amount</span>)
-&gt;setItemList(<span class="hljs-variable">$itemList</span>)
-&gt;setDescription(<span class="hljs-string">"Payment description"</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="payment">Payment</h3>
<p>A Payment Resource; create one using
the above types and intent set to &#39;sale&#39;</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$payment</span> = <span class="hljs-keyword">new</span> Payment();
<span class="hljs-variable">$payment</span>-&gt;setIntent(<span class="hljs-string">"sale"</span>)
-&gt;setPayer(<span class="hljs-variable">$payer</span>)
-&gt;setTransactions(<span class="hljs-keyword">array</span>(<span class="hljs-variable">$transaction</span>));</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="create-payment">Create Payment</h3>
<p>Create a payment by calling the &#39;create&#39; method
passing it a valid apiContext.
(See bootstrap.php for more on <code>ApiContext</code>)
The return object contains the state.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">try</span> {
<span class="hljs-variable">$payment</span>-&gt;create(<span class="hljs-variable">$apiContext</span>);
} <span class="hljs-keyword">catch</span> (PayPal\<span class="hljs-keyword">Exception</span>\PPConnectionException <span class="hljs-variable">$ex</span>) {
<span class="hljs-keyword">echo</span> <span class="hljs-string">"Exception: "</span> . <span class="hljs-variable">$ex</span>-&gt;getMessage() . PHP_EOL;
var_dump(<span class="hljs-variable">$ex</span>-&gt;getData());
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</span>);
}
<span class="hljs-preprocessor">?&gt;</span>
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Saved Credit card payments&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div&gt;
Created payment:
<span class="hljs-preprocessor">&lt;?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$payment</span>-&gt;getId();<span class="hljs-preprocessor">?&gt;</span>
&lt;/div&gt;
&lt;pre&gt;<span class="hljs-preprocessor">&lt;?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$payment</span>-&gt;toJSON(JSON_PRETTY_PRINT);<span class="hljs-preprocessor">?&gt;</span>&lt;/pre&gt;
&lt;a href=<span class="hljs-string">'../index.html'</span>&gt;Back&lt;/a&gt;
&lt;/body&gt;
&lt;/html&gt;</div></div></div></div></body></html>

View File

@@ -0,0 +1,31 @@
<!DOCTYPE html><html lang="en"><head><title>payments/ExecutePayment</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payments/ExecutePayment"><meta name="groc-project-path" content="sample/payments/ExecutePayment.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/payments/ExecutePayment.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="execute-payment-sample">Execute Payment Sample</h1>
<p>This sample shows how you can complete
a payment that has been approved by
the buyer by logging into paypal site.
You can optionally update transaction
information by passing in one or more transactions.
API used: POST &#39;/v1/payments/payment/<payment-id>/execute&#39;.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">ExecutePayment</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Payment</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">PaymentExecution</span>;
session_start();
<span class="hljs-keyword">if</span>(<span class="hljs-keyword">isset</span>(<span class="hljs-variable">$_GET</span>[<span class="hljs-string">'success'</span>]) &amp;&amp; <span class="hljs-variable">$_GET</span>[<span class="hljs-string">'success'</span>] == <span class="hljs-string">'true'</span>) {
</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Get the payment Object by passing paymentId
payment id was previously stored in session in
CreatePaymentUsingPayPal.php</p></div></div><div class="code"><div class="wrapper"> <span class="hljs-variable">$paymentId</span> = <span class="hljs-variable">$_SESSION</span>[<span class="hljs-string">'paymentId'</span>];
<span class="hljs-variable">$payment</span> = Payment::get(<span class="hljs-variable">$paymentId</span>, <span class="hljs-variable">$apiContext</span>);
</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>PaymentExecution object includes information necessary
to execute a PayPal account payment.
The payer_id is added to the request query parameters
when the user is redirected from paypal back to your site</p></div></div><div class="code"><div class="wrapper"> <span class="hljs-variable">$execution</span> = <span class="hljs-keyword">new</span> PaymentExecution();
<span class="hljs-variable">$execution</span>-&gt;setPayerId(<span class="hljs-variable">$_GET</span>[<span class="hljs-string">'PayerID'</span>]);
<span class="hljs-comment">//Execute the payment</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>(See bootstrap.php for more on <code>ApiContext</code>)</p></div></div><div class="code"><div class="wrapper"> <span class="hljs-variable">$result</span> = <span class="hljs-variable">$payment</span>-&gt;execute(<span class="hljs-variable">$execution</span>, <span class="hljs-variable">$apiContext</span>);
<span class="hljs-keyword">echo</span> <span class="hljs-string">"&lt;html&gt;&lt;body&gt;&lt;pre&gt;"</span>;
<span class="hljs-keyword">echo</span> <span class="hljs-variable">$result</span>-&gt;toJSON(JSON_PRETTY_PRINT);
<span class="hljs-keyword">echo</span> <span class="hljs-string">"&lt;/pre&gt;&lt;a href='../index.html'&gt;Back&lt;/a&gt;&lt;/body&gt;&lt;/html&gt;"</span>;
} <span class="hljs-keyword">else</span> {
<span class="hljs-keyword">echo</span> <span class="hljs-string">"User cancelled payment."</span>;
}</div></div></div></div></body></html>

View File

@@ -0,0 +1,31 @@
<!DOCTYPE html><html lang="en"><head><title>payments/GetAuthorization</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payments/GetAuthorization"><meta name="groc-project-path" content="sample/payments/GetAuthorization.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/payments/GetAuthorization.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="getauthorization">GetAuthorization</h1>
<p>This sample code demonstrates how you can get details
of an authorized payment.
API used: /v1/payments/authorization/&lt;$authorizationId&gt;</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Authorization</span>;</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="getauthorization">GetAuthorization</h3>
<p>You can retrieve info about an Authorization
by invoking the Authorization::get method
with a valid ApiContext (See bootstrap.php for more on <code>ApiContext</code>)
The return object contains the authorization state.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">try</span> {</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>create a authorization to get authorization Id
createAuthorization is defined in common.php</p></div></div><div class="code"><div class="wrapper"> <span class="hljs-variable">$authId</span> = createAuthorization(<span class="hljs-variable">$apiContext</span>);
</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Retrieve the authorization</p></div></div><div class="code"><div class="wrapper"> <span class="hljs-variable">$authorization</span> = Authorization::get(<span class="hljs-variable">$authId</span>, <span class="hljs-variable">$apiContext</span>);
} <span class="hljs-keyword">catch</span> (PayPal\<span class="hljs-keyword">Exception</span>\PPConnectionException <span class="hljs-variable">$ex</span>) {
<span class="hljs-keyword">echo</span> <span class="hljs-string">"Exception: "</span> . <span class="hljs-variable">$ex</span>-&gt;getMessage() . PHP_EOL;
var_dump(<span class="hljs-variable">$ex</span>-&gt;getData());
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</span>);
}
<span class="hljs-preprocessor">?&gt;</span>
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Lookup an authorization&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div&gt;
Retrieved Authorization:
<span class="hljs-preprocessor">&lt;?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$authorization</span>-&gt;getId();<span class="hljs-preprocessor">?&gt;</span>
&lt;/div&gt;
&lt;pre&gt;<span class="hljs-preprocessor">&lt;?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$authorization</span>-&gt;toJSON(JSON_PRETTY_PRINT);<span class="hljs-preprocessor">?&gt;</span>&lt;/pre&gt;
&lt;a href=<span class="hljs-string">'../index.html'</span>&gt;Back&lt;/a&gt;
&lt;/body&gt;
&lt;/html&gt;</div></div></div></div></body></html>

View File

@@ -0,0 +1,47 @@
<!DOCTYPE html><html lang="en"><head><title>payments/GetCapture</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payments/GetCapture"><meta name="groc-project-path" content="sample/payments/GetCapture.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/payments/GetCapture.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="getcapture">GetCapture</h1>
<p>This sample code demonstrates how you can lookup the details
of a captured payment.
API used: /v1/payments/capture/&lt;$captureId&gt;</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Capture</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Amount</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Authorization</span>;</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="create-a-mock-capture">Create a mock Capture</h3></div></div></div><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-keyword">try</span> {</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>create a mock authorization to get authorization Id
createAuthorization is defined in common.php</p></div></div><div class="code"><div class="wrapper"> <span class="hljs-variable">$authId</span> = createAuthorization(<span class="hljs-variable">$apiContext</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Lookup the authorization</p></div></div><div class="code"><div class="wrapper"> <span class="hljs-variable">$authorization</span> = Authorization::get(<span class="hljs-variable">$authId</span>, <span class="hljs-variable">$apiContext</span>);
<span class="hljs-comment">### Capture</span>
<span class="hljs-variable">$amt</span> = <span class="hljs-keyword">new</span> Amount();
<span class="hljs-variable">$amt</span>-&gt;setCurrency(<span class="hljs-string">"USD"</span>)
-&gt;setTotal(<span class="hljs-string">"1.00"</span>);
</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Create a capture</p></div></div><div class="code"><div class="wrapper"> <span class="hljs-variable">$captureInfo</span> = <span class="hljs-keyword">new</span> Capture();
<span class="hljs-variable">$captureInfo</span>-&gt;setId(<span class="hljs-variable">$authId</span>)
-&gt;setAmount(<span class="hljs-variable">$amt</span>);
<span class="hljs-variable">$capture</span> = <span class="hljs-variable">$authorization</span>-&gt;capture(<span class="hljs-variable">$captureInfo</span>, <span class="hljs-variable">$apiContext</span>);
} <span class="hljs-keyword">catch</span> (PayPal\<span class="hljs-keyword">Exception</span>\PPConnectionException <span class="hljs-variable">$ex</span>) {
<span class="hljs-keyword">echo</span> <span class="hljs-string">"Exception: "</span> . <span class="hljs-variable">$ex</span>-&gt;getMessage() . PHP_EOL;
var_dump(<span class="hljs-variable">$ex</span>-&gt;getData());
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</span>);
}</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="retrieve-capture-details">Retrieve Capture details</h3>
<p>You can look up a capture by invoking the Capture::get method
with a valid ApiContext (See bootstrap.php for more on <code>ApiContext</code>)</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">try</span> {
<span class="hljs-variable">$capture</span> = Capture::get(<span class="hljs-variable">$capture</span>-&gt;getId(), <span class="hljs-variable">$apiContext</span>);
} <span class="hljs-keyword">catch</span> (PayPal\<span class="hljs-keyword">Exception</span>\PPConnectionException <span class="hljs-variable">$ex</span>) {
<span class="hljs-keyword">echo</span> <span class="hljs-string">"Exception: "</span> . <span class="hljs-variable">$ex</span>-&gt;getMessage() . PHP_EOL;
var_dump(<span class="hljs-variable">$ex</span>-&gt;getData());
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</span>);
}
<span class="hljs-preprocessor">?&gt;</span>
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Lookup a capture&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div&gt;
Capture Id:
<span class="hljs-preprocessor">&lt;?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$capture</span>-&gt;getId();<span class="hljs-preprocessor">?&gt;</span>
&lt;/div&gt;
&lt;pre&gt;<span class="hljs-preprocessor">&lt;?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$capture</span>-&gt;toJSON(JSON_PRETTY_PRINT);<span class="hljs-preprocessor">?&gt;</span>&lt;/pre&gt;
&lt;a href=<span class="hljs-string">'../index.html'</span>&gt;Back&lt;/a&gt;
&lt;/body&gt;
&lt;/html&gt;</div></div></div></div></body></html>

View File

@@ -0,0 +1,33 @@
<!DOCTYPE html><html lang="en"><head><title>payments/GetPayment</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payments/GetPayment"><meta name="groc-project-path" content="sample/payments/GetPayment.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/payments/GetPayment.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="getpaymentsample">GetPaymentSample</h1>
<p>This sample code demonstrate how you can
retrieve a list of all Payment resources
you&#39;ve created using the Payments API.
Note various query parameters that you can
use to filter, and paginate through the
payments list.
API used: GET /v1/payments/payments</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Payment</span>;
<span class="hljs-variable">$paymentId</span> = <span class="hljs-string">"PAY-0XL713371A312273YKE2GCNI"</span>;</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="retrieve-payment">Retrieve payment</h3>
<p>Retrieve the payment object by calling the
static <code>get</code> method
on the Payment class by passing a valid
Payment ID
(See bootstrap.php for more on <code>ApiContext</code>)</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">try</span> {
<span class="hljs-variable">$payment</span> = Payment::get(<span class="hljs-variable">$paymentId</span>, <span class="hljs-variable">$apiContext</span>);
} <span class="hljs-keyword">catch</span> (PayPal\<span class="hljs-keyword">Exception</span>\PPConnectionException <span class="hljs-variable">$ex</span>) {
<span class="hljs-keyword">echo</span> <span class="hljs-string">"Exception:"</span> . <span class="hljs-variable">$ex</span>-&gt;getMessage() . PHP_EOL;
var_dump(<span class="hljs-variable">$ex</span>-&gt;getData());
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</span>);
}
<span class="hljs-preprocessor">?&gt;</span>
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Lookup a payment&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div&gt;Retrieving Payment ID: <span class="hljs-preprocessor">&lt;?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$paymentId</span>;<span class="hljs-preprocessor">?&gt;</span>&lt;/div&gt;
&lt;pre&gt;<span class="hljs-preprocessor">&lt;?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$payment</span>-&gt;toJSON(JSON_PRETTY_PRINT);<span class="hljs-preprocessor">?&gt;</span>&lt;/pre&gt;
&lt;a href=<span class="hljs-string">'../index.html'</span>&gt;Back&lt;/a&gt;
&lt;/body&gt;
&lt;/html&gt;</div></div></div></div></body></html>

View File

@@ -0,0 +1,32 @@
<!DOCTYPE html><html lang="en"><head><title>payments/ListPayments</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payments/ListPayments"><meta name="groc-project-path" content="sample/payments/ListPayments.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/payments/ListPayments.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="getpaymentlist">GetPaymentList</h1>
<p>This sample code demonstrate how you can
retrieve a list of all Payment resources
you&#39;ve created using the Payments API.
Note various query parameters that you can
use to filter, and paginate through the
payments list.
API used: GET /v1/payments/payments</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Payment</span>;</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="retrieve-payment">Retrieve payment</h3>
<p>Retrieve the PaymentHistory object by calling the
static <code>get</code> method on the Payment class,
and pass a Map object that contains
query parameters for paginations and filtering.
Refer the method doc for valid values for keys
(See bootstrap.php for more on <code>ApiContext</code>)</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">try</span> {
<span class="hljs-variable">$payments</span> = Payment::all(<span class="hljs-keyword">array</span>(<span class="hljs-string">'count'</span> =&gt; <span class="hljs-number">10</span>, <span class="hljs-string">'start_index'</span> =&gt; <span class="hljs-number">5</span>), <span class="hljs-variable">$apiContext</span>);
} <span class="hljs-keyword">catch</span> (PayPal\<span class="hljs-keyword">Exception</span>\PPConnectionException <span class="hljs-variable">$ex</span>) {
<span class="hljs-keyword">echo</span> <span class="hljs-string">"Exception:"</span> . <span class="hljs-variable">$ex</span>-&gt;getMessage() . PHP_EOL;
var_dump(<span class="hljs-variable">$ex</span>-&gt;getData());
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</span>);
}
<span class="hljs-preprocessor">?&gt;</span>
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Lookup payment history&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div&gt;Got <span class="hljs-preprocessor">&lt;?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$payments</span>-&gt;getCount(); <span class="hljs-preprocessor">?&gt;</span> matching payments &lt;/div&gt;
&lt;pre&gt;<span class="hljs-preprocessor">&lt;?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$payments</span>-&gt;toJSON(JSON_PRETTY_PRINT);<span class="hljs-preprocessor">?&gt;</span>&lt;/pre&gt;
&lt;a href=<span class="hljs-string">'../index.html'</span>&gt;Back&lt;/a&gt;
&lt;/body&gt;
&lt;/html&gt;</div></div></div></div></body></html>

View File

@@ -0,0 +1,37 @@
<!DOCTYPE html><html lang="en"><head><title>payments/Reauthorization</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payments/Reauthorization"><meta name="groc-project-path" content="sample/payments/Reauthorization.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/payments/Reauthorization.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h2 id="reauthorization-sample">Reauthorization Sample</h2>
<p>This sample code demonstrates how you can reauthorize a PayPal
account payment.
API used: v1/payments/authorization/{authorization_id}/reauthorize</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Authorization</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Amount</span>;</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="reauthorization">Reauthorization</h3>
<p>Reauthorization is available only for PayPal account payments
and not for credit card payments.</p></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>You can reauthorize a payment only once 4 to 29
days after the 3-day honor period for the original authorization
has expired.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">try</span> {
</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="lookup-authorization-using-the-authorization-id">Lookup authorization using the authorization id</h3></div></div></div><div class="segment"><div class="code"><div class="wrapper"> <span class="hljs-variable">$authorization</span> = Authorization::get(<span class="hljs-string">'7GH53639GA425732B'</span>, <span class="hljs-variable">$apiContext</span>);
<span class="hljs-variable">$amount</span> = <span class="hljs-keyword">new</span> Amount();
<span class="hljs-variable">$amount</span>-&gt;setCurrency(<span class="hljs-string">"USD"</span>);
<span class="hljs-variable">$amount</span>-&gt;setTotal(<span class="hljs-string">"1.00"</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="reauthorize-with-amount-being-reauthorized">Reauthorize with amount being reauthorized</h3></div></div></div><div class="segment"><div class="code"><div class="wrapper"> <span class="hljs-variable">$authorization</span>-&gt;setAmount(<span class="hljs-variable">$amount</span>);
<span class="hljs-variable">$reauthorization</span> = <span class="hljs-variable">$authorization</span>-&gt;reauthorize(<span class="hljs-variable">$apiContext</span>);
} <span class="hljs-keyword">catch</span> (PayPal\<span class="hljs-keyword">Exception</span>\PPConnectionException <span class="hljs-variable">$ex</span>) {
<span class="hljs-keyword">echo</span> <span class="hljs-string">"Exception: "</span> . <span class="hljs-variable">$ex</span>-&gt;getMessage() . PHP_EOL;
var_dump(<span class="hljs-variable">$ex</span>-&gt;getData());
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</span>);
}
<span class="hljs-preprocessor">?&gt;</span>
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Reauthorize a payment&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div&gt;
Reauthorization Id:
<span class="hljs-preprocessor">&lt;?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$reauthorization</span>-&gt;getId();<span class="hljs-preprocessor">?&gt;</span>
&lt;/div&gt;
&lt;pre&gt;
<span class="hljs-preprocessor">&lt;?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$reauthorization</span>-&gt;toJSON(JSON_PRETTY_PRINT);<span class="hljs-preprocessor">?&gt;</span>
&lt;/pre&gt;
&lt;a href=<span class="hljs-string">'../index.html'</span>&gt;Back&lt;/a&gt;
&lt;/body&gt;
&lt;/html&gt;</div></div></div></div></body></html>

View File

@@ -0,0 +1,52 @@
<!DOCTYPE html><html lang="en"><head><title>payments/RefundCapture</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payments/RefundCapture"><meta name="groc-project-path" content="sample/payments/RefundCapture.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/payments/RefundCapture.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="refund-capture-sample">Refund Capture Sample</h1>
<p>This sample code demonstrates how you can
process a refund on a Captured transaction.
API used: /v1/payments/capture/{<captureID>}/refund</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Authorization</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Capture</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Refund</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Amount</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Rest</span>\<span class="hljs-title">ApiContext</span>;
<span class="hljs-keyword">try</span> {</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Create a mock authorization to get authorization Id</p></div></div><div class="code"><div class="wrapper"> <span class="hljs-variable">$authId</span> = createAuthorization(<span class="hljs-variable">$apiContext</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Get the authorization</p></div></div><div class="code"><div class="wrapper"> <span class="hljs-variable">$authorization</span> = Authorization::get(<span class="hljs-variable">$authId</span>, <span class="hljs-variable">$apiContext</span>);
</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="capture">Capture</h3></div></div></div><div class="segment"><div class="code"><div class="wrapper">
<span class="hljs-variable">$amt</span> = <span class="hljs-keyword">new</span> Amount();
<span class="hljs-variable">$amt</span>-&gt;setCurrency(<span class="hljs-string">"USD"</span>)
-&gt;setTotal(<span class="hljs-string">"1.00"</span>);
</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Create a capture</p></div></div><div class="code"><div class="wrapper"> <span class="hljs-variable">$captureInfo</span> = <span class="hljs-keyword">new</span> Capture();
<span class="hljs-variable">$captureInfo</span>-&gt;setAmount(<span class="hljs-variable">$amt</span>);
<span class="hljs-variable">$capture</span> = <span class="hljs-variable">$authorization</span>-&gt;capture(<span class="hljs-variable">$captureInfo</span>, <span class="hljs-variable">$apiContext</span>);
} <span class="hljs-keyword">catch</span> (PayPal\<span class="hljs-keyword">Exception</span>\PPConnectionException <span class="hljs-variable">$ex</span>) {
<span class="hljs-keyword">echo</span> <span class="hljs-string">"Exception: "</span> . <span class="hljs-variable">$ex</span>-&gt;getMessage() . PHP_EOL;
var_dump(<span class="hljs-variable">$ex</span>-&gt;getData());
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</span>);
}</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="refund">Refund</h3>
<p>Create a refund object indicating
refund amount and call the refund method</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$refund</span> = <span class="hljs-keyword">new</span> Refund();
<span class="hljs-variable">$refund</span>-&gt;setAmount(<span class="hljs-variable">$amt</span>);
<span class="hljs-keyword">try</span> {</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Create a new apiContext object so we send a new
PayPal-Request-Id (idempotency) header for this resource</p></div></div><div class="code"><div class="wrapper"> <span class="hljs-variable">$apiContext</span> = getApiContext();
<span class="hljs-variable">$captureRefund</span> = <span class="hljs-variable">$capture</span>-&gt;refund(<span class="hljs-variable">$refund</span>, <span class="hljs-variable">$apiContext</span>);
} <span class="hljs-keyword">catch</span> (PayPal\<span class="hljs-keyword">Exception</span>\PPConnectionException <span class="hljs-variable">$ex</span>) {
<span class="hljs-keyword">echo</span> <span class="hljs-string">"Exception: "</span> . <span class="hljs-variable">$ex</span>-&gt;getMessage() . PHP_EOL;
var_dump(<span class="hljs-variable">$ex</span>-&gt;getData());
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</span>);
}
<span class="hljs-preprocessor">?&gt;</span>
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Refund a captured payment&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div&gt;Refund Capture:&lt;/div&gt;
&lt;pre&gt;<span class="hljs-preprocessor">&lt;?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$captureRefund</span>-&gt;toJSON(JSON_PRETTY_PRINT);<span class="hljs-preprocessor">?&gt;</span>&lt;/pre&gt;
&lt;a href=<span class="hljs-string">'../index.html'</span>&gt;Back&lt;/a&gt;
&lt;/body&gt;
&lt;/html&gt;</div></div></div></div></body></html>

View File

@@ -0,0 +1,28 @@
<!DOCTYPE html><html lang="en"><head><title>payments/VoidAuthorization</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payments/VoidAuthorization"><meta name="groc-project-path" content="sample/payments/VoidAuthorization.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/payments/VoidAuthorization.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="voidauthorization">VoidAuthorization</h1>
<p>This sample code demonstrates how you can
void an authorized payment.
API used: /v1/payments/authorization/&lt;{authorizationid}&gt;/void&quot;</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Authorization</span>;</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="voidauthorization">VoidAuthorization</h3>
<p>You can void a previously authorized payment
by invoking the $authorization-&gt;void method
with a valid ApiContext (See bootstrap.php for more on <code>ApiContext</code>)</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">try</span> {</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>create an authorization to get authorization Id
createAuthorization is defined in common.php</p></div></div><div class="code"><div class="wrapper"> <span class="hljs-variable">$authId</span> = createAuthorization(<span class="hljs-variable">$apiContext</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Lookup the authorization</p></div></div><div class="code"><div class="wrapper"> <span class="hljs-variable">$authorization</span> = Authorization::get(<span class="hljs-variable">$authId</span>, <span class="hljs-variable">$apiContext</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Void the authorization </p></div></div><div class="code"><div class="wrapper"> <span class="hljs-variable">$voidedAuth</span> = <span class="hljs-variable">$authorization</span>-&gt;void(<span class="hljs-variable">$apiContext</span>);
} <span class="hljs-keyword">catch</span> (PayPal\<span class="hljs-keyword">Exception</span>\PPConnectionException <span class="hljs-variable">$ex</span>) {
<span class="hljs-keyword">echo</span> <span class="hljs-string">"Exception: "</span> . <span class="hljs-variable">$ex</span>-&gt;getMessage() . PHP_EOL;
var_dump(<span class="hljs-variable">$ex</span>-&gt;getData());
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</span>);
}
<span class="hljs-preprocessor">?&gt;</span>
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Void an authorization&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div&gt;
Voided authorization
&lt;/div&gt;
&lt;pre&gt;<span class="hljs-preprocessor">&lt;?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$voidedAuth</span>-&gt;toJSON(JSON_PRETTY_PRINT);<span class="hljs-preprocessor">?&gt;</span>&lt;/pre&gt;
&lt;a href=<span class="hljs-string">'../index.html'</span>&gt;Back&lt;/a&gt;
&lt;/body&gt;
&lt;/html&gt;</div></div></div></div></body></html>

View File

@@ -0,0 +1,28 @@
<!DOCTYPE html><html lang="en"><head><title>sale/GetSale</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="sale/GetSale"><meta name="groc-project-path" content="sample/sale/GetSale.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/sale/GetSale.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="get-sale-sample">Get Sale sample</h1>
<p>Sale transactions are nothing but completed payments.
This sample code demonstrates how you can retrieve
details of completed Sale Transaction.
API used: /v1/payments/sale/{sale-id}</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Sale</span>;
<span class="hljs-variable">$saleId</span> = <span class="hljs-string">'3RM92092UW5126232'</span>;
<span class="hljs-keyword">try</span> { </div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="retrieve-the-sale-object">Retrieve the sale object</h3>
<p>Pass the ID of the sale
transaction from your payment resource.</p></div></div><div class="code"><div class="wrapper"> <span class="hljs-variable">$sale</span> = Sale::get(<span class="hljs-variable">$saleId</span>, <span class="hljs-variable">$apiContext</span>);
} <span class="hljs-keyword">catch</span> (PayPal\<span class="hljs-keyword">Exception</span>\PPConnectionException <span class="hljs-variable">$ex</span>) {
<span class="hljs-keyword">echo</span> <span class="hljs-string">"Exception:"</span> . <span class="hljs-variable">$ex</span>-&gt;getMessage() . PHP_EOL;
var_dump(<span class="hljs-variable">$ex</span>-&gt;getData());
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</span>);
}
<span class="hljs-preprocessor">?&gt;</span>
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Lookup a sale&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div&gt;Retrieving sale id: <span class="hljs-preprocessor">&lt;?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$saleId</span>;<span class="hljs-preprocessor">?&gt;</span>&lt;/div&gt;
&lt;pre&gt;<span class="hljs-preprocessor">&lt;?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$sale</span>-&gt;toJSON(JSON_PRETTY_PRINT)<span class="hljs-preprocessor">?&gt;</span>&lt;/pre&gt;
&lt;a href=<span class="hljs-string">'../index.html'</span>&gt;Back&lt;/a&gt;
&lt;/body&gt;
&lt;/html&gt;</div></div></div></div></body></html>

View File

@@ -0,0 +1,38 @@
<!DOCTYPE html><html lang="en"><head><title>sale/RefundSale</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="sale/RefundSale"><meta name="groc-project-path" content="sample/sale/RefundSale.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/sale/RefundSale.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="sale-refund-sample">Sale Refund Sample</h1>
<p>This sample code demonstrate how you can
process a refund on a sale transaction created
using the Payments API.
API used: /v1/payments/sale/{sale-id}/refund</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Amount</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Refund</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Sale</span>;</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="refund-amount">Refund amount</h3>
<p>Includes both the refunded amount (to Payer)
and refunded fee (to Payee). Use the $amt-&gt;details
field to mention fees refund details.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$amt</span> = <span class="hljs-keyword">new</span> Amount();
<span class="hljs-variable">$amt</span>-&gt;setCurrency(<span class="hljs-string">'USD'</span>)
-&gt;setTotal(<span class="hljs-string">'0.01'</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="refund-object">Refund object</h3></div></div></div><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-variable">$refund</span> = <span class="hljs-keyword">new</span> Refund();
<span class="hljs-variable">$refund</span>-&gt;setAmount(<span class="hljs-variable">$amt</span>);
<span class="hljs-variable">$saleId</span> = <span class="hljs-string">'3RM92092UW5126232'</span>;</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="sale">Sale</h3>
<p>A sale transaction.
Create a Sale object with the
given sale transaction id.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$sale</span> = <span class="hljs-keyword">new</span> Sale();
<span class="hljs-variable">$sale</span>-&gt;setId(<span class="hljs-variable">$saleId</span>);
<span class="hljs-keyword">try</span> { </div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Refund the sale
(See bootstrap.php for more on <code>ApiContext</code>)</p></div></div><div class="code"><div class="wrapper"> <span class="hljs-variable">$sale</span>-&gt;refund(<span class="hljs-variable">$refund</span>, <span class="hljs-variable">$apiContext</span>);
} <span class="hljs-keyword">catch</span> (PayPal\<span class="hljs-keyword">Exception</span>\PPConnectionException <span class="hljs-variable">$ex</span>) {
<span class="hljs-keyword">echo</span> <span class="hljs-string">"Exception:"</span> . <span class="hljs-variable">$ex</span>-&gt;getMessage() . PHP_EOL;
var_dump(<span class="hljs-variable">$ex</span>-&gt;getData());
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</span>);
}
<span class="hljs-preprocessor">?&gt;</span>
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Refund a sale&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div&gt;Refunding sale id: <span class="hljs-preprocessor">&lt;?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$saleId</span>;<span class="hljs-preprocessor">?&gt;</span>&lt;/div&gt;
&lt;pre&gt;<span class="hljs-preprocessor">&lt;?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$sale</span>-&gt;toJSON(JSON_PRETTY_PRINT);<span class="hljs-preprocessor">?&gt;</span>&lt;/pre&gt;
&lt;a href=<span class="hljs-string">'../index.html'</span>&gt;Back&lt;/a&gt;
&lt;/body&gt;
&lt;/html&gt;</div></div></div></div></body></html>

View File

@@ -0,0 +1,37 @@
<!DOCTYPE html><html lang="en"><head><title>vault/CreateCreditCard</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="vault/CreateCreditCard"><meta name="groc-project-path" content="sample/vault/CreateCreditCard.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/vault/CreateCreditCard.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="create-credit-card-sample">Create Credit Card Sample</h1>
<p>You can store credit card details securely
with PayPal. You can then use the returned
Credit card id to process future payments.
API used: POST /v1/vault/credit-card</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">CreditCard</span>;</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="creditcard">CreditCard</h3>
<p>A resource representing a credit card that is
to be stored with PayPal.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$card</span> = <span class="hljs-keyword">new</span> CreditCard();
<span class="hljs-variable">$card</span>-&gt;setType(<span class="hljs-string">"visa"</span>)
-&gt;setNumber(<span class="hljs-string">"4417119669820331"</span>)
-&gt;setExpireMonth(<span class="hljs-string">"11"</span>)
-&gt;setExpireYear(<span class="hljs-string">"2019"</span>)
-&gt;setCvv2(<span class="hljs-string">"012"</span>)
-&gt;setFirstName(<span class="hljs-string">"Joe"</span>)
-&gt;setLastName(<span class="hljs-string">"Shopper"</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="save-card">Save card</h3>
<p>Creates the credit card as a resource
in the PayPal vault. The response contains
an &#39;id&#39; that you can use to refer to it
in future payments.
(See bootstrap.php for more on <code>ApiContext</code>)</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">try</span> {
<span class="hljs-variable">$card</span>-&gt;create(<span class="hljs-variable">$apiContext</span>);
} <span class="hljs-keyword">catch</span> (PayPal\<span class="hljs-keyword">Exception</span>\PPConnectionException <span class="hljs-variable">$ex</span>) {
<span class="hljs-keyword">echo</span> <span class="hljs-string">"Exception:"</span> . <span class="hljs-variable">$ex</span>-&gt;getMessage() . PHP_EOL;
var_dump(<span class="hljs-variable">$ex</span>-&gt;getData());
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</span>);
}
<span class="hljs-preprocessor">?&gt;</span>
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Save a credit card&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div&gt;Saved a <span class="hljs-keyword">new</span> credit card with id: <span class="hljs-preprocessor">&lt;?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$card</span>-&gt;getId();<span class="hljs-preprocessor">?&gt;</span>&lt;/div&gt;
&lt;pre&gt;<span class="hljs-preprocessor">&lt;?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$card</span>-&gt;toJSON(JSON_PRETTY_PRINT);<span class="hljs-preprocessor">?&gt;</span>&lt;/pre&gt;
&lt;a href=<span class="hljs-string">'../index.html'</span>&gt;Back&lt;/a&gt;
&lt;/body&gt;
&lt;/html&gt;</div></div></div></div></body></html>

View File

@@ -0,0 +1,45 @@
<!DOCTYPE html><html lang="en"><head><title>vault/DeleteCreditCard</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="vault/DeleteCreditCard"><meta name="groc-project-path" content="sample/vault/DeleteCreditCard.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/vault/DeleteCreditCard.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="delete-creditcard-sample">Delete CreditCard Sample</h1>
<p>This sample code demonstrate how you can
delete a saved credit card.
API used: /v1/vault/credit-card/{<creditCardId>}
NOTE: HTTP method used here is DELETE</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">CreditCard</span>;</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Store a mock card that can be deleted later.</p>
<h3 id="creditcard">CreditCard</h3>
<p>A resource representing a credit card that can be
used to fund a payment.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$card</span> = <span class="hljs-keyword">new</span> CreditCard();
<span class="hljs-variable">$card</span>-&gt;setType(<span class="hljs-string">"visa"</span>)
-&gt;setNumber(<span class="hljs-string">"4417119669820331"</span>)
-&gt;setExpireMonth(<span class="hljs-string">"11"</span>)
-&gt;setExpireYear(<span class="hljs-string">"2019"</span>)
-&gt;setCvv2(<span class="hljs-string">"012"</span>)
-&gt;setFirstName(<span class="hljs-string">"Joe"</span>)
-&gt;setLastName(<span class="hljs-string">"Shopper"</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="save-card">Save card</h3>
<p>Creates the credit card as a resource
in the PayPal vault. The response contains
an &#39;id&#39; that you can use to refer to it later.
(See bootstrap.php for more on <code>ApiContext</code>)</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">try</span> {
<span class="hljs-variable">$card</span> = <span class="hljs-variable">$card</span>-&gt;create(<span class="hljs-variable">$apiContext</span>);
} <span class="hljs-keyword">catch</span> (PayPal\<span class="hljs-keyword">Exception</span>\PPConnectionException <span class="hljs-variable">$ex</span>) {
<span class="hljs-keyword">echo</span> <span class="hljs-string">"Exception:"</span> . <span class="hljs-variable">$ex</span>-&gt;getMessage() . PHP_EOL;
var_dump(<span class="hljs-variable">$ex</span>-&gt;getData());
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</span>);
}
<span class="hljs-keyword">try</span> {</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="delete-card">Delete Card</h3>
<p>Lookup and delete a saved credit card.
(See bootstrap.php for more on <code>ApiContext</code>)</p></div></div><div class="code"><div class="wrapper"> <span class="hljs-variable">$creditCard</span> = CreditCard::get(<span class="hljs-variable">$card</span>-&gt;getId(), <span class="hljs-variable">$apiContext</span>);
<span class="hljs-variable">$creditCard</span>-&gt;delete(<span class="hljs-variable">$apiContext</span>);
} <span class="hljs-keyword">catch</span> (PayPal\<span class="hljs-keyword">Exception</span>\PPConnectionException <span class="hljs-variable">$ex</span>) {
<span class="hljs-keyword">echo</span> <span class="hljs-string">"Exception: "</span> . <span class="hljs-variable">$ex</span>-&gt;getMessage() . PHP_EOL;
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</span>);
}
<span class="hljs-preprocessor">?&gt;</span>
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Delete a saved credit card&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;p&gt; Credit Card deleted Successfully&lt;/p&gt;
&lt;a href=<span class="hljs-string">'../index.html'</span>&gt;Back&lt;/a&gt;
&lt;/body&gt;
&lt;/html&gt;</div></div></div></div></body></html>

View File

@@ -0,0 +1,27 @@
<!DOCTYPE html><html lang="en"><head><title>vault/GetCreditCard</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="vault/GetCreditCard"><meta name="groc-project-path" content="sample/vault/GetCreditCard.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/vault/GetCreditCard.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="get-credit-card-sample">Get Credit Card Sample</h1>
<p>The CreditCard resource allows you to
retrieve previously saved CreditCards.
API called: &#39;/v1/vault/credit-card&#39;
The following code takes you through
the process of retrieving a saved CreditCard</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">CreditCard</span>;</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>The cardId can be obtained from a previous save credit
card operation. Use $card-&gt;getId()</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$cardId</span> = <span class="hljs-string">"CARD-5AR29593TC404090HKIKN77Q"</span>;
<span class="hljs-comment">/// ### Retrieve card</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>(See bootstrap.php for more on <code>ApiContext</code>)</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">try</span> {
<span class="hljs-variable">$card</span> = CreditCard::get(<span class="hljs-variable">$cardId</span>, <span class="hljs-variable">$apiContext</span>);
} <span class="hljs-keyword">catch</span> (PayPal\<span class="hljs-keyword">Exception</span>\PPConnectionException <span class="hljs-variable">$ex</span>) {
<span class="hljs-keyword">echo</span> <span class="hljs-string">"Exception: "</span> . <span class="hljs-variable">$ex</span>-&gt;getMessage() . PHP_EOL;
var_dump(<span class="hljs-variable">$ex</span>-&gt;getData());
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</span>);
}
<span class="hljs-preprocessor">?&gt;</span>
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Lookup a saved credit card&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div&gt;Retrieving saved credit card: <span class="hljs-preprocessor">&lt;?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$cardId</span>;<span class="hljs-preprocessor">?&gt;</span>&lt;/div&gt;
&lt;pre&gt;<span class="hljs-preprocessor">&lt;?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$card</span>-&gt;toJSON(JSON_PRETTY_PRINT);<span class="hljs-preprocessor">?&gt;</span>&lt;/pre&gt;
&lt;a href=<span class="hljs-string">'../index.html'</span>&gt;Back&lt;/a&gt;
&lt;/body&gt;
&lt;/html&gt;</div></div></div></div></body></html>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 173 B

BIN
sample/images/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

BIN
sample/images/pp_v_rgb.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

View File

@@ -1,121 +1,310 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html> <!DOCTYPE html>
<html lang="en">
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <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="images/favicon.ico">
<title>PayPal REST API Samples</title> <title>PayPal REST API Samples</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<style> <style>
.imagelink { body {
padding: 5px 0px 5px 28px; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
} -webkit-font-smoothing: antialiased;
.execute {
background: url('images/play_button.png') no-repeat left top;
}
.source {
background: url('images/edt-format-source-button.png') no-repeat left top;
}
.header {
font-weight: bold;
}
.header td {
padding: 10px 0px 10px 0px;
} }
</style> </style>
<!-- HTML5 shim and Respond.js 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> </head>
<body> <body>
<center> <!-- Main component for a primary marketing message or call to action -->
<h3>PayPal REST API Samples</h3> <div class="jumbotron">
</center> <div class="container">
<table cellspacing="5" width="85%"> <div class="row">
<tbody> <div class="col-md-3">
<tr valign="top" class='header'> <img src="images/pp_v_rgb.png" height="200" />
<td>Payments</td> </div>
</tr> <div class="col-md-9">
<tr valign="top"> <h1> REST API Samples</h1>
<td>Direct credit card payments</td> <p>These examples are created to experiment with the rest-api-sdk-php capabilities. Each examples are designed to demonstrate the default use-cases in each segment.
<td width="30%" ><a href="payments/CreatePayment.php" class="execute imagelink">Execute</a></td> Many examples should be executable, and should allow you to experience the default behavior of our sdk, to expedite your integration experience.</p>
<td width="30%"><a href="source/CreatePayment.html" class="source imagelink">Source</a></td> <p>
</tr> </div>
<tr> </div>
<td>PayPal account payments</td> </p>
<td><a href="payments/CreatePaymentUsingPayPal.php" class="execute imagelink">Execute</a></td> </div>
<td><a href="source/CreatePaymentUsingPayPal.html" class="source imagelink">Source</a></td> </div>
</tr> <div class="container-fluid">
<tr> <div class="container">
<td>Stored credit card payments</td> <div class="panel panel-primary">
<td><a href="payments/CreatePaymentUsingSavedCard.php" class="execute imagelink">Execute</a></td> <div class="panel-heading">
<td><a href="source/CreatePaymentUsingSavedCard.html" class="source imagelink">Source</a></td> <h3 class="panel-title">Payments</h3>
<tr> </div>
<td>Get payment details</td> <!-- List group -->
<td><a href="payments/GetPayment.php" class="execute imagelink" >Execute</a></td> <ul class="list-group">
<td><a href="source/GetPayment.html" class="source imagelink" >Source</a></td> <li class="list-group-item">
</tr> <div class="row">
<tr> <div class="col-md-9 "><h5>Direct credit card payments</h5></div>
<td>Get payment history</td> <div class="col-md-3">
<td><a href="payments/ListPayments.php" class="execute imagelink" >Execute</a></td> <a href="payments/CreatePayment.php" class="btn btn-primary pull-left" >Execute <i class="fa fa-play-circle-o"></i></a>
<td><a href="source/ListPayments.html" class="source imagelink" >Source</a></td> <a href="doc/payments/CreatePayment.html" class="btn btn-default pull-right" >Source <i class="fa fa-file-code-o"></i></a>
</tr> </div>
<tr> </div>
<td>Get sale details</td> </li>
<td><a href="sale/GetSale.php" class="execute imagelink" >Execute</a></td> <li class="list-group-item">
<td><a href="source/GetSale.html" class="source imagelink" >Source</a></td> <div class="row">
</tr> <div class="col-md-9 "><h5>PayPal account payments</h5></div>
<tr> <div class="col-md-3">
<td>Refund a payment</td> <a href="payments/CreatePaymentUsingPayPal.php" class="btn btn-primary pull-left" >Execute <i class="fa fa-play-circle-o"></i></a><a href="doc/payments/CreatePaymentUsingPayPal.html" class="btn btn-default pull-right" >Source <i class="fa fa-file-code-o"></i></a>
<td><a href="sale/RefundSale.php" class="execute imagelink" >Execute</a></td> </div>
<td><a href="source/RefundSale.html" class="source imagelink" >Source</a></td> </div>
</tr> </li>
<tr valign="top" class='header'> <li class="list-group-item">
<td>Vault</td> <div class="row">
</tr> <div class="col-md-9 "><h5>Stored credit card payments</h5></div>
<tr> <div class="col-md-3">
<td>Save a credit card</td> <a href="payments/CreatePaymentUsingSavedCard.php" class="btn btn-primary pull-left" >Execute <i class="fa fa-play-circle-o"></i></a>
<td><a href="vault/CreateCreditCard.php" class="execute imagelink" >Execute</a></td> <a href="doc/payments/CreatePayment.html" class="btn btn-default pull-right" >Source <i class="fa fa-file-code-o"></i></a>
<td><a href="source/CreateCreditCard.html" class="source imagelink" >Source</a></td> </div>
</tr> </div>
<tr> </li>
<td>Retrieve saved credit card</td> <li class="list-group-item">
<td><a href="vault/GetCreditCard.php" class="execute imagelink" >Execute</a></td> <div class="row">
<td><a href="source/GetCreditCard.html" class="source imagelink" >Source</a></td> <div class="col-md-9 "><h5>Future payments* <small> (needs Authorization Code from Mobile SDK)</small></h5></div>
</tr> <div class="col-md-3"></div>
<tr> <div class="col-md-3">
<td>Delete saved credit card</td> <a href="doc/payments/CreateFuturePayment.html" class="btn btn-default pull-right" >Source <i class="fa fa-file-code-o"></i></a>
<td><a href="vault/DeleteCreditCard.php" class="execute imagelink" >Execute</a></td> </div>
<td><a href="source/DeleteCreditCard.html" class="source imagelink" >Source</a></td>
</tr> </div>
<tr valign="top" class='header'> </li>
<td>Authorization and capture</td> <li class="list-group-item">
</tr> <div class="row">
<tr> <div class="col-md-9 "><h5>Get payment details</h5></div>
<td>Get details of an authorized payment</td> <div class="col-md-3">
<td><a href="payments/GetAuthorization.php" class="execute imagelink" >Execute</a></td> <a href="payments/GetPayment.php" class="btn btn-primary pull-left" >Execute <i class="fa fa-play-circle-o"></i></a>
<td><a href="source/GetAuthorization.html" class="source imagelink" >Source</a></td> <a href="doc/payments/CreatePayment.html" class="btn btn-default pull-right" >Source <i class="fa fa-file-code-o"></i></a>
</tr> </div>
<tr> </div>
<td>Capture an authorized payment</td> </li>
<td><a href="payments/AuthorizationCapture.php" class="execute imagelink" >Execute</a></td> <li class="list-group-item">
<td><a href="source/AuthorizationCapture.html" class="source imagelink" >Source</a></td> <div class="row">
</tr> <div class="col-md-9 "><h5>Get payment history</h5></div>
<tr> <div class="col-md-3">
<td>Void an authorized payment</td> <a href="payments/ListPayments.php" class="btn btn-primary pull-left" >Execute <i class="fa fa-play-circle-o"></i></a>
<td><a href="payments/VoidAuthorization.php" class="execute imagelink" >Execute</a></td> <a href="doc/payments/CreatePayment.html" class="btn btn-default pull-right" >Source <i class="fa fa-file-code-o"></i></a>
<td><a href="source/VoidAuthorization.html" class="source imagelink" >Source</a></td> </div>
</tr> </div>
<tr> </li>
<td>Reauthorize a payment</td> </ul>
<td><a href="payments/Reauthorization.php" class="execute imagelink" >Execute</a></td> </div>
<td><a href="source/Reauthorization.html" class="source imagelink" >Source</a></td>
</tr> <div class="panel panel-primary" >
<tr> <div class="panel-heading" >
<td>Get details of a captured payment</td> <h3 class="panel-title">Sale</h3>
<td><a href="payments/GetCapture.php" class="execute imagelink" >Execute</a></td> </div>
<td><a href="source/GetCapture.html" class="source imagelink" >Source</a></td> <!-- List group -->
</tr> <ul class="list-group">
<tr> <li class="list-group-item">
<td>Refund captured payment</td> <div class="row">
<td><a href="payments/RefundCapture.php" class="execute imagelink" >Execute</a></td> <div class="col-md-9 "><h5>Get sale details</h5></div>
<td><a href="source/RefundCapture.html" class="source imagelink" >Source</a></td> <div class="col-md-3">
</tr> <a href="sale/GetSale.php" class="btn btn-primary pull-left" >Execute <i class="fa fa-play-circle-o"></i></a>
</tbody> <a href="doc/sale/GetSale.html" class="btn btn-default pull-right" >Source <i class="fa fa-file-code-o"></i></a>
</table> </div>
</div>
</li>
<li class="list-group-item">
<div class="row">
<div class="col-md-9 "><h5>Refund a payment</h5></div>
<div class="col-md-3">
<a href="sale/RefundSale.php" class="btn btn-primary pull-left" >Execute <i class="fa fa-play-circle-o"></i></a>
<a href="doc/sale/RefundSale.html" class="btn btn-default pull-right" >Source <i class="fa fa-file-code-o"></i></a>
</div>
</div>
</li>
</ul>
</div>
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">Vault</h3>
</div>
<!-- List group -->
<ul class="list-group">
<li class="list-group-item">
<div class="row">
<div class="col-md-9 "><h5>Save a credit card</h5></div>
<div class="col-md-3">
<a href="vault/CreateCreditCard.php" class="btn btn-primary pull-left" >Execute <i class="fa fa-play-circle-o"></i></a>
<a href="doc/vault/CreateCreditCard.html" class="btn btn-default pull-right" >Source <i class="fa fa-file-code-o"></i></a>
</div>
</div>
</li>
<li class="list-group-item">
<div class="row">
<div class="col-md-9 "><h5>Retrieve saved credit card</h5></div>
<div class="col-md-3">
<a href="vault/GetCreditCard.php" class="btn btn-primary pull-left" >Execute <i class="fa fa-play-circle-o"></i></a>
<a href="doc/vault/GetCreditCard.html" class="btn btn-default pull-right" >Source <i class="fa fa-file-code-o"></i></a>
</div>
</div>
</li>
<li class="list-group-item">
<div class="row">
<div class="col-md-9 "><h5>Delete saved credit card</h5></div>
<div class="col-md-3">
<a href="vault/DeleteCreditCard.php" class="btn btn-primary pull-left" >Execute <i class="fa fa-play-circle-o"></i></a>
<a href="doc/vault/DeleteCreditCard.html" class="btn btn-default pull-right" >Source <i class="fa fa-file-code-o"></i></a>
</div>
</div>
</li>
</ul>
</div>
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">Authorization and capture</h3>
</div>
<!-- List group -->
<ul class="list-group">
<li class="list-group-item">
<div class="row">
<div class="col-md-9 "><h5>Get details of an authorized payment</h5></div>
<div class="col-md-3">
<a href="payments/GetAuthorization.php" class="btn btn-primary pull-left" >Execute <i class="fa fa-play-circle-o"></i></a>
<a href="doc/payments/GetAuthorization.html" class="btn btn-default pull-right" >Source <i class="fa fa-file-code-o"></i></a>
</div>
</div>
</li>
<li class="list-group-item">
<div class="row">
<div class="col-md-9 "><h5>Capture an authorized payment</h5></div>
<div class="col-md-3">
<a href="payments/AuthorizationCapture.php" class="btn btn-primary pull-left" >Execute <i class="fa fa-play-circle-o"></i></a>
<a href="doc/payments/AuthorizationCapture.html" class="btn btn-default pull-right" >Source <i class="fa fa-file-code-o"></i></a>
</div>
</div>
</li>
<li class="list-group-item">
<div class="row">
<div class="col-md-9 "><h5>Void an authorized payment</h5></div>
<div class="col-md-3">
<a href="payments/VoidAuthorization.php" class="btn btn-primary pull-left" >Execute <i class="fa fa-play-circle-o"></i></a>
<a href="doc/payments/VoidAuthorization.html" class="btn btn-default pull-right" >Source <i class="fa fa-file-code-o"></i></a>
</div>
</div>
</li>
<li class="list-group-item">
<div class="row">
<div class="col-md-9 "><h5>Reauthorize a payment</h5></div>
<div class="col-md-3">
<a href="payments/Reauthorization.php" class="btn btn-primary pull-left" >Execute <i class="fa fa-play-circle-o"></i></a>
<a href="doc/payments/Reauthorization.html" class="btn btn-default pull-right" >Source <i class="fa fa-file-code-o"></i></a>
</div>
</div>
</li>
<li class="list-group-item">
<div class="row">
<div class="col-md-9 "><h5>Get details of a captured payment</h5></div>
<div class="col-md-3">
<a href="payments/GetCapture.php" class="btn btn-primary pull-left" >Execute <i class="fa fa-play-circle-o"></i></a>
<a href="doc/payments/GetCapture.html" class="btn btn-default pull-right" >Source <i class="fa fa-file-code-o"></i></a>
</div>
</div>
</li>
<li class="list-group-item">
<div class="row">
<div class="col-md-9 "><h5>Refund captured payment</h5></div>
<div class="col-md-3">
<a href="payments/RefundCapture.php" class="btn btn-primary pull-left" >Execute <i class="fa fa-play-circle-o"></i></a>
<a href="doc/payments/RefundCapture.html" class="btn btn-default pull-right" >Source <i class="fa fa-file-code-o"></i></a>
</div>
</div>
</li>
</ul>
</div>
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">Invoice</h3>
</div>
<!-- List group -->
<ul class="list-group">
<li class="list-group-item">
<div class="row">
<div class="col-md-9 "><h5>Create Invoice</h5></div>
<div class="col-md-3">
<a href="invoice/CreateInvoice.php" class="btn btn-primary pull-left" >Execute <i class="fa fa-play-circle-o"></i></a>
<a href="doc/" class="btn btn-default pull-right" >Source <i class="fa fa-file-code-o"></i></a>
</div>
</div>
</li>
<li class="list-group-item">
<div class="row">
<div class="col-md-9 "><h5>Get Invoice</h5></div>
<div class="col-md-3">
<a href="invoice/GetInvoice.php" class="btn btn-primary pull-left" >Execute <i class="fa fa-play-circle-o"></i></a>
<a href="doc/" class="btn btn-default pull-right" >Source <i class="fa fa-file-code-o"></i></a>
</div>
</div>
</li>
<li class="list-group-item">
<div class="row">
<div class="col-md-9 "><h5>List All Invoice</h5></div>
<div class="col-md-3">
<a href="invoice/ListInvoice.php" class="btn btn-primary pull-left" >Execute <i class="fa fa-play-circle-o"></i></a>
<a href="doc/" class="btn btn-default pull-right" >Source <i class="fa fa-file-code-o"></i></a>
</div>
</div>
</li>
<li class="list-group-item">
<div class="row">
<div class="col-md-9 "><h5>Send Invoice</h5></div>
<div class="col-md-3">
<a href="invoice/SendInvoice.php" class="btn btn-primary pull-left" >Execute <i class="fa fa-play-circle-o"></i></a>
<a href="doc/" class="btn btn-default pull-right" >Source <i class="fa fa-file-code-o"></i></a>
</div>
</div>
</li>
<li class="list-group-item">
<div class="row">
<div class="col-md-9 "><h5>Remind Invoice</h5></div>
<div class="col-md-3">
<a href="invoice/RemindInvoice.php" class="btn btn-primary pull-left" >Execute <i class="fa fa-play-circle-o"></i></a>
<a href="doc/" class="btn btn-default pull-right" >Source <i class="fa fa-file-code-o"></i></a>
</div>
</div>
</li>
<li class="list-group-item">
<div class="row">
<div class="col-md-9 "><h5>Cancel Invoice</h5></div>
<div class="col-md-3">
<a href="invoice/CancelInvoice.php" class="btn btn-primary pull-left" >Execute <i class="fa fa-play-circle-o"></i></a>
<a href="doc/" class="btn btn-default pull-right" >Source <i class="fa fa-file-code-o"></i></a>
</div>
</div>
</li>
</ul>
</div>
</div>
</div> <!-- /container -->
<!-- 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.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.2.0/js/scrollspy.min.js"></script>
</body> </body>
</html> </html>

View File

@@ -0,0 +1,57 @@
<?php
// # Cancel Invoice Sample
// This sample code demonstrate how you can cancel
// an invoice.
require __DIR__ . '/../bootstrap.php';
use PayPal\Api\Invoice;
use PayPal\Api\CancelNotification;
try {
// ### Retrieve Invoice
// Retrieve the invoice object by calling the
// static `get` method
// on the Payment class by passing a valid
// Invoice ID
// (See bootstrap.php for more on `ApiContext`)
$invoice = Invoice::get("INV2-CJL7-PF4G-BLQF-5FWG", $apiContext);
// ### Cancel Notification Object
// This would send a notification to both merchant as well
// the payer about the cancellation. The information of
// merchant and payer is retrieved from the invoice details
$notify = new CancelNotification();
$notify
->setSubject("Past due")
->setNote("Canceling invoice")
->setSendToMerchant(true)
->setSendToPayer(true);
// ### Cancel Invoice
// Cancel invoice object by calling the
// static `cancel` method
// on the Invoice class by passing a valid
// notification object
// (See bootstrap.php for more on `ApiContext`)
$cancelStatus = $invoice->cancel($notify, $apiContext);
} catch (PayPal\Exception\PPConnectionException $ex) {
echo "Exception: " . $ex->getMessage() . PHP_EOL;
var_dump($ex->getData());
exit(1);
}
?>
<html>
<head>
<title>Cancel Invoice</title>
</head>
<body>
<div>Cancel Invoice:</div>
<pre><?php echo $invoice->toJSON(JSON_PRETTY_PRINT); ?></pre>
<a href='../index.html'>Back</a>
</body>
</html>

View File

@@ -0,0 +1,119 @@
<?php
// # Create Invoice Sample
// This sample code demonstrate how you can create
// an invoice.
require __DIR__ . '/../bootstrap.php';
use PayPal\Api\Invoice;
use PayPal\Api\MerchantInfo;
use PayPal\Api\BillingInfo;
use PayPal\Api\InvoiceItem;
use PayPal\Api\Phone;
use PayPal\Api\Address;
use PayPal\Api\Currency;
use PayPal\Api\PaymentTerm;
use PayPal\Api\ShippingInfo;
$invoice = new Invoice();
// ### Invoice Info
// Fill in all the information that is
// required for invoice APIs
$invoice
->setMerchantInfo(new MerchantInfo())
->setBillingInfo(array(new BillingInfo()))
->setItems(array(new InvoiceItem()))
->setNote("Medical Invoice 16 Jul, 2013 PST")
->setPaymentTerm(new PaymentTerm())
->setShippingInfo(new ShippingInfo());
// ### Merchant Info
// A resource representing merchant information that can be
// used to identify merchant
$invoice->getMerchantInfo()
->setEmail("PPX.DevNet-facilitator@gmail.com")
->setFirstName("Dennis")
->setLastName("Doctor")
->setbusinessName("Medical Professionals, LLC")
->setPhone(new Phone())
->setAddress(new Address());
$invoice->getMerchantInfo()->getPhone()
->setCountryCode("001")
->setNationalNumber("5032141716");
// ### Address Information
// The address used for creating the invoice
$invoice->getMerchantInfo()->getAddress()
->setLine1("1234 Main St.")
->setCity("Portland")
->setState("OR")
->setPostalCode("97217")
->setCountryCode("US");
// ### Billing Information
// Set the email address for each billing
$billing = $invoice->getBillingInfo();
$billing[0]
->setEmail("example@example.com");
// ### Items List
// You could provide the list of all items for
// detailed breakdown of invoice
$items = $invoice->getItems();
$items[0]
->setName("Sutures")
->setQuantity(100)
->setUnitPrice(new Currency());
$items[0]->getUnitPrice()
->setCurrency("USD")
->setValue(5);
$invoice->getPaymentTerm()
->setTermType("NET_45");
// ### Shipping Information
$invoice->getShippingInfo()
->setFirstName("Sally")
->setLastName("Patient")
->setBusinessName("Not applicable")
->setPhone(new Phone())
->setAddress(new Address());
$invoice->getShippingInfo()->getPhone()
->setCountryCode("001")
->setNationalNumber("5039871234");
$invoice->getShippingInfo()->getAddress()
->setLine1("1234 Main St.")
->setCity("Portland")
->setState("OR")
->setPostalCode("97217")
->setCountryCode("US");
try {
// ### Create Invoice
// Create an invoice by calling the invoice->create() method
// with a valid ApiContext (See bootstrap.php for more on `ApiContext`)
$invoice->create($apiContext);
} catch (PayPal\Exception\PPConnectionException $ex) {
echo "Exception: " . $ex->getMessage() . PHP_EOL;
var_dump($ex->getData());
exit(1);
}
?>
<html>
<head>
<title>Invoice Creation</title>
</head>
<body>
<div>
Created Invoice:
<?php echo $invoice->getId(); ?>
</div>
<pre><?php echo $invoice->toJSON(JSON_PRETTY_PRINT); ?></pre>
<a href='../index.html'>Back</a>
</body>
</html>

View File

@@ -0,0 +1,35 @@
<?php
// # Get Invoice Sample
// This sample code demonstrate how you can retrieve
// an invoice.
require __DIR__ . '/../bootstrap.php';
use PayPal\Api\Invoice;
$invoiceId = "INV2-9DRB-YTHU-2V9Q-7Q24";
// ### Retrieve Invoice
// Retrieve the invoice object by calling the
// static `get` method
// on the Invoice class by passing a valid
// Invoice ID
// (See bootstrap.php for more on `ApiContext`)
try {
$invoice = Invoice::get($invoiceId, $apiContext);
} catch (PayPal\Exception\PPConnectionException $ex) {
echo "Exception:" . $ex->getMessage() . PHP_EOL;
var_dump($ex->getData());
exit(1);
}
?>
<html>
<head>
<title>Lookup invoice details</title>
</head>
<body>
<div>Retrieving Invoice: <?php echo $invoiceId;?></div>
<pre><?php echo $invoice->toJSON(JSON_PRETTY_PRINT); ?></pre>
<a href='../index.html'>Back</a>
</body>
</html>

View File

@@ -0,0 +1,32 @@
<?php
// # List Invoices Sample
// This sample code demonstrate how you can get
// all invoice from history.
require __DIR__ . '/../bootstrap.php';
use PayPal\Api\Invoice;
try {
// ### Retrieve Invoices
// Retrieve the Invoice History object by calling the
// static `get_all` method on the Invoice class.
// Refer the method doc for valid values for keys
// (See bootstrap.php for more on `ApiContext`)
$invoices = Invoice::get_all($apiContext);
} catch (PayPal\Exception\PPConnectionException $ex) {
echo "Exception:" . $ex->getMessage() . PHP_EOL;
var_dump($ex->getData());
exit(1);
}
?>
<html>
<head>
<title>Lookup invoice history</title>
</head>
<body>
<div>Got invoices </div>
<pre><?php echo $invoices->toJSON(JSON_PRETTY_PRINT); ?></pre>
<a href='../index.html'>Back</a>
</body>
</html>

View File

@@ -0,0 +1,55 @@
<?php
// # Remind Invoice Sample
// This sample code demonstrate how you can remind
// an invoice to the payer
require __DIR__ . '/../bootstrap.php';
use PayPal\Api\Invoice;
use PayPal\Api\Notification;
try {
// ### Retrieve Invoice
// Retrieve the invoice object by calling the
// static `get` method
// on the Invoice class by passing a valid
// Invoice ID
// (See bootstrap.php for more on `ApiContext`)
$invoice = Invoice::get("INV2-9CAH-K5G7-2JPL-G4B4", $apiContext);
// ### Notification Object
// This would send a notification to both merchant as well
// the payer. The information of merchant
// and payer is retrieved from the invoice details
$notify = new Notification();
$notify
->setSubject("Past due")
->setNote("Please pay soon")
->setSendToMerchant(true);
// ### Remind Invoice
// Remind the notifiers by calling the
// `remind` method
// on the Invoice class by passing a valid
// notification object
// (See bootstrap.php for more on `ApiContext`)
$remindStatus = $invoice->remind($notify, $apiContext);
} catch (PayPal\Exception\PPConnectionException $ex) {
echo "Exception: " . $ex->getMessage() . PHP_EOL;
var_dump($ex->getData());
exit(1);
}
?>
<html>
<head>
<title>Remind Invoice</title>
</head>
<body>
<div>Remind Invoice:</div>
<pre><?php echo $invoice->toJSON(JSON_PRETTY_PRINT); ?></pre>
<a href='../index.html'>Back</a>
</body>
</html>

View File

@@ -0,0 +1,40 @@
<?php
// # Create Invoice Sample
// This sample code demonstrate how you can send
// a legitimate invoice to the payer
require __DIR__ . '/../bootstrap.php';
use PayPal\Api\Invoice;
try {
// ### Retrieve Invoice
// Retrieve the invoice object by calling the
// static `get` method
// on the Invoice class by passing a valid
// Invoice ID
// (See bootstrap.php for more on `ApiContext`)
$invoice = Invoice::get("INV2-9DRB-YTHU-2V9Q-7Q24", $apiContext);
// ### Send Invoice
// Send a legitimate invoice to the payer
// with a valid ApiContext (See bootstrap.php for more on `ApiContext`)
$sendStatus = $invoice->send($apiContext);
} catch (PayPal\Exception\PPConnectionException $ex) {
echo "Exception: " . $ex->getMessage() . PHP_EOL;
var_dump($ex->getData());
exit(1);
}
?>
<html>
<head>
<title>Send Invoice</title>
</head>
<body>
<div>Send Invoice:</div>
<pre><?php echo $invoice->toJSON(JSON_PRETTY_PRINT); ?></pre>
<a href='../index.html'>Back</a>
</body>
</html>

View File

@@ -1,37 +0,0 @@
<?php
require __DIR__ . '/../bootstrap.php';
use PayPal\Api\Invoice;
use PayPal\Api\CancelNotification;
try {
$invoice = Invoice::get("INV2-CJL7-PF4G-BLQF-5FWG", $apiContext);
$notify = new CancelNotification();
$notify
->setSubject("Past due")
->setNote("Canceling invoice")
->setSendToMerchant(true)
->setSendToPayer(true);
$cancelStatus = $invoice->cancel($notify, $apiContext);
} catch (PayPal\Exception\PPConnectionException $ex) {
echo "Exception: " . $ex->getMessage() . PHP_EOL;
var_dump($ex->getData());
exit(1);
}
?>
<html>
<head>
<title>Cancel Invoice</title>
</head>
<body>
<div>Cancel Invoice:</div>
<pre><?php var_dump($invoice);?></pre>
<a href='../index.html'>Back</a>
</body>
</html>

View File

@@ -1,100 +0,0 @@
<?php
require __DIR__ . '/../bootstrap.php';
use PayPal\Api\Invoice;
use PayPal\Api\MerchantInfo;
use PayPal\Api\BillingInfo;
use PayPal\Api\InvoiceItem;
use PayPal\Api\Phone;
use PayPal\Api\Address;
use PayPal\Api\Currency;
use PayPal\Api\PaymentTerm;
use PayPal\Api\ShippingInfo;
$invoice = new Invoice();
$invoice
->setMerchantInfo(new MerchantInfo())
->setBillingInfo(array(new BillingInfo()))
->setItems(array(new InvoiceItem()))
->setNote("Medical Invoice 16 Jul, 2013 PST")
->setPaymentTerm(new PaymentTerm())
->setShippingInfo(new ShippingInfo());
$invoice->getMerchantInfo()
->setEmail("PPX.DevNet-facilitator@gmail.com")
->setFirstName("Dennis")
->setLastName("Doctor")
->setbusinessName("Medical Professionals, LLC")
->setPhone(new Phone())
->setAddress(new Address());
$invoice->getMerchantInfo()->getPhone()
->setCountryCode("001")
->setNationalNumber("5032141716");
$invoice->getMerchantInfo()->getAddress()
->setLine1("1234 Main St.")
->setCity("Portland")
->setState("OR")
->setPostalCode("97217")
->setCountryCode("US");
$billing = $invoice->getBillingInfo();
$billing[0]
->setEmail("example@example.com");
$items = $invoice->getItems();
$items[0]
->setName("Sutures")
->setQuantity(100)
->setUnitPrice(new Currency());
$items[0]->getUnitPrice()
->setCurrency("USD")
->setValue(5);
$invoice->getPaymentTerm()
->setTermType("NET_45");
$invoice->getShippingInfo()
->setFirstName("Sally")
->setLastName("Patient")
->setBusinessName("Not applicable")
->setPhone(new Phone())
->setAddress(new Address());
$invoice->getShippingInfo()->getPhone()
->setCountryCode("001")
->setNationalNumber("5039871234");
$invoice->getShippingInfo()->getAddress()
->setLine1("1234 Main St.")
->setCity("Portland")
->setState("OR")
->setPostalCode("97217")
->setCountryCode("US");
print(var_dump($invoice->toArray()));
try {
$invoice->create($apiContext);
} catch (PayPal\Exception\PPConnectionException $ex) {
echo "Exception: " . $ex->getMessage() . PHP_EOL;
var_dump($ex->getData());
exit(1);
}
?>
<html>
<head>
<title>Direct Credit card payments</title>
</head>
<body>
<div>
Created Invoice:
<?php echo $invoice->getId();?>
</div>
<pre><?php var_dump($invoice->toArray());?></pre>
<a href='../index.html'>Back</a>
</body>
</html>

View File

@@ -1,19 +0,0 @@
<?php
require __DIR__ . '/../bootstrap.php';
use PayPal\Api\Invoice;
$invoiceId = "INV2-9DRB-YTHU-2V9Q-7Q24";
$invoice = Invoice::get($invoiceId, $apiContext);
?>
<html>
<head>
<title>Lookup invoice details</title>
</head>
<body>
<div>Retrieving Invoice: <?php echo $invoiceId;?></div>
<pre><?php var_dump($invoice);?></pre>
<a href='../index.html'>Back</a>
</body>
</html>

View File

@@ -1,22 +0,0 @@
<?php
require __DIR__ . '/../bootstrap.php';
use PayPal\Api\Invoice;
try {
$invoices = Invoice::get_all($apiContext);
} catch (PayPal\Exception\PPConnectionException $ex) {
echo "Exception:" . $ex->getMessage() . PHP_EOL;
var_dump($ex->getData());
exit(1);
}
?>
<html>
<head>
<title>Lookup invoice history</title>
</head>
<body>
<div>Got invoices </div>
<pre><?php var_dump($invoices->toArray());?></pre>
<a href='../index.html'>Back</a>
</body>
</html>

View File

@@ -1,35 +0,0 @@
<?php
require __DIR__ . '/../bootstrap.php';
use PayPal\Api\Invoice;
use PayPal\Api\Notification;
try {
$invoice = Invoice::get("INV2-9CAH-K5G7-2JPL-G4B4", $apiContext);
$notify = new Notification();
$notify
->setSubject("Past due")
->setNote("Please pay soon")
->setSendToMerchant(true);
$remindStatus = $invoice->remind($notify, $apiContext);
} catch (PayPal\Exception\PPConnectionException $ex) {
echo "Exception: " . $ex->getMessage() . PHP_EOL;
var_dump($ex->getData());
exit(1);
}
?>
<html>
<head>
<title>Remind Invoice</title>
</head>
<body>
<div>Remind Invoice:</div>
<pre><?php var_dump($invoice);?></pre>
<a href='../index.html'>Back</a>
</body>
</html>

View File

@@ -1,27 +0,0 @@
<?php
require __DIR__ . '/../bootstrap.php';
use PayPal\Api\Invoice;
try {
$invoice = Invoice::get("INV2-9DRB-YTHU-2V9Q-7Q24", $apiContext);
$sendStatus = $invoice->send($apiContext);
} catch (PayPal\Exception\PPConnectionException $ex) {
echo "Exception: " . $ex->getMessage() . PHP_EOL;
var_dump($ex->getData());
exit(1);
}
?>
<html>
<head>
<title>Send Invoice</title>
</head>
<body>
<div>Send Invoice:</div>
<pre><?php var_dump($invoice);?></pre>
<a href='../index.html'>Back</a>
</body>
</html>

View File

@@ -48,7 +48,7 @@ try {
Captured payment <?php echo $getCapture->getParentPayment(); ?>. Capture Id: Captured payment <?php echo $getCapture->getParentPayment(); ?>. Capture Id:
<?php echo $getCapture->getId();?> <?php echo $getCapture->getId();?>
</div> </div>
<pre><?php var_dump($getCapture->toArray());?></pre> <pre><?php echo $getCapture->toJSON(JSON_PRETTY_PRINT);?></pre>
<a href='../index.html'>Back</a> <a href='../index.html'>Back</a>
</body> </body>
</html> </html>

View File

@@ -123,7 +123,7 @@ try {
Created payment: Created payment:
<?php echo $payment->getId();?> <?php echo $payment->getId();?>
</div> </div>
<pre><?php var_dump($payment->toArray());?></pre> <pre><?php echo $payment->toJSON(JSON_PRETTY_PRINT);?></pre>
<a href='../index.html'>Back</a> <a href='../index.html'>Back</a>
</body> </body>
</html> </html>

View File

@@ -111,7 +111,7 @@ try {
Created payment: Created payment:
<?php echo $payment->getId();?> <?php echo $payment->getId();?>
</div> </div>
<pre><?php var_dump($payment->toArray());?></pre> <pre><?php echo $payment->toJSON(JSON_PRETTY_PRINT);?></pre>
<a href='../index.html'>Back</a> <a href='../index.html'>Back</a>
</body> </body>
</html> </html>

View File

@@ -32,7 +32,7 @@ if(isset($_GET['success']) && $_GET['success'] == 'true') {
$result = $payment->execute($execution, $apiContext); $result = $payment->execute($execution, $apiContext);
echo "<html><body><pre>"; echo "<html><body><pre>";
var_dump($result); echo $result->toJSON(JSON_PRETTY_PRINT);
echo "</pre><a href='../index.html'>Back</a></body></html>"; echo "</pre><a href='../index.html'>Back</a></body></html>";
} else { } else {

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