forked from LiveCarta/PayPal-PHP-SDK
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:
@@ -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)
|
||||||
[](https://bitdeli.com/free "Bitdeli Badge")
|
[](https://bitdeli.com/free "Bitdeli Badge")
|
||||||
|
|||||||
67
build.xml
67
build.xml
@@ -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>
|
|
||||||
@@ -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.*"
|
||||||
|
|||||||
@@ -4,221 +4,248 @@ 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) {
|
*/
|
||||||
$this->email = $email;
|
public function setEmail($email)
|
||||||
return $this;
|
{
|
||||||
}
|
$this->email = $email;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Email address of the invoice recipient. 260 characters max.
|
* Email address of the invoice recipient. 260 characters max.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getEmail() {
|
public function getEmail()
|
||||||
return $this->email;
|
{
|
||||||
}
|
return $this->email;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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;
|
{
|
||||||
return $this;
|
$this->first_name = $first_name;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* First name of the invoice recipient. 30 characters max.
|
* First name of the invoice recipient. 30 characters max.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getFirstName() {
|
public function getFirstName()
|
||||||
return $this->first_name;
|
{
|
||||||
}
|
return $this->first_name;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
||||||
* @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;
|
{
|
||||||
return $this;
|
$this->first_name = $first_name;
|
||||||
}
|
return $this;
|
||||||
/**
|
}
|
||||||
* First name of the invoice recipient. 30 characters max.
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
* @deprecated. Instead use getFirstName
|
|
||||||
*/
|
|
||||||
public function getFirst_name() {
|
|
||||||
return $this->first_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Last name of the invoice recipient. 30 characters max.
|
* First name of the invoice recipient. 30 characters max.
|
||||||
*
|
*
|
||||||
* @param string $last_name
|
* @return string
|
||||||
*/
|
* @deprecated. Instead use getFirstName
|
||||||
public function setLastName($last_name) {
|
*/
|
||||||
$this->last_name = $last_name;
|
public function getFirst_name()
|
||||||
return $this;
|
{
|
||||||
}
|
return $this->first_name;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Last name of the invoice recipient. 30 characters max.
|
* Last name of the invoice recipient. 30 characters max.
|
||||||
*
|
*
|
||||||
* @return string
|
* @param string $last_name
|
||||||
*/
|
*/
|
||||||
public function getLastName() {
|
public function setLastName($last_name)
|
||||||
return $this->last_name;
|
{
|
||||||
}
|
$this->last_name = $last_name;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Last name of the invoice recipient. 30 characters max.
|
* Last name of the invoice recipient. 30 characters max.
|
||||||
*
|
*
|
||||||
* @param string $last_name
|
* @return string
|
||||||
* @deprecated. Instead use setLastName
|
*/
|
||||||
*/
|
public function getLastName()
|
||||||
public function setLast_name($last_name) {
|
{
|
||||||
$this->last_name = $last_name;
|
return $this->last_name;
|
||||||
return $this;
|
}
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Last name of the invoice recipient. 30 characters max.
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
* @deprecated. Instead use getLastName
|
|
||||||
*/
|
|
||||||
public function getLast_name() {
|
|
||||||
return $this->last_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Company business name of the invoice recipient. 100 characters max.
|
* Last name of the invoice recipient. 30 characters max.
|
||||||
*
|
*
|
||||||
* @param string $business_name
|
* @param string $last_name
|
||||||
*/
|
* @deprecated. Instead use setLastName
|
||||||
public function setBusinessName($business_name) {
|
*/
|
||||||
$this->business_name = $business_name;
|
public function setLast_name($last_name)
|
||||||
return $this;
|
{
|
||||||
}
|
$this->last_name = $last_name;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Company business name of the invoice recipient. 100 characters max.
|
* Last name of the invoice recipient. 30 characters max.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
* @deprecated. Instead use getLastName
|
||||||
public function getBusinessName() {
|
*/
|
||||||
return $this->business_name;
|
public function getLast_name()
|
||||||
}
|
{
|
||||||
|
return $this->last_name;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Company business name of the invoice recipient. 100 characters max.
|
* Company business name of the invoice recipient. 100 characters max.
|
||||||
*
|
*
|
||||||
* @param string $business_name
|
* @param string $business_name
|
||||||
* @deprecated. Instead use setBusinessName
|
*/
|
||||||
*/
|
public function setBusinessName($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.
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
* @deprecated. Instead use getBusinessName
|
|
||||||
*/
|
|
||||||
public function getBusiness_name() {
|
|
||||||
return $this->business_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Address of the invoice recipient.
|
* Company business name of the invoice recipient. 100 characters max.
|
||||||
*
|
*
|
||||||
* @param PayPal\Api\Address $address
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function setAddress($address) {
|
public function getBusinessName()
|
||||||
$this->address = $address;
|
{
|
||||||
return $this;
|
return $this->business_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Address of the invoice recipient.
|
* Company business name of the invoice recipient. 100 characters max.
|
||||||
*
|
*
|
||||||
* @return PayPal\Api\Address
|
* @param string $business_name
|
||||||
*/
|
* @deprecated. Instead use setBusinessName
|
||||||
public function getAddress() {
|
*/
|
||||||
return $this->address;
|
public function setBusiness_name($business_name)
|
||||||
}
|
{
|
||||||
|
$this->business_name = $business_name;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Company business name of the invoice recipient. 100 characters max.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
* @deprecated. Instead use getBusinessName
|
||||||
|
*/
|
||||||
|
public function getBusiness_name()
|
||||||
|
{
|
||||||
|
return $this->business_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Address of the invoice recipient.
|
||||||
|
*
|
||||||
|
* @param PayPal\Api\Address $address
|
||||||
|
*/
|
||||||
|
public function setAddress($address)
|
||||||
|
{
|
||||||
|
$this->address = $address;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Address of the invoice recipient.
|
||||||
|
*
|
||||||
|
* @return PayPal\Api\Address
|
||||||
|
*/
|
||||||
|
public function getAddress()
|
||||||
|
{
|
||||||
|
return $this->address;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Language of the email sent to the payer. Will only be used if payer doesn't have a PayPal account.
|
* Language of the email sent to the payer. Will only be used if payer doesn't have a PayPal account.
|
||||||
*
|
*
|
||||||
* @param string $language
|
* @param string $language
|
||||||
*/
|
*/
|
||||||
public function setLanguage($language) {
|
public function setLanguage($language)
|
||||||
$this->language = $language;
|
{
|
||||||
return $this;
|
$this->language = $language;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Language of the email sent to the payer. Will only be used if payer doesn't have a PayPal account.
|
* Language of the email sent to the payer. Will only be used if payer doesn't have a PayPal account.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getLanguage() {
|
public function getLanguage()
|
||||||
return $this->language;
|
{
|
||||||
}
|
return $this->language;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Option to display additional information such as business hours. 40 characters max.
|
* Option to display additional information such as business hours. 40 characters max.
|
||||||
*
|
*
|
||||||
* @param string $additional_info
|
* @param string $additional_info
|
||||||
*/
|
*/
|
||||||
public function setAdditionalInfo($additional_info) {
|
public function setAdditionalInfo($additional_info)
|
||||||
$this->additional_info = $additional_info;
|
{
|
||||||
return $this;
|
$this->additional_info = $additional_info;
|
||||||
}
|
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
|
||||||
*/
|
*/
|
||||||
public function getAdditionalInfo() {
|
public function getAdditionalInfo()
|
||||||
return $this->additional_info;
|
{
|
||||||
}
|
return $this->additional_info;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Option to display additional information such as business hours. 40 characters max.
|
* Option to display additional information such as business hours. 40 characters max.
|
||||||
*
|
*
|
||||||
* @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;
|
{
|
||||||
return $this;
|
$this->additional_info = $additional_info;
|
||||||
}
|
return $this;
|
||||||
/**
|
}
|
||||||
* Option to display additional information such as business hours. 40 characters max.
|
|
||||||
*
|
/**
|
||||||
* @return string
|
* Option to display additional information such as business hours. 40 characters max.
|
||||||
* @deprecated. Instead use getAdditionalInfo
|
*
|
||||||
*/
|
* @return string
|
||||||
public function getAdditional_info() {
|
* @deprecated. Instead use getAdditionalInfo
|
||||||
return $this->additional_info;
|
*/
|
||||||
}
|
public function getAdditional_info()
|
||||||
|
{
|
||||||
|
return $this->additional_info;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,123 +4,138 @@ 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) {
|
*/
|
||||||
$this->subject = $subject;
|
public function setSubject($subject)
|
||||||
return $this;
|
{
|
||||||
}
|
$this->subject = $subject;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Subject of the notification.
|
* Subject of the notification.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getSubject() {
|
public function getSubject()
|
||||||
return $this->subject;
|
{
|
||||||
}
|
return $this->subject;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Note to the payer.
|
* Note to the payer.
|
||||||
*
|
*
|
||||||
* @param string $note
|
* @param string $note
|
||||||
*/
|
*/
|
||||||
public function setNote($note) {
|
public function setNote($note)
|
||||||
$this->note = $note;
|
{
|
||||||
return $this;
|
$this->note = $note;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Note to the payer.
|
* Note to the payer.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getNote() {
|
public function getNote()
|
||||||
return $this->note;
|
{
|
||||||
}
|
return $this->note;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
*
|
*
|
||||||
* @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;
|
{
|
||||||
return $this;
|
$this->send_to_merchant = $send_to_merchant;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A flag indicating whether a copy of the email has to be sent to the merchant.
|
* A flag indicating whether a copy of the email has to be sent to the merchant.
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function getSendToMerchant() {
|
public function getSendToMerchant()
|
||||||
return $this->send_to_merchant;
|
{
|
||||||
}
|
return $this->send_to_merchant;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
*
|
*
|
||||||
* @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;
|
{
|
||||||
return $this;
|
$this->send_to_merchant = $send_to_merchant;
|
||||||
}
|
return $this;
|
||||||
/**
|
}
|
||||||
* A flag indicating whether a copy of the email has to be sent to the merchant.
|
|
||||||
*
|
|
||||||
* @return boolean
|
|
||||||
* @deprecated. Instead use getSendToMerchant
|
|
||||||
*/
|
|
||||||
public function getSend_to_merchant() {
|
|
||||||
return $this->send_to_merchant;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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 merchant.
|
||||||
*
|
*
|
||||||
* @param boolean $send_to_payer
|
* @return boolean
|
||||||
*/
|
* @deprecated. Instead use getSendToMerchant
|
||||||
public function setSendToPayer($send_to_payer) {
|
*/
|
||||||
$this->send_to_payer = $send_to_payer;
|
public function getSend_to_merchant()
|
||||||
return $this;
|
{
|
||||||
}
|
return $this->send_to_merchant;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
* @param boolean $send_to_payer
|
||||||
*/
|
*/
|
||||||
public function getSendToPayer() {
|
public function setSendToPayer($send_to_payer)
|
||||||
return $this->send_to_payer;
|
{
|
||||||
}
|
$this->send_to_payer = $send_to_payer;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A flag indicating whether a copy of the email has to be sent to the payer.
|
* A flag indicating whether a copy of the email has to be sent to the payer.
|
||||||
*
|
*
|
||||||
* @param boolean $send_to_payer
|
* @return boolean
|
||||||
* @deprecated. Instead use setSendToPayer
|
*/
|
||||||
*/
|
public function getSendToPayer()
|
||||||
public function setSend_to_payer($send_to_payer) {
|
{
|
||||||
$this->send_to_payer = $send_to_payer;
|
return $this->send_to_payer;
|
||||||
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
|
* @param boolean $send_to_payer
|
||||||
* @deprecated. Instead use getSendToPayer
|
* @deprecated. Instead use setSendToPayer
|
||||||
*/
|
*/
|
||||||
public function getSend_to_payer() {
|
public function setSend_to_payer($send_to_payer)
|
||||||
return $this->send_to_payer;
|
{
|
||||||
}
|
$this->send_to_payer = $send_to_payer;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A flag indicating whether a copy of the email has to be sent to the payer.
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
* @deprecated. Instead use getSendToPayer
|
||||||
|
*/
|
||||||
|
public function getSend_to_payer()
|
||||||
|
{
|
||||||
|
return $this->send_to_payer;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,45 +4,50 @@ 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) {
|
*/
|
||||||
$this->percent = $percent;
|
public function setPercent($percent)
|
||||||
return $this;
|
{
|
||||||
}
|
$this->percent = $percent;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cost in percent. Range of 0 to 100.
|
* Cost in percent. Range of 0 to 100.
|
||||||
*
|
*
|
||||||
* @return PayPal\Api\number
|
* @return PayPal\Api\number
|
||||||
*/
|
*/
|
||||||
public function getPercent() {
|
public function getPercent()
|
||||||
return $this->percent;
|
{
|
||||||
}
|
return $this->percent;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cost in amount. Range of 0 to 999999.99.
|
* 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;
|
{
|
||||||
return $this;
|
$this->amount = $amount;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cost in amount. Range of 0 to 999999.99.
|
* Cost in amount. Range of 0 to 999999.99.
|
||||||
*
|
*
|
||||||
* @return PayPal\Api\Currency
|
* @return PayPal\Api\Currency
|
||||||
*/
|
*/
|
||||||
public function getAmount() {
|
public function getAmount()
|
||||||
return $this->amount;
|
{
|
||||||
}
|
return $this->amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,45 +4,50 @@ 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) {
|
*/
|
||||||
$this->currency = $currency;
|
public function setCurrency($currency)
|
||||||
return $this;
|
{
|
||||||
}
|
$this->currency = $currency;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 3 letter currency code
|
* 3 letter currency code
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getCurrency() {
|
public function getCurrency()
|
||||||
return $this->currency;
|
{
|
||||||
}
|
return $this->currency;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* amount upto 2 decimals represented as string
|
* amount upto 2 decimals represented as string
|
||||||
*
|
*
|
||||||
* @param string $value
|
* @param string $value
|
||||||
*/
|
*/
|
||||||
public function setValue($value) {
|
public function setValue($value)
|
||||||
$this->value = $value;
|
{
|
||||||
return $this;
|
$this->value = $value;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* amount upto 2 decimals represented as string
|
* amount upto 2 decimals represented as string
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getValue() {
|
public function getValue()
|
||||||
return $this->value;
|
{
|
||||||
}
|
return $this->value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,45 +4,50 @@ 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) {
|
*/
|
||||||
$this->label = $label;
|
public function setLabel($label)
|
||||||
return $this;
|
{
|
||||||
}
|
$this->label = $label;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Custom amount label. 25 characters max.
|
* Custom amount label. 25 characters max.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getLabel() {
|
public function getLabel()
|
||||||
return $this->label;
|
{
|
||||||
}
|
return $this->label;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Custom amount value. Range of 0 to 999999.99.
|
* Custom amount value. 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;
|
{
|
||||||
return $this;
|
$this->amount = $amount;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Custom amount value. Range of 0 to 999999.99.
|
* Custom amount value. Range of 0 to 999999.99.
|
||||||
*
|
*
|
||||||
* @return PayPal\Api\Currency
|
* @return PayPal\Api\Currency
|
||||||
*/
|
*/
|
||||||
public function getAmount() {
|
public function getAmount()
|
||||||
return $this->amount;
|
{
|
||||||
}
|
return $this->amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,143 +4,160 @@ 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) {
|
*/
|
||||||
$this->name = $name;
|
public function setName($name)
|
||||||
return $this;
|
{
|
||||||
}
|
$this->name = $name;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Human readable, unique name of the error.
|
* Human readable, unique name of the error.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getName() {
|
public function getName()
|
||||||
return $this->name;
|
{
|
||||||
}
|
return $this->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PayPal internal identifier used for correlation purposes.
|
* PayPal internal identifier used for correlation purposes.
|
||||||
*
|
*
|
||||||
* @param string $debug_id
|
* @param string $debug_id
|
||||||
*/
|
*/
|
||||||
public function setDebugId($debug_id) {
|
public function setDebugId($debug_id)
|
||||||
$this->debug_id = $debug_id;
|
{
|
||||||
return $this;
|
$this->debug_id = $debug_id;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PayPal internal identifier used for correlation purposes.
|
* PayPal internal identifier used for correlation purposes.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getDebugId() {
|
public function getDebugId()
|
||||||
return $this->debug_id;
|
{
|
||||||
}
|
return $this->debug_id;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PayPal internal identifier used for correlation purposes.
|
* PayPal internal identifier used for correlation purposes.
|
||||||
*
|
*
|
||||||
* @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;
|
{
|
||||||
return $this;
|
$this->debug_id = $debug_id;
|
||||||
}
|
return $this;
|
||||||
/**
|
}
|
||||||
* PayPal internal identifier used for correlation purposes.
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
* @deprecated. Instead use getDebugId
|
|
||||||
*/
|
|
||||||
public function getDebug_id() {
|
|
||||||
return $this->debug_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Message describing the error.
|
* PayPal internal identifier used for correlation purposes.
|
||||||
*
|
*
|
||||||
* @param string $message
|
* @return string
|
||||||
*/
|
* @deprecated. Instead use getDebugId
|
||||||
public function setMessage($message) {
|
*/
|
||||||
$this->message = $message;
|
public function getDebug_id()
|
||||||
return $this;
|
{
|
||||||
}
|
return $this->debug_id;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Message describing the error.
|
* Message describing the error.
|
||||||
*
|
*
|
||||||
* @return string
|
* @param string $message
|
||||||
*/
|
*/
|
||||||
public function getMessage() {
|
public function setMessage($message)
|
||||||
return $this->message;
|
{
|
||||||
}
|
$this->message = $message;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Message describing the error.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getMessage()
|
||||||
|
{
|
||||||
|
return $this->message;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* URI for detailed information related to this error for the developer.
|
* URI for detailed information related to this error for the developer.
|
||||||
*
|
*
|
||||||
* @param string $information_link
|
* @param string $information_link
|
||||||
*/
|
*/
|
||||||
public function setInformationLink($information_link) {
|
public function setInformationLink($information_link)
|
||||||
$this->information_link = $information_link;
|
{
|
||||||
return $this;
|
$this->information_link = $information_link;
|
||||||
}
|
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
|
||||||
*/
|
*/
|
||||||
public function getInformationLink() {
|
public function getInformationLink()
|
||||||
return $this->information_link;
|
{
|
||||||
}
|
return $this->information_link;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* URI for detailed information related to this error for the developer.
|
* URI for detailed information related to this error for the developer.
|
||||||
*
|
*
|
||||||
* @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;
|
{
|
||||||
return $this;
|
$this->information_link = $information_link;
|
||||||
}
|
return $this;
|
||||||
/**
|
}
|
||||||
* URI for detailed information related to this error for the developer.
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
* @deprecated. Instead use getInformationLink
|
|
||||||
*/
|
|
||||||
public function getInformation_link() {
|
|
||||||
return $this->information_link;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Additional details of the error
|
* URI for detailed information related to this error for the developer.
|
||||||
*
|
*
|
||||||
* @param PayPal\Api\ErrorDetails $details
|
* @return string
|
||||||
*/
|
* @deprecated. Instead use getInformationLink
|
||||||
public function setDetails($details) {
|
*/
|
||||||
$this->details = $details;
|
public function getInformation_link()
|
||||||
return $this;
|
{
|
||||||
}
|
return $this->information_link;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Additional details of the error
|
* Additional details of the error
|
||||||
*
|
*
|
||||||
* @return PayPal\Api\ErrorDetails
|
* @param PayPal\Api\ErrorDetails $details
|
||||||
*/
|
*/
|
||||||
public function getDetails() {
|
public function setDetails($details)
|
||||||
return $this->details;
|
{
|
||||||
}
|
$this->details = $details;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Additional details of the error
|
||||||
|
*
|
||||||
|
* @return PayPal\Api\ErrorDetails
|
||||||
|
*/
|
||||||
|
public function getDetails()
|
||||||
|
{
|
||||||
|
return $this->details;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,45 +4,50 @@ 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) {
|
*/
|
||||||
$this->field = $field;
|
public function setField($field)
|
||||||
return $this;
|
{
|
||||||
}
|
$this->field = $field;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Name of the field that caused the error.
|
* Name of the field that caused the error.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getField() {
|
public function getField()
|
||||||
return $this->field;
|
{
|
||||||
}
|
return $this->field;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reason for the error.
|
* Reason for the error.
|
||||||
*
|
*
|
||||||
* @param string $issue
|
* @param string $issue
|
||||||
*/
|
*/
|
||||||
public function setIssue($issue) {
|
public function setIssue($issue)
|
||||||
$this->issue = $issue;
|
{
|
||||||
return $this;
|
$this->issue = $issue;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reason for the error.
|
* Reason for the error.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getIssue() {
|
public function getIssue()
|
||||||
return $this->issue;
|
{
|
||||||
}
|
return $this->issue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -4,164 +4,182 @@ 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) {
|
*/
|
||||||
$this->name = $name;
|
public function setName($name)
|
||||||
return $this;
|
{
|
||||||
}
|
$this->name = $name;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Name of the item. 60 characters max.
|
* Name of the item. 60 characters max.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getName() {
|
public function getName()
|
||||||
return $this->name;
|
{
|
||||||
}
|
return $this->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Description of the item. 1000 characters max.
|
* Description of the item. 1000 characters max.
|
||||||
*
|
*
|
||||||
* @param string $description
|
* @param string $description
|
||||||
*/
|
*/
|
||||||
public function setDescription($description) {
|
public function setDescription($description)
|
||||||
$this->description = $description;
|
{
|
||||||
return $this;
|
$this->description = $description;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Description of the item. 1000 characters max.
|
* Description of the item. 1000 characters max.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getDescription() {
|
public function getDescription()
|
||||||
return $this->description;
|
{
|
||||||
}
|
return $this->description;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Quantity of the item. Range of 0 to 9999.999.
|
* Quantity of the item. Range of 0 to 9999.999.
|
||||||
*
|
*
|
||||||
* @param PayPal\Api\number $quantity
|
* @param PayPal\Api\number $quantity
|
||||||
*/
|
*/
|
||||||
public function setQuantity($quantity) {
|
public function setQuantity($quantity)
|
||||||
$this->quantity = $quantity;
|
{
|
||||||
return $this;
|
$this->quantity = $quantity;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Quantity of the item. Range of 0 to 9999.999.
|
* Quantity of the item. Range of 0 to 9999.999.
|
||||||
*
|
*
|
||||||
* @return PayPal\Api\number
|
* @return PayPal\Api\number
|
||||||
*/
|
*/
|
||||||
public function getQuantity() {
|
public function getQuantity()
|
||||||
return $this->quantity;
|
{
|
||||||
}
|
return $this->quantity;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unit price of the item. Range of -999999.99 to 999999.99.
|
* Unit price of the item. Range of -999999.99 to 999999.99.
|
||||||
*
|
*
|
||||||
* @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;
|
{
|
||||||
return $this;
|
$this->unit_price = $unit_price;
|
||||||
}
|
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
|
||||||
*/
|
*/
|
||||||
public function getUnitPrice() {
|
public function getUnitPrice()
|
||||||
return $this->unit_price;
|
{
|
||||||
}
|
return $this->unit_price;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unit price of the item. Range of -999999.99 to 999999.99.
|
* Unit price of the item. Range of -999999.99 to 999999.99.
|
||||||
*
|
*
|
||||||
* @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;
|
{
|
||||||
return $this;
|
$this->unit_price = $unit_price;
|
||||||
}
|
return $this;
|
||||||
/**
|
}
|
||||||
* Unit price of the item. Range of -999999.99 to 999999.99.
|
|
||||||
*
|
|
||||||
* @return PayPal\Api\Currency
|
|
||||||
* @deprecated. Instead use getUnitPrice
|
|
||||||
*/
|
|
||||||
public function getUnit_price() {
|
|
||||||
return $this->unit_price;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tax associated with the item.
|
* Unit price of the item. Range of -999999.99 to 999999.99.
|
||||||
*
|
*
|
||||||
* @param PayPal\Api\Tax $tax
|
* @return PayPal\Api\Currency
|
||||||
*/
|
* @deprecated. Instead use getUnitPrice
|
||||||
public function setTax($tax) {
|
*/
|
||||||
$this->tax = $tax;
|
public function getUnit_price()
|
||||||
return $this;
|
{
|
||||||
}
|
return $this->unit_price;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tax associated with the item.
|
* Tax associated with the item.
|
||||||
*
|
*
|
||||||
* @return PayPal\Api\Tax
|
* @param PayPal\Api\Tax $tax
|
||||||
*/
|
*/
|
||||||
public function getTax() {
|
public function setTax($tax)
|
||||||
return $this->tax;
|
{
|
||||||
}
|
$this->tax = $tax;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tax associated with the item.
|
||||||
|
*
|
||||||
|
* @return PayPal\Api\Tax
|
||||||
|
*/
|
||||||
|
public function getTax()
|
||||||
|
{
|
||||||
|
return $this->tax;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date on which the item or service was provided. Date format: yyyy-MM-dd z. For example, 2014-02-27 PST.
|
* Date on which the item or service was provided. Date format: yyyy-MM-dd z. For example, 2014-02-27 PST.
|
||||||
*
|
*
|
||||||
* @param string $date
|
* @param string $date
|
||||||
*/
|
*/
|
||||||
public function setDate($date) {
|
public function setDate($date)
|
||||||
$this->date = $date;
|
{
|
||||||
return $this;
|
$this->date = $date;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date on which the item or service was provided. Date format: yyyy-MM-dd z. For example, 2014-02-27 PST.
|
* Date on which the item or service was provided. Date format: yyyy-MM-dd z. For example, 2014-02-27 PST.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getDate() {
|
public function getDate()
|
||||||
return $this->date;
|
{
|
||||||
}
|
return $this->date;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Item discount in percent or amount.
|
* Item discount in percent or amount.
|
||||||
*
|
*
|
||||||
* @param PayPal\Api\Cost $discount
|
* @param PayPal\Api\Cost $discount
|
||||||
*/
|
*/
|
||||||
public function setDiscount($discount) {
|
public function setDiscount($discount)
|
||||||
$this->discount = $discount;
|
{
|
||||||
return $this;
|
$this->discount = $discount;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Item discount in percent or amount.
|
* Item discount in percent or amount.
|
||||||
*
|
*
|
||||||
* @return PayPal\Api\Cost
|
* @return PayPal\Api\Cost
|
||||||
*/
|
*/
|
||||||
public function getDiscount() {
|
public function getDiscount()
|
||||||
return $this->discount;
|
{
|
||||||
}
|
return $this->discount;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,64 +4,72 @@ 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) {
|
*/
|
||||||
$this->total_count = $total_count;
|
public function setTotalCount($total_count)
|
||||||
return $this;
|
{
|
||||||
}
|
$this->total_count = $total_count;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @return integer
|
* @return integer
|
||||||
*/
|
*/
|
||||||
public function getTotalCount() {
|
public function getTotalCount()
|
||||||
return $this->total_count;
|
{
|
||||||
}
|
return $this->total_count;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @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;
|
{
|
||||||
return $this;
|
$this->total_count = $total_count;
|
||||||
}
|
return $this;
|
||||||
/**
|
}
|
||||||
*
|
|
||||||
*
|
|
||||||
* @return integer
|
|
||||||
* @deprecated. Instead use getTotalCount
|
|
||||||
*/
|
|
||||||
public function getTotal_count() {
|
|
||||||
return $this->total_count;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of invoices belonging to a merchant.
|
*
|
||||||
*
|
*
|
||||||
* @param PayPal\Api\Invoice $invoices
|
* @return integer
|
||||||
*/
|
* @deprecated. Instead use getTotalCount
|
||||||
public function setInvoices($invoices) {
|
*/
|
||||||
$this->invoices = $invoices;
|
public function getTotal_count()
|
||||||
return $this;
|
{
|
||||||
}
|
return $this->total_count;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of invoices belonging to a merchant.
|
* List of invoices belonging to a merchant.
|
||||||
*
|
*
|
||||||
* @return PayPal\Api\Invoice
|
* @param PayPal\Api\Invoice $invoices
|
||||||
*/
|
*/
|
||||||
public function getInvoices() {
|
public function setInvoices($invoices)
|
||||||
return $this->invoices;
|
{
|
||||||
}
|
$this->invoices = $invoices;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of invoices belonging to a merchant.
|
||||||
|
*
|
||||||
|
* @return PayPal\Api\Invoice
|
||||||
|
*/
|
||||||
|
public function getInvoices()
|
||||||
|
{
|
||||||
|
return $this->invoices;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,356 +4,402 @@ 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) {
|
*/
|
||||||
$this->created_date = $created_date;
|
public function setCreatedDate($created_date)
|
||||||
return $this;
|
{
|
||||||
}
|
$this->created_date = $created_date;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date when the resource was created.
|
* Date when the resource was created.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getCreatedDate() {
|
public function getCreatedDate()
|
||||||
return $this->created_date;
|
{
|
||||||
}
|
return $this->created_date;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date when the resource was created.
|
* Date when the resource was created.
|
||||||
*
|
*
|
||||||
* @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;
|
{
|
||||||
return $this;
|
$this->created_date = $created_date;
|
||||||
}
|
return $this;
|
||||||
/**
|
}
|
||||||
* Date when the resource was created.
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
* @deprecated. Instead use getCreatedDate
|
|
||||||
*/
|
|
||||||
public function getCreated_date() {
|
|
||||||
return $this->created_date;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Email address of the account that created the resource.
|
* Date when the resource was created.
|
||||||
*
|
*
|
||||||
* @param string $created_by
|
* @return string
|
||||||
*/
|
* @deprecated. Instead use getCreatedDate
|
||||||
public function setCreatedBy($created_by) {
|
*/
|
||||||
$this->created_by = $created_by;
|
public function getCreated_date()
|
||||||
return $this;
|
{
|
||||||
}
|
return $this->created_date;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Email address of the account that created the resource.
|
* Email address of the account that created the resource.
|
||||||
*
|
*
|
||||||
* @return string
|
* @param string $created_by
|
||||||
*/
|
*/
|
||||||
public function getCreatedBy() {
|
public function setCreatedBy($created_by)
|
||||||
return $this->created_by;
|
{
|
||||||
}
|
$this->created_by = $created_by;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Email address of the account that created the resource.
|
* Email address of the account that created the resource.
|
||||||
*
|
*
|
||||||
* @param string $created_by
|
* @return string
|
||||||
* @deprecated. Instead use setCreatedBy
|
*/
|
||||||
*/
|
public function getCreatedBy()
|
||||||
public function setCreated_by($created_by) {
|
{
|
||||||
$this->created_by = $created_by;
|
return $this->created_by;
|
||||||
return $this;
|
}
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Email address of the account that created the resource.
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
* @deprecated. Instead use getCreatedBy
|
|
||||||
*/
|
|
||||||
public function getCreated_by() {
|
|
||||||
return $this->created_by;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date when the resource was cancelled.
|
* Email address of the account that created the resource.
|
||||||
*
|
*
|
||||||
* @param string $cancelled_date
|
* @param string $created_by
|
||||||
*/
|
* @deprecated. Instead use setCreatedBy
|
||||||
public function setCancelledDate($cancelled_date) {
|
*/
|
||||||
$this->cancelled_date = $cancelled_date;
|
public function setCreated_by($created_by)
|
||||||
return $this;
|
{
|
||||||
}
|
$this->created_by = $created_by;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date when the resource was cancelled.
|
* Email address of the account that created the resource.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
* @deprecated. Instead use getCreatedBy
|
||||||
public function getCancelledDate() {
|
*/
|
||||||
return $this->cancelled_date;
|
public function getCreated_by()
|
||||||
}
|
{
|
||||||
|
return $this->created_by;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date when the resource was cancelled.
|
* Date when the resource was cancelled.
|
||||||
*
|
*
|
||||||
* @param string $cancelled_date
|
* @param string $cancelled_date
|
||||||
* @deprecated. Instead use setCancelledDate
|
*/
|
||||||
*/
|
public function setCancelledDate($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.
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
* @deprecated. Instead use getCancelledDate
|
|
||||||
*/
|
|
||||||
public function getCancelled_date() {
|
|
||||||
return $this->cancelled_date;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Actor who cancelled the resource.
|
* Date when the resource was cancelled.
|
||||||
*
|
*
|
||||||
* @param string $cancelled_by
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function setCancelledBy($cancelled_by) {
|
public function getCancelledDate()
|
||||||
$this->cancelled_by = $cancelled_by;
|
{
|
||||||
return $this;
|
return $this->cancelled_date;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Actor who cancelled the resource.
|
* Date when the resource was cancelled.
|
||||||
*
|
*
|
||||||
* @return string
|
* @param string $cancelled_date
|
||||||
*/
|
* @deprecated. Instead use setCancelledDate
|
||||||
public function getCancelledBy() {
|
*/
|
||||||
return $this->cancelled_by;
|
public function setCancelled_date($cancelled_date)
|
||||||
}
|
{
|
||||||
|
$this->cancelled_date = $cancelled_date;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Actor who cancelled the resource.
|
* Date when the resource was cancelled.
|
||||||
*
|
*
|
||||||
* @param string $cancelled_by
|
* @return string
|
||||||
* @deprecated. Instead use setCancelledBy
|
* @deprecated. Instead use getCancelledDate
|
||||||
*/
|
*/
|
||||||
public function setCancelled_by($cancelled_by) {
|
public function getCancelled_date()
|
||||||
$this->cancelled_by = $cancelled_by;
|
{
|
||||||
return $this;
|
return $this->cancelled_date;
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* Actor who cancelled the resource.
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
* @deprecated. Instead use getCancelledBy
|
|
||||||
*/
|
|
||||||
public function getCancelled_by() {
|
|
||||||
return $this->cancelled_by;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date when the resource was last edited.
|
* Actor who cancelled the resource.
|
||||||
*
|
*
|
||||||
* @param string $last_updated_date
|
* @param string $cancelled_by
|
||||||
*/
|
*/
|
||||||
public function setLastUpdatedDate($last_updated_date) {
|
public function setCancelledBy($cancelled_by)
|
||||||
$this->last_updated_date = $last_updated_date;
|
{
|
||||||
return $this;
|
$this->cancelled_by = $cancelled_by;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date when the resource was last edited.
|
* Actor who cancelled the resource.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getLastUpdatedDate() {
|
public function getCancelledBy()
|
||||||
return $this->last_updated_date;
|
{
|
||||||
}
|
return $this->cancelled_by;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date when the resource was last edited.
|
* Actor who cancelled the resource.
|
||||||
*
|
*
|
||||||
* @param string $last_updated_date
|
* @param string $cancelled_by
|
||||||
* @deprecated. Instead use setLastUpdatedDate
|
* @deprecated. Instead use setCancelledBy
|
||||||
*/
|
*/
|
||||||
public function setLast_updated_date($last_updated_date) {
|
public function setCancelled_by($cancelled_by)
|
||||||
$this->last_updated_date = $last_updated_date;
|
{
|
||||||
return $this;
|
$this->cancelled_by = $cancelled_by;
|
||||||
}
|
return $this;
|
||||||
/**
|
}
|
||||||
* Date when the resource was last edited.
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
* @deprecated. Instead use getLastUpdatedDate
|
|
||||||
*/
|
|
||||||
public function getLast_updated_date() {
|
|
||||||
return $this->last_updated_date;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Email address of the account that last edited the resource.
|
* Actor who cancelled the resource.
|
||||||
*
|
*
|
||||||
* @param string $last_updated_by
|
* @return string
|
||||||
*/
|
* @deprecated. Instead use getCancelledBy
|
||||||
public function setLastUpdatedBy($last_updated_by) {
|
*/
|
||||||
$this->last_updated_by = $last_updated_by;
|
public function getCancelled_by()
|
||||||
return $this;
|
{
|
||||||
}
|
return $this->cancelled_by;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Email address of the account that last edited the resource.
|
* Date when the resource was last edited.
|
||||||
*
|
*
|
||||||
* @return string
|
* @param string $last_updated_date
|
||||||
*/
|
*/
|
||||||
public function getLastUpdatedBy() {
|
public function setLastUpdatedDate($last_updated_date)
|
||||||
return $this->last_updated_by;
|
{
|
||||||
}
|
$this->last_updated_date = $last_updated_date;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Email address of the account that last edited the resource.
|
* Date when the resource was last edited.
|
||||||
*
|
*
|
||||||
* @param string $last_updated_by
|
* @return string
|
||||||
* @deprecated. Instead use setLastUpdatedBy
|
*/
|
||||||
*/
|
public function getLastUpdatedDate()
|
||||||
public function setLast_updated_by($last_updated_by) {
|
{
|
||||||
$this->last_updated_by = $last_updated_by;
|
return $this->last_updated_date;
|
||||||
return $this;
|
}
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Email address of the account that last edited the resource.
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
* @deprecated. Instead use getLastUpdatedBy
|
|
||||||
*/
|
|
||||||
public function getLast_updated_by() {
|
|
||||||
return $this->last_updated_by;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date when the resource was first sent.
|
* Date when the resource was last edited.
|
||||||
*
|
*
|
||||||
* @param string $first_sent_date
|
* @param string $last_updated_date
|
||||||
*/
|
* @deprecated. Instead use setLastUpdatedDate
|
||||||
public function setFirstSentDate($first_sent_date) {
|
*/
|
||||||
$this->first_sent_date = $first_sent_date;
|
public function setLast_updated_date($last_updated_date)
|
||||||
return $this;
|
{
|
||||||
}
|
$this->last_updated_date = $last_updated_date;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date when the resource was first sent.
|
* Date when the resource was last edited.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
* @deprecated. Instead use getLastUpdatedDate
|
||||||
public function getFirstSentDate() {
|
*/
|
||||||
return $this->first_sent_date;
|
public function getLast_updated_date()
|
||||||
}
|
{
|
||||||
|
return $this->last_updated_date;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date when the resource was first sent.
|
* Email address of the account that last edited the resource.
|
||||||
*
|
*
|
||||||
* @param string $first_sent_date
|
* @param string $last_updated_by
|
||||||
* @deprecated. Instead use setFirstSentDate
|
*/
|
||||||
*/
|
public function setLastUpdatedBy($last_updated_by)
|
||||||
public function setFirst_sent_date($first_sent_date) {
|
{
|
||||||
$this->first_sent_date = $first_sent_date;
|
$this->last_updated_by = $last_updated_by;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* Date when the resource was first sent.
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
* @deprecated. Instead use getFirstSentDate
|
|
||||||
*/
|
|
||||||
public function getFirst_sent_date() {
|
|
||||||
return $this->first_sent_date;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date when the resource was last sent.
|
* Email address of the account that last edited the resource.
|
||||||
*
|
*
|
||||||
* @param string $last_sent_date
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function setLastSentDate($last_sent_date) {
|
public function getLastUpdatedBy()
|
||||||
$this->last_sent_date = $last_sent_date;
|
{
|
||||||
return $this;
|
return $this->last_updated_by;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date when the resource was last sent.
|
* Email address of the account that last edited the resource.
|
||||||
*
|
*
|
||||||
* @return string
|
* @param string $last_updated_by
|
||||||
*/
|
* @deprecated. Instead use setLastUpdatedBy
|
||||||
public function getLastSentDate() {
|
*/
|
||||||
return $this->last_sent_date;
|
public function setLast_updated_by($last_updated_by)
|
||||||
}
|
{
|
||||||
|
$this->last_updated_by = $last_updated_by;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date when the resource was last sent.
|
* Email address of the account that last edited the resource.
|
||||||
*
|
*
|
||||||
* @param string $last_sent_date
|
* @return string
|
||||||
* @deprecated. Instead use setLastSentDate
|
* @deprecated. Instead use getLastUpdatedBy
|
||||||
*/
|
*/
|
||||||
public function setLast_sent_date($last_sent_date) {
|
public function getLast_updated_by()
|
||||||
$this->last_sent_date = $last_sent_date;
|
{
|
||||||
return $this;
|
return $this->last_updated_by;
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* Date when the resource was last sent.
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
* @deprecated. Instead use getLastSentDate
|
|
||||||
*/
|
|
||||||
public function getLast_sent_date() {
|
|
||||||
return $this->last_sent_date;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Email address of the account that last sent the resource.
|
* Date when the resource was first sent.
|
||||||
*
|
*
|
||||||
* @param string $last_sent_by
|
* @param string $first_sent_date
|
||||||
*/
|
*/
|
||||||
public function setLastSentBy($last_sent_by) {
|
public function setFirstSentDate($first_sent_date)
|
||||||
$this->last_sent_by = $last_sent_by;
|
{
|
||||||
return $this;
|
$this->first_sent_date = $first_sent_date;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Email address of the account that last sent the resource.
|
* Date when the resource was first sent.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getLastSentBy() {
|
public function getFirstSentDate()
|
||||||
return $this->last_sent_by;
|
{
|
||||||
}
|
return $this->first_sent_date;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Email address of the account that last sent the resource.
|
* Date when the resource was first sent.
|
||||||
*
|
*
|
||||||
* @param string $last_sent_by
|
* @param string $first_sent_date
|
||||||
* @deprecated. Instead use setLastSentBy
|
* @deprecated. Instead use setFirstSentDate
|
||||||
*/
|
*/
|
||||||
public function setLast_sent_by($last_sent_by) {
|
public function setFirst_sent_date($first_sent_date)
|
||||||
$this->last_sent_by = $last_sent_by;
|
{
|
||||||
return $this;
|
$this->first_sent_date = $first_sent_date;
|
||||||
}
|
return $this;
|
||||||
/**
|
}
|
||||||
* Email address of the account that last sent the resource.
|
|
||||||
*
|
/**
|
||||||
* @return string
|
* Date when the resource was first sent.
|
||||||
* @deprecated. Instead use getLastSentBy
|
*
|
||||||
*/
|
* @return string
|
||||||
public function getLast_sent_by() {
|
* @deprecated. Instead use getFirstSentDate
|
||||||
return $this->last_sent_by;
|
*/
|
||||||
}
|
public function getFirst_sent_date()
|
||||||
|
{
|
||||||
|
return $this->first_sent_date;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Date when the resource was last sent.
|
||||||
|
*
|
||||||
|
* @param string $last_sent_date
|
||||||
|
*/
|
||||||
|
public function setLastSentDate($last_sent_date)
|
||||||
|
{
|
||||||
|
$this->last_sent_date = $last_sent_date;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Date when the resource was last sent.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getLastSentDate()
|
||||||
|
{
|
||||||
|
return $this->last_sent_date;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Date when the resource was last sent.
|
||||||
|
*
|
||||||
|
* @param string $last_sent_date
|
||||||
|
* @deprecated. Instead use setLastSentDate
|
||||||
|
*/
|
||||||
|
public function setLast_sent_date($last_sent_date)
|
||||||
|
{
|
||||||
|
$this->last_sent_date = $last_sent_date;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Date when the resource was last sent.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
* @deprecated. Instead use getLastSentDate
|
||||||
|
*/
|
||||||
|
public function getLast_sent_date()
|
||||||
|
{
|
||||||
|
return $this->last_sent_date;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Email address of the account that last sent the resource.
|
||||||
|
*
|
||||||
|
* @param string $last_sent_by
|
||||||
|
*/
|
||||||
|
public function setLastSentBy($last_sent_by)
|
||||||
|
{
|
||||||
|
$this->last_sent_by = $last_sent_by;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Email address of the account that last sent the resource.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getLastSentBy()
|
||||||
|
{
|
||||||
|
return $this->last_sent_by;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Email address of the account that last sent the resource.
|
||||||
|
*
|
||||||
|
* @param string $last_sent_by
|
||||||
|
* @deprecated. Instead use setLastSentBy
|
||||||
|
*/
|
||||||
|
public function setLast_sent_by($last_sent_by)
|
||||||
|
{
|
||||||
|
$this->last_sent_by = $last_sent_by;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Email address of the account that last sent the resource.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
* @deprecated. Instead use getLastSentBy
|
||||||
|
*/
|
||||||
|
public function getLast_sent_by()
|
||||||
|
{
|
||||||
|
return $this->last_sent_by;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,84 +4,94 @@ 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) {
|
*/
|
||||||
$this->subject = $subject;
|
public function setSubject($subject)
|
||||||
return $this;
|
{
|
||||||
}
|
$this->subject = $subject;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Subject of the notification.
|
* Subject of the notification.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getSubject() {
|
public function getSubject()
|
||||||
return $this->subject;
|
{
|
||||||
}
|
return $this->subject;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Note to the payer.
|
* Note to the payer.
|
||||||
*
|
*
|
||||||
* @param string $note
|
* @param string $note
|
||||||
*/
|
*/
|
||||||
public function setNote($note) {
|
public function setNote($note)
|
||||||
$this->note = $note;
|
{
|
||||||
return $this;
|
$this->note = $note;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Note to the payer.
|
* Note to the payer.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getNote() {
|
public function getNote()
|
||||||
return $this->note;
|
{
|
||||||
}
|
return $this->note;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
*
|
*
|
||||||
* @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;
|
{
|
||||||
return $this;
|
$this->send_to_merchant = $send_to_merchant;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A flag indicating whether a copy of the email has to be sent to the merchant.
|
* A flag indicating whether a copy of the email has to be sent to the merchant.
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function getSendToMerchant() {
|
public function getSendToMerchant()
|
||||||
return $this->send_to_merchant;
|
{
|
||||||
}
|
return $this->send_to_merchant;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
*
|
*
|
||||||
* @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;
|
{
|
||||||
return $this;
|
$this->send_to_merchant = $send_to_merchant;
|
||||||
}
|
return $this;
|
||||||
/**
|
}
|
||||||
* A flag indicating whether a copy of the email has to be sent to the merchant.
|
|
||||||
*
|
/**
|
||||||
* @return boolean
|
* A flag indicating whether a copy of the email has to be sent to the merchant.
|
||||||
* @deprecated. Instead use getSendToMerchant
|
*
|
||||||
*/
|
* @return boolean
|
||||||
public function getSend_to_merchant() {
|
* @deprecated. Instead use getSendToMerchant
|
||||||
return $this->send_to_merchant;
|
*/
|
||||||
}
|
public function getSend_to_merchant()
|
||||||
|
{
|
||||||
|
return $this->send_to_merchant;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,163 +4,182 @@ 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) {
|
*/
|
||||||
$this->type = $type;
|
public function setType($type)
|
||||||
return $this;
|
{
|
||||||
}
|
$this->type = $type;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PayPal payment detail indicating whether payment was made in an invoicing flow via PayPal or externally. In the case of the mark-as-paid API, payment type is EXTERNAL and this is what is now supported. The PAYPAL value is provided for backward compatibility.
|
* PayPal payment detail indicating whether payment was made in an invoicing flow via PayPal or externally. In the case of the mark-as-paid API, payment type is EXTERNAL and this is what is now supported. The PAYPAL value is provided for backward compatibility.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getType() {
|
public function getType()
|
||||||
return $this->type;
|
{
|
||||||
}
|
return $this->type;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
*
|
*
|
||||||
* @param string $transaction_id
|
* @param string $transaction_id
|
||||||
*/
|
*/
|
||||||
public function setTransactionId($transaction_id) {
|
public function setTransactionId($transaction_id)
|
||||||
$this->transaction_id = $transaction_id;
|
{
|
||||||
return $this;
|
$this->transaction_id = $transaction_id;
|
||||||
}
|
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
|
||||||
*/
|
*/
|
||||||
public function getTransactionId() {
|
public function getTransactionId()
|
||||||
return $this->transaction_id;
|
{
|
||||||
}
|
return $this->transaction_id;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
*
|
*
|
||||||
* @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;
|
{
|
||||||
return $this;
|
$this->transaction_id = $transaction_id;
|
||||||
}
|
return $this;
|
||||||
/**
|
}
|
||||||
* PayPal payment transaction id. Mandatory field in case the type value is PAYPAL.
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
* @deprecated. Instead use getTransactionId
|
|
||||||
*/
|
|
||||||
public function getTransaction_id() {
|
|
||||||
return $this->transaction_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Type of the transaction.
|
* PayPal payment transaction id. Mandatory field in case the type value is PAYPAL.
|
||||||
*
|
*
|
||||||
* @param string $transaction_type
|
* @return string
|
||||||
*/
|
* @deprecated. Instead use getTransactionId
|
||||||
public function setTransactionType($transaction_type) {
|
*/
|
||||||
$this->transaction_type = $transaction_type;
|
public function getTransaction_id()
|
||||||
return $this;
|
{
|
||||||
}
|
return $this->transaction_id;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Type of the transaction.
|
* Type of the transaction.
|
||||||
*
|
*
|
||||||
* @return string
|
* @param string $transaction_type
|
||||||
*/
|
*/
|
||||||
public function getTransactionType() {
|
public function setTransactionType($transaction_type)
|
||||||
return $this->transaction_type;
|
{
|
||||||
}
|
$this->transaction_type = $transaction_type;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Type of the transaction.
|
* Type of the transaction.
|
||||||
*
|
*
|
||||||
* @param string $transaction_type
|
* @return string
|
||||||
* @deprecated. Instead use setTransactionType
|
*/
|
||||||
*/
|
public function getTransactionType()
|
||||||
public function setTransaction_type($transaction_type) {
|
{
|
||||||
$this->transaction_type = $transaction_type;
|
return $this->transaction_type;
|
||||||
return $this;
|
}
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Type of the transaction.
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
* @deprecated. Instead use getTransactionType
|
|
||||||
*/
|
|
||||||
public function getTransaction_type() {
|
|
||||||
return $this->transaction_type;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date when the invoice was paid. Date format: yyyy-MM-dd z. For example, 2014-02-27 PST.
|
* Type of the transaction.
|
||||||
*
|
*
|
||||||
* @param string $date
|
* @param string $transaction_type
|
||||||
*/
|
* @deprecated. Instead use setTransactionType
|
||||||
public function setDate($date) {
|
*/
|
||||||
$this->date = $date;
|
public function setTransaction_type($transaction_type)
|
||||||
return $this;
|
{
|
||||||
}
|
$this->transaction_type = $transaction_type;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date when the invoice was paid. Date format: yyyy-MM-dd z. For example, 2014-02-27 PST.
|
* Type of the transaction.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
* @deprecated. Instead use getTransactionType
|
||||||
public function getDate() {
|
*/
|
||||||
return $this->date;
|
public function getTransaction_type()
|
||||||
}
|
{
|
||||||
|
return $this->transaction_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Date when the invoice was paid. Date format: yyyy-MM-dd z. For example, 2014-02-27 PST.
|
||||||
|
*
|
||||||
|
* @param string $date
|
||||||
|
*/
|
||||||
|
public function setDate($date)
|
||||||
|
{
|
||||||
|
$this->date = $date;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Date when the invoice was paid. Date format: yyyy-MM-dd z. For example, 2014-02-27 PST.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getDate()
|
||||||
|
{
|
||||||
|
return $this->date;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Payment mode or method. This field is mandatory if the value of the type field is OTHER.
|
* Payment mode or method. This field is mandatory if the value of the type field is OTHER.
|
||||||
*
|
*
|
||||||
* @param string $method
|
* @param string $method
|
||||||
*/
|
*/
|
||||||
public function setMethod($method) {
|
public function setMethod($method)
|
||||||
$this->method = $method;
|
{
|
||||||
return $this;
|
$this->method = $method;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Payment mode or method. This field is mandatory if the value of the type field is OTHER.
|
* Payment mode or method. This field is mandatory if the value of the type field is OTHER.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getMethod() {
|
public function getMethod()
|
||||||
return $this->method;
|
{
|
||||||
}
|
return $this->method;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Optional note associated with the payment.
|
* Optional note associated with the payment.
|
||||||
*
|
*
|
||||||
* @param string $note
|
* @param string $note
|
||||||
*/
|
*/
|
||||||
public function setNote($note) {
|
public function setNote($note)
|
||||||
$this->note = $note;
|
{
|
||||||
return $this;
|
$this->note = $note;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Optional note associated with the payment.
|
* Optional note associated with the payment.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getNote() {
|
public function getNote()
|
||||||
return $this->note;
|
{
|
||||||
}
|
return $this->note;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,65 +4,72 @@ 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) {
|
*/
|
||||||
$this->type = $type;
|
public function setType($type)
|
||||||
return $this;
|
{
|
||||||
}
|
$this->type = $type;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getType() {
|
public function getType()
|
||||||
return $this->type;
|
{
|
||||||
}
|
return $this->type;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date when the invoice was marked as refunded. If no date is specified, the current date and time is used as the default. In addition, the date must be after the invoice payment date.
|
* Date when the invoice was marked as refunded. If no date is specified, the current date and time is used as the default. In addition, the date must be after the invoice payment date.
|
||||||
*
|
*
|
||||||
* @param string $date
|
* @param string $date
|
||||||
*/
|
*/
|
||||||
public function setDate($date) {
|
public function setDate($date)
|
||||||
$this->date = $date;
|
{
|
||||||
return $this;
|
$this->date = $date;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date when the invoice was marked as refunded. If no date is specified, the current date and time is used as the default. In addition, the date must be after the invoice payment date.
|
* Date when the invoice was marked as refunded. If no date is specified, the current date and time is used as the default. In addition, the date must be after the invoice payment date.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getDate() {
|
public function getDate()
|
||||||
return $this->date;
|
{
|
||||||
}
|
return $this->date;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Optional note associated with the refund.
|
* Optional note associated with the refund.
|
||||||
*
|
*
|
||||||
* @param string $note
|
* @param string $note
|
||||||
*/
|
*/
|
||||||
public function setNote($note) {
|
public function setNote($note)
|
||||||
$this->note = $note;
|
{
|
||||||
return $this;
|
$this->note = $note;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Optional note associated with the refund.
|
* Optional note associated with the refund.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getNote() {
|
public function getNote()
|
||||||
return $this->note;
|
{
|
||||||
}
|
return $this->note;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,26 +69,30 @@ class ItemList extends PPModel
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Append an item to the list.
|
* Append an item to the list.
|
||||||
* @return PayPal\Api\Item
|
*
|
||||||
*/
|
* @return PayPal\Api\Item
|
||||||
public function addItem($item) {
|
*/
|
||||||
return $this->setItems(
|
public function addItem($item)
|
||||||
array_merge($this->items, array($item))
|
{
|
||||||
);
|
return $this->setItems(
|
||||||
}
|
array_merge($this->items, array($item))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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) {
|
*/
|
||||||
return $this->setItems(
|
public function removeItem($item)
|
||||||
array_diff($this->items, array($item))
|
{
|
||||||
);
|
return $this->setItems(
|
||||||
}
|
array_diff($this->items, array($item))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Shipping Address
|
* Get Shipping Address
|
||||||
|
|||||||
@@ -4,300 +4,336 @@ 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) {
|
*/
|
||||||
$this->email = $email;
|
public function setEmail($email)
|
||||||
return $this;
|
{
|
||||||
}
|
$this->email = $email;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Email address of the merchant. 260 characters max.
|
* Email address of the merchant. 260 characters max.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getEmail() {
|
public function getEmail()
|
||||||
return $this->email;
|
{
|
||||||
}
|
return $this->email;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* First name of the merchant. 30 characters max.
|
* First name of the merchant. 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;
|
{
|
||||||
return $this;
|
$this->first_name = $first_name;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* First name of the merchant. 30 characters max.
|
* First name of the merchant. 30 characters max.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getFirstName() {
|
public function getFirstName()
|
||||||
return $this->first_name;
|
{
|
||||||
}
|
return $this->first_name;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* First name of the merchant. 30 characters max.
|
* First name of the merchant. 30 characters max.
|
||||||
*
|
*
|
||||||
* @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;
|
{
|
||||||
return $this;
|
$this->first_name = $first_name;
|
||||||
}
|
return $this;
|
||||||
/**
|
}
|
||||||
* First name of the merchant. 30 characters max.
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
* @deprecated. Instead use getFirstName
|
|
||||||
*/
|
|
||||||
public function getFirst_name() {
|
|
||||||
return $this->first_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Last name of the merchant. 30 characters max.
|
* First name of the merchant. 30 characters max.
|
||||||
*
|
*
|
||||||
* @param string $last_name
|
* @return string
|
||||||
*/
|
* @deprecated. Instead use getFirstName
|
||||||
public function setLastName($last_name) {
|
*/
|
||||||
$this->last_name = $last_name;
|
public function getFirst_name()
|
||||||
return $this;
|
{
|
||||||
}
|
return $this->first_name;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Last name of the merchant. 30 characters max.
|
* Last name of the merchant. 30 characters max.
|
||||||
*
|
*
|
||||||
* @return string
|
* @param string $last_name
|
||||||
*/
|
*/
|
||||||
public function getLastName() {
|
public function setLastName($last_name)
|
||||||
return $this->last_name;
|
{
|
||||||
}
|
$this->last_name = $last_name;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Last name of the merchant. 30 characters max.
|
* Last name of the merchant. 30 characters max.
|
||||||
*
|
*
|
||||||
* @param string $last_name
|
* @return string
|
||||||
* @deprecated. Instead use setLastName
|
*/
|
||||||
*/
|
public function getLastName()
|
||||||
public function setLast_name($last_name) {
|
{
|
||||||
$this->last_name = $last_name;
|
return $this->last_name;
|
||||||
return $this;
|
}
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Last name of the merchant. 30 characters max.
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
* @deprecated. Instead use getLastName
|
|
||||||
*/
|
|
||||||
public function getLast_name() {
|
|
||||||
return $this->last_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Address of the merchant.
|
* Last name of the merchant. 30 characters max.
|
||||||
*
|
*
|
||||||
* @param PayPal\Api\Address $address
|
* @param string $last_name
|
||||||
*/
|
* @deprecated. Instead use setLastName
|
||||||
public function setAddress($address) {
|
*/
|
||||||
$this->address = $address;
|
public function setLast_name($last_name)
|
||||||
return $this;
|
{
|
||||||
}
|
$this->last_name = $last_name;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Address of the merchant.
|
* Last name of the merchant. 30 characters max.
|
||||||
*
|
*
|
||||||
* @return PayPal\Api\Address
|
* @return string
|
||||||
*/
|
* @deprecated. Instead use getLastName
|
||||||
public function getAddress() {
|
*/
|
||||||
return $this->address;
|
public function getLast_name()
|
||||||
}
|
{
|
||||||
|
return $this->last_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Address of the merchant.
|
||||||
|
*
|
||||||
|
* @param PayPal\Api\Address $address
|
||||||
|
*/
|
||||||
|
public function setAddress($address)
|
||||||
|
{
|
||||||
|
$this->address = $address;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Address of the merchant.
|
||||||
|
*
|
||||||
|
* @return PayPal\Api\Address
|
||||||
|
*/
|
||||||
|
public function getAddress()
|
||||||
|
{
|
||||||
|
return $this->address;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Company business name of the merchant. 100 characters max.
|
* Company business name of the merchant. 100 characters max.
|
||||||
*
|
*
|
||||||
* @param string $business_name
|
* @param string $business_name
|
||||||
*/
|
*/
|
||||||
public function setBusinessName($business_name) {
|
public function setBusinessName($business_name)
|
||||||
$this->business_name = $business_name;
|
{
|
||||||
return $this;
|
$this->business_name = $business_name;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Company business name of the merchant. 100 characters max.
|
* Company business name of the merchant. 100 characters max.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getBusinessName() {
|
public function getBusinessName()
|
||||||
return $this->business_name;
|
{
|
||||||
}
|
return $this->business_name;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Company business name of the merchant. 100 characters max.
|
* Company business name of the merchant. 100 characters max.
|
||||||
*
|
*
|
||||||
* @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;
|
{
|
||||||
return $this;
|
$this->business_name = $business_name;
|
||||||
}
|
return $this;
|
||||||
/**
|
}
|
||||||
* Company business name of the merchant. 100 characters max.
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
* @deprecated. Instead use getBusinessName
|
|
||||||
*/
|
|
||||||
public function getBusiness_name() {
|
|
||||||
return $this->business_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Phone number of the merchant.
|
* Company business name of the merchant. 100 characters max.
|
||||||
*
|
*
|
||||||
* @param PayPal\Api\Phone $phone
|
* @return string
|
||||||
*/
|
* @deprecated. Instead use getBusinessName
|
||||||
public function setPhone($phone) {
|
*/
|
||||||
$this->phone = $phone;
|
public function getBusiness_name()
|
||||||
return $this;
|
{
|
||||||
}
|
return $this->business_name;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Phone number of the merchant.
|
* Phone number of the merchant.
|
||||||
*
|
*
|
||||||
* @return PayPal\Api\Phone
|
* @param PayPal\Api\Phone $phone
|
||||||
*/
|
*/
|
||||||
public function getPhone() {
|
public function setPhone($phone)
|
||||||
return $this->phone;
|
{
|
||||||
}
|
$this->phone = $phone;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Phone number of the merchant.
|
||||||
|
*
|
||||||
|
* @return PayPal\Api\Phone
|
||||||
|
*/
|
||||||
|
public function getPhone()
|
||||||
|
{
|
||||||
|
return $this->phone;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fax number of the merchant.
|
* Fax number of the merchant.
|
||||||
*
|
*
|
||||||
* @param PayPal\Api\Phone $fax
|
* @param PayPal\Api\Phone $fax
|
||||||
*/
|
*/
|
||||||
public function setFax($fax) {
|
public function setFax($fax)
|
||||||
$this->fax = $fax;
|
{
|
||||||
return $this;
|
$this->fax = $fax;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fax number of the merchant.
|
* Fax number of the merchant.
|
||||||
*
|
*
|
||||||
* @return PayPal\Api\Phone
|
* @return PayPal\Api\Phone
|
||||||
*/
|
*/
|
||||||
public function getFax() {
|
public function getFax()
|
||||||
return $this->fax;
|
{
|
||||||
}
|
return $this->fax;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Website of the merchant. 2048 characters max.
|
* Website of the merchant. 2048 characters max.
|
||||||
*
|
*
|
||||||
* @param string $website
|
* @param string $website
|
||||||
*/
|
*/
|
||||||
public function setWebsite($website) {
|
public function setWebsite($website)
|
||||||
$this->website = $website;
|
{
|
||||||
return $this;
|
$this->website = $website;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Website of the merchant. 2048 characters max.
|
* Website of the merchant. 2048 characters max.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getWebsite() {
|
public function getWebsite()
|
||||||
return $this->website;
|
{
|
||||||
}
|
return $this->website;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tax ID of the merchant. 100 characters max.
|
* Tax ID of the merchant. 100 characters max.
|
||||||
*
|
*
|
||||||
* @param string $tax_id
|
* @param string $tax_id
|
||||||
*/
|
*/
|
||||||
public function setTaxId($tax_id) {
|
public function setTaxId($tax_id)
|
||||||
$this->tax_id = $tax_id;
|
{
|
||||||
return $this;
|
$this->tax_id = $tax_id;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tax ID of the merchant. 100 characters max.
|
* Tax ID of the merchant. 100 characters max.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getTaxId() {
|
public function getTaxId()
|
||||||
return $this->tax_id;
|
{
|
||||||
}
|
return $this->tax_id;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tax ID of the merchant. 100 characters max.
|
* Tax ID of the merchant. 100 characters max.
|
||||||
*
|
*
|
||||||
* @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;
|
{
|
||||||
return $this;
|
$this->tax_id = $tax_id;
|
||||||
}
|
return $this;
|
||||||
/**
|
}
|
||||||
* Tax ID of the merchant. 100 characters max.
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
* @deprecated. Instead use getTaxId
|
|
||||||
*/
|
|
||||||
public function getTax_id() {
|
|
||||||
return $this->tax_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Option to display additional information such as business hours. 40 characters max.
|
* Tax ID of the merchant. 100 characters max.
|
||||||
*
|
*
|
||||||
* @param string $additional_info
|
* @return string
|
||||||
*/
|
* @deprecated. Instead use getTaxId
|
||||||
public function setAdditionalInfo($additional_info) {
|
*/
|
||||||
$this->additional_info = $additional_info;
|
public function getTax_id()
|
||||||
return $this;
|
{
|
||||||
}
|
return $this->tax_id;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
* @param string $additional_info
|
||||||
*/
|
*/
|
||||||
public function getAdditionalInfo() {
|
public function setAdditionalInfo($additional_info)
|
||||||
return $this->additional_info;
|
{
|
||||||
}
|
$this->additional_info = $additional_info;
|
||||||
|
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.
|
||||||
*
|
*
|
||||||
* @param string $additional_info
|
* @return string
|
||||||
* @deprecated. Instead use setAdditionalInfo
|
*/
|
||||||
*/
|
public function getAdditionalInfo()
|
||||||
public function setAdditional_info($additional_info) {
|
{
|
||||||
$this->additional_info = $additional_info;
|
return $this->additional_info;
|
||||||
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
|
* @param string $additional_info
|
||||||
* @deprecated. Instead use getAdditionalInfo
|
* @deprecated. Instead use setAdditionalInfo
|
||||||
*/
|
*/
|
||||||
public function getAdditional_info() {
|
public function setAdditional_info($additional_info)
|
||||||
return $this->additional_info;
|
{
|
||||||
}
|
$this->additional_info = $additional_info;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Option to display additional information such as business hours. 40 characters max.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
* @deprecated. Instead use getAdditionalInfo
|
||||||
|
*/
|
||||||
|
public function getAdditional_info()
|
||||||
|
{
|
||||||
|
return $this->additional_info;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,356 +4,402 @@ 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) {
|
*/
|
||||||
$this->created_date = $created_date;
|
public function setCreatedDate($created_date)
|
||||||
return $this;
|
{
|
||||||
}
|
$this->created_date = $created_date;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date when the resource was created.
|
* Date when the resource was created.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getCreatedDate() {
|
public function getCreatedDate()
|
||||||
return $this->created_date;
|
{
|
||||||
}
|
return $this->created_date;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date when the resource was created.
|
* Date when the resource was created.
|
||||||
*
|
*
|
||||||
* @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;
|
{
|
||||||
return $this;
|
$this->created_date = $created_date;
|
||||||
}
|
return $this;
|
||||||
/**
|
}
|
||||||
* Date when the resource was created.
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
* @deprecated. Instead use getCreatedDate
|
|
||||||
*/
|
|
||||||
public function getCreated_date() {
|
|
||||||
return $this->created_date;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Email address of the account that created the resource.
|
* Date when the resource was created.
|
||||||
*
|
*
|
||||||
* @param string $created_by
|
* @return string
|
||||||
*/
|
* @deprecated. Instead use getCreatedDate
|
||||||
public function setCreatedBy($created_by) {
|
*/
|
||||||
$this->created_by = $created_by;
|
public function getCreated_date()
|
||||||
return $this;
|
{
|
||||||
}
|
return $this->created_date;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Email address of the account that created the resource.
|
* Email address of the account that created the resource.
|
||||||
*
|
*
|
||||||
* @return string
|
* @param string $created_by
|
||||||
*/
|
*/
|
||||||
public function getCreatedBy() {
|
public function setCreatedBy($created_by)
|
||||||
return $this->created_by;
|
{
|
||||||
}
|
$this->created_by = $created_by;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Email address of the account that created the resource.
|
* Email address of the account that created the resource.
|
||||||
*
|
*
|
||||||
* @param string $created_by
|
* @return string
|
||||||
* @deprecated. Instead use setCreatedBy
|
*/
|
||||||
*/
|
public function getCreatedBy()
|
||||||
public function setCreated_by($created_by) {
|
{
|
||||||
$this->created_by = $created_by;
|
return $this->created_by;
|
||||||
return $this;
|
}
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Email address of the account that created the resource.
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
* @deprecated. Instead use getCreatedBy
|
|
||||||
*/
|
|
||||||
public function getCreated_by() {
|
|
||||||
return $this->created_by;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date when the resource was cancelled.
|
* Email address of the account that created the resource.
|
||||||
*
|
*
|
||||||
* @param string $cancelled_date
|
* @param string $created_by
|
||||||
*/
|
* @deprecated. Instead use setCreatedBy
|
||||||
public function setCancelledDate($cancelled_date) {
|
*/
|
||||||
$this->cancelled_date = $cancelled_date;
|
public function setCreated_by($created_by)
|
||||||
return $this;
|
{
|
||||||
}
|
$this->created_by = $created_by;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date when the resource was cancelled.
|
* Email address of the account that created the resource.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
* @deprecated. Instead use getCreatedBy
|
||||||
public function getCancelledDate() {
|
*/
|
||||||
return $this->cancelled_date;
|
public function getCreated_by()
|
||||||
}
|
{
|
||||||
|
return $this->created_by;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date when the resource was cancelled.
|
* Date when the resource was cancelled.
|
||||||
*
|
*
|
||||||
* @param string $cancelled_date
|
* @param string $cancelled_date
|
||||||
* @deprecated. Instead use setCancelledDate
|
*/
|
||||||
*/
|
public function setCancelledDate($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.
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
* @deprecated. Instead use getCancelledDate
|
|
||||||
*/
|
|
||||||
public function getCancelled_date() {
|
|
||||||
return $this->cancelled_date;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Actor who cancelled the resource.
|
* Date when the resource was cancelled.
|
||||||
*
|
*
|
||||||
* @param string $cancelled_by
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function setCancelledBy($cancelled_by) {
|
public function getCancelledDate()
|
||||||
$this->cancelled_by = $cancelled_by;
|
{
|
||||||
return $this;
|
return $this->cancelled_date;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Actor who cancelled the resource.
|
* Date when the resource was cancelled.
|
||||||
*
|
*
|
||||||
* @return string
|
* @param string $cancelled_date
|
||||||
*/
|
* @deprecated. Instead use setCancelledDate
|
||||||
public function getCancelledBy() {
|
*/
|
||||||
return $this->cancelled_by;
|
public function setCancelled_date($cancelled_date)
|
||||||
}
|
{
|
||||||
|
$this->cancelled_date = $cancelled_date;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Actor who cancelled the resource.
|
* Date when the resource was cancelled.
|
||||||
*
|
*
|
||||||
* @param string $cancelled_by
|
* @return string
|
||||||
* @deprecated. Instead use setCancelledBy
|
* @deprecated. Instead use getCancelledDate
|
||||||
*/
|
*/
|
||||||
public function setCancelled_by($cancelled_by) {
|
public function getCancelled_date()
|
||||||
$this->cancelled_by = $cancelled_by;
|
{
|
||||||
return $this;
|
return $this->cancelled_date;
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* Actor who cancelled the resource.
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
* @deprecated. Instead use getCancelledBy
|
|
||||||
*/
|
|
||||||
public function getCancelled_by() {
|
|
||||||
return $this->cancelled_by;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date when the resource was last edited.
|
* Actor who cancelled the resource.
|
||||||
*
|
*
|
||||||
* @param string $last_updated_date
|
* @param string $cancelled_by
|
||||||
*/
|
*/
|
||||||
public function setLastUpdatedDate($last_updated_date) {
|
public function setCancelledBy($cancelled_by)
|
||||||
$this->last_updated_date = $last_updated_date;
|
{
|
||||||
return $this;
|
$this->cancelled_by = $cancelled_by;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date when the resource was last edited.
|
* Actor who cancelled the resource.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getLastUpdatedDate() {
|
public function getCancelledBy()
|
||||||
return $this->last_updated_date;
|
{
|
||||||
}
|
return $this->cancelled_by;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date when the resource was last edited.
|
* Actor who cancelled the resource.
|
||||||
*
|
*
|
||||||
* @param string $last_updated_date
|
* @param string $cancelled_by
|
||||||
* @deprecated. Instead use setLastUpdatedDate
|
* @deprecated. Instead use setCancelledBy
|
||||||
*/
|
*/
|
||||||
public function setLast_updated_date($last_updated_date) {
|
public function setCancelled_by($cancelled_by)
|
||||||
$this->last_updated_date = $last_updated_date;
|
{
|
||||||
return $this;
|
$this->cancelled_by = $cancelled_by;
|
||||||
}
|
return $this;
|
||||||
/**
|
}
|
||||||
* Date when the resource was last edited.
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
* @deprecated. Instead use getLastUpdatedDate
|
|
||||||
*/
|
|
||||||
public function getLast_updated_date() {
|
|
||||||
return $this->last_updated_date;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Email address of the account that last edited the resource.
|
* Actor who cancelled the resource.
|
||||||
*
|
*
|
||||||
* @param string $last_updated_by
|
* @return string
|
||||||
*/
|
* @deprecated. Instead use getCancelledBy
|
||||||
public function setLastUpdatedBy($last_updated_by) {
|
*/
|
||||||
$this->last_updated_by = $last_updated_by;
|
public function getCancelled_by()
|
||||||
return $this;
|
{
|
||||||
}
|
return $this->cancelled_by;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Email address of the account that last edited the resource.
|
* Date when the resource was last edited.
|
||||||
*
|
*
|
||||||
* @return string
|
* @param string $last_updated_date
|
||||||
*/
|
*/
|
||||||
public function getLastUpdatedBy() {
|
public function setLastUpdatedDate($last_updated_date)
|
||||||
return $this->last_updated_by;
|
{
|
||||||
}
|
$this->last_updated_date = $last_updated_date;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Email address of the account that last edited the resource.
|
* Date when the resource was last edited.
|
||||||
*
|
*
|
||||||
* @param string $last_updated_by
|
* @return string
|
||||||
* @deprecated. Instead use setLastUpdatedBy
|
*/
|
||||||
*/
|
public function getLastUpdatedDate()
|
||||||
public function setLast_updated_by($last_updated_by) {
|
{
|
||||||
$this->last_updated_by = $last_updated_by;
|
return $this->last_updated_date;
|
||||||
return $this;
|
}
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Email address of the account that last edited the resource.
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
* @deprecated. Instead use getLastUpdatedBy
|
|
||||||
*/
|
|
||||||
public function getLast_updated_by() {
|
|
||||||
return $this->last_updated_by;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date when the resource was first sent.
|
* Date when the resource was last edited.
|
||||||
*
|
*
|
||||||
* @param string $first_sent_date
|
* @param string $last_updated_date
|
||||||
*/
|
* @deprecated. Instead use setLastUpdatedDate
|
||||||
public function setFirstSentDate($first_sent_date) {
|
*/
|
||||||
$this->first_sent_date = $first_sent_date;
|
public function setLast_updated_date($last_updated_date)
|
||||||
return $this;
|
{
|
||||||
}
|
$this->last_updated_date = $last_updated_date;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date when the resource was first sent.
|
* Date when the resource was last edited.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
* @deprecated. Instead use getLastUpdatedDate
|
||||||
public function getFirstSentDate() {
|
*/
|
||||||
return $this->first_sent_date;
|
public function getLast_updated_date()
|
||||||
}
|
{
|
||||||
|
return $this->last_updated_date;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date when the resource was first sent.
|
* Email address of the account that last edited the resource.
|
||||||
*
|
*
|
||||||
* @param string $first_sent_date
|
* @param string $last_updated_by
|
||||||
* @deprecated. Instead use setFirstSentDate
|
*/
|
||||||
*/
|
public function setLastUpdatedBy($last_updated_by)
|
||||||
public function setFirst_sent_date($first_sent_date) {
|
{
|
||||||
$this->first_sent_date = $first_sent_date;
|
$this->last_updated_by = $last_updated_by;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* Date when the resource was first sent.
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
* @deprecated. Instead use getFirstSentDate
|
|
||||||
*/
|
|
||||||
public function getFirst_sent_date() {
|
|
||||||
return $this->first_sent_date;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date when the resource was last sent.
|
* Email address of the account that last edited the resource.
|
||||||
*
|
*
|
||||||
* @param string $last_sent_date
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function setLastSentDate($last_sent_date) {
|
public function getLastUpdatedBy()
|
||||||
$this->last_sent_date = $last_sent_date;
|
{
|
||||||
return $this;
|
return $this->last_updated_by;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date when the resource was last sent.
|
* Email address of the account that last edited the resource.
|
||||||
*
|
*
|
||||||
* @return string
|
* @param string $last_updated_by
|
||||||
*/
|
* @deprecated. Instead use setLastUpdatedBy
|
||||||
public function getLastSentDate() {
|
*/
|
||||||
return $this->last_sent_date;
|
public function setLast_updated_by($last_updated_by)
|
||||||
}
|
{
|
||||||
|
$this->last_updated_by = $last_updated_by;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date when the resource was last sent.
|
* Email address of the account that last edited the resource.
|
||||||
*
|
*
|
||||||
* @param string $last_sent_date
|
* @return string
|
||||||
* @deprecated. Instead use setLastSentDate
|
* @deprecated. Instead use getLastUpdatedBy
|
||||||
*/
|
*/
|
||||||
public function setLast_sent_date($last_sent_date) {
|
public function getLast_updated_by()
|
||||||
$this->last_sent_date = $last_sent_date;
|
{
|
||||||
return $this;
|
return $this->last_updated_by;
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* Date when the resource was last sent.
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
* @deprecated. Instead use getLastSentDate
|
|
||||||
*/
|
|
||||||
public function getLast_sent_date() {
|
|
||||||
return $this->last_sent_date;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Email address of the account that last sent the resource.
|
* Date when the resource was first sent.
|
||||||
*
|
*
|
||||||
* @param string $last_sent_by
|
* @param string $first_sent_date
|
||||||
*/
|
*/
|
||||||
public function setLastSentBy($last_sent_by) {
|
public function setFirstSentDate($first_sent_date)
|
||||||
$this->last_sent_by = $last_sent_by;
|
{
|
||||||
return $this;
|
$this->first_sent_date = $first_sent_date;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Email address of the account that last sent the resource.
|
* Date when the resource was first sent.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getLastSentBy() {
|
public function getFirstSentDate()
|
||||||
return $this->last_sent_by;
|
{
|
||||||
}
|
return $this->first_sent_date;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Email address of the account that last sent the resource.
|
* Date when the resource was first sent.
|
||||||
*
|
*
|
||||||
* @param string $last_sent_by
|
* @param string $first_sent_date
|
||||||
* @deprecated. Instead use setLastSentBy
|
* @deprecated. Instead use setFirstSentDate
|
||||||
*/
|
*/
|
||||||
public function setLast_sent_by($last_sent_by) {
|
public function setFirst_sent_date($first_sent_date)
|
||||||
$this->last_sent_by = $last_sent_by;
|
{
|
||||||
return $this;
|
$this->first_sent_date = $first_sent_date;
|
||||||
}
|
return $this;
|
||||||
/**
|
}
|
||||||
* Email address of the account that last sent the resource.
|
|
||||||
*
|
/**
|
||||||
* @return string
|
* Date when the resource was first sent.
|
||||||
* @deprecated. Instead use getLastSentBy
|
*
|
||||||
*/
|
* @return string
|
||||||
public function getLast_sent_by() {
|
* @deprecated. Instead use getFirstSentDate
|
||||||
return $this->last_sent_by;
|
*/
|
||||||
}
|
public function getFirst_sent_date()
|
||||||
|
{
|
||||||
|
return $this->first_sent_date;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Date when the resource was last sent.
|
||||||
|
*
|
||||||
|
* @param string $last_sent_date
|
||||||
|
*/
|
||||||
|
public function setLastSentDate($last_sent_date)
|
||||||
|
{
|
||||||
|
$this->last_sent_date = $last_sent_date;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Date when the resource was last sent.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getLastSentDate()
|
||||||
|
{
|
||||||
|
return $this->last_sent_date;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Date when the resource was last sent.
|
||||||
|
*
|
||||||
|
* @param string $last_sent_date
|
||||||
|
* @deprecated. Instead use setLastSentDate
|
||||||
|
*/
|
||||||
|
public function setLast_sent_date($last_sent_date)
|
||||||
|
{
|
||||||
|
$this->last_sent_date = $last_sent_date;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Date when the resource was last sent.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
* @deprecated. Instead use getLastSentDate
|
||||||
|
*/
|
||||||
|
public function getLast_sent_date()
|
||||||
|
{
|
||||||
|
return $this->last_sent_date;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Email address of the account that last sent the resource.
|
||||||
|
*
|
||||||
|
* @param string $last_sent_by
|
||||||
|
*/
|
||||||
|
public function setLastSentBy($last_sent_by)
|
||||||
|
{
|
||||||
|
$this->last_sent_by = $last_sent_by;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Email address of the account that last sent the resource.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getLastSentBy()
|
||||||
|
{
|
||||||
|
return $this->last_sent_by;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Email address of the account that last sent the resource.
|
||||||
|
*
|
||||||
|
* @param string $last_sent_by
|
||||||
|
* @deprecated. Instead use setLastSentBy
|
||||||
|
*/
|
||||||
|
public function setLast_sent_by($last_sent_by)
|
||||||
|
{
|
||||||
|
$this->last_sent_by = $last_sent_by;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Email address of the account that last sent the resource.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
* @deprecated. Instead use getLastSentBy
|
||||||
|
*/
|
||||||
|
public function getLast_sent_by()
|
||||||
|
{
|
||||||
|
return $this->last_sent_by;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,84 +4,94 @@ 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) {
|
*/
|
||||||
$this->subject = $subject;
|
public function setSubject($subject)
|
||||||
return $this;
|
{
|
||||||
}
|
$this->subject = $subject;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Subject of the notification.
|
* Subject of the notification.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getSubject() {
|
public function getSubject()
|
||||||
return $this->subject;
|
{
|
||||||
}
|
return $this->subject;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Note to the payer.
|
* Note to the payer.
|
||||||
*
|
*
|
||||||
* @param string $note
|
* @param string $note
|
||||||
*/
|
*/
|
||||||
public function setNote($note) {
|
public function setNote($note)
|
||||||
$this->note = $note;
|
{
|
||||||
return $this;
|
$this->note = $note;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Note to the payer.
|
* Note to the payer.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getNote() {
|
public function getNote()
|
||||||
return $this->note;
|
{
|
||||||
}
|
return $this->note;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
*
|
*
|
||||||
* @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;
|
{
|
||||||
return $this;
|
$this->send_to_merchant = $send_to_merchant;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A flag indicating whether a copy of the email has to be sent to the merchant.
|
* A flag indicating whether a copy of the email has to be sent to the merchant.
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function getSendToMerchant() {
|
public function getSendToMerchant()
|
||||||
return $this->send_to_merchant;
|
{
|
||||||
}
|
return $this->send_to_merchant;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
*
|
*
|
||||||
* @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;
|
{
|
||||||
return $this;
|
$this->send_to_merchant = $send_to_merchant;
|
||||||
}
|
return $this;
|
||||||
/**
|
}
|
||||||
* A flag indicating whether a copy of the email has to be sent to the merchant.
|
|
||||||
*
|
/**
|
||||||
* @return boolean
|
* A flag indicating whether a copy of the email has to be sent to the merchant.
|
||||||
* @deprecated. Instead use getSendToMerchant
|
*
|
||||||
*/
|
* @return boolean
|
||||||
public function getSend_to_merchant() {
|
* @deprecated. Instead use getSendToMerchant
|
||||||
return $this->send_to_merchant;
|
*/
|
||||||
}
|
public function getSend_to_merchant()
|
||||||
|
{
|
||||||
|
return $this->send_to_merchant;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ use PayPal\Rest\ApiContext;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Order
|
* Class Order
|
||||||
*
|
*
|
||||||
* @property string id
|
* @property string id
|
||||||
* @property string createTime
|
* @property string createTime
|
||||||
* @property string updateTime
|
* @property string updateTime
|
||||||
@@ -21,9 +21,9 @@ class Order extends PPModel
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Set the identifier of the order transaction.
|
* Set the identifier of the order transaction.
|
||||||
*
|
*
|
||||||
* @param string $id
|
* @param string $id
|
||||||
*
|
*
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setId($id)
|
public function setId($id)
|
||||||
@@ -35,7 +35,7 @@ class Order extends PPModel
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the identifier of the order transaction.
|
* Get the identifier of the order transaction.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getId()
|
public function getId()
|
||||||
@@ -45,9 +45,9 @@ class Order extends PPModel
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the time the resource was created.
|
* Set the time the resource was created.
|
||||||
*
|
*
|
||||||
* @param string $create_time
|
* @param string $create_time
|
||||||
*
|
*
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setCreateTime($create_time)
|
public function setCreateTime($create_time)
|
||||||
@@ -59,7 +59,7 @@ class Order extends PPModel
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the time the resource was created.
|
* Get the time the resource was created.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getCreateTime()
|
public function getCreateTime()
|
||||||
@@ -69,9 +69,9 @@ class Order extends PPModel
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the time the resource was last updated.
|
* Set the time the resource was last updated.
|
||||||
*
|
*
|
||||||
* @param string $update_time
|
* @param string $update_time
|
||||||
*
|
*
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setUpdateTime($update_time)
|
public function setUpdateTime($update_time)
|
||||||
@@ -83,7 +83,7 @@ class Order extends PPModel
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the time the resource was last updated.
|
* Get the time the resource was last updated.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getUpdateTime()
|
public function getUpdateTime()
|
||||||
@@ -93,11 +93,11 @@ class Order extends PPModel
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the state of the order transaction.
|
* Set the state of the order transaction.
|
||||||
*
|
*
|
||||||
* Allowed values are: `PENDING`, `COMPLETED`, `REFUNDED` or `PARTIALLY_REFUNDED`.
|
* Allowed values are: `PENDING`, `COMPLETED`, `REFUNDED` or `PARTIALLY_REFUNDED`.
|
||||||
*
|
*
|
||||||
* @param string $state
|
* @param string $state
|
||||||
*
|
*
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setState($state)
|
public function setState($state)
|
||||||
@@ -109,9 +109,9 @@ class Order extends PPModel
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the state of the order transaction.
|
* Get the state of the order transaction.
|
||||||
*
|
*
|
||||||
* Allowed values are: `PENDING`, `COMPLETED`, `REFUNDED` or `PARTIALLY_REFUNDED`.
|
* Allowed values are: `PENDING`, `COMPLETED`, `REFUNDED` or `PARTIALLY_REFUNDED`.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getState()
|
public function getState()
|
||||||
@@ -121,9 +121,9 @@ class Order extends PPModel
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the amount being collected.
|
* Set the amount being collected.
|
||||||
*
|
*
|
||||||
* @param \PayPal\Api\Amount $amount
|
* @param \PayPal\Api\Amount $amount
|
||||||
*
|
*
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setAmount($amount)
|
public function setAmount($amount)
|
||||||
@@ -135,7 +135,7 @@ class Order extends PPModel
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the amount being collected.
|
* Get the amount being collected.
|
||||||
*
|
*
|
||||||
* @return \PayPal\Api\Amount
|
* @return \PayPal\Api\Amount
|
||||||
*/
|
*/
|
||||||
public function getAmount()
|
public function getAmount()
|
||||||
@@ -145,9 +145,9 @@ class Order extends PPModel
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set ID of the payment resource on which this transaction is based.
|
* Set ID of the payment resource on which this transaction is based.
|
||||||
*
|
*
|
||||||
* @param string $parent_payment
|
* @param string $parent_payment
|
||||||
*
|
*
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setParentPayment($parent_payment)
|
public function setParentPayment($parent_payment)
|
||||||
@@ -159,7 +159,7 @@ class Order extends PPModel
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get ID of the payment resource on which this transaction is based.
|
* Get ID of the payment resource on which this transaction is based.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getParentPayment()
|
public function getParentPayment()
|
||||||
@@ -169,9 +169,9 @@ class Order extends PPModel
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Links
|
* Set Links
|
||||||
*
|
*
|
||||||
* @param \PayPal\Api\Links $links
|
* @param \PayPal\Api\Links $links
|
||||||
*
|
*
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setLinks($links)
|
public function setLinks($links)
|
||||||
@@ -183,7 +183,7 @@ class Order extends PPModel
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Links
|
* Get Links
|
||||||
*
|
*
|
||||||
* @return \PayPal\Api\Links
|
* @return \PayPal\Api\Links
|
||||||
*/
|
*/
|
||||||
public function getLinks()
|
public function getLinks()
|
||||||
@@ -193,16 +193,16 @@ class Order extends PPModel
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reason code for the transaction state being Pending or Reversed. Assigned in response.
|
* Reason code for the transaction state being Pending or Reversed. Assigned in response.
|
||||||
*
|
*
|
||||||
* Allowed values: `CHARGEBACK`, `GUARANTEE`, `BUYER_COMPLAINT`, `REFUND`,
|
* Allowed values: `CHARGEBACK`, `GUARANTEE`, `BUYER_COMPLAINT`, `REFUND`,
|
||||||
* `UNCONFIRMED_SHIPPING_ADDRESS`,
|
* `UNCONFIRMED_SHIPPING_ADDRESS`,
|
||||||
* `ECHECK`, `INTERNATIONAL_WITHDRAWAL`,
|
* `ECHECK`, `INTERNATIONAL_WITHDRAWAL`,
|
||||||
* `RECEIVING_PREFERENCE_MANDATES_MANUAL_ACTION`, `PAYMENT_REVIEW`,
|
* `RECEIVING_PREFERENCE_MANDATES_MANUAL_ACTION`, `PAYMENT_REVIEW`,
|
||||||
* `REGULATORY_REVIEW`, `UNILATERAL`, or `VERIFICATION_REQUIRED`
|
* `REGULATORY_REVIEW`, `UNILATERAL`, or `VERIFICATION_REQUIRED`
|
||||||
* (`ORDER` can also be set in the response).
|
* (`ORDER` can also be set in the response).
|
||||||
*
|
*
|
||||||
* @param string $reason_code
|
* @param string $reason_code
|
||||||
*
|
*
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setReasonCode($reason_code)
|
public function setReasonCode($reason_code)
|
||||||
@@ -214,14 +214,14 @@ class Order extends PPModel
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reason code for the transaction state being Pending or Reversed. Assigned in response.
|
* Reason code for the transaction state being Pending or Reversed. Assigned in response.
|
||||||
*
|
*
|
||||||
* Allowed values: `CHARGEBACK`, `GUARANTEE`, `BUYER_COMPLAINT`, `REFUND`,
|
* Allowed values: `CHARGEBACK`, `GUARANTEE`, `BUYER_COMPLAINT`, `REFUND`,
|
||||||
* `UNCONFIRMED_SHIPPING_ADDRESS`,
|
* `UNCONFIRMED_SHIPPING_ADDRESS`,
|
||||||
* `ECHECK`, `INTERNATIONAL_WITHDRAWAL`,
|
* `ECHECK`, `INTERNATIONAL_WITHDRAWAL`,
|
||||||
* `RECEIVING_PREFERENCE_MANDATES_MANUAL_ACTION`, `PAYMENT_REVIEW`,
|
* `RECEIVING_PREFERENCE_MANDATES_MANUAL_ACTION`, `PAYMENT_REVIEW`,
|
||||||
* `REGULATORY_REVIEW`, `UNILATERAL`, or `VERIFICATION_REQUIRED`
|
* `REGULATORY_REVIEW`, `UNILATERAL`, or `VERIFICATION_REQUIRED`
|
||||||
* (`ORDER` can also be set in the response).
|
* (`ORDER` can also be set in the response).
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getReasonCode()
|
public function getReasonCode()
|
||||||
|
|||||||
@@ -279,7 +279,7 @@ class PayerInfo extends PPModel
|
|||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Shipping Address
|
* Get Shipping Address
|
||||||
* Shipping address of the Payer from their PayPal Account
|
* Shipping address of the Payer from their PayPal Account
|
||||||
|
|||||||
@@ -4,163 +4,182 @@ 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) {
|
*/
|
||||||
$this->type = $type;
|
public function setType($type)
|
||||||
return $this;
|
{
|
||||||
}
|
$this->type = $type;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PayPal payment detail indicating whether payment was made in an invoicing flow via PayPal or externally. In the case of the mark-as-paid API, payment type is EXTERNAL and this is what is now supported. The PAYPAL value is provided for backward compatibility.
|
* PayPal payment detail indicating whether payment was made in an invoicing flow via PayPal or externally. In the case of the mark-as-paid API, payment type is EXTERNAL and this is what is now supported. The PAYPAL value is provided for backward compatibility.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getType() {
|
public function getType()
|
||||||
return $this->type;
|
{
|
||||||
}
|
return $this->type;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
*
|
*
|
||||||
* @param string $transaction_id
|
* @param string $transaction_id
|
||||||
*/
|
*/
|
||||||
public function setTransactionId($transaction_id) {
|
public function setTransactionId($transaction_id)
|
||||||
$this->transaction_id = $transaction_id;
|
{
|
||||||
return $this;
|
$this->transaction_id = $transaction_id;
|
||||||
}
|
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
|
||||||
*/
|
*/
|
||||||
public function getTransactionId() {
|
public function getTransactionId()
|
||||||
return $this->transaction_id;
|
{
|
||||||
}
|
return $this->transaction_id;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
*
|
*
|
||||||
* @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;
|
{
|
||||||
return $this;
|
$this->transaction_id = $transaction_id;
|
||||||
}
|
return $this;
|
||||||
/**
|
}
|
||||||
* PayPal payment transaction id. Mandatory field in case the type value is PAYPAL.
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
* @deprecated. Instead use getTransactionId
|
|
||||||
*/
|
|
||||||
public function getTransaction_id() {
|
|
||||||
return $this->transaction_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Type of the transaction.
|
* PayPal payment transaction id. Mandatory field in case the type value is PAYPAL.
|
||||||
*
|
*
|
||||||
* @param string $transaction_type
|
* @return string
|
||||||
*/
|
* @deprecated. Instead use getTransactionId
|
||||||
public function setTransactionType($transaction_type) {
|
*/
|
||||||
$this->transaction_type = $transaction_type;
|
public function getTransaction_id()
|
||||||
return $this;
|
{
|
||||||
}
|
return $this->transaction_id;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Type of the transaction.
|
* Type of the transaction.
|
||||||
*
|
*
|
||||||
* @return string
|
* @param string $transaction_type
|
||||||
*/
|
*/
|
||||||
public function getTransactionType() {
|
public function setTransactionType($transaction_type)
|
||||||
return $this->transaction_type;
|
{
|
||||||
}
|
$this->transaction_type = $transaction_type;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Type of the transaction.
|
* Type of the transaction.
|
||||||
*
|
*
|
||||||
* @param string $transaction_type
|
* @return string
|
||||||
* @deprecated. Instead use setTransactionType
|
*/
|
||||||
*/
|
public function getTransactionType()
|
||||||
public function setTransaction_type($transaction_type) {
|
{
|
||||||
$this->transaction_type = $transaction_type;
|
return $this->transaction_type;
|
||||||
return $this;
|
}
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Type of the transaction.
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
* @deprecated. Instead use getTransactionType
|
|
||||||
*/
|
|
||||||
public function getTransaction_type() {
|
|
||||||
return $this->transaction_type;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date when the invoice was paid. Date format: yyyy-MM-dd z. For example, 2014-02-27 PST.
|
* Type of the transaction.
|
||||||
*
|
*
|
||||||
* @param string $date
|
* @param string $transaction_type
|
||||||
*/
|
* @deprecated. Instead use setTransactionType
|
||||||
public function setDate($date) {
|
*/
|
||||||
$this->date = $date;
|
public function setTransaction_type($transaction_type)
|
||||||
return $this;
|
{
|
||||||
}
|
$this->transaction_type = $transaction_type;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date when the invoice was paid. Date format: yyyy-MM-dd z. For example, 2014-02-27 PST.
|
* Type of the transaction.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
* @deprecated. Instead use getTransactionType
|
||||||
public function getDate() {
|
*/
|
||||||
return $this->date;
|
public function getTransaction_type()
|
||||||
}
|
{
|
||||||
|
return $this->transaction_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Date when the invoice was paid. Date format: yyyy-MM-dd z. For example, 2014-02-27 PST.
|
||||||
|
*
|
||||||
|
* @param string $date
|
||||||
|
*/
|
||||||
|
public function setDate($date)
|
||||||
|
{
|
||||||
|
$this->date = $date;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Date when the invoice was paid. Date format: yyyy-MM-dd z. For example, 2014-02-27 PST.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getDate()
|
||||||
|
{
|
||||||
|
return $this->date;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Payment mode or method. This field is mandatory if the value of the type field is OTHER.
|
* Payment mode or method. This field is mandatory if the value of the type field is OTHER.
|
||||||
*
|
*
|
||||||
* @param string $method
|
* @param string $method
|
||||||
*/
|
*/
|
||||||
public function setMethod($method) {
|
public function setMethod($method)
|
||||||
$this->method = $method;
|
{
|
||||||
return $this;
|
$this->method = $method;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Payment mode or method. This field is mandatory if the value of the type field is OTHER.
|
* Payment mode or method. This field is mandatory if the value of the type field is OTHER.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getMethod() {
|
public function getMethod()
|
||||||
return $this->method;
|
{
|
||||||
}
|
return $this->method;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Optional note associated with the payment.
|
* Optional note associated with the payment.
|
||||||
*
|
*
|
||||||
* @param string $note
|
* @param string $note
|
||||||
*/
|
*/
|
||||||
public function setNote($note) {
|
public function setNote($note)
|
||||||
$this->note = $note;
|
{
|
||||||
return $this;
|
$this->note = $note;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Optional note associated with the payment.
|
* Optional note associated with the payment.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getNote() {
|
public function getNote()
|
||||||
return $this->note;
|
{
|
||||||
}
|
return $this->note;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ class PaymentHistory extends PPModel
|
|||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Next ID
|
* Get Next ID
|
||||||
* Identifier of the next element to get the next range of results
|
* Identifier of the next element to get the next range of results
|
||||||
|
|||||||
@@ -4,83 +4,94 @@ 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) {
|
*/
|
||||||
$this->term_type = $term_type;
|
public function setTermType($term_type)
|
||||||
return $this;
|
{
|
||||||
}
|
$this->term_type = $term_type;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Terms by which the invoice payment is due.
|
* Terms by which the invoice payment is due.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getTermType() {
|
public function getTermType()
|
||||||
return $this->term_type;
|
{
|
||||||
}
|
return $this->term_type;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Terms by which the invoice payment is due.
|
* Terms by which the invoice payment is due.
|
||||||
*
|
*
|
||||||
* @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;
|
{
|
||||||
return $this;
|
$this->term_type = $term_type;
|
||||||
}
|
return $this;
|
||||||
/**
|
}
|
||||||
* Terms by which the invoice payment is due.
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
* @deprecated. Instead use getTermType
|
|
||||||
*/
|
|
||||||
public function getTerm_type() {
|
|
||||||
return $this->term_type;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
* Terms by which the invoice payment is due.
|
||||||
*
|
*
|
||||||
* @param string $due_date
|
* @return string
|
||||||
*/
|
* @deprecated. Instead use getTermType
|
||||||
public function setDueDate($due_date) {
|
*/
|
||||||
$this->due_date = $due_date;
|
public function getTerm_type()
|
||||||
return $this;
|
{
|
||||||
}
|
return $this->term_type;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
* @param string $due_date
|
||||||
*/
|
*/
|
||||||
public function getDueDate() {
|
public function setDueDate($due_date)
|
||||||
return $this->due_date;
|
{
|
||||||
}
|
$this->due_date = $due_date;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date on which invoice payment is due. It must be always a future date. Date format: yyyy-MM-dd z. 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
|
||||||
*
|
*
|
||||||
* @param string $due_date
|
* @return string
|
||||||
* @deprecated. Instead use setDueDate
|
*/
|
||||||
*/
|
public function getDueDate()
|
||||||
public function setDue_date($due_date) {
|
{
|
||||||
$this->due_date = $due_date;
|
return $this->due_date;
|
||||||
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
|
* @param string $due_date
|
||||||
* @deprecated. Instead use getDueDate
|
* @deprecated. Instead use setDueDate
|
||||||
*/
|
*/
|
||||||
public function getDue_date() {
|
public function setDue_date($due_date)
|
||||||
return $this->due_date;
|
{
|
||||||
}
|
$this->due_date = $due_date;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Date on which invoice payment is due. It must be always a future date. Date format: yyyy-MM-dd z. For example, 2014-02-27 PST
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
* @deprecated. Instead use getDueDate
|
||||||
|
*/
|
||||||
|
public function getDue_date()
|
||||||
|
{
|
||||||
|
return $this->due_date;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,83 +4,94 @@ 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) {
|
*/
|
||||||
$this->country_code = $country_code;
|
public function setCountryCode($country_code)
|
||||||
return $this;
|
{
|
||||||
}
|
$this->country_code = $country_code;
|
||||||
|
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
|
||||||
*/
|
*/
|
||||||
public function getCountryCode() {
|
public function getCountryCode()
|
||||||
return $this->country_code;
|
{
|
||||||
}
|
return $this->country_code;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
||||||
* @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;
|
{
|
||||||
return $this;
|
$this->country_code = $country_code;
|
||||||
}
|
return $this;
|
||||||
/**
|
}
|
||||||
* Country code (in E.164 format). Assume length is n.
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
* @deprecated. Instead use getCountryCode
|
|
||||||
*/
|
|
||||||
public function getCountry_code() {
|
|
||||||
return $this->country_code;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* In-country phone number (in E.164 format). Maximum (15 - n) digits.
|
* Country code (in E.164 format). Assume length is n.
|
||||||
*
|
*
|
||||||
* @param string $national_number
|
* @return string
|
||||||
*/
|
* @deprecated. Instead use getCountryCode
|
||||||
public function setNationalNumber($national_number) {
|
*/
|
||||||
$this->national_number = $national_number;
|
public function getCountry_code()
|
||||||
return $this;
|
{
|
||||||
}
|
return $this->country_code;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
* @param string $national_number
|
||||||
*/
|
*/
|
||||||
public function getNationalNumber() {
|
public function setNationalNumber($national_number)
|
||||||
return $this->national_number;
|
{
|
||||||
}
|
$this->national_number = $national_number;
|
||||||
|
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.
|
||||||
*
|
*
|
||||||
* @param string $national_number
|
* @return string
|
||||||
* @deprecated. Instead use setNationalNumber
|
*/
|
||||||
*/
|
public function getNationalNumber()
|
||||||
public function setNational_number($national_number) {
|
{
|
||||||
$this->national_number = $national_number;
|
return $this->national_number;
|
||||||
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
|
* @param string $national_number
|
||||||
* @deprecated. Instead use getNationalNumber
|
* @deprecated. Instead use setNationalNumber
|
||||||
*/
|
*/
|
||||||
public function getNational_number() {
|
public function setNational_number($national_number)
|
||||||
return $this->national_number;
|
{
|
||||||
}
|
$this->national_number = $national_number;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* In-country phone number (in E.164 format). Maximum (15 - n) digits.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
* @deprecated. Instead use getNationalNumber
|
||||||
|
*/
|
||||||
|
public function getNational_number()
|
||||||
|
{
|
||||||
|
return $this->national_number;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
@@ -120,7 +118,7 @@ class RedirectUrls extends PPModel
|
|||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Cancel URL
|
* Get Cancel URL
|
||||||
* Url where the payer would be redirected to after canceling the payment
|
* Url where the payer would be redirected to after canceling the payment
|
||||||
|
|||||||
@@ -4,65 +4,72 @@ 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) {
|
*/
|
||||||
$this->type = $type;
|
public function setType($type)
|
||||||
return $this;
|
{
|
||||||
}
|
$this->type = $type;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getType() {
|
public function getType()
|
||||||
return $this->type;
|
{
|
||||||
}
|
return $this->type;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date when the invoice was marked as refunded. If no date is specified, the current date and time is used as the default. In addition, the date must be after the invoice payment date.
|
* Date when the invoice was marked as refunded. If no date is specified, the current date and time is used as the default. In addition, the date must be after the invoice payment date.
|
||||||
*
|
*
|
||||||
* @param string $date
|
* @param string $date
|
||||||
*/
|
*/
|
||||||
public function setDate($date) {
|
public function setDate($date)
|
||||||
$this->date = $date;
|
{
|
||||||
return $this;
|
$this->date = $date;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date when the invoice was marked as refunded. If no date is specified, the current date and time is used as the default. In addition, the date must be after the invoice payment date.
|
* Date when the invoice was marked as refunded. If no date is specified, the current date and time is used as the default. In addition, the date must be after the invoice payment date.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getDate() {
|
public function getDate()
|
||||||
return $this->date;
|
{
|
||||||
}
|
return $this->date;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Optional note associated with the refund.
|
* Optional note associated with the refund.
|
||||||
*
|
*
|
||||||
* @param string $note
|
* @param string $note
|
||||||
*/
|
*/
|
||||||
public function setNote($note) {
|
public function setNote($note)
|
||||||
$this->note = $note;
|
{
|
||||||
return $this;
|
$this->note = $note;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Optional note associated with the refund.
|
* Optional note associated with the refund.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getNote() {
|
public function getNote()
|
||||||
return $this->note;
|
{
|
||||||
}
|
return $this->note;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -117,9 +117,9 @@ class RelatedResources extends PPModel
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Order
|
* Set Order
|
||||||
*
|
*
|
||||||
* @param \PayPal\Api\Order $order
|
* @param \PayPal\Api\Order $order
|
||||||
*
|
*
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setOrder($order)
|
public function setOrder($order)
|
||||||
@@ -131,7 +131,7 @@ class RelatedResources extends PPModel
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Order
|
* Get Order
|
||||||
*
|
*
|
||||||
* @return \PayPal\Api\Order
|
* @return \PayPal\Api\Order
|
||||||
*/
|
*/
|
||||||
public function getOrder()
|
public function getOrder()
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -4,45 +4,50 @@ 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) {
|
*/
|
||||||
$this->amount = $amount;
|
public function setAmount($amount)
|
||||||
return $this;
|
{
|
||||||
}
|
$this->amount = $amount;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shipping cost in amount. Range of 0 to 999999.99.
|
* Shipping cost in amount. Range of 0 to 999999.99.
|
||||||
*
|
*
|
||||||
* @return PayPal\Api\Currency
|
* @return PayPal\Api\Currency
|
||||||
*/
|
*/
|
||||||
public function getAmount() {
|
public function getAmount()
|
||||||
return $this->amount;
|
{
|
||||||
}
|
return $this->amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tax percentage on shipping amount.
|
* Tax percentage on shipping amount.
|
||||||
*
|
*
|
||||||
* @param PayPal\Api\Tax $tax
|
* @param PayPal\Api\Tax $tax
|
||||||
*/
|
*/
|
||||||
public function setTax($tax) {
|
public function setTax($tax)
|
||||||
$this->tax = $tax;
|
{
|
||||||
return $this;
|
$this->tax = $tax;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tax percentage on shipping amount.
|
* Tax percentage on shipping amount.
|
||||||
*
|
*
|
||||||
* @return PayPal\Api\Tax
|
* @return PayPal\Api\Tax
|
||||||
*/
|
*/
|
||||||
public function getTax() {
|
public function getTax()
|
||||||
return $this->tax;
|
{
|
||||||
}
|
return $this->tax;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,162 +4,182 @@ 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) {
|
*/
|
||||||
$this->first_name = $first_name;
|
public function setFirstName($first_name)
|
||||||
return $this;
|
{
|
||||||
}
|
$this->first_name = $first_name;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* First name of the invoice recipient. 30 characters max.
|
* First name of the invoice recipient. 30 characters max.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getFirstName() {
|
public function getFirstName()
|
||||||
return $this->first_name;
|
{
|
||||||
}
|
return $this->first_name;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
||||||
* @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;
|
{
|
||||||
return $this;
|
$this->first_name = $first_name;
|
||||||
}
|
return $this;
|
||||||
/**
|
}
|
||||||
* First name of the invoice recipient. 30 characters max.
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
* @deprecated. Instead use getFirstName
|
|
||||||
*/
|
|
||||||
public function getFirst_name() {
|
|
||||||
return $this->first_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Last name of the invoice recipient. 30 characters max.
|
* First name of the invoice recipient. 30 characters max.
|
||||||
*
|
*
|
||||||
* @param string $last_name
|
* @return string
|
||||||
*/
|
* @deprecated. Instead use getFirstName
|
||||||
public function setLastName($last_name) {
|
*/
|
||||||
$this->last_name = $last_name;
|
public function getFirst_name()
|
||||||
return $this;
|
{
|
||||||
}
|
return $this->first_name;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Last name of the invoice recipient. 30 characters max.
|
* Last name of the invoice recipient. 30 characters max.
|
||||||
*
|
*
|
||||||
* @return string
|
* @param string $last_name
|
||||||
*/
|
*/
|
||||||
public function getLastName() {
|
public function setLastName($last_name)
|
||||||
return $this->last_name;
|
{
|
||||||
}
|
$this->last_name = $last_name;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Last name of the invoice recipient. 30 characters max.
|
* Last name of the invoice recipient. 30 characters max.
|
||||||
*
|
*
|
||||||
* @param string $last_name
|
* @return string
|
||||||
* @deprecated. Instead use setLastName
|
*/
|
||||||
*/
|
public function getLastName()
|
||||||
public function setLast_name($last_name) {
|
{
|
||||||
$this->last_name = $last_name;
|
return $this->last_name;
|
||||||
return $this;
|
}
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Last name of the invoice recipient. 30 characters max.
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
* @deprecated. Instead use getLastName
|
|
||||||
*/
|
|
||||||
public function getLast_name() {
|
|
||||||
return $this->last_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Company business name of the invoice recipient. 100 characters max.
|
* Last name of the invoice recipient. 30 characters max.
|
||||||
*
|
*
|
||||||
* @param string $business_name
|
* @param string $last_name
|
||||||
*/
|
* @deprecated. Instead use setLastName
|
||||||
public function setBusinessName($business_name) {
|
*/
|
||||||
$this->business_name = $business_name;
|
public function setLast_name($last_name)
|
||||||
return $this;
|
{
|
||||||
}
|
$this->last_name = $last_name;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Company business name of the invoice recipient. 100 characters max.
|
* Last name of the invoice recipient. 30 characters max.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
* @deprecated. Instead use getLastName
|
||||||
public function getBusinessName() {
|
*/
|
||||||
return $this->business_name;
|
public function getLast_name()
|
||||||
}
|
{
|
||||||
|
return $this->last_name;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Company business name of the invoice recipient. 100 characters max.
|
* Company business name of the invoice recipient. 100 characters max.
|
||||||
*
|
*
|
||||||
* @param string $business_name
|
* @param string $business_name
|
||||||
* @deprecated. Instead use setBusinessName
|
*/
|
||||||
*/
|
public function setBusinessName($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.
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
* @deprecated. Instead use getBusinessName
|
|
||||||
*/
|
|
||||||
public function getBusiness_name() {
|
|
||||||
return $this->business_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Company business name of the invoice recipient. 100 characters max.
|
||||||
*
|
*
|
||||||
* @param PayPal\Api\Phone $phone
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function setPhone($phone) {
|
public function getBusinessName()
|
||||||
$this->phone = $phone;
|
{
|
||||||
return $this;
|
return $this->business_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Company business name of the invoice recipient. 100 characters max.
|
||||||
*
|
*
|
||||||
* @return PayPal\Api\Phone
|
* @param string $business_name
|
||||||
*/
|
* @deprecated. Instead use setBusinessName
|
||||||
public function getPhone() {
|
*/
|
||||||
return $this->phone;
|
public function setBusiness_name($business_name)
|
||||||
}
|
{
|
||||||
|
$this->business_name = $business_name;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Company business name of the invoice recipient. 100 characters max.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
* @deprecated. Instead use getBusinessName
|
||||||
|
*/
|
||||||
|
public function getBusiness_name()
|
||||||
|
{
|
||||||
|
return $this->business_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param PayPal\Api\Phone $phone
|
||||||
|
*/
|
||||||
|
public function setPhone($phone)
|
||||||
|
{
|
||||||
|
$this->phone = $phone;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @return PayPal\Api\Phone
|
||||||
|
*/
|
||||||
|
public function getPhone()
|
||||||
|
{
|
||||||
|
return $this->phone;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Address of the invoice recipient.
|
* Address of the invoice recipient.
|
||||||
*
|
*
|
||||||
* @param PayPal\Api\Address $address
|
* @param PayPal\Api\Address $address
|
||||||
*/
|
*/
|
||||||
public function setAddress($address) {
|
public function setAddress($address)
|
||||||
$this->address = $address;
|
{
|
||||||
return $this;
|
$this->address = $address;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Address of the invoice recipient.
|
* Address of the invoice recipient.
|
||||||
*
|
*
|
||||||
* @return PayPal\Api\Address
|
* @return PayPal\Api\Address
|
||||||
*/
|
*/
|
||||||
public function getAddress() {
|
public function getAddress()
|
||||||
return $this->address;
|
{
|
||||||
}
|
return $this->address;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,85 +4,94 @@ 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) {
|
*/
|
||||||
$this->id = $id;
|
public function setId($id)
|
||||||
return $this;
|
{
|
||||||
}
|
$this->id = $id;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Identifier of the resource.
|
* Identifier of the resource.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getId() {
|
public function getId()
|
||||||
return $this->id;
|
{
|
||||||
}
|
return $this->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Name of the tax. 10 characters max.
|
* Name of the tax. 10 characters max.
|
||||||
*
|
*
|
||||||
* @param string $name
|
* @param string $name
|
||||||
*/
|
*/
|
||||||
public function setName($name) {
|
public function setName($name)
|
||||||
$this->name = $name;
|
{
|
||||||
return $this;
|
$this->name = $name;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Name of the tax. 10 characters max.
|
* Name of the tax. 10 characters max.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getName() {
|
public function getName()
|
||||||
return $this->name;
|
{
|
||||||
}
|
return $this->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rate of the specified tax. Range of 0.001 to 99.999.
|
* Rate of the specified tax. Range of 0.001 to 99.999.
|
||||||
*
|
*
|
||||||
* @param PayPal\Api\number $percent
|
* @param PayPal\Api\number $percent
|
||||||
*/
|
*/
|
||||||
public function setPercent($percent) {
|
public function setPercent($percent)
|
||||||
$this->percent = $percent;
|
{
|
||||||
return $this;
|
$this->percent = $percent;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rate of the specified tax. Range of 0.001 to 99.999.
|
* Rate of the specified tax. Range of 0.001 to 99.999.
|
||||||
*
|
*
|
||||||
* @return PayPal\Api\number
|
* @return PayPal\Api\number
|
||||||
*/
|
*/
|
||||||
public function getPercent() {
|
public function getPercent()
|
||||||
return $this->percent;
|
{
|
||||||
}
|
return $this->percent;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tax in the form of money. Cannot be specified in a request.
|
* Tax in the form of money. Cannot be specified in a request.
|
||||||
*
|
*
|
||||||
* @param PayPal\Api\Currency $amount
|
* @param PayPal\Api\Currency $amount
|
||||||
*/
|
*/
|
||||||
public function setAmount($amount) {
|
public function setAmount($amount)
|
||||||
$this->amount = $amount;
|
{
|
||||||
return $this;
|
$this->amount = $amount;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tax in the form of money. Cannot be specified in a request.
|
* Tax in the form of money. Cannot be specified in a request.
|
||||||
*
|
*
|
||||||
* @return PayPal\Api\Currency
|
* @return PayPal\Api\Currency
|
||||||
*/
|
*/
|
||||||
public function getAmount() {
|
public function getAmount()
|
||||||
return $this->amount;
|
{
|
||||||
}
|
return $this->amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
28
lib/PayPal/Common/PPArrayUtil.php
Normal file
28
lib/PayPal/Common/PPArrayUtil.php
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
148
lib/PayPal/Common/PPModel.php
Normal file
148
lib/PayPal/Common/PPModel.php
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
102
lib/PayPal/Common/PPReflectionUtil.php
Normal file
102
lib/PayPal/Common/PPReflectionUtil.php
Normal 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]);
|
||||||
|
}
|
||||||
|
}
|
||||||
59
lib/PayPal/Common/PPUserAgent.php
Normal file
59
lib/PayPal/Common/PPUserAgent.php
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
163
lib/PayPal/Core/PPConfigManager.php
Normal file
163
lib/PayPal/Core/PPConfigManager.php
Normal 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
19
lib/PayPal/Core/PPConstants.php
Normal file
19
lib/PayPal/Core/PPConstants.php
Normal 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/";
|
||||||
|
}
|
||||||
167
lib/PayPal/Core/PPCredentialManager.php
Normal file
167
lib/PayPal/Core/PPCredentialManager.php
Normal 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
258
lib/PayPal/Core/PPHttpConfig.php
Normal file
258
lib/PayPal/Core/PPHttpConfig.php
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
171
lib/PayPal/Core/PPHttpConnection.php
Normal file
171
lib/PayPal/Core/PPHttpConnection.php
Normal 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
23
lib/PayPal/Core/PPLoggingLevel.php
Normal file
23
lib/PayPal/Core/PPLoggingLevel.php
Normal 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;
|
||||||
|
}
|
||||||
119
lib/PayPal/Core/PPLoggingManager.php
Normal file
119
lib/PayPal/Core/PPLoggingManager.php
Normal 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
23
lib/PayPal/Exception/PPConfigurationException.php
Normal file
23
lib/PayPal/Exception/PPConfigurationException.php
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
68
lib/PayPal/Exception/PPConnectionException.php
Normal file
68
lib/PayPal/Exception/PPConnectionException.php
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
36
lib/PayPal/Exception/PPInvalidCredentialException.php
Normal file
36
lib/PayPal/Exception/PPInvalidCredentialException.php
Normal 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
37
lib/PayPal/Exception/PPMissingCredentialException.php
Normal file
37
lib/PayPal/Exception/PPMissingCredentialException.php
Normal 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
20
lib/PayPal/Handler/IPPHandler.php
Normal file
20
lib/PayPal/Handler/IPPHandler.php
Normal 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);
|
||||||
|
}
|
||||||
@@ -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
|
||||||
|
*
|
||||||
|
* Call level parameters such as request id, credentials etc
|
||||||
|
*
|
||||||
|
* @package PayPal\Rest
|
||||||
*/
|
*/
|
||||||
class ApiContext extends PPApiContext
|
class ApiContext
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* OAuth Credentials to use for this call
|
|
||||||
*
|
|
||||||
* @var \PayPal\Auth\OAuthTokenCredential $credential
|
|
||||||
*/
|
|
||||||
private $credential;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ namespace PayPal\Rest;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface IResource
|
* Interface IResource
|
||||||
|
*
|
||||||
|
* @package PayPal\Rest
|
||||||
*/
|
*/
|
||||||
interface IResource
|
interface IResource
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
78
lib/PayPal/Transport/PPRestCall.php
Normal file
78
lib/PayPal/Transport/PPRestCall.php
Normal 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -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
|
||||||
@@ -25,7 +30,7 @@ v0.7.0
|
|||||||
-----
|
-----
|
||||||
* Added support for Auth and Capture APIs
|
* Added support for Auth and Capture APIs
|
||||||
* Types modified to match the API Spec
|
* Types modified to match the API Spec
|
||||||
* Updated SDK to use namespace supported core library
|
* Updated SDK to use namespace supported core library
|
||||||
|
|
||||||
v0.6.0
|
v0.6.0
|
||||||
-----
|
-----
|
||||||
@@ -34,4 +39,4 @@ v0.6.0
|
|||||||
|
|
||||||
v0.5.0
|
v0.5.0
|
||||||
-----
|
-----
|
||||||
* Initial Release
|
* Initial Release
|
||||||
|
|||||||
@@ -6,13 +6,12 @@
|
|||||||
// 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';
|
||||||
|
|
||||||
|
|
||||||
if(!file_exists($composerAutoload)) {
|
if (!file_exists($composerAutoload)) {
|
||||||
echo "The 'vendor' folder is missing. You must run 'composer update' to resolve application dependencies.\nPlease see the README for more information.\n";
|
echo "The 'vendor' folder is missing. You must run 'composer update' to resolve application dependencies.\nPlease see the README for more information.\n";
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
@@ -32,46 +31,46 @@ $apiContext = getApiContext();
|
|||||||
*
|
*
|
||||||
* @return PayPal\Rest\ApiContext
|
* @return PayPal\Rest\ApiContext
|
||||||
*/
|
*/
|
||||||
function getApiContext() {
|
function getApiContext()
|
||||||
|
{
|
||||||
// ### Api context
|
|
||||||
// Use an ApiContext object to authenticate
|
|
||||||
// API calls. The clientId and clientSecret for the
|
|
||||||
// OAuthTokenCredential class can be retrieved from
|
|
||||||
// developer.paypal.com
|
|
||||||
|
|
||||||
$apiContext = new ApiContext(
|
// ### Api context
|
||||||
new OAuthTokenCredential(
|
// Use an ApiContext object to authenticate
|
||||||
'EBWKjlELKMYqRNQ6sYvFo64FtaRLRR5BdHEESmha49TM',
|
// API calls. The clientId and clientSecret for the
|
||||||
'EO422dn3gQLgDbuwqTjzrFgFtaRLRR5BdHEESmha49TM'
|
// OAuthTokenCredential class can be retrieved from
|
||||||
)
|
// developer.paypal.com
|
||||||
);
|
|
||||||
|
$apiContext = new ApiContext(
|
||||||
|
new OAuthTokenCredential(
|
||||||
|
'EBWKjlELKMYqRNQ6sYvFo64FtaRLRR5BdHEESmha49TM',
|
||||||
|
'EO422dn3gQLgDbuwqTjzrFgFtaRLRR5BdHEESmha49TM'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// #### SDK configuration
|
||||||
|
|
||||||
// #### SDK configuration
|
// Comment this line out and uncomment the PP_CONFIG_PATH
|
||||||
|
// 'define' block if you want to use static file
|
||||||
// Comment this line out and uncomment the PP_CONFIG_PATH
|
// based configuration
|
||||||
// 'define' block if you want to use static file
|
|
||||||
// based configuration
|
|
||||||
|
|
||||||
$apiContext->setConfig(
|
$apiContext->setConfig(
|
||||||
array(
|
array(
|
||||||
'mode' => 'sandbox',
|
'mode' => 'sandbox',
|
||||||
'http.ConnectionTimeOut' => 30,
|
'http.ConnectionTimeOut' => 30,
|
||||||
'log.LogEnabled' => true,
|
'log.LogEnabled' => true,
|
||||||
'log.FileName' => '../PayPal.log',
|
'log.FileName' => '../PayPal.log',
|
||||||
'log.LogLevel' => 'FINE'
|
'log.LogLevel' => 'FINE'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
/*
|
|
||||||
// Register the sdk_config.ini file in current directory
|
|
||||||
// as the configuration source.
|
|
||||||
if(!defined("PP_CONFIG_PATH")) {
|
|
||||||
define("PP_CONFIG_PATH", __DIR__);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
return $apiContext;
|
/*
|
||||||
|
// Register the sdk_config.ini file in current directory
|
||||||
|
// as the configuration source.
|
||||||
|
if(!defined("PP_CONFIG_PATH")) {
|
||||||
|
define("PP_CONFIG_PATH", __DIR__);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
return $apiContext;
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
1
sample/doc/assets/style.css
Normal file
1
sample/doc/assets/style.css
Normal file
File diff suppressed because one or more lines are too long
44
sample/doc/invoice/CancelInvoice.html
Normal file
44
sample/doc/invoice/CancelInvoice.html
Normal 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"><?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>
|
||||||
|
->setSubject(<span class="hljs-string">"Past due"</span>)
|
||||||
|
->setNote(<span class="hljs-string">"Canceling invoice"</span>)
|
||||||
|
->setSendToMerchant(<span class="hljs-keyword">true</span>)
|
||||||
|
->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>->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>->getMessage() . PHP_EOL;
|
||||||
|
var_dump(<span class="hljs-variable">$ex</span>->getData());
|
||||||
|
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</span>);
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="hljs-preprocessor">?></span>
|
||||||
|
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Cancel Invoice</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div>Cancel Invoice:</div>
|
||||||
|
<pre><span class="hljs-preprocessor"><?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$invoice</span>->toJSON(JSON_PRETTY_PRINT); <span class="hljs-preprocessor">?></span></pre>
|
||||||
|
<a href=<span class="hljs-string">'../index.html'</span>>Back</a>
|
||||||
|
</body>
|
||||||
|
</html></div></div></div></div></body></html>
|
||||||
95
sample/doc/invoice/CreateInvoice.html
Normal file
95
sample/doc/invoice/CreateInvoice.html
Normal 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"><?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>
|
||||||
|
->setMerchantInfo(<span class="hljs-keyword">new</span> MerchantInfo())
|
||||||
|
->setBillingInfo(<span class="hljs-keyword">array</span>(<span class="hljs-keyword">new</span> BillingInfo()))
|
||||||
|
->setItems(<span class="hljs-keyword">array</span>(<span class="hljs-keyword">new</span> InvoiceItem()))
|
||||||
|
->setNote(<span class="hljs-string">"Medical Invoice 16 Jul, 2013 PST"</span>)
|
||||||
|
->setPaymentTerm(<span class="hljs-keyword">new</span> PaymentTerm())
|
||||||
|
->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>->getMerchantInfo()
|
||||||
|
->setEmail(<span class="hljs-string">"PPX.DevNet-facilitator@gmail.com"</span>)
|
||||||
|
->setFirstName(<span class="hljs-string">"Dennis"</span>)
|
||||||
|
->setLastName(<span class="hljs-string">"Doctor"</span>)
|
||||||
|
->setbusinessName(<span class="hljs-string">"Medical Professionals, LLC"</span>)
|
||||||
|
->setPhone(<span class="hljs-keyword">new</span> Phone())
|
||||||
|
->setAddress(<span class="hljs-keyword">new</span> Address());
|
||||||
|
|
||||||
|
<span class="hljs-variable">$invoice</span>->getMerchantInfo()->getPhone()
|
||||||
|
->setCountryCode(<span class="hljs-string">"001"</span>)
|
||||||
|
->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>->getMerchantInfo()->getAddress()
|
||||||
|
->setLine1(<span class="hljs-string">"1234 Main St."</span>)
|
||||||
|
->setCity(<span class="hljs-string">"Portland"</span>)
|
||||||
|
->setState(<span class="hljs-string">"OR"</span>)
|
||||||
|
->setPostalCode(<span class="hljs-string">"97217"</span>)
|
||||||
|
->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>->getBillingInfo();
|
||||||
|
<span class="hljs-variable">$billing</span>[<span class="hljs-number">0</span>]
|
||||||
|
->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>->getItems();
|
||||||
|
<span class="hljs-variable">$items</span>[<span class="hljs-number">0</span>]
|
||||||
|
->setName(<span class="hljs-string">"Sutures"</span>)
|
||||||
|
->setQuantity(<span class="hljs-number">100</span>)
|
||||||
|
->setUnitPrice(<span class="hljs-keyword">new</span> Currency());
|
||||||
|
|
||||||
|
<span class="hljs-variable">$items</span>[<span class="hljs-number">0</span>]->getUnitPrice()
|
||||||
|
->setCurrency(<span class="hljs-string">"USD"</span>)
|
||||||
|
->setValue(<span class="hljs-number">5</span>);
|
||||||
|
|
||||||
|
<span class="hljs-variable">$invoice</span>->getPaymentTerm()
|
||||||
|
->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>->getShippingInfo()
|
||||||
|
->setFirstName(<span class="hljs-string">"Sally"</span>)
|
||||||
|
->setLastName(<span class="hljs-string">"Patient"</span>)
|
||||||
|
->setBusinessName(<span class="hljs-string">"Not applicable"</span>)
|
||||||
|
->setPhone(<span class="hljs-keyword">new</span> Phone())
|
||||||
|
->setAddress(<span class="hljs-keyword">new</span> Address());
|
||||||
|
|
||||||
|
<span class="hljs-variable">$invoice</span>->getShippingInfo()->getPhone()
|
||||||
|
->setCountryCode(<span class="hljs-string">"001"</span>)
|
||||||
|
->setNationalNumber(<span class="hljs-string">"5039871234"</span>);
|
||||||
|
|
||||||
|
<span class="hljs-variable">$invoice</span>->getShippingInfo()->getAddress()
|
||||||
|
->setLine1(<span class="hljs-string">"1234 Main St."</span>)
|
||||||
|
->setCity(<span class="hljs-string">"Portland"</span>)
|
||||||
|
->setState(<span class="hljs-string">"OR"</span>)
|
||||||
|
->setPostalCode(<span class="hljs-string">"97217"</span>)
|
||||||
|
->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->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>->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>->getMessage() . PHP_EOL;
|
||||||
|
var_dump(<span class="hljs-variable">$ex</span>->getData());
|
||||||
|
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</span>);
|
||||||
|
}
|
||||||
|
<span class="hljs-preprocessor">?></span>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Invoice Creation</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div>
|
||||||
|
Created Invoice:
|
||||||
|
<span class="hljs-preprocessor"><?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$invoice</span>->getId(); <span class="hljs-preprocessor">?></span>
|
||||||
|
</div>
|
||||||
|
<pre><span class="hljs-preprocessor"><?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$invoice</span>->toJSON(JSON_PRETTY_PRINT); <span class="hljs-preprocessor">?></span></pre>
|
||||||
|
<a href=<span class="hljs-string">'../index.html'</span>>Back</a>
|
||||||
|
</body>
|
||||||
|
</html></div></div></div></div></body></html>
|
||||||
28
sample/doc/invoice/GetInvoice.html
Normal file
28
sample/doc/invoice/GetInvoice.html
Normal 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"><?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>->getMessage() . PHP_EOL;
|
||||||
|
var_dump(<span class="hljs-variable">$ex</span>->getData());
|
||||||
|
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</span>);
|
||||||
|
}
|
||||||
|
<span class="hljs-preprocessor">?></span>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Lookup invoice details</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div>Retrieving Invoice: <span class="hljs-preprocessor"><?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$invoiceId</span>;<span class="hljs-preprocessor">?></span></div>
|
||||||
|
<pre><span class="hljs-preprocessor"><?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$invoice</span>->toJSON(JSON_PRETTY_PRINT); <span class="hljs-preprocessor">?></span></pre>
|
||||||
|
<a href=<span class="hljs-string">'../index.html'</span>>Back</a>
|
||||||
|
</body>
|
||||||
|
</html></div></div></div></div></body></html>
|
||||||
26
sample/doc/invoice/ListInvoice.html
Normal file
26
sample/doc/invoice/ListInvoice.html
Normal 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"><?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>->getMessage() . PHP_EOL;
|
||||||
|
var_dump(<span class="hljs-variable">$ex</span>->getData());
|
||||||
|
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</span>);
|
||||||
|
}
|
||||||
|
<span class="hljs-preprocessor">?></span>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Lookup invoice history</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div>Got invoices </div>
|
||||||
|
<pre><span class="hljs-preprocessor"><?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$invoices</span>->toJSON(JSON_PRETTY_PRINT); <span class="hljs-preprocessor">?></span></pre>
|
||||||
|
<a href=<span class="hljs-string">'../index.html'</span>>Back</a>
|
||||||
|
</body>
|
||||||
|
</html></div></div></div></div></body></html>
|
||||||
43
sample/doc/invoice/RemindInvoice.html
Normal file
43
sample/doc/invoice/RemindInvoice.html
Normal 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"><?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>
|
||||||
|
->setSubject(<span class="hljs-string">"Past due"</span>)
|
||||||
|
->setNote(<span class="hljs-string">"Please pay soon"</span>)
|
||||||
|
->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>->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>->getMessage() . PHP_EOL;
|
||||||
|
var_dump(<span class="hljs-variable">$ex</span>->getData());
|
||||||
|
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</span>);
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="hljs-preprocessor">?></span>
|
||||||
|
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Remind Invoice</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div>Remind Invoice:</div>
|
||||||
|
<pre><span class="hljs-preprocessor"><?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$invoice</span>->toJSON(JSON_PRETTY_PRINT); <span class="hljs-preprocessor">?></span></pre>
|
||||||
|
<a href=<span class="hljs-string">'../index.html'</span>>Back</a>
|
||||||
|
</body>
|
||||||
|
</html></div></div></div></div></body></html>
|
||||||
31
sample/doc/invoice/SendInvoice.html
Normal file
31
sample/doc/invoice/SendInvoice.html
Normal 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"><?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>->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>->getMessage() . PHP_EOL;
|
||||||
|
var_dump(<span class="hljs-variable">$ex</span>->getData());
|
||||||
|
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</span>);
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="hljs-preprocessor">?></span>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Send Invoice</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div>Send Invoice:</div>
|
||||||
|
<pre><span class="hljs-preprocessor"><?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$invoice</span>->toJSON(JSON_PRETTY_PRINT); <span class="hljs-preprocessor">?></span></pre>
|
||||||
|
<a href=<span class="hljs-string">'../index.html'</span>>Back</a>
|
||||||
|
</body>
|
||||||
|
</html></div></div></div></div></body></html>
|
||||||
39
sample/doc/payments/AuthorizationCapture.html
Normal file
39
sample/doc/payments/AuthorizationCapture.html
Normal 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"><?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->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>->setCurrency(<span class="hljs-string">"USD"</span>)
|
||||||
|
->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>->setId(<span class="hljs-variable">$authId</span>)
|
||||||
|
->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>->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>->getMessage() . PHP_EOL;
|
||||||
|
var_dump(<span class="hljs-variable">$ex</span>->getData());
|
||||||
|
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</span>);
|
||||||
|
}
|
||||||
|
<span class="hljs-preprocessor">?></span>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Capturing an authorization</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div>
|
||||||
|
Captured payment <span class="hljs-preprocessor"><?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$getCapture</span>->getParentPayment(); <span class="hljs-preprocessor">?></span>. Capture Id:
|
||||||
|
<span class="hljs-preprocessor"><?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$getCapture</span>->getId();<span class="hljs-preprocessor">?></span>
|
||||||
|
</div>
|
||||||
|
<pre><span class="hljs-preprocessor"><?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$getCapture</span>->toJSON(JSON_PRETTY_PRINT);<span class="hljs-preprocessor">?></span></pre>
|
||||||
|
<a href=<span class="hljs-string">'../index.html'</span>>Back</a>
|
||||||
|
</body>
|
||||||
|
</html></div></div></div></div></body></html>
|
||||||
97
sample/doc/payments/CreatePayment.html
Normal file
97
sample/doc/payments/CreatePayment.html
Normal 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"><?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>->setType(<span class="hljs-string">"visa"</span>)
|
||||||
|
->setNumber(<span class="hljs-string">"4417119669820331"</span>)
|
||||||
|
->setExpireMonth(<span class="hljs-string">"11"</span>)
|
||||||
|
->setExpireYear(<span class="hljs-string">"2019"</span>)
|
||||||
|
->setCvv2(<span class="hljs-string">"012"</span>)
|
||||||
|
->setFirstName(<span class="hljs-string">"Joe"</span>)
|
||||||
|
->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'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>->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 'credit_card' 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>->setPaymentMethod(<span class="hljs-string">"credit_card"</span>)
|
||||||
|
->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>->setName(<span class="hljs-string">'Ground Coffee 40 oz'</span>)
|
||||||
|
->setDescription(<span class="hljs-string">'Ground Coffee 40 oz'</span>)
|
||||||
|
->setCurrency(<span class="hljs-string">'USD'</span>)
|
||||||
|
->setQuantity(<span class="hljs-number">1</span>)
|
||||||
|
->setTax(<span class="hljs-string">'0.30'</span>)
|
||||||
|
->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>->setName(<span class="hljs-string">'Granola bars'</span>)
|
||||||
|
->setDescription(<span class="hljs-string">'Granola Bars with Peanuts'</span>)
|
||||||
|
->setCurrency(<span class="hljs-string">'USD'</span>)
|
||||||
|
->setQuantity(<span class="hljs-number">5</span>)
|
||||||
|
->setTax(<span class="hljs-string">'0.20'</span>)
|
||||||
|
->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>->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>->setShipping(<span class="hljs-string">'1.20'</span>)
|
||||||
|
->setTax(<span class="hljs-string">'1.30'</span>)
|
||||||
|
->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>->setCurrency(<span class="hljs-string">"USD"</span>)
|
||||||
|
->setTotal(<span class="hljs-string">"20.00"</span>)
|
||||||
|
->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>->setAmount(<span class="hljs-variable">$amount</span>)
|
||||||
|
->setItemList(<span class="hljs-variable">$itemList</span>)
|
||||||
|
->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 'sale'</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>->setIntent(<span class="hljs-string">"sale"</span>)
|
||||||
|
->setPayer(<span class="hljs-variable">$payer</span>)
|
||||||
|
->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->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>->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>->getMessage() . PHP_EOL;
|
||||||
|
var_dump(<span class="hljs-variable">$ex</span>->getData());
|
||||||
|
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</span>);
|
||||||
|
}
|
||||||
|
<span class="hljs-preprocessor">?></span>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Direct Credit card payments</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div>
|
||||||
|
Created payment:
|
||||||
|
<span class="hljs-preprocessor"><?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$payment</span>->getId();<span class="hljs-preprocessor">?></span>
|
||||||
|
</div>
|
||||||
|
<pre><span class="hljs-preprocessor"><?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$payment</span>->toJSON(JSON_PRETTY_PRINT);<span class="hljs-preprocessor">?></span></pre>
|
||||||
|
<a href=<span class="hljs-string">'../index.html'</span>>Back</a>
|
||||||
|
</body>
|
||||||
|
</html></div></div></div></div></body></html>
|
||||||
90
sample/doc/payments/CreatePaymentUsingPayPal.html
Normal file
90
sample/doc/payments/CreatePaymentUsingPayPal.html
Normal 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"><?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 'paypal'.</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>->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>->setName(<span class="hljs-string">'Ground Coffee 40 oz'</span>)
|
||||||
|
->setCurrency(<span class="hljs-string">'USD'</span>)
|
||||||
|
->setQuantity(<span class="hljs-number">1</span>)
|
||||||
|
->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>->setName(<span class="hljs-string">'Granola bars'</span>)
|
||||||
|
->setCurrency(<span class="hljs-string">'USD'</span>)
|
||||||
|
->setQuantity(<span class="hljs-number">5</span>)
|
||||||
|
->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>->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>->setShipping(<span class="hljs-string">'1.20'</span>)
|
||||||
|
->setTax(<span class="hljs-string">'1.30'</span>)
|
||||||
|
->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>->setCurrency(<span class="hljs-string">"USD"</span>)
|
||||||
|
->setTotal(<span class="hljs-string">"20.00"</span>)
|
||||||
|
->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>->setAmount(<span class="hljs-variable">$amount</span>)
|
||||||
|
->setItemList(<span class="hljs-variable">$itemList</span>)
|
||||||
|
->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>->setReturnUrl(<span class="hljs-string">"$baseUrl/ExecutePayment.php?success=true"</span>)
|
||||||
|
->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 'sale'</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>->setIntent(<span class="hljs-string">"sale"</span>)
|
||||||
|
->setPayer(<span class="hljs-variable">$payer</span>)
|
||||||
|
->setRedirectUrls(<span class="hljs-variable">$redirectUrls</span>)
|
||||||
|
->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 'create' 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>->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>->getMessage() . PHP_EOL;
|
||||||
|
var_dump(<span class="hljs-variable">$ex</span>->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->getLinks()
|
||||||
|
method</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">foreach</span>(<span class="hljs-variable">$payment</span>->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>->getRel() == <span class="hljs-string">'approval_url'</span>) {
|
||||||
|
<span class="hljs-variable">$redirectUrl</span> = <span class="hljs-variable">$link</span>->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 'complete' 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>->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>
|
||||||
86
sample/doc/payments/CreatePaymentUsingSavedCard.html
Normal file
86
sample/doc/payments/CreatePaymentUsingSavedCard.html
Normal 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"><?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>->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'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>->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 'credit_card'.</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>->setPaymentMethod(<span class="hljs-string">"credit_card"</span>)
|
||||||
|
->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>->setName(<span class="hljs-string">'Ground Coffee 40 oz'</span>)
|
||||||
|
->setCurrency(<span class="hljs-string">'USD'</span>)
|
||||||
|
->setQuantity(<span class="hljs-number">1</span>)
|
||||||
|
->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>->setName(<span class="hljs-string">'Granola bars'</span>)
|
||||||
|
->setCurrency(<span class="hljs-string">'USD'</span>)
|
||||||
|
->setQuantity(<span class="hljs-number">5</span>)
|
||||||
|
->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>->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>->setShipping(<span class="hljs-string">'1.20'</span>)
|
||||||
|
->setTax(<span class="hljs-string">'1.30'</span>)
|
||||||
|
->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>->setCurrency(<span class="hljs-string">"USD"</span>)
|
||||||
|
->setTotal(<span class="hljs-string">"20.00"</span>)
|
||||||
|
->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>->setAmount(<span class="hljs-variable">$amount</span>)
|
||||||
|
->setItemList(<span class="hljs-variable">$itemList</span>)
|
||||||
|
->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'</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>->setIntent(<span class="hljs-string">"sale"</span>)
|
||||||
|
->setPayer(<span class="hljs-variable">$payer</span>)
|
||||||
|
->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 'create' 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>->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>->getMessage() . PHP_EOL;
|
||||||
|
var_dump(<span class="hljs-variable">$ex</span>->getData());
|
||||||
|
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</span>);
|
||||||
|
}
|
||||||
|
<span class="hljs-preprocessor">?></span>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Saved Credit card payments</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div>
|
||||||
|
Created payment:
|
||||||
|
<span class="hljs-preprocessor"><?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$payment</span>->getId();<span class="hljs-preprocessor">?></span>
|
||||||
|
</div>
|
||||||
|
<pre><span class="hljs-preprocessor"><?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$payment</span>->toJSON(JSON_PRETTY_PRINT);<span class="hljs-preprocessor">?></span></pre>
|
||||||
|
<a href=<span class="hljs-string">'../index.html'</span>>Back</a>
|
||||||
|
</body>
|
||||||
|
</html></div></div></div></div></body></html>
|
||||||
31
sample/doc/payments/ExecutePayment.html
Normal file
31
sample/doc/payments/ExecutePayment.html
Normal 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"><?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 '/v1/payments/payment/<payment-id>/execute'.</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>]) && <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>->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>->execute(<span class="hljs-variable">$execution</span>, <span class="hljs-variable">$apiContext</span>);
|
||||||
|
|
||||||
|
<span class="hljs-keyword">echo</span> <span class="hljs-string">"<html><body><pre>"</span>;
|
||||||
|
<span class="hljs-keyword">echo</span> <span class="hljs-variable">$result</span>->toJSON(JSON_PRETTY_PRINT);
|
||||||
|
<span class="hljs-keyword">echo</span> <span class="hljs-string">"</pre><a href='../index.html'>Back</a></body></html>"</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>
|
||||||
31
sample/doc/payments/GetAuthorization.html
Normal file
31
sample/doc/payments/GetAuthorization.html
Normal 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"><?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/<$authorizationId></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>->getMessage() . PHP_EOL;
|
||||||
|
var_dump(<span class="hljs-variable">$ex</span>->getData());
|
||||||
|
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</span>);
|
||||||
|
}
|
||||||
|
<span class="hljs-preprocessor">?></span>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Lookup an authorization</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div>
|
||||||
|
Retrieved Authorization:
|
||||||
|
<span class="hljs-preprocessor"><?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$authorization</span>->getId();<span class="hljs-preprocessor">?></span>
|
||||||
|
</div>
|
||||||
|
<pre><span class="hljs-preprocessor"><?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$authorization</span>->toJSON(JSON_PRETTY_PRINT);<span class="hljs-preprocessor">?></span></pre>
|
||||||
|
<a href=<span class="hljs-string">'../index.html'</span>>Back</a>
|
||||||
|
</body>
|
||||||
|
</html></div></div></div></div></body></html>
|
||||||
47
sample/doc/payments/GetCapture.html
Normal file
47
sample/doc/payments/GetCapture.html
Normal 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"><?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/<$captureId></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>->setCurrency(<span class="hljs-string">"USD"</span>)
|
||||||
|
->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>->setId(<span class="hljs-variable">$authId</span>)
|
||||||
|
->setAmount(<span class="hljs-variable">$amt</span>);
|
||||||
|
|
||||||
|
<span class="hljs-variable">$capture</span> = <span class="hljs-variable">$authorization</span>->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>->getMessage() . PHP_EOL;
|
||||||
|
var_dump(<span class="hljs-variable">$ex</span>->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>->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>->getMessage() . PHP_EOL;
|
||||||
|
var_dump(<span class="hljs-variable">$ex</span>->getData());
|
||||||
|
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</span>);
|
||||||
|
}
|
||||||
|
<span class="hljs-preprocessor">?></span>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Lookup a capture</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div>
|
||||||
|
Capture Id:
|
||||||
|
<span class="hljs-preprocessor"><?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$capture</span>->getId();<span class="hljs-preprocessor">?></span>
|
||||||
|
</div>
|
||||||
|
<pre><span class="hljs-preprocessor"><?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$capture</span>->toJSON(JSON_PRETTY_PRINT);<span class="hljs-preprocessor">?></span></pre>
|
||||||
|
<a href=<span class="hljs-string">'../index.html'</span>>Back</a>
|
||||||
|
</body>
|
||||||
|
</html></div></div></div></div></body></html>
|
||||||
33
sample/doc/payments/GetPayment.html
Normal file
33
sample/doc/payments/GetPayment.html
Normal 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"><?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'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>->getMessage() . PHP_EOL;
|
||||||
|
var_dump(<span class="hljs-variable">$ex</span>->getData());
|
||||||
|
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</span>);
|
||||||
|
}
|
||||||
|
<span class="hljs-preprocessor">?></span>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Lookup a payment</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div>Retrieving Payment ID: <span class="hljs-preprocessor"><?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$paymentId</span>;<span class="hljs-preprocessor">?></span></div>
|
||||||
|
<pre><span class="hljs-preprocessor"><?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$payment</span>->toJSON(JSON_PRETTY_PRINT);<span class="hljs-preprocessor">?></span></pre>
|
||||||
|
<a href=<span class="hljs-string">'../index.html'</span>>Back</a>
|
||||||
|
</body>
|
||||||
|
</html></div></div></div></div></body></html>
|
||||||
32
sample/doc/payments/ListPayments.html
Normal file
32
sample/doc/payments/ListPayments.html
Normal 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"><?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'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> => <span class="hljs-number">10</span>, <span class="hljs-string">'start_index'</span> => <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>->getMessage() . PHP_EOL;
|
||||||
|
var_dump(<span class="hljs-variable">$ex</span>->getData());
|
||||||
|
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</span>);
|
||||||
|
}
|
||||||
|
<span class="hljs-preprocessor">?></span>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Lookup payment history</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div>Got <span class="hljs-preprocessor"><?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$payments</span>->getCount(); <span class="hljs-preprocessor">?></span> matching payments </div>
|
||||||
|
<pre><span class="hljs-preprocessor"><?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$payments</span>->toJSON(JSON_PRETTY_PRINT);<span class="hljs-preprocessor">?></span></pre>
|
||||||
|
<a href=<span class="hljs-string">'../index.html'</span>>Back</a>
|
||||||
|
</body>
|
||||||
|
</html></div></div></div></div></body></html>
|
||||||
37
sample/doc/payments/Reauthorization.html
Normal file
37
sample/doc/payments/Reauthorization.html
Normal 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"><?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>->setCurrency(<span class="hljs-string">"USD"</span>);
|
||||||
|
<span class="hljs-variable">$amount</span>->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>->setAmount(<span class="hljs-variable">$amount</span>);
|
||||||
|
<span class="hljs-variable">$reauthorization</span> = <span class="hljs-variable">$authorization</span>->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>->getMessage() . PHP_EOL;
|
||||||
|
var_dump(<span class="hljs-variable">$ex</span>->getData());
|
||||||
|
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</span>);
|
||||||
|
}
|
||||||
|
<span class="hljs-preprocessor">?></span>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Reauthorize a payment</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div>
|
||||||
|
Reauthorization Id:
|
||||||
|
<span class="hljs-preprocessor"><?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$reauthorization</span>->getId();<span class="hljs-preprocessor">?></span>
|
||||||
|
</div>
|
||||||
|
<pre>
|
||||||
|
<span class="hljs-preprocessor"><?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$reauthorization</span>->toJSON(JSON_PRETTY_PRINT);<span class="hljs-preprocessor">?></span>
|
||||||
|
</pre>
|
||||||
|
<a href=<span class="hljs-string">'../index.html'</span>>Back</a>
|
||||||
|
</body>
|
||||||
|
</html></div></div></div></div></body></html>
|
||||||
52
sample/doc/payments/RefundCapture.html
Normal file
52
sample/doc/payments/RefundCapture.html
Normal 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"><?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>->setCurrency(<span class="hljs-string">"USD"</span>)
|
||||||
|
->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>->setAmount(<span class="hljs-variable">$amt</span>);
|
||||||
|
|
||||||
|
<span class="hljs-variable">$capture</span> = <span class="hljs-variable">$authorization</span>->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>->getMessage() . PHP_EOL;
|
||||||
|
var_dump(<span class="hljs-variable">$ex</span>->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>->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>->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>->getMessage() . PHP_EOL;
|
||||||
|
var_dump(<span class="hljs-variable">$ex</span>->getData());
|
||||||
|
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</span>);
|
||||||
|
}
|
||||||
|
<span class="hljs-preprocessor">?></span>
|
||||||
|
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Refund a captured payment</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div>Refund Capture:</div>
|
||||||
|
<pre><span class="hljs-preprocessor"><?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$captureRefund</span>->toJSON(JSON_PRETTY_PRINT);<span class="hljs-preprocessor">?></span></pre>
|
||||||
|
<a href=<span class="hljs-string">'../index.html'</span>>Back</a>
|
||||||
|
</body>
|
||||||
|
</html></div></div></div></div></body></html>
|
||||||
28
sample/doc/payments/VoidAuthorization.html
Normal file
28
sample/doc/payments/VoidAuthorization.html
Normal 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"><?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/<{authorizationid}>/void"</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->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>->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>->getMessage() . PHP_EOL;
|
||||||
|
var_dump(<span class="hljs-variable">$ex</span>->getData());
|
||||||
|
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</span>);
|
||||||
|
}
|
||||||
|
<span class="hljs-preprocessor">?></span>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Void an authorization</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div>
|
||||||
|
Voided authorization
|
||||||
|
</div>
|
||||||
|
<pre><span class="hljs-preprocessor"><?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$voidedAuth</span>->toJSON(JSON_PRETTY_PRINT);<span class="hljs-preprocessor">?></span></pre>
|
||||||
|
<a href=<span class="hljs-string">'../index.html'</span>>Back</a>
|
||||||
|
</body>
|
||||||
|
</html></div></div></div></div></body></html>
|
||||||
28
sample/doc/sale/GetSale.html
Normal file
28
sample/doc/sale/GetSale.html
Normal 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"><?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>->getMessage() . PHP_EOL;
|
||||||
|
var_dump(<span class="hljs-variable">$ex</span>->getData());
|
||||||
|
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</span>);
|
||||||
|
}
|
||||||
|
<span class="hljs-preprocessor">?></span>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Lookup a sale</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div>Retrieving sale id: <span class="hljs-preprocessor"><?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$saleId</span>;<span class="hljs-preprocessor">?></span></div>
|
||||||
|
<pre><span class="hljs-preprocessor"><?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$sale</span>->toJSON(JSON_PRETTY_PRINT)<span class="hljs-preprocessor">?></span></pre>
|
||||||
|
<a href=<span class="hljs-string">'../index.html'</span>>Back</a>
|
||||||
|
</body>
|
||||||
|
</html></div></div></div></div></body></html>
|
||||||
38
sample/doc/sale/RefundSale.html
Normal file
38
sample/doc/sale/RefundSale.html
Normal 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"><?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->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>->setCurrency(<span class="hljs-string">'USD'</span>)
|
||||||
|
->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>->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>->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>->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>->getMessage() . PHP_EOL;
|
||||||
|
var_dump(<span class="hljs-variable">$ex</span>->getData());
|
||||||
|
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</span>);
|
||||||
|
}
|
||||||
|
<span class="hljs-preprocessor">?></span>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Refund a sale</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div>Refunding sale id: <span class="hljs-preprocessor"><?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$saleId</span>;<span class="hljs-preprocessor">?></span></div>
|
||||||
|
<pre><span class="hljs-preprocessor"><?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$sale</span>->toJSON(JSON_PRETTY_PRINT);<span class="hljs-preprocessor">?></span></pre>
|
||||||
|
<a href=<span class="hljs-string">'../index.html'</span>>Back</a>
|
||||||
|
</body>
|
||||||
|
</html></div></div></div></div></body></html>
|
||||||
37
sample/doc/vault/CreateCreditCard.html
Normal file
37
sample/doc/vault/CreateCreditCard.html
Normal 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"><?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>->setType(<span class="hljs-string">"visa"</span>)
|
||||||
|
->setNumber(<span class="hljs-string">"4417119669820331"</span>)
|
||||||
|
->setExpireMonth(<span class="hljs-string">"11"</span>)
|
||||||
|
->setExpireYear(<span class="hljs-string">"2019"</span>)
|
||||||
|
->setCvv2(<span class="hljs-string">"012"</span>)
|
||||||
|
->setFirstName(<span class="hljs-string">"Joe"</span>)
|
||||||
|
->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 'id' 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>->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>->getMessage() . PHP_EOL;
|
||||||
|
var_dump(<span class="hljs-variable">$ex</span>->getData());
|
||||||
|
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</span>);
|
||||||
|
}
|
||||||
|
<span class="hljs-preprocessor">?></span>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Save a credit card</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div>Saved a <span class="hljs-keyword">new</span> credit card with id: <span class="hljs-preprocessor"><?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$card</span>->getId();<span class="hljs-preprocessor">?></span></div>
|
||||||
|
<pre><span class="hljs-preprocessor"><?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$card</span>->toJSON(JSON_PRETTY_PRINT);<span class="hljs-preprocessor">?></span></pre>
|
||||||
|
<a href=<span class="hljs-string">'../index.html'</span>>Back</a>
|
||||||
|
</body>
|
||||||
|
</html></div></div></div></div></body></html>
|
||||||
45
sample/doc/vault/DeleteCreditCard.html
Normal file
45
sample/doc/vault/DeleteCreditCard.html
Normal 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"><?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>->setType(<span class="hljs-string">"visa"</span>)
|
||||||
|
->setNumber(<span class="hljs-string">"4417119669820331"</span>)
|
||||||
|
->setExpireMonth(<span class="hljs-string">"11"</span>)
|
||||||
|
->setExpireYear(<span class="hljs-string">"2019"</span>)
|
||||||
|
->setCvv2(<span class="hljs-string">"012"</span>)
|
||||||
|
->setFirstName(<span class="hljs-string">"Joe"</span>)
|
||||||
|
->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 'id' 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>->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>->getMessage() . PHP_EOL;
|
||||||
|
var_dump(<span class="hljs-variable">$ex</span>->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>->getId(), <span class="hljs-variable">$apiContext</span>);
|
||||||
|
<span class="hljs-variable">$creditCard</span>->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>->getMessage() . PHP_EOL;
|
||||||
|
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</span>);
|
||||||
|
}
|
||||||
|
<span class="hljs-preprocessor">?></span>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Delete a saved credit card</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p> Credit Card deleted Successfully</p>
|
||||||
|
<a href=<span class="hljs-string">'../index.html'</span>>Back</a>
|
||||||
|
</body>
|
||||||
|
</html></div></div></div></div></body></html>
|
||||||
27
sample/doc/vault/GetCreditCard.html
Normal file
27
sample/doc/vault/GetCreditCard.html
Normal 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"><?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: '/v1/vault/credit-card'
|
||||||
|
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->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>->getMessage() . PHP_EOL;
|
||||||
|
var_dump(<span class="hljs-variable">$ex</span>->getData());
|
||||||
|
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</span>);
|
||||||
|
}
|
||||||
|
<span class="hljs-preprocessor">?></span>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Lookup a saved credit card</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div>Retrieving saved credit card: <span class="hljs-preprocessor"><?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$cardId</span>;<span class="hljs-preprocessor">?></span></div>
|
||||||
|
<pre><span class="hljs-preprocessor"><?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$card</span>->toJSON(JSON_PRETTY_PRINT);<span class="hljs-preprocessor">?></span></pre>
|
||||||
|
<a href=<span class="hljs-string">'../index.html'</span>>Back</a>
|
||||||
|
</body>
|
||||||
|
</html></div></div></div></div></body></html>
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 173 B |
BIN
sample/images/favicon.ico
Normal file
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
BIN
sample/images/pp_v_rgb.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 38 KiB |
@@ -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">
|
||||||
<title>PayPal REST API Samples</title>
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<style>
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
.imagelink {
|
<meta name="description" content="">
|
||||||
padding: 5px 0px 5px 28px;
|
<meta name="author" content="">
|
||||||
}
|
<link rel="icon" href="images/favicon.ico">
|
||||||
.execute {
|
|
||||||
background: url('images/play_button.png') no-repeat left top;
|
<title>PayPal REST API Samples</title>
|
||||||
}
|
|
||||||
.source {
|
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
|
||||||
background: url('images/edt-format-source-button.png') no-repeat left top;
|
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
|
||||||
}
|
<style>
|
||||||
.header {
|
body {
|
||||||
font-weight: bold;
|
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||||
}
|
-webkit-font-smoothing: antialiased;
|
||||||
.header td {
|
}
|
||||||
padding: 10px 0px 10px 0px;
|
</style>
|
||||||
}
|
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
|
||||||
</style>
|
<!--[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>
|
||||||
|
|||||||
57
sample/invoice/CancelInvoice.php
Normal file
57
sample/invoice/CancelInvoice.php
Normal 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>
|
||||||
119
sample/invoice/CreateInvoice.php
Normal file
119
sample/invoice/CreateInvoice.php
Normal 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>
|
||||||
35
sample/invoice/GetInvoice.php
Normal file
35
sample/invoice/GetInvoice.php
Normal 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>
|
||||||
32
sample/invoice/ListInvoice.php
Normal file
32
sample/invoice/ListInvoice.php
Normal 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>
|
||||||
55
sample/invoice/RemindInvoice.php
Normal file
55
sample/invoice/RemindInvoice.php
Normal 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>
|
||||||
40
sample/invoice/SendInvoice.php
Normal file
40
sample/invoice/SendInvoice.php
Normal 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>
|
||||||
@@ -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>
|
|
||||||
@@ -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>
|
|
||||||
@@ -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>
|
|
||||||
@@ -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>
|
|
||||||
@@ -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>
|
|
||||||
@@ -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>
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user