forked from LiveCarta/PayPal-PHP-SDK
Merge pull request #1 from DevTools/authcapture
Updated stubs for Auth and Capture APIs
This commit is contained in:
@@ -15,7 +15,7 @@
|
|||||||
"php": ">=5.3.0",
|
"php": ">=5.3.0",
|
||||||
"ext-curl": "*",
|
"ext-curl": "*",
|
||||||
"ext-json": "*",
|
"ext-json": "*",
|
||||||
"paypal/sdk-core-php": "1.4.*"
|
"paypal/sdk-core-php": "2.4.*"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"phpunit/phpunit": "3.7.*"
|
"phpunit/phpunit": "3.7.*"
|
||||||
|
|||||||
@@ -1,16 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace PayPal\Api;
|
namespace PayPal\Api;
|
||||||
|
|
||||||
|
use PayPal\Common\PPModel;
|
||||||
|
|
||||||
class Address extends \PPModel {
|
class Address extends PPModel {
|
||||||
/**
|
/**
|
||||||
* Line 1 of the Address (eg. number, street, etc).
|
* Line 1 of the Address (eg. number, street, etc).
|
||||||
* @param string $line1
|
* @param string $line1
|
||||||
*/
|
*/
|
||||||
public function setLine1($line1) {
|
public function setLine1($line1) {
|
||||||
$this->line1 = $line1;
|
$this->line1 = $line1;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Line 1 of the Address (eg. number, street, etc).
|
* Line 1 of the Address (eg. number, street, etc).
|
||||||
* @return string
|
* @return string
|
||||||
@@ -18,15 +20,17 @@ class Address extends \PPModel {
|
|||||||
public function getLine1() {
|
public function getLine1() {
|
||||||
return $this->line1;
|
return $this->line1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Optional line 2 of the Address (eg. suite, apt #, etc.).
|
* Optional line 2 of the Address (eg. suite, apt #, etc.).
|
||||||
* @param string $line2
|
* @param string $line2
|
||||||
*/
|
*/
|
||||||
public function setLine2($line2) {
|
public function setLine2($line2) {
|
||||||
$this->line2 = $line2;
|
$this->line2 = $line2;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Optional line 2 of the Address (eg. suite, apt #, etc.).
|
* Optional line 2 of the Address (eg. suite, apt #, etc.).
|
||||||
* @return string
|
* @return string
|
||||||
@@ -34,15 +38,17 @@ class Address extends \PPModel {
|
|||||||
public function getLine2() {
|
public function getLine2() {
|
||||||
return $this->line2;
|
return $this->line2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* City name.
|
* City name.
|
||||||
* @param string $city
|
* @param string $city
|
||||||
*/
|
*/
|
||||||
public function setCity($city) {
|
public function setCity($city) {
|
||||||
$this->city = $city;
|
$this->city = $city;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* City name.
|
* City name.
|
||||||
* @return string
|
* @return string
|
||||||
@@ -50,15 +56,17 @@ class Address extends \PPModel {
|
|||||||
public function getCity() {
|
public function getCity() {
|
||||||
return $this->city;
|
return $this->city;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 2 letter country code.
|
* 2 letter country code.
|
||||||
* @param string $country_code
|
* @param string $country_code
|
||||||
*/
|
*/
|
||||||
public function setCountryCode($country_code) {
|
public function setCountryCode($country_code) {
|
||||||
$this->country_code = $country_code;
|
$this->country_code = $country_code;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 2 letter country code.
|
* 2 letter country code.
|
||||||
* @return string
|
* @return string
|
||||||
@@ -66,15 +74,34 @@ class Address extends \PPModel {
|
|||||||
public function getCountryCode() {
|
public function getCountryCode() {
|
||||||
return $this->country_code;
|
return $this->country_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 2 letter country code.
|
||||||
|
* @param string $country_code
|
||||||
|
* @deprecated. Instead use setCountryCode
|
||||||
|
*/
|
||||||
|
public function setCountry_code($country_code) {
|
||||||
|
$this->country_code = $country_code;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 2 letter country code.
|
||||||
|
* @return string
|
||||||
|
* @deprecated. Instead use getCountryCode
|
||||||
|
*/
|
||||||
|
public function getCountry_code() {
|
||||||
|
return $this->country_code;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Zip code or equivalent is usually required for countries that have them. For list of countries that do not have postal codes please refer to http://en.wikipedia.org/wiki/Postal_code.
|
* Zip code or equivalent is usually required for countries that have them. For list of countries that do not have postal codes please refer to http://en.wikipedia.org/wiki/Postal_code.
|
||||||
* @param string $postal_code
|
* @param string $postal_code
|
||||||
*/
|
*/
|
||||||
public function setPostalCode($postal_code) {
|
public function setPostalCode($postal_code) {
|
||||||
$this->postal_code = $postal_code;
|
$this->postal_code = $postal_code;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Zip code or equivalent is usually required for countries that have them. For list of countries that do not have postal codes please refer to http://en.wikipedia.org/wiki/Postal_code.
|
* Zip code or equivalent is usually required for countries that have them. For list of countries that do not have postal codes please refer to http://en.wikipedia.org/wiki/Postal_code.
|
||||||
* @return string
|
* @return string
|
||||||
@@ -82,15 +109,34 @@ class Address extends \PPModel {
|
|||||||
public function getPostalCode() {
|
public function getPostalCode() {
|
||||||
return $this->postal_code;
|
return $this->postal_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Zip code or equivalent is usually required for countries that have them. For list of countries that do not have postal codes please refer to http://en.wikipedia.org/wiki/Postal_code.
|
||||||
|
* @param string $postal_code
|
||||||
|
* @deprecated. Instead use setPostalCode
|
||||||
|
*/
|
||||||
|
public function setPostal_code($postal_code) {
|
||||||
|
$this->postal_code = $postal_code;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Zip code or equivalent is usually required for countries that have them. For list of countries that do not have postal codes please refer to http://en.wikipedia.org/wiki/Postal_code.
|
||||||
|
* @return string
|
||||||
|
* @deprecated. Instead use getPostalCode
|
||||||
|
*/
|
||||||
|
public function getPostal_code() {
|
||||||
|
return $this->postal_code;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 2 letter code for US states, and the equivalent for other countries.
|
* 2 letter code for US states, and the equivalent for other countries.
|
||||||
* @param string $state
|
* @param string $state
|
||||||
*/
|
*/
|
||||||
public function setState($state) {
|
public function setState($state) {
|
||||||
$this->state = $state;
|
$this->state = $state;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 2 letter code for US states, and the equivalent for other countries.
|
* 2 letter code for US states, and the equivalent for other countries.
|
||||||
* @return string
|
* @return string
|
||||||
@@ -98,15 +144,17 @@ class Address extends \PPModel {
|
|||||||
public function getState() {
|
public function getState() {
|
||||||
return $this->state;
|
return $this->state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Phone number in E.123 format.
|
* Phone number in E.123 format.
|
||||||
* @param string $phone
|
* @param string $phone
|
||||||
*/
|
*/
|
||||||
public function setPhone($phone) {
|
public function setPhone($phone) {
|
||||||
$this->phone = $phone;
|
$this->phone = $phone;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Phone number in E.123 format.
|
* Phone number in E.123 format.
|
||||||
* @return string
|
* @return string
|
||||||
@@ -114,5 +162,6 @@ class Address extends \PPModel {
|
|||||||
public function getPhone() {
|
public function getPhone() {
|
||||||
return $this->phone;
|
return $this->phone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace PayPal\Api;
|
namespace PayPal\Api;
|
||||||
|
|
||||||
|
use PayPal\Common\PPModel;
|
||||||
|
|
||||||
class Amount extends \PPModel {
|
class Amount extends PPModel {
|
||||||
/**
|
/**
|
||||||
* 3 letter currency code
|
* 3 letter currency code
|
||||||
* @param string $currency
|
* @param string $currency
|
||||||
*/
|
*/
|
||||||
public function setCurrency($currency) {
|
public function setCurrency($currency) {
|
||||||
$this->currency = $currency;
|
$this->currency = $currency;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 3 letter currency code
|
* 3 letter currency code
|
||||||
* @return string
|
* @return string
|
||||||
@@ -18,15 +20,17 @@ class Amount extends \PPModel {
|
|||||||
public function getCurrency() {
|
public function getCurrency() {
|
||||||
return $this->currency;
|
return $this->currency;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Total amount charged from the Payer account (or card) to Payee. In case of a refund, this is the refunded amount to the original Payer from Payee account.
|
* Total amount charged from the Payer account (or card) to Payee. In case of a refund, this is the refunded amount to the original Payer from Payee account.
|
||||||
* @param string $total
|
* @param string $total
|
||||||
*/
|
*/
|
||||||
public function setTotal($total) {
|
public function setTotal($total) {
|
||||||
$this->total = $total;
|
$this->total = $total;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Total amount charged from the Payer account (or card) to Payee. In case of a refund, this is the refunded amount to the original Payer from Payee account.
|
* Total amount charged from the Payer account (or card) to Payee. In case of a refund, this is the refunded amount to the original Payer from Payee account.
|
||||||
* @return string
|
* @return string
|
||||||
@@ -34,15 +38,17 @@ class Amount extends \PPModel {
|
|||||||
public function getTotal() {
|
public function getTotal() {
|
||||||
return $this->total;
|
return $this->total;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Additional details of the payment amount.
|
* Additional details of the payment amount.
|
||||||
* @param PayPal\Api\Details $details
|
* @param PayPal\Api\Details $details
|
||||||
*/
|
*/
|
||||||
public function setDetails($details) {
|
public function setDetails($details) {
|
||||||
$this->details = $details;
|
$this->details = $details;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Additional details of the payment amount.
|
* Additional details of the payment amount.
|
||||||
* @return PayPal\Api\Details
|
* @return PayPal\Api\Details
|
||||||
@@ -50,5 +56,6 @@ class Amount extends \PPModel {
|
|||||||
public function getDetails() {
|
public function getDetails() {
|
||||||
return $this->details;
|
return $this->details;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,30 +1,35 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace PayPal\Api;
|
namespace PayPal\Api;
|
||||||
|
|
||||||
|
use PayPal\Common\PPModel;
|
||||||
use PayPal\Rest\IResource;
|
use PayPal\Rest\IResource;
|
||||||
use PayPal\Rest\Call;
|
use PayPal\Rest\Call;
|
||||||
use PayPal\Rest\ApiContext;
|
use PayPal\Rest\ApiContext;
|
||||||
|
use PayPal\Api\Authorization;
|
||||||
|
use PayPal\Api\Capture;
|
||||||
|
use PayPal\Transport\PPRestCall;
|
||||||
|
|
||||||
|
class Authorization extends PPModel implements IResource {
|
||||||
|
|
||||||
class Authorization extends \PPModel implements IResource {
|
|
||||||
|
|
||||||
private static $credential;
|
private static $credential;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @deprected. Pass ApiContext to create/get methods instead
|
* @deprecated. Pass ApiContext to create/get methods instead
|
||||||
*/
|
*/
|
||||||
public static function setCredential($credential) {
|
public static function setCredential($credential) {
|
||||||
self::$credential = $credential;
|
self::$credential = $credential;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Identifier of the authorization transaction.
|
* Identifier of the authorization transaction.
|
||||||
* @param string $id
|
* @param string $id
|
||||||
*/
|
*/
|
||||||
public function setId($id) {
|
public function setId($id) {
|
||||||
$this->id = $id;
|
$this->id = $id;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Identifier of the authorization transaction.
|
* Identifier of the authorization transaction.
|
||||||
* @return string
|
* @return string
|
||||||
@@ -32,15 +37,17 @@ class Authorization extends \PPModel implements IResource {
|
|||||||
public function getId() {
|
public function getId() {
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Time the resource was created.
|
* Time the resource was created.
|
||||||
* @param string $create_time
|
* @param string $create_time
|
||||||
*/
|
*/
|
||||||
public function setCreateTime($create_time) {
|
public function setCreateTime($create_time) {
|
||||||
$this->create_time = $create_time;
|
$this->create_time = $create_time;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Time the resource was created.
|
* Time the resource was created.
|
||||||
* @return string
|
* @return string
|
||||||
@@ -48,15 +55,34 @@ class Authorization extends \PPModel implements IResource {
|
|||||||
public function getCreateTime() {
|
public function getCreateTime() {
|
||||||
return $this->create_time;
|
return $this->create_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Time the resource was created.
|
||||||
|
* @param string $create_time
|
||||||
|
* @deprecated. Instead use setCreateTime
|
||||||
|
*/
|
||||||
|
public function setCreate_time($create_time) {
|
||||||
|
$this->create_time = $create_time;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Time the resource was created.
|
||||||
|
* @return string
|
||||||
|
* @deprecated. Instead use getCreateTime
|
||||||
|
*/
|
||||||
|
public function getCreate_time() {
|
||||||
|
return $this->create_time;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Time the resource was last updated.
|
* Time the resource was last updated.
|
||||||
* @param string $update_time
|
* @param string $update_time
|
||||||
*/
|
*/
|
||||||
public function setUpdateTime($update_time) {
|
public function setUpdateTime($update_time) {
|
||||||
$this->update_time = $update_time;
|
$this->update_time = $update_time;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Time the resource was last updated.
|
* Time the resource was last updated.
|
||||||
* @return string
|
* @return string
|
||||||
@@ -64,15 +90,34 @@ class Authorization extends \PPModel implements IResource {
|
|||||||
public function getUpdateTime() {
|
public function getUpdateTime() {
|
||||||
return $this->update_time;
|
return $this->update_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Time the resource was last updated.
|
||||||
|
* @param string $update_time
|
||||||
|
* @deprecated. Instead use setUpdateTime
|
||||||
|
*/
|
||||||
|
public function setUpdate_time($update_time) {
|
||||||
|
$this->update_time = $update_time;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Time the resource was last updated.
|
||||||
|
* @return string
|
||||||
|
* @deprecated. Instead use getUpdateTime
|
||||||
|
*/
|
||||||
|
public function getUpdate_time() {
|
||||||
|
return $this->update_time;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Amount being authorized for.
|
* Amount being authorized for.
|
||||||
* @param PayPal\Api\Amount $amount
|
* @param PayPal\Api\Amount $amount
|
||||||
*/
|
*/
|
||||||
public function setAmount($amount) {
|
public function setAmount($amount) {
|
||||||
$this->amount = $amount;
|
$this->amount = $amount;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Amount being authorized for.
|
* Amount being authorized for.
|
||||||
* @return PayPal\Api\Amount
|
* @return PayPal\Api\Amount
|
||||||
@@ -80,15 +125,17 @@ class Authorization extends \PPModel implements IResource {
|
|||||||
public function getAmount() {
|
public function getAmount() {
|
||||||
return $this->amount;
|
return $this->amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* State of the authorization transaction.
|
* State of the authorization transaction.
|
||||||
* @param string $state
|
* @param string $state
|
||||||
*/
|
*/
|
||||||
public function setState($state) {
|
public function setState($state) {
|
||||||
$this->state = $state;
|
$this->state = $state;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* State of the authorization transaction.
|
* State of the authorization transaction.
|
||||||
* @return string
|
* @return string
|
||||||
@@ -96,15 +143,17 @@ class Authorization extends \PPModel implements IResource {
|
|||||||
public function getState() {
|
public function getState() {
|
||||||
return $this->state;
|
return $this->state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ID of the Payment resource that this transaction is based on.
|
* ID of the Payment resource that this transaction is based on.
|
||||||
* @param string $parent_payment
|
* @param string $parent_payment
|
||||||
*/
|
*/
|
||||||
public function setParentPayment($parent_payment) {
|
public function setParentPayment($parent_payment) {
|
||||||
$this->parent_payment = $parent_payment;
|
$this->parent_payment = $parent_payment;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ID of the Payment resource that this transaction is based on.
|
* ID of the Payment resource that this transaction is based on.
|
||||||
* @return string
|
* @return string
|
||||||
@@ -112,15 +161,34 @@ class Authorization extends \PPModel implements IResource {
|
|||||||
public function getParentPayment() {
|
public function getParentPayment() {
|
||||||
return $this->parent_payment;
|
return $this->parent_payment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ID of the Payment resource that this transaction is based on.
|
||||||
|
* @param string $parent_payment
|
||||||
|
* @deprecated. Instead use setParentPayment
|
||||||
|
*/
|
||||||
|
public function setParent_payment($parent_payment) {
|
||||||
|
$this->parent_payment = $parent_payment;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* ID of the Payment resource that this transaction is based on.
|
||||||
|
* @return string
|
||||||
|
* @deprecated. Instead use getParentPayment
|
||||||
|
*/
|
||||||
|
public function getParent_payment() {
|
||||||
|
return $this->parent_payment;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date/Time until which funds may be captured against this resource.
|
* Date/Time until which funds may be captured against this resource.
|
||||||
* @param string $valid_until
|
* @param string $valid_until
|
||||||
*/
|
*/
|
||||||
public function setValidUntil($valid_until) {
|
public function setValidUntil($valid_until) {
|
||||||
$this->valid_until = $valid_until;
|
$this->valid_until = $valid_until;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date/Time until which funds may be captured against this resource.
|
* Date/Time until which funds may be captured against this resource.
|
||||||
* @return string
|
* @return string
|
||||||
@@ -128,7 +196,25 @@ class Authorization extends \PPModel implements IResource {
|
|||||||
public function getValidUntil() {
|
public function getValidUntil() {
|
||||||
return $this->valid_until;
|
return $this->valid_until;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Date/Time until which funds may be captured against this resource.
|
||||||
|
* @param string $valid_until
|
||||||
|
* @deprecated. Instead use setValidUntil
|
||||||
|
*/
|
||||||
|
public function setValid_until($valid_until) {
|
||||||
|
$this->valid_until = $valid_until;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Date/Time until which funds may be captured against this resource.
|
||||||
|
* @return string
|
||||||
|
* @deprecated. Instead use getValidUntil
|
||||||
|
*/
|
||||||
|
public function getValid_until() {
|
||||||
|
return $this->valid_until;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @array
|
* @array
|
||||||
@@ -136,8 +222,9 @@ class Authorization extends \PPModel implements IResource {
|
|||||||
*/
|
*/
|
||||||
public function setLinks($links) {
|
public function setLinks($links) {
|
||||||
$this->links = $links;
|
$this->links = $links;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return PayPal\Api\Links
|
* @return PayPal\Api\Links
|
||||||
@@ -145,7 +232,8 @@ class Authorization extends \PPModel implements IResource {
|
|||||||
public function getLinks() {
|
public function getLinks() {
|
||||||
return $this->links;
|
return $this->links;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static function get($authorizationId, $apiContext = null) {
|
public static function get($authorizationId, $apiContext = null) {
|
||||||
if (($authorizationId == null) || (strlen($authorizationId) <= 0)) {
|
if (($authorizationId == null) || (strlen($authorizationId) <= 0)) {
|
||||||
@@ -155,7 +243,7 @@ class Authorization extends \PPModel implements IResource {
|
|||||||
if ($apiContext == null) {
|
if ($apiContext == null) {
|
||||||
$apiContext = new ApiContext(self::$credential);
|
$apiContext = new ApiContext(self::$credential);
|
||||||
}
|
}
|
||||||
$call = new \PPRestCall($apiContext);
|
$call = new PPRestCall($apiContext);
|
||||||
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payments/authorization/$authorizationId", "GET", $payLoad);
|
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payments/authorization/$authorizationId", "GET", $payLoad);
|
||||||
$ret = new Authorization();
|
$ret = new Authorization();
|
||||||
$ret->fromJson($json);
|
$ret->fromJson($json);
|
||||||
@@ -173,7 +261,7 @@ class Authorization extends \PPModel implements IResource {
|
|||||||
if ($apiContext == null) {
|
if ($apiContext == null) {
|
||||||
$apiContext = new ApiContext(self::$credential);
|
$apiContext = new ApiContext(self::$credential);
|
||||||
}
|
}
|
||||||
$call = new \PPRestCall($apiContext);
|
$call = new PPRestCall($apiContext);
|
||||||
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payments/authorization/{$this->getId()}/capture", "POST", $payLoad);
|
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payments/authorization/{$this->getId()}/capture", "POST", $payLoad);
|
||||||
$ret = new Capture();
|
$ret = new Capture();
|
||||||
$ret->fromJson($json);
|
$ret->fromJson($json);
|
||||||
@@ -188,7 +276,7 @@ class Authorization extends \PPModel implements IResource {
|
|||||||
if ($apiContext == null) {
|
if ($apiContext == null) {
|
||||||
$apiContext = new ApiContext(self::$credential);
|
$apiContext = new ApiContext(self::$credential);
|
||||||
}
|
}
|
||||||
$call = new \PPRestCall($apiContext);
|
$call = new PPRestCall($apiContext);
|
||||||
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payments/authorization/{$this->getId()}/void", "POST", $payLoad);
|
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payments/authorization/{$this->getId()}/void", "POST", $payLoad);
|
||||||
$ret = new Authorization();
|
$ret = new Authorization();
|
||||||
$ret->fromJson($json);
|
$ret->fromJson($json);
|
||||||
@@ -203,7 +291,7 @@ class Authorization extends \PPModel implements IResource {
|
|||||||
if ($apiContext == null) {
|
if ($apiContext == null) {
|
||||||
$apiContext = new ApiContext(self::$credential);
|
$apiContext = new ApiContext(self::$credential);
|
||||||
}
|
}
|
||||||
$call = new \PPRestCall($apiContext);
|
$call = new PPRestCall($apiContext);
|
||||||
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payments/authorization/{$this->getId()}/reauthorize", "POST", $payLoad);
|
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payments/authorization/{$this->getId()}/reauthorize", "POST", $payLoad);
|
||||||
$this->fromJson($json);
|
$this->fromJson($json);
|
||||||
return $this;
|
return $this;
|
||||||
|
|||||||
@@ -1,30 +1,35 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace PayPal\Api;
|
namespace PayPal\Api;
|
||||||
|
|
||||||
|
use PayPal\Common\PPModel;
|
||||||
use PayPal\Rest\IResource;
|
use PayPal\Rest\IResource;
|
||||||
use PayPal\Rest\Call;
|
use PayPal\Rest\Call;
|
||||||
use PayPal\Rest\ApiContext;
|
use PayPal\Rest\ApiContext;
|
||||||
|
use PayPal\Api\Capture;
|
||||||
|
use PayPal\Api\Refund;
|
||||||
|
use PayPal\Transport\PPRestCall;
|
||||||
|
|
||||||
|
class Capture extends PPModel implements IResource {
|
||||||
|
|
||||||
class Capture extends \PPModel implements IResource {
|
|
||||||
|
|
||||||
private static $credential;
|
private static $credential;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @deprected. Pass ApiContext to create/get methods instead
|
* @deprecated. Pass ApiContext to create/get methods instead
|
||||||
*/
|
*/
|
||||||
public static function setCredential($credential) {
|
public static function setCredential($credential) {
|
||||||
self::$credential = $credential;
|
self::$credential = $credential;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Identifier of the Capture transaction.
|
* Identifier of the Capture transaction.
|
||||||
* @param string $id
|
* @param string $id
|
||||||
*/
|
*/
|
||||||
public function setId($id) {
|
public function setId($id) {
|
||||||
$this->id = $id;
|
$this->id = $id;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Identifier of the Capture transaction.
|
* Identifier of the Capture transaction.
|
||||||
* @return string
|
* @return string
|
||||||
@@ -32,15 +37,17 @@ class Capture extends \PPModel implements IResource {
|
|||||||
public function getId() {
|
public function getId() {
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Time the resource was created.
|
* Time the resource was created.
|
||||||
* @param string $create_time
|
* @param string $create_time
|
||||||
*/
|
*/
|
||||||
public function setCreateTime($create_time) {
|
public function setCreateTime($create_time) {
|
||||||
$this->create_time = $create_time;
|
$this->create_time = $create_time;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Time the resource was created.
|
* Time the resource was created.
|
||||||
* @return string
|
* @return string
|
||||||
@@ -48,15 +55,34 @@ class Capture extends \PPModel implements IResource {
|
|||||||
public function getCreateTime() {
|
public function getCreateTime() {
|
||||||
return $this->create_time;
|
return $this->create_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Time the resource was created.
|
||||||
|
* @param string $create_time
|
||||||
|
* @deprecated. Instead use setCreateTime
|
||||||
|
*/
|
||||||
|
public function setCreate_time($create_time) {
|
||||||
|
$this->create_time = $create_time;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Time the resource was created.
|
||||||
|
* @return string
|
||||||
|
* @deprecated. Instead use getCreateTime
|
||||||
|
*/
|
||||||
|
public function getCreate_time() {
|
||||||
|
return $this->create_time;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Time the resource was last updated.
|
* Time the resource was last updated.
|
||||||
* @param string $update_time
|
* @param string $update_time
|
||||||
*/
|
*/
|
||||||
public function setUpdateTime($update_time) {
|
public function setUpdateTime($update_time) {
|
||||||
$this->update_time = $update_time;
|
$this->update_time = $update_time;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Time the resource was last updated.
|
* Time the resource was last updated.
|
||||||
* @return string
|
* @return string
|
||||||
@@ -64,15 +90,34 @@ class Capture extends \PPModel implements IResource {
|
|||||||
public function getUpdateTime() {
|
public function getUpdateTime() {
|
||||||
return $this->update_time;
|
return $this->update_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Time the resource was last updated.
|
||||||
|
* @param string $update_time
|
||||||
|
* @deprecated. Instead use setUpdateTime
|
||||||
|
*/
|
||||||
|
public function setUpdate_time($update_time) {
|
||||||
|
$this->update_time = $update_time;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Time the resource was last updated.
|
||||||
|
* @return string
|
||||||
|
* @deprecated. Instead use getUpdateTime
|
||||||
|
*/
|
||||||
|
public function getUpdate_time() {
|
||||||
|
return $this->update_time;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Amount being captured. If no amount is specified, amount is used from the authorization being captured. If amount is same as the amount that's authorized for, the state of the authorization changes to captured. If not, the state of the authorization changes to partially_captured. Alternatively, you could indicate a final capture by seting the is_final_capture flag to true.
|
* Amount being captured. If no amount is specified, amount is used from the authorization being captured. If amount is same as the amount that's authorized for, the state of the authorization changes to captured. If not, the state of the authorization changes to partially_captured. Alternatively, you could indicate a final capture by seting the is_final_capture flag to true.
|
||||||
* @param PayPal\Api\Amount $amount
|
* @param PayPal\Api\Amount $amount
|
||||||
*/
|
*/
|
||||||
public function setAmount($amount) {
|
public function setAmount($amount) {
|
||||||
$this->amount = $amount;
|
$this->amount = $amount;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Amount being captured. If no amount is specified, amount is used from the authorization being captured. If amount is same as the amount that's authorized for, the state of the authorization changes to captured. If not, the state of the authorization changes to partially_captured. Alternatively, you could indicate a final capture by seting the is_final_capture flag to true.
|
* Amount being captured. If no amount is specified, amount is used from the authorization being captured. If amount is same as the amount that's authorized for, the state of the authorization changes to captured. If not, the state of the authorization changes to partially_captured. Alternatively, you could indicate a final capture by seting the is_final_capture flag to true.
|
||||||
* @return PayPal\Api\Amount
|
* @return PayPal\Api\Amount
|
||||||
@@ -80,15 +125,17 @@ class Capture extends \PPModel implements IResource {
|
|||||||
public function getAmount() {
|
public function getAmount() {
|
||||||
return $this->amount;
|
return $this->amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* whether this is a final capture for the given authorization or not. If it's final, all the remaining funds held by the authorization, will be released in the funding instrument.
|
* whether this is a final capture for the given authorization or not. If it's final, all the remaining funds held by the authorization, will be released in the funding instrument.
|
||||||
* @param boolean $is_final_capture
|
* @param boolean $is_final_capture
|
||||||
*/
|
*/
|
||||||
public function setIsFinalCapture($is_final_capture) {
|
public function setIsFinalCapture($is_final_capture) {
|
||||||
$this->is_final_capture = $is_final_capture;
|
$this->is_final_capture = $is_final_capture;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* whether this is a final capture for the given authorization or not. If it's final, all the remaining funds held by the authorization, will be released in the funding instrument.
|
* whether this is a final capture for the given authorization or not. If it's final, all the remaining funds held by the authorization, will be released in the funding instrument.
|
||||||
* @return boolean
|
* @return boolean
|
||||||
@@ -96,15 +143,34 @@ class Capture extends \PPModel implements IResource {
|
|||||||
public function getIsFinalCapture() {
|
public function getIsFinalCapture() {
|
||||||
return $this->is_final_capture;
|
return $this->is_final_capture;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* whether this is a final capture for the given authorization or not. If it's final, all the remaining funds held by the authorization, will be released in the funding instrument.
|
||||||
|
* @param boolean $is_final_capture
|
||||||
|
* @deprecated. Instead use setIsFinalCapture
|
||||||
|
*/
|
||||||
|
public function setIs_final_capture($is_final_capture) {
|
||||||
|
$this->is_final_capture = $is_final_capture;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* whether this is a final capture for the given authorization or not. If it's final, all the remaining funds held by the authorization, will be released in the funding instrument.
|
||||||
|
* @return boolean
|
||||||
|
* @deprecated. Instead use getIsFinalCapture
|
||||||
|
*/
|
||||||
|
public function getIs_final_capture() {
|
||||||
|
return $this->is_final_capture;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* State of the capture transaction.
|
* State of the capture transaction.
|
||||||
* @param string $state
|
* @param string $state
|
||||||
*/
|
*/
|
||||||
public function setState($state) {
|
public function setState($state) {
|
||||||
$this->state = $state;
|
$this->state = $state;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* State of the capture transaction.
|
* State of the capture transaction.
|
||||||
* @return string
|
* @return string
|
||||||
@@ -112,15 +178,17 @@ class Capture extends \PPModel implements IResource {
|
|||||||
public function getState() {
|
public function getState() {
|
||||||
return $this->state;
|
return $this->state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ID of the Payment resource that this transaction is based on.
|
* ID of the Payment resource that this transaction is based on.
|
||||||
* @param string $parent_payment
|
* @param string $parent_payment
|
||||||
*/
|
*/
|
||||||
public function setParentPayment($parent_payment) {
|
public function setParentPayment($parent_payment) {
|
||||||
$this->parent_payment = $parent_payment;
|
$this->parent_payment = $parent_payment;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ID of the Payment resource that this transaction is based on.
|
* ID of the Payment resource that this transaction is based on.
|
||||||
* @return string
|
* @return string
|
||||||
@@ -128,7 +196,25 @@ class Capture extends \PPModel implements IResource {
|
|||||||
public function getParentPayment() {
|
public function getParentPayment() {
|
||||||
return $this->parent_payment;
|
return $this->parent_payment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ID of the Payment resource that this transaction is based on.
|
||||||
|
* @param string $parent_payment
|
||||||
|
* @deprecated. Instead use setParentPayment
|
||||||
|
*/
|
||||||
|
public function setParent_payment($parent_payment) {
|
||||||
|
$this->parent_payment = $parent_payment;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* ID of the Payment resource that this transaction is based on.
|
||||||
|
* @return string
|
||||||
|
* @deprecated. Instead use getParentPayment
|
||||||
|
*/
|
||||||
|
public function getParent_payment() {
|
||||||
|
return $this->parent_payment;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @array
|
* @array
|
||||||
@@ -136,8 +222,9 @@ class Capture extends \PPModel implements IResource {
|
|||||||
*/
|
*/
|
||||||
public function setLinks($links) {
|
public function setLinks($links) {
|
||||||
$this->links = $links;
|
$this->links = $links;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return PayPal\Api\Links
|
* @return PayPal\Api\Links
|
||||||
@@ -145,7 +232,8 @@ class Capture extends \PPModel implements IResource {
|
|||||||
public function getLinks() {
|
public function getLinks() {
|
||||||
return $this->links;
|
return $this->links;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static function get($captureId, $apiContext = null) {
|
public static function get($captureId, $apiContext = null) {
|
||||||
if (($captureId == null) || (strlen($captureId) <= 0)) {
|
if (($captureId == null) || (strlen($captureId) <= 0)) {
|
||||||
@@ -155,7 +243,7 @@ class Capture extends \PPModel implements IResource {
|
|||||||
if ($apiContext == null) {
|
if ($apiContext == null) {
|
||||||
$apiContext = new ApiContext(self::$credential);
|
$apiContext = new ApiContext(self::$credential);
|
||||||
}
|
}
|
||||||
$call = new \PPRestCall($apiContext);
|
$call = new PPRestCall($apiContext);
|
||||||
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payments/capture/$captureId", "GET", $payLoad);
|
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payments/capture/$captureId", "GET", $payLoad);
|
||||||
$ret = new Capture();
|
$ret = new Capture();
|
||||||
$ret->fromJson($json);
|
$ret->fromJson($json);
|
||||||
@@ -173,7 +261,7 @@ class Capture extends \PPModel implements IResource {
|
|||||||
if ($apiContext == null) {
|
if ($apiContext == null) {
|
||||||
$apiContext = new ApiContext(self::$credential);
|
$apiContext = new ApiContext(self::$credential);
|
||||||
}
|
}
|
||||||
$call = new \PPRestCall($apiContext);
|
$call = new PPRestCall($apiContext);
|
||||||
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payments/capture/{$this->getId()}/refund", "POST", $payLoad);
|
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payments/capture/{$this->getId()}/refund", "POST", $payLoad);
|
||||||
$ret = new Refund();
|
$ret = new Refund();
|
||||||
$ret->fromJson($json);
|
$ret->fromJson($json);
|
||||||
|
|||||||
@@ -1,30 +1,34 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace PayPal\Api;
|
namespace PayPal\Api;
|
||||||
|
|
||||||
|
use PayPal\Common\PPModel;
|
||||||
use PayPal\Rest\IResource;
|
use PayPal\Rest\IResource;
|
||||||
use PayPal\Rest\Call;
|
use PayPal\Rest\Call;
|
||||||
use PayPal\Rest\ApiContext;
|
use PayPal\Rest\ApiContext;
|
||||||
|
use PayPal\Api\CreditCard;
|
||||||
|
use PayPal\Transport\PPRestCall;
|
||||||
|
|
||||||
|
class CreditCard extends PPModel implements IResource {
|
||||||
|
|
||||||
class CreditCard extends \PPModel implements IResource {
|
|
||||||
|
|
||||||
private static $credential;
|
private static $credential;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @deprected. Pass ApiContext to create/get methods instead
|
* @deprecated. Pass ApiContext to create/get methods instead
|
||||||
*/
|
*/
|
||||||
public static function setCredential($credential) {
|
public static function setCredential($credential) {
|
||||||
self::$credential = $credential;
|
self::$credential = $credential;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ID of the credit card being saved for later use.
|
* ID of the credit card being saved for later use.
|
||||||
* @param string $id
|
* @param string $id
|
||||||
*/
|
*/
|
||||||
public function setId($id) {
|
public function setId($id) {
|
||||||
$this->id = $id;
|
$this->id = $id;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ID of the credit card being saved for later use.
|
* ID of the credit card being saved for later use.
|
||||||
* @return string
|
* @return string
|
||||||
@@ -32,15 +36,17 @@ class CreditCard extends \PPModel implements IResource {
|
|||||||
public function getId() {
|
public function getId() {
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Card number.
|
* Card number.
|
||||||
* @param string $number
|
* @param string $number
|
||||||
*/
|
*/
|
||||||
public function setNumber($number) {
|
public function setNumber($number) {
|
||||||
$this->number = $number;
|
$this->number = $number;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Card number.
|
* Card number.
|
||||||
* @return string
|
* @return string
|
||||||
@@ -48,15 +54,17 @@ class CreditCard extends \PPModel implements IResource {
|
|||||||
public function getNumber() {
|
public function getNumber() {
|
||||||
return $this->number;
|
return $this->number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Type of the Card (eg. Visa, Mastercard, etc.).
|
* Type of the Card (eg. Visa, Mastercard, etc.).
|
||||||
* @param string $type
|
* @param string $type
|
||||||
*/
|
*/
|
||||||
public function setType($type) {
|
public function setType($type) {
|
||||||
$this->type = $type;
|
$this->type = $type;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Type of the Card (eg. Visa, Mastercard, etc.).
|
* Type of the Card (eg. Visa, Mastercard, etc.).
|
||||||
* @return string
|
* @return string
|
||||||
@@ -64,15 +72,17 @@ class CreditCard extends \PPModel implements IResource {
|
|||||||
public function getType() {
|
public function getType() {
|
||||||
return $this->type;
|
return $this->type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* card expiry month with value 1 - 12.
|
* card expiry month with value 1 - 12.
|
||||||
* @param integer $expire_month
|
* @param integer $expire_month
|
||||||
*/
|
*/
|
||||||
public function setExpireMonth($expire_month) {
|
public function setExpireMonth($expire_month) {
|
||||||
$this->expire_month = $expire_month;
|
$this->expire_month = $expire_month;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* card expiry month with value 1 - 12.
|
* card expiry month with value 1 - 12.
|
||||||
* @return integer
|
* @return integer
|
||||||
@@ -80,15 +90,34 @@ class CreditCard extends \PPModel implements IResource {
|
|||||||
public function getExpireMonth() {
|
public function getExpireMonth() {
|
||||||
return $this->expire_month;
|
return $this->expire_month;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* card expiry month with value 1 - 12.
|
||||||
|
* @param integer $expire_month
|
||||||
|
* @deprecated. Instead use setExpireMonth
|
||||||
|
*/
|
||||||
|
public function setExpire_month($expire_month) {
|
||||||
|
$this->expire_month = $expire_month;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* card expiry month with value 1 - 12.
|
||||||
|
* @return integer
|
||||||
|
* @deprecated. Instead use getExpireMonth
|
||||||
|
*/
|
||||||
|
public function getExpire_month() {
|
||||||
|
return $this->expire_month;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 4 digit card expiry year
|
* 4 digit card expiry year
|
||||||
* @param integer $expire_year
|
* @param integer $expire_year
|
||||||
*/
|
*/
|
||||||
public function setExpireYear($expire_year) {
|
public function setExpireYear($expire_year) {
|
||||||
$this->expire_year = $expire_year;
|
$this->expire_year = $expire_year;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 4 digit card expiry year
|
* 4 digit card expiry year
|
||||||
* @return integer
|
* @return integer
|
||||||
@@ -96,15 +125,34 @@ class CreditCard extends \PPModel implements IResource {
|
|||||||
public function getExpireYear() {
|
public function getExpireYear() {
|
||||||
return $this->expire_year;
|
return $this->expire_year;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 4 digit card expiry year
|
||||||
|
* @param integer $expire_year
|
||||||
|
* @deprecated. Instead use setExpireYear
|
||||||
|
*/
|
||||||
|
public function setExpire_year($expire_year) {
|
||||||
|
$this->expire_year = $expire_year;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 4 digit card expiry year
|
||||||
|
* @return integer
|
||||||
|
* @deprecated. Instead use getExpireYear
|
||||||
|
*/
|
||||||
|
public function getExpire_year() {
|
||||||
|
return $this->expire_year;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Card validation code. Only supported when making a Payment but not when saving a credit card for future use.
|
* Card validation code. Only supported when making a Payment but not when saving a credit card for future use.
|
||||||
* @param string $cvv2
|
* @param string $cvv2
|
||||||
*/
|
*/
|
||||||
public function setCvv2($cvv2) {
|
public function setCvv2($cvv2) {
|
||||||
$this->cvv2 = $cvv2;
|
$this->cvv2 = $cvv2;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Card validation code. Only supported when making a Payment but not when saving a credit card for future use.
|
* Card validation code. Only supported when making a Payment but not when saving a credit card for future use.
|
||||||
* @return string
|
* @return string
|
||||||
@@ -112,15 +160,17 @@ class CreditCard extends \PPModel implements IResource {
|
|||||||
public function getCvv2() {
|
public function getCvv2() {
|
||||||
return $this->cvv2;
|
return $this->cvv2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Card holder's first name.
|
* Card holder's first name.
|
||||||
* @param string $first_name
|
* @param string $first_name
|
||||||
*/
|
*/
|
||||||
public function setFirstName($first_name) {
|
public function setFirstName($first_name) {
|
||||||
$this->first_name = $first_name;
|
$this->first_name = $first_name;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Card holder's first name.
|
* Card holder's first name.
|
||||||
* @return string
|
* @return string
|
||||||
@@ -128,15 +178,34 @@ class CreditCard extends \PPModel implements IResource {
|
|||||||
public function getFirstName() {
|
public function getFirstName() {
|
||||||
return $this->first_name;
|
return $this->first_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Card holder's first name.
|
||||||
|
* @param string $first_name
|
||||||
|
* @deprecated. Instead use setFirstName
|
||||||
|
*/
|
||||||
|
public function setFirst_name($first_name) {
|
||||||
|
$this->first_name = $first_name;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Card holder's first name.
|
||||||
|
* @return string
|
||||||
|
* @deprecated. Instead use getFirstName
|
||||||
|
*/
|
||||||
|
public function getFirst_name() {
|
||||||
|
return $this->first_name;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Card holder's last name.
|
* Card holder's last name.
|
||||||
* @param string $last_name
|
* @param string $last_name
|
||||||
*/
|
*/
|
||||||
public function setLastName($last_name) {
|
public function setLastName($last_name) {
|
||||||
$this->last_name = $last_name;
|
$this->last_name = $last_name;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Card holder's last name.
|
* Card holder's last name.
|
||||||
* @return string
|
* @return string
|
||||||
@@ -144,15 +213,34 @@ class CreditCard extends \PPModel implements IResource {
|
|||||||
public function getLastName() {
|
public function getLastName() {
|
||||||
return $this->last_name;
|
return $this->last_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Card holder's last name.
|
||||||
|
* @param string $last_name
|
||||||
|
* @deprecated. Instead use setLastName
|
||||||
|
*/
|
||||||
|
public function setLast_name($last_name) {
|
||||||
|
$this->last_name = $last_name;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Card holder's last name.
|
||||||
|
* @return string
|
||||||
|
* @deprecated. Instead use getLastName
|
||||||
|
*/
|
||||||
|
public function getLast_name() {
|
||||||
|
return $this->last_name;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Billing Address associated with this card.
|
* Billing Address associated with this card.
|
||||||
* @param PayPal\Api\Address $billing_address
|
* @param PayPal\Api\Address $billing_address
|
||||||
*/
|
*/
|
||||||
public function setBillingAddress($billing_address) {
|
public function setBillingAddress($billing_address) {
|
||||||
$this->billing_address = $billing_address;
|
$this->billing_address = $billing_address;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Billing Address associated with this card.
|
* Billing Address associated with this card.
|
||||||
* @return PayPal\Api\Address
|
* @return PayPal\Api\Address
|
||||||
@@ -160,15 +248,34 @@ class CreditCard extends \PPModel implements IResource {
|
|||||||
public function getBillingAddress() {
|
public function getBillingAddress() {
|
||||||
return $this->billing_address;
|
return $this->billing_address;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Billing Address associated with this card.
|
||||||
|
* @param PayPal\Api\Address $billing_address
|
||||||
|
* @deprecated. Instead use setBillingAddress
|
||||||
|
*/
|
||||||
|
public function setBilling_address($billing_address) {
|
||||||
|
$this->billing_address = $billing_address;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Billing Address associated with this card.
|
||||||
|
* @return PayPal\Api\Address
|
||||||
|
* @deprecated. Instead use getBillingAddress
|
||||||
|
*/
|
||||||
|
public function getBilling_address() {
|
||||||
|
return $this->billing_address;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A unique identifier of the payer generated and provided by the facilitator. This is required when creating or using a tokenized funding instrument.
|
* A unique identifier of the payer generated and provided by the facilitator. This is required when creating or using a tokenized funding instrument.
|
||||||
* @param string $payer_id
|
* @param string $payer_id
|
||||||
*/
|
*/
|
||||||
public function setPayerId($payer_id) {
|
public function setPayerId($payer_id) {
|
||||||
$this->payer_id = $payer_id;
|
$this->payer_id = $payer_id;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A unique identifier of the payer generated and provided by the facilitator. This is required when creating or using a tokenized funding instrument.
|
* A unique identifier of the payer generated and provided by the facilitator. This is required when creating or using a tokenized funding instrument.
|
||||||
* @return string
|
* @return string
|
||||||
@@ -176,15 +283,34 @@ class CreditCard extends \PPModel implements IResource {
|
|||||||
public function getPayerId() {
|
public function getPayerId() {
|
||||||
return $this->payer_id;
|
return $this->payer_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A unique identifier of the payer generated and provided by the facilitator. This is required when creating or using a tokenized funding instrument.
|
||||||
|
* @param string $payer_id
|
||||||
|
* @deprecated. Instead use setPayerId
|
||||||
|
*/
|
||||||
|
public function setPayer_id($payer_id) {
|
||||||
|
$this->payer_id = $payer_id;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* A unique identifier of the payer generated and provided by the facilitator. This is required when creating or using a tokenized funding instrument.
|
||||||
|
* @return string
|
||||||
|
* @deprecated. Instead use getPayerId
|
||||||
|
*/
|
||||||
|
public function getPayer_id() {
|
||||||
|
return $this->payer_id;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* State of the funding instrument.
|
* State of the funding instrument.
|
||||||
* @param string $state
|
* @param string $state
|
||||||
*/
|
*/
|
||||||
public function setState($state) {
|
public function setState($state) {
|
||||||
$this->state = $state;
|
$this->state = $state;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* State of the funding instrument.
|
* State of the funding instrument.
|
||||||
* @return string
|
* @return string
|
||||||
@@ -192,15 +318,17 @@ class CreditCard extends \PPModel implements IResource {
|
|||||||
public function getState() {
|
public function getState() {
|
||||||
return $this->state;
|
return $this->state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date/Time until this resource can be used fund a payment.
|
* Date/Time until this resource can be used fund a payment.
|
||||||
* @param string $valid_until
|
* @param string $valid_until
|
||||||
*/
|
*/
|
||||||
public function setValidUntil($valid_until) {
|
public function setValidUntil($valid_until) {
|
||||||
$this->valid_until = $valid_until;
|
$this->valid_until = $valid_until;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date/Time until this resource can be used fund a payment.
|
* Date/Time until this resource can be used fund a payment.
|
||||||
* @return string
|
* @return string
|
||||||
@@ -208,7 +336,25 @@ class CreditCard extends \PPModel implements IResource {
|
|||||||
public function getValidUntil() {
|
public function getValidUntil() {
|
||||||
return $this->valid_until;
|
return $this->valid_until;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Date/Time until this resource can be used fund a payment.
|
||||||
|
* @param string $valid_until
|
||||||
|
* @deprecated. Instead use setValidUntil
|
||||||
|
*/
|
||||||
|
public function setValid_until($valid_until) {
|
||||||
|
$this->valid_until = $valid_until;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Date/Time until this resource can be used fund a payment.
|
||||||
|
* @return string
|
||||||
|
* @deprecated. Instead use getValidUntil
|
||||||
|
*/
|
||||||
|
public function getValid_until() {
|
||||||
|
return $this->valid_until;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @array
|
* @array
|
||||||
@@ -216,8 +362,9 @@ class CreditCard extends \PPModel implements IResource {
|
|||||||
*/
|
*/
|
||||||
public function setLinks($links) {
|
public function setLinks($links) {
|
||||||
$this->links = $links;
|
$this->links = $links;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return PayPal\Api\Links
|
* @return PayPal\Api\Links
|
||||||
@@ -225,14 +372,15 @@ class CreditCard extends \PPModel implements IResource {
|
|||||||
public function getLinks() {
|
public function getLinks() {
|
||||||
return $this->links;
|
return $this->links;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function create($apiContext = null) {
|
public function create($apiContext = null) {
|
||||||
$payLoad = $this->toJSON();
|
$payLoad = $this->toJSON();
|
||||||
if ($apiContext == null) {
|
if ($apiContext == null) {
|
||||||
$apiContext = new ApiContext(self::$credential);
|
$apiContext = new ApiContext(self::$credential);
|
||||||
}
|
}
|
||||||
$call = new \PPRestCall($apiContext);
|
$call = new PPRestCall($apiContext);
|
||||||
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/vault/credit-card", "POST", $payLoad);
|
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/vault/credit-card", "POST", $payLoad);
|
||||||
$this->fromJson($json);
|
$this->fromJson($json);
|
||||||
return $this;
|
return $this;
|
||||||
@@ -246,7 +394,7 @@ class CreditCard extends \PPModel implements IResource {
|
|||||||
if ($apiContext == null) {
|
if ($apiContext == null) {
|
||||||
$apiContext = new ApiContext(self::$credential);
|
$apiContext = new ApiContext(self::$credential);
|
||||||
}
|
}
|
||||||
$call = new \PPRestCall($apiContext);
|
$call = new PPRestCall($apiContext);
|
||||||
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/vault/credit-card/$creditCardId", "GET", $payLoad);
|
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/vault/credit-card/$creditCardId", "GET", $payLoad);
|
||||||
$ret = new CreditCard();
|
$ret = new CreditCard();
|
||||||
$ret->fromJson($json);
|
$ret->fromJson($json);
|
||||||
@@ -261,8 +409,8 @@ class CreditCard extends \PPModel implements IResource {
|
|||||||
if ($apiContext == null) {
|
if ($apiContext == null) {
|
||||||
$apiContext = new ApiContext(self::$credential);
|
$apiContext = new ApiContext(self::$credential);
|
||||||
}
|
}
|
||||||
$call = new \PPRestCall($apiContext);
|
$call = new PPRestCall($apiContext);
|
||||||
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/vault/credit-card/{$this->getId()}", "POST", $payLoad);
|
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/vault/credit-card/{$this->getId()}", "DELETE", $payLoad);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +1,19 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace PayPal\Api;
|
namespace PayPal\Api;
|
||||||
|
|
||||||
|
use PayPal\Common\PPModel;
|
||||||
|
|
||||||
class CreditCardHistory extends \PPModel {
|
class CreditCardHistory extends PPModel {
|
||||||
/**
|
/**
|
||||||
* A list of credit card resources
|
* A list of credit card resources
|
||||||
* @array
|
* @array
|
||||||
* @param PayPal\Api\CreditCard $credit-cards
|
* @param PayPal\Api\CreditCard $credit-cards
|
||||||
*/
|
*/
|
||||||
public function setCreditCards($credit-cards) {
|
public function setCreditCards($credit_cards) {
|
||||||
$this->credit-cards = $credit-cards;
|
$this->credit_cards = $credit_cards;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A list of credit card resources
|
* A list of credit card resources
|
||||||
* @return PayPal\Api\CreditCard
|
* @return PayPal\Api\CreditCard
|
||||||
@@ -19,15 +21,35 @@ class CreditCardHistory extends \PPModel {
|
|||||||
public function getCreditCards() {
|
public function getCreditCards() {
|
||||||
return $this->credit-cards;
|
return $this->credit-cards;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A list of credit card resources
|
||||||
|
* @array
|
||||||
|
* @param PayPal\Api\CreditCard $credit-cards
|
||||||
|
* @deprecated. Instead use setCreditCards
|
||||||
|
*/
|
||||||
|
public function setCredit_cards($credit_cards) {
|
||||||
|
$this->credit_cards = $credit_cards;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* A list of credit card resources
|
||||||
|
* @return PayPal\Api\CreditCard
|
||||||
|
* @deprecated. Instead use getCreditCards
|
||||||
|
*/
|
||||||
|
public function getCredit_cards() {
|
||||||
|
return $this->credit-cards;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Number of items returned in each range of results. Note that the last results range could have fewer items than the requested number of items.
|
* Number of items returned in each range of results. Note that the last results range could have fewer items than the requested number of items.
|
||||||
* @param integer $count
|
* @param integer $count
|
||||||
*/
|
*/
|
||||||
public function setCount($count) {
|
public function setCount($count) {
|
||||||
$this->count = $count;
|
$this->count = $count;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Number of items returned in each range of results. Note that the last results range could have fewer items than the requested number of items.
|
* Number of items returned in each range of results. Note that the last results range could have fewer items than the requested number of items.
|
||||||
* @return integer
|
* @return integer
|
||||||
@@ -35,15 +57,17 @@ class CreditCardHistory extends \PPModel {
|
|||||||
public function getCount() {
|
public function getCount() {
|
||||||
return $this->count;
|
return $this->count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Identifier of the next element to get the next range of results.
|
* Identifier of the next element to get the next range of results.
|
||||||
* @param string $next_id
|
* @param string $next_id
|
||||||
*/
|
*/
|
||||||
public function setNextId($next_id) {
|
public function setNextId($next_id) {
|
||||||
$this->next_id = $next_id;
|
$this->next_id = $next_id;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Identifier of the next element to get the next range of results.
|
* Identifier of the next element to get the next range of results.
|
||||||
* @return string
|
* @return string
|
||||||
@@ -51,5 +75,23 @@ class CreditCardHistory extends \PPModel {
|
|||||||
public function getNextId() {
|
public function getNextId() {
|
||||||
return $this->next_id;
|
return $this->next_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Identifier of the next element to get the next range of results.
|
||||||
|
* @param string $next_id
|
||||||
|
* @deprecated. Instead use setNextId
|
||||||
|
*/
|
||||||
|
public function setNext_id($next_id) {
|
||||||
|
$this->next_id = $next_id;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Identifier of the next element to get the next range of results.
|
||||||
|
* @return string
|
||||||
|
* @deprecated. Instead use getNextId
|
||||||
|
*/
|
||||||
|
public function getNext_id() {
|
||||||
|
return $this->next_id;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace PayPal\Api;
|
namespace PayPal\Api;
|
||||||
|
|
||||||
|
use PayPal\Common\PPModel;
|
||||||
|
|
||||||
class CreditCardToken extends \PPModel {
|
class CreditCardToken extends PPModel {
|
||||||
/**
|
/**
|
||||||
* ID of a previously saved Credit Card resource using /vault/credit-card API.
|
* ID of a previously saved Credit Card resource using /vault/credit-card API.
|
||||||
* @param string $credit_card_id
|
* @param string $credit_card_id
|
||||||
*/
|
*/
|
||||||
public function setCreditCardId($credit_card_id) {
|
public function setCreditCardId($credit_card_id) {
|
||||||
$this->credit_card_id = $credit_card_id;
|
$this->credit_card_id = $credit_card_id;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ID of a previously saved Credit Card resource using /vault/credit-card API.
|
* ID of a previously saved Credit Card resource using /vault/credit-card API.
|
||||||
* @return string
|
* @return string
|
||||||
@@ -18,15 +20,34 @@ class CreditCardToken extends \PPModel {
|
|||||||
public function getCreditCardId() {
|
public function getCreditCardId() {
|
||||||
return $this->credit_card_id;
|
return $this->credit_card_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ID of a previously saved Credit Card resource using /vault/credit-card API.
|
||||||
|
* @param string $credit_card_id
|
||||||
|
* @deprecated. Instead use setCreditCardId
|
||||||
|
*/
|
||||||
|
public function setCredit_card_id($credit_card_id) {
|
||||||
|
$this->credit_card_id = $credit_card_id;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* ID of a previously saved Credit Card resource using /vault/credit-card API.
|
||||||
|
* @return string
|
||||||
|
* @deprecated. Instead use getCreditCardId
|
||||||
|
*/
|
||||||
|
public function getCredit_card_id() {
|
||||||
|
return $this->credit_card_id;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The unique identifier of the payer used when saving this credit card using /vault/credit-card API.
|
* The unique identifier of the payer used when saving this credit card using /vault/credit-card API.
|
||||||
* @param string $payer_id
|
* @param string $payer_id
|
||||||
*/
|
*/
|
||||||
public function setPayerId($payer_id) {
|
public function setPayerId($payer_id) {
|
||||||
$this->payer_id = $payer_id;
|
$this->payer_id = $payer_id;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The unique identifier of the payer used when saving this credit card using /vault/credit-card API.
|
* The unique identifier of the payer used when saving this credit card using /vault/credit-card API.
|
||||||
* @return string
|
* @return string
|
||||||
@@ -34,15 +55,34 @@ class CreditCardToken extends \PPModel {
|
|||||||
public function getPayerId() {
|
public function getPayerId() {
|
||||||
return $this->payer_id;
|
return $this->payer_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The unique identifier of the payer used when saving this credit card using /vault/credit-card API.
|
||||||
|
* @param string $payer_id
|
||||||
|
* @deprecated. Instead use setPayerId
|
||||||
|
*/
|
||||||
|
public function setPayer_id($payer_id) {
|
||||||
|
$this->payer_id = $payer_id;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* The unique identifier of the payer used when saving this credit card using /vault/credit-card API.
|
||||||
|
* @return string
|
||||||
|
* @deprecated. Instead use getPayerId
|
||||||
|
*/
|
||||||
|
public function getPayer_id() {
|
||||||
|
return $this->payer_id;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Last 4 digits of the card number from the saved card.
|
* Last 4 digits of the card number from the saved card.
|
||||||
* @param string $last4
|
* @param string $last4
|
||||||
*/
|
*/
|
||||||
public function setLast4($last4) {
|
public function setLast4($last4) {
|
||||||
$this->last4 = $last4;
|
$this->last4 = $last4;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Last 4 digits of the card number from the saved card.
|
* Last 4 digits of the card number from the saved card.
|
||||||
* @return string
|
* @return string
|
||||||
@@ -50,15 +90,17 @@ class CreditCardToken extends \PPModel {
|
|||||||
public function getLast4() {
|
public function getLast4() {
|
||||||
return $this->last4;
|
return $this->last4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Type of the Card (eg. visa, mastercard, etc.) from the saved card. Please note that the values are always in lowercase and not meant to be used directly for display.
|
* Type of the Card (eg. visa, mastercard, etc.) from the saved card. Please note that the values are always in lowercase and not meant to be used directly for display.
|
||||||
* @param string $type
|
* @param string $type
|
||||||
*/
|
*/
|
||||||
public function setType($type) {
|
public function setType($type) {
|
||||||
$this->type = $type;
|
$this->type = $type;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Type of the Card (eg. visa, mastercard, etc.) from the saved card. Please note that the values are always in lowercase and not meant to be used directly for display.
|
* Type of the Card (eg. visa, mastercard, etc.) from the saved card. Please note that the values are always in lowercase and not meant to be used directly for display.
|
||||||
* @return string
|
* @return string
|
||||||
@@ -66,15 +108,17 @@ class CreditCardToken extends \PPModel {
|
|||||||
public function getType() {
|
public function getType() {
|
||||||
return $this->type;
|
return $this->type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* card expiry month from the saved card with value 1 - 12
|
* card expiry month from the saved card with value 1 - 12
|
||||||
* @param integer $expire_month
|
* @param integer $expire_month
|
||||||
*/
|
*/
|
||||||
public function setExpireMonth($expire_month) {
|
public function setExpireMonth($expire_month) {
|
||||||
$this->expire_month = $expire_month;
|
$this->expire_month = $expire_month;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* card expiry month from the saved card with value 1 - 12
|
* card expiry month from the saved card with value 1 - 12
|
||||||
* @return integer
|
* @return integer
|
||||||
@@ -82,15 +126,34 @@ class CreditCardToken extends \PPModel {
|
|||||||
public function getExpireMonth() {
|
public function getExpireMonth() {
|
||||||
return $this->expire_month;
|
return $this->expire_month;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* card expiry month from the saved card with value 1 - 12
|
||||||
|
* @param integer $expire_month
|
||||||
|
* @deprecated. Instead use setExpireMonth
|
||||||
|
*/
|
||||||
|
public function setExpire_month($expire_month) {
|
||||||
|
$this->expire_month = $expire_month;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* card expiry month from the saved card with value 1 - 12
|
||||||
|
* @return integer
|
||||||
|
* @deprecated. Instead use getExpireMonth
|
||||||
|
*/
|
||||||
|
public function getExpire_month() {
|
||||||
|
return $this->expire_month;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 4 digit card expiry year from the saved card
|
* 4 digit card expiry year from the saved card
|
||||||
* @param integer $expire_year
|
* @param integer $expire_year
|
||||||
*/
|
*/
|
||||||
public function setExpireYear($expire_year) {
|
public function setExpireYear($expire_year) {
|
||||||
$this->expire_year = $expire_year;
|
$this->expire_year = $expire_year;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 4 digit card expiry year from the saved card
|
* 4 digit card expiry year from the saved card
|
||||||
* @return integer
|
* @return integer
|
||||||
@@ -98,5 +161,23 @@ class CreditCardToken extends \PPModel {
|
|||||||
public function getExpireYear() {
|
public function getExpireYear() {
|
||||||
return $this->expire_year;
|
return $this->expire_year;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 4 digit card expiry year from the saved card
|
||||||
|
* @param integer $expire_year
|
||||||
|
* @deprecated. Instead use setExpireYear
|
||||||
|
*/
|
||||||
|
public function setExpire_year($expire_year) {
|
||||||
|
$this->expire_year = $expire_year;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 4 digit card expiry year from the saved card
|
||||||
|
* @return integer
|
||||||
|
* @deprecated. Instead use getExpireYear
|
||||||
|
*/
|
||||||
|
public function getExpire_year() {
|
||||||
|
return $this->expire_year;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace PayPal\Api;
|
namespace PayPal\Api;
|
||||||
|
|
||||||
|
use PayPal\Common\PPModel;
|
||||||
|
|
||||||
class Details extends \PPModel {
|
class Details extends PPModel {
|
||||||
/**
|
/**
|
||||||
* Amount being charged for shipping.
|
* Amount being charged for shipping.
|
||||||
* @param string $shipping
|
* @param string $shipping
|
||||||
*/
|
*/
|
||||||
public function setShipping($shipping) {
|
public function setShipping($shipping) {
|
||||||
$this->shipping = $shipping;
|
$this->shipping = $shipping;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Amount being charged for shipping.
|
* Amount being charged for shipping.
|
||||||
* @return string
|
* @return string
|
||||||
@@ -18,15 +20,17 @@ class Details extends \PPModel {
|
|||||||
public function getShipping() {
|
public function getShipping() {
|
||||||
return $this->shipping;
|
return $this->shipping;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sub-total (amount) of items being paid for.
|
* Sub-total (amount) of items being paid for.
|
||||||
* @param string $subtotal
|
* @param string $subtotal
|
||||||
*/
|
*/
|
||||||
public function setSubtotal($subtotal) {
|
public function setSubtotal($subtotal) {
|
||||||
$this->subtotal = $subtotal;
|
$this->subtotal = $subtotal;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sub-total (amount) of items being paid for.
|
* Sub-total (amount) of items being paid for.
|
||||||
* @return string
|
* @return string
|
||||||
@@ -34,15 +38,17 @@ class Details extends \PPModel {
|
|||||||
public function getSubtotal() {
|
public function getSubtotal() {
|
||||||
return $this->subtotal;
|
return $this->subtotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Amount being charged as tax.
|
* Amount being charged as tax.
|
||||||
* @param string $tax
|
* @param string $tax
|
||||||
*/
|
*/
|
||||||
public function setTax($tax) {
|
public function setTax($tax) {
|
||||||
$this->tax = $tax;
|
$this->tax = $tax;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Amount being charged as tax.
|
* Amount being charged as tax.
|
||||||
* @return string
|
* @return string
|
||||||
@@ -50,15 +56,17 @@ class Details extends \PPModel {
|
|||||||
public function getTax() {
|
public function getTax() {
|
||||||
return $this->tax;
|
return $this->tax;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fee charged by PayPal. In case of a refund, this is the fee amount refunded to the original receipient of the payment.
|
* Fee charged by PayPal. In case of a refund, this is the fee amount refunded to the original receipient of the payment.
|
||||||
* @param string $fee
|
* @param string $fee
|
||||||
*/
|
*/
|
||||||
public function setFee($fee) {
|
public function setFee($fee) {
|
||||||
$this->fee = $fee;
|
$this->fee = $fee;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fee charged by PayPal. In case of a refund, this is the fee amount refunded to the original receipient of the payment.
|
* Fee charged by PayPal. In case of a refund, this is the fee amount refunded to the original receipient of the payment.
|
||||||
* @return string
|
* @return string
|
||||||
@@ -66,5 +74,6 @@ class Details extends \PPModel {
|
|||||||
public function getFee() {
|
public function getFee() {
|
||||||
return $this->fee;
|
return $this->fee;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace PayPal\Api;
|
namespace PayPal\Api;
|
||||||
|
|
||||||
|
use PayPal\Common\PPModel;
|
||||||
|
|
||||||
class FundingInstrument extends \PPModel {
|
class FundingInstrument extends PPModel {
|
||||||
/**
|
/**
|
||||||
* Credit Card information.
|
* Credit Card information.
|
||||||
* @param PayPal\Api\CreditCard $credit_card
|
* @param PayPal\Api\CreditCard $credit_card
|
||||||
*/
|
*/
|
||||||
public function setCreditCard($credit_card) {
|
public function setCreditCard($credit_card) {
|
||||||
$this->credit_card = $credit_card;
|
$this->credit_card = $credit_card;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Credit Card information.
|
* Credit Card information.
|
||||||
* @return PayPal\Api\CreditCard
|
* @return PayPal\Api\CreditCard
|
||||||
@@ -18,15 +20,34 @@ class FundingInstrument extends \PPModel {
|
|||||||
public function getCreditCard() {
|
public function getCreditCard() {
|
||||||
return $this->credit_card;
|
return $this->credit_card;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Credit Card information.
|
||||||
|
* @param PayPal\Api\CreditCard $credit_card
|
||||||
|
* @deprecated. Instead use setCreditCard
|
||||||
|
*/
|
||||||
|
public function setCredit_card($credit_card) {
|
||||||
|
$this->credit_card = $credit_card;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Credit Card information.
|
||||||
|
* @return PayPal\Api\CreditCard
|
||||||
|
* @deprecated. Instead use getCreditCard
|
||||||
|
*/
|
||||||
|
public function getCredit_card() {
|
||||||
|
return $this->credit_card;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Credit Card information.
|
* Credit Card information.
|
||||||
* @param PayPal\Api\CreditCardToken $credit_card_token
|
* @param PayPal\Api\CreditCardToken $credit_card_token
|
||||||
*/
|
*/
|
||||||
public function setCreditCardToken($credit_card_token) {
|
public function setCreditCardToken($credit_card_token) {
|
||||||
$this->credit_card_token = $credit_card_token;
|
$this->credit_card_token = $credit_card_token;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Credit Card information.
|
* Credit Card information.
|
||||||
* @return PayPal\Api\CreditCardToken
|
* @return PayPal\Api\CreditCardToken
|
||||||
@@ -34,5 +55,23 @@ class FundingInstrument extends \PPModel {
|
|||||||
public function getCreditCardToken() {
|
public function getCreditCardToken() {
|
||||||
return $this->credit_card_token;
|
return $this->credit_card_token;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Credit Card information.
|
||||||
|
* @param PayPal\Api\CreditCardToken $credit_card_token
|
||||||
|
* @deprecated. Instead use setCreditCardToken
|
||||||
|
*/
|
||||||
|
public function setCredit_card_token($credit_card_token) {
|
||||||
|
$this->credit_card_token = $credit_card_token;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Credit Card information.
|
||||||
|
* @return PayPal\Api\CreditCardToken
|
||||||
|
* @deprecated. Instead use getCreditCardToken
|
||||||
|
*/
|
||||||
|
public function getCredit_card_token() {
|
||||||
|
return $this->credit_card_token;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace PayPal\Api;
|
namespace PayPal\Api;
|
||||||
|
|
||||||
|
use PayPal\Common\PPModel;
|
||||||
|
|
||||||
class HyperSchema extends \PPModel {
|
class HyperSchema extends PPModel {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @array
|
* @array
|
||||||
@@ -10,8 +11,9 @@ class HyperSchema extends \PPModel {
|
|||||||
*/
|
*/
|
||||||
public function setLinks($links) {
|
public function setLinks($links) {
|
||||||
$this->links = $links;
|
$this->links = $links;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return PayPal\Api\Links
|
* @return PayPal\Api\Links
|
||||||
@@ -19,15 +21,17 @@ class HyperSchema extends \PPModel {
|
|||||||
public function getLinks() {
|
public function getLinks() {
|
||||||
return $this->links;
|
return $this->links;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param string $fragmentResolution
|
* @param string $fragmentResolution
|
||||||
*/
|
*/
|
||||||
public function setFragmentResolution($fragmentResolution) {
|
public function setFragmentResolution($fragmentResolution) {
|
||||||
$this->fragmentResolution = $fragmentResolution;
|
$this->fragmentResolution = $fragmentResolution;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
@@ -35,15 +39,17 @@ class HyperSchema extends \PPModel {
|
|||||||
public function getFragmentResolution() {
|
public function getFragmentResolution() {
|
||||||
return $this->fragmentResolution;
|
return $this->fragmentResolution;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param boolean $readonly
|
* @param boolean $readonly
|
||||||
*/
|
*/
|
||||||
public function setReadonly($readonly) {
|
public function setReadonly($readonly) {
|
||||||
$this->readonly = $readonly;
|
$this->readonly = $readonly;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
@@ -51,15 +57,17 @@ class HyperSchema extends \PPModel {
|
|||||||
public function getReadonly() {
|
public function getReadonly() {
|
||||||
return $this->readonly;
|
return $this->readonly;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param string $contentEncoding
|
* @param string $contentEncoding
|
||||||
*/
|
*/
|
||||||
public function setContentEncoding($contentEncoding) {
|
public function setContentEncoding($contentEncoding) {
|
||||||
$this->contentEncoding = $contentEncoding;
|
$this->contentEncoding = $contentEncoding;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
@@ -67,15 +75,17 @@ class HyperSchema extends \PPModel {
|
|||||||
public function getContentEncoding() {
|
public function getContentEncoding() {
|
||||||
return $this->contentEncoding;
|
return $this->contentEncoding;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param string $pathStart
|
* @param string $pathStart
|
||||||
*/
|
*/
|
||||||
public function setPathStart($pathStart) {
|
public function setPathStart($pathStart) {
|
||||||
$this->pathStart = $pathStart;
|
$this->pathStart = $pathStart;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
@@ -83,15 +93,17 @@ class HyperSchema extends \PPModel {
|
|||||||
public function getPathStart() {
|
public function getPathStart() {
|
||||||
return $this->pathStart;
|
return $this->pathStart;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param string $mediaType
|
* @param string $mediaType
|
||||||
*/
|
*/
|
||||||
public function setMediaType($mediaType) {
|
public function setMediaType($mediaType) {
|
||||||
$this->mediaType = $mediaType;
|
$this->mediaType = $mediaType;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
@@ -99,5 +111,6 @@ class HyperSchema extends \PPModel {
|
|||||||
public function getMediaType() {
|
public function getMediaType() {
|
||||||
return $this->mediaType;
|
return $this->mediaType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace PayPal\Api;
|
namespace PayPal\Api;
|
||||||
|
|
||||||
|
use PayPal\Common\PPModel;
|
||||||
|
|
||||||
class Item extends \PPModel {
|
class Item extends PPModel {
|
||||||
/**
|
/**
|
||||||
* Number of items.
|
* Number of items.
|
||||||
* @param string $quantity
|
* @param string $quantity
|
||||||
*/
|
*/
|
||||||
public function setQuantity($quantity) {
|
public function setQuantity($quantity) {
|
||||||
$this->quantity = $quantity;
|
$this->quantity = $quantity;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Number of items.
|
* Number of items.
|
||||||
* @return string
|
* @return string
|
||||||
@@ -18,15 +20,17 @@ class Item extends \PPModel {
|
|||||||
public function getQuantity() {
|
public function getQuantity() {
|
||||||
return $this->quantity;
|
return $this->quantity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Name of the item.
|
* Name of the item.
|
||||||
* @param string $name
|
* @param string $name
|
||||||
*/
|
*/
|
||||||
public function setName($name) {
|
public function setName($name) {
|
||||||
$this->name = $name;
|
$this->name = $name;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Name of the item.
|
* Name of the item.
|
||||||
* @return string
|
* @return string
|
||||||
@@ -34,15 +38,17 @@ class Item extends \PPModel {
|
|||||||
public function getName() {
|
public function getName() {
|
||||||
return $this->name;
|
return $this->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cost of the item.
|
* Cost of the item.
|
||||||
* @param string $price
|
* @param string $price
|
||||||
*/
|
*/
|
||||||
public function setPrice($price) {
|
public function setPrice($price) {
|
||||||
$this->price = $price;
|
$this->price = $price;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cost of the item.
|
* Cost of the item.
|
||||||
* @return string
|
* @return string
|
||||||
@@ -50,15 +56,17 @@ class Item extends \PPModel {
|
|||||||
public function getPrice() {
|
public function getPrice() {
|
||||||
return $this->price;
|
return $this->price;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 3-letter Currency Code
|
* 3-letter Currency Code
|
||||||
* @param string $currency
|
* @param string $currency
|
||||||
*/
|
*/
|
||||||
public function setCurrency($currency) {
|
public function setCurrency($currency) {
|
||||||
$this->currency = $currency;
|
$this->currency = $currency;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 3-letter Currency Code
|
* 3-letter Currency Code
|
||||||
* @return string
|
* @return string
|
||||||
@@ -66,15 +74,17 @@ class Item extends \PPModel {
|
|||||||
public function getCurrency() {
|
public function getCurrency() {
|
||||||
return $this->currency;
|
return $this->currency;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Number or code to identify the item in your catalog/records.
|
* Number or code to identify the item in your catalog/records.
|
||||||
* @param string $sku
|
* @param string $sku
|
||||||
*/
|
*/
|
||||||
public function setSku($sku) {
|
public function setSku($sku) {
|
||||||
$this->sku = $sku;
|
$this->sku = $sku;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Number or code to identify the item in your catalog/records.
|
* Number or code to identify the item in your catalog/records.
|
||||||
* @return string
|
* @return string
|
||||||
@@ -82,5 +92,6 @@ class Item extends \PPModel {
|
|||||||
public function getSku() {
|
public function getSku() {
|
||||||
return $this->sku;
|
return $this->sku;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace PayPal\Api;
|
namespace PayPal\Api;
|
||||||
|
|
||||||
|
use PayPal\Common\PPModel;
|
||||||
|
|
||||||
class ItemList extends \PPModel {
|
class ItemList extends PPModel {
|
||||||
/**
|
/**
|
||||||
* List of items.
|
* List of items.
|
||||||
* @array
|
* @array
|
||||||
@@ -10,8 +11,9 @@ class ItemList extends \PPModel {
|
|||||||
*/
|
*/
|
||||||
public function setItems($items) {
|
public function setItems($items) {
|
||||||
$this->items = $items;
|
$this->items = $items;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of items.
|
* List of items.
|
||||||
* @return PayPal\Api\Item
|
* @return PayPal\Api\Item
|
||||||
@@ -19,15 +21,17 @@ class ItemList extends \PPModel {
|
|||||||
public function getItems() {
|
public function getItems() {
|
||||||
return $this->items;
|
return $this->items;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shipping address.
|
* Shipping address.
|
||||||
* @param PayPal\Api\ShippingAddress $shipping_address
|
* @param PayPal\Api\ShippingAddress $shipping_address
|
||||||
*/
|
*/
|
||||||
public function setShippingAddress($shipping_address) {
|
public function setShippingAddress($shipping_address) {
|
||||||
$this->shipping_address = $shipping_address;
|
$this->shipping_address = $shipping_address;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shipping address.
|
* Shipping address.
|
||||||
* @return PayPal\Api\ShippingAddress
|
* @return PayPal\Api\ShippingAddress
|
||||||
@@ -35,5 +39,23 @@ class ItemList extends \PPModel {
|
|||||||
public function getShippingAddress() {
|
public function getShippingAddress() {
|
||||||
return $this->shipping_address;
|
return $this->shipping_address;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shipping address.
|
||||||
|
* @param PayPal\Api\ShippingAddress $shipping_address
|
||||||
|
* @deprecated. Instead use setShippingAddress
|
||||||
|
*/
|
||||||
|
public function setShipping_address($shipping_address) {
|
||||||
|
$this->shipping_address = $shipping_address;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Shipping address.
|
||||||
|
* @return PayPal\Api\ShippingAddress
|
||||||
|
* @deprecated. Instead use getShippingAddress
|
||||||
|
*/
|
||||||
|
public function getShipping_address() {
|
||||||
|
return $this->shipping_address;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace PayPal\Api;
|
namespace PayPal\Api;
|
||||||
|
|
||||||
|
use PayPal\Common\PPModel;
|
||||||
|
|
||||||
class Links extends \PPModel {
|
class Links extends PPModel {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param string $href
|
* @param string $href
|
||||||
*/
|
*/
|
||||||
public function setHref($href) {
|
public function setHref($href) {
|
||||||
$this->href = $href;
|
$this->href = $href;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
@@ -18,15 +20,17 @@ class Links extends \PPModel {
|
|||||||
public function getHref() {
|
public function getHref() {
|
||||||
return $this->href;
|
return $this->href;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param string $rel
|
* @param string $rel
|
||||||
*/
|
*/
|
||||||
public function setRel($rel) {
|
public function setRel($rel) {
|
||||||
$this->rel = $rel;
|
$this->rel = $rel;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
@@ -34,15 +38,17 @@ class Links extends \PPModel {
|
|||||||
public function getRel() {
|
public function getRel() {
|
||||||
return $this->rel;
|
return $this->rel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param PayPal\Api\HyperSchema $targetSchema
|
* @param PayPal\Api\HyperSchema $targetSchema
|
||||||
*/
|
*/
|
||||||
public function setTargetSchema($targetSchema) {
|
public function setTargetSchema($targetSchema) {
|
||||||
$this->targetSchema = $targetSchema;
|
$this->targetSchema = $targetSchema;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return PayPal\Api\HyperSchema
|
* @return PayPal\Api\HyperSchema
|
||||||
@@ -50,15 +56,17 @@ class Links extends \PPModel {
|
|||||||
public function getTargetSchema() {
|
public function getTargetSchema() {
|
||||||
return $this->targetSchema;
|
return $this->targetSchema;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param string $method
|
* @param string $method
|
||||||
*/
|
*/
|
||||||
public function setMethod($method) {
|
public function setMethod($method) {
|
||||||
$this->method = $method;
|
$this->method = $method;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
@@ -66,15 +74,17 @@ class Links extends \PPModel {
|
|||||||
public function getMethod() {
|
public function getMethod() {
|
||||||
return $this->method;
|
return $this->method;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param string $enctype
|
* @param string $enctype
|
||||||
*/
|
*/
|
||||||
public function setEnctype($enctype) {
|
public function setEnctype($enctype) {
|
||||||
$this->enctype = $enctype;
|
$this->enctype = $enctype;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
@@ -82,15 +92,17 @@ class Links extends \PPModel {
|
|||||||
public function getEnctype() {
|
public function getEnctype() {
|
||||||
return $this->enctype;
|
return $this->enctype;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param PayPal\Api\HyperSchema $schema
|
* @param PayPal\Api\HyperSchema $schema
|
||||||
*/
|
*/
|
||||||
public function setSchema($schema) {
|
public function setSchema($schema) {
|
||||||
$this->schema = $schema;
|
$this->schema = $schema;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return PayPal\Api\HyperSchema
|
* @return PayPal\Api\HyperSchema
|
||||||
@@ -98,5 +110,6 @@ class Links extends \PPModel {
|
|||||||
public function getSchema() {
|
public function getSchema() {
|
||||||
return $this->schema;
|
return $this->schema;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace PayPal\Api;
|
namespace PayPal\Api;
|
||||||
|
|
||||||
|
use PayPal\Common\PPModel;
|
||||||
|
|
||||||
class Payee extends \PPModel {
|
class Payee extends PPModel {
|
||||||
/**
|
/**
|
||||||
* Email Address associated with the Payee's PayPal Account. If the provided email address is not associated with any PayPal Account, the payee can only receiver PayPal Wallet Payments. Direct Credit Card Payments will be denied due to card compliance requirements.
|
* Email Address associated with the Payee's PayPal Account. If the provided email address is not associated with any PayPal Account, the payee can only receiver PayPal Wallet Payments. Direct Credit Card Payments will be denied due to card compliance requirements.
|
||||||
* @param string $email
|
* @param string $email
|
||||||
*/
|
*/
|
||||||
public function setEmail($email) {
|
public function setEmail($email) {
|
||||||
$this->email = $email;
|
$this->email = $email;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Email Address associated with the Payee's PayPal Account. If the provided email address is not associated with any PayPal Account, the payee can only receiver PayPal Wallet Payments. Direct Credit Card Payments will be denied due to card compliance requirements.
|
* Email Address associated with the Payee's PayPal Account. If the provided email address is not associated with any PayPal Account, the payee can only receiver PayPal Wallet Payments. Direct Credit Card Payments will be denied due to card compliance requirements.
|
||||||
* @return string
|
* @return string
|
||||||
@@ -18,15 +20,17 @@ class Payee extends \PPModel {
|
|||||||
public function getEmail() {
|
public function getEmail() {
|
||||||
return $this->email;
|
return $this->email;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Encrypted PayPal Account identifier for the Payee.
|
* Encrypted PayPal Account identifier for the Payee.
|
||||||
* @param string $merchant_id
|
* @param string $merchant_id
|
||||||
*/
|
*/
|
||||||
public function setMerchantId($merchant_id) {
|
public function setMerchantId($merchant_id) {
|
||||||
$this->merchant_id = $merchant_id;
|
$this->merchant_id = $merchant_id;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Encrypted PayPal Account identifier for the Payee.
|
* Encrypted PayPal Account identifier for the Payee.
|
||||||
* @return string
|
* @return string
|
||||||
@@ -34,15 +38,34 @@ class Payee extends \PPModel {
|
|||||||
public function getMerchantId() {
|
public function getMerchantId() {
|
||||||
return $this->merchant_id;
|
return $this->merchant_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Encrypted PayPal Account identifier for the Payee.
|
||||||
|
* @param string $merchant_id
|
||||||
|
* @deprecated. Instead use setMerchantId
|
||||||
|
*/
|
||||||
|
public function setMerchant_id($merchant_id) {
|
||||||
|
$this->merchant_id = $merchant_id;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Encrypted PayPal Account identifier for the Payee.
|
||||||
|
* @return string
|
||||||
|
* @deprecated. Instead use getMerchantId
|
||||||
|
*/
|
||||||
|
public function getMerchant_id() {
|
||||||
|
return $this->merchant_id;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Phone number (in E.123 format) associated with the Payee's PayPal Account. If the provided phont number is not associated with any PayPal Account, the payee can only receiver PayPal Wallet Payments. Direct Credit Card Payments will be denied due to card compliance requirements.
|
* Phone number (in E.123 format) associated with the Payee's PayPal Account. If the provided phont number is not associated with any PayPal Account, the payee can only receiver PayPal Wallet Payments. Direct Credit Card Payments will be denied due to card compliance requirements.
|
||||||
* @param string $phone
|
* @param string $phone
|
||||||
*/
|
*/
|
||||||
public function setPhone($phone) {
|
public function setPhone($phone) {
|
||||||
$this->phone = $phone;
|
$this->phone = $phone;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Phone number (in E.123 format) associated with the Payee's PayPal Account. If the provided phont number is not associated with any PayPal Account, the payee can only receiver PayPal Wallet Payments. Direct Credit Card Payments will be denied due to card compliance requirements.
|
* Phone number (in E.123 format) associated with the Payee's PayPal Account. If the provided phont number is not associated with any PayPal Account, the payee can only receiver PayPal Wallet Payments. Direct Credit Card Payments will be denied due to card compliance requirements.
|
||||||
* @return string
|
* @return string
|
||||||
@@ -50,5 +73,6 @@ class Payee extends \PPModel {
|
|||||||
public function getPhone() {
|
public function getPhone() {
|
||||||
return $this->phone;
|
return $this->phone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace PayPal\Api;
|
namespace PayPal\Api;
|
||||||
|
|
||||||
|
use PayPal\Common\PPModel;
|
||||||
|
|
||||||
class Payer extends \PPModel {
|
class Payer extends PPModel {
|
||||||
/**
|
/**
|
||||||
* Payment method being used - PayPal Wallet payment or Direct Credit card.
|
* Payment method being used - PayPal Wallet payment or Direct Credit card.
|
||||||
* @param string $payment_method
|
* @param string $payment_method
|
||||||
*/
|
*/
|
||||||
public function setPaymentMethod($payment_method) {
|
public function setPaymentMethod($payment_method) {
|
||||||
$this->payment_method = $payment_method;
|
$this->payment_method = $payment_method;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Payment method being used - PayPal Wallet payment or Direct Credit card.
|
* Payment method being used - PayPal Wallet payment or Direct Credit card.
|
||||||
* @return string
|
* @return string
|
||||||
@@ -18,7 +20,25 @@ class Payer extends \PPModel {
|
|||||||
public function getPaymentMethod() {
|
public function getPaymentMethod() {
|
||||||
return $this->payment_method;
|
return $this->payment_method;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Payment method being used - PayPal Wallet payment or Direct Credit card.
|
||||||
|
* @param string $payment_method
|
||||||
|
* @deprecated. Instead use setPaymentMethod
|
||||||
|
*/
|
||||||
|
public function setPayment_method($payment_method) {
|
||||||
|
$this->payment_method = $payment_method;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Payment method being used - PayPal Wallet payment or Direct Credit card.
|
||||||
|
* @return string
|
||||||
|
* @deprecated. Instead use getPaymentMethod
|
||||||
|
*/
|
||||||
|
public function getPayment_method() {
|
||||||
|
return $this->payment_method;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of funding instruments from where the funds of the current payment come from. Typically a credit card.
|
* List of funding instruments from where the funds of the current payment come from. Typically a credit card.
|
||||||
* @array
|
* @array
|
||||||
@@ -26,8 +46,9 @@ class Payer extends \PPModel {
|
|||||||
*/
|
*/
|
||||||
public function setFundingInstruments($funding_instruments) {
|
public function setFundingInstruments($funding_instruments) {
|
||||||
$this->funding_instruments = $funding_instruments;
|
$this->funding_instruments = $funding_instruments;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of funding instruments from where the funds of the current payment come from. Typically a credit card.
|
* List of funding instruments from where the funds of the current payment come from. Typically a credit card.
|
||||||
* @return PayPal\Api\FundingInstrument
|
* @return PayPal\Api\FundingInstrument
|
||||||
@@ -35,15 +56,35 @@ class Payer extends \PPModel {
|
|||||||
public function getFundingInstruments() {
|
public function getFundingInstruments() {
|
||||||
return $this->funding_instruments;
|
return $this->funding_instruments;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of funding instruments from where the funds of the current payment come from. Typically a credit card.
|
||||||
|
* @array
|
||||||
|
* @param PayPal\Api\FundingInstrument $funding_instruments
|
||||||
|
* @deprecated. Instead use setFundingInstruments
|
||||||
|
*/
|
||||||
|
public function setFunding_instruments($funding_instruments) {
|
||||||
|
$this->funding_instruments = $funding_instruments;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* List of funding instruments from where the funds of the current payment come from. Typically a credit card.
|
||||||
|
* @return PayPal\Api\FundingInstrument
|
||||||
|
* @deprecated. Instead use getFundingInstruments
|
||||||
|
*/
|
||||||
|
public function getFunding_instruments() {
|
||||||
|
return $this->funding_instruments;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Information related to the Payer. In case of PayPal Wallet payment, this information will be filled in by PayPal after the user approves the payment using their PayPal Wallet.
|
* Information related to the Payer. In case of PayPal Wallet payment, this information will be filled in by PayPal after the user approves the payment using their PayPal Wallet.
|
||||||
* @param PayPal\Api\PayerInfo $payer_info
|
* @param PayPal\Api\PayerInfo $payer_info
|
||||||
*/
|
*/
|
||||||
public function setPayerInfo($payer_info) {
|
public function setPayerInfo($payer_info) {
|
||||||
$this->payer_info = $payer_info;
|
$this->payer_info = $payer_info;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Information related to the Payer. In case of PayPal Wallet payment, this information will be filled in by PayPal after the user approves the payment using their PayPal Wallet.
|
* Information related to the Payer. In case of PayPal Wallet payment, this information will be filled in by PayPal after the user approves the payment using their PayPal Wallet.
|
||||||
* @return PayPal\Api\PayerInfo
|
* @return PayPal\Api\PayerInfo
|
||||||
@@ -51,5 +92,23 @@ class Payer extends \PPModel {
|
|||||||
public function getPayerInfo() {
|
public function getPayerInfo() {
|
||||||
return $this->payer_info;
|
return $this->payer_info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Information related to the Payer. In case of PayPal Wallet payment, this information will be filled in by PayPal after the user approves the payment using their PayPal Wallet.
|
||||||
|
* @param PayPal\Api\PayerInfo $payer_info
|
||||||
|
* @deprecated. Instead use setPayerInfo
|
||||||
|
*/
|
||||||
|
public function setPayer_info($payer_info) {
|
||||||
|
$this->payer_info = $payer_info;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Information related to the Payer. In case of PayPal Wallet payment, this information will be filled in by PayPal after the user approves the payment using their PayPal Wallet.
|
||||||
|
* @return PayPal\Api\PayerInfo
|
||||||
|
* @deprecated. Instead use getPayerInfo
|
||||||
|
*/
|
||||||
|
public function getPayer_info() {
|
||||||
|
return $this->payer_info;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace PayPal\Api;
|
namespace PayPal\Api;
|
||||||
|
|
||||||
|
use PayPal\Common\PPModel;
|
||||||
|
|
||||||
class PayerInfo extends \PPModel {
|
class PayerInfo extends PPModel {
|
||||||
/**
|
/**
|
||||||
* Email address representing the Payer.
|
* Email address representing the Payer.
|
||||||
* @param string $email
|
* @param string $email
|
||||||
*/
|
*/
|
||||||
public function setEmail($email) {
|
public function setEmail($email) {
|
||||||
$this->email = $email;
|
$this->email = $email;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Email address representing the Payer.
|
* Email address representing the Payer.
|
||||||
* @return string
|
* @return string
|
||||||
@@ -18,15 +20,17 @@ class PayerInfo extends \PPModel {
|
|||||||
public function getEmail() {
|
public function getEmail() {
|
||||||
return $this->email;
|
return $this->email;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* First Name of the Payer from their PayPal Account.
|
* First Name of the Payer from their PayPal Account.
|
||||||
* @param string $first_name
|
* @param string $first_name
|
||||||
*/
|
*/
|
||||||
public function setFirstName($first_name) {
|
public function setFirstName($first_name) {
|
||||||
$this->first_name = $first_name;
|
$this->first_name = $first_name;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* First Name of the Payer from their PayPal Account.
|
* First Name of the Payer from their PayPal Account.
|
||||||
* @return string
|
* @return string
|
||||||
@@ -34,15 +38,34 @@ class PayerInfo extends \PPModel {
|
|||||||
public function getFirstName() {
|
public function getFirstName() {
|
||||||
return $this->first_name;
|
return $this->first_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* First Name of the Payer from their PayPal Account.
|
||||||
|
* @param string $first_name
|
||||||
|
* @deprecated. Instead use setFirstName
|
||||||
|
*/
|
||||||
|
public function setFirst_name($first_name) {
|
||||||
|
$this->first_name = $first_name;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* First Name of the Payer from their PayPal Account.
|
||||||
|
* @return string
|
||||||
|
* @deprecated. Instead use getFirstName
|
||||||
|
*/
|
||||||
|
public function getFirst_name() {
|
||||||
|
return $this->first_name;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Last Name of the Payer from their PayPal Account.
|
* Last Name of the Payer from their PayPal Account.
|
||||||
* @param string $last_name
|
* @param string $last_name
|
||||||
*/
|
*/
|
||||||
public function setLastName($last_name) {
|
public function setLastName($last_name) {
|
||||||
$this->last_name = $last_name;
|
$this->last_name = $last_name;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Last Name of the Payer from their PayPal Account.
|
* Last Name of the Payer from their PayPal Account.
|
||||||
* @return string
|
* @return string
|
||||||
@@ -50,15 +73,34 @@ class PayerInfo extends \PPModel {
|
|||||||
public function getLastName() {
|
public function getLastName() {
|
||||||
return $this->last_name;
|
return $this->last_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Last Name of the Payer from their PayPal Account.
|
||||||
|
* @param string $last_name
|
||||||
|
* @deprecated. Instead use setLastName
|
||||||
|
*/
|
||||||
|
public function setLast_name($last_name) {
|
||||||
|
$this->last_name = $last_name;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Last Name of the Payer from their PayPal Account.
|
||||||
|
* @return string
|
||||||
|
* @deprecated. Instead use getLastName
|
||||||
|
*/
|
||||||
|
public function getLast_name() {
|
||||||
|
return $this->last_name;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PayPal assigned Payer ID.
|
* PayPal assigned Payer ID.
|
||||||
* @param string $payer_id
|
* @param string $payer_id
|
||||||
*/
|
*/
|
||||||
public function setPayerId($payer_id) {
|
public function setPayerId($payer_id) {
|
||||||
$this->payer_id = $payer_id;
|
$this->payer_id = $payer_id;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PayPal assigned Payer ID.
|
* PayPal assigned Payer ID.
|
||||||
* @return string
|
* @return string
|
||||||
@@ -66,15 +108,34 @@ class PayerInfo extends \PPModel {
|
|||||||
public function getPayerId() {
|
public function getPayerId() {
|
||||||
return $this->payer_id;
|
return $this->payer_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PayPal assigned Payer ID.
|
||||||
|
* @param string $payer_id
|
||||||
|
* @deprecated. Instead use setPayerId
|
||||||
|
*/
|
||||||
|
public function setPayer_id($payer_id) {
|
||||||
|
$this->payer_id = $payer_id;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* PayPal assigned Payer ID.
|
||||||
|
* @return string
|
||||||
|
* @deprecated. Instead use getPayerId
|
||||||
|
*/
|
||||||
|
public function getPayer_id() {
|
||||||
|
return $this->payer_id;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Phone number representing the Payer.
|
* Phone number representing the Payer.
|
||||||
* @param string $phone
|
* @param string $phone
|
||||||
*/
|
*/
|
||||||
public function setPhone($phone) {
|
public function setPhone($phone) {
|
||||||
$this->phone = $phone;
|
$this->phone = $phone;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Phone number representing the Payer.
|
* Phone number representing the Payer.
|
||||||
* @return string
|
* @return string
|
||||||
@@ -82,15 +143,17 @@ class PayerInfo extends \PPModel {
|
|||||||
public function getPhone() {
|
public function getPhone() {
|
||||||
return $this->phone;
|
return $this->phone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shipping address of the Payer from their PayPal Account.
|
* Shipping address of the Payer from their PayPal Account.
|
||||||
* @param PayPal\Api\Address $shipping_address
|
* @param PayPal\Api\Address $shipping_address
|
||||||
*/
|
*/
|
||||||
public function setShippingAddress($shipping_address) {
|
public function setShippingAddress($shipping_address) {
|
||||||
$this->shipping_address = $shipping_address;
|
$this->shipping_address = $shipping_address;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shipping address of the Payer from their PayPal Account.
|
* Shipping address of the Payer from their PayPal Account.
|
||||||
* @return PayPal\Api\Address
|
* @return PayPal\Api\Address
|
||||||
@@ -98,5 +161,23 @@ class PayerInfo extends \PPModel {
|
|||||||
public function getShippingAddress() {
|
public function getShippingAddress() {
|
||||||
return $this->shipping_address;
|
return $this->shipping_address;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shipping address of the Payer from their PayPal Account.
|
||||||
|
* @param PayPal\Api\Address $shipping_address
|
||||||
|
* @deprecated. Instead use setShippingAddress
|
||||||
|
*/
|
||||||
|
public function setShipping_address($shipping_address) {
|
||||||
|
$this->shipping_address = $shipping_address;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Shipping address of the Payer from their PayPal Account.
|
||||||
|
* @return PayPal\Api\Address
|
||||||
|
* @deprecated. Instead use getShippingAddress
|
||||||
|
*/
|
||||||
|
public function getShipping_address() {
|
||||||
|
return $this->shipping_address;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,30 +1,35 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace PayPal\Api;
|
namespace PayPal\Api;
|
||||||
|
|
||||||
|
use PayPal\Common\PPModel;
|
||||||
use PayPal\Rest\IResource;
|
use PayPal\Rest\IResource;
|
||||||
use PayPal\Rest\Call;
|
use PayPal\Rest\Call;
|
||||||
use PayPal\Rest\ApiContext;
|
use PayPal\Rest\ApiContext;
|
||||||
|
use PayPal\Api\Payment;
|
||||||
|
use PayPal\Api\PaymentHistory;
|
||||||
|
use PayPal\Transport\PPRestCall;
|
||||||
|
|
||||||
|
class Payment extends PPModel implements IResource {
|
||||||
|
|
||||||
class Payment extends \PPModel implements IResource {
|
|
||||||
|
|
||||||
private static $credential;
|
private static $credential;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @deprected. Pass ApiContext to create/get methods instead
|
* @deprecated. Pass ApiContext to create/get methods instead
|
||||||
*/
|
*/
|
||||||
public static function setCredential($credential) {
|
public static function setCredential($credential) {
|
||||||
self::$credential = $credential;
|
self::$credential = $credential;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Identifier of the payment resource created.
|
* Identifier of the payment resource created.
|
||||||
* @param string $id
|
* @param string $id
|
||||||
*/
|
*/
|
||||||
public function setId($id) {
|
public function setId($id) {
|
||||||
$this->id = $id;
|
$this->id = $id;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Identifier of the payment resource created.
|
* Identifier of the payment resource created.
|
||||||
* @return string
|
* @return string
|
||||||
@@ -32,15 +37,17 @@ class Payment extends \PPModel implements IResource {
|
|||||||
public function getId() {
|
public function getId() {
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Time the resource was created.
|
* Time the resource was created.
|
||||||
* @param string $create_time
|
* @param string $create_time
|
||||||
*/
|
*/
|
||||||
public function setCreateTime($create_time) {
|
public function setCreateTime($create_time) {
|
||||||
$this->create_time = $create_time;
|
$this->create_time = $create_time;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Time the resource was created.
|
* Time the resource was created.
|
||||||
* @return string
|
* @return string
|
||||||
@@ -48,15 +55,34 @@ class Payment extends \PPModel implements IResource {
|
|||||||
public function getCreateTime() {
|
public function getCreateTime() {
|
||||||
return $this->create_time;
|
return $this->create_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Time the resource was created.
|
||||||
|
* @param string $create_time
|
||||||
|
* @deprecated. Instead use setCreateTime
|
||||||
|
*/
|
||||||
|
public function setCreate_time($create_time) {
|
||||||
|
$this->create_time = $create_time;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Time the resource was created.
|
||||||
|
* @return string
|
||||||
|
* @deprecated. Instead use getCreateTime
|
||||||
|
*/
|
||||||
|
public function getCreate_time() {
|
||||||
|
return $this->create_time;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Time the resource was last updated.
|
* Time the resource was last updated.
|
||||||
* @param string $update_time
|
* @param string $update_time
|
||||||
*/
|
*/
|
||||||
public function setUpdateTime($update_time) {
|
public function setUpdateTime($update_time) {
|
||||||
$this->update_time = $update_time;
|
$this->update_time = $update_time;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Time the resource was last updated.
|
* Time the resource was last updated.
|
||||||
* @return string
|
* @return string
|
||||||
@@ -64,15 +90,34 @@ class Payment extends \PPModel implements IResource {
|
|||||||
public function getUpdateTime() {
|
public function getUpdateTime() {
|
||||||
return $this->update_time;
|
return $this->update_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Time the resource was last updated.
|
||||||
|
* @param string $update_time
|
||||||
|
* @deprecated. Instead use setUpdateTime
|
||||||
|
*/
|
||||||
|
public function setUpdate_time($update_time) {
|
||||||
|
$this->update_time = $update_time;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Time the resource was last updated.
|
||||||
|
* @return string
|
||||||
|
* @deprecated. Instead use getUpdateTime
|
||||||
|
*/
|
||||||
|
public function getUpdate_time() {
|
||||||
|
return $this->update_time;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Intent of the payment - Sale or Authorization or Order.
|
* Intent of the payment - Sale or Authorization or Order.
|
||||||
* @param string $intent
|
* @param string $intent
|
||||||
*/
|
*/
|
||||||
public function setIntent($intent) {
|
public function setIntent($intent) {
|
||||||
$this->intent = $intent;
|
$this->intent = $intent;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Intent of the payment - Sale or Authorization or Order.
|
* Intent of the payment - Sale or Authorization or Order.
|
||||||
* @return string
|
* @return string
|
||||||
@@ -80,15 +125,17 @@ class Payment extends \PPModel implements IResource {
|
|||||||
public function getIntent() {
|
public function getIntent() {
|
||||||
return $this->intent;
|
return $this->intent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Source of the funds for this payment represented by a PayPal account or a direct credit card.
|
* Source of the funds for this payment represented by a PayPal account or a direct credit card.
|
||||||
* @param PayPal\Api\Payer $payer
|
* @param PayPal\Api\Payer $payer
|
||||||
*/
|
*/
|
||||||
public function setPayer($payer) {
|
public function setPayer($payer) {
|
||||||
$this->payer = $payer;
|
$this->payer = $payer;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Source of the funds for this payment represented by a PayPal account or a direct credit card.
|
* Source of the funds for this payment represented by a PayPal account or a direct credit card.
|
||||||
* @return PayPal\Api\Payer
|
* @return PayPal\Api\Payer
|
||||||
@@ -96,7 +143,8 @@ class Payment extends \PPModel implements IResource {
|
|||||||
public function getPayer() {
|
public function getPayer() {
|
||||||
return $this->payer;
|
return $this->payer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A payment can have more than one transaction, with each transaction establishing a contract between the payer and a payee
|
* A payment can have more than one transaction, with each transaction establishing a contract between the payer and a payee
|
||||||
* @array
|
* @array
|
||||||
@@ -104,8 +152,9 @@ class Payment extends \PPModel implements IResource {
|
|||||||
*/
|
*/
|
||||||
public function setTransactions($transactions) {
|
public function setTransactions($transactions) {
|
||||||
$this->transactions = $transactions;
|
$this->transactions = $transactions;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A payment can have more than one transaction, with each transaction establishing a contract between the payer and a payee
|
* A payment can have more than one transaction, with each transaction establishing a contract between the payer and a payee
|
||||||
* @return PayPal\Api\Transaction
|
* @return PayPal\Api\Transaction
|
||||||
@@ -113,15 +162,17 @@ class Payment extends \PPModel implements IResource {
|
|||||||
public function getTransactions() {
|
public function getTransactions() {
|
||||||
return $this->transactions;
|
return $this->transactions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* state of the payment
|
* state of the payment
|
||||||
* @param string $state
|
* @param string $state
|
||||||
*/
|
*/
|
||||||
public function setState($state) {
|
public function setState($state) {
|
||||||
$this->state = $state;
|
$this->state = $state;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* state of the payment
|
* state of the payment
|
||||||
* @return string
|
* @return string
|
||||||
@@ -129,15 +180,17 @@ class Payment extends \PPModel implements IResource {
|
|||||||
public function getState() {
|
public function getState() {
|
||||||
return $this->state;
|
return $this->state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Redirect urls required only when using payment_method as PayPal - the only settings supported are return and cancel urls.
|
* Redirect urls required only when using payment_method as PayPal - the only settings supported are return and cancel urls.
|
||||||
* @param PayPal\Api\RedirectUrls $redirect_urls
|
* @param PayPal\Api\RedirectUrls $redirect_urls
|
||||||
*/
|
*/
|
||||||
public function setRedirectUrls($redirect_urls) {
|
public function setRedirectUrls($redirect_urls) {
|
||||||
$this->redirect_urls = $redirect_urls;
|
$this->redirect_urls = $redirect_urls;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Redirect urls required only when using payment_method as PayPal - the only settings supported are return and cancel urls.
|
* Redirect urls required only when using payment_method as PayPal - the only settings supported are return and cancel urls.
|
||||||
* @return PayPal\Api\RedirectUrls
|
* @return PayPal\Api\RedirectUrls
|
||||||
@@ -145,7 +198,25 @@ class Payment extends \PPModel implements IResource {
|
|||||||
public function getRedirectUrls() {
|
public function getRedirectUrls() {
|
||||||
return $this->redirect_urls;
|
return $this->redirect_urls;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Redirect urls required only when using payment_method as PayPal - the only settings supported are return and cancel urls.
|
||||||
|
* @param PayPal\Api\RedirectUrls $redirect_urls
|
||||||
|
* @deprecated. Instead use setRedirectUrls
|
||||||
|
*/
|
||||||
|
public function setRedirect_urls($redirect_urls) {
|
||||||
|
$this->redirect_urls = $redirect_urls;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Redirect urls required only when using payment_method as PayPal - the only settings supported are return and cancel urls.
|
||||||
|
* @return PayPal\Api\RedirectUrls
|
||||||
|
* @deprecated. Instead use getRedirectUrls
|
||||||
|
*/
|
||||||
|
public function getRedirect_urls() {
|
||||||
|
return $this->redirect_urls;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @array
|
* @array
|
||||||
@@ -153,8 +224,9 @@ class Payment extends \PPModel implements IResource {
|
|||||||
*/
|
*/
|
||||||
public function setLinks($links) {
|
public function setLinks($links) {
|
||||||
$this->links = $links;
|
$this->links = $links;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return PayPal\Api\Links
|
* @return PayPal\Api\Links
|
||||||
@@ -162,14 +234,15 @@ class Payment extends \PPModel implements IResource {
|
|||||||
public function getLinks() {
|
public function getLinks() {
|
||||||
return $this->links;
|
return $this->links;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function create($apiContext = null) {
|
public function create($apiContext = null) {
|
||||||
$payLoad = $this->toJSON();
|
$payLoad = $this->toJSON();
|
||||||
if ($apiContext == null) {
|
if ($apiContext == null) {
|
||||||
$apiContext = new ApiContext(self::$credential);
|
$apiContext = new ApiContext(self::$credential);
|
||||||
}
|
}
|
||||||
$call = new \PPRestCall($apiContext);
|
$call = new PPRestCall($apiContext);
|
||||||
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payments/payment", "POST", $payLoad);
|
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payments/payment", "POST", $payLoad);
|
||||||
$this->fromJson($json);
|
$this->fromJson($json);
|
||||||
return $this;
|
return $this;
|
||||||
@@ -183,7 +256,7 @@ class Payment extends \PPModel implements IResource {
|
|||||||
if ($apiContext == null) {
|
if ($apiContext == null) {
|
||||||
$apiContext = new ApiContext(self::$credential);
|
$apiContext = new ApiContext(self::$credential);
|
||||||
}
|
}
|
||||||
$call = new \PPRestCall($apiContext);
|
$call = new PPRestCall($apiContext);
|
||||||
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payments/payment/$paymentId", "GET", $payLoad);
|
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payments/payment/$paymentId", "GET", $payLoad);
|
||||||
$ret = new Payment();
|
$ret = new Payment();
|
||||||
$ret->fromJson($json);
|
$ret->fromJson($json);
|
||||||
@@ -201,7 +274,7 @@ class Payment extends \PPModel implements IResource {
|
|||||||
if ($apiContext == null) {
|
if ($apiContext == null) {
|
||||||
$apiContext = new ApiContext(self::$credential);
|
$apiContext = new ApiContext(self::$credential);
|
||||||
}
|
}
|
||||||
$call = new \PPRestCall($apiContext);
|
$call = new PPRestCall($apiContext);
|
||||||
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payments/payment/{$this->getId()}/execute", "POST", $payLoad);
|
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payments/payment/{$this->getId()}/execute", "POST", $payLoad);
|
||||||
$ret = new Payment();
|
$ret = new Payment();
|
||||||
$ret->fromJson($json);
|
$ret->fromJson($json);
|
||||||
@@ -217,7 +290,7 @@ class Payment extends \PPModel implements IResource {
|
|||||||
if ($apiContext == null) {
|
if ($apiContext == null) {
|
||||||
$apiContext = new ApiContext(self::$credential);
|
$apiContext = new ApiContext(self::$credential);
|
||||||
}
|
}
|
||||||
$call = new \PPRestCall($apiContext);
|
$call = new PPRestCall($apiContext);
|
||||||
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payments/payment?" . http_build_query(array_intersect_key($params, $allowedParams)), "GET", $payLoad);
|
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payments/payment?" . http_build_query(array_intersect_key($params, $allowedParams)), "GET", $payLoad);
|
||||||
$ret = new PaymentHistory();
|
$ret = new PaymentHistory();
|
||||||
$ret->fromJson($json);
|
$ret->fromJson($json);
|
||||||
|
|||||||
@@ -1,16 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace PayPal\Api;
|
namespace PayPal\Api;
|
||||||
|
|
||||||
|
use PayPal\Common\PPModel;
|
||||||
|
|
||||||
class PaymentExecution extends \PPModel {
|
class PaymentExecution extends PPModel {
|
||||||
/**
|
/**
|
||||||
* PayPal assigned Payer ID returned in the approval return url.
|
* PayPal assigned Payer ID returned in the approval return url.
|
||||||
* @param string $payer_id
|
* @param string $payer_id
|
||||||
*/
|
*/
|
||||||
public function setPayerId($payer_id) {
|
public function setPayerId($payer_id) {
|
||||||
$this->payer_id = $payer_id;
|
$this->payer_id = $payer_id;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PayPal assigned Payer ID returned in the approval return url.
|
* PayPal assigned Payer ID returned in the approval return url.
|
||||||
* @return string
|
* @return string
|
||||||
@@ -18,7 +20,25 @@ class PaymentExecution extends \PPModel {
|
|||||||
public function getPayerId() {
|
public function getPayerId() {
|
||||||
return $this->payer_id;
|
return $this->payer_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PayPal assigned Payer ID returned in the approval return url.
|
||||||
|
* @param string $payer_id
|
||||||
|
* @deprecated. Instead use setPayerId
|
||||||
|
*/
|
||||||
|
public function setPayer_id($payer_id) {
|
||||||
|
$this->payer_id = $payer_id;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* PayPal assigned Payer ID returned in the approval return url.
|
||||||
|
* @return string
|
||||||
|
* @deprecated. Instead use getPayerId
|
||||||
|
*/
|
||||||
|
public function getPayer_id() {
|
||||||
|
return $this->payer_id;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If the amount needs to be updated after obtaining the PayPal Payer info (eg. shipping address), it can be updated using this element.
|
* If the amount needs to be updated after obtaining the PayPal Payer info (eg. shipping address), it can be updated using this element.
|
||||||
* @array
|
* @array
|
||||||
@@ -26,8 +46,9 @@ class PaymentExecution extends \PPModel {
|
|||||||
*/
|
*/
|
||||||
public function setTransactions($transactions) {
|
public function setTransactions($transactions) {
|
||||||
$this->transactions = $transactions;
|
$this->transactions = $transactions;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If the amount needs to be updated after obtaining the PayPal Payer info (eg. shipping address), it can be updated using this element.
|
* If the amount needs to be updated after obtaining the PayPal Payer info (eg. shipping address), it can be updated using this element.
|
||||||
* @return PayPal\Api\Transactions
|
* @return PayPal\Api\Transactions
|
||||||
@@ -35,5 +56,6 @@ class PaymentExecution extends \PPModel {
|
|||||||
public function getTransactions() {
|
public function getTransactions() {
|
||||||
return $this->transactions;
|
return $this->transactions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace PayPal\Api;
|
namespace PayPal\Api;
|
||||||
|
|
||||||
|
use PayPal\Common\PPModel;
|
||||||
|
|
||||||
class PaymentHistory extends \PPModel {
|
class PaymentHistory extends PPModel {
|
||||||
/**
|
/**
|
||||||
* A list of Payment resources
|
* A list of Payment resources
|
||||||
* @array
|
* @array
|
||||||
@@ -10,8 +11,9 @@ class PaymentHistory extends \PPModel {
|
|||||||
*/
|
*/
|
||||||
public function setPayments($payments) {
|
public function setPayments($payments) {
|
||||||
$this->payments = $payments;
|
$this->payments = $payments;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A list of Payment resources
|
* A list of Payment resources
|
||||||
* @return PayPal\Api\Payment
|
* @return PayPal\Api\Payment
|
||||||
@@ -19,15 +21,17 @@ class PaymentHistory extends \PPModel {
|
|||||||
public function getPayments() {
|
public function getPayments() {
|
||||||
return $this->payments;
|
return $this->payments;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Number of items returned in each range of results. Note that the last results range could have fewer items than the requested number of items.
|
* Number of items returned in each range of results. Note that the last results range could have fewer items than the requested number of items.
|
||||||
* @param integer $count
|
* @param integer $count
|
||||||
*/
|
*/
|
||||||
public function setCount($count) {
|
public function setCount($count) {
|
||||||
$this->count = $count;
|
$this->count = $count;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Number of items returned in each range of results. Note that the last results range could have fewer items than the requested number of items.
|
* Number of items returned in each range of results. Note that the last results range could have fewer items than the requested number of items.
|
||||||
* @return integer
|
* @return integer
|
||||||
@@ -35,15 +39,17 @@ class PaymentHistory extends \PPModel {
|
|||||||
public function getCount() {
|
public function getCount() {
|
||||||
return $this->count;
|
return $this->count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Identifier of the next element to get the next range of results.
|
* Identifier of the next element to get the next range of results.
|
||||||
* @param string $next_id
|
* @param string $next_id
|
||||||
*/
|
*/
|
||||||
public function setNextId($next_id) {
|
public function setNextId($next_id) {
|
||||||
$this->next_id = $next_id;
|
$this->next_id = $next_id;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Identifier of the next element to get the next range of results.
|
* Identifier of the next element to get the next range of results.
|
||||||
* @return string
|
* @return string
|
||||||
@@ -51,5 +57,23 @@ class PaymentHistory extends \PPModel {
|
|||||||
public function getNextId() {
|
public function getNextId() {
|
||||||
return $this->next_id;
|
return $this->next_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Identifier of the next element to get the next range of results.
|
||||||
|
* @param string $next_id
|
||||||
|
* @deprecated. Instead use setNextId
|
||||||
|
*/
|
||||||
|
public function setNext_id($next_id) {
|
||||||
|
$this->next_id = $next_id;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Identifier of the next element to get the next range of results.
|
||||||
|
* @return string
|
||||||
|
* @deprecated. Instead use getNextId
|
||||||
|
*/
|
||||||
|
public function getNext_id() {
|
||||||
|
return $this->next_id;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace PayPal\Api;
|
namespace PayPal\Api;
|
||||||
|
|
||||||
|
use PayPal\Common\PPModel;
|
||||||
|
|
||||||
class RedirectUrls extends \PPModel {
|
class RedirectUrls extends PPModel {
|
||||||
/**
|
/**
|
||||||
* Url where the payer would be redirected to after approving the payment.
|
* Url where the payer would be redirected to after approving the payment.
|
||||||
* @param string $return_url
|
* @param string $return_url
|
||||||
*/
|
*/
|
||||||
public function setReturnUrl($return_url) {
|
public function setReturnUrl($return_url) {
|
||||||
$this->return_url = $return_url;
|
$this->return_url = $return_url;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Url where the payer would be redirected to after approving the payment.
|
* Url where the payer would be redirected to after approving the payment.
|
||||||
* @return string
|
* @return string
|
||||||
@@ -18,15 +20,34 @@ class RedirectUrls extends \PPModel {
|
|||||||
public function getReturnUrl() {
|
public function getReturnUrl() {
|
||||||
return $this->return_url;
|
return $this->return_url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Url where the payer would be redirected to after approving the payment.
|
||||||
|
* @param string $return_url
|
||||||
|
* @deprecated. Instead use setReturnUrl
|
||||||
|
*/
|
||||||
|
public function setReturn_url($return_url) {
|
||||||
|
$this->return_url = $return_url;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Url where the payer would be redirected to after approving the payment.
|
||||||
|
* @return string
|
||||||
|
* @deprecated. Instead use getReturnUrl
|
||||||
|
*/
|
||||||
|
public function getReturn_url() {
|
||||||
|
return $this->return_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.
|
||||||
* @param string $cancel_url
|
* @param string $cancel_url
|
||||||
*/
|
*/
|
||||||
public function setCancelUrl($cancel_url) {
|
public function setCancelUrl($cancel_url) {
|
||||||
$this->cancel_url = $cancel_url;
|
$this->cancel_url = $cancel_url;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Url where the payer would be redirected to after canceling the payment.
|
* Url where the payer would be redirected to after canceling the payment.
|
||||||
* @return string
|
* @return string
|
||||||
@@ -34,5 +55,23 @@ class RedirectUrls extends \PPModel {
|
|||||||
public function getCancelUrl() {
|
public function getCancelUrl() {
|
||||||
return $this->cancel_url;
|
return $this->cancel_url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Url where the payer would be redirected to after canceling the payment.
|
||||||
|
* @param string $cancel_url
|
||||||
|
* @deprecated. Instead use setCancelUrl
|
||||||
|
*/
|
||||||
|
public function setCancel_url($cancel_url) {
|
||||||
|
$this->cancel_url = $cancel_url;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Url where the payer would be redirected to after canceling the payment.
|
||||||
|
* @return string
|
||||||
|
* @deprecated. Instead use getCancelUrl
|
||||||
|
*/
|
||||||
|
public function getCancel_url() {
|
||||||
|
return $this->cancel_url;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,30 +1,34 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace PayPal\Api;
|
namespace PayPal\Api;
|
||||||
|
|
||||||
|
use PayPal\Common\PPModel;
|
||||||
use PayPal\Rest\IResource;
|
use PayPal\Rest\IResource;
|
||||||
use PayPal\Rest\Call;
|
use PayPal\Rest\Call;
|
||||||
use PayPal\Rest\ApiContext;
|
use PayPal\Rest\ApiContext;
|
||||||
|
use PayPal\Api\Refund;
|
||||||
|
use PayPal\Transport\PPRestCall;
|
||||||
|
|
||||||
|
class Refund extends PPModel implements IResource {
|
||||||
|
|
||||||
class Refund extends \PPModel implements IResource {
|
|
||||||
|
|
||||||
private static $credential;
|
private static $credential;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @deprected. Pass ApiContext to create/get methods instead
|
* @deprecated. Pass ApiContext to create/get methods instead
|
||||||
*/
|
*/
|
||||||
public static function setCredential($credential) {
|
public static function setCredential($credential) {
|
||||||
self::$credential = $credential;
|
self::$credential = $credential;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Identifier of the refund transaction.
|
* Identifier of the refund transaction.
|
||||||
* @param string $id
|
* @param string $id
|
||||||
*/
|
*/
|
||||||
public function setId($id) {
|
public function setId($id) {
|
||||||
$this->id = $id;
|
$this->id = $id;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Identifier of the refund transaction.
|
* Identifier of the refund transaction.
|
||||||
* @return string
|
* @return string
|
||||||
@@ -32,15 +36,17 @@ class Refund extends \PPModel implements IResource {
|
|||||||
public function getId() {
|
public function getId() {
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Time the resource was created.
|
* Time the resource was created.
|
||||||
* @param string $create_time
|
* @param string $create_time
|
||||||
*/
|
*/
|
||||||
public function setCreateTime($create_time) {
|
public function setCreateTime($create_time) {
|
||||||
$this->create_time = $create_time;
|
$this->create_time = $create_time;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Time the resource was created.
|
* Time the resource was created.
|
||||||
* @return string
|
* @return string
|
||||||
@@ -48,15 +54,34 @@ class Refund extends \PPModel implements IResource {
|
|||||||
public function getCreateTime() {
|
public function getCreateTime() {
|
||||||
return $this->create_time;
|
return $this->create_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Time the resource was created.
|
||||||
|
* @param string $create_time
|
||||||
|
* @deprecated. Instead use setCreateTime
|
||||||
|
*/
|
||||||
|
public function setCreate_time($create_time) {
|
||||||
|
$this->create_time = $create_time;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Time the resource was created.
|
||||||
|
* @return string
|
||||||
|
* @deprecated. Instead use getCreateTime
|
||||||
|
*/
|
||||||
|
public function getCreate_time() {
|
||||||
|
return $this->create_time;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Details including both refunded amount (to Payer) and refunded fee (to Payee).If amount is not specified, it's assumed to be full refund.
|
* Details including both refunded amount (to Payer) and refunded fee (to Payee).If amount is not specified, it's assumed to be full refund.
|
||||||
* @param PayPal\Api\Amount $amount
|
* @param PayPal\Api\Amount $amount
|
||||||
*/
|
*/
|
||||||
public function setAmount($amount) {
|
public function setAmount($amount) {
|
||||||
$this->amount = $amount;
|
$this->amount = $amount;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Details including both refunded amount (to Payer) and refunded fee (to Payee).If amount is not specified, it's assumed to be full refund.
|
* Details including both refunded amount (to Payer) and refunded fee (to Payee).If amount is not specified, it's assumed to be full refund.
|
||||||
* @return PayPal\Api\Amount
|
* @return PayPal\Api\Amount
|
||||||
@@ -64,15 +89,17 @@ class Refund extends \PPModel implements IResource {
|
|||||||
public function getAmount() {
|
public function getAmount() {
|
||||||
return $this->amount;
|
return $this->amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* State of the refund transaction.
|
* State of the refund transaction.
|
||||||
* @param string $state
|
* @param string $state
|
||||||
*/
|
*/
|
||||||
public function setState($state) {
|
public function setState($state) {
|
||||||
$this->state = $state;
|
$this->state = $state;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* State of the refund transaction.
|
* State of the refund transaction.
|
||||||
* @return string
|
* @return string
|
||||||
@@ -80,15 +107,17 @@ class Refund extends \PPModel implements IResource {
|
|||||||
public function getState() {
|
public function getState() {
|
||||||
return $this->state;
|
return $this->state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ID of the Sale transaction being refunded.
|
* ID of the Sale transaction being refunded.
|
||||||
* @param string $sale_id
|
* @param string $sale_id
|
||||||
*/
|
*/
|
||||||
public function setSaleId($sale_id) {
|
public function setSaleId($sale_id) {
|
||||||
$this->sale_id = $sale_id;
|
$this->sale_id = $sale_id;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ID of the Sale transaction being refunded.
|
* ID of the Sale transaction being refunded.
|
||||||
* @return string
|
* @return string
|
||||||
@@ -96,15 +125,34 @@ class Refund extends \PPModel implements IResource {
|
|||||||
public function getSaleId() {
|
public function getSaleId() {
|
||||||
return $this->sale_id;
|
return $this->sale_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ID of the Sale transaction being refunded.
|
||||||
|
* @param string $sale_id
|
||||||
|
* @deprecated. Instead use setSaleId
|
||||||
|
*/
|
||||||
|
public function setSale_id($sale_id) {
|
||||||
|
$this->sale_id = $sale_id;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* ID of the Sale transaction being refunded.
|
||||||
|
* @return string
|
||||||
|
* @deprecated. Instead use getSaleId
|
||||||
|
*/
|
||||||
|
public function getSale_id() {
|
||||||
|
return $this->sale_id;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ID of the Capture transaction being refunded.
|
* ID of the Capture transaction being refunded.
|
||||||
* @param string $capture_id
|
* @param string $capture_id
|
||||||
*/
|
*/
|
||||||
public function setCaptureId($capture_id) {
|
public function setCaptureId($capture_id) {
|
||||||
$this->capture_id = $capture_id;
|
$this->capture_id = $capture_id;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ID of the Capture transaction being refunded.
|
* ID of the Capture transaction being refunded.
|
||||||
* @return string
|
* @return string
|
||||||
@@ -112,15 +160,34 @@ class Refund extends \PPModel implements IResource {
|
|||||||
public function getCaptureId() {
|
public function getCaptureId() {
|
||||||
return $this->capture_id;
|
return $this->capture_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ID of the Capture transaction being refunded.
|
||||||
|
* @param string $capture_id
|
||||||
|
* @deprecated. Instead use setCaptureId
|
||||||
|
*/
|
||||||
|
public function setCapture_id($capture_id) {
|
||||||
|
$this->capture_id = $capture_id;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* ID of the Capture transaction being refunded.
|
||||||
|
* @return string
|
||||||
|
* @deprecated. Instead use getCaptureId
|
||||||
|
*/
|
||||||
|
public function getCapture_id() {
|
||||||
|
return $this->capture_id;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ID of the Payment resource that this transaction is based on.
|
* ID of the Payment resource that this transaction is based on.
|
||||||
* @param string $parent_payment
|
* @param string $parent_payment
|
||||||
*/
|
*/
|
||||||
public function setParentPayment($parent_payment) {
|
public function setParentPayment($parent_payment) {
|
||||||
$this->parent_payment = $parent_payment;
|
$this->parent_payment = $parent_payment;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ID of the Payment resource that this transaction is based on.
|
* ID of the Payment resource that this transaction is based on.
|
||||||
* @return string
|
* @return string
|
||||||
@@ -128,7 +195,25 @@ class Refund extends \PPModel implements IResource {
|
|||||||
public function getParentPayment() {
|
public function getParentPayment() {
|
||||||
return $this->parent_payment;
|
return $this->parent_payment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ID of the Payment resource that this transaction is based on.
|
||||||
|
* @param string $parent_payment
|
||||||
|
* @deprecated. Instead use setParentPayment
|
||||||
|
*/
|
||||||
|
public function setParent_payment($parent_payment) {
|
||||||
|
$this->parent_payment = $parent_payment;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* ID of the Payment resource that this transaction is based on.
|
||||||
|
* @return string
|
||||||
|
* @deprecated. Instead use getParentPayment
|
||||||
|
*/
|
||||||
|
public function getParent_payment() {
|
||||||
|
return $this->parent_payment;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @array
|
* @array
|
||||||
@@ -136,8 +221,9 @@ class Refund extends \PPModel implements IResource {
|
|||||||
*/
|
*/
|
||||||
public function setLinks($links) {
|
public function setLinks($links) {
|
||||||
$this->links = $links;
|
$this->links = $links;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return PayPal\Api\Links
|
* @return PayPal\Api\Links
|
||||||
@@ -145,7 +231,8 @@ class Refund extends \PPModel implements IResource {
|
|||||||
public function getLinks() {
|
public function getLinks() {
|
||||||
return $this->links;
|
return $this->links;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static function get($refundId, $apiContext = null) {
|
public static function get($refundId, $apiContext = null) {
|
||||||
if (($refundId == null) || (strlen($refundId) <= 0)) {
|
if (($refundId == null) || (strlen($refundId) <= 0)) {
|
||||||
@@ -155,7 +242,7 @@ class Refund extends \PPModel implements IResource {
|
|||||||
if ($apiContext == null) {
|
if ($apiContext == null) {
|
||||||
$apiContext = new ApiContext(self::$credential);
|
$apiContext = new ApiContext(self::$credential);
|
||||||
}
|
}
|
||||||
$call = new \PPRestCall($apiContext);
|
$call = new PPRestCall($apiContext);
|
||||||
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payments/refund/$refundId", "GET", $payLoad);
|
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payments/refund/$refundId", "GET", $payLoad);
|
||||||
$ret = new Refund();
|
$ret = new Refund();
|
||||||
$ret->fromJson($json);
|
$ret->fromJson($json);
|
||||||
|
|||||||
@@ -1,16 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace PayPal\Api;
|
namespace PayPal\Api;
|
||||||
|
|
||||||
|
use PayPal\Common\PPModel;
|
||||||
|
|
||||||
class RelatedResources extends \PPModel {
|
class RelatedResources extends PPModel {
|
||||||
/**
|
/**
|
||||||
* A sale transaction
|
* A sale transaction
|
||||||
* @param PayPal\Api\Sale $sale
|
* @param PayPal\Api\Sale $sale
|
||||||
*/
|
*/
|
||||||
public function setSale($sale) {
|
public function setSale($sale) {
|
||||||
$this->sale = $sale;
|
$this->sale = $sale;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A sale transaction
|
* A sale transaction
|
||||||
* @return PayPal\Api\Sale
|
* @return PayPal\Api\Sale
|
||||||
@@ -18,15 +20,17 @@ class RelatedResources extends \PPModel {
|
|||||||
public function getSale() {
|
public function getSale() {
|
||||||
return $this->sale;
|
return $this->sale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An authorization transaction
|
* An authorization transaction
|
||||||
* @param PayPal\Api\Authorization $authorization
|
* @param PayPal\Api\Authorization $authorization
|
||||||
*/
|
*/
|
||||||
public function setAuthorization($authorization) {
|
public function setAuthorization($authorization) {
|
||||||
$this->authorization = $authorization;
|
$this->authorization = $authorization;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An authorization transaction
|
* An authorization transaction
|
||||||
* @return PayPal\Api\Authorization
|
* @return PayPal\Api\Authorization
|
||||||
@@ -34,15 +38,17 @@ class RelatedResources extends \PPModel {
|
|||||||
public function getAuthorization() {
|
public function getAuthorization() {
|
||||||
return $this->authorization;
|
return $this->authorization;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A capture transaction
|
* A capture transaction
|
||||||
* @param PayPal\Api\Capture $capture
|
* @param PayPal\Api\Capture $capture
|
||||||
*/
|
*/
|
||||||
public function setCapture($capture) {
|
public function setCapture($capture) {
|
||||||
$this->capture = $capture;
|
$this->capture = $capture;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A capture transaction
|
* A capture transaction
|
||||||
* @return PayPal\Api\Capture
|
* @return PayPal\Api\Capture
|
||||||
@@ -50,15 +56,17 @@ class RelatedResources extends \PPModel {
|
|||||||
public function getCapture() {
|
public function getCapture() {
|
||||||
return $this->capture;
|
return $this->capture;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A refund transaction
|
* A refund transaction
|
||||||
* @param PayPal\Api\Refund $refund
|
* @param PayPal\Api\Refund $refund
|
||||||
*/
|
*/
|
||||||
public function setRefund($refund) {
|
public function setRefund($refund) {
|
||||||
$this->refund = $refund;
|
$this->refund = $refund;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A refund transaction
|
* A refund transaction
|
||||||
* @return PayPal\Api\Refund
|
* @return PayPal\Api\Refund
|
||||||
@@ -66,5 +74,6 @@ class RelatedResources extends \PPModel {
|
|||||||
public function getRefund() {
|
public function getRefund() {
|
||||||
return $this->refund;
|
return $this->refund;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,30 +1,35 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace PayPal\Api;
|
namespace PayPal\Api;
|
||||||
|
|
||||||
|
use PayPal\Common\PPModel;
|
||||||
use PayPal\Rest\IResource;
|
use PayPal\Rest\IResource;
|
||||||
use PayPal\Rest\Call;
|
use PayPal\Rest\Call;
|
||||||
use PayPal\Rest\ApiContext;
|
use PayPal\Rest\ApiContext;
|
||||||
|
use PayPal\Api\Sale;
|
||||||
|
use PayPal\Api\Refund;
|
||||||
|
use PayPal\Transport\PPRestCall;
|
||||||
|
|
||||||
|
class Sale extends PPModel implements IResource {
|
||||||
|
|
||||||
class Sale extends \PPModel implements IResource {
|
|
||||||
|
|
||||||
private static $credential;
|
private static $credential;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @deprected. Pass ApiContext to create/get methods instead
|
* @deprecated. Pass ApiContext to create/get methods instead
|
||||||
*/
|
*/
|
||||||
public static function setCredential($credential) {
|
public static function setCredential($credential) {
|
||||||
self::$credential = $credential;
|
self::$credential = $credential;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Identifier of the authorization transaction.
|
* Identifier of the authorization transaction.
|
||||||
* @param string $id
|
* @param string $id
|
||||||
*/
|
*/
|
||||||
public function setId($id) {
|
public function setId($id) {
|
||||||
$this->id = $id;
|
$this->id = $id;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Identifier of the authorization transaction.
|
* Identifier of the authorization transaction.
|
||||||
* @return string
|
* @return string
|
||||||
@@ -32,15 +37,17 @@ class Sale extends \PPModel implements IResource {
|
|||||||
public function getId() {
|
public function getId() {
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Time the resource was created.
|
* Time the resource was created.
|
||||||
* @param string $create_time
|
* @param string $create_time
|
||||||
*/
|
*/
|
||||||
public function setCreateTime($create_time) {
|
public function setCreateTime($create_time) {
|
||||||
$this->create_time = $create_time;
|
$this->create_time = $create_time;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Time the resource was created.
|
* Time the resource was created.
|
||||||
* @return string
|
* @return string
|
||||||
@@ -48,15 +55,34 @@ class Sale extends \PPModel implements IResource {
|
|||||||
public function getCreateTime() {
|
public function getCreateTime() {
|
||||||
return $this->create_time;
|
return $this->create_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Time the resource was created.
|
||||||
|
* @param string $create_time
|
||||||
|
* @deprecated. Instead use setCreateTime
|
||||||
|
*/
|
||||||
|
public function setCreate_time($create_time) {
|
||||||
|
$this->create_time = $create_time;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Time the resource was created.
|
||||||
|
* @return string
|
||||||
|
* @deprecated. Instead use getCreateTime
|
||||||
|
*/
|
||||||
|
public function getCreate_time() {
|
||||||
|
return $this->create_time;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Time the resource was last updated.
|
* Time the resource was last updated.
|
||||||
* @param string $update_time
|
* @param string $update_time
|
||||||
*/
|
*/
|
||||||
public function setUpdateTime($update_time) {
|
public function setUpdateTime($update_time) {
|
||||||
$this->update_time = $update_time;
|
$this->update_time = $update_time;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Time the resource was last updated.
|
* Time the resource was last updated.
|
||||||
* @return string
|
* @return string
|
||||||
@@ -64,15 +90,34 @@ class Sale extends \PPModel implements IResource {
|
|||||||
public function getUpdateTime() {
|
public function getUpdateTime() {
|
||||||
return $this->update_time;
|
return $this->update_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Time the resource was last updated.
|
||||||
|
* @param string $update_time
|
||||||
|
* @deprecated. Instead use setUpdateTime
|
||||||
|
*/
|
||||||
|
public function setUpdate_time($update_time) {
|
||||||
|
$this->update_time = $update_time;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Time the resource was last updated.
|
||||||
|
* @return string
|
||||||
|
* @deprecated. Instead use getUpdateTime
|
||||||
|
*/
|
||||||
|
public function getUpdate_time() {
|
||||||
|
return $this->update_time;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Amount being collected.
|
* Amount being collected.
|
||||||
* @param PayPal\Api\Amount $amount
|
* @param PayPal\Api\Amount $amount
|
||||||
*/
|
*/
|
||||||
public function setAmount($amount) {
|
public function setAmount($amount) {
|
||||||
$this->amount = $amount;
|
$this->amount = $amount;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Amount being collected.
|
* Amount being collected.
|
||||||
* @return PayPal\Api\Amount
|
* @return PayPal\Api\Amount
|
||||||
@@ -80,15 +125,17 @@ class Sale extends \PPModel implements IResource {
|
|||||||
public function getAmount() {
|
public function getAmount() {
|
||||||
return $this->amount;
|
return $this->amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* State of the sale transaction.
|
* State of the sale transaction.
|
||||||
* @param string $state
|
* @param string $state
|
||||||
*/
|
*/
|
||||||
public function setState($state) {
|
public function setState($state) {
|
||||||
$this->state = $state;
|
$this->state = $state;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* State of the sale transaction.
|
* State of the sale transaction.
|
||||||
* @return string
|
* @return string
|
||||||
@@ -96,15 +143,17 @@ class Sale extends \PPModel implements IResource {
|
|||||||
public function getState() {
|
public function getState() {
|
||||||
return $this->state;
|
return $this->state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ID of the Payment resource that this transaction is based on.
|
* ID of the Payment resource that this transaction is based on.
|
||||||
* @param string $parent_payment
|
* @param string $parent_payment
|
||||||
*/
|
*/
|
||||||
public function setParentPayment($parent_payment) {
|
public function setParentPayment($parent_payment) {
|
||||||
$this->parent_payment = $parent_payment;
|
$this->parent_payment = $parent_payment;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ID of the Payment resource that this transaction is based on.
|
* ID of the Payment resource that this transaction is based on.
|
||||||
* @return string
|
* @return string
|
||||||
@@ -112,7 +161,25 @@ class Sale extends \PPModel implements IResource {
|
|||||||
public function getParentPayment() {
|
public function getParentPayment() {
|
||||||
return $this->parent_payment;
|
return $this->parent_payment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ID of the Payment resource that this transaction is based on.
|
||||||
|
* @param string $parent_payment
|
||||||
|
* @deprecated. Instead use setParentPayment
|
||||||
|
*/
|
||||||
|
public function setParent_payment($parent_payment) {
|
||||||
|
$this->parent_payment = $parent_payment;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* ID of the Payment resource that this transaction is based on.
|
||||||
|
* @return string
|
||||||
|
* @deprecated. Instead use getParentPayment
|
||||||
|
*/
|
||||||
|
public function getParent_payment() {
|
||||||
|
return $this->parent_payment;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @array
|
* @array
|
||||||
@@ -120,8 +187,9 @@ class Sale extends \PPModel implements IResource {
|
|||||||
*/
|
*/
|
||||||
public function setLinks($links) {
|
public function setLinks($links) {
|
||||||
$this->links = $links;
|
$this->links = $links;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return PayPal\Api\Links
|
* @return PayPal\Api\Links
|
||||||
@@ -129,7 +197,8 @@ class Sale extends \PPModel implements IResource {
|
|||||||
public function getLinks() {
|
public function getLinks() {
|
||||||
return $this->links;
|
return $this->links;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static function get($saleId, $apiContext = null) {
|
public static function get($saleId, $apiContext = null) {
|
||||||
if (($saleId == null) || (strlen($saleId) <= 0)) {
|
if (($saleId == null) || (strlen($saleId) <= 0)) {
|
||||||
@@ -139,7 +208,7 @@ class Sale extends \PPModel implements IResource {
|
|||||||
if ($apiContext == null) {
|
if ($apiContext == null) {
|
||||||
$apiContext = new ApiContext(self::$credential);
|
$apiContext = new ApiContext(self::$credential);
|
||||||
}
|
}
|
||||||
$call = new \PPRestCall($apiContext);
|
$call = new PPRestCall($apiContext);
|
||||||
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payments/sale/$saleId", "GET", $payLoad);
|
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payments/sale/$saleId", "GET", $payLoad);
|
||||||
$ret = new Sale();
|
$ret = new Sale();
|
||||||
$ret->fromJson($json);
|
$ret->fromJson($json);
|
||||||
@@ -157,7 +226,7 @@ class Sale extends \PPModel implements IResource {
|
|||||||
if ($apiContext == null) {
|
if ($apiContext == null) {
|
||||||
$apiContext = new ApiContext(self::$credential);
|
$apiContext = new ApiContext(self::$credential);
|
||||||
}
|
}
|
||||||
$call = new \PPRestCall($apiContext);
|
$call = new PPRestCall($apiContext);
|
||||||
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payments/sale/{$this->getId()}/refund", "POST", $payLoad);
|
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payments/sale/{$this->getId()}/refund", "POST", $payLoad);
|
||||||
$ret = new Refund();
|
$ret = new Refund();
|
||||||
$ret->fromJson($json);
|
$ret->fromJson($json);
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace PayPal\Api;
|
namespace PayPal\Api;
|
||||||
|
|
||||||
|
use PayPal\Common\PPModel;
|
||||||
|
|
||||||
class ShippingAddress extends Address {
|
class ShippingAddress extends Address {
|
||||||
/**
|
/**
|
||||||
@@ -9,8 +10,9 @@ class ShippingAddress extends Address {
|
|||||||
*/
|
*/
|
||||||
public function setRecipientName($recipient_name) {
|
public function setRecipientName($recipient_name) {
|
||||||
$this->recipient_name = $recipient_name;
|
$this->recipient_name = $recipient_name;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Name of the recipient at this address.
|
* Name of the recipient at this address.
|
||||||
* @return string
|
* @return string
|
||||||
@@ -18,5 +20,23 @@ class ShippingAddress extends Address {
|
|||||||
public function getRecipientName() {
|
public function getRecipientName() {
|
||||||
return $this->recipient_name;
|
return $this->recipient_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Name of the recipient at this address.
|
||||||
|
* @param string $recipient_name
|
||||||
|
* @deprecated. Instead use setRecipientName
|
||||||
|
*/
|
||||||
|
public function setRecipient_name($recipient_name) {
|
||||||
|
$this->recipient_name = $recipient_name;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Name of the recipient at this address.
|
||||||
|
* @return string
|
||||||
|
* @deprecated. Instead use getRecipientName
|
||||||
|
*/
|
||||||
|
public function getRecipient_name() {
|
||||||
|
return $this->recipient_name;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace PayPal\Api;
|
namespace PayPal\Api;
|
||||||
|
|
||||||
|
use PayPal\Common\PPModel;
|
||||||
|
|
||||||
class Transaction extends \PPModel {
|
class Transaction extends PPModel {
|
||||||
/**
|
/**
|
||||||
* Amount being collected.
|
* Amount being collected.
|
||||||
* @param PayPal\Api\Amount $amount
|
* @param PayPal\Api\Amount $amount
|
||||||
*/
|
*/
|
||||||
public function setAmount($amount) {
|
public function setAmount($amount) {
|
||||||
$this->amount = $amount;
|
$this->amount = $amount;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Amount being collected.
|
* Amount being collected.
|
||||||
* @return PayPal\Api\Amount
|
* @return PayPal\Api\Amount
|
||||||
@@ -18,15 +20,17 @@ class Transaction extends \PPModel {
|
|||||||
public function getAmount() {
|
public function getAmount() {
|
||||||
return $this->amount;
|
return $this->amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Recepient of the funds in this transaction.
|
* Recepient of the funds in this transaction.
|
||||||
* @param PayPal\Api\Payee $payee
|
* @param PayPal\Api\Payee $payee
|
||||||
*/
|
*/
|
||||||
public function setPayee($payee) {
|
public function setPayee($payee) {
|
||||||
$this->payee = $payee;
|
$this->payee = $payee;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Recepient of the funds in this transaction.
|
* Recepient of the funds in this transaction.
|
||||||
* @return PayPal\Api\Payee
|
* @return PayPal\Api\Payee
|
||||||
@@ -34,15 +38,17 @@ class Transaction extends \PPModel {
|
|||||||
public function getPayee() {
|
public function getPayee() {
|
||||||
return $this->payee;
|
return $this->payee;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Description of what is being paid for.
|
* Description of what is being paid for.
|
||||||
* @param string $description
|
* @param string $description
|
||||||
*/
|
*/
|
||||||
public function setDescription($description) {
|
public function setDescription($description) {
|
||||||
$this->description = $description;
|
$this->description = $description;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Description of what is being paid for.
|
* Description of what is being paid for.
|
||||||
* @return string
|
* @return string
|
||||||
@@ -50,15 +56,17 @@ class Transaction extends \PPModel {
|
|||||||
public function getDescription() {
|
public function getDescription() {
|
||||||
return $this->description;
|
return $this->description;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of items being paid for.
|
* List of items being paid for.
|
||||||
* @param PayPal\Api\ItemList $item_list
|
* @param PayPal\Api\ItemList $item_list
|
||||||
*/
|
*/
|
||||||
public function setItemList($item_list) {
|
public function setItemList($item_list) {
|
||||||
$this->item_list = $item_list;
|
$this->item_list = $item_list;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of items being paid for.
|
* List of items being paid for.
|
||||||
* @return PayPal\Api\ItemList
|
* @return PayPal\Api\ItemList
|
||||||
@@ -66,7 +74,25 @@ class Transaction extends \PPModel {
|
|||||||
public function getItemList() {
|
public function getItemList() {
|
||||||
return $this->item_list;
|
return $this->item_list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of items being paid for.
|
||||||
|
* @param PayPal\Api\ItemList $item_list
|
||||||
|
* @deprecated. Instead use setItemList
|
||||||
|
*/
|
||||||
|
public function setItem_list($item_list) {
|
||||||
|
$this->item_list = $item_list;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* List of items being paid for.
|
||||||
|
* @return PayPal\Api\ItemList
|
||||||
|
* @deprecated. Instead use getItemList
|
||||||
|
*/
|
||||||
|
public function getItem_list() {
|
||||||
|
return $this->item_list;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of financial transactions (Sale, Authorization, Capture, Refund) related to the payment.
|
* List of financial transactions (Sale, Authorization, Capture, Refund) related to the payment.
|
||||||
* @array
|
* @array
|
||||||
@@ -74,8 +100,9 @@ class Transaction extends \PPModel {
|
|||||||
*/
|
*/
|
||||||
public function setRelatedResources($related_resources) {
|
public function setRelatedResources($related_resources) {
|
||||||
$this->related_resources = $related_resources;
|
$this->related_resources = $related_resources;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of financial transactions (Sale, Authorization, Capture, Refund) related to the payment.
|
* List of financial transactions (Sale, Authorization, Capture, Refund) related to the payment.
|
||||||
* @return PayPal\Api\RelatedResources
|
* @return PayPal\Api\RelatedResources
|
||||||
@@ -83,7 +110,26 @@ class Transaction extends \PPModel {
|
|||||||
public function getRelatedResources() {
|
public function getRelatedResources() {
|
||||||
return $this->related_resources;
|
return $this->related_resources;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of financial transactions (Sale, Authorization, Capture, Refund) related to the payment.
|
||||||
|
* @array
|
||||||
|
* @param PayPal\Api\RelatedResources $related_resources
|
||||||
|
* @deprecated. Instead use setRelatedResources
|
||||||
|
*/
|
||||||
|
public function setRelated_resources($related_resources) {
|
||||||
|
$this->related_resources = $related_resources;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* List of financial transactions (Sale, Authorization, Capture, Refund) related to the payment.
|
||||||
|
* @return PayPal\Api\RelatedResources
|
||||||
|
* @deprecated. Instead use getRelatedResources
|
||||||
|
*/
|
||||||
|
public function getRelated_resources() {
|
||||||
|
return $this->related_resources;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Additional transactions for complex payment (Parallel and Chained) scenarios.
|
* Additional transactions for complex payment (Parallel and Chained) scenarios.
|
||||||
* @array
|
* @array
|
||||||
@@ -91,8 +137,9 @@ class Transaction extends \PPModel {
|
|||||||
*/
|
*/
|
||||||
public function setTransactions($transactions) {
|
public function setTransactions($transactions) {
|
||||||
$this->transactions = $transactions;
|
$this->transactions = $transactions;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Additional transactions for complex payment (Parallel and Chained) scenarios.
|
* Additional transactions for complex payment (Parallel and Chained) scenarios.
|
||||||
* @return PayPal\Api\self
|
* @return PayPal\Api\self
|
||||||
@@ -100,5 +147,6 @@ class Transaction extends \PPModel {
|
|||||||
public function getTransactions() {
|
public function getTransactions() {
|
||||||
return $this->transactions;
|
return $this->transactions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace PayPal\Api;
|
namespace PayPal\Api;
|
||||||
|
|
||||||
|
use PayPal\Common\PPModel;
|
||||||
|
|
||||||
class Transactions extends \PPModel {
|
class Transactions extends PPModel {
|
||||||
/**
|
/**
|
||||||
* Amount being collected.
|
* Amount being collected.
|
||||||
* @param PayPal\Api\Amount $amount
|
* @param PayPal\Api\Amount $amount
|
||||||
*/
|
*/
|
||||||
public function setAmount($amount) {
|
public function setAmount($amount) {
|
||||||
$this->amount = $amount;
|
$this->amount = $amount;
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Amount being collected.
|
* Amount being collected.
|
||||||
* @return PayPal\Api\Amount
|
* @return PayPal\Api\Amount
|
||||||
@@ -18,5 +20,6 @@ class Transactions extends \PPModel {
|
|||||||
public function getAmount() {
|
public function getAmount() {
|
||||||
return $this->amount;
|
return $this->amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,8 +7,12 @@ namespace PayPal\Auth;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
use PayPal\Rest\RestHandler;
|
use PayPal\Rest\RestHandler;
|
||||||
|
use PayPal\Common\PPUserAgent;
|
||||||
use PayPal\Common\UserAgent;
|
use PayPal\Core\PPLoggingManager;
|
||||||
|
use PayPal\Core\PPConstants;
|
||||||
|
use PayPal\Core\PPHttpConfig;
|
||||||
|
use PayPal\Core\PPConnectionManager;
|
||||||
|
use PayPal\Exception\PPConfigurationException;
|
||||||
|
|
||||||
class OAuthTokenCredential {
|
class OAuthTokenCredential {
|
||||||
|
|
||||||
@@ -57,7 +61,7 @@ class OAuthTokenCredential {
|
|||||||
*/
|
*/
|
||||||
public function getAccessToken($config) {
|
public function getAccessToken($config) {
|
||||||
|
|
||||||
$this->logger = new \PPLoggingManager(__CLASS__, $config);
|
$this->logger = new PPLoggingManager(__CLASS__, $config);
|
||||||
// Check if Access Token is not null and has not expired.
|
// Check if Access Token is not null and has not expired.
|
||||||
// The API returns expiry time as a relative time unit
|
// The API returns expiry time as a relative time unit
|
||||||
// We use a buffer time when checking for token expiry to account
|
// We use a buffer time when checking for token expiry to account
|
||||||
@@ -81,14 +85,14 @@ class OAuthTokenCredential {
|
|||||||
|
|
||||||
$base64ClientID = base64_encode($this->clientId . ":" . $this->clientSecret);
|
$base64ClientID = base64_encode($this->clientId . ":" . $this->clientSecret);
|
||||||
$headers = array(
|
$headers = array(
|
||||||
"User-Agent" => \PPUserAgent::getValue(RestHandler::$sdkName, RestHandler::$sdkVersion),
|
"User-Agent" => PPUserAgent::getValue(RestHandler::$sdkName, RestHandler::$sdkVersion),
|
||||||
"Authorization" => "Basic " . $base64ClientID,
|
"Authorization" => "Basic " . $base64ClientID,
|
||||||
"Accept" => "*/*"
|
"Accept" => "*/*"
|
||||||
);
|
);
|
||||||
$httpConfiguration = $this->getOAuthHttpConfiguration($config);
|
$httpConfiguration = $this->getOAuthHttpConfiguration($config);
|
||||||
$httpConfiguration->setHeaders($headers);
|
$httpConfiguration->setHeaders($headers);
|
||||||
|
|
||||||
$connection = \PPConnectionManager::getInstance()->getConnection($httpConfiguration, $config);
|
$connection = PPConnectionManager::getInstance()->getConnection($httpConfiguration, $config);
|
||||||
$res = $connection->execute("grant_type=client_credentials");
|
$res = $connection->execute("grant_type=client_credentials");
|
||||||
$jsonResponse = json_decode($res, true);
|
$jsonResponse = json_decode($res, true);
|
||||||
if($jsonResponse == NULL ||
|
if($jsonResponse == NULL ||
|
||||||
@@ -115,19 +119,19 @@ class OAuthTokenCredential {
|
|||||||
} else if (isset($config['mode'])) {
|
} else if (isset($config['mode'])) {
|
||||||
switch (strtoupper($config['mode'])) {
|
switch (strtoupper($config['mode'])) {
|
||||||
case 'SANDBOX':
|
case 'SANDBOX':
|
||||||
$baseEndpoint = \PPConstants::REST_SANDBOX_ENDPOINT;
|
$baseEndpoint = PPConstants::REST_SANDBOX_ENDPOINT;
|
||||||
break;
|
break;
|
||||||
case 'LIVE':
|
case 'LIVE':
|
||||||
$baseEndpoint = \PPConstants::REST_LIVE_ENDPOINT;
|
$baseEndpoint = PPConstants::REST_LIVE_ENDPOINT;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new \PPConfigurationException('The mode config parameter must be set to either sandbox/live');
|
throw new PPConfigurationException('The mode config parameter must be set to either sandbox/live');
|
||||||
}
|
}
|
||||||
} 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');
|
||||||
}
|
}
|
||||||
|
|
||||||
$baseEndpoint = rtrim(trim($baseEndpoint), '/');
|
$baseEndpoint = rtrim(trim($baseEndpoint), '/');
|
||||||
return new \PPHttpConfig($baseEndpoint . "/v1/oauth2/token", "POST");
|
return new PPHttpConfig($baseEndpoint . "/v1/oauth2/token", "POST");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace PayPal\Rest;
|
namespace PayPal\Rest;
|
||||||
|
|
||||||
|
use PayPal\Common\PPApiContext;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Call level parameters such as
|
* Call level parameters such as
|
||||||
* request id, credentials etc
|
* request id, credentials etc
|
||||||
*/
|
*/
|
||||||
class ApiContext extends \PPApiContext {
|
class ApiContext extends PPApiContext {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* OAuth Credentials to use for this call
|
* OAuth Credentials to use for this call
|
||||||
|
|||||||
@@ -2,12 +2,19 @@
|
|||||||
namespace PayPal\Rest;
|
namespace PayPal\Rest;
|
||||||
|
|
||||||
use PayPal\Auth\OAuthTokenCredential;
|
use PayPal\Auth\OAuthTokenCredential;
|
||||||
|
use PayPal\Handler\IPPHandler;
|
||||||
|
use PayPal\Core\PPCredentialManager;
|
||||||
|
use PayPal\Core\PPConstants;
|
||||||
|
use PayPal\Exception\PPMissingCredentialException;
|
||||||
|
use PayPal\Exception\PPInvalidCredentialException;
|
||||||
|
use PayPal\Exception\PPConfigurationException;
|
||||||
|
use PayPal\Common\PPUserAgent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* API handler for all REST API calls
|
* API handler for all REST API calls
|
||||||
*/
|
*/
|
||||||
class RestHandler implements \IPPHandler {
|
class RestHandler implements IPPHandler {
|
||||||
|
|
||||||
private $apiContext;
|
private $apiContext;
|
||||||
|
|
||||||
@@ -25,15 +32,15 @@ class RestHandler implements \IPPHandler {
|
|||||||
|
|
||||||
if($credential == NULL) {
|
if($credential == NULL) {
|
||||||
// Try picking credentials from the config file
|
// Try picking credentials from the config file
|
||||||
$credMgr = \PPCredentialManager::getInstance($config);
|
$credMgr = PPCredentialManager::getInstance($config);
|
||||||
$credValues = $credMgr->getCredentialObject();
|
$credValues = $credMgr->getCredentialObject();
|
||||||
if(!is_array($credValues)) {
|
if(!is_array($credValues)) {
|
||||||
throw new \PPMissingCredentialException("Empty or invalid credentials passed");
|
throw new PPMissingCredentialException("Empty or invalid credentials passed");
|
||||||
}
|
}
|
||||||
$credential = new OAuthTokenCredential($credValues['clientId'], $credValues['clientSecret']);
|
$credential = new OAuthTokenCredential($credValues['clientId'], $credValues['clientSecret']);
|
||||||
}
|
}
|
||||||
if($credential == NULL || ! ($credential instanceof OAuthTokenCredential) ) {
|
if($credential == NULL || ! ($credential instanceof OAuthTokenCredential) ) {
|
||||||
throw new \PPInvalidCredentialException("Invalid credentials passed");
|
throw new PPInvalidCredentialException("Invalid credentials passed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -43,7 +50,7 @@ class RestHandler implements \IPPHandler {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if(!array_key_exists("User-Agent", $httpConfig->getHeaders())) {
|
if(!array_key_exists("User-Agent", $httpConfig->getHeaders())) {
|
||||||
$httpConfig->addHeader("User-Agent", \PPUserAgent::getValue(self::$sdkName, self::$sdkVersion));
|
$httpConfig->addHeader("User-Agent", PPUserAgent::getValue(self::$sdkName, self::$sdkVersion));
|
||||||
}
|
}
|
||||||
if(!is_null($credential) && $credential instanceof OAuthTokenCredential) {
|
if(!is_null($credential) && $credential instanceof OAuthTokenCredential) {
|
||||||
$httpConfig->addHeader('Authorization', "Bearer " . $credential->getAccessToken($config));
|
$httpConfig->addHeader('Authorization', "Bearer " . $credential->getAccessToken($config));
|
||||||
@@ -60,10 +67,10 @@ class RestHandler implements \IPPHandler {
|
|||||||
} else if (isset($config['mode'])) {
|
} else if (isset($config['mode'])) {
|
||||||
switch (strtoupper($config['mode'])) {
|
switch (strtoupper($config['mode'])) {
|
||||||
case 'SANDBOX':
|
case 'SANDBOX':
|
||||||
return \PPConstants::REST_SANDBOX_ENDPOINT;
|
return PPConstants::REST_SANDBOX_ENDPOINT;
|
||||||
break;
|
break;
|
||||||
case 'LIVE':
|
case 'LIVE':
|
||||||
return \PPConstants::REST_LIVE_ENDPOINT;
|
return PPConstants::REST_LIVE_ENDPOINT;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new PPConfigurationException('The mode config parameter must be set to either sandbox/live');
|
throw new PPConfigurationException('The mode config parameter must be set to either sandbox/live');
|
||||||
|
|||||||
@@ -82,12 +82,47 @@
|
|||||||
<td><a href="source/GetCreditCard.html" class="source imagelink" >Source</a></td>
|
<td><a href="source/GetCreditCard.html" class="source imagelink" >Source</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Payment with saved credit card</td>
|
<td>Get Details of Authorized Payment</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td><a href="payments/CreatePaymentUsingSavedCard.php" class="execute imagelink" >Execute</a></td>
|
<td><a href="payments/GetAuthorization.php" class="execute imagelink" >Execute</a></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td><a href="source/CreatePaymentUsingSavedCard.html" class="source imagelink" >Source</a></td>
|
<td><a href="source/GetAuthorization.html" class="source imagelink" >Source</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Capture Authorized Payment</td>
|
||||||
|
<td></td>
|
||||||
|
<td><a href="payments/AuthorizationCapture.php" class="execute imagelink" >Execute</a></td>
|
||||||
|
<td></td>
|
||||||
|
<td><a href="source/AuthorizationCapture.html" class="source imagelink" >Source</a></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Void Authorized Payment</td>
|
||||||
|
<td></td>
|
||||||
|
<td><a href="payments/VoidAuthorization.php" class="execute imagelink" >Execute</a></td>
|
||||||
|
<td></td>
|
||||||
|
<td><a href="source/VoidAuthorization.html" class="source imagelink" >Source</a></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Get Details of Captured Payment</td>
|
||||||
|
<td></td>
|
||||||
|
<td><a href="payments/GetCapture.php" class="execute imagelink" >Execute</a></td>
|
||||||
|
<td></td>
|
||||||
|
<td><a href="source/GetCapture.html" class="source imagelink" >Source</a></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Refund Captured Payment</td>
|
||||||
|
<td></td>
|
||||||
|
<td><a href="payments/RefundCapture.php" class="execute imagelink" >Execute</a></td>
|
||||||
|
<td></td>
|
||||||
|
<td><a href="source/RefundCapture.html" class="source imagelink" >Source</a></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Delete saved CreditCard</td>
|
||||||
|
<td></td>
|
||||||
|
<td><a href="vault/DeleteCreditCard.php" class="execute imagelink" >Execute</a></td>
|
||||||
|
<td></td>
|
||||||
|
<td><a href="source/DeleteCreditCard.html" class="source imagelink" >Source</a></td>
|
||||||
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
102
sample/payments/AuthorizationCapture.php
Normal file
102
sample/payments/AuthorizationCapture.php
Normal file
@@ -0,0 +1,102 @@
|
|||||||
|
<?php
|
||||||
|
// # AuthorizationCapture
|
||||||
|
// This sample code demonstrate how you can capture the authorized payment
|
||||||
|
// API used: /v1/payments/payment
|
||||||
|
|
||||||
|
require __DIR__ . '/../bootstrap.php';
|
||||||
|
use PayPal\Api\Capture;
|
||||||
|
use PayPal\Api\Authorization;
|
||||||
|
use PayPal\Api\Address;
|
||||||
|
use PayPal\Api\Amount;
|
||||||
|
use PayPal\Api\CreditCard;
|
||||||
|
use PayPal\Api\Payer;
|
||||||
|
use PayPal\Api\Payment;
|
||||||
|
use PayPal\Api\FundingInstrument;
|
||||||
|
use PayPal\Api\Transaction;
|
||||||
|
|
||||||
|
// create payment to get authorization Id
|
||||||
|
$authId = createAuthorization($apiContext);
|
||||||
|
|
||||||
|
$amt = new Amount();
|
||||||
|
$amt->setCurrency("USD");
|
||||||
|
$amt->setTotal("1.00");
|
||||||
|
|
||||||
|
### Capture
|
||||||
|
$capture = new Capture();
|
||||||
|
$capture->setId($authId);
|
||||||
|
$capture->setAmount($amt);
|
||||||
|
|
||||||
|
// get the authorization
|
||||||
|
$authorization = Authorization::get($authId, $apiContext);
|
||||||
|
|
||||||
|
// ### Capture Payment
|
||||||
|
// Capture Payment by posting to the APIService
|
||||||
|
// using a valid ApiContext (See bootstrap.php for more on `ApiContext`)
|
||||||
|
// The return object contains the status;
|
||||||
|
try {
|
||||||
|
$getCapture = $authorization->capture($capture, $apiContext);
|
||||||
|
} catch (\PPConnectionException $ex) {
|
||||||
|
echo "Exception: " . $ex->getMessage() . PHP_EOL;
|
||||||
|
var_dump($ex->getData());
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<html>
|
||||||
|
<body>
|
||||||
|
<div>
|
||||||
|
Capture payment:
|
||||||
|
<?php echo $getCapture->getId();?>
|
||||||
|
</div>
|
||||||
|
<pre>
|
||||||
|
<?php var_dump($getCapture->toArray());?>
|
||||||
|
</pre>
|
||||||
|
<a href='../index.html'>Back</a>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
<?php
|
||||||
|
function createAuthorization($apiContext)
|
||||||
|
{
|
||||||
|
$addr = new Address();
|
||||||
|
$addr->setLine1("3909 Witmer Road");
|
||||||
|
$addr->setLine2("Niagara Falls");
|
||||||
|
$addr->setCity("Niagara Falls");
|
||||||
|
$addr->setState("NY");
|
||||||
|
$addr->setPostal_code("14305");
|
||||||
|
$addr->setCountry_code("US");
|
||||||
|
$addr->setPhone("716-298-1822");
|
||||||
|
|
||||||
|
$card = new CreditCard();
|
||||||
|
$card->setType("visa");
|
||||||
|
$card->setNumber("4417119669820331");
|
||||||
|
$card->setExpire_month("11");
|
||||||
|
$card->setExpire_year("2019");
|
||||||
|
$card->setCvv2("012");
|
||||||
|
$card->setFirst_name("Joe");
|
||||||
|
$card->setLast_name("Shopper");
|
||||||
|
$card->setBilling_address($addr);
|
||||||
|
|
||||||
|
$fi = new FundingInstrument();
|
||||||
|
$fi->setCredit_card($card);
|
||||||
|
|
||||||
|
$payer = new Payer();
|
||||||
|
$payer->setPayment_method("credit_card");
|
||||||
|
$payer->setFunding_instruments(array($fi));
|
||||||
|
|
||||||
|
$amount = new Amount();
|
||||||
|
$amount->setCurrency("USD");
|
||||||
|
$amount->setTotal("1.00");
|
||||||
|
|
||||||
|
$transaction = new Transaction();
|
||||||
|
$transaction->setAmount($amount);
|
||||||
|
$transaction->setDescription("This is the payment description.");
|
||||||
|
|
||||||
|
$payment = new Payment();
|
||||||
|
$payment->setIntent("authorize");
|
||||||
|
$payment->setPayer($payer);
|
||||||
|
$payment->setTransactions(array($transaction));
|
||||||
|
|
||||||
|
$paymnt = $payment->create($apiContext);
|
||||||
|
$resArray = $paymnt->toArray();
|
||||||
|
|
||||||
|
return $authId = $resArray['transactions'][0]['related_resources'][0]['authorization']['id'];
|
||||||
|
}
|
||||||
88
sample/payments/GetAuthorization.php
Normal file
88
sample/payments/GetAuthorization.php
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
<?php
|
||||||
|
// # GetAuthorization
|
||||||
|
// This sample code demonstrate how you can get details of an authorized payment
|
||||||
|
// API used: /v1/payments/authorization/<$authorizationId>
|
||||||
|
|
||||||
|
require __DIR__ . '/../bootstrap.php';
|
||||||
|
|
||||||
|
use PayPal\Api\Authorization;
|
||||||
|
use PayPal\Api\Address;
|
||||||
|
use PayPal\Api\Amount;
|
||||||
|
use PayPal\Api\CreditCard;
|
||||||
|
use PayPal\Api\Payer;
|
||||||
|
use PayPal\Api\Payment;
|
||||||
|
use PayPal\Api\FundingInstrument;
|
||||||
|
use PayPal\Api\Transaction;
|
||||||
|
|
||||||
|
// create payment to get authorization Id
|
||||||
|
$authId = createAuthorization($apiContext);
|
||||||
|
|
||||||
|
// ### GetAuthorization
|
||||||
|
// GetAuthorization by posting to the APIService
|
||||||
|
// using a valid ApiContext (See bootstrap.php for more on `ApiContext`)
|
||||||
|
// The return object contains the status;
|
||||||
|
try {
|
||||||
|
$authorization = Authorization::get($authId, $apiContext);
|
||||||
|
} catch (\PPConnectionException $ex) {
|
||||||
|
echo "Exception: " . $ex->getMessage() . PHP_EOL;
|
||||||
|
var_dump($ex->getData());
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<html>
|
||||||
|
<body>
|
||||||
|
<div>
|
||||||
|
Get Authorization:
|
||||||
|
<?php echo $authorization->getId();?>
|
||||||
|
</div>
|
||||||
|
<pre><?php var_dump($authorization->toArray());?></pre>
|
||||||
|
<a href='../index.html'>Back</a>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
<?php
|
||||||
|
function createAuthorization($apiContext)
|
||||||
|
{
|
||||||
|
$addr = new Address();
|
||||||
|
$addr->setLine1("3909 Witmer Road");
|
||||||
|
$addr->setLine2("Niagara Falls");
|
||||||
|
$addr->setCity("Niagara Falls");
|
||||||
|
$addr->setState("NY");
|
||||||
|
$addr->setPostal_code("14305");
|
||||||
|
$addr->setCountry_code("US");
|
||||||
|
$addr->setPhone("716-298-1822");
|
||||||
|
|
||||||
|
$card = new CreditCard();
|
||||||
|
$card->setType("visa");
|
||||||
|
$card->setNumber("4417119669820331");
|
||||||
|
$card->setExpire_month("11");
|
||||||
|
$card->setExpire_year("2019");
|
||||||
|
$card->setCvv2("012");
|
||||||
|
$card->setFirst_name("Joe");
|
||||||
|
$card->setLast_name("Shopper");
|
||||||
|
$card->setBilling_address($addr);
|
||||||
|
|
||||||
|
$fi = new FundingInstrument();
|
||||||
|
$fi->setCredit_card($card);
|
||||||
|
|
||||||
|
$payer = new Payer();
|
||||||
|
$payer->setPayment_method("credit_card");
|
||||||
|
$payer->setFunding_instruments(array($fi));
|
||||||
|
|
||||||
|
$amount = new Amount();
|
||||||
|
$amount->setCurrency("USD");
|
||||||
|
$amount->setTotal("1.00");
|
||||||
|
|
||||||
|
$transaction = new Transaction();
|
||||||
|
$transaction->setAmount($amount);
|
||||||
|
$transaction->setDescription("This is the payment description.");
|
||||||
|
|
||||||
|
$payment = new Payment();
|
||||||
|
$payment->setIntent("authorize");
|
||||||
|
$payment->setPayer($payer);
|
||||||
|
$payment->setTransactions(array($transaction));
|
||||||
|
|
||||||
|
$paymnt = $payment->create($apiContext);
|
||||||
|
$resArray = $paymnt->toArray();
|
||||||
|
|
||||||
|
return $authId = $resArray['transactions'][0]['related_resources'][0]['authorization']['id'];
|
||||||
|
}
|
||||||
111
sample/payments/GetCapture.php
Normal file
111
sample/payments/GetCapture.php
Normal file
@@ -0,0 +1,111 @@
|
|||||||
|
<?php
|
||||||
|
// # GetCapture
|
||||||
|
// This sample code demonstrate how you can get the details of Captured Payment
|
||||||
|
// API used: /v1/payments/capture/<$captureId>
|
||||||
|
|
||||||
|
require __DIR__ . '/../bootstrap.php';
|
||||||
|
use PayPal\Api\Capture;
|
||||||
|
use PayPal\Api\Address;
|
||||||
|
use PayPal\Api\Amount;
|
||||||
|
use PayPal\Api\CreditCard;
|
||||||
|
use PayPal\Api\Payer;
|
||||||
|
use PayPal\Api\Payment;
|
||||||
|
use PayPal\Api\FundingInstrument;
|
||||||
|
use PayPal\Api\Transaction;
|
||||||
|
use PayPal\Api\Authorization;
|
||||||
|
|
||||||
|
// create payment to get authorization Id
|
||||||
|
$authId = createAuthorization($apiContext);
|
||||||
|
$amt = new Amount();
|
||||||
|
$amt->setCurrency("USD");
|
||||||
|
$amt->setTotal("1.00");
|
||||||
|
|
||||||
|
### Capture
|
||||||
|
$captur = new Capture();
|
||||||
|
$captur->setId($authId);
|
||||||
|
$captur->setAmount($amt);
|
||||||
|
|
||||||
|
// get the authorization
|
||||||
|
$authorization = Authorization::get($authId, $apiContext);
|
||||||
|
|
||||||
|
// ### Capture Payment
|
||||||
|
// Capture Payment by posting to the APIService
|
||||||
|
// using a valid ApiContext (See bootstrap.php for more on `ApiContext`)
|
||||||
|
// The return object contains the status;
|
||||||
|
try {
|
||||||
|
$capt = $authorization->capture($captur, $apiContext);
|
||||||
|
} catch (\PPConnectionException $ex) {
|
||||||
|
echo "Exception: " . $ex->getMessage() . PHP_EOL;
|
||||||
|
var_dump($ex->getData());
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ### Get Capture
|
||||||
|
// Get Capture by posting to the APIService
|
||||||
|
// using a valid ApiContext (See bootstrap.php for more on `ApiContext`)
|
||||||
|
// The return object contains the status;
|
||||||
|
try {
|
||||||
|
$capture = Capture::get($capt->getId(), $apiContext);
|
||||||
|
} catch (\PPConnectionException $ex) {
|
||||||
|
echo "Exception: " . $ex->getMessage() . PHP_EOL;
|
||||||
|
var_dump($ex->getData());
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<html>
|
||||||
|
<body>
|
||||||
|
<div>
|
||||||
|
Get Capture :
|
||||||
|
<?php echo $capture->getId();?>
|
||||||
|
</div>
|
||||||
|
<pre><?php var_dump($capture->toArray());?></pre>
|
||||||
|
<a href='../index.html'>Back</a>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
<?php
|
||||||
|
function createAuthorization($apiContext)
|
||||||
|
{
|
||||||
|
$addr = new Address();
|
||||||
|
$addr->setLine1("3909 Witmer Road");
|
||||||
|
$addr->setLine2("Niagara Falls");
|
||||||
|
$addr->setCity("Niagara Falls");
|
||||||
|
$addr->setState("NY");
|
||||||
|
$addr->setPostal_code("14305");
|
||||||
|
$addr->setCountry_code("US");
|
||||||
|
$addr->setPhone("716-298-1822");
|
||||||
|
|
||||||
|
$card = new CreditCard();
|
||||||
|
$card->setType("visa");
|
||||||
|
$card->setNumber("4417119669820331");
|
||||||
|
$card->setExpire_month("11");
|
||||||
|
$card->setExpire_year("2019");
|
||||||
|
$card->setCvv2("012");
|
||||||
|
$card->setFirst_name("Joe");
|
||||||
|
$card->setLast_name("Shopper");
|
||||||
|
$card->setBilling_address($addr);
|
||||||
|
|
||||||
|
$fi = new FundingInstrument();
|
||||||
|
$fi->setCredit_card($card);
|
||||||
|
|
||||||
|
$payer = new Payer();
|
||||||
|
$payer->setPayment_method("credit_card");
|
||||||
|
$payer->setFunding_instruments(array($fi));
|
||||||
|
|
||||||
|
$amount = new Amount();
|
||||||
|
$amount->setCurrency("USD");
|
||||||
|
$amount->setTotal("1.00");
|
||||||
|
|
||||||
|
$transaction = new Transaction();
|
||||||
|
$transaction->setAmount($amount);
|
||||||
|
$transaction->setDescription("This is the payment description.");
|
||||||
|
|
||||||
|
$payment = new Payment();
|
||||||
|
$payment->setIntent("authorize");
|
||||||
|
$payment->setPayer($payer);
|
||||||
|
$payment->setTransactions(array($transaction));
|
||||||
|
|
||||||
|
$paymnt = $payment->create($apiContext);
|
||||||
|
$resArray = $paymnt->toArray();
|
||||||
|
|
||||||
|
return $authId = $resArray['transactions'][0]['related_resources'][0]['authorization']['id'];
|
||||||
|
}
|
||||||
124
sample/payments/RefundCapture.php
Normal file
124
sample/payments/RefundCapture.php
Normal file
@@ -0,0 +1,124 @@
|
|||||||
|
<?php
|
||||||
|
// # Refund Capture Sample
|
||||||
|
// This sample code demonstrate how you can
|
||||||
|
// process a refund on a Captured transaction created
|
||||||
|
// using the Capture API.
|
||||||
|
// API used: /v1/payments/capture/{<captureID>}/refund
|
||||||
|
require __DIR__ . '/../bootstrap.php';
|
||||||
|
use PayPal\Api\Authorization;
|
||||||
|
use PayPal\Api\Capture;
|
||||||
|
use PayPal\Api\Refund;
|
||||||
|
use PayPal\Api\Address;
|
||||||
|
use PayPal\Api\Amount;
|
||||||
|
use PayPal\Api\CreditCard;
|
||||||
|
use PayPal\Api\Payer;
|
||||||
|
use PayPal\Api\Payment;
|
||||||
|
use PayPal\Api\FundingInstrument;
|
||||||
|
use PayPal\Api\Transaction;
|
||||||
|
use PayPal\Rest\ApiContext;
|
||||||
|
use PayPal\Auth\OAuthTokenCredential;
|
||||||
|
|
||||||
|
// create payment to get authorization Id
|
||||||
|
$authId = createAuthorization($apiContext);
|
||||||
|
|
||||||
|
$amt = new Amount();
|
||||||
|
$amt->setCurrency("USD");
|
||||||
|
$amt->setTotal("1.00");
|
||||||
|
|
||||||
|
### Capture
|
||||||
|
$captur = new Capture();
|
||||||
|
$captur->setAmount($amt);
|
||||||
|
|
||||||
|
// get the authorization
|
||||||
|
$authorization = Authorization::get($authId, $apiContext);
|
||||||
|
|
||||||
|
// ### Capture Payment
|
||||||
|
// Capture Payment by posting to the APIService
|
||||||
|
// using a valid ApiContext (See bootstrap.php for more on `ApiContext`)
|
||||||
|
// The return object contains the status;
|
||||||
|
try {
|
||||||
|
$capt = $authorization->capture($captur, $apiContext);
|
||||||
|
} catch (\PPConnectionException $ex) {
|
||||||
|
echo "Exception: " . $ex->getMessage() . PHP_EOL;
|
||||||
|
var_dump($ex->getData());
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ### Refund
|
||||||
|
// Create a refund object indicating
|
||||||
|
// refund amount
|
||||||
|
|
||||||
|
|
||||||
|
$refund = new Refund();
|
||||||
|
$refund->setAmount($amt);
|
||||||
|
|
||||||
|
$capture = Capture::get($capt->getId(), $apiContext);
|
||||||
|
|
||||||
|
// create new API context
|
||||||
|
$context = new ApiContext(new OAuthTokenCredential(
|
||||||
|
'EBWKjlELKMYqRNQ6sYvFo64FtaRLRR5BdHEESmha49TM',
|
||||||
|
'EO422dn3gQLgDbuwqTjzrFgFtaRLRR5BdHEESmha49TM'));
|
||||||
|
try {
|
||||||
|
// (See bootstrap.php for more on `ApiContext`)
|
||||||
|
$captureRefund = $capture->refund($refund, $context);
|
||||||
|
} catch (\PPConnectionException $ex) {
|
||||||
|
echo "Exception: " . $ex->getMessage() . PHP_EOL;
|
||||||
|
var_dump($ex->getData());
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<html>
|
||||||
|
<body>
|
||||||
|
<div>Refund Capture:</div>
|
||||||
|
<pre><?php var_dump($captureRefund);?></pre>
|
||||||
|
<a href='../index.html'>Back</a>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
<?php
|
||||||
|
function createAuthorization($apiContext)
|
||||||
|
{
|
||||||
|
$addr = new Address();
|
||||||
|
$addr->setLine1("3909 Witmer Road");
|
||||||
|
$addr->setLine2("Niagara Falls");
|
||||||
|
$addr->setCity("Niagara Falls");
|
||||||
|
$addr->setState("NY");
|
||||||
|
$addr->setPostal_code("14305");
|
||||||
|
$addr->setCountry_code("US");
|
||||||
|
$addr->setPhone("716-298-1822");
|
||||||
|
|
||||||
|
$card = new CreditCard();
|
||||||
|
$card->setType("visa");
|
||||||
|
$card->setNumber("4417119669820331");
|
||||||
|
$card->setExpire_month("11");
|
||||||
|
$card->setExpire_year("2019");
|
||||||
|
$card->setCvv2("012");
|
||||||
|
$card->setFirst_name("Joe");
|
||||||
|
$card->setLast_name("Shopper");
|
||||||
|
$card->setBilling_address($addr);
|
||||||
|
|
||||||
|
$fi = new FundingInstrument();
|
||||||
|
$fi->setCredit_card($card);
|
||||||
|
|
||||||
|
$payer = new Payer();
|
||||||
|
$payer->setPayment_method("credit_card");
|
||||||
|
$payer->setFunding_instruments(array($fi));
|
||||||
|
|
||||||
|
$amount = new Amount();
|
||||||
|
$amount->setCurrency("USD");
|
||||||
|
$amount->setTotal("10.00");
|
||||||
|
|
||||||
|
$transaction = new Transaction();
|
||||||
|
$transaction->setAmount($amount);
|
||||||
|
$transaction->setDescription("This is the payment description.");
|
||||||
|
|
||||||
|
$payment = new Payment();
|
||||||
|
$payment->setIntent("authorize");
|
||||||
|
$payment->setPayer($payer);
|
||||||
|
$payment->setTransactions(array($transaction));
|
||||||
|
|
||||||
|
$paymnt = $payment->create($apiContext);
|
||||||
|
$resArray = $paymnt->toArray();
|
||||||
|
|
||||||
|
return $authId = $resArray['transactions'][0]['related_resources'][0]['authorization']['id'];
|
||||||
|
}
|
||||||
90
sample/payments/VoidAuthorization.php
Normal file
90
sample/payments/VoidAuthorization.php
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
<?php
|
||||||
|
// # VoidAuthorization
|
||||||
|
// This sample code demonstrate how you can void an authorized payment
|
||||||
|
// API used: /v1/payments/authorization/<{authorizationid}>/void"
|
||||||
|
|
||||||
|
require __DIR__ . '/../bootstrap.php';
|
||||||
|
|
||||||
|
use PayPal\Api\Authorization;
|
||||||
|
use PayPal\Api\Address;
|
||||||
|
use PayPal\Api\Amount;
|
||||||
|
use PayPal\Api\CreditCard;
|
||||||
|
use PayPal\Api\Payer;
|
||||||
|
use PayPal\Api\Payment;
|
||||||
|
use PayPal\Api\FundingInstrument;
|
||||||
|
use PayPal\Api\Transaction;
|
||||||
|
|
||||||
|
// create payment to get authorization Id
|
||||||
|
$authId = createAuthorization($apiContext);
|
||||||
|
|
||||||
|
$authorization = Authorization::get($authId, $apiContext);
|
||||||
|
|
||||||
|
|
||||||
|
// ### VoidAuthorization
|
||||||
|
// VoidAuthorization by posting to the APIService
|
||||||
|
// using a valid ApiContext (See bootstrap.php for more on `ApiContext`)
|
||||||
|
// The return object contains the status;
|
||||||
|
try {
|
||||||
|
$void = $authorization->void($apiContext);
|
||||||
|
} catch (\PPConnectionException $ex) {
|
||||||
|
echo "Exception: " . $ex->getMessage() . PHP_EOL;
|
||||||
|
var_dump($ex->getData());
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<html>
|
||||||
|
<body>
|
||||||
|
<div>
|
||||||
|
Void Authorization:
|
||||||
|
</div>
|
||||||
|
<pre><?php var_dump($void->toArray());?></pre>
|
||||||
|
<a href='../index.html'>Back</a>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
<?php
|
||||||
|
function createAuthorization($apiContext)
|
||||||
|
{
|
||||||
|
$addr = new Address();
|
||||||
|
$addr->setLine1("3909 Witmer Road");
|
||||||
|
$addr->setLine2("Niagara Falls");
|
||||||
|
$addr->setCity("Niagara Falls");
|
||||||
|
$addr->setState("NY");
|
||||||
|
$addr->setPostal_code("14305");
|
||||||
|
$addr->setCountry_code("US");
|
||||||
|
$addr->setPhone("716-298-1822");
|
||||||
|
|
||||||
|
$card = new CreditCard();
|
||||||
|
$card->setType("visa");
|
||||||
|
$card->setNumber("4417119669820331");
|
||||||
|
$card->setExpire_month("11");
|
||||||
|
$card->setExpire_year("2019");
|
||||||
|
$card->setCvv2("012");
|
||||||
|
$card->setFirst_name("Joe");
|
||||||
|
$card->setLast_name("Shopper");
|
||||||
|
$card->setBilling_address($addr);
|
||||||
|
|
||||||
|
$fi = new FundingInstrument();
|
||||||
|
$fi->setCredit_card($card);
|
||||||
|
|
||||||
|
$payer = new Payer();
|
||||||
|
$payer->setPayment_method("credit_card");
|
||||||
|
$payer->setFunding_instruments(array($fi));
|
||||||
|
|
||||||
|
$amount = new Amount();
|
||||||
|
$amount->setCurrency("USD");
|
||||||
|
$amount->setTotal("1.00");
|
||||||
|
|
||||||
|
$transaction = new Transaction();
|
||||||
|
$transaction->setAmount($amount);
|
||||||
|
$transaction->setDescription("This is the payment description.");
|
||||||
|
|
||||||
|
$payment = new Payment();
|
||||||
|
$payment->setIntent("authorize");
|
||||||
|
$payment->setPayer($payer);
|
||||||
|
$payment->setTransactions(array($transaction));
|
||||||
|
|
||||||
|
$paymnt = $payment->create($apiContext);
|
||||||
|
$resArray = $paymnt->toArray();
|
||||||
|
|
||||||
|
return $authId = $resArray['transactions'][0]['related_resources'][0]['authorization']['id'];
|
||||||
|
}
|
||||||
92
sample/source/AuthorizationCapture.html
Normal file
92
sample/source/AuthorizationCapture.html
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
<!DOCTYPE html><html lang="en"><head><title>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="AuthorizationCapture"><meta name="groc-project-path" content="AuthorizationCapture.php"><link rel="stylesheet" type="text/css" media="all" href="assets/style.css"><body></body></html><a href="../">Back<div id="document"><div class="segment"><a id="segment-0" name="segment-0" class="section_anchor"></a><div class="code"><div class="wrapper"><span class="cp"><?php</span></div></div></div><div class="segment"><a id="segment-1" name="segment-1" class="section_anchor"></a><div class="comments"><div class="pilwrap"><a href="#segment-1" class="pilcrow">¶</a></div><div class="wrapper"><h1 id="authorizationcapture">AuthorizationCapture</h1>
|
||||||
|
|
||||||
|
<p>This sample code demonstrate how you can capture the authorized payment
|
||||||
|
API used: /v1/payments/payment</p></div></div><div class="code"><div class="wrapper"><span class="k">require</span> <span class="nx">__DIR__</span> <span class="o">.</span> <span class="s1">'/../bootstrap.php'</span><span class="p">;</span>
|
||||||
|
<span class="k">use</span> <span class="nx">PayPal\Api\Capture</span><span class="p">;</span>
|
||||||
|
<span class="k">use</span> <span class="nx">PayPal\Api\Authorization</span><span class="p">;</span>
|
||||||
|
<span class="k">use</span> <span class="nx">PayPal\Api\Address</span><span class="p">;</span>
|
||||||
|
<span class="k">use</span> <span class="nx">PayPal\Api\Amount</span><span class="p">;</span>
|
||||||
|
<span class="k">use</span> <span class="nx">PayPal\Api\CreditCard</span><span class="p">;</span>
|
||||||
|
<span class="k">use</span> <span class="nx">PayPal\Api\Payer</span><span class="p">;</span>
|
||||||
|
<span class="k">use</span> <span class="nx">PayPal\Api\Payment</span><span class="p">;</span>
|
||||||
|
<span class="k">use</span> <span class="nx">PayPal\Api\FundingInstrument</span><span class="p">;</span>
|
||||||
|
<span class="k">use</span> <span class="nx">PayPal\Api\Transaction</span><span class="p">;</span></div></div></div><div class="segment"><a id="segment-2" name="segment-2" class="section_anchor"></a><div class="comments"><div class="pilwrap"><a href="#segment-2" class="pilcrow">¶</a></div><div class="wrapper"><p>create payment to get authorization Id</p></div></div><div class="code"><div class="wrapper"><span class="nv">$authId</span> <span class="o">=</span> <span class="nx">createAuthorization</span><span class="p">(</span><span class="nv">$apiContext</span><span class="p">);</span>
|
||||||
|
|
||||||
|
<span class="nv">$amt</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Amount</span><span class="p">();</span>
|
||||||
|
<span class="nv">$amt</span><span class="o">-></span><span class="na">setCurrency</span><span class="p">(</span><span class="s2">"USD"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$amt</span><span class="o">-></span><span class="na">setTotal</span><span class="p">(</span><span class="s2">"1.00"</span><span class="p">);</span>
|
||||||
|
|
||||||
|
<span class="c1">### Capture</span>
|
||||||
|
<span class="nv">$capture</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Capture</span><span class="p">();</span>
|
||||||
|
<span class="nv">$capture</span><span class="o">-></span><span class="na">setId</span><span class="p">(</span><span class="nv">$authId</span><span class="p">);</span>
|
||||||
|
<span class="nv">$capture</span><span class="o">-></span><span class="na">setAmount</span><span class="p">(</span><span class="nv">$amt</span><span class="p">);</span></div></div></div><div class="segment"><a id="segment-3" name="segment-3" class="section_anchor"></a><div class="comments"><div class="pilwrap"><a href="#segment-3" class="pilcrow">¶</a></div><div class="wrapper"><p>get the authorization</p></div></div><div class="code"><div class="wrapper"><span class="nv">$authorization</span> <span class="o">=</span> <span class="nx">Authorization</span><span class="o">::</span><span class="na">get</span><span class="p">(</span><span class="nv">$authId</span><span class="p">,</span> <span class="nv">$apiContext</span><span class="p">);</span></div></div></div><div class="segment"><a id="segment-4" name="segment-4" class="section_anchor"></a><div class="comments"><div class="pilwrap"><a href="#segment-4" class="pilcrow">¶</a></div><div class="wrapper"><h3 id="capture-payment">Capture Payment</h3>
|
||||||
|
|
||||||
|
<p>Capture Payment by posting to the APIService
|
||||||
|
using a valid ApiContext (See bootstrap.php for more on <code>ApiContext</code>)
|
||||||
|
The return object contains the status;</p></div></div><div class="code"><div class="wrapper"><span class="k">try</span> <span class="p">{</span>
|
||||||
|
<span class="nv">$getCapture</span> <span class="o">=</span> <span class="nv">$authorization</span><span class="o">-></span><span class="na">capture</span><span class="p">(</span><span class="nv">$capture</span><span class="p">,</span> <span class="nv">$apiContext</span><span class="p">);</span>
|
||||||
|
<span class="p">}</span> <span class="k">catch</span> <span class="p">(</span><span class="nx">\PPConnectionException</span> <span class="nv">$ex</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="k">echo</span> <span class="s2">"Exception: "</span> <span class="o">.</span> <span class="nv">$ex</span><span class="o">-></span><span class="na">getMessage</span><span class="p">()</span> <span class="o">.</span> <span class="nx">PHP_EOL</span><span class="p">;</span>
|
||||||
|
<span class="nb">var_dump</span><span class="p">(</span><span class="nv">$ex</span><span class="o">-></span><span class="na">getData</span><span class="p">());</span>
|
||||||
|
<span class="k">exit</span><span class="p">(</span><span class="mi">1</span><span class="p">);</span>
|
||||||
|
<span class="p">}</span>
|
||||||
|
<span class="cp">?></span><span class="x"></span>
|
||||||
|
<span class="x"><html></span>
|
||||||
|
<span class="x"><body></span>
|
||||||
|
<span class="x"> <div></span>
|
||||||
|
<span class="x"> Capture payment:</span>
|
||||||
|
<span class="x"> </span><span class="cp"><?php</span> <span class="k">echo</span> <span class="nv">$getCapture</span><span class="o">-></span><span class="na">getId</span><span class="p">();</span><span class="cp">?></span><span class="x"></span>
|
||||||
|
<span class="x"> </div></span>
|
||||||
|
<span class="x"> <pre></span>
|
||||||
|
<span class="x"> </span><span class="cp"><?php</span> <span class="nb">var_dump</span><span class="p">(</span><span class="nv">$getCapture</span><span class="o">-></span><span class="na">toArray</span><span class="p">());</span><span class="cp">?></span><span class="x"></span>
|
||||||
|
<span class="x"> </pre></span>
|
||||||
|
<span class="x"> <a href='../index.html'>Back</a></span>
|
||||||
|
<span class="x"></body></span>
|
||||||
|
<span class="x"></html></span>
|
||||||
|
<span class="cp"><?php</span>
|
||||||
|
<span class="k">function</span> <span class="nf">createAuthorization</span><span class="p">(</span><span class="nv">$apiContext</span><span class="p">)</span>
|
||||||
|
<span class="p">{</span>
|
||||||
|
<span class="nv">$addr</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Address</span><span class="p">();</span>
|
||||||
|
<span class="nv">$addr</span><span class="o">-></span><span class="na">setLine1</span><span class="p">(</span><span class="s2">"3909 Witmer Road"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$addr</span><span class="o">-></span><span class="na">setLine2</span><span class="p">(</span><span class="s2">"Niagara Falls"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$addr</span><span class="o">-></span><span class="na">setCity</span><span class="p">(</span><span class="s2">"Niagara Falls"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$addr</span><span class="o">-></span><span class="na">setState</span><span class="p">(</span><span class="s2">"NY"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$addr</span><span class="o">-></span><span class="na">setPostal_code</span><span class="p">(</span><span class="s2">"14305"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$addr</span><span class="o">-></span><span class="na">setCountry_code</span><span class="p">(</span><span class="s2">"US"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$addr</span><span class="o">-></span><span class="na">setPhone</span><span class="p">(</span><span class="s2">"716-298-1822"</span><span class="p">);</span>
|
||||||
|
|
||||||
|
<span class="nv">$card</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">CreditCard</span><span class="p">();</span>
|
||||||
|
<span class="nv">$card</span><span class="o">-></span><span class="na">setType</span><span class="p">(</span><span class="s2">"visa"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$card</span><span class="o">-></span><span class="na">setNumber</span><span class="p">(</span><span class="s2">"4417119669820331"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$card</span><span class="o">-></span><span class="na">setExpire_month</span><span class="p">(</span><span class="s2">"11"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$card</span><span class="o">-></span><span class="na">setExpire_year</span><span class="p">(</span><span class="s2">"2019"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$card</span><span class="o">-></span><span class="na">setCvv2</span><span class="p">(</span><span class="s2">"012"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$card</span><span class="o">-></span><span class="na">setFirst_name</span><span class="p">(</span><span class="s2">"Joe"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$card</span><span class="o">-></span><span class="na">setLast_name</span><span class="p">(</span><span class="s2">"Shopper"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$card</span><span class="o">-></span><span class="na">setBilling_address</span><span class="p">(</span><span class="nv">$addr</span><span class="p">);</span>
|
||||||
|
|
||||||
|
<span class="nv">$fi</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">FundingInstrument</span><span class="p">();</span>
|
||||||
|
<span class="nv">$fi</span><span class="o">-></span><span class="na">setCredit_card</span><span class="p">(</span><span class="nv">$card</span><span class="p">);</span>
|
||||||
|
|
||||||
|
<span class="nv">$payer</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Payer</span><span class="p">();</span>
|
||||||
|
<span class="nv">$payer</span><span class="o">-></span><span class="na">setPayment_method</span><span class="p">(</span><span class="s2">"credit_card"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$payer</span><span class="o">-></span><span class="na">setFunding_instruments</span><span class="p">(</span><span class="k">array</span><span class="p">(</span><span class="nv">$fi</span><span class="p">));</span>
|
||||||
|
|
||||||
|
<span class="nv">$amount</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Amount</span><span class="p">();</span>
|
||||||
|
<span class="nv">$amount</span><span class="o">-></span><span class="na">setCurrency</span><span class="p">(</span><span class="s2">"USD"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$amount</span><span class="o">-></span><span class="na">setTotal</span><span class="p">(</span><span class="s2">"1.00"</span><span class="p">);</span>
|
||||||
|
|
||||||
|
<span class="nv">$transaction</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Transaction</span><span class="p">();</span>
|
||||||
|
<span class="nv">$transaction</span><span class="o">-></span><span class="na">setAmount</span><span class="p">(</span><span class="nv">$amount</span><span class="p">);</span>
|
||||||
|
<span class="nv">$transaction</span><span class="o">-></span><span class="na">setDescription</span><span class="p">(</span><span class="s2">"This is the payment description."</span><span class="p">);</span>
|
||||||
|
|
||||||
|
<span class="nv">$payment</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Payment</span><span class="p">();</span>
|
||||||
|
<span class="nv">$payment</span><span class="o">-></span><span class="na">setIntent</span><span class="p">(</span><span class="s2">"authorize"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$payment</span><span class="o">-></span><span class="na">setPayer</span><span class="p">(</span><span class="nv">$payer</span><span class="p">);</span>
|
||||||
|
<span class="nv">$payment</span><span class="o">-></span><span class="na">setTransactions</span><span class="p">(</span><span class="k">array</span><span class="p">(</span><span class="nv">$transaction</span><span class="p">));</span>
|
||||||
|
|
||||||
|
<span class="nv">$paymnt</span> <span class="o">=</span> <span class="nv">$payment</span><span class="o">-></span><span class="na">create</span><span class="p">(</span><span class="nv">$apiContext</span><span class="p">);</span>
|
||||||
|
<span class="nv">$resArray</span> <span class="o">=</span> <span class="nv">$paymnt</span><span class="o">-></span><span class="na">toArray</span><span class="p">();</span>
|
||||||
|
|
||||||
|
<span class="k">return</span> <span class="nv">$authId</span> <span class="o">=</span> <span class="nv">$resArray</span><span class="p">[</span><span class="s1">'transactions'</span><span class="p">][</span><span class="mi">0</span><span class="p">][</span><span class="s1">'related_resources'</span><span class="p">][</span><span class="mi">0</span><span class="p">][</span><span class="s1">'authorization'</span><span class="p">][</span><span class="s1">'id'</span><span class="p">];</span>
|
||||||
|
<span class="p">}</span></div></div></div><div class="segment"><div class="comments"><a href="../">Back</a></div></div></div><script type="text/javascript" src="assets/jquery.min.js"></script><script type="text/javascript" src="assets/docs.js"></script></a>
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
<!DOCTYPE html><html lang="en"><head><title>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="CreatePayment"><meta name="groc-project-path" content="CreatePayment.php"><link rel="stylesheet" type="text/css" media="all" href="assets/style.css"><body><div id="document"><div class="segment"><a id="segment-0" name="segment-0" class="section_anchor"></a><div class="code"><div class="wrapper"><span class="cp"><?php</span></div></div></div><div class="segment"><a id="segment-1" name="segment-1" class="section_anchor"></a><div class="comments"><div class="pilwrap"><a href="#segment-1" class="pilcrow">¶</a></div><div class="wrapper"><h1 id="createpaymentsample">CreatePaymentSample</h1>
|
<!DOCTYPE html><html lang="en"><head><title>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="CreatePayment"><meta name="groc-project-path" content="CreatePayment.php"><link rel="stylesheet" type="text/css" media="all" href="assets/style.css"><body></body></html><a href="../">Back<div id="document"><div class="segment"><a id="segment-0" name="segment-0" class="section_anchor"></a><div class="code"><div class="wrapper"><span class="cp"><?php</span></div></div></div><div class="segment"><a id="segment-1" name="segment-1" class="section_anchor"></a><div class="comments"><div class="pilwrap"><a href="#segment-1" class="pilcrow">¶</a></div><div class="wrapper"><h1 id="createpaymentsample">CreatePaymentSample</h1>
|
||||||
|
|
||||||
<p>This sample code demonstrate how you can process
|
<p>This sample code demonstrate how you can process
|
||||||
a payment with a credit card.
|
a payment with a credit card.
|
||||||
@@ -81,4 +81,4 @@ The return object contains the status;</p></div></div><div class="code"><div cla
|
|||||||
<span class="x"> <pre></span><span class="cp"><?php</span> <span class="nb">var_dump</span><span class="p">(</span><span class="nv">$payment</span><span class="o">-></span><span class="na">toArray</span><span class="p">());</span><span class="cp">?></span><span class="x"></pre></span>
|
<span class="x"> <pre></span><span class="cp"><?php</span> <span class="nb">var_dump</span><span class="p">(</span><span class="nv">$payment</span><span class="o">-></span><span class="na">toArray</span><span class="p">());</span><span class="cp">?></span><span class="x"></pre></span>
|
||||||
<span class="x"> <a href='../index.html'>Back</a></span>
|
<span class="x"> <a href='../index.html'>Back</a></span>
|
||||||
<span class="x"></body></span>
|
<span class="x"></body></span>
|
||||||
<span class="x"></html></span></div></div></div><div class="segment"><div class="comments"><a href="../">Back</a></div></div></div><script type="text/javascript" src="assets/jquery.min.js"></script><script type="text/javascript" src="assets/docs.js"></script></body></html>
|
<span class="x"></html></span></div></div></div><div class="segment"><div class="comments"><a href="../">Back</a></div></div></div><script type="text/javascript" src="assets/jquery.min.js"></script><script type="text/javascript" src="assets/docs.js"></script></a>
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
<!DOCTYPE html><html lang="en"><head><title>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="CreatePaymentUsingPayPal"><meta name="groc-project-path" content="CreatePaymentUsingPayPal.php"><link rel="stylesheet" type="text/css" media="all" href="assets/style.css"><body><div id="document"><div class="segment"><a id="segment-0" name="segment-0" class="section_anchor"></a><div class="code"><div class="wrapper"><span class="cp"><?php</span></div></div></div><div class="segment"><a id="segment-1" name="segment-1" class="section_anchor"></a><div class="comments"><div class="pilwrap"><a href="#segment-1" class="pilcrow">¶</a></div><div class="wrapper"><h1 id="create-payment-using-paypal-as-payment-method">Create Payment using PayPal as payment method</h1>
|
<!DOCTYPE html><html lang="en"><head><title>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="CreatePaymentUsingPayPal"><meta name="groc-project-path" content="CreatePaymentUsingPayPal.php"><link rel="stylesheet" type="text/css" media="all" href="assets/style.css"><body></body></html><a href="../">Back<div id="document"><div class="segment"><a id="segment-0" name="segment-0" class="section_anchor"></a><div class="code"><div class="wrapper"><span class="cp"><?php</span></div></div></div><div class="segment"><a id="segment-1" name="segment-1" class="section_anchor"></a><div class="comments"><div class="pilwrap"><a href="#segment-1" class="pilcrow">¶</a></div><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
|
<p>This sample code demonstrates how you can process a
|
||||||
PayPal Account based Payment.
|
PayPal Account based Payment.
|
||||||
@@ -64,4 +64,4 @@ payment id in a database.</p></div></div><div class="code"><div class="wrapper">
|
|||||||
<span class="k">if</span><span class="p">(</span><span class="nb">isset</span><span class="p">(</span><span class="nv">$redirectUrl</span><span class="p">))</span> <span class="p">{</span>
|
<span class="k">if</span><span class="p">(</span><span class="nb">isset</span><span class="p">(</span><span class="nv">$redirectUrl</span><span class="p">))</span> <span class="p">{</span>
|
||||||
<span class="nx">header</span><span class="p">(</span><span class="s2">"Location: </span><span class="si">$redirectUrl</span><span class="s2">"</span><span class="p">);</span>
|
<span class="nx">header</span><span class="p">(</span><span class="s2">"Location: </span><span class="si">$redirectUrl</span><span class="s2">"</span><span class="p">);</span>
|
||||||
<span class="k">exit</span><span class="p">;</span>
|
<span class="k">exit</span><span class="p">;</span>
|
||||||
<span class="p">}</span></div></div></div><div class="segment"><div class="comments"><a href="../">Back</a></div></div></div><script type="text/javascript" src="assets/jquery.min.js"></script><script type="text/javascript" src="assets/docs.js"></script></body></html>
|
<span class="p">}</span></div></div></div><div class="segment"><div class="comments"><a href="../">Back</a></div></div></div><script type="text/javascript" src="assets/jquery.min.js"></script><script type="text/javascript" src="assets/docs.js"></script></a>
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
<!DOCTYPE html><html lang="en"><head><title>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="CreatePaymentUsingSavedCard"><meta name="groc-project-path" content="CreatePaymentUsingSavedCard.php"><link rel="stylesheet" type="text/css" media="all" href="assets/style.css"><body><div id="document"><div class="segment"><a id="segment-0" name="segment-0" class="section_anchor"></a><div class="code"><div class="wrapper"><span class="cp"><?php</span></div></div></div><div class="segment"><a id="segment-1" name="segment-1" class="section_anchor"></a><div class="comments"><div class="pilwrap"><a href="#segment-1" class="pilcrow">¶</a></div><div class="wrapper"><h1 id="create-payment-using-a-saved-credit-card">Create payment using a saved credit card</h1>
|
<!DOCTYPE html><html lang="en"><head><title>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="CreatePaymentUsingSavedCard"><meta name="groc-project-path" content="CreatePaymentUsingSavedCard.php"><link rel="stylesheet" type="text/css" media="all" href="assets/style.css"><body></body></html><a href="../">Back<div id="document"><div class="segment"><a id="segment-0" name="segment-0" class="section_anchor"></a><div class="code"><div class="wrapper"><span class="cp"><?php</span></div></div></div><div class="segment"><a id="segment-1" name="segment-1" class="section_anchor"></a><div class="comments"><div class="pilwrap"><a href="#segment-1" class="pilcrow">¶</a></div><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
|
<p>This sample code demonstrates how you can process a
|
||||||
Payment using a previously saved credit card.
|
Payment using a previously saved credit card.
|
||||||
@@ -68,4 +68,4 @@ The return object contains the status;</p></div></div><div class="code"><div cla
|
|||||||
<span class="x"> <pre></span><span class="cp"><?php</span> <span class="nb">var_dump</span><span class="p">(</span><span class="nv">$payment</span><span class="o">-></span><span class="na">toArray</span><span class="p">());</span><span class="cp">?></span><span class="x"></pre></span>
|
<span class="x"> <pre></span><span class="cp"><?php</span> <span class="nb">var_dump</span><span class="p">(</span><span class="nv">$payment</span><span class="o">-></span><span class="na">toArray</span><span class="p">());</span><span class="cp">?></span><span class="x"></pre></span>
|
||||||
<span class="x"> <a href='../index.html'>Back</a></span>
|
<span class="x"> <a href='../index.html'>Back</a></span>
|
||||||
<span class="x"></body></span>
|
<span class="x"></body></span>
|
||||||
<span class="x"></html></span></div></div></div><div class="segment"><div class="comments"><a href="../">Back</a></div></div></div><script type="text/javascript" src="assets/jquery.min.js"></script><script type="text/javascript" src="assets/docs.js"></script></body></html>
|
<span class="x"></html></span></div></div></div><div class="segment"><div class="comments"><a href="../">Back</a></div></div></div><script type="text/javascript" src="assets/jquery.min.js"></script><script type="text/javascript" src="assets/docs.js"></script></a>
|
||||||
50
sample/source/DeleteCreditCard.html
Normal file
50
sample/source/DeleteCreditCard.html
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
<!DOCTYPE html><html lang="en"><head><title>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="DeleteCreditCard"><meta name="groc-project-path" content="DeleteCreditCard.php"><link rel="stylesheet" type="text/css" media="all" href="assets/style.css"><body></body></html><a href="../">Back<div id="document"><div class="segment"><a id="segment-0" name="segment-0" class="section_anchor"></a><div class="code"><div class="wrapper"><span class="cp"><?php</span></div></div></div><div class="segment"><a id="segment-1" name="segment-1" class="section_anchor"></a><div class="comments"><div class="pilwrap"><a href="#segment-1" class="pilcrow">¶</a></div><div class="wrapper"><h1 id="delete-creditcard-sample">Delete CreditCard Sample</h1>
|
||||||
|
|
||||||
|
<p>This sample code demonstrate how you can</p></div></div><div class="code"><div class="wrapper"><span class="c1">//delete a saved creditcard</span></div></div></div><div class="segment"><a id="segment-2" name="segment-2" class="section_anchor"></a><div class="comments"><div class="pilwrap"><a href="#segment-2" class="pilcrow">¶</a></div><div class="wrapper"><p>using the delete API.
|
||||||
|
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="k">require</span> <span class="nx">__DIR__</span> <span class="o">.</span> <span class="s1">'/../bootstrap.php'</span><span class="p">;</span>
|
||||||
|
<span class="k">use</span> <span class="nx">PayPal\Api\CreditCard</span><span class="p">;</span>
|
||||||
|
<span class="k">use</span> <span class="nx">PayPal\Api\Address</span><span class="p">;</span></div></div></div><div class="segment"><a id="segment-3" name="segment-3" class="section_anchor"></a><div class="comments"><div class="pilwrap"><a href="#segment-3" class="pilcrow">¶</a></div><div class="wrapper"><p>save card for demo </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="nv">$card</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">CreditCard</span><span class="p">();</span>
|
||||||
|
<span class="nv">$card</span><span class="o">-></span><span class="na">setType</span><span class="p">(</span><span class="s2">"visa"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$card</span><span class="o">-></span><span class="na">setNumber</span><span class="p">(</span><span class="s2">"4417119669820331"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$card</span><span class="o">-></span><span class="na">setExpire_month</span><span class="p">(</span><span class="s2">"11"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$card</span><span class="o">-></span><span class="na">setExpire_year</span><span class="p">(</span><span class="s2">"2019"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$card</span><span class="o">-></span><span class="na">setCvv2</span><span class="p">(</span><span class="s2">"012"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$card</span><span class="o">-></span><span class="na">setFirst_name</span><span class="p">(</span><span class="s2">"Joe"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$card</span><span class="o">-></span><span class="na">setLast_name</span><span class="p">(</span><span class="s2">"Shopper"</span><span class="p">);</span></div></div></div><div class="segment"><a id="segment-4" name="segment-4" class="section_anchor"></a><div class="comments"><div class="pilwrap"><a href="#segment-4" class="pilcrow">¶</a></div><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 the future payments.
|
||||||
|
(See bootstrap.php for more on <code>ApiContext</code>)</p></div></div><div class="code"><div class="wrapper"><span class="k">try</span> <span class="p">{</span>
|
||||||
|
<span class="nv">$res</span> <span class="o">=</span> <span class="nv">$card</span><span class="o">-></span><span class="na">create</span><span class="p">(</span><span class="nv">$apiContext</span><span class="p">);</span>
|
||||||
|
<span class="p">}</span> <span class="k">catch</span> <span class="p">(</span><span class="nx">\PPConnectionException</span> <span class="nv">$ex</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="k">echo</span> <span class="s2">"Exception:"</span> <span class="o">.</span> <span class="nv">$ex</span><span class="o">-></span><span class="na">getMessage</span><span class="p">()</span> <span class="o">.</span> <span class="nx">PHP_EOL</span><span class="p">;</span>
|
||||||
|
<span class="nb">var_dump</span><span class="p">(</span><span class="nv">$ex</span><span class="o">-></span><span class="na">getData</span><span class="p">());</span>
|
||||||
|
<span class="k">exit</span><span class="p">(</span><span class="mi">1</span><span class="p">);</span>
|
||||||
|
<span class="p">}</span>
|
||||||
|
|
||||||
|
<span class="nv">$creditCard</span> <span class="o">=</span> <span class="nx">CreditCard</span><span class="o">::</span><span class="na">get</span><span class="p">(</span><span class="nv">$res</span><span class="o">-></span><span class="na">getId</span><span class="p">(),</span> <span class="nv">$apiContext</span><span class="p">);</span>
|
||||||
|
<span class="k">try</span> <span class="p">{</span></div></div></div><div class="segment"><a id="segment-5" name="segment-5" class="section_anchor"></a><div class="comments"><div class="pilwrap"><a href="#segment-5" class="pilcrow">¶</a></div><div class="wrapper"><h3 id="delete-card">Delete Card</h3>
|
||||||
|
|
||||||
|
<p>deletes saved credit card
|
||||||
|
(See bootstrap.php for more on <code>ApiContext</code>)</p></div></div><div class="code"><div class="wrapper"> <span class="nv">$creditCard</span><span class="o">-></span><span class="na">delete</span><span class="p">(</span><span class="nv">$apiContext</span><span class="p">);</span>
|
||||||
|
<span class="p">}</span> <span class="k">catch</span> <span class="p">(</span><span class="nx">\PPConnectionException</span> <span class="nv">$ex</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="k">echo</span> <span class="s2">"Exception: "</span> <span class="o">.</span> <span class="nv">$ex</span><span class="o">-></span><span class="na">getMessage</span><span class="p">()</span> <span class="o">.</span> <span class="nx">PHP_EOL</span><span class="p">;</span>
|
||||||
|
<span class="k">exit</span><span class="p">(</span><span class="mi">1</span><span class="p">);</span>
|
||||||
|
<span class="p">}</span>
|
||||||
|
<span class="cp">?></span><span class="x"></span>
|
||||||
|
|
||||||
|
<span class="x"><html></span>
|
||||||
|
<span class="x"><body></span>
|
||||||
|
<span class="x"><div>Delete CreditCard:</div></span>
|
||||||
|
<span class="x"> <p> Credit Card deleted Successfully</p></span>
|
||||||
|
<span class="x"> <a href='../index.html'>Back</a></span>
|
||||||
|
<span class="x"></body></span>
|
||||||
|
<span class="x"></html></span></div></div></div><div class="segment"><div class="comments"><a href="../">Back</a></div></div></div><script type="text/javascript" src="assets/jquery.min.js"></script><script type="text/javascript" src="assets/docs.js"></script></a>
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
<!DOCTYPE html><html lang="en"><head><title>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="ExecutePayment"><meta name="groc-project-path" content="ExecutePayment.php"><link rel="stylesheet" type="text/css" media="all" href="assets/style.css"><body><div id="document"><div class="segment"><a id="segment-0" name="segment-0" class="section_anchor"></a><div class="code"><div class="wrapper"><span class="cp"><?php</span></div></div></div><div class="segment"><a id="segment-1" name="segment-1" class="section_anchor"></a><div class="comments"><div class="pilwrap"><a href="#segment-1" class="pilcrow">¶</a></div><div class="wrapper"><h1 id="execute-payment-sample">Execute Payment Sample</h1>
|
<!DOCTYPE html><html lang="en"><head><title>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="ExecutePayment"><meta name="groc-project-path" content="ExecutePayment.php"><link rel="stylesheet" type="text/css" media="all" href="assets/style.css"><body></body></html><a href="../">Back<div id="document"><div class="segment"><a id="segment-0" name="segment-0" class="section_anchor"></a><div class="code"><div class="wrapper"><span class="cp"><?php</span></div></div></div><div class="segment"><a id="segment-1" name="segment-1" class="section_anchor"></a><div class="comments"><div class="pilwrap"><a href="#segment-1" class="pilcrow">¶</a></div><div class="wrapper"><h1 id="execute-payment-sample">Execute Payment Sample</h1>
|
||||||
|
|
||||||
<p>This sample shows how you can complete
|
<p>This sample shows how you can complete
|
||||||
a payment that has been approved by
|
a payment that has been approved by
|
||||||
@@ -29,4 +29,4 @@ when the user is redirected from paypal back to your site</p></div></div><div cl
|
|||||||
|
|
||||||
<span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
|
<span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
|
||||||
<span class="k">echo</span> <span class="s2">"User cancelled payment."</span><span class="p">;</span>
|
<span class="k">echo</span> <span class="s2">"User cancelled payment."</span><span class="p">;</span>
|
||||||
<span class="p">}</span></div></div></div><div class="segment"><div class="comments"><a href="../">Back</a></div></div></div><script type="text/javascript" src="assets/jquery.min.js"></script><script type="text/javascript" src="assets/docs.js"></script></body></html>
|
<span class="p">}</span></div></div></div><div class="segment"><div class="comments"><a href="../">Back</a></div></div></div><script type="text/javascript" src="assets/jquery.min.js"></script><script type="text/javascript" src="assets/docs.js"></script></a>
|
||||||
81
sample/source/GetAuthorization.html
Normal file
81
sample/source/GetAuthorization.html
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
<!DOCTYPE html><html lang="en"><head><title>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="GetAuthorization"><meta name="groc-project-path" content="GetAuthorization.php"><link rel="stylesheet" type="text/css" media="all" href="assets/style.css"><body></body></html><a href="../">Back<div id="document"><div class="segment"><a id="segment-0" name="segment-0" class="section_anchor"></a><div class="code"><div class="wrapper"><span class="cp"><?php</span></div></div></div><div class="segment"><a id="segment-1" name="segment-1" class="section_anchor"></a><div class="comments"><div class="pilwrap"><a href="#segment-1" class="pilcrow">¶</a></div><div class="wrapper"><h1 id="getauthorization">GetAuthorization</h1>
|
||||||
|
|
||||||
|
<p>This sample code demonstrate 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="k">require</span> <span class="nx">__DIR__</span> <span class="o">.</span> <span class="s1">'/../bootstrap.php'</span><span class="p">;</span>
|
||||||
|
|
||||||
|
<span class="k">use</span> <span class="nx">PayPal\Api\Authorization</span><span class="p">;</span>
|
||||||
|
<span class="k">use</span> <span class="nx">PayPal\Api\Address</span><span class="p">;</span>
|
||||||
|
<span class="k">use</span> <span class="nx">PayPal\Api\Amount</span><span class="p">;</span>
|
||||||
|
<span class="k">use</span> <span class="nx">PayPal\Api\CreditCard</span><span class="p">;</span>
|
||||||
|
<span class="k">use</span> <span class="nx">PayPal\Api\Payer</span><span class="p">;</span>
|
||||||
|
<span class="k">use</span> <span class="nx">PayPal\Api\Payment</span><span class="p">;</span>
|
||||||
|
<span class="k">use</span> <span class="nx">PayPal\Api\FundingInstrument</span><span class="p">;</span>
|
||||||
|
<span class="k">use</span> <span class="nx">PayPal\Api\Transaction</span><span class="p">;</span></div></div></div><div class="segment"><a id="segment-2" name="segment-2" class="section_anchor"></a><div class="comments"><div class="pilwrap"><a href="#segment-2" class="pilcrow">¶</a></div><div class="wrapper"><p>create payment to get authorization Id</p></div></div><div class="code"><div class="wrapper"><span class="nv">$authId</span> <span class="o">=</span> <span class="nx">createAuthorization</span><span class="p">(</span><span class="nv">$apiContext</span><span class="p">);</span></div></div></div><div class="segment"><a id="segment-3" name="segment-3" class="section_anchor"></a><div class="comments"><div class="pilwrap"><a href="#segment-3" class="pilcrow">¶</a></div><div class="wrapper"><h3 id="getauthorization">GetAuthorization</h3>
|
||||||
|
|
||||||
|
<p>GetAuthorization by posting to the APIService
|
||||||
|
using a valid ApiContext (See bootstrap.php for more on <code>ApiContext</code>)
|
||||||
|
The return object contains the status;</p></div></div><div class="code"><div class="wrapper"><span class="k">try</span> <span class="p">{</span>
|
||||||
|
<span class="nv">$authorization</span> <span class="o">=</span> <span class="nx">Authorization</span><span class="o">::</span><span class="na">get</span><span class="p">(</span><span class="nv">$authId</span><span class="p">,</span> <span class="nv">$apiContext</span><span class="p">);</span>
|
||||||
|
<span class="p">}</span> <span class="k">catch</span> <span class="p">(</span><span class="nx">\PPConnectionException</span> <span class="nv">$ex</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="k">echo</span> <span class="s2">"Exception: "</span> <span class="o">.</span> <span class="nv">$ex</span><span class="o">-></span><span class="na">getMessage</span><span class="p">()</span> <span class="o">.</span> <span class="nx">PHP_EOL</span><span class="p">;</span>
|
||||||
|
<span class="nb">var_dump</span><span class="p">(</span><span class="nv">$ex</span><span class="o">-></span><span class="na">getData</span><span class="p">());</span>
|
||||||
|
<span class="k">exit</span><span class="p">(</span><span class="mi">1</span><span class="p">);</span>
|
||||||
|
<span class="p">}</span>
|
||||||
|
<span class="cp">?></span><span class="x"></span>
|
||||||
|
<span class="x"><html></span>
|
||||||
|
<span class="x"><body></span>
|
||||||
|
<span class="x"> <div></span>
|
||||||
|
<span class="x"> Get Authorization:</span>
|
||||||
|
<span class="x"> </span><span class="cp"><?php</span> <span class="k">echo</span> <span class="nv">$authorization</span><span class="o">-></span><span class="na">getId</span><span class="p">();</span><span class="cp">?></span><span class="x"></span>
|
||||||
|
<span class="x"> </div></span>
|
||||||
|
<span class="x"> <pre></span><span class="cp"><?php</span> <span class="nb">var_dump</span><span class="p">(</span><span class="nv">$authorization</span><span class="o">-></span><span class="na">toArray</span><span class="p">());</span><span class="cp">?></span><span class="x"></pre></span>
|
||||||
|
<span class="x"> <a href='../index.html'>Back</a></span>
|
||||||
|
<span class="x"></body></span>
|
||||||
|
<span class="x"></html></span>
|
||||||
|
<span class="cp"><?php</span>
|
||||||
|
<span class="k">function</span> <span class="nf">createAuthorization</span><span class="p">(</span><span class="nv">$apiContext</span><span class="p">)</span>
|
||||||
|
<span class="p">{</span>
|
||||||
|
<span class="nv">$addr</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Address</span><span class="p">();</span>
|
||||||
|
<span class="nv">$addr</span><span class="o">-></span><span class="na">setLine1</span><span class="p">(</span><span class="s2">"3909 Witmer Road"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$addr</span><span class="o">-></span><span class="na">setLine2</span><span class="p">(</span><span class="s2">"Niagara Falls"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$addr</span><span class="o">-></span><span class="na">setCity</span><span class="p">(</span><span class="s2">"Niagara Falls"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$addr</span><span class="o">-></span><span class="na">setState</span><span class="p">(</span><span class="s2">"NY"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$addr</span><span class="o">-></span><span class="na">setPostal_code</span><span class="p">(</span><span class="s2">"14305"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$addr</span><span class="o">-></span><span class="na">setCountry_code</span><span class="p">(</span><span class="s2">"US"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$addr</span><span class="o">-></span><span class="na">setPhone</span><span class="p">(</span><span class="s2">"716-298-1822"</span><span class="p">);</span>
|
||||||
|
|
||||||
|
<span class="nv">$card</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">CreditCard</span><span class="p">();</span>
|
||||||
|
<span class="nv">$card</span><span class="o">-></span><span class="na">setType</span><span class="p">(</span><span class="s2">"visa"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$card</span><span class="o">-></span><span class="na">setNumber</span><span class="p">(</span><span class="s2">"4417119669820331"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$card</span><span class="o">-></span><span class="na">setExpire_month</span><span class="p">(</span><span class="s2">"11"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$card</span><span class="o">-></span><span class="na">setExpire_year</span><span class="p">(</span><span class="s2">"2019"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$card</span><span class="o">-></span><span class="na">setCvv2</span><span class="p">(</span><span class="s2">"012"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$card</span><span class="o">-></span><span class="na">setFirst_name</span><span class="p">(</span><span class="s2">"Joe"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$card</span><span class="o">-></span><span class="na">setLast_name</span><span class="p">(</span><span class="s2">"Shopper"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$card</span><span class="o">-></span><span class="na">setBilling_address</span><span class="p">(</span><span class="nv">$addr</span><span class="p">);</span>
|
||||||
|
|
||||||
|
<span class="nv">$fi</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">FundingInstrument</span><span class="p">();</span>
|
||||||
|
<span class="nv">$fi</span><span class="o">-></span><span class="na">setCredit_card</span><span class="p">(</span><span class="nv">$card</span><span class="p">);</span>
|
||||||
|
|
||||||
|
<span class="nv">$payer</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Payer</span><span class="p">();</span>
|
||||||
|
<span class="nv">$payer</span><span class="o">-></span><span class="na">setPayment_method</span><span class="p">(</span><span class="s2">"credit_card"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$payer</span><span class="o">-></span><span class="na">setFunding_instruments</span><span class="p">(</span><span class="k">array</span><span class="p">(</span><span class="nv">$fi</span><span class="p">));</span>
|
||||||
|
|
||||||
|
<span class="nv">$amount</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Amount</span><span class="p">();</span>
|
||||||
|
<span class="nv">$amount</span><span class="o">-></span><span class="na">setCurrency</span><span class="p">(</span><span class="s2">"USD"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$amount</span><span class="o">-></span><span class="na">setTotal</span><span class="p">(</span><span class="s2">"1.00"</span><span class="p">);</span>
|
||||||
|
|
||||||
|
<span class="nv">$transaction</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Transaction</span><span class="p">();</span>
|
||||||
|
<span class="nv">$transaction</span><span class="o">-></span><span class="na">setAmount</span><span class="p">(</span><span class="nv">$amount</span><span class="p">);</span>
|
||||||
|
<span class="nv">$transaction</span><span class="o">-></span><span class="na">setDescription</span><span class="p">(</span><span class="s2">"This is the payment description."</span><span class="p">);</span>
|
||||||
|
|
||||||
|
<span class="nv">$payment</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Payment</span><span class="p">();</span>
|
||||||
|
<span class="nv">$payment</span><span class="o">-></span><span class="na">setIntent</span><span class="p">(</span><span class="s2">"authorize"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$payment</span><span class="o">-></span><span class="na">setPayer</span><span class="p">(</span><span class="nv">$payer</span><span class="p">);</span>
|
||||||
|
<span class="nv">$payment</span><span class="o">-></span><span class="na">setTransactions</span><span class="p">(</span><span class="k">array</span><span class="p">(</span><span class="nv">$transaction</span><span class="p">));</span>
|
||||||
|
|
||||||
|
<span class="nv">$paymnt</span> <span class="o">=</span> <span class="nv">$payment</span><span class="o">-></span><span class="na">create</span><span class="p">(</span><span class="nv">$apiContext</span><span class="p">);</span>
|
||||||
|
<span class="nv">$resArray</span> <span class="o">=</span> <span class="nv">$paymnt</span><span class="o">-></span><span class="na">toArray</span><span class="p">();</span>
|
||||||
|
|
||||||
|
<span class="k">return</span> <span class="nv">$authId</span> <span class="o">=</span> <span class="nv">$resArray</span><span class="p">[</span><span class="s1">'transactions'</span><span class="p">][</span><span class="mi">0</span><span class="p">][</span><span class="s1">'related_resources'</span><span class="p">][</span><span class="mi">0</span><span class="p">][</span><span class="s1">'authorization'</span><span class="p">][</span><span class="s1">'id'</span><span class="p">];</span>
|
||||||
|
<span class="p">}</span></div></div></div><div class="segment"><div class="comments"><a href="../">Back</a></div></div></div><script type="text/javascript" src="assets/jquery.min.js"></script><script type="text/javascript" src="assets/docs.js"></script></a>
|
||||||
99
sample/source/GetCapture.html
Normal file
99
sample/source/GetCapture.html
Normal file
@@ -0,0 +1,99 @@
|
|||||||
|
<!DOCTYPE html><html lang="en"><head><title>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="GetCapture"><meta name="groc-project-path" content="GetCapture.php"><link rel="stylesheet" type="text/css" media="all" href="assets/style.css"><body></body></html><a href="../">Back<div id="document"><div class="segment"><a id="segment-0" name="segment-0" class="section_anchor"></a><div class="code"><div class="wrapper"><span class="cp"><?php</span></div></div></div><div class="segment"><a id="segment-1" name="segment-1" class="section_anchor"></a><div class="comments"><div class="pilwrap"><a href="#segment-1" class="pilcrow">¶</a></div><div class="wrapper"><h1 id="getcapture">GetCapture</h1>
|
||||||
|
|
||||||
|
<p>This sample code demonstrate how you can get the details of Captured Payment
|
||||||
|
API used: /v1/payments/capture/<$captureId></p></div></div><div class="code"><div class="wrapper"><span class="k">require</span> <span class="nx">__DIR__</span> <span class="o">.</span> <span class="s1">'/../bootstrap.php'</span><span class="p">;</span>
|
||||||
|
<span class="k">use</span> <span class="nx">PayPal\Api\Capture</span><span class="p">;</span>
|
||||||
|
<span class="k">use</span> <span class="nx">PayPal\Api\Address</span><span class="p">;</span>
|
||||||
|
<span class="k">use</span> <span class="nx">PayPal\Api\Amount</span><span class="p">;</span>
|
||||||
|
<span class="k">use</span> <span class="nx">PayPal\Api\CreditCard</span><span class="p">;</span>
|
||||||
|
<span class="k">use</span> <span class="nx">PayPal\Api\Payer</span><span class="p">;</span>
|
||||||
|
<span class="k">use</span> <span class="nx">PayPal\Api\Payment</span><span class="p">;</span>
|
||||||
|
<span class="k">use</span> <span class="nx">PayPal\Api\FundingInstrument</span><span class="p">;</span>
|
||||||
|
<span class="k">use</span> <span class="nx">PayPal\Api\Transaction</span><span class="p">;</span>
|
||||||
|
<span class="k">use</span> <span class="nx">PayPal\Api\Authorization</span><span class="p">;</span></div></div></div><div class="segment"><a id="segment-2" name="segment-2" class="section_anchor"></a><div class="comments"><div class="pilwrap"><a href="#segment-2" class="pilcrow">¶</a></div><div class="wrapper"><p>create payment to get authorization Id</p></div></div><div class="code"><div class="wrapper"><span class="nv">$authId</span> <span class="o">=</span> <span class="nx">createAuthorization</span><span class="p">(</span><span class="nv">$apiContext</span><span class="p">);</span>
|
||||||
|
<span class="nv">$amt</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Amount</span><span class="p">();</span>
|
||||||
|
<span class="nv">$amt</span><span class="o">-></span><span class="na">setCurrency</span><span class="p">(</span><span class="s2">"USD"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$amt</span><span class="o">-></span><span class="na">setTotal</span><span class="p">(</span><span class="s2">"1.00"</span><span class="p">);</span>
|
||||||
|
|
||||||
|
<span class="c1">### Capture</span>
|
||||||
|
<span class="nv">$captur</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Capture</span><span class="p">();</span>
|
||||||
|
<span class="nv">$captur</span><span class="o">-></span><span class="na">setId</span><span class="p">(</span><span class="nv">$authId</span><span class="p">);</span>
|
||||||
|
<span class="nv">$captur</span><span class="o">-></span><span class="na">setAmount</span><span class="p">(</span><span class="nv">$amt</span><span class="p">);</span></div></div></div><div class="segment"><a id="segment-3" name="segment-3" class="section_anchor"></a><div class="comments"><div class="pilwrap"><a href="#segment-3" class="pilcrow">¶</a></div><div class="wrapper"><p>get the authorization</p></div></div><div class="code"><div class="wrapper"><span class="nv">$authorization</span> <span class="o">=</span> <span class="nx">Authorization</span><span class="o">::</span><span class="na">get</span><span class="p">(</span><span class="nv">$authId</span><span class="p">,</span> <span class="nv">$apiContext</span><span class="p">);</span></div></div></div><div class="segment"><a id="segment-4" name="segment-4" class="section_anchor"></a><div class="comments"><div class="pilwrap"><a href="#segment-4" class="pilcrow">¶</a></div><div class="wrapper"><h3 id="capture-payment">Capture Payment</h3>
|
||||||
|
|
||||||
|
<p>Capture Payment by posting to the APIService
|
||||||
|
using a valid ApiContext (See bootstrap.php for more on <code>ApiContext</code>)
|
||||||
|
The return object contains the status;</p></div></div><div class="code"><div class="wrapper"><span class="k">try</span> <span class="p">{</span>
|
||||||
|
<span class="nv">$capt</span> <span class="o">=</span> <span class="nv">$authorization</span><span class="o">-></span><span class="na">capture</span><span class="p">(</span><span class="nv">$captur</span><span class="p">,</span> <span class="nv">$apiContext</span><span class="p">);</span>
|
||||||
|
<span class="p">}</span> <span class="k">catch</span> <span class="p">(</span><span class="nx">\PPConnectionException</span> <span class="nv">$ex</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="k">echo</span> <span class="s2">"Exception: "</span> <span class="o">.</span> <span class="nv">$ex</span><span class="o">-></span><span class="na">getMessage</span><span class="p">()</span> <span class="o">.</span> <span class="nx">PHP_EOL</span><span class="p">;</span>
|
||||||
|
<span class="nb">var_dump</span><span class="p">(</span><span class="nv">$ex</span><span class="o">-></span><span class="na">getData</span><span class="p">());</span>
|
||||||
|
<span class="k">exit</span><span class="p">(</span><span class="mi">1</span><span class="p">);</span>
|
||||||
|
<span class="p">}</span></div></div></div><div class="segment"><a id="segment-5" name="segment-5" class="section_anchor"></a><div class="comments"><div class="pilwrap"><a href="#segment-5" class="pilcrow">¶</a></div><div class="wrapper"><h3 id="get-capture">Get Capture</h3>
|
||||||
|
|
||||||
|
<p>Get Capture by posting to the APIService
|
||||||
|
using a valid ApiContext (See bootstrap.php for more on <code>ApiContext</code>)
|
||||||
|
The return object contains the status;</p></div></div><div class="code"><div class="wrapper"><span class="k">try</span> <span class="p">{</span>
|
||||||
|
<span class="nv">$capture</span> <span class="o">=</span> <span class="nx">Capture</span><span class="o">::</span><span class="na">get</span><span class="p">(</span><span class="nv">$capt</span><span class="o">-></span><span class="na">getId</span><span class="p">(),</span> <span class="nv">$apiContext</span><span class="p">);</span>
|
||||||
|
<span class="p">}</span> <span class="k">catch</span> <span class="p">(</span><span class="nx">\PPConnectionException</span> <span class="nv">$ex</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="k">echo</span> <span class="s2">"Exception: "</span> <span class="o">.</span> <span class="nv">$ex</span><span class="o">-></span><span class="na">getMessage</span><span class="p">()</span> <span class="o">.</span> <span class="nx">PHP_EOL</span><span class="p">;</span>
|
||||||
|
<span class="nb">var_dump</span><span class="p">(</span><span class="nv">$ex</span><span class="o">-></span><span class="na">getData</span><span class="p">());</span>
|
||||||
|
<span class="k">exit</span><span class="p">(</span><span class="mi">1</span><span class="p">);</span>
|
||||||
|
<span class="p">}</span>
|
||||||
|
<span class="cp">?></span><span class="x"></span>
|
||||||
|
<span class="x"><html></span>
|
||||||
|
<span class="x"><body></span>
|
||||||
|
<span class="x"> <div></span>
|
||||||
|
<span class="x"> Get Capture :</span>
|
||||||
|
<span class="x"> </span><span class="cp"><?php</span> <span class="k">echo</span> <span class="nv">$capture</span><span class="o">-></span><span class="na">getId</span><span class="p">();</span><span class="cp">?></span><span class="x"></span>
|
||||||
|
<span class="x"> </div></span>
|
||||||
|
<span class="x"> <pre></span><span class="cp"><?php</span> <span class="nb">var_dump</span><span class="p">(</span><span class="nv">$capture</span><span class="o">-></span><span class="na">toArray</span><span class="p">());</span><span class="cp">?></span><span class="x"></pre></span>
|
||||||
|
<span class="x"> <a href='../index.html'>Back</a></span>
|
||||||
|
<span class="x"></body></span>
|
||||||
|
<span class="x"></html></span>
|
||||||
|
<span class="cp"><?php</span>
|
||||||
|
<span class="k">function</span> <span class="nf">createAuthorization</span><span class="p">(</span><span class="nv">$apiContext</span><span class="p">)</span>
|
||||||
|
<span class="p">{</span>
|
||||||
|
<span class="nv">$addr</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Address</span><span class="p">();</span>
|
||||||
|
<span class="nv">$addr</span><span class="o">-></span><span class="na">setLine1</span><span class="p">(</span><span class="s2">"3909 Witmer Road"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$addr</span><span class="o">-></span><span class="na">setLine2</span><span class="p">(</span><span class="s2">"Niagara Falls"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$addr</span><span class="o">-></span><span class="na">setCity</span><span class="p">(</span><span class="s2">"Niagara Falls"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$addr</span><span class="o">-></span><span class="na">setState</span><span class="p">(</span><span class="s2">"NY"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$addr</span><span class="o">-></span><span class="na">setPostal_code</span><span class="p">(</span><span class="s2">"14305"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$addr</span><span class="o">-></span><span class="na">setCountry_code</span><span class="p">(</span><span class="s2">"US"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$addr</span><span class="o">-></span><span class="na">setPhone</span><span class="p">(</span><span class="s2">"716-298-1822"</span><span class="p">);</span>
|
||||||
|
|
||||||
|
<span class="nv">$card</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">CreditCard</span><span class="p">();</span>
|
||||||
|
<span class="nv">$card</span><span class="o">-></span><span class="na">setType</span><span class="p">(</span><span class="s2">"visa"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$card</span><span class="o">-></span><span class="na">setNumber</span><span class="p">(</span><span class="s2">"4417119669820331"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$card</span><span class="o">-></span><span class="na">setExpire_month</span><span class="p">(</span><span class="s2">"11"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$card</span><span class="o">-></span><span class="na">setExpire_year</span><span class="p">(</span><span class="s2">"2019"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$card</span><span class="o">-></span><span class="na">setCvv2</span><span class="p">(</span><span class="s2">"012"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$card</span><span class="o">-></span><span class="na">setFirst_name</span><span class="p">(</span><span class="s2">"Joe"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$card</span><span class="o">-></span><span class="na">setLast_name</span><span class="p">(</span><span class="s2">"Shopper"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$card</span><span class="o">-></span><span class="na">setBilling_address</span><span class="p">(</span><span class="nv">$addr</span><span class="p">);</span>
|
||||||
|
|
||||||
|
<span class="nv">$fi</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">FundingInstrument</span><span class="p">();</span>
|
||||||
|
<span class="nv">$fi</span><span class="o">-></span><span class="na">setCredit_card</span><span class="p">(</span><span class="nv">$card</span><span class="p">);</span>
|
||||||
|
|
||||||
|
<span class="nv">$payer</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Payer</span><span class="p">();</span>
|
||||||
|
<span class="nv">$payer</span><span class="o">-></span><span class="na">setPayment_method</span><span class="p">(</span><span class="s2">"credit_card"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$payer</span><span class="o">-></span><span class="na">setFunding_instruments</span><span class="p">(</span><span class="k">array</span><span class="p">(</span><span class="nv">$fi</span><span class="p">));</span>
|
||||||
|
|
||||||
|
<span class="nv">$amount</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Amount</span><span class="p">();</span>
|
||||||
|
<span class="nv">$amount</span><span class="o">-></span><span class="na">setCurrency</span><span class="p">(</span><span class="s2">"USD"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$amount</span><span class="o">-></span><span class="na">setTotal</span><span class="p">(</span><span class="s2">"1.00"</span><span class="p">);</span>
|
||||||
|
|
||||||
|
<span class="nv">$transaction</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Transaction</span><span class="p">();</span>
|
||||||
|
<span class="nv">$transaction</span><span class="o">-></span><span class="na">setAmount</span><span class="p">(</span><span class="nv">$amount</span><span class="p">);</span>
|
||||||
|
<span class="nv">$transaction</span><span class="o">-></span><span class="na">setDescription</span><span class="p">(</span><span class="s2">"This is the payment description."</span><span class="p">);</span>
|
||||||
|
|
||||||
|
<span class="nv">$payment</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Payment</span><span class="p">();</span>
|
||||||
|
<span class="nv">$payment</span><span class="o">-></span><span class="na">setIntent</span><span class="p">(</span><span class="s2">"authorize"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$payment</span><span class="o">-></span><span class="na">setPayer</span><span class="p">(</span><span class="nv">$payer</span><span class="p">);</span>
|
||||||
|
<span class="nv">$payment</span><span class="o">-></span><span class="na">setTransactions</span><span class="p">(</span><span class="k">array</span><span class="p">(</span><span class="nv">$transaction</span><span class="p">));</span>
|
||||||
|
|
||||||
|
<span class="nv">$paymnt</span> <span class="o">=</span> <span class="nv">$payment</span><span class="o">-></span><span class="na">create</span><span class="p">(</span><span class="nv">$apiContext</span><span class="p">);</span>
|
||||||
|
<span class="nv">$resArray</span> <span class="o">=</span> <span class="nv">$paymnt</span><span class="o">-></span><span class="na">toArray</span><span class="p">();</span>
|
||||||
|
|
||||||
|
<span class="k">return</span> <span class="nv">$authId</span> <span class="o">=</span> <span class="nv">$resArray</span><span class="p">[</span><span class="s1">'transactions'</span><span class="p">][</span><span class="mi">0</span><span class="p">][</span><span class="s1">'related_resources'</span><span class="p">][</span><span class="mi">0</span><span class="p">][</span><span class="s1">'authorization'</span><span class="p">][</span><span class="s1">'id'</span><span class="p">];</span>
|
||||||
|
<span class="p">}</span></div></div></div><div class="segment"><div class="comments"><a href="../">Back</a></div></div></div><script type="text/javascript" src="assets/jquery.min.js"></script><script type="text/javascript" src="assets/docs.js"></script></a>
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
<!DOCTYPE html><html lang="en"><head><title>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="GetPayment"><meta name="groc-project-path" content="GetPayment.php"><link rel="stylesheet" type="text/css" media="all" href="assets/style.css"><body><div id="document"><div class="segment"><a id="segment-0" name="segment-0" class="section_anchor"></a><div class="code"><div class="wrapper"><span class="cp"><?php</span></div></div></div><div class="segment"><a id="segment-1" name="segment-1" class="section_anchor"></a><div class="comments"><div class="pilwrap"><a href="#segment-1" class="pilcrow">¶</a></div><div class="wrapper"><h1 id="getpaymentsample">GetPaymentSample</h1>
|
<!DOCTYPE html><html lang="en"><head><title>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="GetPayment"><meta name="groc-project-path" content="GetPayment.php"><link rel="stylesheet" type="text/css" media="all" href="assets/style.css"><body></body></html><a href="../">Back<div id="document"><div class="segment"><a id="segment-0" name="segment-0" class="section_anchor"></a><div class="code"><div class="wrapper"><span class="cp"><?php</span></div></div></div><div class="segment"><a id="segment-1" name="segment-1" class="section_anchor"></a><div class="comments"><div class="pilwrap"><a href="#segment-1" class="pilcrow">¶</a></div><div class="wrapper"><h1 id="getpaymentsample">GetPaymentSample</h1>
|
||||||
|
|
||||||
<p>This sample code demonstrate how you can
|
<p>This sample code demonstrate how you can
|
||||||
retrieve a list of all Payment resources
|
retrieve a list of all Payment resources
|
||||||
@@ -29,4 +29,4 @@ Payment ID
|
|||||||
<span class="x"> <pre></span><span class="cp"><?php</span> <span class="nb">var_dump</span><span class="p">(</span><span class="nv">$payment</span><span class="o">-></span><span class="na">toArray</span><span class="p">());</span><span class="cp">?></span><span class="x"></pre></span>
|
<span class="x"> <pre></span><span class="cp"><?php</span> <span class="nb">var_dump</span><span class="p">(</span><span class="nv">$payment</span><span class="o">-></span><span class="na">toArray</span><span class="p">());</span><span class="cp">?></span><span class="x"></pre></span>
|
||||||
<span class="x"> <a href='../index.html'>Back</a></span>
|
<span class="x"> <a href='../index.html'>Back</a></span>
|
||||||
<span class="x"></body></span>
|
<span class="x"></body></span>
|
||||||
<span class="x"></html></span></div></div></div><div class="segment"><div class="comments"><a href="../">Back</a></div></div></div><script type="text/javascript" src="assets/jquery.min.js"></script><script type="text/javascript" src="assets/docs.js"></script></body></html>
|
<span class="x"></html></span></div></div></div><div class="segment"><div class="comments"><a href="../">Back</a></div></div></div><script type="text/javascript" src="assets/jquery.min.js"></script><script type="text/javascript" src="assets/docs.js"></script></a>
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
<!DOCTYPE html><html lang="en"><head><title>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="ListPayments"><meta name="groc-project-path" content="ListPayments.php"><link rel="stylesheet" type="text/css" media="all" href="assets/style.css"><body><div id="document"><div class="segment"><a id="segment-0" name="segment-0" class="section_anchor"></a><div class="code"><div class="wrapper"><span class="cp"><?php</span></div></div></div><div class="segment"><a id="segment-1" name="segment-1" class="section_anchor"></a><div class="comments"><div class="pilwrap"><a href="#segment-1" class="pilcrow">¶</a></div><div class="wrapper"><h1 id="getpaymentlist">GetPaymentList</h1>
|
<!DOCTYPE html><html lang="en"><head><title>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="ListPayments"><meta name="groc-project-path" content="ListPayments.php"><link rel="stylesheet" type="text/css" media="all" href="assets/style.css"><body></body></html><a href="../">Back<div id="document"><div class="segment"><a id="segment-0" name="segment-0" class="section_anchor"></a><div class="code"><div class="wrapper"><span class="cp"><?php</span></div></div></div><div class="segment"><a id="segment-1" name="segment-1" class="section_anchor"></a><div class="comments"><div class="pilwrap"><a href="#segment-1" class="pilcrow">¶</a></div><div class="wrapper"><h1 id="getpaymentlist">GetPaymentList</h1>
|
||||||
|
|
||||||
<p>This sample code demonstrate how you can
|
<p>This sample code demonstrate how you can
|
||||||
retrieve a list of all Payment resources
|
retrieve a list of all Payment resources
|
||||||
@@ -28,4 +28,4 @@ Refer the method doc for valid values for keys
|
|||||||
<span class="x"> <pre></span><span class="cp"><?php</span> <span class="nb">var_dump</span><span class="p">(</span><span class="nv">$payments</span><span class="o">-></span><span class="na">toArray</span><span class="p">());</span><span class="cp">?></span><span class="x"></pre></span>
|
<span class="x"> <pre></span><span class="cp"><?php</span> <span class="nb">var_dump</span><span class="p">(</span><span class="nv">$payments</span><span class="o">-></span><span class="na">toArray</span><span class="p">());</span><span class="cp">?></span><span class="x"></pre></span>
|
||||||
<span class="x"> <a href='../index.html'>Back</a></span>
|
<span class="x"> <a href='../index.html'>Back</a></span>
|
||||||
<span class="x"></body></span>
|
<span class="x"></body></span>
|
||||||
<span class="x"></html></span></div></div></div><div class="segment"><div class="comments"><a href="../">Back</a></div></div></div><script type="text/javascript" src="assets/jquery.min.js"></script><script type="text/javascript" src="assets/docs.js"></script></body></html>
|
<span class="x"></html></span></div></div></div><div class="segment"><div class="comments"><a href="../">Back</a></div></div></div><script type="text/javascript" src="assets/jquery.min.js"></script><script type="text/javascript" src="assets/docs.js"></script></a>
|
||||||
106
sample/source/RefundCapture.html
Normal file
106
sample/source/RefundCapture.html
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
<!DOCTYPE html><html lang="en"><head><title>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="RefundCapture"><meta name="groc-project-path" content="RefundCapture.php"><link rel="stylesheet" type="text/css" media="all" href="assets/style.css"><body></body></html><a href="../">Back<div id="document"><div class="segment"><a id="segment-0" name="segment-0" class="section_anchor"></a><div class="code"><div class="wrapper"><span class="cp"><?php</span></div></div></div><div class="segment"><a id="segment-1" name="segment-1" class="section_anchor"></a><div class="comments"><div class="pilwrap"><a href="#segment-1" class="pilcrow">¶</a></div><div class="wrapper"><h1 id="refund-capture-sample">Refund Capture Sample</h1>
|
||||||
|
|
||||||
|
<p>This sample code demonstrate how you can
|
||||||
|
process a refund on a Captured transaction created
|
||||||
|
using the Capture API.
|
||||||
|
API used: /v1/payments/capture/{<captureID>}/refund</p></div></div><div class="code"><div class="wrapper"><span class="k">require</span> <span class="nx">__DIR__</span> <span class="o">.</span> <span class="s1">'/../bootstrap.php'</span><span class="p">;</span>
|
||||||
|
<span class="k">use</span> <span class="nx">PayPal\Api\Authorization</span><span class="p">;</span>
|
||||||
|
<span class="k">use</span> <span class="nx">PayPal\Api\Capture</span><span class="p">;</span>
|
||||||
|
<span class="k">use</span> <span class="nx">PayPal\Api\Refund</span><span class="p">;</span>
|
||||||
|
<span class="k">use</span> <span class="nx">PayPal\Api\Address</span><span class="p">;</span>
|
||||||
|
<span class="k">use</span> <span class="nx">PayPal\Api\Amount</span><span class="p">;</span>
|
||||||
|
<span class="k">use</span> <span class="nx">PayPal\Api\CreditCard</span><span class="p">;</span>
|
||||||
|
<span class="k">use</span> <span class="nx">PayPal\Api\Payer</span><span class="p">;</span>
|
||||||
|
<span class="k">use</span> <span class="nx">PayPal\Api\Payment</span><span class="p">;</span>
|
||||||
|
<span class="k">use</span> <span class="nx">PayPal\Api\FundingInstrument</span><span class="p">;</span>
|
||||||
|
<span class="k">use</span> <span class="nx">PayPal\Api\Transaction</span><span class="p">;</span>
|
||||||
|
<span class="k">use</span> <span class="nx">PayPal\Rest\ApiContext</span><span class="p">;</span>
|
||||||
|
<span class="k">use</span> <span class="nx">PayPal\Auth\OAuthTokenCredential</span><span class="p">;</span></div></div></div><div class="segment"><a id="segment-2" name="segment-2" class="section_anchor"></a><div class="comments"><div class="pilwrap"><a href="#segment-2" class="pilcrow">¶</a></div><div class="wrapper"><p>create payment to get authorization Id</p></div></div><div class="code"><div class="wrapper"><span class="nv">$authId</span> <span class="o">=</span> <span class="nx">createAuthorization</span><span class="p">(</span><span class="nv">$apiContext</span><span class="p">);</span>
|
||||||
|
|
||||||
|
<span class="nv">$amt</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Amount</span><span class="p">();</span>
|
||||||
|
<span class="nv">$amt</span><span class="o">-></span><span class="na">setCurrency</span><span class="p">(</span><span class="s2">"USD"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$amt</span><span class="o">-></span><span class="na">setTotal</span><span class="p">(</span><span class="s2">"1.00"</span><span class="p">);</span>
|
||||||
|
|
||||||
|
<span class="c1">### Capture</span>
|
||||||
|
<span class="nv">$captur</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Capture</span><span class="p">();</span>
|
||||||
|
<span class="nv">$captur</span><span class="o">-></span><span class="na">setAmount</span><span class="p">(</span><span class="nv">$amt</span><span class="p">);</span></div></div></div><div class="segment"><a id="segment-3" name="segment-3" class="section_anchor"></a><div class="comments"><div class="pilwrap"><a href="#segment-3" class="pilcrow">¶</a></div><div class="wrapper"><p>get the authorization</p></div></div><div class="code"><div class="wrapper"><span class="nv">$authorization</span> <span class="o">=</span> <span class="nx">Authorization</span><span class="o">::</span><span class="na">get</span><span class="p">(</span><span class="nv">$authId</span><span class="p">,</span> <span class="nv">$apiContext</span><span class="p">);</span></div></div></div><div class="segment"><a id="segment-4" name="segment-4" class="section_anchor"></a><div class="comments"><div class="pilwrap"><a href="#segment-4" class="pilcrow">¶</a></div><div class="wrapper"><h3 id="capture-payment">Capture Payment</h3>
|
||||||
|
|
||||||
|
<p>Capture Payment by posting to the APIService
|
||||||
|
using a valid ApiContext (See bootstrap.php for more on <code>ApiContext</code>)
|
||||||
|
The return object contains the status;</p></div></div><div class="code"><div class="wrapper"><span class="k">try</span> <span class="p">{</span>
|
||||||
|
<span class="nv">$capt</span> <span class="o">=</span> <span class="nv">$authorization</span><span class="o">-></span><span class="na">capture</span><span class="p">(</span><span class="nv">$captur</span><span class="p">,</span> <span class="nv">$apiContext</span><span class="p">);</span>
|
||||||
|
<span class="p">}</span> <span class="k">catch</span> <span class="p">(</span><span class="nx">\PPConnectionException</span> <span class="nv">$ex</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="k">echo</span> <span class="s2">"Exception: "</span> <span class="o">.</span> <span class="nv">$ex</span><span class="o">-></span><span class="na">getMessage</span><span class="p">()</span> <span class="o">.</span> <span class="nx">PHP_EOL</span><span class="p">;</span>
|
||||||
|
<span class="nb">var_dump</span><span class="p">(</span><span class="nv">$ex</span><span class="o">-></span><span class="na">getData</span><span class="p">());</span>
|
||||||
|
<span class="k">exit</span><span class="p">(</span><span class="mi">1</span><span class="p">);</span>
|
||||||
|
<span class="p">}</span></div></div></div><div class="segment"><a id="segment-5" name="segment-5" class="section_anchor"></a><div class="comments"><div class="pilwrap"><a href="#segment-5" class="pilcrow">¶</a></div><div class="wrapper"><h3 id="refund">Refund</h3>
|
||||||
|
|
||||||
|
<p>Create a refund object indicating
|
||||||
|
refund amount</p></div></div><div class="code"><div class="wrapper"><span class="nv">$refund</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Refund</span><span class="p">();</span>
|
||||||
|
<span class="nv">$refund</span><span class="o">-></span><span class="na">setAmount</span><span class="p">(</span><span class="nv">$amt</span><span class="p">);</span>
|
||||||
|
|
||||||
|
<span class="nv">$capture</span> <span class="o">=</span> <span class="nx">Capture</span><span class="o">::</span><span class="na">get</span><span class="p">(</span><span class="nv">$capt</span><span class="o">-></span><span class="na">getId</span><span class="p">(),</span> <span class="nv">$apiContext</span><span class="p">);</span></div></div></div><div class="segment"><a id="segment-6" name="segment-6" class="section_anchor"></a><div class="comments"><div class="pilwrap"><a href="#segment-6" class="pilcrow">¶</a></div><div class="wrapper"><p>create new API context </p></div></div><div class="code"><div class="wrapper"><span class="nv">$context</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">ApiContext</span><span class="p">(</span><span class="k">new</span> <span class="nx">OAuthTokenCredential</span><span class="p">(</span>
|
||||||
|
<span class="s1">'EBWKjlELKMYqRNQ6sYvFo64FtaRLRR5BdHEESmha49TM'</span><span class="p">,</span>
|
||||||
|
<span class="s1">'EO422dn3gQLgDbuwqTjzrFgFtaRLRR5BdHEESmha49TM'</span><span class="p">));</span>
|
||||||
|
<span class="k">try</span> <span class="p">{</span></div></div></div><div class="segment"><a id="segment-7" name="segment-7" class="section_anchor"></a><div class="comments"><div class="pilwrap"><a href="#segment-7" class="pilcrow">¶</a></div><div class="wrapper"><p>(See bootstrap.php for more on <code>ApiContext</code>)</p></div></div><div class="code"><div class="wrapper"> <span class="nv">$captureRefund</span> <span class="o">=</span> <span class="nv">$capture</span><span class="o">-></span><span class="na">refund</span><span class="p">(</span><span class="nv">$refund</span><span class="p">,</span> <span class="nv">$context</span><span class="p">);</span>
|
||||||
|
<span class="p">}</span> <span class="k">catch</span> <span class="p">(</span><span class="nx">\PPConnectionException</span> <span class="nv">$ex</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="k">echo</span> <span class="s2">"Exception: "</span> <span class="o">.</span> <span class="nv">$ex</span><span class="o">-></span><span class="na">getMessage</span><span class="p">()</span> <span class="o">.</span> <span class="nx">PHP_EOL</span><span class="p">;</span>
|
||||||
|
<span class="nb">var_dump</span><span class="p">(</span><span class="nv">$ex</span><span class="o">-></span><span class="na">getData</span><span class="p">());</span>
|
||||||
|
<span class="k">exit</span><span class="p">(</span><span class="mi">1</span><span class="p">);</span>
|
||||||
|
<span class="p">}</span>
|
||||||
|
<span class="cp">?></span><span class="x"></span>
|
||||||
|
|
||||||
|
<span class="x"><html></span>
|
||||||
|
<span class="x"><body></span>
|
||||||
|
<span class="x"> <div>Refund Capture:</div></span>
|
||||||
|
<span class="x"> <pre></span><span class="cp"><?php</span> <span class="nb">var_dump</span><span class="p">(</span><span class="nv">$captureRefund</span><span class="p">);</span><span class="cp">?></span><span class="x"></pre></span>
|
||||||
|
<span class="x"> <a href='../index.html'>Back</a></span>
|
||||||
|
<span class="x"></body></span>
|
||||||
|
<span class="x"></html></span>
|
||||||
|
<span class="cp"><?php</span>
|
||||||
|
<span class="k">function</span> <span class="nf">createAuthorization</span><span class="p">(</span><span class="nv">$apiContext</span><span class="p">)</span>
|
||||||
|
<span class="p">{</span>
|
||||||
|
<span class="nv">$addr</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Address</span><span class="p">();</span>
|
||||||
|
<span class="nv">$addr</span><span class="o">-></span><span class="na">setLine1</span><span class="p">(</span><span class="s2">"3909 Witmer Road"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$addr</span><span class="o">-></span><span class="na">setLine2</span><span class="p">(</span><span class="s2">"Niagara Falls"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$addr</span><span class="o">-></span><span class="na">setCity</span><span class="p">(</span><span class="s2">"Niagara Falls"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$addr</span><span class="o">-></span><span class="na">setState</span><span class="p">(</span><span class="s2">"NY"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$addr</span><span class="o">-></span><span class="na">setPostal_code</span><span class="p">(</span><span class="s2">"14305"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$addr</span><span class="o">-></span><span class="na">setCountry_code</span><span class="p">(</span><span class="s2">"US"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$addr</span><span class="o">-></span><span class="na">setPhone</span><span class="p">(</span><span class="s2">"716-298-1822"</span><span class="p">);</span>
|
||||||
|
|
||||||
|
<span class="nv">$card</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">CreditCard</span><span class="p">();</span>
|
||||||
|
<span class="nv">$card</span><span class="o">-></span><span class="na">setType</span><span class="p">(</span><span class="s2">"visa"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$card</span><span class="o">-></span><span class="na">setNumber</span><span class="p">(</span><span class="s2">"4417119669820331"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$card</span><span class="o">-></span><span class="na">setExpire_month</span><span class="p">(</span><span class="s2">"11"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$card</span><span class="o">-></span><span class="na">setExpire_year</span><span class="p">(</span><span class="s2">"2019"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$card</span><span class="o">-></span><span class="na">setCvv2</span><span class="p">(</span><span class="s2">"012"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$card</span><span class="o">-></span><span class="na">setFirst_name</span><span class="p">(</span><span class="s2">"Joe"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$card</span><span class="o">-></span><span class="na">setLast_name</span><span class="p">(</span><span class="s2">"Shopper"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$card</span><span class="o">-></span><span class="na">setBilling_address</span><span class="p">(</span><span class="nv">$addr</span><span class="p">);</span>
|
||||||
|
|
||||||
|
<span class="nv">$fi</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">FundingInstrument</span><span class="p">();</span>
|
||||||
|
<span class="nv">$fi</span><span class="o">-></span><span class="na">setCredit_card</span><span class="p">(</span><span class="nv">$card</span><span class="p">);</span>
|
||||||
|
|
||||||
|
<span class="nv">$payer</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Payer</span><span class="p">();</span>
|
||||||
|
<span class="nv">$payer</span><span class="o">-></span><span class="na">setPayment_method</span><span class="p">(</span><span class="s2">"credit_card"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$payer</span><span class="o">-></span><span class="na">setFunding_instruments</span><span class="p">(</span><span class="k">array</span><span class="p">(</span><span class="nv">$fi</span><span class="p">));</span>
|
||||||
|
|
||||||
|
<span class="nv">$amount</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Amount</span><span class="p">();</span>
|
||||||
|
<span class="nv">$amount</span><span class="o">-></span><span class="na">setCurrency</span><span class="p">(</span><span class="s2">"USD"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$amount</span><span class="o">-></span><span class="na">setTotal</span><span class="p">(</span><span class="s2">"10.00"</span><span class="p">);</span>
|
||||||
|
|
||||||
|
<span class="nv">$transaction</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Transaction</span><span class="p">();</span>
|
||||||
|
<span class="nv">$transaction</span><span class="o">-></span><span class="na">setAmount</span><span class="p">(</span><span class="nv">$amount</span><span class="p">);</span>
|
||||||
|
<span class="nv">$transaction</span><span class="o">-></span><span class="na">setDescription</span><span class="p">(</span><span class="s2">"This is the payment description."</span><span class="p">);</span>
|
||||||
|
|
||||||
|
<span class="nv">$payment</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Payment</span><span class="p">();</span>
|
||||||
|
<span class="nv">$payment</span><span class="o">-></span><span class="na">setIntent</span><span class="p">(</span><span class="s2">"authorize"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$payment</span><span class="o">-></span><span class="na">setPayer</span><span class="p">(</span><span class="nv">$payer</span><span class="p">);</span>
|
||||||
|
<span class="nv">$payment</span><span class="o">-></span><span class="na">setTransactions</span><span class="p">(</span><span class="k">array</span><span class="p">(</span><span class="nv">$transaction</span><span class="p">));</span>
|
||||||
|
|
||||||
|
<span class="nv">$paymnt</span> <span class="o">=</span> <span class="nv">$payment</span><span class="o">-></span><span class="na">create</span><span class="p">(</span><span class="nv">$apiContext</span><span class="p">);</span>
|
||||||
|
<span class="nv">$resArray</span> <span class="o">=</span> <span class="nv">$paymnt</span><span class="o">-></span><span class="na">toArray</span><span class="p">();</span>
|
||||||
|
|
||||||
|
<span class="k">return</span> <span class="nv">$authId</span> <span class="o">=</span> <span class="nv">$resArray</span><span class="p">[</span><span class="s1">'transactions'</span><span class="p">][</span><span class="mi">0</span><span class="p">][</span><span class="s1">'related_resources'</span><span class="p">][</span><span class="mi">0</span><span class="p">][</span><span class="s1">'authorization'</span><span class="p">][</span><span class="s1">'id'</span><span class="p">];</span>
|
||||||
|
<span class="p">}</span></div></div></div><div class="segment"><div class="comments"><a href="../">Back</a></div></div></div><script type="text/javascript" src="assets/jquery.min.js"></script><script type="text/javascript" src="assets/docs.js"></script></a>
|
||||||
82
sample/source/VoidAuthorization.html
Normal file
82
sample/source/VoidAuthorization.html
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
<!DOCTYPE html><html lang="en"><head><title>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="VoidAuthorization"><meta name="groc-project-path" content="VoidAuthorization.php"><link rel="stylesheet" type="text/css" media="all" href="assets/style.css"><body></body></html><a href="../">Back<div id="document"><div class="segment"><a id="segment-0" name="segment-0" class="section_anchor"></a><div class="code"><div class="wrapper"><span class="cp"><?php</span></div></div></div><div class="segment"><a id="segment-1" name="segment-1" class="section_anchor"></a><div class="comments"><div class="pilwrap"><a href="#segment-1" class="pilcrow">¶</a></div><div class="wrapper"><h1 id="voidauthorization">VoidAuthorization</h1>
|
||||||
|
|
||||||
|
<p>This sample code demonstrate 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="k">require</span> <span class="nx">__DIR__</span> <span class="o">.</span> <span class="s1">'/../bootstrap.php'</span><span class="p">;</span>
|
||||||
|
|
||||||
|
<span class="k">use</span> <span class="nx">PayPal\Api\Authorization</span><span class="p">;</span>
|
||||||
|
<span class="k">use</span> <span class="nx">PayPal\Api\Address</span><span class="p">;</span>
|
||||||
|
<span class="k">use</span> <span class="nx">PayPal\Api\Amount</span><span class="p">;</span>
|
||||||
|
<span class="k">use</span> <span class="nx">PayPal\Api\CreditCard</span><span class="p">;</span>
|
||||||
|
<span class="k">use</span> <span class="nx">PayPal\Api\Payer</span><span class="p">;</span>
|
||||||
|
<span class="k">use</span> <span class="nx">PayPal\Api\Payment</span><span class="p">;</span>
|
||||||
|
<span class="k">use</span> <span class="nx">PayPal\Api\FundingInstrument</span><span class="p">;</span>
|
||||||
|
<span class="k">use</span> <span class="nx">PayPal\Api\Transaction</span><span class="p">;</span></div></div></div><div class="segment"><a id="segment-2" name="segment-2" class="section_anchor"></a><div class="comments"><div class="pilwrap"><a href="#segment-2" class="pilcrow">¶</a></div><div class="wrapper"><p>create payment to get authorization Id</p></div></div><div class="code"><div class="wrapper"><span class="nv">$authId</span> <span class="o">=</span> <span class="nx">createAuthorization</span><span class="p">(</span><span class="nv">$apiContext</span><span class="p">);</span>
|
||||||
|
|
||||||
|
<span class="nv">$authorization</span> <span class="o">=</span> <span class="nx">Authorization</span><span class="o">::</span><span class="na">get</span><span class="p">(</span><span class="nv">$authId</span><span class="p">,</span> <span class="nv">$apiContext</span><span class="p">);</span></div></div></div><div class="segment"><a id="segment-3" name="segment-3" class="section_anchor"></a><div class="comments"><div class="pilwrap"><a href="#segment-3" class="pilcrow">¶</a></div><div class="wrapper"><h3 id="voidauthorization">VoidAuthorization</h3>
|
||||||
|
|
||||||
|
<p>VoidAuthorization by posting to the APIService
|
||||||
|
using a valid ApiContext (See bootstrap.php for more on <code>ApiContext</code>)
|
||||||
|
The return object contains the status;</p></div></div><div class="code"><div class="wrapper"><span class="k">try</span> <span class="p">{</span>
|
||||||
|
<span class="nv">$void</span> <span class="o">=</span> <span class="nv">$authorization</span><span class="o">-></span><span class="na">void</span><span class="p">(</span><span class="nv">$apiContext</span><span class="p">);</span>
|
||||||
|
<span class="p">}</span> <span class="k">catch</span> <span class="p">(</span><span class="nx">\PPConnectionException</span> <span class="nv">$ex</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="k">echo</span> <span class="s2">"Exception: "</span> <span class="o">.</span> <span class="nv">$ex</span><span class="o">-></span><span class="na">getMessage</span><span class="p">()</span> <span class="o">.</span> <span class="nx">PHP_EOL</span><span class="p">;</span>
|
||||||
|
<span class="nb">var_dump</span><span class="p">(</span><span class="nv">$ex</span><span class="o">-></span><span class="na">getData</span><span class="p">());</span>
|
||||||
|
<span class="k">exit</span><span class="p">(</span><span class="mi">1</span><span class="p">);</span>
|
||||||
|
<span class="p">}</span>
|
||||||
|
<span class="cp">?></span><span class="x"></span>
|
||||||
|
<span class="x"><html></span>
|
||||||
|
<span class="x"><body></span>
|
||||||
|
<span class="x"> <div></span>
|
||||||
|
<span class="x"> Void Authorization:</span>
|
||||||
|
<span class="x"> </div></span>
|
||||||
|
<span class="x"> <pre></span><span class="cp"><?php</span> <span class="nb">var_dump</span><span class="p">(</span><span class="nv">$void</span><span class="o">-></span><span class="na">toArray</span><span class="p">());</span><span class="cp">?></span><span class="x"></pre></span>
|
||||||
|
<span class="x"> <a href='../index.html'>Back</a></span>
|
||||||
|
<span class="x"></body></span>
|
||||||
|
<span class="x"></html></span>
|
||||||
|
<span class="cp"><?php</span>
|
||||||
|
<span class="k">function</span> <span class="nf">createAuthorization</span><span class="p">(</span><span class="nv">$apiContext</span><span class="p">)</span>
|
||||||
|
<span class="p">{</span>
|
||||||
|
<span class="nv">$addr</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Address</span><span class="p">();</span>
|
||||||
|
<span class="nv">$addr</span><span class="o">-></span><span class="na">setLine1</span><span class="p">(</span><span class="s2">"3909 Witmer Road"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$addr</span><span class="o">-></span><span class="na">setLine2</span><span class="p">(</span><span class="s2">"Niagara Falls"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$addr</span><span class="o">-></span><span class="na">setCity</span><span class="p">(</span><span class="s2">"Niagara Falls"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$addr</span><span class="o">-></span><span class="na">setState</span><span class="p">(</span><span class="s2">"NY"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$addr</span><span class="o">-></span><span class="na">setPostal_code</span><span class="p">(</span><span class="s2">"14305"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$addr</span><span class="o">-></span><span class="na">setCountry_code</span><span class="p">(</span><span class="s2">"US"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$addr</span><span class="o">-></span><span class="na">setPhone</span><span class="p">(</span><span class="s2">"716-298-1822"</span><span class="p">);</span>
|
||||||
|
|
||||||
|
<span class="nv">$card</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">CreditCard</span><span class="p">();</span>
|
||||||
|
<span class="nv">$card</span><span class="o">-></span><span class="na">setType</span><span class="p">(</span><span class="s2">"visa"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$card</span><span class="o">-></span><span class="na">setNumber</span><span class="p">(</span><span class="s2">"4417119669820331"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$card</span><span class="o">-></span><span class="na">setExpire_month</span><span class="p">(</span><span class="s2">"11"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$card</span><span class="o">-></span><span class="na">setExpire_year</span><span class="p">(</span><span class="s2">"2019"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$card</span><span class="o">-></span><span class="na">setCvv2</span><span class="p">(</span><span class="s2">"012"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$card</span><span class="o">-></span><span class="na">setFirst_name</span><span class="p">(</span><span class="s2">"Joe"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$card</span><span class="o">-></span><span class="na">setLast_name</span><span class="p">(</span><span class="s2">"Shopper"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$card</span><span class="o">-></span><span class="na">setBilling_address</span><span class="p">(</span><span class="nv">$addr</span><span class="p">);</span>
|
||||||
|
|
||||||
|
<span class="nv">$fi</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">FundingInstrument</span><span class="p">();</span>
|
||||||
|
<span class="nv">$fi</span><span class="o">-></span><span class="na">setCredit_card</span><span class="p">(</span><span class="nv">$card</span><span class="p">);</span>
|
||||||
|
|
||||||
|
<span class="nv">$payer</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Payer</span><span class="p">();</span>
|
||||||
|
<span class="nv">$payer</span><span class="o">-></span><span class="na">setPayment_method</span><span class="p">(</span><span class="s2">"credit_card"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$payer</span><span class="o">-></span><span class="na">setFunding_instruments</span><span class="p">(</span><span class="k">array</span><span class="p">(</span><span class="nv">$fi</span><span class="p">));</span>
|
||||||
|
|
||||||
|
<span class="nv">$amount</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Amount</span><span class="p">();</span>
|
||||||
|
<span class="nv">$amount</span><span class="o">-></span><span class="na">setCurrency</span><span class="p">(</span><span class="s2">"USD"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$amount</span><span class="o">-></span><span class="na">setTotal</span><span class="p">(</span><span class="s2">"1.00"</span><span class="p">);</span>
|
||||||
|
|
||||||
|
<span class="nv">$transaction</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Transaction</span><span class="p">();</span>
|
||||||
|
<span class="nv">$transaction</span><span class="o">-></span><span class="na">setAmount</span><span class="p">(</span><span class="nv">$amount</span><span class="p">);</span>
|
||||||
|
<span class="nv">$transaction</span><span class="o">-></span><span class="na">setDescription</span><span class="p">(</span><span class="s2">"This is the payment description."</span><span class="p">);</span>
|
||||||
|
|
||||||
|
<span class="nv">$payment</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Payment</span><span class="p">();</span>
|
||||||
|
<span class="nv">$payment</span><span class="o">-></span><span class="na">setIntent</span><span class="p">(</span><span class="s2">"authorize"</span><span class="p">);</span>
|
||||||
|
<span class="nv">$payment</span><span class="o">-></span><span class="na">setPayer</span><span class="p">(</span><span class="nv">$payer</span><span class="p">);</span>
|
||||||
|
<span class="nv">$payment</span><span class="o">-></span><span class="na">setTransactions</span><span class="p">(</span><span class="k">array</span><span class="p">(</span><span class="nv">$transaction</span><span class="p">));</span>
|
||||||
|
|
||||||
|
<span class="nv">$paymnt</span> <span class="o">=</span> <span class="nv">$payment</span><span class="o">-></span><span class="na">create</span><span class="p">(</span><span class="nv">$apiContext</span><span class="p">);</span>
|
||||||
|
<span class="nv">$resArray</span> <span class="o">=</span> <span class="nv">$paymnt</span><span class="o">-></span><span class="na">toArray</span><span class="p">();</span>
|
||||||
|
|
||||||
|
<span class="k">return</span> <span class="nv">$authId</span> <span class="o">=</span> <span class="nv">$resArray</span><span class="p">[</span><span class="s1">'transactions'</span><span class="p">][</span><span class="mi">0</span><span class="p">][</span><span class="s1">'related_resources'</span><span class="p">][</span><span class="mi">0</span><span class="p">][</span><span class="s1">'authorization'</span><span class="p">][</span><span class="s1">'id'</span><span class="p">];</span>
|
||||||
|
<span class="p">}</span></div></div></div><div class="segment"><div class="comments"><a href="../">Back</a></div></div></div><script type="text/javascript" src="assets/jquery.min.js"></script><script type="text/javascript" src="assets/docs.js"></script></a>
|
||||||
57
sample/vault/DeleteCreditCard.php
Normal file
57
sample/vault/DeleteCreditCard.php
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
<?php
|
||||||
|
// # Delete CreditCard Sample
|
||||||
|
// This sample code demonstrate how you can
|
||||||
|
//delete a saved creditcard
|
||||||
|
// using the delete API.
|
||||||
|
// API used: /v1/vault/credit-card/{<creditCardId>}
|
||||||
|
// NOTE: HTTP method used here is DELETE
|
||||||
|
require __DIR__ . '/../bootstrap.php';
|
||||||
|
use PayPal\Api\CreditCard;
|
||||||
|
use PayPal\Api\Address;
|
||||||
|
|
||||||
|
// save card for demo
|
||||||
|
// ### CreditCard
|
||||||
|
// A resource representing a credit card that can be
|
||||||
|
// used to fund a payment.
|
||||||
|
$card = new CreditCard();
|
||||||
|
$card->setType("visa");
|
||||||
|
$card->setNumber("4417119669820331");
|
||||||
|
$card->setExpire_month("11");
|
||||||
|
$card->setExpire_year("2019");
|
||||||
|
$card->setCvv2("012");
|
||||||
|
$card->setFirst_name("Joe");
|
||||||
|
$card->setLast_name("Shopper");
|
||||||
|
|
||||||
|
// ### Save card
|
||||||
|
// 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 the future payments.
|
||||||
|
// (See bootstrap.php for more on `ApiContext`)
|
||||||
|
try {
|
||||||
|
$res = $card->create($apiContext);
|
||||||
|
} catch (\PPConnectionException $ex) {
|
||||||
|
echo "Exception:" . $ex->getMessage() . PHP_EOL;
|
||||||
|
var_dump($ex->getData());
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
$creditCard = CreditCard::get($res->getId(), $apiContext);
|
||||||
|
try {
|
||||||
|
// ### Delete Card
|
||||||
|
// deletes saved credit card
|
||||||
|
// (See bootstrap.php for more on `ApiContext`)
|
||||||
|
$creditCard->delete($apiContext);
|
||||||
|
} catch (\PPConnectionException $ex) {
|
||||||
|
echo "Exception: " . $ex->getMessage() . PHP_EOL;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<html>
|
||||||
|
<body>
|
||||||
|
<div>Delete CreditCard:</div>
|
||||||
|
<p> Credit Card deleted Successfully</p>
|
||||||
|
<a href='../index.html'>Back</a>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -23,10 +23,9 @@ class AddressTest extends \PHPUnit_Framework_TestCase {
|
|||||||
$addr->setLine2(self::$line2);
|
$addr->setLine2(self::$line2);
|
||||||
$addr->setCity(self::$city);
|
$addr->setCity(self::$city);
|
||||||
$addr->setState(self::$state);
|
$addr->setState(self::$state);
|
||||||
$addr->setPostal_code(self::$postalCode);
|
$addr->setPostalCode(self::$postalCode);
|
||||||
$addr->setCountry_code(self::$countryCode);
|
$addr->setCountryCode(self::$countryCode);
|
||||||
$addr->setPhone(self::$phone);
|
$addr->setPhone(self::$phone);
|
||||||
$addr->setType(self::$type);
|
|
||||||
return $addr;
|
return $addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -39,10 +38,9 @@ class AddressTest extends \PHPUnit_Framework_TestCase {
|
|||||||
$this->assertEquals(self::$line2, $this->address->getLine2());
|
$this->assertEquals(self::$line2, $this->address->getLine2());
|
||||||
$this->assertEquals(self::$city, $this->address->getCity());
|
$this->assertEquals(self::$city, $this->address->getCity());
|
||||||
$this->assertEquals(self::$state, $this->address->getState());
|
$this->assertEquals(self::$state, $this->address->getState());
|
||||||
$this->assertEquals(self::$postalCode, $this->address->getPostal_code());
|
$this->assertEquals(self::$postalCode, $this->address->getPostalCode());
|
||||||
$this->assertEquals(self::$countryCode, $this->address->getCountry_code());
|
$this->assertEquals(self::$countryCode, $this->address->getCountryCode());
|
||||||
$this->assertEquals(self::$phone, $this->address->getPhone());
|
$this->assertEquals(self::$phone, $this->address->getPhone());
|
||||||
$this->assertEquals(self::$type, $this->address->getType());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSerializeDeserialize() {
|
public function testSerializeDeserialize() {
|
||||||
|
|||||||
@@ -24,14 +24,14 @@ class AmountTest extends \PHPUnit_Framework_TestCase {
|
|||||||
$this->amounts['partial'] = self::createAmount();
|
$this->amounts['partial'] = self::createAmount();
|
||||||
|
|
||||||
$amount = self::createAmount();
|
$amount = self::createAmount();
|
||||||
$amount->setDetails(AmountDetailsTest::createAmountDetails());
|
$amount->setDetails(DetailsTest::createAmountDetails());
|
||||||
$this->amounts['full'] = $amount;
|
$this->amounts['full'] = $amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetterSetter() {
|
public function testGetterSetter() {
|
||||||
$this->assertEquals(self::$currency, $this->amounts['partial']->getCurrency());
|
$this->assertEquals(self::$currency, $this->amounts['partial']->getCurrency());
|
||||||
$this->assertEquals(self::$total, $this->amounts['partial']->getTotal());
|
$this->assertEquals(self::$total, $this->amounts['partial']->getTotal());
|
||||||
$this->assertEquals(AmountDetailsTest::$fee, $this->amounts['full']->getDetails()->getFee());
|
$this->assertEquals(DetailsTest::$fee, $this->amounts['full']->getDetails()->getFee());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSerializeDeserialize() {
|
public function testSerializeDeserialize() {
|
||||||
|
|||||||
@@ -3,55 +3,106 @@ namespace PayPal\Test\Api;
|
|||||||
|
|
||||||
use PayPal\Api\Amount;
|
use PayPal\Api\Amount;
|
||||||
use PayPal\Api\Authorization;
|
use PayPal\Api\Authorization;
|
||||||
use PayPal\Api\Link;
|
use PayPal\Api\Links;
|
||||||
use PayPal\Test\Constants;
|
use PayPal\Test\Constants;
|
||||||
|
use PayPal\Api\RedirectUrls;
|
||||||
|
use PayPal\Api\Address;
|
||||||
|
|
||||||
|
use PayPal\Api\Capture;
|
||||||
|
use PayPal\Api\CreditCard;
|
||||||
|
use PayPal\Api\Payer;
|
||||||
|
use PayPal\Api\Payment;
|
||||||
|
use PayPal\Api\FundingInstrument;
|
||||||
|
use PayPal\Api\Transaction;
|
||||||
|
|
||||||
class AuthorizationTest extends \PHPUnit_Framework_TestCase {
|
class AuthorizationTest extends \PHPUnit_Framework_TestCase {
|
||||||
|
|
||||||
private $authorizations = array();
|
private $authorizations = array();
|
||||||
|
|
||||||
public static $create_time = "2013-02-28T00:00:00Z";
|
public static $create_time = "2013-02-28T00:00:00Z";
|
||||||
public static $id = "AUTH-123";
|
public static $id = "AUTH-123";
|
||||||
public static $state = "Created";
|
public static $state = "Created";
|
||||||
public static $parent_payment = "PAY-12345";
|
public static $parent_payment = "PAY-12345";
|
||||||
|
|
||||||
public static $currency = "USD";
|
public static $currency = "USD";
|
||||||
public static $total = "1.12";
|
public static $total = "1.12";
|
||||||
|
|
||||||
public static $href = "USD";
|
public static $href = "USD";
|
||||||
public static $rel = "1.12";
|
public static $rel = "1.12";
|
||||||
public static $method = "1.12";
|
public static $method = "1.12";
|
||||||
|
|
||||||
public static function createAuthorization() {
|
public static function createAuthorization() {
|
||||||
$authorization = new Authorization();
|
$authorization = new Authorization();
|
||||||
$authorization->setCreate_time(self::$create_time);
|
$authorization->setCreateTime(self::$create_time);
|
||||||
$authorization->setId(self::$id);
|
$authorization->setId(self::$id);
|
||||||
$authorization->setState(self::$state);
|
$authorization->setState(self::$state);
|
||||||
|
|
||||||
$authorization->setAmount(AmountTest::createAmount());
|
$authorization->setAmount(AmountTest::createAmount());
|
||||||
$authorization->setLinks(array(LinkTest::createLink()));
|
$authorization->setLinks(array(LinksTest::createLinks()));
|
||||||
|
|
||||||
return $authorization;
|
return $authorization;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function authorize()
|
||||||
|
{
|
||||||
|
$addr = new Address();
|
||||||
|
$addr->setLine1("3909 Witmer Road");
|
||||||
|
$addr->setLine2("Niagara Falls");
|
||||||
|
$addr->setCity("Niagara Falls");
|
||||||
|
$addr->setState("NY");
|
||||||
|
$addr->setPostal_code("14305");
|
||||||
|
$addr->setCountry_code("US");
|
||||||
|
$addr->setPhone("716-298-1822");
|
||||||
|
|
||||||
|
$card = new CreditCard();
|
||||||
|
$card->setType("visa");
|
||||||
|
$card->setNumber("4417119669820331");
|
||||||
|
$card->setExpire_month("11");
|
||||||
|
$card->setExpire_year("2019");
|
||||||
|
$card->setCvv2("012");
|
||||||
|
$card->setFirst_name("Joe");
|
||||||
|
$card->setLast_name("Shopper");
|
||||||
|
$card->setBilling_address($addr);
|
||||||
|
|
||||||
|
$fi = new FundingInstrument();
|
||||||
|
$fi->setCredit_card($card);
|
||||||
|
|
||||||
|
$payer = new Payer();
|
||||||
|
$payer->setPayment_method("credit_card");
|
||||||
|
$payer->setFunding_instruments(array($fi));
|
||||||
|
|
||||||
|
$amount = new Amount();
|
||||||
|
$amount->setCurrency("USD");
|
||||||
|
$amount->setTotal("1.00");
|
||||||
|
|
||||||
|
$transaction = new Transaction();
|
||||||
|
$transaction->setAmount($amount);
|
||||||
|
$transaction->setDescription("This is the payment description.");
|
||||||
|
|
||||||
|
$payment = new Payment();
|
||||||
|
$payment->setIntent("authorize");
|
||||||
|
$payment->setPayer($payer);
|
||||||
|
$payment->setTransactions(array($transaction));
|
||||||
|
|
||||||
|
$paymnt = $payment->create();
|
||||||
|
$resArray = $paymnt->toArray();
|
||||||
|
|
||||||
|
return $authId = $resArray['transactions'][0]['related_resources'][0]['authorization']['id'];
|
||||||
|
|
||||||
|
}
|
||||||
public function setup() {
|
public function setup() {
|
||||||
$authorization = new Authorization();
|
$authorization = new Authorization();
|
||||||
$authorization->setCreate_time(self::$create_time);
|
$authorization->setCreateTime(self::$create_time);
|
||||||
$authorization->setId(self::$id);
|
$authorization->setId(self::$id);
|
||||||
$authorization->setState(self::$state);
|
$authorization->setState(self::$state);
|
||||||
$authorization->setParent_payment(self::$parent_payment);
|
$authorization->setParentPayment(self::$parent_payment);
|
||||||
$this->authorizations['partial'] = $authorization;
|
$this->authorizations['partial'] = $authorization;
|
||||||
|
|
||||||
|
|
||||||
$this->authorizations['full'] = self::createAuthorization();
|
$this->authorizations['full'] = self::createAuthorization();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetterSetter() {
|
public function testGetterSetter() {
|
||||||
$authorization = $this->authorizations['partial'];
|
$authorization = $this->authorizations['partial'];
|
||||||
$this->assertEquals(self::$create_time, $authorization->getCreate_time());
|
$this->assertEquals(self::$create_time, $authorization->getCreateTime());
|
||||||
$this->assertEquals(self::$id, $authorization->getId());
|
$this->assertEquals(self::$id, $authorization->getId());
|
||||||
$this->assertEquals(self::$state, $authorization->getState());
|
$this->assertEquals(self::$state, $authorization->getState());
|
||||||
$this->assertEquals(self::$parent_payment, $authorization->getParent_payment());
|
$this->assertEquals(self::$parent_payment, $authorization->getParentPayment());
|
||||||
|
|
||||||
$authorization = $this->authorizations['full'];
|
$authorization = $this->authorizations['full'];
|
||||||
$this->assertEquals(AmountTest::$currency, $authorization->getAmount()->getCurrency());
|
$this->assertEquals(AmountTest::$currency, $authorization->getAmount()->getCurrency());
|
||||||
@@ -60,10 +111,30 @@ class AuthorizationTest extends \PHPUnit_Framework_TestCase {
|
|||||||
|
|
||||||
public function testSerializeDeserialize() {
|
public function testSerializeDeserialize() {
|
||||||
$a1 = $this->authorizations['partial'];
|
$a1 = $this->authorizations['partial'];
|
||||||
|
|
||||||
$a2 = new Authorization();
|
$a2 = new Authorization();
|
||||||
$a2->fromJson($a1->toJson());
|
$a2->fromJson($a1->toJson());
|
||||||
|
|
||||||
$this->assertEquals($a1, $a2);
|
$this->assertEquals($a1, $a2);
|
||||||
}
|
}
|
||||||
|
public function testOperations() {
|
||||||
|
$authId = self::authorize();
|
||||||
|
$auth = Authorization::get($authId);
|
||||||
|
$this->assertNotNull($auth->getId());
|
||||||
|
|
||||||
|
$amount = new Amount();
|
||||||
|
$amount->setCurrency("USD");
|
||||||
|
$amount->setTotal("1.00");
|
||||||
|
|
||||||
|
$captur = new Capture();
|
||||||
|
$captur->setId($authId);
|
||||||
|
$captur->setAmount($amount);
|
||||||
|
|
||||||
|
$capt = $auth->capture($captur);
|
||||||
|
$this->assertNotNull( $capt->getId());
|
||||||
|
|
||||||
|
$authId = self::authorize();
|
||||||
|
$auth = Authorization::get($authId);
|
||||||
|
$void = $auth->void();
|
||||||
|
$this->assertNotNull($void->getId());
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -2,6 +2,9 @@
|
|||||||
namespace PayPal\Test\Api;
|
namespace PayPal\Test\Api;
|
||||||
|
|
||||||
use PayPal\Api\Capture;
|
use PayPal\Api\Capture;
|
||||||
|
use PayPal\Api\Refund;
|
||||||
|
use PayPal\Api\Authorization;
|
||||||
|
use PayPal\Api\Amount;
|
||||||
use PayPal\Test\Constants;
|
use PayPal\Test\Constants;
|
||||||
|
|
||||||
class CaptureTest extends \PHPUnit_Framework_TestCase {
|
class CaptureTest extends \PHPUnit_Framework_TestCase {
|
||||||
@@ -10,18 +13,15 @@ class CaptureTest extends \PHPUnit_Framework_TestCase {
|
|||||||
|
|
||||||
public static $authorization_id = "AUTH-123";
|
public static $authorization_id = "AUTH-123";
|
||||||
public static $create_time = "2013-02-28T00:00:00Z";
|
public static $create_time = "2013-02-28T00:00:00Z";
|
||||||
public static $description = "Test capture";
|
|
||||||
public static $id = "C-5678";
|
public static $id = "C-5678";
|
||||||
public static $parent_payment = "PAY-123";
|
public static $parent_payment = "PAY-123";
|
||||||
public static $state = "Created";
|
public static $state = "Created";
|
||||||
|
|
||||||
public static function createCapture() {
|
public static function createCapture() {
|
||||||
$capture = new Capture();
|
$capture = new Capture();
|
||||||
$capture->setAuthorization_id(self::$authorization_id);
|
$capture->setCreateTime(self::$create_time);
|
||||||
$capture->setCreate_time(self::$create_time);
|
|
||||||
$capture->setDescription(self::$description);
|
|
||||||
$capture->setId(self::$id);
|
$capture->setId(self::$id);
|
||||||
$capture->setParent_payment(self::$parent_payment);
|
$capture->setParentPayment(self::$parent_payment);
|
||||||
$capture->setState(self::$state);
|
$capture->setState(self::$state);
|
||||||
|
|
||||||
return $capture;
|
return $capture;
|
||||||
@@ -32,21 +32,19 @@ class CaptureTest extends \PHPUnit_Framework_TestCase {
|
|||||||
|
|
||||||
$capture = self::createCapture();
|
$capture = self::createCapture();
|
||||||
$capture->setAmount(AmountTest::createAmount());
|
$capture->setAmount(AmountTest::createAmount());
|
||||||
$capture->setLinks(array(LinkTest::createLink()));
|
$capture->setLinks(array(LinksTest::createLinks()));
|
||||||
$this->captures['full'] = $capture;
|
$this->captures['full'] = $capture;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetterSetter() {
|
public function testGetterSetter() {
|
||||||
$this->assertEquals(self::$authorization_id, $this->captures['partial']->getAuthorization_id());
|
$this->assertEquals(self::$create_time, $this->captures['partial']->getCreateTime());
|
||||||
$this->assertEquals(self::$create_time, $this->captures['partial']->getCreate_time());
|
|
||||||
$this->assertEquals(self::$description, $this->captures['partial']->getDescription());
|
|
||||||
$this->assertEquals(self::$id, $this->captures['partial']->getId());
|
$this->assertEquals(self::$id, $this->captures['partial']->getId());
|
||||||
$this->assertEquals(self::$parent_payment, $this->captures['partial']->getParent_payment());
|
$this->assertEquals(self::$parent_payment, $this->captures['partial']->getParentPayment());
|
||||||
$this->assertEquals(self::$state, $this->captures['partial']->getState());
|
$this->assertEquals(self::$state, $this->captures['partial']->getState());
|
||||||
|
|
||||||
$this->assertEquals(AmountTest::$currency, $this->captures['full']->getAmount()->getCurrency());
|
$this->assertEquals(AmountTest::$currency, $this->captures['full']->getAmount()->getCurrency());
|
||||||
$links = $this->captures['full']->getLinks();
|
$links = $this->captures['full']->getLinks();
|
||||||
$this->assertEquals(LinkTest::$href, $links[0]->getHref());
|
$this->assertEquals(LinksTest::$href, $links[0]->getHref());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSerializeDeserialize() {
|
public function testSerializeDeserialize() {
|
||||||
@@ -57,4 +55,33 @@ class CaptureTest extends \PHPUnit_Framework_TestCase {
|
|||||||
|
|
||||||
$this->assertEquals($c1, $c2);
|
$this->assertEquals($c1, $c2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testOperations()
|
||||||
|
{
|
||||||
|
$authId = AuthorizationTest::authorize();
|
||||||
|
$auth = Authorization::get($authId);
|
||||||
|
|
||||||
|
$amount = new Amount();
|
||||||
|
$amount->setCurrency("USD");
|
||||||
|
$amount->setTotal("1.00");
|
||||||
|
|
||||||
|
$captr = new Capture();
|
||||||
|
$captr->setId($authId);
|
||||||
|
$captr->setAmount($amount);
|
||||||
|
|
||||||
|
$capt = $auth->capture($captr);
|
||||||
|
$captureId = $capt->getId();
|
||||||
|
$this->assertNotNull($captureId);
|
||||||
|
|
||||||
|
$refund = new Refund();
|
||||||
|
$refund->setId($captureId);
|
||||||
|
$refund->setAmount($amount);
|
||||||
|
|
||||||
|
$capture = Capture::get($captureId);
|
||||||
|
$this->assertNotNull($capture->getId());
|
||||||
|
|
||||||
|
$retund = $capture->refund($refund);
|
||||||
|
$this->assertNotNull($retund->getId());
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,11 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace PayPal\Test\Api;
|
namespace PayPal\Test\Api;
|
||||||
|
|
||||||
use PayPal\Api\Address;
|
use PayPal\Api\Address;
|
||||||
use PayPal\Api\CreditCard;
|
use PayPal\Api\CreditCard;
|
||||||
use PayPal\Test\Constants;
|
use PayPal\Test\Constants;
|
||||||
|
|
||||||
class CreditCardTest extends \PHPUnit_Framework_TestCase {
|
class CreditCardTest extends \PHPUnit_Framework_TestCase {
|
||||||
|
|
||||||
private $cards;
|
private $cards;
|
||||||
@@ -26,23 +24,23 @@ class CreditCardTest extends \PHPUnit_Framework_TestCase {
|
|||||||
$card = new CreditCard();
|
$card = new CreditCard();
|
||||||
$card->setType(self::$cardType);
|
$card->setType(self::$cardType);
|
||||||
$card->setNumber(self::$cardNumber);
|
$card->setNumber(self::$cardNumber);
|
||||||
$card->setExpire_month(self::$expireMonth);
|
$card->setExpireMonth(self::$expireMonth);
|
||||||
$card->setExpire_year(self::$expireYear);
|
$card->setExpireYear(self::$expireYear);
|
||||||
$card->setCvv2(self::$cvv);
|
$card->setCvv2(self::$cvv);
|
||||||
$card->setFirst_name(self::$firstName);
|
$card->setFirstName(self::$firstName);
|
||||||
$card->setLast_name(self::$lastName);
|
$card->setLastName(self::$lastName);
|
||||||
$card->setId(self::$id);
|
$card->setId(self::$id);
|
||||||
$card->setValid_until(self::$validUntil);
|
$card->setValidUntil(self::$validUntil);
|
||||||
$card->setState(self::$state);
|
$card->setState(self::$state);
|
||||||
$card->setPayer_id(self::$payerId);
|
$card->setPayerId(self::$payerId);
|
||||||
return $card;
|
return $card;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setup() {
|
public function setup() {
|
||||||
|
|
||||||
$card = self::createCreditCard();
|
$card = self::createCreditCard();
|
||||||
$card->setBilling_address(AddressTest::createAddress());
|
$card->setBillingAddress(AddressTest::createAddress());
|
||||||
$card->setLinks(array(LinkTest::createLink()));
|
$card->setLinks(array(LinksTest::createLinks()));
|
||||||
$this->cards['full'] = $card;
|
$this->cards['full'] = $card;
|
||||||
|
|
||||||
$card = self::createCreditCard();
|
$card = self::createCreditCard();
|
||||||
@@ -53,20 +51,20 @@ class CreditCardTest extends \PHPUnit_Framework_TestCase {
|
|||||||
$c = $this->cards['partial'];
|
$c = $this->cards['partial'];
|
||||||
$this->assertEquals(self::$cardType, $c->getType());
|
$this->assertEquals(self::$cardType, $c->getType());
|
||||||
$this->assertEquals(self::$cardNumber, $c->getNumber());
|
$this->assertEquals(self::$cardNumber, $c->getNumber());
|
||||||
$this->assertEquals(self::$expireMonth, $c->getExpire_month());
|
$this->assertEquals(self::$expireMonth, $c->getExpireMonth());
|
||||||
$this->assertEquals(self::$expireYear, $c->getExpire_year());
|
$this->assertEquals(self::$expireYear, $c->getExpireYear());
|
||||||
$this->assertEquals(self::$cvv, $c->getCvv2());
|
$this->assertEquals(self::$cvv, $c->getCvv2());
|
||||||
$this->assertEquals(self::$firstName, $c->getFirst_name());
|
$this->assertEquals(self::$firstName, $c->getFirstName());
|
||||||
$this->assertEquals(self::$lastName, $c->getLast_name());
|
$this->assertEquals(self::$lastName, $c->getLastName());
|
||||||
$this->assertEquals(self::$id, $c->getId());
|
$this->assertEquals(self::$id, $c->getId());
|
||||||
$this->assertEquals(self::$validUntil, $c->getValid_until());
|
$this->assertEquals(self::$validUntil, $c->getValidUntil());
|
||||||
$this->assertEquals(self::$state, $c->getState());
|
$this->assertEquals(self::$state, $c->getState());
|
||||||
$this->assertEquals(self::$payerId, $c->getPayer_id());
|
$this->assertEquals(self::$payerId, $c->getPayerId());
|
||||||
|
|
||||||
$c = $this->cards['full'];
|
$c = $this->cards['full'];
|
||||||
$this->assertEquals(AddressTest::$line1, $c->getBilling_address()->getLine1());
|
$this->assertEquals(AddressTest::$line1, $c->getBillingAddress()->getLine1());
|
||||||
$link = $c->getLinks();
|
$link = $c->getLinks();
|
||||||
$this->assertEquals(LinkTest::$href, $link[0]->getHref());
|
$this->assertEquals(LinksTest::$href, $link[0]->getHref());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSerializeDeserialize() {
|
public function testSerializeDeserialize() {
|
||||||
@@ -87,9 +85,10 @@ class CreditCardTest extends \PHPUnit_Framework_TestCase {
|
|||||||
$this->assertNotNull($c1->getId());
|
$this->assertNotNull($c1->getId());
|
||||||
|
|
||||||
$c2 = CreditCard::get($c1->getId());
|
$c2 = CreditCard::get($c1->getId());
|
||||||
$this->assertEquals($c1->getBilling_address(), $c2->getBilling_address());
|
$this->assertEquals($c1->getBillingAddress(), $c2->getBillingAddress());
|
||||||
$this->assertGreaterThan(0, count($c2->getLinks()));
|
$this->assertGreaterThan(0, count($c2->getLinks()));
|
||||||
$this->assertEquals(self::$cardType, $c2->getType());
|
$this->assertEquals(self::$cardType, $c2->getType());
|
||||||
$this->assertNotNull($c2->getState());
|
$this->assertNotNull($c2->getState());
|
||||||
|
$this->assertEquals(true, $c2->delete());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -13,8 +13,8 @@ class CreditCardTokenTest extends \PHPUnit_Framework_TestCase {
|
|||||||
|
|
||||||
public static function createCreditCardToken() {
|
public static function createCreditCardToken() {
|
||||||
$ccToken = new CreditCardToken();
|
$ccToken = new CreditCardToken();
|
||||||
$ccToken->setPayer_id(self::$payerId);
|
$ccToken->setPayerId(self::$payerId);
|
||||||
$ccToken->setCredit_card_id(self::$creditCardId);
|
$ccToken->setCreditCardId(self::$creditCardId);
|
||||||
return $ccToken;
|
return $ccToken;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -23,8 +23,8 @@ class CreditCardTokenTest extends \PHPUnit_Framework_TestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function testGetterSetter() {
|
public function testGetterSetter() {
|
||||||
$this->assertEquals(self::$payerId, $this->ccToken->getPayer_id());
|
$this->assertEquals(self::$payerId, $this->ccToken->getPayerId());
|
||||||
$this->assertEquals(self::$creditCardId, $this->ccToken->getCredit_card_id());
|
$this->assertEquals(self::$creditCardId, $this->ccToken->getCreditCardId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSerializeDeserialize() {
|
public function testSerializeDeserialize() {
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace PayPal\Test\Api;
|
namespace PayPal\Test\Api;
|
||||||
|
|
||||||
use PayPal\Api\AmountDetails;
|
use PayPal\Api\Details;
|
||||||
use PayPal\Test\Constants;
|
use PayPal\Test\Constants;
|
||||||
|
|
||||||
class AmountDetailsTest extends \PHPUnit_Framework_TestCase {
|
class DetailsTest extends \PHPUnit_Framework_TestCase {
|
||||||
|
|
||||||
private $amountDetails;
|
private $amountDetails;
|
||||||
|
|
||||||
@@ -14,7 +14,7 @@ class AmountDetailsTest extends \PHPUnit_Framework_TestCase {
|
|||||||
public static $fee = "4.99";
|
public static $fee = "4.99";
|
||||||
|
|
||||||
public static function createAmountDetails() {
|
public static function createAmountDetails() {
|
||||||
$amountDetails = new AmountDetails();
|
$amountDetails = new Details();
|
||||||
$amountDetails->setSubtotal(self::$subtotal);
|
$amountDetails->setSubtotal(self::$subtotal);
|
||||||
$amountDetails->setTax(self::$tax);
|
$amountDetails->setTax(self::$tax);
|
||||||
$amountDetails->setShipping(self::$shipping);
|
$amountDetails->setShipping(self::$shipping);
|
||||||
@@ -37,7 +37,7 @@ class AmountDetailsTest extends \PHPUnit_Framework_TestCase {
|
|||||||
public function testSerializeDeserialize() {
|
public function testSerializeDeserialize() {
|
||||||
$a1 = $this->amountDetails;
|
$a1 = $this->amountDetails;
|
||||||
|
|
||||||
$a2 = new AmountDetails();
|
$a2 = new Details();
|
||||||
$a2->fromJson($a1->toJson());
|
$a2->fromJson($a1->toJson());
|
||||||
|
|
||||||
$this->assertEquals($a1, $a2);
|
$this->assertEquals($a1, $a2);
|
||||||
@@ -11,8 +11,8 @@ class FundingInstrumentTest extends \PHPUnit_Framework_TestCase {
|
|||||||
|
|
||||||
public static function createFundingInstrument() {
|
public static function createFundingInstrument() {
|
||||||
$fi = new FundingInstrument();
|
$fi = new FundingInstrument();
|
||||||
$fi->setCredit_card(CreditCardTest::createCreditCard());
|
$fi->setCreditCard(CreditCardTest::createCreditCard());
|
||||||
$fi->setCredit_card_token(CreditCardTokenTest::createCreditCardToken());
|
$fi->setCreditCardToken(CreditCardTokenTest::createCreditCardToken());
|
||||||
return $fi;
|
return $fi;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -21,9 +21,9 @@ class FundingInstrumentTest extends \PHPUnit_Framework_TestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function testGetterSetter() {
|
public function testGetterSetter() {
|
||||||
$this->assertEquals(CreditCardTest::$cardNumber, $this->fi->getCredit_card()->getNumber());
|
$this->assertEquals(CreditCardTest::$cardNumber, $this->fi->getCreditCard()->getNumber());
|
||||||
$this->assertEquals(CreditCardTokenTest::$creditCardId,
|
$this->assertEquals(CreditCardTokenTest::$creditCardId,
|
||||||
$this->fi->getCredit_card_token()->getCredit_card_id());
|
$this->fi->getCreditCardToken()->getCreditCardId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSerializeDeserialize() {
|
public function testSerializeDeserialize() {
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ class ItemListTest extends \PHPUnit_Framework_TestCase {
|
|||||||
|
|
||||||
$itemList = new ItemList();
|
$itemList = new ItemList();
|
||||||
$itemList->setItems(array($item));
|
$itemList->setItems(array($item));
|
||||||
$itemList->setShipping_address(ShippingAddressTest::createAddress());
|
$itemList->setShippingAddress(ShippingAddressTest::createAddress());
|
||||||
|
|
||||||
return $itemList;
|
return $itemList;
|
||||||
}
|
}
|
||||||
@@ -33,7 +33,7 @@ class ItemListTest extends \PHPUnit_Framework_TestCase {
|
|||||||
public function testGetterSetters() {
|
public function testGetterSetters() {
|
||||||
$items = $this->items->getItems();
|
$items = $this->items->getItems();
|
||||||
$this->assertEquals(ItemTest::createItem(), $items[0]);
|
$this->assertEquals(ItemTest::createItem(), $items[0]);
|
||||||
$this->assertEquals(ShippingAddressTest::createAddress(), $this->items->getShipping_address());
|
$this->assertEquals(ShippingAddressTest::createAddress(), $this->items->getShippingAddress());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSerializeDeserialize() {
|
public function testSerializeDeserialize() {
|
||||||
|
|||||||
@@ -1,40 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace PayPal\Test\Api;
|
|
||||||
|
|
||||||
use PayPal\Api\Link;
|
|
||||||
use PayPal\Test\Constants;
|
|
||||||
|
|
||||||
class LinkTest extends \PHPUnit_Framework_TestCase {
|
|
||||||
|
|
||||||
private $link;
|
|
||||||
|
|
||||||
public static $href = "USD";
|
|
||||||
public static $rel = "1.12";
|
|
||||||
public static $method = "1.12";
|
|
||||||
|
|
||||||
public static function createLink() {
|
|
||||||
$link = new Link();
|
|
||||||
$link->setHref(self::$href);
|
|
||||||
$link->setRel(self::$rel);
|
|
||||||
$link->setMethod(self::$method);
|
|
||||||
|
|
||||||
return $link;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setup() {
|
|
||||||
$this->link = self::createLink();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testGetterSetters() {
|
|
||||||
$this->assertEquals(self::$href, $this->link->getHref());
|
|
||||||
$this->assertEquals(self::$rel, $this->link->getRel());
|
|
||||||
$this->assertEquals(self::$method, $this->link->getMethod());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testSerializeDeserialize() {
|
|
||||||
$link2 = new Link();
|
|
||||||
$link2->fromJson($this->link->toJSON());
|
|
||||||
$this->assertEquals($this->link, $link2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
40
tests/PayPal/Test/Api/LinksTest.php
Normal file
40
tests/PayPal/Test/Api/LinksTest.php
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace PayPal\Test\Api;
|
||||||
|
|
||||||
|
use PayPal\Api\Links;
|
||||||
|
use PayPal\Test\Constants;
|
||||||
|
|
||||||
|
class LinksTest extends \PHPUnit_Framework_TestCase {
|
||||||
|
|
||||||
|
private $links;
|
||||||
|
|
||||||
|
public static $href = "USD";
|
||||||
|
public static $rel = "1.12";
|
||||||
|
public static $method = "1.12";
|
||||||
|
|
||||||
|
public static function createLinks() {
|
||||||
|
$links = new Links();
|
||||||
|
$links->setHref(self::$href);
|
||||||
|
$links->setRel(self::$rel);
|
||||||
|
$links->setMethod(self::$method);
|
||||||
|
|
||||||
|
return $links;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setup() {
|
||||||
|
$this->links = self::createLinks();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testGetterSetters() {
|
||||||
|
$this->assertEquals(self::$href, $this->links->getHref());
|
||||||
|
$this->assertEquals(self::$rel, $this->links->getRel());
|
||||||
|
$this->assertEquals(self::$method, $this->links->getMethod());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testSerializeDeserialize() {
|
||||||
|
$link2 = new Links();
|
||||||
|
$link2->fromJson($this->links->toJSON());
|
||||||
|
$this->assertEquals($this->links, $link2);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,7 +17,7 @@ class PayeeTest extends \PHPUnit_Framework_TestCase {
|
|||||||
public static function createPayee() {
|
public static function createPayee() {
|
||||||
$payee = new Payee();
|
$payee = new Payee();
|
||||||
$payee->setEmail(self::$email);
|
$payee->setEmail(self::$email);
|
||||||
$payee->setMerchant_id(self::$merchant_id);
|
$payee->setMerchantId(self::$merchant_id);
|
||||||
$payee->setPhone(self::$phone);
|
$payee->setPhone(self::$phone);
|
||||||
|
|
||||||
return $payee;
|
return $payee;
|
||||||
@@ -29,7 +29,7 @@ class PayeeTest extends \PHPUnit_Framework_TestCase {
|
|||||||
|
|
||||||
public function testGetterSetter() {
|
public function testGetterSetter() {
|
||||||
$this->assertEquals(self::$email, $this->payee->getEmail());
|
$this->assertEquals(self::$email, $this->payee->getEmail());
|
||||||
$this->assertEquals(self::$merchant_id, $this->payee->getMerchant_id());
|
$this->assertEquals(self::$merchant_id, $this->payee->getMerchantId());
|
||||||
$this->assertEquals(self::$phone, $this->payee->getPhone());
|
$this->assertEquals(self::$phone, $this->payee->getPhone());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,11 +17,11 @@ class PayerInfoTest extends \PHPUnit_Framework_TestCase {
|
|||||||
public static function createPayerInfo() {
|
public static function createPayerInfo() {
|
||||||
$payerInfo = new PayerInfo();
|
$payerInfo = new PayerInfo();
|
||||||
$payerInfo->setEmail(self::$email);
|
$payerInfo->setEmail(self::$email);
|
||||||
$payerInfo->setFirst_name(self::$firstName);
|
$payerInfo->setFirstName(self::$firstName);
|
||||||
$payerInfo->setLast_name(self::$lastName);
|
$payerInfo->setLastName(self::$lastName);
|
||||||
$payerInfo->setPhone(self::$phone);
|
$payerInfo->setPhone(self::$phone);
|
||||||
$payerInfo->setPayer_id(self::$payerId);
|
$payerInfo->setPayerId(self::$payerId);
|
||||||
$payerInfo->setShipping_address(AddressTest::createAddress());
|
$payerInfo->setShippingAddress(AddressTest::createAddress());
|
||||||
|
|
||||||
return $payerInfo;
|
return $payerInfo;
|
||||||
}
|
}
|
||||||
@@ -32,11 +32,11 @@ class PayerInfoTest extends \PHPUnit_Framework_TestCase {
|
|||||||
|
|
||||||
public function testGetterSetter() {
|
public function testGetterSetter() {
|
||||||
$this->assertEquals(self::$email, $this->payerInfo->getEmail());
|
$this->assertEquals(self::$email, $this->payerInfo->getEmail());
|
||||||
$this->assertEquals(self::$firstName, $this->payerInfo->getFirst_name());
|
$this->assertEquals(self::$firstName, $this->payerInfo->getFirstName());
|
||||||
$this->assertEquals(self::$lastName, $this->payerInfo->getLast_name());
|
$this->assertEquals(self::$lastName, $this->payerInfo->getLastName());
|
||||||
$this->assertEquals(self::$phone, $this->payerInfo->getPhone());
|
$this->assertEquals(self::$phone, $this->payerInfo->getPhone());
|
||||||
$this->assertEquals(self::$payerId, $this->payerInfo->getPayer_id());
|
$this->assertEquals(self::$payerId, $this->payerInfo->getPayerId());
|
||||||
$this->assertEquals(AddressTest::$line1, $this->payerInfo->getShipping_address()->getLine1());
|
$this->assertEquals(AddressTest::$line1, $this->payerInfo->getShippingAddress()->getLine1());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSerializeDeserialize() {
|
public function testSerializeDeserialize() {
|
||||||
|
|||||||
@@ -15,9 +15,9 @@ class PayerTest extends \PHPUnit_Framework_TestCase {
|
|||||||
|
|
||||||
public static function createPayer() {
|
public static function createPayer() {
|
||||||
$payer = new Payer();
|
$payer = new Payer();
|
||||||
$payer->setPayment_method(self::$paymentMethod);
|
$payer->setPaymentMethod(self::$paymentMethod);
|
||||||
$payer->setPayer_info(PayerInfoTest::createPayerInfo());
|
$payer->setPayerInfo(PayerInfoTest::createPayerInfo());
|
||||||
$payer->setFunding_instruments(array(FundingInstrumentTest::createFundingInstrument()));
|
$payer->setFundingInstruments(array(FundingInstrumentTest::createFundingInstrument()));
|
||||||
|
|
||||||
return $payer;
|
return $payer;
|
||||||
}
|
}
|
||||||
@@ -27,11 +27,11 @@ class PayerTest extends \PHPUnit_Framework_TestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function testGetterSetter() {
|
public function testGetterSetter() {
|
||||||
$this->assertEquals(self::$paymentMethod, $this->payer->getPayment_method());
|
$this->assertEquals(self::$paymentMethod, $this->payer->getPaymentMethod());
|
||||||
$this->assertEquals(PayerInfoTest::$email, $this->payer->getPayer_info()->getEmail());
|
$this->assertEquals(PayerInfoTest::$email, $this->payer->getPayerInfo()->getEmail());
|
||||||
|
|
||||||
$fi = $this->payer->getFunding_instruments();
|
$fi = $this->payer->getFundingInstruments();
|
||||||
$this->assertEquals(CreditCardTokenTest::$creditCardId, $fi[0]->getCredit_card_token()->getCredit_card_id());
|
$this->assertEquals(CreditCardTokenTest::$creditCardId, $fi[0]->getCreditCardToken()->getCreditCardId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSerializeDeserialize() {
|
public function testSerializeDeserialize() {
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ class PaymentHistoryTest extends \PHPUnit_Framework_TestCase {
|
|||||||
public static function createPaymentHistory() {
|
public static function createPaymentHistory() {
|
||||||
$history = new PaymentHistory();
|
$history = new PaymentHistory();
|
||||||
$history->setCount(self::$count);
|
$history->setCount(self::$count);
|
||||||
$history->setNext_id(self::$nextId);
|
$history->setNextId(self::$nextId);
|
||||||
$history->setPayments(array(PaymentTest::createPayment()));
|
$history->setPayments(array(PaymentTest::createPayment()));
|
||||||
return $history;
|
return $history;
|
||||||
}
|
}
|
||||||
@@ -25,7 +25,7 @@ class PaymentHistoryTest extends \PHPUnit_Framework_TestCase {
|
|||||||
|
|
||||||
public function testGetterSetters() {
|
public function testGetterSetters() {
|
||||||
$this->assertEquals(self::$count, $this->history->getCount());
|
$this->assertEquals(self::$count, $this->history->getCount());
|
||||||
$this->assertEquals(self::$nextId, $this->history->getNext_id());
|
$this->assertEquals(self::$nextId, $this->history->getNextId());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace PayPal\Test\Api;
|
namespace PayPal\Test\Api;
|
||||||
|
|
||||||
|
|
||||||
use PayPal\Api\RedirectUrls;
|
use PayPal\Api\RedirectUrls;
|
||||||
|
|
||||||
use PayPal\Api\Address;
|
use PayPal\Api\Address;
|
||||||
use PayPal\Api\Amount;
|
use PayPal\Api\Amount;
|
||||||
use PayPal\Api\CreditCard;
|
use PayPal\Api\CreditCard;
|
||||||
@@ -21,12 +17,12 @@ class PaymentTest extends \PHPUnit_Framework_TestCase {
|
|||||||
public static function createPayment() {
|
public static function createPayment() {
|
||||||
|
|
||||||
$redirectUrls = new RedirectUrls();
|
$redirectUrls = new RedirectUrls();
|
||||||
$redirectUrls->setReturn_url("http://localhost/return");
|
$redirectUrls->setReturnUrl("http://localhost/return");
|
||||||
$redirectUrls->setCancel_url("http://localhost/cancel");
|
$redirectUrls->setCancelUrl("http://localhost/cancel");
|
||||||
|
|
||||||
$payment = new Payment();
|
$payment = new Payment();
|
||||||
$payment->setIntent("sale");
|
$payment->setIntent("sale");
|
||||||
$payment->setRedirect_urls($redirectUrls);
|
$payment->setRedirectUrls($redirectUrls);
|
||||||
$payment->setPayer(PayerTest::createPayer());
|
$payment->setPayer(PayerTest::createPayer());
|
||||||
$payment->setTransactions(array(TransactionTest::createTransaction()));
|
$payment->setTransactions(array(TransactionTest::createTransaction()));
|
||||||
|
|
||||||
@@ -35,20 +31,20 @@ class PaymentTest extends \PHPUnit_Framework_TestCase {
|
|||||||
|
|
||||||
public static function createNewPayment() {
|
public static function createNewPayment() {
|
||||||
$payer = new Payer();
|
$payer = new Payer();
|
||||||
$payer->setPayment_method("credit_card");
|
$payer->setPaymentMethod("credit_card");
|
||||||
$payer->setFunding_instruments(array(FundingInstrumentTest::createFundingInstrument()));
|
$payer->setFundingInstruments(array(FundingInstrumentTest::createFundingInstrument()));
|
||||||
|
|
||||||
$transaction = new Transaction();
|
$transaction = new Transaction();
|
||||||
$transaction->setAmount(AmountTest::createAmount());
|
$transaction->setAmount(AmountTest::createAmount());
|
||||||
$transaction->setDescription("This is the payment description.");
|
$transaction->setDescription("This is the payment description.");
|
||||||
|
|
||||||
$redirectUrls = new RedirectUrls();
|
$redirectUrls = new RedirectUrls();
|
||||||
$redirectUrls->setReturn_url("http://localhost/return");
|
$redirectUrls->setReturnUrl("http://localhost/return");
|
||||||
$redirectUrls->setCancel_url("http://localhost/cancel");
|
$redirectUrls->setCancelUrl("http://localhost/cancel");
|
||||||
|
|
||||||
$payment = new Payment();
|
$payment = new Payment();
|
||||||
$payment->setIntent("sale");
|
$payment->setIntent("sale");
|
||||||
$payment->setRedirect_urls($redirectUrls);
|
$payment->setRedirectUrls($redirectUrls);
|
||||||
$payment->setPayer($payer);
|
$payment->setPayer($payer);
|
||||||
$payment->setTransactions(array($transaction));
|
$payment->setTransactions(array($transaction));
|
||||||
|
|
||||||
|
|||||||
@@ -10,19 +10,17 @@ class RefundTest extends \PHPUnit_Framework_TestCase {
|
|||||||
|
|
||||||
public static $captureId = "CAP-123";
|
public static $captureId = "CAP-123";
|
||||||
public static $createTime = "2013-02-28T00:00:00Z";
|
public static $createTime = "2013-02-28T00:00:00Z";
|
||||||
public static $description = "Test refund";
|
|
||||||
public static $id = "R-5678";
|
public static $id = "R-5678";
|
||||||
public static $parentPayment = "PAY-123";
|
public static $parentPayment = "PAY-123";
|
||||||
|
|
||||||
public static function createRefund() {
|
public static function createRefund() {
|
||||||
$refund = new Refund();
|
$refund = new Refund();
|
||||||
|
$refund->setCreateTime(self::$createTime);
|
||||||
$refund->setAmount(AmountTest::createAmount());
|
$refund->setAmount(AmountTest::createAmount());
|
||||||
$refund->setCapture_id(self::$captureId);
|
$refund->setCaptureId(self::$captureId);
|
||||||
$refund->setCreate_time(self::$createTime);
|
|
||||||
$refund->setDescription(self::$description);
|
|
||||||
$refund->setId(self::$id);
|
$refund->setId(self::$id);
|
||||||
$refund->setLinks(array(LinkTest::createLink()));
|
$refund->setLinks(array(LinksTest::createLinks()));
|
||||||
$refund->setParent_payment(self::$parentPayment);
|
$refund->setParentPayment(self::$parentPayment);
|
||||||
|
|
||||||
return $refund;
|
return $refund;
|
||||||
}
|
}
|
||||||
@@ -32,14 +30,13 @@ class RefundTest extends \PHPUnit_Framework_TestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function testGetterSetter() {
|
public function testGetterSetter() {
|
||||||
$this->assertEquals(self::$captureId, $this->refund->getCapture_id());
|
$this->assertEquals(self::$captureId, $this->refund->getCaptureId());
|
||||||
$this->assertEquals(self::$createTime, $this->refund->getCreate_time());
|
$this->assertEquals(self::$createTime, $this->refund->getCreateTime());
|
||||||
$this->assertEquals(self::$description, $this->refund->getDescription());
|
|
||||||
$this->assertEquals(self::$id, $this->refund->getId());
|
$this->assertEquals(self::$id, $this->refund->getId());
|
||||||
$this->assertEquals(self::$parentPayment, $this->refund->getParent_payment());
|
$this->assertEquals(self::$parentPayment, $this->refund->getParentPayment());
|
||||||
$this->assertEquals(AmountTest::$currency, $this->refund->getAmount()->getCurrency());
|
$this->assertEquals(AmountTest::$currency, $this->refund->getAmount()->getCurrency());
|
||||||
$links = $this->refund->getLinks();
|
$links = $this->refund->getLinks();
|
||||||
$this->assertEquals(LinkTest::$href, $links[0]->getHref());
|
$this->assertEquals(LinksTest::$href, $links[0]->getHref());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSerializeDeserialize() {
|
public function testSerializeDeserialize() {
|
||||||
|
|||||||
35
tests/PayPal/Test/Api/RelatedResourcesTest.php
Normal file
35
tests/PayPal/Test/Api/RelatedResourcesTest.php
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
namespace PayPal\Test\Api;
|
||||||
|
|
||||||
|
use PayPal\Api\RelatedResources;
|
||||||
|
use PayPal\Test\Constants;
|
||||||
|
|
||||||
|
class RelatedResourcesTest extends \PHPUnit_Framework_TestCase {
|
||||||
|
|
||||||
|
private $RelatedResources;
|
||||||
|
|
||||||
|
public static function createRelatedResources() {
|
||||||
|
$relatedResources = new RelatedResources();
|
||||||
|
$relatedResources->setAuthorization(AuthorizationTest::createAuthorization());
|
||||||
|
$relatedResources->setCapture(CaptureTest::createCapture());
|
||||||
|
return $relatedResources;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setup() {
|
||||||
|
$this->relatedResources = self::createRelatedResources();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testGetterSetter() {
|
||||||
|
$this->assertEquals(AuthorizationTest::$create_time, $this->relatedResources->getAuthorization()->getCreateTime());
|
||||||
|
$this->assertEquals(CaptureTest::$create_time, $this->relatedResources->getCapture()->getCreateTime());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testSerializeDeserialize() {
|
||||||
|
$s1 = $this->relatedResources;
|
||||||
|
|
||||||
|
$s2 = new RelatedResources();
|
||||||
|
$s2->fromJson($s1->toJson());
|
||||||
|
|
||||||
|
$this->assertEquals($s1, $s2);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,7 +6,7 @@ use PayPal\Api\Sale;
|
|||||||
use PayPal\Test\Constants;
|
use PayPal\Test\Constants;
|
||||||
use PayPal\Test\Api\AmountTest;
|
use PayPal\Test\Api\AmountTest;
|
||||||
use PayPal\Test\Api\PaymentTest;
|
use PayPal\Test\Api\PaymentTest;
|
||||||
use PayPal\Test\Api\LinkTest;
|
use PayPal\Test\Api\LinksTest;
|
||||||
|
|
||||||
class SaleTest extends \PHPUnit_Framework_TestCase {
|
class SaleTest extends \PHPUnit_Framework_TestCase {
|
||||||
|
|
||||||
@@ -14,7 +14,6 @@ class SaleTest extends \PHPUnit_Framework_TestCase {
|
|||||||
|
|
||||||
public static $captureId = "CAP-123";
|
public static $captureId = "CAP-123";
|
||||||
public static $createTime = "2013-02-28T00:00:00Z";
|
public static $createTime = "2013-02-28T00:00:00Z";
|
||||||
public static $description = "Test refund";
|
|
||||||
public static $id = "R-5678";
|
public static $id = "R-5678";
|
||||||
public static $parentPayment = "PAY-123";
|
public static $parentPayment = "PAY-123";
|
||||||
public static $state = "Created";
|
public static $state = "Created";
|
||||||
@@ -22,10 +21,10 @@ class SaleTest extends \PHPUnit_Framework_TestCase {
|
|||||||
public static function createSale() {
|
public static function createSale() {
|
||||||
$sale = new Sale();
|
$sale = new Sale();
|
||||||
$sale->setAmount(AmountTest::createAmount());
|
$sale->setAmount(AmountTest::createAmount());
|
||||||
$sale->setCreate_time(self::$createTime);
|
$sale->setCreateTime(self::$createTime);
|
||||||
$sale->setId(self::$id);
|
$sale->setId(self::$id);
|
||||||
$sale->setLinks(array(LinkTest::createLink()));
|
$sale->setLinks(array(LinksTest::createLinks()));
|
||||||
$sale->setParent_payment(self::$parentPayment);
|
$sale->setParentPayment(self::$parentPayment);
|
||||||
$sale->setState(self::$state);
|
$sale->setState(self::$state);
|
||||||
return $sale;
|
return $sale;
|
||||||
}
|
}
|
||||||
@@ -35,13 +34,13 @@ class SaleTest extends \PHPUnit_Framework_TestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function testGetterSetter() {
|
public function testGetterSetter() {
|
||||||
$this->assertEquals(self::$createTime, $this->sale->getCreate_time());
|
$this->assertEquals(self::$createTime, $this->sale->getCreateTime());
|
||||||
$this->assertEquals(self::$id, $this->sale->getId());
|
$this->assertEquals(self::$id, $this->sale->getId());
|
||||||
$this->assertEquals(self::$parentPayment, $this->sale->getParent_payment());
|
$this->assertEquals(self::$parentPayment, $this->sale->getParentPayment());
|
||||||
$this->assertEquals(self::$state, $this->sale->getState());
|
$this->assertEquals(self::$state, $this->sale->getState());
|
||||||
$this->assertEquals(AmountTest::$currency, $this->sale->getAmount()->getCurrency());
|
$this->assertEquals(AmountTest::$currency, $this->sale->getAmount()->getCurrency());
|
||||||
$links = $this->sale->getLinks();
|
$links = $this->sale->getLinks();
|
||||||
$this->assertEquals(LinkTest::$href, $links[0]->getHref());
|
$this->assertEquals(LinksTest::$href, $links[0]->getHref());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSerializeDeserialize() {
|
public function testSerializeDeserialize() {
|
||||||
@@ -58,7 +57,7 @@ class SaleTest extends \PHPUnit_Framework_TestCase {
|
|||||||
$payment->create();
|
$payment->create();
|
||||||
|
|
||||||
$transactions = $payment->getTransactions();
|
$transactions = $payment->getTransactions();
|
||||||
$resources = $transactions[0]->getRelated_resources();
|
$resources = $transactions[0]->getRelatedResources();
|
||||||
$saleId = $resources[0]->getSale()->getId();
|
$saleId = $resources[0]->getSale()->getId();
|
||||||
|
|
||||||
$sale = Sale::get($saleId);
|
$sale = Sale::get($saleId);
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ class ShippingAddressTest extends \PHPUnit_Framework_TestCase {
|
|||||||
public static $countryCode = "US";
|
public static $countryCode = "US";
|
||||||
public static $phone = "716-298-1822";
|
public static $phone = "716-298-1822";
|
||||||
public static $recipientName = "TestUser";
|
public static $recipientName = "TestUser";
|
||||||
public static $type = "Billing";
|
|
||||||
|
|
||||||
public static function createAddress() {
|
public static function createAddress() {
|
||||||
$addr = new ShippingAddress();
|
$addr = new ShippingAddress();
|
||||||
@@ -24,11 +23,10 @@ class ShippingAddressTest extends \PHPUnit_Framework_TestCase {
|
|||||||
$addr->setLine2(self::$line2);
|
$addr->setLine2(self::$line2);
|
||||||
$addr->setCity(self::$city);
|
$addr->setCity(self::$city);
|
||||||
$addr->setState(self::$state);
|
$addr->setState(self::$state);
|
||||||
$addr->setPostal_code(self::$postalCode);
|
$addr->setPostalCode(self::$postalCode);
|
||||||
$addr->setCountry_code(self::$countryCode);
|
$addr->setCountryCode(self::$countryCode);
|
||||||
$addr->setPhone(self::$phone);
|
$addr->setPhone(self::$phone);
|
||||||
$addr->setRecipient_name(self::$recipientName);
|
$addr->setRecipientName(self::$recipientName);
|
||||||
$addr->setType(self::$type);
|
|
||||||
return $addr;
|
return $addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -41,11 +39,10 @@ class ShippingAddressTest extends \PHPUnit_Framework_TestCase {
|
|||||||
$this->assertEquals(self::$line2, $this->address->getLine2());
|
$this->assertEquals(self::$line2, $this->address->getLine2());
|
||||||
$this->assertEquals(self::$city, $this->address->getCity());
|
$this->assertEquals(self::$city, $this->address->getCity());
|
||||||
$this->assertEquals(self::$state, $this->address->getState());
|
$this->assertEquals(self::$state, $this->address->getState());
|
||||||
$this->assertEquals(self::$postalCode, $this->address->getPostal_code());
|
$this->assertEquals(self::$postalCode, $this->address->getPostalCode());
|
||||||
$this->assertEquals(self::$countryCode, $this->address->getCountry_code());
|
$this->assertEquals(self::$countryCode, $this->address->getCountryCode());
|
||||||
$this->assertEquals(self::$phone, $this->address->getPhone());
|
$this->assertEquals(self::$phone, $this->address->getPhone());
|
||||||
$this->assertEquals(self::$recipientName, $this->address->getRecipient_name());
|
$this->assertEquals(self::$recipientName, $this->address->getRecipientName());
|
||||||
$this->assertEquals(self::$type, $this->address->getType());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSerializeDeserialize() {
|
public function testSerializeDeserialize() {
|
||||||
|
|||||||
@@ -1,35 +0,0 @@
|
|||||||
<?php
|
|
||||||
namespace PayPal\Test\Api;
|
|
||||||
|
|
||||||
use PayPal\Api\SubTransaction;
|
|
||||||
use PayPal\Test\Constants;
|
|
||||||
|
|
||||||
class SubTransactionTest extends \PHPUnit_Framework_TestCase {
|
|
||||||
|
|
||||||
private $subTransaction;
|
|
||||||
|
|
||||||
public static function createSubTransaction() {
|
|
||||||
$subTransaction = new SubTransaction();
|
|
||||||
$subTransaction->setAuthorization(AuthorizationTest::createAuthorization());
|
|
||||||
$subTransaction->setCapture(CaptureTest::createCapture());
|
|
||||||
return $subTransaction;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setup() {
|
|
||||||
$this->subTransaction = self::createSubTransaction();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testGetterSetter() {
|
|
||||||
$this->assertEquals(AuthorizationTest::$create_time, $this->subTransaction->getAuthorization()->getCreate_Time());
|
|
||||||
$this->assertEquals(CaptureTest::$create_time, $this->subTransaction->getCapture()->getCreate_Time());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testSerializeDeserialize() {
|
|
||||||
$s1 = $this->subTransaction;
|
|
||||||
|
|
||||||
$s2 = new SubTransaction();
|
|
||||||
$s2->fromJson($s1->toJson());
|
|
||||||
|
|
||||||
$this->assertEquals($s1, $s2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -18,9 +18,9 @@ class TransactionTest extends \PHPUnit_Framework_TestCase {
|
|||||||
$transaction = new Transaction();
|
$transaction = new Transaction();
|
||||||
$transaction->setAmount(AmountTest::createAmount());
|
$transaction->setAmount(AmountTest::createAmount());
|
||||||
$transaction->setDescription(self::$description);
|
$transaction->setDescription(self::$description);
|
||||||
$transaction->setItem_list(ItemListTest::createItemList());
|
$transaction->setItemList(ItemListTest::createItemList());
|
||||||
$transaction->setPayee(PayeeTest::createPayee());
|
$transaction->setPayee(PayeeTest::createPayee());
|
||||||
$transaction->setRelated_resources( array(SubTransactionTest::createSubTransaction()) );
|
$transaction->setRelatedResources( array(RelatedResourcesTest::createRelatedResources()) );
|
||||||
return $transaction;
|
return $transaction;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -31,11 +31,11 @@ class TransactionTest extends \PHPUnit_Framework_TestCase {
|
|||||||
public function testGetterSetter() {
|
public function testGetterSetter() {
|
||||||
$this->assertEquals(AmountTest::$currency, $this->transaction->getAmount()->getCurrency());
|
$this->assertEquals(AmountTest::$currency, $this->transaction->getAmount()->getCurrency());
|
||||||
$this->assertEquals(self::$description, $this->transaction->getDescription());
|
$this->assertEquals(self::$description, $this->transaction->getDescription());
|
||||||
$items = $this->transaction->getItem_list()->getItems();
|
$items = $this->transaction->getItemList()->getItems();
|
||||||
$this->assertEquals(ItemTest::$quantity, $items[0]->getQuantity());
|
$this->assertEquals(ItemTest::$quantity, $items[0]->getQuantity());
|
||||||
$this->assertEquals(PayeeTest::$email, $this->transaction->getPayee()->getEmail());
|
$this->assertEquals(PayeeTest::$email, $this->transaction->getPayee()->getEmail());
|
||||||
$resources = $this->transaction->getRelated_resources();
|
$resources = $this->transaction->getRelatedResources();
|
||||||
$this->assertEquals(AuthorizationTest::$create_time, $resources[0]->getAuthorization()->getCreate_Time());
|
$this->assertEquals(AuthorizationTest::$create_time, $resources[0]->getAuthorization()->getCreateTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSerializeDeserialize() {
|
public function testSerializeDeserialize() {
|
||||||
|
|||||||
@@ -4,12 +4,13 @@
|
|||||||
|
|
||||||
use PayPal\Auth\OAuthTokenCredential;
|
use PayPal\Auth\OAuthTokenCredential;
|
||||||
use PayPal\Test\Constants;
|
use PayPal\Test\Constants;
|
||||||
|
use PayPal\Core\PPConfigManager;
|
||||||
|
use PayPal\Exception\PPConnectionException;
|
||||||
class OAuthTokenCredentialTest extends PHPUnit_Framework_TestCase {
|
class OAuthTokenCredentialTest extends PHPUnit_Framework_TestCase {
|
||||||
|
|
||||||
public function testGetAccessToken() {
|
public function testGetAccessToken() {
|
||||||
$cred = new OAuthTokenCredential(Constants::CLIENT_ID, Constants::CLIENT_SECRET);
|
$cred = new OAuthTokenCredential(Constants::CLIENT_ID, Constants::CLIENT_SECRET);
|
||||||
$config = \PPConfigManager::getInstance()->getConfigHashmap();
|
$config = PPConfigManager::getInstance()->getConfigHashmap();
|
||||||
|
|
||||||
$token = $cred->getAccessToken($config);
|
$token = $cred->getAccessToken($config);
|
||||||
$this->assertNotNull($token);
|
$this->assertNotNull($token);
|
||||||
@@ -27,8 +28,8 @@ class OAuthTokenCredentialTest extends PHPUnit_Framework_TestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function testInvalidCredentials() {
|
public function testInvalidCredentials() {
|
||||||
$this->setExpectedException('\PPConnectionException');
|
$this->setExpectedException('PayPal\Exception\PPConnectionException');
|
||||||
$cred = new OAuthTokenCredential('dummy', 'secret');
|
$cred = new OAuthTokenCredential('dummy', 'secret');
|
||||||
$this->assertNull($cred->getAccessToken(\PPConfigManager::getInstance()->getConfigHashmap()));
|
$this->assertNull($cred->getAccessToken(PPConfigManager::getInstance()->getConfigHashmap()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
29
tests/PayPal/Test/Common/ArrayClass.php
Normal file
29
tests/PayPal/Test/Common/ArrayClass.php
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
namespace PayPal\Test\Common;
|
||||||
|
use PayPal\Common\PPModel;
|
||||||
|
class ArrayClass extends PPModel {
|
||||||
|
|
||||||
|
public function setName($name) {
|
||||||
|
$this->name = $name;
|
||||||
|
}
|
||||||
|
public function getName() {
|
||||||
|
return $this->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDescription($desc) {
|
||||||
|
$this->desc = $desc;
|
||||||
|
}
|
||||||
|
public function getDescription() {
|
||||||
|
return $this->desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setTags($tags) {
|
||||||
|
if(!is_array($tags)) {
|
||||||
|
$tags = array($tags);
|
||||||
|
}
|
||||||
|
$this->tags = $tags;
|
||||||
|
}
|
||||||
|
public function getTags() {
|
||||||
|
return $this->tags;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
// namespace PayPal\Test\Common;
|
namespace PayPal\Test\Common;
|
||||||
|
use PayPal\Common\PPArrayUtil;
|
||||||
|
|
||||||
|
class ArrayUtilTest extends \PHPUnit_Framework_TestCase {
|
||||||
class ArrayUtilTest extends PHPUnit_Framework_TestCase {
|
|
||||||
|
|
||||||
public function testIsAssocArray() {
|
public function testIsAssocArray() {
|
||||||
|
|
||||||
|
|||||||
6
tests/PayPal/Test/Common/ChildClass.php
Normal file
6
tests/PayPal/Test/Common/ChildClass.php
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?php
|
||||||
|
namespace PayPal\Test\Common;
|
||||||
|
use PayPal\Common\PPModel;
|
||||||
|
class ChildClass extends SimpleClass {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,82 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
namespace PayPal\Test\Common;
|
||||||
// namespace PayPal\Test\Common;
|
use PayPal\Common\PPModel;
|
||||||
|
use PayPal\Test\Common\ArrayClass;
|
||||||
|
use PayPal\Test\Common\SimpleClass;
|
||||||
class SimpleClass extends \PPModel {
|
use PayPal\Test\Common\NestedClass;
|
||||||
|
class ModelTest extends \PHPUnit_Framework_TestCase {
|
||||||
public function setName($name) {
|
|
||||||
$this->name = $name;
|
|
||||||
}
|
|
||||||
public function getName() {
|
|
||||||
return $this->name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setDescription($desc) {
|
|
||||||
$this->desc = $desc;
|
|
||||||
}
|
|
||||||
public function getDescription() {
|
|
||||||
return $this->desc;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class ArrayClass extends \PPModel {
|
|
||||||
|
|
||||||
public function setName($name) {
|
|
||||||
$this->name = $name;
|
|
||||||
}
|
|
||||||
public function getName() {
|
|
||||||
return $this->name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setDescription($desc) {
|
|
||||||
$this->desc = $desc;
|
|
||||||
}
|
|
||||||
public function getDescription() {
|
|
||||||
return $this->desc;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setTags($tags) {
|
|
||||||
if(!is_array($tags)) {
|
|
||||||
$tags = array($tags);
|
|
||||||
}
|
|
||||||
$this->tags = $tags;
|
|
||||||
}
|
|
||||||
public function getTags() {
|
|
||||||
return $this->tags;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class NestedClass extends \PPModel {
|
|
||||||
|
|
||||||
public function setId($id) {
|
|
||||||
$this->id = $id;
|
|
||||||
}
|
|
||||||
public function getId() {
|
|
||||||
return $this->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param ArrayClass $info
|
|
||||||
*/
|
|
||||||
public function setInfo($info) {
|
|
||||||
$this->info = $info;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @return ArrayClass
|
|
||||||
*/
|
|
||||||
public function getInfo() {
|
|
||||||
return $this->info;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class ChildClass extends SimpleClass {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
class ModelTest extends PHPUnit_Framework_TestCase {
|
|
||||||
|
|
||||||
public function testSimpleClassConversion() {
|
public function testSimpleClassConversion() {
|
||||||
$o = new SimpleClass();
|
$o = new SimpleClass();
|
||||||
|
|||||||
27
tests/PayPal/Test/Common/NestedClass.php
Normal file
27
tests/PayPal/Test/Common/NestedClass.php
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
namespace PayPal\Test\Common;
|
||||||
|
use PayPal\Common\PPModel;
|
||||||
|
class NestedClass extends PPModel {
|
||||||
|
|
||||||
|
public function setId($id) {
|
||||||
|
$this->id = $id;
|
||||||
|
}
|
||||||
|
public function getId() {
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param PayPal\Test\Common\ArrayClass $info
|
||||||
|
*/
|
||||||
|
public function setInfo($info) {
|
||||||
|
$this->info = $info;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return PayPal\Test\Common\ArrayClass
|
||||||
|
*/
|
||||||
|
public function getInfo() {
|
||||||
|
return $this->info;
|
||||||
|
}
|
||||||
|
}
|
||||||
19
tests/PayPal/Test/Common/SimpleClass.php
Normal file
19
tests/PayPal/Test/Common/SimpleClass.php
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
namespace PayPal\Test\Common;
|
||||||
|
use PayPal\Common\PPModel;
|
||||||
|
class SimpleClass extends PPModel {
|
||||||
|
|
||||||
|
public function setName($name) {
|
||||||
|
$this->name = $name;
|
||||||
|
}
|
||||||
|
public function getName() {
|
||||||
|
return $this->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDescription($desc) {
|
||||||
|
$this->desc = $desc;
|
||||||
|
}
|
||||||
|
public function getDescription() {
|
||||||
|
return $this->desc;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use PayPal\Common\UserAgent;
|
use PayPal\Common\PPUserAgent;
|
||||||
|
|
||||||
class UserAgentTest extends PHPUnit_Framework_TestCase {
|
class UserAgentTest extends PHPUnit_Framework_TestCase {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user