forked from LiveCarta/PayPal-PHP-SDK
Enabled EC Parameters support
- Updated Api to enabled EC Parameters - Updated Tests - Updated Logging Manager - Added a feature to do validation on accessors.
This commit is contained in:
36
README.md
36
README.md
@@ -117,6 +117,42 @@ There are two kinds of tests that we include in our sdk package. Unit tests, and
|
||||
* It executes the tests with configuration stored in `phpunit.integration.xml` file.
|
||||
* The configurations could be changed from `tests\sdk_config.ini` file.
|
||||
|
||||
## Developer Notes
|
||||
|
||||
### API Model Constructor
|
||||
|
||||
You can intialize the API objects by passing JSON string or Array representation of object to the constructor. E.g.:
|
||||
|
||||
```
|
||||
$obj = new SimpleClass('{"name":"test","description":"description"}');
|
||||
$obj->getName();
|
||||
$obj->getDescription();
|
||||
```
|
||||
|
||||
### Accessor Validation
|
||||
|
||||
We recently introduced a validation to determine if Model Object contains all the appropriate accessors (Getters and Setters) when converted from json response that we receive from Server.
|
||||
|
||||
This validation could be configured by updating the configuration settings in your sdk_config.ini file
|
||||
|
||||
Please visit our [sample sdk_config.ini](https://github.com/paypal/rest-api-sdk-php/blob/master/sample/sdk_config.ini)
|
||||
```
|
||||
;Validation Configuration
|
||||
[validation]
|
||||
; If validation is set to strict, the PPModel would make sure that
|
||||
; there are proper accessors (Getters and Setters) for each model
|
||||
; objects. Accepted value is
|
||||
; 'log' : logs the error message to logger only (default)
|
||||
; 'strict' : throws a php notice message
|
||||
; 'disable' : disable the validation
|
||||
validation.level=strict
|
||||
```
|
||||
|
||||
The warning message would be logged into your PayPal.log file, for e.g.:
|
||||
```
|
||||
PayPal\Validation\ModelAccessorValidator: WARNING: Missing Accessor: PayPal\Api\Payment:setFirstName . Please let us know by creating an issue at https://github.com/paypal/rest-api-sdk-php/issues
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
||||
* If you find solution to an [issue/improvements](https://github.com/paypal/rest-api-sdk-php/issues) in sdk that would be helpful to everyone, feel free to send us a pull request.
|
||||
|
||||
@@ -8,6 +8,10 @@ use PayPal\Rest\ApiContext;
|
||||
/**
|
||||
* Class Address
|
||||
*
|
||||
* Base Address object used as billing address in a payment or extended for Shipping Address.
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
* @property string line1
|
||||
* @property string line2
|
||||
* @property string city
|
||||
@@ -19,8 +23,8 @@ use PayPal\Rest\ApiContext;
|
||||
class Address extends PPModel
|
||||
{
|
||||
/**
|
||||
* Set Line 1
|
||||
* Address (eg. number, street, etc)
|
||||
* Line 1 of the Address (eg. number, street, etc).
|
||||
*
|
||||
*
|
||||
* @param string $line1
|
||||
*
|
||||
@@ -29,13 +33,11 @@ class Address extends PPModel
|
||||
public function setLine1($line1)
|
||||
{
|
||||
$this->line1 = $line1;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Line 1
|
||||
* Address (eg. number, street, etc)
|
||||
* Line 1 of the Address (eg. number, street, etc).
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -45,8 +47,8 @@ class Address extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Line 2 (Optional)
|
||||
* Address (eg. suite, apt #, etc)
|
||||
* Optional line 2 of the Address (eg. suite, apt #, etc.).
|
||||
*
|
||||
*
|
||||
* @param string $line2
|
||||
*
|
||||
@@ -55,13 +57,11 @@ class Address extends PPModel
|
||||
public function setLine2($line2)
|
||||
{
|
||||
$this->line2 = $line2;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Line 2 (Optional)
|
||||
* Address (eg. suite, apt #, etc)
|
||||
* Optional line 2 of the Address (eg. suite, apt #, etc.).
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -71,7 +71,8 @@ class Address extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set City Name
|
||||
* City name.
|
||||
*
|
||||
*
|
||||
* @param string $city
|
||||
*
|
||||
@@ -80,12 +81,11 @@ class Address extends PPModel
|
||||
public function setCity($city)
|
||||
{
|
||||
$this->city = $city;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get City Name
|
||||
* City name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -95,8 +95,8 @@ class Address extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Country Code
|
||||
* Two Letter
|
||||
* 2 letter country code.
|
||||
*
|
||||
*
|
||||
* @param string $country_code
|
||||
*
|
||||
@@ -105,13 +105,11 @@ class Address extends PPModel
|
||||
public function setCountryCode($country_code)
|
||||
{
|
||||
$this->country_code = $country_code;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Country Code
|
||||
* Two Letter
|
||||
* 2 letter country code.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -121,27 +119,22 @@ class Address extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Country Code
|
||||
* Two Letter
|
||||
* 2 letter country code.
|
||||
*
|
||||
* @deprecated Instead use setCountryCode
|
||||
*
|
||||
* @param string $country_code
|
||||
*
|
||||
* @deprecated Use setCountryCode
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setCountry_code($country_code)
|
||||
{
|
||||
$this->country_code = $country_code;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Country Code
|
||||
* Two Letter
|
||||
*
|
||||
* @deprecated Use getCountryCode
|
||||
* 2 letter country code.
|
||||
* @deprecated Instead use getCountryCode
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -151,9 +144,8 @@ class Address extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set 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
|
||||
* 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
|
||||
*
|
||||
@@ -162,14 +154,11 @@ class Address extends PPModel
|
||||
public function setPostalCode($postal_code)
|
||||
{
|
||||
$this->postal_code = $postal_code;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get 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
|
||||
* 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
|
||||
*/
|
||||
@@ -179,29 +168,22 @@ class Address extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set 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
|
||||
* 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.
|
||||
*
|
||||
* @deprecated Instead use setPostalCode
|
||||
*
|
||||
* @param string $postal_code
|
||||
*
|
||||
* @deprecated Use setPostalCode
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setPostal_code($postal_code)
|
||||
{
|
||||
$this->postal_code = $postal_code;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get 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
|
||||
*
|
||||
* @deprecated Use getPostalCode
|
||||
* 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.
|
||||
* @deprecated Instead use getPostalCode
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -211,8 +193,8 @@ class Address extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set State
|
||||
* Two 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
|
||||
*
|
||||
@@ -221,13 +203,11 @@ class Address extends PPModel
|
||||
public function setState($state)
|
||||
{
|
||||
$this->state = $state;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get State
|
||||
* Two 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
|
||||
*/
|
||||
@@ -237,8 +217,8 @@ class Address extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Phone Number
|
||||
* E.123 format
|
||||
* Phone number in E.123 format.
|
||||
*
|
||||
*
|
||||
* @param string $phone
|
||||
*
|
||||
@@ -251,8 +231,7 @@ class Address extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Phone Number
|
||||
* E.123 format
|
||||
* Phone number in E.123 format.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -260,4 +239,5 @@ class Address extends PPModel
|
||||
{
|
||||
return $this->phone;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,6 +8,10 @@ use PayPal\Rest\ApiContext;
|
||||
/**
|
||||
* Class Amount
|
||||
*
|
||||
* Let's you specify details of a payment amount.
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
* @property string currency
|
||||
* @property string total
|
||||
* @property \PayPal\Api\Details details
|
||||
@@ -15,8 +19,8 @@ use PayPal\Rest\ApiContext;
|
||||
class Amount extends PPModel
|
||||
{
|
||||
/**
|
||||
* Set Currency
|
||||
* Three Letter Currency Code
|
||||
* 3 letter currency code
|
||||
*
|
||||
*
|
||||
* @param string $currency
|
||||
*
|
||||
@@ -25,13 +29,11 @@ class Amount extends PPModel
|
||||
public function setCurrency($currency)
|
||||
{
|
||||
$this->currency = $currency;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Currency
|
||||
* Three Letter Currency Code
|
||||
* 3 letter currency code
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -41,9 +43,8 @@ class Amount extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set 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
|
||||
*
|
||||
@@ -52,14 +53,11 @@ class Amount extends PPModel
|
||||
public function setTotal($total)
|
||||
{
|
||||
$this->total = $total;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get 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
|
||||
*/
|
||||
@@ -69,8 +67,8 @@ class Amount extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Details
|
||||
* Additional Details of Payment Amount
|
||||
* Additional details of the payment amount.
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\Details $details
|
||||
*
|
||||
@@ -83,8 +81,7 @@ class Amount extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Details
|
||||
* Additional Details of Payment Amount
|
||||
* Additional details of the payment amount.
|
||||
*
|
||||
* @return \PayPal\Api\Details
|
||||
*/
|
||||
@@ -92,4 +89,5 @@ class Amount extends PPModel
|
||||
{
|
||||
return $this->details;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,32 +7,42 @@ use PayPal\Rest\ApiContext;
|
||||
use PayPal\Rest\IResource;
|
||||
use PayPal\Api\Capture;
|
||||
use PayPal\Transport\PPRestCall;
|
||||
use PayPal\Validation\ArgumentValidator;
|
||||
|
||||
/**
|
||||
* Class Authorization
|
||||
*
|
||||
* An authorization transaction.
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
* @property string id
|
||||
* @property string create_time
|
||||
* @property string update_time
|
||||
* @property \PayPal\Api\Amount amount
|
||||
* @property string payment_mode
|
||||
* @property string state
|
||||
* @property string protection_eligibility
|
||||
* @property string protection_eligibility_type
|
||||
* @property string parent_payment
|
||||
* @property string clearing_time
|
||||
* @property string valid_until
|
||||
* @property \PayPal\Api\Links links
|
||||
*/
|
||||
class Authorization extends PPModel implements IResource
|
||||
{
|
||||
/**
|
||||
* @var
|
||||
* OAuth Credentials to use for this call
|
||||
*
|
||||
* @var \PayPal\Auth\OAuthTokenCredential $credential
|
||||
*/
|
||||
private static $credential;
|
||||
protected static $credential;
|
||||
|
||||
/**
|
||||
* Set Credential
|
||||
*
|
||||
* @param $credential
|
||||
* Sets Credential
|
||||
*
|
||||
* @deprecated Pass ApiContext to create/get methods instead
|
||||
* @param \PayPal\Auth\OAuthTokenCredential $credential
|
||||
*/
|
||||
public static function setCredential($credential)
|
||||
{
|
||||
@@ -40,8 +50,8 @@ class Authorization extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set ID
|
||||
* Identifier of the authorization transaction
|
||||
* Identifier of the authorization transaction.
|
||||
*
|
||||
*
|
||||
* @param string $id
|
||||
*
|
||||
@@ -50,13 +60,11 @@ class Authorization extends PPModel implements IResource
|
||||
public function setId($id)
|
||||
{
|
||||
$this->id = $id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get ID
|
||||
* Identifier of the authorization transaction
|
||||
* Identifier of the authorization transaction.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -66,8 +74,8 @@ class Authorization extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Create Time
|
||||
* Time the resource was created
|
||||
* Time the resource was created in UTC ISO8601 format.
|
||||
*
|
||||
*
|
||||
* @param string $create_time
|
||||
*
|
||||
@@ -76,13 +84,11 @@ class Authorization extends PPModel implements IResource
|
||||
public function setCreateTime($create_time)
|
||||
{
|
||||
$this->create_time = $create_time;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Create Time
|
||||
* Time the resource was created
|
||||
* Time the resource was created in UTC ISO8601 format.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -92,27 +98,22 @@ class Authorization extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Create Time
|
||||
* Time the resource was created
|
||||
* Time the resource was created in UTC ISO8601 format.
|
||||
*
|
||||
* @deprecated Instead use setCreateTime
|
||||
*
|
||||
* @param string $create_time
|
||||
*
|
||||
* @deprecated Use setCreateTime
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setCreate_time($create_time)
|
||||
{
|
||||
$this->create_time = $create_time;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Create Time
|
||||
* Time the resource was created
|
||||
*
|
||||
* @deprecated Use getCreateTime
|
||||
* Time the resource was created in UTC ISO8601 format.
|
||||
* @deprecated Instead use getCreateTime
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -122,8 +123,8 @@ class Authorization extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Update Time
|
||||
* Time the resource was last updated
|
||||
* Time the resource was last updated in UTC ISO8601 format.
|
||||
*
|
||||
*
|
||||
* @param string $update_time
|
||||
*
|
||||
@@ -132,13 +133,11 @@ class Authorization extends PPModel implements IResource
|
||||
public function setUpdateTime($update_time)
|
||||
{
|
||||
$this->update_time = $update_time;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Update Time
|
||||
* Time the resource was last updated
|
||||
* Time the resource was last updated in UTC ISO8601 format.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -148,27 +147,22 @@ class Authorization extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Update Time
|
||||
* Time the resource was last updated
|
||||
* Time the resource was last updated in UTC ISO8601 format.
|
||||
*
|
||||
* @deprecated Instead use setUpdateTime
|
||||
*
|
||||
* @param string $update_time
|
||||
*
|
||||
* @deprecated Use setUpdateTime
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setUpdate_time($update_time)
|
||||
{
|
||||
$this->update_time = $update_time;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Update Time
|
||||
* Time the resource was last updated
|
||||
*
|
||||
* @deprecated Use getUpdateTime
|
||||
* Time the resource was last updated in UTC ISO8601 format.
|
||||
* @deprecated Instead use getUpdateTime
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -178,7 +172,8 @@ class Authorization extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Amount
|
||||
* Amount being authorized for.
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\Amount $amount
|
||||
*
|
||||
@@ -187,12 +182,11 @@ class Authorization extends PPModel implements IResource
|
||||
public function setAmount($amount)
|
||||
{
|
||||
$this->amount = $amount;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Amount
|
||||
* Amount being authorized for.
|
||||
*
|
||||
* @return \PayPal\Api\Amount
|
||||
*/
|
||||
@@ -202,8 +196,57 @@ class Authorization extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set State
|
||||
* State of the authorization transaction
|
||||
* specifies payment mode of the transaction
|
||||
* Valid Values: ["INSTANT_TRANSFER", "MANUAL_BANK_TRANSFER", "DELAYED_TRANSFER", "ECHECK"]
|
||||
*
|
||||
* @param string $payment_mode
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setPaymentMode($payment_mode)
|
||||
{
|
||||
$this->payment_mode = $payment_mode;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* specifies payment mode of the transaction
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPaymentMode()
|
||||
{
|
||||
return $this->payment_mode;
|
||||
}
|
||||
|
||||
/**
|
||||
* specifies payment mode of the transaction
|
||||
*
|
||||
* @deprecated Instead use setPaymentMode
|
||||
*
|
||||
* @param string $payment_mode
|
||||
* @return $this
|
||||
*/
|
||||
public function setPayment_mode($payment_mode)
|
||||
{
|
||||
$this->payment_mode = $payment_mode;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* specifies payment mode of the transaction
|
||||
* @deprecated Instead use getPaymentMode
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPayment_mode()
|
||||
{
|
||||
return $this->payment_mode;
|
||||
}
|
||||
|
||||
/**
|
||||
* State of the authorization transaction.
|
||||
* Valid Values: ["pending", "authorized", "partially_captured", "captured", "expired", "voided"]
|
||||
*
|
||||
* @param string $state
|
||||
*
|
||||
@@ -212,13 +255,11 @@ class Authorization extends PPModel implements IResource
|
||||
public function setState($state)
|
||||
{
|
||||
$this->state = $state;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get State
|
||||
* State of the authorization transaction
|
||||
* State of the authorization transaction.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -228,8 +269,106 @@ class Authorization extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Parent Payment
|
||||
* ID of the Payment resource that this transaction is based on
|
||||
* Protection Eligibility of the Payer
|
||||
* Valid Values: ["ELIGIBLE", "PARTIALLY_ELIGIBLE", "INELIGIBLE"]
|
||||
*
|
||||
* @param string $protection_eligibility
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setProtectionEligibility($protection_eligibility)
|
||||
{
|
||||
$this->protection_eligibility = $protection_eligibility;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Protection Eligibility of the Payer
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getProtectionEligibility()
|
||||
{
|
||||
return $this->protection_eligibility;
|
||||
}
|
||||
|
||||
/**
|
||||
* Protection Eligibility of the Payer
|
||||
*
|
||||
* @deprecated Instead use setProtectionEligibility
|
||||
*
|
||||
* @param string $protection_eligibility
|
||||
* @return $this
|
||||
*/
|
||||
public function setProtection_eligibility($protection_eligibility)
|
||||
{
|
||||
$this->protection_eligibility = $protection_eligibility;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Protection Eligibility of the Payer
|
||||
* @deprecated Instead use getProtectionEligibility
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getProtection_eligibility()
|
||||
{
|
||||
return $this->protection_eligibility;
|
||||
}
|
||||
|
||||
/**
|
||||
* Protection Eligibility Type of the Payer
|
||||
* Valid Values: ["ELIGIBLE", "ITEM_NOT_RECEIVED_ELIGIBLE", "INELIGIBLE", "UNAUTHORIZED_PAYMENT_ELIGIBLE"]
|
||||
*
|
||||
* @param string $protection_eligibility_type
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setProtectionEligibilityType($protection_eligibility_type)
|
||||
{
|
||||
$this->protection_eligibility_type = $protection_eligibility_type;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Protection Eligibility Type of the Payer
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getProtectionEligibilityType()
|
||||
{
|
||||
return $this->protection_eligibility_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Protection Eligibility Type of the Payer
|
||||
*
|
||||
* @deprecated Instead use setProtectionEligibilityType
|
||||
*
|
||||
* @param string $protection_eligibility_type
|
||||
* @return $this
|
||||
*/
|
||||
public function setProtection_eligibility_type($protection_eligibility_type)
|
||||
{
|
||||
$this->protection_eligibility_type = $protection_eligibility_type;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Protection Eligibility Type of the Payer
|
||||
* @deprecated Instead use getProtectionEligibilityType
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getProtection_eligibility_type()
|
||||
{
|
||||
return $this->protection_eligibility_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* ID of the Payment resource that this transaction is based on.
|
||||
*
|
||||
*
|
||||
* @param string $parent_payment
|
||||
*
|
||||
@@ -238,13 +377,11 @@ class Authorization extends PPModel implements IResource
|
||||
public function setParentPayment($parent_payment)
|
||||
{
|
||||
$this->parent_payment = $parent_payment;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Parent Payment
|
||||
* ID of the Payment resource that this transaction is based on
|
||||
* ID of the Payment resource that this transaction is based on.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -254,27 +391,22 @@ class Authorization extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Parent Payment
|
||||
* ID of the Payment resource that this transaction is based on
|
||||
* ID of the Payment resource that this transaction is based on.
|
||||
*
|
||||
* @deprecated Instead use setParentPayment
|
||||
*
|
||||
* @param string $parent_payment
|
||||
*
|
||||
* @deprecated Use setParentPayment
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setParent_payment($parent_payment)
|
||||
{
|
||||
$this->parent_payment = $parent_payment;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Parent Payment
|
||||
* ID of the Payment resource that this transaction is based on
|
||||
*
|
||||
* @deprecated Use getParentPayment
|
||||
* ID of the Payment resource that this transaction is based on.
|
||||
* @deprecated Instead use getParentPayment
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -284,8 +416,57 @@ class Authorization extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Valid Until
|
||||
* Date/Time until which funds may be captured against this resource
|
||||
* Expected clearing time for eCheck Transactions
|
||||
*
|
||||
*
|
||||
* @param string $clearing_time
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setClearingTime($clearing_time)
|
||||
{
|
||||
$this->clearing_time = $clearing_time;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Expected clearing time for eCheck Transactions
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getClearingTime()
|
||||
{
|
||||
return $this->clearing_time;
|
||||
}
|
||||
|
||||
/**
|
||||
* Expected clearing time for eCheck Transactions
|
||||
*
|
||||
* @deprecated Instead use setClearingTime
|
||||
*
|
||||
* @param string $clearing_time
|
||||
* @return $this
|
||||
*/
|
||||
public function setClearing_time($clearing_time)
|
||||
{
|
||||
$this->clearing_time = $clearing_time;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Expected clearing time for eCheck Transactions
|
||||
* @deprecated Instead use getClearingTime
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getClearing_time()
|
||||
{
|
||||
return $this->clearing_time;
|
||||
}
|
||||
|
||||
/**
|
||||
* Date/Time until which funds may be captured against this resource.
|
||||
*
|
||||
*
|
||||
* @param string $valid_until
|
||||
*
|
||||
@@ -294,13 +475,11 @@ class Authorization extends PPModel implements IResource
|
||||
public function setValidUntil($valid_until)
|
||||
{
|
||||
$this->valid_until = $valid_until;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Valid Until
|
||||
* Date/Time until which funds may be captured against this resource
|
||||
* Date/Time until which funds may be captured against this resource.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -310,27 +489,22 @@ class Authorization extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Valid Until
|
||||
* Date/Time until which funds may be captured against this resource
|
||||
* Date/Time until which funds may be captured against this resource.
|
||||
*
|
||||
* @deprecated Instead use setValidUntil
|
||||
*
|
||||
* @param string $valid_until
|
||||
*
|
||||
* @deprecated Use setValidUntil
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setValid_until($valid_until)
|
||||
{
|
||||
$this->valid_until = $valid_until;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Valid Until
|
||||
* Date/Time until which funds may be captured against this resource
|
||||
*
|
||||
* @deprecated Use getValidUntil
|
||||
* Date/Time until which funds may be captured against this resource.
|
||||
* @deprecated Instead use getValidUntil
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -340,7 +514,8 @@ class Authorization extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Links
|
||||
* Sets Links
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\Links $links
|
||||
*
|
||||
@@ -349,14 +524,13 @@ class Authorization extends PPModel implements IResource
|
||||
public function setLinks($links)
|
||||
{
|
||||
$this->links = $links;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Links
|
||||
* Gets Links
|
||||
*
|
||||
* @return \PayPal\Api\Links
|
||||
* @return \PayPal\Api\Links[]
|
||||
*/
|
||||
public function getLinks()
|
||||
{
|
||||
@@ -364,122 +538,88 @@ class Authorization extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Get
|
||||
*
|
||||
* @param int $authorizationId
|
||||
* @param \PayPal\Rest\ApiContext|null $apiContext
|
||||
* Obtain the Authorization transaction resource for the given identifier.
|
||||
*
|
||||
* @param string $authorizationId
|
||||
* @param \PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
||||
* @return Authorization
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public static function get($authorizationId, $apiContext = null)
|
||||
{
|
||||
if (($authorizationId == null) || (strlen($authorizationId) <= 0)) {
|
||||
throw new \InvalidArgumentException("authorizationId cannot be null or empty");
|
||||
}
|
||||
ArgumentValidator::validate($authorizationId, 'authorizationId');
|
||||
|
||||
$payLoad = "";
|
||||
|
||||
if ($apiContext == null) {
|
||||
$apiContext = new ApiContext(self::$credential);
|
||||
}
|
||||
|
||||
$call = new PPRestCall($apiContext);
|
||||
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payments/authorization/$authorizationId", "GET", $payLoad);
|
||||
|
||||
$ret = new Authorization();
|
||||
$ret->fromJson($json);
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Capture
|
||||
*
|
||||
* @param \Paypal\Api\Capture $capture
|
||||
* @param \PayPal\Rest\ApiContext|null $apiContext
|
||||
* Creates (and processes) a new Capture Transaction added as a related resource.
|
||||
*
|
||||
* @param Capture $capture
|
||||
* @param \PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
||||
* @return Capture
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function capture($capture, $apiContext = null)
|
||||
{
|
||||
if ($this->getId() == null) {
|
||||
throw new \InvalidArgumentException("Id cannot be null");
|
||||
}
|
||||
|
||||
if (($capture == null)) {
|
||||
throw new \InvalidArgumentException("capture cannot be null or empty");
|
||||
}
|
||||
ArgumentValidator::validate($this->getId(), "Id");
|
||||
ArgumentValidator::validate($capture, 'capture');
|
||||
|
||||
$payLoad = $capture->toJSON();
|
||||
|
||||
if ($apiContext == null) {
|
||||
$apiContext = new ApiContext(self::$credential);
|
||||
}
|
||||
|
||||
$call = new PPRestCall($apiContext);
|
||||
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payments/authorization/{$this->getId()}/capture", "POST", $payLoad);
|
||||
|
||||
$ret = new Capture();
|
||||
$ret->fromJson($json);
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Void
|
||||
*
|
||||
* @param \PayPal\Rest\ApiContext|null $apiContext
|
||||
* Voids (cancels) an Authorization.
|
||||
*
|
||||
* @param \PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
||||
* @return Authorization
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function void($apiContext = null)
|
||||
{
|
||||
if ($this->getId() == null) {
|
||||
throw new \InvalidArgumentException("Id cannot be null");
|
||||
}
|
||||
ArgumentValidator::validate($this->getId(), "Id");
|
||||
|
||||
$payLoad = "";
|
||||
|
||||
if ($apiContext == null) {
|
||||
$apiContext = new ApiContext(self::$credential);
|
||||
}
|
||||
|
||||
$call = new PPRestCall($apiContext);
|
||||
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payments/authorization/{$this->getId()}/void", "POST", $payLoad);
|
||||
|
||||
$ret = new Authorization();
|
||||
$ret->fromJson($json);
|
||||
|
||||
return $ret;
|
||||
$this->fromJson($json);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reauthorize
|
||||
* Reauthorizes an expired Authorization.
|
||||
*
|
||||
* @param \PayPal\Rest\ApiContext|null $apiContext
|
||||
*
|
||||
* @return $this
|
||||
* @throws \InvalidArgumentException
|
||||
* @param \PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
||||
* @return Authorization
|
||||
*/
|
||||
public function reauthorize($apiContext = null)
|
||||
{
|
||||
if ($this->getId() == null) {
|
||||
throw new \InvalidArgumentException("Id cannot be null");
|
||||
}
|
||||
ArgumentValidator::validate($this->getId(), "Id");
|
||||
|
||||
$payLoad = $this->toJSON();
|
||||
|
||||
if ($apiContext == null) {
|
||||
$apiContext = new ApiContext(self::$credential);
|
||||
}
|
||||
|
||||
$call = new PPRestCall($apiContext);
|
||||
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payments/authorization/{$this->getId()}/reauthorize", "POST", $payLoad);
|
||||
$this->fromJson($json);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
1244
lib/PayPal/Api/BankAccount.php
Normal file
1244
lib/PayPal/Api/BankAccount.php
Normal file
File diff suppressed because it is too large
Load Diff
143
lib/PayPal/Api/BankAccountsList.php
Normal file
143
lib/PayPal/Api/BankAccountsList.php
Normal file
@@ -0,0 +1,143 @@
|
||||
<?php
|
||||
|
||||
namespace PayPal\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Rest\ApiContext;
|
||||
|
||||
/**
|
||||
* Class BankAccountsList
|
||||
*
|
||||
* A list of Bank Account Resources
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
* @property \PayPal\Api\BankAccount bank_accounts
|
||||
* @property int count
|
||||
* @property string next_id
|
||||
*/
|
||||
class BankAccountsList extends PPModel
|
||||
{
|
||||
/**
|
||||
* A list of bank account resources
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\BankAccount $bank_accounts
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setBankAccounts($bank_accounts)
|
||||
{
|
||||
$this->{"bank-accounts"} = $bank_accounts;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* A list of bank account resources
|
||||
*
|
||||
* @return \PayPal\Api\BankAccount[]
|
||||
*/
|
||||
public function getBankAccounts()
|
||||
{
|
||||
return $this->{"bank-accounts"};
|
||||
}
|
||||
|
||||
/**
|
||||
* A list of bank account resources
|
||||
*
|
||||
* @deprecated Instead use setBankAccounts
|
||||
*
|
||||
* @param \PayPal\Api\BankAccount $bank-accounts
|
||||
* @return $this
|
||||
*/
|
||||
public function setBank_accounts($bank_accounts)
|
||||
{
|
||||
$this->{"bank-accounts"} = $bank_accounts;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* A list of bank account resources
|
||||
* @deprecated Instead use getBankAccounts
|
||||
*
|
||||
* @return \PayPal\Api\BankAccount
|
||||
*/
|
||||
public function getBank_accounts()
|
||||
{
|
||||
return $this->{"bank-accounts"};
|
||||
}
|
||||
|
||||
/**
|
||||
* Number of items returned in each range of results. Note that the last results range could have fewer items than the requested number of items.
|
||||
*
|
||||
*
|
||||
* @param int $count
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setCount($count)
|
||||
{
|
||||
$this->count = $count;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Number of items returned in each range of results. Note that the last results range could have fewer items than the requested number of items.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getCount()
|
||||
{
|
||||
return $this->count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Identifier of the next element to get the next range of results.
|
||||
*
|
||||
*
|
||||
* @param string $next_id
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setNextId($next_id)
|
||||
{
|
||||
$this->next_id = $next_id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Identifier of the next element to get the next range of results.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getNextId()
|
||||
{
|
||||
return $this->next_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Identifier of the next element to get the next range of results.
|
||||
*
|
||||
* @deprecated Instead use setNextId
|
||||
*
|
||||
* @param string $next_id
|
||||
* @return $this
|
||||
*/
|
||||
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.
|
||||
* @deprecated Instead use getNextId
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getNext_id()
|
||||
{
|
||||
return $this->next_id;
|
||||
}
|
||||
|
||||
}
|
||||
168
lib/PayPal/Api/BankToken.php
Normal file
168
lib/PayPal/Api/BankToken.php
Normal file
@@ -0,0 +1,168 @@
|
||||
<?php
|
||||
|
||||
namespace PayPal\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Rest\ApiContext;
|
||||
|
||||
/**
|
||||
* Class BankToken
|
||||
*
|
||||
* A resource representing a bank that can be used to fund a payment.
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
* @property string bank_id
|
||||
* @property string external_customer_id
|
||||
* @property string mandate_reference_number
|
||||
*/
|
||||
class BankToken extends PPModel
|
||||
{
|
||||
/**
|
||||
* ID of a previously saved Bank resource using /vault/bank API.
|
||||
*
|
||||
*
|
||||
* @param string $bank_id
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setBankId($bank_id)
|
||||
{
|
||||
$this->bank_id = $bank_id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* ID of a previously saved Bank resource using /vault/bank API.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getBankId()
|
||||
{
|
||||
return $this->bank_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* ID of a previously saved Bank resource using /vault/bank API.
|
||||
*
|
||||
* @deprecated Instead use setBankId
|
||||
*
|
||||
* @param string $bank_id
|
||||
* @return $this
|
||||
*/
|
||||
public function setBank_id($bank_id)
|
||||
{
|
||||
$this->bank_id = $bank_id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* ID of a previously saved Bank resource using /vault/bank API.
|
||||
* @deprecated Instead use getBankId
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getBank_id()
|
||||
{
|
||||
return $this->bank_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* The unique identifier of the payer used when saving this bank using /vault/bank API.
|
||||
*
|
||||
*
|
||||
* @param string $external_customer_id
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setExternalCustomerId($external_customer_id)
|
||||
{
|
||||
$this->external_customer_id = $external_customer_id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The unique identifier of the payer used when saving this bank using /vault/bank API.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getExternalCustomerId()
|
||||
{
|
||||
return $this->external_customer_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* The unique identifier of the payer used when saving this bank using /vault/bank API.
|
||||
*
|
||||
* @deprecated Instead use setExternalCustomerId
|
||||
*
|
||||
* @param string $external_customer_id
|
||||
* @return $this
|
||||
*/
|
||||
public function setExternal_customer_id($external_customer_id)
|
||||
{
|
||||
$this->external_customer_id = $external_customer_id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The unique identifier of the payer used when saving this bank using /vault/bank API.
|
||||
* @deprecated Instead use getExternalCustomerId
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getExternal_customer_id()
|
||||
{
|
||||
return $this->external_customer_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Identifier of the direct debit mandate to validate. Currently supported only for EU bank accounts(SEPA).
|
||||
*
|
||||
*
|
||||
* @param string $mandate_reference_number
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setMandateReferenceNumber($mandate_reference_number)
|
||||
{
|
||||
$this->mandate_reference_number = $mandate_reference_number;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Identifier of the direct debit mandate to validate. Currently supported only for EU bank accounts(SEPA).
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getMandateReferenceNumber()
|
||||
{
|
||||
return $this->mandate_reference_number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Identifier of the direct debit mandate to validate. Currently supported only for EU bank accounts(SEPA).
|
||||
*
|
||||
* @deprecated Instead use setMandateReferenceNumber
|
||||
*
|
||||
* @param string $mandate_reference_number
|
||||
* @return $this
|
||||
*/
|
||||
public function setMandate_reference_number($mandate_reference_number)
|
||||
{
|
||||
$this->mandate_reference_number = $mandate_reference_number;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Identifier of the direct debit mandate to validate. Currently supported only for EU bank accounts(SEPA).
|
||||
* @deprecated Instead use getMandateReferenceNumber
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getMandate_reference_number()
|
||||
{
|
||||
return $this->mandate_reference_number;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,10 +7,15 @@ use PayPal\Rest\ApiContext;
|
||||
use PayPal\Rest\IResource;
|
||||
use PayPal\Api\Refund;
|
||||
use PayPal\Transport\PPRestCall;
|
||||
use PayPal\Validation\ArgumentValidator;
|
||||
|
||||
/**
|
||||
* Class Capture
|
||||
*
|
||||
* A capture transaction.
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
* @property string id
|
||||
* @property string create_time
|
||||
* @property string update_time
|
||||
@@ -23,14 +28,17 @@ use PayPal\Transport\PPRestCall;
|
||||
class Capture extends PPModel implements IResource
|
||||
{
|
||||
/**
|
||||
* @var
|
||||
* OAuth Credentials to use for this call
|
||||
*
|
||||
* @var \PayPal\Auth\OAuthTokenCredential $credential
|
||||
*/
|
||||
private static $credential;
|
||||
protected static $credential;
|
||||
|
||||
/**
|
||||
* @param $credential
|
||||
* Sets Credential
|
||||
*
|
||||
* @deprecated Pass ApiContext to create/get methods instead
|
||||
* @param \PayPal\Auth\OAuthTokenCredential $credential
|
||||
*/
|
||||
public static function setCredential($credential)
|
||||
{
|
||||
@@ -38,8 +46,8 @@ class Capture extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set ID
|
||||
* Identifier of the Capture transaction
|
||||
* Identifier of the Capture transaction.
|
||||
*
|
||||
*
|
||||
* @param string $id
|
||||
*
|
||||
@@ -48,13 +56,11 @@ class Capture extends PPModel implements IResource
|
||||
public function setId($id)
|
||||
{
|
||||
$this->id = $id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get ID
|
||||
* Identifier of the Capture transaction
|
||||
* Identifier of the Capture transaction.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -64,8 +70,8 @@ class Capture extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Create Time
|
||||
* Time the resource was created
|
||||
* Time the resource was created in UTC ISO8601 format.
|
||||
*
|
||||
*
|
||||
* @param string $create_time
|
||||
*
|
||||
@@ -74,13 +80,11 @@ class Capture extends PPModel implements IResource
|
||||
public function setCreateTime($create_time)
|
||||
{
|
||||
$this->create_time = $create_time;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Create Time
|
||||
* Time the resource was created
|
||||
* Time the resource was created in UTC ISO8601 format.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -90,27 +94,22 @@ class Capture extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Create Time
|
||||
* Time the resource was created
|
||||
* Time the resource was created in UTC ISO8601 format.
|
||||
*
|
||||
* @deprecated Instead use setCreateTime
|
||||
*
|
||||
* @param string $create_time
|
||||
*
|
||||
* @deprecated Use setCreateTime
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setCreate_time($create_time)
|
||||
{
|
||||
$this->create_time = $create_time;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Create Time
|
||||
* Time the resource was created
|
||||
*
|
||||
* @deprecated Use getCreateTime
|
||||
* Time the resource was created in UTC ISO8601 format.
|
||||
* @deprecated Instead use getCreateTime
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -120,8 +119,8 @@ class Capture extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Update Time
|
||||
* Time the resource was last updated
|
||||
* Time the resource was last updated in UTC ISO8601 format.
|
||||
*
|
||||
*
|
||||
* @param string $update_time
|
||||
*
|
||||
@@ -130,13 +129,11 @@ class Capture extends PPModel implements IResource
|
||||
public function setUpdateTime($update_time)
|
||||
{
|
||||
$this->update_time = $update_time;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Update Time
|
||||
* Time the resource was last updated
|
||||
* Time the resource was last updated in UTC ISO8601 format.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -146,27 +143,22 @@ class Capture extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Update Time
|
||||
* Time the resource was last updated
|
||||
* Time the resource was last updated in UTC ISO8601 format.
|
||||
*
|
||||
* @deprecated Instead use setUpdateTime
|
||||
*
|
||||
* @param string $update_time
|
||||
*
|
||||
* @deprecated Use setUpdateTime
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setUpdate_time($update_time)
|
||||
{
|
||||
$this->update_time = $update_time;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Update Time
|
||||
* Time the resource was last updated
|
||||
*
|
||||
* @deprecated Use getUpdateTime
|
||||
* Time the resource was last updated in UTC ISO8601 format.
|
||||
* @deprecated Instead use getUpdateTime
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -176,11 +168,8 @@ class Capture extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Amount
|
||||
* 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
|
||||
*
|
||||
@@ -189,16 +178,11 @@ class Capture extends PPModel implements IResource
|
||||
public function setAmount($amount)
|
||||
{
|
||||
$this->amount = $amount;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Amount
|
||||
* 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
|
||||
*/
|
||||
@@ -208,27 +192,23 @@ class Capture extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set 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
|
||||
* 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 bool $is_final_capture
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setIsFinalCapture($is_final_capture)
|
||||
{
|
||||
$this->is_final_capture = $is_final_capture;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get 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
|
||||
* 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 bool
|
||||
*/
|
||||
public function getIsFinalCapture()
|
||||
{
|
||||
@@ -236,31 +216,24 @@ class Capture extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set 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
|
||||
* 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 Use setIsFinalCapture
|
||||
* @deprecated Instead use setIsFinalCapture
|
||||
*
|
||||
* @param bool $is_final_capture
|
||||
* @return $this
|
||||
*/
|
||||
public function setIs_final_capture($is_final_capture)
|
||||
{
|
||||
$this->is_final_capture = $is_final_capture;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get 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
|
||||
* 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.
|
||||
* @deprecated Instead use getIsFinalCapture
|
||||
*
|
||||
* @deprecated Use getIsFinalCapture
|
||||
*
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
public function getIs_final_capture()
|
||||
{
|
||||
@@ -268,8 +241,8 @@ class Capture extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set State
|
||||
* State of the capture transaction
|
||||
* State of the capture transaction.
|
||||
* Valid Values: ["pending", "completed", "refunded", "partially_refunded"]
|
||||
*
|
||||
* @param string $state
|
||||
*
|
||||
@@ -278,13 +251,11 @@ class Capture extends PPModel implements IResource
|
||||
public function setState($state)
|
||||
{
|
||||
$this->state = $state;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get State
|
||||
* State of the capture transaction
|
||||
* State of the capture transaction.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -294,8 +265,8 @@ class Capture extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Parent Payment
|
||||
* 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
|
||||
*
|
||||
@@ -304,13 +275,11 @@ class Capture extends PPModel implements IResource
|
||||
public function setParentPayment($parent_payment)
|
||||
{
|
||||
$this->parent_payment = $parent_payment;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Parent Payment
|
||||
* ID of the Payment resource that this transaction is based on
|
||||
* ID of the Payment resource that this transaction is based on.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -320,27 +289,22 @@ class Capture extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Parent Payment
|
||||
* ID of the Payment resource that this transaction is based on
|
||||
* ID of the Payment resource that this transaction is based on.
|
||||
*
|
||||
* @deprecated Instead use setParentPayment
|
||||
*
|
||||
* @param string $parent_payment
|
||||
*
|
||||
* @deprecated Use setParentPayment
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setParent_payment($parent_payment)
|
||||
{
|
||||
$this->parent_payment = $parent_payment;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Parent Payment
|
||||
* ID of the Payment resource that this transaction is based on
|
||||
*
|
||||
* @deprecated Use getParentPayment
|
||||
* ID of the Payment resource that this transaction is based on.
|
||||
* @deprecated Instead use getParentPayment
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -350,7 +314,8 @@ class Capture extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Links
|
||||
* Sets Links
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\Links $links
|
||||
*
|
||||
@@ -359,14 +324,13 @@ class Capture extends PPModel implements IResource
|
||||
public function setLinks($links)
|
||||
{
|
||||
$this->links = $links;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Links
|
||||
* Gets Links
|
||||
*
|
||||
* @return \PayPal\Api\Links
|
||||
* @return \PayPal\Api\Links[]
|
||||
*/
|
||||
public function getLinks()
|
||||
{
|
||||
@@ -374,66 +338,48 @@ class Capture extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Get
|
||||
*
|
||||
* @param int $captureId
|
||||
* @param \PayPal\Rest\ApiContext|null $apiContext
|
||||
* Obtain the Capture transaction resource for the given identifier.
|
||||
*
|
||||
* @param string $captureId
|
||||
* @param \PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
||||
* @return Capture
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public static function get($captureId, $apiContext = null)
|
||||
{
|
||||
if (($captureId == null) || (strlen($captureId) <= 0)) {
|
||||
throw new \InvalidArgumentException("captureId cannot be null or empty");
|
||||
}
|
||||
ArgumentValidator::validate($captureId, 'captureId');
|
||||
|
||||
$payLoad = "";
|
||||
|
||||
if ($apiContext == null) {
|
||||
$apiContext = new ApiContext(self::$credential);
|
||||
}
|
||||
|
||||
$call = new PPRestCall($apiContext);
|
||||
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payments/capture/$captureId", "GET", $payLoad);
|
||||
|
||||
$ret = new Capture();
|
||||
$ret->fromJson($json);
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Refund
|
||||
*
|
||||
* @param \Paypal\Api\Refund $refund
|
||||
* @param \PayPal\Rest\ApiContext|null $apiContext
|
||||
* Creates (and processes) a new Refund Transaction added as a related resource.
|
||||
*
|
||||
* @param Refund $refund
|
||||
* @param \PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
||||
* @return Refund
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function refund($refund, $apiContext = null)
|
||||
{
|
||||
if ($this->getId() == null) {
|
||||
throw new \InvalidArgumentException("Id cannot be null");
|
||||
}
|
||||
|
||||
if (($refund == null)) {
|
||||
throw new \InvalidArgumentException("refund cannot be null or empty");
|
||||
}
|
||||
ArgumentValidator::validate($this->getId(), "Id");
|
||||
ArgumentValidator::validate($refund, 'refund');
|
||||
|
||||
$payLoad = $refund->toJSON();
|
||||
|
||||
if ($apiContext == null) {
|
||||
$apiContext = new ApiContext(self::$credential);
|
||||
}
|
||||
|
||||
$call = new PPRestCall($apiContext);
|
||||
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payments/capture/{$this->getId()}/refund", "POST", $payLoad);
|
||||
|
||||
$ret = new Refund();
|
||||
$ret->fromJson($json);
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
117
lib/PayPal/Api/CarrierAccountToken.php
Normal file
117
lib/PayPal/Api/CarrierAccountToken.php
Normal file
@@ -0,0 +1,117 @@
|
||||
<?php
|
||||
|
||||
namespace PayPal\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Rest\ApiContext;
|
||||
|
||||
|
||||
/**
|
||||
* Class CarrierAccountToken
|
||||
*
|
||||
* A resource representing a carrier account that can be used to fund a payment.
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
* @property string carrier_account_id
|
||||
* @property string external_customer_id
|
||||
*/
|
||||
class CarrierAccountToken extends PPModel
|
||||
{
|
||||
/**
|
||||
* ID of a previously saved carrier account resource.
|
||||
*
|
||||
*
|
||||
* @param string $carrier_account_id
|
||||
* @return $this
|
||||
*/
|
||||
public function setCarrierAccountId($carrier_account_id)
|
||||
{
|
||||
$this->carrier_account_id = $carrier_account_id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* ID of a previously saved carrier account resource.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCarrierAccountId()
|
||||
{
|
||||
return $this->carrier_account_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* ID of a previously saved carrier account resource.
|
||||
*
|
||||
* @deprecated Instead use setCarrierAccountId
|
||||
*
|
||||
* @param string $carrier_account_id
|
||||
* @return $this
|
||||
*/
|
||||
public function setCarrier_account_id($carrier_account_id)
|
||||
{
|
||||
$this->carrier_account_id = $carrier_account_id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* ID of a previously saved carrier account resource.
|
||||
* @deprecated Instead use getCarrierAccountId
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCarrier_account_id()
|
||||
{
|
||||
return $this->carrier_account_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* The unique identifier of the payer used when saving this carrier account instrument.
|
||||
*
|
||||
*
|
||||
* @param string $external_customer_id
|
||||
* @return $this
|
||||
*/
|
||||
public function setExternalCustomerId($external_customer_id)
|
||||
{
|
||||
$this->external_customer_id = $external_customer_id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The unique identifier of the payer used when saving this carrier account instrument.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getExternalCustomerId()
|
||||
{
|
||||
return $this->external_customer_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* The unique identifier of the payer used when saving this carrier account instrument.
|
||||
*
|
||||
* @deprecated Instead use setExternalCustomerId
|
||||
*
|
||||
* @param string $external_customer_id
|
||||
* @return $this
|
||||
*/
|
||||
public function setExternal_customer_id($external_customer_id)
|
||||
{
|
||||
$this->external_customer_id = $external_customer_id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The unique identifier of the payer used when saving this carrier account instrument.
|
||||
* @deprecated Instead use getExternalCustomerId
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getExternal_customer_id()
|
||||
{
|
||||
return $this->external_customer_id;
|
||||
}
|
||||
|
||||
}
|
||||
368
lib/PayPal/Api/CartBase.php
Normal file
368
lib/PayPal/Api/CartBase.php
Normal file
@@ -0,0 +1,368 @@
|
||||
<?php
|
||||
|
||||
namespace PayPal\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Rest\ApiContext;
|
||||
|
||||
/**
|
||||
* Class CartBase
|
||||
*
|
||||
* Base properties of a cart resource
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
* @property \PayPal\Api\Amount amount
|
||||
* @property \PayPal\Api\Payee payee
|
||||
* @property string description
|
||||
* @property string note_to_payee
|
||||
* @property string custom
|
||||
* @property string invoice_number
|
||||
* @property string soft_descriptor
|
||||
* @property \PayPal\Api\PaymentOptions payment_options
|
||||
* @property \PayPal\Api\ItemList item_list
|
||||
*/
|
||||
class CartBase extends PPModel
|
||||
{
|
||||
/**
|
||||
* Amount being collected.
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\Amount $amount
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setAmount($amount)
|
||||
{
|
||||
$this->amount = $amount;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Amount being collected.
|
||||
*
|
||||
* @return \PayPal\Api\Amount
|
||||
*/
|
||||
public function getAmount()
|
||||
{
|
||||
return $this->amount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recipient of the funds in this transaction.
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\Payee $payee
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setPayee($payee)
|
||||
{
|
||||
$this->payee = $payee;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recipient of the funds in this transaction.
|
||||
*
|
||||
* @return \PayPal\Api\Payee
|
||||
*/
|
||||
public function getPayee()
|
||||
{
|
||||
return $this->payee;
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of what is being paid for.
|
||||
*
|
||||
*
|
||||
* @param string $description
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setDescription($description)
|
||||
{
|
||||
$this->description = $description;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of what is being paid for.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDescription()
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Note to the recipient of the funds in this transaction.
|
||||
*
|
||||
*
|
||||
* @param string $note_to_payee
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setNoteToPayee($note_to_payee)
|
||||
{
|
||||
$this->note_to_payee = $note_to_payee;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Note to the recipient of the funds in this transaction.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getNoteToPayee()
|
||||
{
|
||||
return $this->note_to_payee;
|
||||
}
|
||||
|
||||
/**
|
||||
* Note to the recipient of the funds in this transaction.
|
||||
*
|
||||
* @deprecated Instead use setNoteToPayee
|
||||
*
|
||||
* @param string $note_to_payee
|
||||
* @return $this
|
||||
*/
|
||||
public function setNote_to_payee($note_to_payee)
|
||||
{
|
||||
$this->note_to_payee = $note_to_payee;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Note to the recipient of the funds in this transaction.
|
||||
* @deprecated Instead use getNoteToPayee
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getNote_to_payee()
|
||||
{
|
||||
return $this->note_to_payee;
|
||||
}
|
||||
|
||||
/**
|
||||
* free-form field for the use of clients
|
||||
*
|
||||
*
|
||||
* @param string $custom
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setCustom($custom)
|
||||
{
|
||||
$this->custom = $custom;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* free-form field for the use of clients
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCustom()
|
||||
{
|
||||
return $this->custom;
|
||||
}
|
||||
|
||||
/**
|
||||
* invoice number to track this payment
|
||||
*
|
||||
*
|
||||
* @param string $invoice_number
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setInvoiceNumber($invoice_number)
|
||||
{
|
||||
$this->invoice_number = $invoice_number;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* invoice number to track this payment
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getInvoiceNumber()
|
||||
{
|
||||
return $this->invoice_number;
|
||||
}
|
||||
|
||||
/**
|
||||
* invoice number to track this payment
|
||||
*
|
||||
* @deprecated Instead use setInvoiceNumber
|
||||
*
|
||||
* @param string $invoice_number
|
||||
* @return $this
|
||||
*/
|
||||
public function setInvoice_number($invoice_number)
|
||||
{
|
||||
$this->invoice_number = $invoice_number;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* invoice number to track this payment
|
||||
* @deprecated Instead use getInvoiceNumber
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getInvoice_number()
|
||||
{
|
||||
return $this->invoice_number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Soft descriptor used when charging this funding source.
|
||||
*
|
||||
*
|
||||
* @param string $soft_descriptor
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setSoftDescriptor($soft_descriptor)
|
||||
{
|
||||
$this->soft_descriptor = $soft_descriptor;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Soft descriptor used when charging this funding source.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSoftDescriptor()
|
||||
{
|
||||
return $this->soft_descriptor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Soft descriptor used when charging this funding source.
|
||||
*
|
||||
* @deprecated Instead use setSoftDescriptor
|
||||
*
|
||||
* @param string $soft_descriptor
|
||||
* @return $this
|
||||
*/
|
||||
public function setSoft_descriptor($soft_descriptor)
|
||||
{
|
||||
$this->soft_descriptor = $soft_descriptor;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Soft descriptor used when charging this funding source.
|
||||
* @deprecated Instead use getSoftDescriptor
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSoft_descriptor()
|
||||
{
|
||||
return $this->soft_descriptor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Payment options requested for this purchase unit
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\PaymentOptions $payment_options
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setPaymentOptions($payment_options)
|
||||
{
|
||||
$this->payment_options = $payment_options;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Payment options requested for this purchase unit
|
||||
*
|
||||
* @return \PayPal\Api\PaymentOptions
|
||||
*/
|
||||
public function getPaymentOptions()
|
||||
{
|
||||
return $this->payment_options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Payment options requested for this purchase unit
|
||||
*
|
||||
* @deprecated Instead use setPaymentOptions
|
||||
*
|
||||
* @param \PayPal\Api\PaymentOptions $payment_options
|
||||
* @return $this
|
||||
*/
|
||||
public function setPayment_options($payment_options)
|
||||
{
|
||||
$this->payment_options = $payment_options;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Payment options requested for this purchase unit
|
||||
* @deprecated Instead use getPaymentOptions
|
||||
*
|
||||
* @return \PayPal\Api\PaymentOptions
|
||||
*/
|
||||
public function getPayment_options()
|
||||
{
|
||||
return $this->payment_options;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of items being paid for.
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\ItemList $item_list
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setItemList($item_list)
|
||||
{
|
||||
$this->item_list = $item_list;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of items being paid for.
|
||||
*
|
||||
* @return \PayPal\Api\ItemList
|
||||
*/
|
||||
public function getItemList()
|
||||
{
|
||||
return $this->item_list;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of items being paid for.
|
||||
*
|
||||
* @deprecated Instead use setItemList
|
||||
*
|
||||
* @param \PayPal\Api\ItemList $item_list
|
||||
* @return $this
|
||||
*/
|
||||
public function setItem_list($item_list)
|
||||
{
|
||||
$this->item_list = $item_list;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of items being paid for.
|
||||
* @deprecated Instead use getItemList
|
||||
*
|
||||
* @return \PayPal\Api\ItemList
|
||||
*/
|
||||
public function getItem_list()
|
||||
{
|
||||
return $this->item_list;
|
||||
}
|
||||
|
||||
}
|
||||
93
lib/PayPal/Api/Credit.php
Normal file
93
lib/PayPal/Api/Credit.php
Normal file
@@ -0,0 +1,93 @@
|
||||
<?php
|
||||
|
||||
namespace PayPal\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Rest\ApiContext;
|
||||
|
||||
/**
|
||||
* Class Credit
|
||||
*
|
||||
* A resource representing a credit instrument.
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
* @property string id
|
||||
* @property string type
|
||||
* @property string terms
|
||||
*/
|
||||
class Credit extends PPModel
|
||||
{
|
||||
/**
|
||||
* Unique identifier of credit resource.
|
||||
*
|
||||
*
|
||||
* @param string $id
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setId($id)
|
||||
{
|
||||
$this->id = $id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unique identifier of credit resource.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* specifies type of credit
|
||||
* Valid Values: ["BILL_ME_LATER", "PAYPAL_EXTRAS_MASTERCARD", "EBAY_MASTERCARD", "PAYPAL_SMART_CONNECT"]
|
||||
*
|
||||
* @param string $type
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setType($type)
|
||||
{
|
||||
$this->type = $type;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* specifies type of credit
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
/**
|
||||
* URI to the associated terms
|
||||
*
|
||||
*
|
||||
* @param string $terms
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setTerms($terms)
|
||||
{
|
||||
$this->terms = $terms;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* URI to the associated terms
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTerms()
|
||||
{
|
||||
return $this->terms;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,41 +5,46 @@ namespace PayPal\Api;
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Rest\ApiContext;
|
||||
use PayPal\Rest\IResource;
|
||||
use PayPal\Api\CreditCardHistory;
|
||||
use PayPal\Transport\PPRestCall;
|
||||
use PayPal\Validation\ArgumentValidator;
|
||||
|
||||
/**
|
||||
* Class CreditCard
|
||||
*
|
||||
* A resource representing a credit card that can be used to fund a payment.
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
* @property string id
|
||||
* @property string number
|
||||
* @property string type
|
||||
* @property int expire_month
|
||||
* @property int expire_year
|
||||
* @property string cvv2
|
||||
* @property int cvv2
|
||||
* @property string first_name
|
||||
* @property string last_name
|
||||
* @property \PayPal\Api\Address billing_address
|
||||
* @property string payer_id
|
||||
* @property string external_customer_id
|
||||
* @property string state
|
||||
* @property string valid_until
|
||||
* @property string create_time
|
||||
* @property string update_time
|
||||
* @property \PayPal\Api\Links links
|
||||
*/
|
||||
class CreditCard extends PPModel implements IResource
|
||||
{
|
||||
/**
|
||||
* Private Variable
|
||||
* OAuth Credentials to use for this call
|
||||
*
|
||||
* @var $credential
|
||||
* @var \PayPal\Auth\OAuthTokenCredential $credential
|
||||
*/
|
||||
private static $credential;
|
||||
protected static $credential;
|
||||
|
||||
/**
|
||||
* Set Credential
|
||||
*
|
||||
* @param $credential
|
||||
* Sets Credential
|
||||
*
|
||||
* @deprecated Pass ApiContext to create/get methods instead
|
||||
* @param \PayPal\Auth\OAuthTokenCredential $credential
|
||||
*/
|
||||
public static function setCredential($credential)
|
||||
{
|
||||
@@ -47,8 +52,8 @@ class CreditCard extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set ID
|
||||
* ID of the credit card being saved for later use
|
||||
* ID of the credit card being saved for later use.
|
||||
*
|
||||
*
|
||||
* @param string $id
|
||||
*
|
||||
@@ -57,13 +62,11 @@ class CreditCard extends PPModel implements IResource
|
||||
public function setId($id)
|
||||
{
|
||||
$this->id = $id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get ID
|
||||
* ID of the credit card being saved for later use
|
||||
* ID of the credit card being saved for later use.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -73,8 +76,8 @@ class CreditCard extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Number
|
||||
* Credit Card
|
||||
* Card number.
|
||||
*
|
||||
*
|
||||
* @param string $number
|
||||
*
|
||||
@@ -83,13 +86,11 @@ class CreditCard extends PPModel implements IResource
|
||||
public function setNumber($number)
|
||||
{
|
||||
$this->number = $number;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Number
|
||||
* Credit Card
|
||||
* Card number.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -99,8 +100,8 @@ class CreditCard extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Type
|
||||
* (eg. Visa, Mastercard, etc)
|
||||
* Type of the Card (eg. Visa, Mastercard, etc.).
|
||||
*
|
||||
*
|
||||
* @param string $type
|
||||
*
|
||||
@@ -109,15 +110,13 @@ class CreditCard extends PPModel implements IResource
|
||||
public function setType($type)
|
||||
{
|
||||
$this->type = $type;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Type
|
||||
* (eg. Visa, Mastercard, etc)
|
||||
* Type of the Card (eg. Visa, Mastercard, etc.).
|
||||
*
|
||||
* @return mixed
|
||||
* @return string
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
@@ -125,8 +124,8 @@ class CreditCard extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Expire Month
|
||||
* (eg. 1 - 12)
|
||||
* 2 digit card expiry month.
|
||||
*
|
||||
*
|
||||
* @param int $expire_month
|
||||
*
|
||||
@@ -135,13 +134,11 @@ class CreditCard extends PPModel implements IResource
|
||||
public function setExpireMonth($expire_month)
|
||||
{
|
||||
$this->expire_month = $expire_month;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Expire Month
|
||||
* (eg. 1 - 12)
|
||||
* 2 digit card expiry month.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
@@ -151,27 +148,22 @@ class CreditCard extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Expire Month
|
||||
* (eg. 1 - 12)
|
||||
* 2 digit card expiry month.
|
||||
*
|
||||
* @deprecated Instead use setExpireMonth
|
||||
*
|
||||
* @param int $expire_month
|
||||
*
|
||||
* @deprecated Use setExpireMonth
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setExpire_month($expire_month)
|
||||
{
|
||||
$this->expire_month = $expire_month;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Expire Month
|
||||
* (eg. 1 - 12)
|
||||
*
|
||||
* @deprecated Use getExpireMonth
|
||||
* 2 digit card expiry month.
|
||||
* @deprecated Instead use getExpireMonth
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
@@ -181,8 +173,8 @@ class CreditCard extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Expire Year
|
||||
* Four Digit
|
||||
* 4 digit card expiry year
|
||||
*
|
||||
*
|
||||
* @param int $expire_year
|
||||
*
|
||||
@@ -191,13 +183,11 @@ class CreditCard extends PPModel implements IResource
|
||||
public function setExpireYear($expire_year)
|
||||
{
|
||||
$this->expire_year = $expire_year;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Expire Year
|
||||
* Four Digit
|
||||
* 4 digit card expiry year
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
@@ -207,27 +197,22 @@ class CreditCard extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Expire Year
|
||||
* Four Digit
|
||||
* 4 digit card expiry year
|
||||
*
|
||||
* @deprecated Instead use setExpireYear
|
||||
*
|
||||
* @param int $expire_year
|
||||
*
|
||||
* @deprecated Use setExpireYear
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setExpire_year($expire_year)
|
||||
{
|
||||
$this->expire_year = $expire_year;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Expire Year
|
||||
* Four Digit
|
||||
*
|
||||
* @deprecated Use getExpireYear
|
||||
* 4 digit card expiry year
|
||||
* @deprecated Instead use getExpireYear
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
@@ -237,27 +222,23 @@ class CreditCard extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set CVV2
|
||||
* 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 int $cvv2
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setCvv2($cvv2)
|
||||
{
|
||||
$this->cvv2 = $cvv2;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get CVV2
|
||||
* 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 int
|
||||
*/
|
||||
public function getCvv2()
|
||||
{
|
||||
@@ -265,8 +246,8 @@ class CreditCard extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set First Name
|
||||
* Card holder's first name
|
||||
* Card holder's first name.
|
||||
*
|
||||
*
|
||||
* @param string $first_name
|
||||
*
|
||||
@@ -275,13 +256,11 @@ class CreditCard extends PPModel implements IResource
|
||||
public function setFirstName($first_name)
|
||||
{
|
||||
$this->first_name = $first_name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get First Name
|
||||
* Card holder's first name
|
||||
* Card holder's first name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -291,27 +270,22 @@ class CreditCard extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set First Name
|
||||
* Card holder's first name
|
||||
* Card holder's first name.
|
||||
*
|
||||
* @deprecated Instead use setFirstName
|
||||
*
|
||||
* @param string $first_name
|
||||
*
|
||||
* @deprecated Use setFirstName
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setFirst_name($first_name)
|
||||
{
|
||||
$this->first_name = $first_name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get First Name
|
||||
* Card holder's first name
|
||||
*
|
||||
* @deprecated Use getFirstName
|
||||
* Card holder's first name.
|
||||
* @deprecated Instead use getFirstName
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -321,8 +295,8 @@ class CreditCard extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Last Name
|
||||
* Card holder's last name
|
||||
* Card holder's last name.
|
||||
*
|
||||
*
|
||||
* @param string $last_name
|
||||
*
|
||||
@@ -331,13 +305,11 @@ class CreditCard extends PPModel implements IResource
|
||||
public function setLastName($last_name)
|
||||
{
|
||||
$this->last_name = $last_name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Last Name
|
||||
* Card holder's last name
|
||||
* Card holder's last name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -347,27 +319,22 @@ class CreditCard extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Last Name
|
||||
* Card holder's last name
|
||||
* Card holder's last name.
|
||||
*
|
||||
* @deprecated Instead use setLastName
|
||||
*
|
||||
* @param string $last_name
|
||||
*
|
||||
* @deprecated Use setLastName
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setLast_name($last_name)
|
||||
{
|
||||
$this->last_name = $last_name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Last Name
|
||||
* Card holder's last name
|
||||
*
|
||||
* @deprecated Use getLastName
|
||||
* Card holder's last name.
|
||||
* @deprecated Instead use getLastName
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -377,7 +344,8 @@ class CreditCard extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Billing Address associated with this card
|
||||
* Billing Address associated with this card.
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\Address $billing_address
|
||||
*
|
||||
@@ -386,12 +354,11 @@ class CreditCard extends PPModel implements IResource
|
||||
public function setBillingAddress($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
|
||||
*/
|
||||
@@ -401,25 +368,22 @@ class CreditCard extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Billing Address associated with this card
|
||||
* Billing Address associated with this card.
|
||||
*
|
||||
* @deprecated Instead use setBillingAddress
|
||||
*
|
||||
* @param \PayPal\Api\Address $billing_address
|
||||
*
|
||||
* @deprecated Use setBillingAddress
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setBilling_address($billing_address)
|
||||
{
|
||||
$this->billing_address = $billing_address;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Billing Address associated with this card
|
||||
*
|
||||
* @deprecated Use getBillingAddress
|
||||
* Billing Address associated with this card.
|
||||
* @deprecated Instead use getBillingAddress
|
||||
*
|
||||
* @return \PayPal\Api\Address
|
||||
*/
|
||||
@@ -429,68 +393,57 @@ class CreditCard extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set 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
|
||||
* A unique identifier of the customer to whom this bank account belongs to. Generated and provided by the facilitator. This is required when creating or using a stored funding instrument in vault.
|
||||
*
|
||||
* @param string $payer_id
|
||||
*
|
||||
* @param string $external_customer_id
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setPayerId($payer_id)
|
||||
public function setExternalCustomerId($external_customer_id)
|
||||
{
|
||||
$this->payer_id = $payer_id;
|
||||
|
||||
$this->external_customer_id = $external_customer_id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get 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
|
||||
* A unique identifier of the customer to whom this bank account belongs to. Generated and provided by the facilitator. This is required when creating or using a stored funding instrument in vault.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPayerId()
|
||||
public function getExternalCustomerId()
|
||||
{
|
||||
return $this->payer_id;
|
||||
return $this->external_customer_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set 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
|
||||
* A unique identifier of the customer to whom this bank account belongs to. Generated and provided by the facilitator. This is required when creating or using a stored funding instrument in vault.
|
||||
*
|
||||
* @param string $payer_id
|
||||
*
|
||||
* @deprecated Use setPayerId
|
||||
* @deprecated Instead use setExternalCustomerId
|
||||
*
|
||||
* @param string $external_customer_id
|
||||
* @return $this
|
||||
*/
|
||||
public function setPayer_id($payer_id)
|
||||
public function setExternal_customer_id($external_customer_id)
|
||||
{
|
||||
$this->payer_id = $payer_id;
|
||||
|
||||
$this->external_customer_id = $external_customer_id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get 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
|
||||
*
|
||||
* @deprecated Use getPayerId
|
||||
* A unique identifier of the customer to whom this bank account belongs to. Generated and provided by the facilitator. This is required when creating or using a stored funding instrument in vault.
|
||||
* @deprecated Instead use getExternalCustomerId
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPayer_id()
|
||||
public function getExternal_customer_id()
|
||||
{
|
||||
return $this->payer_id;
|
||||
return $this->external_customer_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set State
|
||||
* State of the funding instrument
|
||||
* State of the funding instrument.
|
||||
* Valid Values: ["expired", "ok"]
|
||||
*
|
||||
* @param string $state
|
||||
*
|
||||
@@ -499,13 +452,11 @@ class CreditCard extends PPModel implements IResource
|
||||
public function setState($state)
|
||||
{
|
||||
$this->state = $state;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get State
|
||||
* State of the funding instrument
|
||||
* State of the funding instrument.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -515,8 +466,8 @@ class CreditCard extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Valid Until
|
||||
* 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
|
||||
*
|
||||
@@ -525,13 +476,11 @@ class CreditCard extends PPModel implements IResource
|
||||
public function setValidUntil($valid_until)
|
||||
{
|
||||
$this->valid_until = $valid_until;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Valid Until
|
||||
* Date/Time until this resource can be used fund a payment
|
||||
* Date/Time until this resource can be used fund a payment.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -541,27 +490,22 @@ class CreditCard extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Valid Until
|
||||
* Date/Time until this resource can be used fund a payment
|
||||
* Date/Time until this resource can be used fund a payment.
|
||||
*
|
||||
* @deprecated Instead use setValidUntil
|
||||
*
|
||||
* @param string $valid_until
|
||||
*
|
||||
* @deprecated Use setValidUntil
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setValid_until($valid_until)
|
||||
{
|
||||
$this->valid_until = $valid_until;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Valid Until
|
||||
* Date/Time until this resource can be used fund a payment
|
||||
*
|
||||
* @deprecated Use getValidUntil
|
||||
* Date/Time until this resource can be used fund a payment.
|
||||
* @deprecated Instead use getValidUntil
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -571,7 +515,106 @@ class CreditCard extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Links
|
||||
* Time the resource was created in UTC ISO8601 format.
|
||||
*
|
||||
*
|
||||
* @param string $create_time
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setCreateTime($create_time)
|
||||
{
|
||||
$this->create_time = $create_time;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Time the resource was created in UTC ISO8601 format.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCreateTime()
|
||||
{
|
||||
return $this->create_time;
|
||||
}
|
||||
|
||||
/**
|
||||
* Time the resource was created in UTC ISO8601 format.
|
||||
*
|
||||
* @deprecated Instead use setCreateTime
|
||||
*
|
||||
* @param string $create_time
|
||||
* @return $this
|
||||
*/
|
||||
public function setCreate_time($create_time)
|
||||
{
|
||||
$this->create_time = $create_time;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Time the resource was created in UTC ISO8601 format.
|
||||
* @deprecated Instead use getCreateTime
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCreate_time()
|
||||
{
|
||||
return $this->create_time;
|
||||
}
|
||||
|
||||
/**
|
||||
* Time the resource was last updated in UTC ISO8601 format.
|
||||
*
|
||||
*
|
||||
* @param string $update_time
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setUpdateTime($update_time)
|
||||
{
|
||||
$this->update_time = $update_time;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Time the resource was last updated in UTC ISO8601 format.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getUpdateTime()
|
||||
{
|
||||
return $this->update_time;
|
||||
}
|
||||
|
||||
/**
|
||||
* Time the resource was last updated in UTC ISO8601 format.
|
||||
*
|
||||
* @deprecated Instead use setUpdateTime
|
||||
*
|
||||
* @param string $update_time
|
||||
* @return $this
|
||||
*/
|
||||
public function setUpdate_time($update_time)
|
||||
{
|
||||
$this->update_time = $update_time;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Time the resource was last updated in UTC ISO8601 format.
|
||||
* @deprecated Instead use getUpdateTime
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getUpdate_time()
|
||||
{
|
||||
return $this->update_time;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets Links
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\Links $links
|
||||
*
|
||||
@@ -580,14 +623,13 @@ class CreditCard extends PPModel implements IResource
|
||||
public function setLinks($links)
|
||||
{
|
||||
$this->links = $links;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Links
|
||||
* Gets Links
|
||||
*
|
||||
* @return \PayPal\Api\Links
|
||||
* @return \PayPal\Api\Links[]
|
||||
*/
|
||||
public function getLinks()
|
||||
{
|
||||
@@ -595,80 +637,83 @@ class CreditCard extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Create
|
||||
* Creates a new Credit Card Resource (aka Tokenize).
|
||||
*
|
||||
* @param \PayPal\Rest\ApiContext|null $apiContext
|
||||
*
|
||||
* @return $this
|
||||
* @param \PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
||||
* @return CreditCard
|
||||
*/
|
||||
public function create($apiContext = null)
|
||||
{
|
||||
$payLoad = $this->toJSON();
|
||||
|
||||
$payLoad = $this->toJSON();
|
||||
if ($apiContext == null) {
|
||||
$apiContext = new ApiContext(self::$credential);
|
||||
}
|
||||
|
||||
$call = new PPRestCall($apiContext);
|
||||
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/vault/credit-card", "POST", $payLoad);
|
||||
$this->fromJson($json);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get
|
||||
*
|
||||
* @param int $creditCardId
|
||||
* @param \PayPal\Rest\ApiContext|null $apiContext
|
||||
* Obtain the Credit Card resource for the given identifier.
|
||||
*
|
||||
* @param string $creditCardId
|
||||
* @param \PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
||||
* @return CreditCard
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public static function get($creditCardId, $apiContext = null)
|
||||
{
|
||||
if (($creditCardId == null) || (strlen($creditCardId) <= 0)) {
|
||||
throw new \InvalidArgumentException("creditCardId cannot be null or empty");
|
||||
}
|
||||
ArgumentValidator::validate($creditCardId, 'creditCardId');
|
||||
|
||||
$payLoad = "";
|
||||
|
||||
if ($apiContext == null) {
|
||||
$apiContext = new ApiContext(self::$credential);
|
||||
}
|
||||
|
||||
$call = new PPRestCall($apiContext);
|
||||
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/vault/credit-card/$creditCardId", "GET", $payLoad);
|
||||
|
||||
$ret = new CreditCard();
|
||||
$ret->fromJson($json);
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete
|
||||
*
|
||||
* @param \PayPal\Rest\ApiContext|null $apiContext
|
||||
* Delete the Credit Card resource for the given identifier.
|
||||
*
|
||||
* @param \PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
||||
* @return bool
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function delete($apiContext = null)
|
||||
{
|
||||
if ($this->getId() == null) {
|
||||
throw new \InvalidArgumentException("Id cannot be null");
|
||||
}
|
||||
ArgumentValidator::validate($this->getId(), "Id");
|
||||
|
||||
$payLoad = "";
|
||||
|
||||
if ($apiContext == null) {
|
||||
$apiContext = new ApiContext(self::$credential);
|
||||
}
|
||||
|
||||
$call = new PPRestCall($apiContext);
|
||||
$call->execute(array('PayPal\Rest\RestHandler'), "/v1/vault/credit-card/{$this->getId()}", "DELETE", $payLoad);
|
||||
|
||||
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/vault/credit-card/{$this->getId()}", "DELETE", $payLoad);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update information in a previously saved card. Only the modified fields need to be passed in the request.
|
||||
*
|
||||
* @param \PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
||||
* @return CreditCard
|
||||
*/
|
||||
public function update($apiContext = null)
|
||||
{
|
||||
ArgumentValidator::validate($this->getId(), "Id");
|
||||
|
||||
$payLoad = $this->toJSON();
|
||||
if ($apiContext == null) {
|
||||
$apiContext = new ApiContext(self::$credential);
|
||||
}
|
||||
$call = new PPRestCall($apiContext);
|
||||
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/vault/credit-card/{$this->getId()}", "PATCH", $payLoad);
|
||||
$this->fromJson($json);
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,28 +8,31 @@ use PayPal\Rest\ApiContext;
|
||||
/**
|
||||
* Class CreditCardHistory
|
||||
*
|
||||
* A list of Credit Card Resources
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
* @property \PayPal\Api\CreditCard credit_cards
|
||||
* @property int count
|
||||
* @property string next_id
|
||||
*/
|
||||
class CreditCardHistory extends PPModel
|
||||
{
|
||||
/**
|
||||
* Set Credit Cards
|
||||
* A list of credit card resources
|
||||
*
|
||||
* @param \PayPal\Api\CreditCard $credit_cards
|
||||
*
|
||||
* @param \PayPal\Api\CreditCard $credit-cards
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setCreditCards($credit_cards)
|
||||
{
|
||||
$this->{"credit-cards"} = $credit_cards;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Credit Cards
|
||||
* A list of credit card resources
|
||||
*
|
||||
* @return \PayPal\Api\CreditCard
|
||||
@@ -40,27 +43,22 @@ class CreditCardHistory extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Credit Cards
|
||||
* A list of credit card resources
|
||||
*
|
||||
* @param \PayPal\Api\CreditCard $credit_cards
|
||||
*
|
||||
* @deprecated Use setCreditCards
|
||||
* @deprecated Instead use setCreditCards
|
||||
*
|
||||
* @param \PayPal\Api\CreditCard $credit-cards
|
||||
* @return $this
|
||||
*/
|
||||
public function setCredit_cards($credit_cards)
|
||||
{
|
||||
$this->{"credit-cards"} = $credit_cards;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Credit Cards
|
||||
* A list of credit card resources
|
||||
*
|
||||
* @deprecated Use getCreditCards
|
||||
* @deprecated Instead use getCreditCards
|
||||
*
|
||||
* @return \PayPal\Api\CreditCard
|
||||
*/
|
||||
@@ -70,9 +68,8 @@ class CreditCardHistory extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Count
|
||||
* 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 int $count
|
||||
*
|
||||
@@ -81,14 +78,11 @@ class CreditCardHistory extends PPModel
|
||||
public function setCount($count)
|
||||
{
|
||||
$this->count = $count;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Count
|
||||
* 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 int
|
||||
*/
|
||||
@@ -98,8 +92,8 @@ class CreditCardHistory extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Next ID
|
||||
* Identifier of the next element to get the next range of results
|
||||
* Identifier of the next element to get the next range of results.
|
||||
*
|
||||
*
|
||||
* @param string $next_id
|
||||
*
|
||||
@@ -108,13 +102,11 @@ class CreditCardHistory extends PPModel
|
||||
public function setNextId($next_id)
|
||||
{
|
||||
$this->next_id = $next_id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Next ID
|
||||
* Identifier of the next element to get the next range of results
|
||||
* Identifier of the next element to get the next range of results.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -124,27 +116,22 @@ class CreditCardHistory extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Next ID
|
||||
* Identifier of the next element to get the next range of results
|
||||
* Identifier of the next element to get the next range of results.
|
||||
*
|
||||
* @deprecated Instead use setNextId
|
||||
*
|
||||
* @param string $next_id
|
||||
*
|
||||
* @deprecated Use setNextId
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setNext_id($next_id)
|
||||
{
|
||||
$this->next_id = $next_id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Next ID
|
||||
* Identifier of the next element to get the next range of results
|
||||
*
|
||||
* @deprecated Use getNextId
|
||||
* Identifier of the next element to get the next range of results.
|
||||
* @deprecated Instead use getNextId
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -152,4 +139,5 @@ class CreditCardHistory extends PPModel
|
||||
{
|
||||
return $this->next_id;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
143
lib/PayPal/Api/CreditCardList.php
Normal file
143
lib/PayPal/Api/CreditCardList.php
Normal file
@@ -0,0 +1,143 @@
|
||||
<?php
|
||||
|
||||
namespace PayPal\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Rest\ApiContext;
|
||||
|
||||
/**
|
||||
* Class CreditCardList
|
||||
*
|
||||
* A list of Credit Card Resources
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
* @property \PayPal\Api\CreditCard credit_cards
|
||||
* @property int count
|
||||
* @property string next_id
|
||||
*/
|
||||
class CreditCardList extends PPModel
|
||||
{
|
||||
/**
|
||||
* A list of credit card resources
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\CreditCard $credit_cards
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setCreditCards($credit_cards)
|
||||
{
|
||||
$this->{"credit-cards"} = $credit_cards;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* A list of credit card resources
|
||||
*
|
||||
* @return \PayPal\Api\CreditCard[]
|
||||
*/
|
||||
public function getCreditCards()
|
||||
{
|
||||
return $this->{"credit-cards"};
|
||||
}
|
||||
|
||||
/**
|
||||
* A list of credit card resources
|
||||
*
|
||||
* @deprecated Instead use setCreditCards
|
||||
*
|
||||
* @param \PayPal\Api\CreditCard $credit-cards
|
||||
* @return $this
|
||||
*/
|
||||
public function setCredit_cards($credit_cards)
|
||||
{
|
||||
$this->{"credit-cards"} = $credit_cards;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* A list of credit card resources
|
||||
* @deprecated Instead use getCreditCards
|
||||
*
|
||||
* @return \PayPal\Api\CreditCard
|
||||
*/
|
||||
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.
|
||||
*
|
||||
*
|
||||
* @param int $count
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setCount($count)
|
||||
{
|
||||
$this->count = $count;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Number of items returned in each range of results. Note that the last results range could have fewer items than the requested number of items.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getCount()
|
||||
{
|
||||
return $this->count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Identifier of the next element to get the next range of results.
|
||||
*
|
||||
*
|
||||
* @param string $next_id
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setNextId($next_id)
|
||||
{
|
||||
$this->next_id = $next_id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Identifier of the next element to get the next range of results.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getNextId()
|
||||
{
|
||||
return $this->next_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Identifier of the next element to get the next range of results.
|
||||
*
|
||||
* @deprecated Instead use setNextId
|
||||
*
|
||||
* @param string $next_id
|
||||
* @return $this
|
||||
*/
|
||||
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.
|
||||
* @deprecated Instead use getNextId
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getNext_id()
|
||||
{
|
||||
return $this->next_id;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,6 +8,10 @@ use PayPal\Rest\ApiContext;
|
||||
/**
|
||||
* Class CreditCardToken
|
||||
*
|
||||
* A resource representing a credit card that can be used to fund a payment.
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
* @property string credit_card_id
|
||||
* @property string payer_id
|
||||
* @property string last4
|
||||
@@ -18,8 +22,8 @@ use PayPal\Rest\ApiContext;
|
||||
class CreditCardToken extends PPModel
|
||||
{
|
||||
/**
|
||||
* Set Credit Card ID
|
||||
* 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
|
||||
*
|
||||
@@ -28,13 +32,11 @@ class CreditCardToken extends PPModel
|
||||
public function setCreditCardId($credit_card_id)
|
||||
{
|
||||
$this->credit_card_id = $credit_card_id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Credit Card ID
|
||||
* 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
|
||||
*/
|
||||
@@ -44,27 +46,22 @@ class CreditCardToken extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Credit Card ID
|
||||
* 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.
|
||||
*
|
||||
* @deprecated Instead use setCreditCardId
|
||||
*
|
||||
* @param string $credit_card_id
|
||||
*
|
||||
* @deprecated Use setCreditCardId
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setCredit_card_id($credit_card_id)
|
||||
{
|
||||
$this->credit_card_id = $credit_card_id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Credit Card ID
|
||||
* ID of a previously saved Credit Card resource using /vault/credit-card API
|
||||
*
|
||||
* @deprecated Use getCreditCardId
|
||||
* ID of a previously saved Credit Card resource using /vault/credit-card API.
|
||||
* @deprecated Instead use getCreditCardId
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -74,8 +71,8 @@ class CreditCardToken extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Payer 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
|
||||
*
|
||||
@@ -84,13 +81,11 @@ class CreditCardToken extends PPModel
|
||||
public function setPayerId($payer_id)
|
||||
{
|
||||
$this->payer_id = $payer_id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Payer 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.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -100,27 +95,22 @@ class CreditCardToken extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Payer 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.
|
||||
*
|
||||
* @deprecated Instead use setPayerId
|
||||
*
|
||||
* @param string $payer_id
|
||||
*
|
||||
* @deprecated Use setPayerId
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setPayer_id($payer_id)
|
||||
{
|
||||
$this->payer_id = $payer_id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Payer ID
|
||||
* The unique identifier of the payer used when saving this credit card using /vault/credit-card API
|
||||
*
|
||||
* @deprecated Use getPayerId
|
||||
* The unique identifier of the payer used when saving this credit card using /vault/credit-card API.
|
||||
* @deprecated Instead use getPayerId
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -130,8 +120,8 @@ class CreditCardToken extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Last Four
|
||||
* 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
|
||||
*
|
||||
@@ -140,13 +130,11 @@ class CreditCardToken extends PPModel
|
||||
public function setLast4($last4)
|
||||
{
|
||||
$this->last4 = $last4;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Last Four
|
||||
* Last 4 digits of the card number from the saved card
|
||||
* Last 4 digits of the card number from the saved card.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -156,9 +144,8 @@ class CreditCardToken extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Type
|
||||
* (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
|
||||
*
|
||||
@@ -167,14 +154,11 @@ class CreditCardToken extends PPModel
|
||||
public function setType($type)
|
||||
{
|
||||
$this->type = $type;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Type
|
||||
* (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
|
||||
*/
|
||||
@@ -184,8 +168,8 @@ class CreditCardToken extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Expire Month
|
||||
* Card Expiration month from the saved card with value 1 - 12
|
||||
* card expiry month from the saved card with value 1 - 12
|
||||
*
|
||||
*
|
||||
* @param int $expire_month
|
||||
*
|
||||
@@ -194,13 +178,11 @@ class CreditCardToken extends PPModel
|
||||
public function setExpireMonth($expire_month)
|
||||
{
|
||||
$this->expire_month = $expire_month;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Expire Month
|
||||
* Card Expiration month from the saved card with value 1 - 12
|
||||
* card expiry month from the saved card with value 1 - 12
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
@@ -210,27 +192,22 @@ class CreditCardToken extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Expire Month
|
||||
* Card Expiration month from the saved card with value 1 - 12
|
||||
* card expiry month from the saved card with value 1 - 12
|
||||
*
|
||||
* @deprecated Instead use setExpireMonth
|
||||
*
|
||||
* @param int $expire_month
|
||||
*
|
||||
* @deprecated Use setExpireMonth
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setExpire_month($expire_month)
|
||||
{
|
||||
$this->expire_month = $expire_month;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Expire Month
|
||||
* Card Expiration month from the saved card with value 1 - 12
|
||||
*
|
||||
* @deprecated Use getExpireMonth
|
||||
* card expiry month from the saved card with value 1 - 12
|
||||
* @deprecated Instead use getExpireMonth
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
@@ -240,9 +217,9 @@ class CreditCardToken extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Expire Year
|
||||
* 4 digit card expiry year from the saved card
|
||||
*
|
||||
*
|
||||
* @param int $expire_year
|
||||
*
|
||||
* @return $this
|
||||
@@ -250,12 +227,10 @@ class CreditCardToken extends PPModel
|
||||
public function setExpireYear($expire_year)
|
||||
{
|
||||
$this->expire_year = $expire_year;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Expire Year
|
||||
* 4 digit card expiry year from the saved card
|
||||
*
|
||||
* @return int
|
||||
@@ -266,27 +241,22 @@ class CreditCardToken extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Expire Year
|
||||
* 4 digit card expiry year from the saved card
|
||||
*
|
||||
* @deprecated Instead use setExpireYear
|
||||
*
|
||||
* @param int $expire_year
|
||||
*
|
||||
* @deprecated Use setExpireYear
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setExpire_year($expire_year)
|
||||
{
|
||||
$this->expire_year = $expire_year;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Expire Year
|
||||
* 4 digit card expiry year from the saved card
|
||||
*
|
||||
* @deprecated Use getExpireYear
|
||||
* @deprecated Instead use getExpireYear
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
@@ -294,4 +264,5 @@ class CreditCardToken extends PPModel
|
||||
{
|
||||
return $this->expire_year;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,16 +8,24 @@ use PayPal\Rest\ApiContext;
|
||||
/**
|
||||
* Class Details
|
||||
*
|
||||
* Additional details of the payment amount.
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
* @property string shipping
|
||||
* @property string subtotal
|
||||
* @property string tax
|
||||
* @property string fee
|
||||
* @property string shipping_discount
|
||||
* @property string insurance
|
||||
* @property string handling_fee
|
||||
* @property string gift_wrap
|
||||
*/
|
||||
class Details extends PPModel
|
||||
{
|
||||
/**
|
||||
* Set Shipping
|
||||
* Amount being charged for shipping
|
||||
* Amount being charged for shipping.
|
||||
*
|
||||
*
|
||||
* @param string $shipping
|
||||
*
|
||||
@@ -30,8 +38,7 @@ class Details extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Shipping
|
||||
* Amount being charged for shipping
|
||||
* Amount being charged for shipping.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -41,8 +48,8 @@ class Details extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Subtotal
|
||||
* Sub-total (amount) of items being paid for
|
||||
* Sub-total (amount) of items being paid for.
|
||||
*
|
||||
*
|
||||
* @param string $subtotal
|
||||
*
|
||||
@@ -55,8 +62,7 @@ class Details extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Subtotal
|
||||
* Sub-total (amount) of items being paid for
|
||||
* Sub-total (amount) of items being paid for.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -66,8 +72,8 @@ class Details extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Tax
|
||||
* Amount being charged as tax
|
||||
* Amount being charged as tax.
|
||||
*
|
||||
*
|
||||
* @param string $tax
|
||||
*
|
||||
@@ -80,8 +86,7 @@ class Details extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Tax
|
||||
* Amount being charged as tax
|
||||
* Amount being charged as tax.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -91,9 +96,8 @@ class Details extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Fee
|
||||
* 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
|
||||
*
|
||||
@@ -106,9 +110,7 @@ class Details extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Fee
|
||||
* 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
|
||||
*/
|
||||
@@ -116,4 +118,176 @@ class Details extends PPModel
|
||||
{
|
||||
return $this->fee;
|
||||
}
|
||||
|
||||
/**
|
||||
* Amount being charged as shipping discount.
|
||||
*
|
||||
*
|
||||
* @param string $shipping_discount
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setShippingDiscount($shipping_discount)
|
||||
{
|
||||
$this->shipping_discount = $shipping_discount;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Amount being charged as shipping discount.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getShippingDiscount()
|
||||
{
|
||||
return $this->shipping_discount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Amount being charged as shipping discount.
|
||||
*
|
||||
* @deprecated Instead use setShippingDiscount
|
||||
*
|
||||
* @param string $shipping_discount
|
||||
* @return $this
|
||||
*/
|
||||
public function setShipping_discount($shipping_discount)
|
||||
{
|
||||
$this->shipping_discount = $shipping_discount;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Amount being charged as shipping discount.
|
||||
* @deprecated Instead use getShippingDiscount
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getShipping_discount()
|
||||
{
|
||||
return $this->shipping_discount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Amount being charged as insurance.
|
||||
*
|
||||
*
|
||||
* @param string $insurance
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setInsurance($insurance)
|
||||
{
|
||||
$this->insurance = $insurance;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Amount being charged as insurance.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getInsurance()
|
||||
{
|
||||
return $this->insurance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Amount being charged as handling fee.
|
||||
*
|
||||
*
|
||||
* @param string $handling_fee
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setHandlingFee($handling_fee)
|
||||
{
|
||||
$this->handling_fee = $handling_fee;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Amount being charged as handling fee.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getHandlingFee()
|
||||
{
|
||||
return $this->handling_fee;
|
||||
}
|
||||
|
||||
/**
|
||||
* Amount being charged as handling fee.
|
||||
*
|
||||
* @deprecated Instead use setHandlingFee
|
||||
*
|
||||
* @param string $handling_fee
|
||||
* @return $this
|
||||
*/
|
||||
public function setHandling_fee($handling_fee)
|
||||
{
|
||||
$this->handling_fee = $handling_fee;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Amount being charged as handling fee.
|
||||
* @deprecated Instead use getHandlingFee
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getHandling_fee()
|
||||
{
|
||||
return $this->handling_fee;
|
||||
}
|
||||
|
||||
/**
|
||||
* Amount being charged as gift wrap fee.
|
||||
*
|
||||
*
|
||||
* @param string $gift_wrap
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setGiftWrap($gift_wrap)
|
||||
{
|
||||
$this->gift_wrap = $gift_wrap;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Amount being charged as gift wrap fee.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getGiftWrap()
|
||||
{
|
||||
return $this->gift_wrap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Amount being charged as gift wrap fee.
|
||||
*
|
||||
* @deprecated Instead use setGiftWrap
|
||||
*
|
||||
* @param string $gift_wrap
|
||||
* @return $this
|
||||
*/
|
||||
public function setGift_wrap($gift_wrap)
|
||||
{
|
||||
$this->gift_wrap = $gift_wrap;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Amount being charged as gift wrap fee.
|
||||
* @deprecated Instead use getGiftWrap
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getGift_wrap()
|
||||
{
|
||||
return $this->gift_wrap;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
68
lib/PayPal/Api/ExtendedBankAccount.php
Normal file
68
lib/PayPal/Api/ExtendedBankAccount.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace PayPal\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Rest\ApiContext;
|
||||
|
||||
/**
|
||||
* Class ExtendedBankAccount
|
||||
*
|
||||
* A resource representing a bank account that can be used to fund a payment including support for SEPA.
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
* @property string mandate_reference_number
|
||||
*/
|
||||
class ExtendedBankAccount extends BankAccount
|
||||
{
|
||||
/**
|
||||
* Identifier of the direct debit mandate to validate. Currently supported only for EU bank accounts(SEPA).
|
||||
*
|
||||
*
|
||||
* @param string $mandate_reference_number
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setMandateReferenceNumber($mandate_reference_number)
|
||||
{
|
||||
$this->mandate_reference_number = $mandate_reference_number;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Identifier of the direct debit mandate to validate. Currently supported only for EU bank accounts(SEPA).
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getMandateReferenceNumber()
|
||||
{
|
||||
return $this->mandate_reference_number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Identifier of the direct debit mandate to validate. Currently supported only for EU bank accounts(SEPA).
|
||||
*
|
||||
* @deprecated Instead use setMandateReferenceNumber
|
||||
*
|
||||
* @param string $mandate_reference_number
|
||||
* @return $this
|
||||
*/
|
||||
public function setMandate_reference_number($mandate_reference_number)
|
||||
{
|
||||
$this->mandate_reference_number = $mandate_reference_number;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Identifier of the direct debit mandate to validate. Currently supported only for EU bank accounts(SEPA).
|
||||
* @deprecated Instead use getMandateReferenceNumber
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getMandate_reference_number()
|
||||
{
|
||||
return $this->mandate_reference_number;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,13 +8,23 @@ use PayPal\Rest\ApiContext;
|
||||
/**
|
||||
* Class FundingInstrument
|
||||
*
|
||||
* A resource representing a Payer's funding instrument.
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
* @property \PayPal\Api\CreditCard credit_card
|
||||
* @property \PayPal\Api\CreditCardToken credit_card_token
|
||||
* @property \PayPal\Api\PaymentCard payment_card
|
||||
* @property \PayPal\Api\PaymentCardToken payment_card_token
|
||||
* @property \PayPal\Api\ExtendedBankAccount bank_account
|
||||
* @property \PayPal\Api\BankToken bank_account_token
|
||||
* @property \PayPal\Api\Credit credit
|
||||
*/
|
||||
class FundingInstrument extends PPModel
|
||||
{
|
||||
/**
|
||||
* Set Credit Card
|
||||
* Credit Card information.
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\CreditCard $credit_card
|
||||
*
|
||||
@@ -23,12 +33,11 @@ class FundingInstrument extends PPModel
|
||||
public function setCreditCard($credit_card)
|
||||
{
|
||||
$this->credit_card = $credit_card;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Credit Card
|
||||
* Credit Card information.
|
||||
*
|
||||
* @return \PayPal\Api\CreditCard
|
||||
*/
|
||||
@@ -38,25 +47,22 @@ class FundingInstrument extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Credit Card
|
||||
* Credit Card information.
|
||||
*
|
||||
* @deprecated Instead use setCreditCard
|
||||
*
|
||||
* @param \PayPal\Api\CreditCard $credit_card
|
||||
*
|
||||
* @deprecated Use setCreditCard
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setCredit_card($credit_card)
|
||||
{
|
||||
$this->credit_card = $credit_card;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Credit Card
|
||||
*
|
||||
* @deprecated Use getCreditCard
|
||||
* Credit Card information.
|
||||
* @deprecated Instead use getCreditCard
|
||||
*
|
||||
* @return \PayPal\Api\CreditCard
|
||||
*/
|
||||
@@ -66,7 +72,8 @@ class FundingInstrument extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Credit Card Token
|
||||
* Credit Card information.
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\CreditCardToken $credit_card_token
|
||||
*
|
||||
@@ -75,12 +82,11 @@ class FundingInstrument extends PPModel
|
||||
public function setCreditCardToken($credit_card_token)
|
||||
{
|
||||
$this->credit_card_token = $credit_card_token;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Credit Card Token
|
||||
* Credit Card information.
|
||||
*
|
||||
* @return \PayPal\Api\CreditCardToken
|
||||
*/
|
||||
@@ -90,25 +96,22 @@ class FundingInstrument extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Credit Card Token
|
||||
* Credit Card information.
|
||||
*
|
||||
* @deprecated Instead use setCreditCardToken
|
||||
*
|
||||
* @param \PayPal\Api\CreditCardToken $credit_card_token
|
||||
*
|
||||
* @deprecated Use setCreditCardToken
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setCredit_card_token($credit_card_token)
|
||||
{
|
||||
$this->credit_card_token = $credit_card_token;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Credit Card Token
|
||||
*
|
||||
* @deprecated Use getCreditCardToken
|
||||
* Credit Card information.
|
||||
* @deprecated Instead use getCreditCardToken
|
||||
*
|
||||
* @return \PayPal\Api\CreditCardToken
|
||||
*/
|
||||
@@ -116,4 +119,225 @@ class FundingInstrument extends PPModel
|
||||
{
|
||||
return $this->credit_card_token;
|
||||
}
|
||||
|
||||
/**
|
||||
* Payment Card information.
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\PaymentCard $payment_card
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setPaymentCard($payment_card)
|
||||
{
|
||||
$this->payment_card = $payment_card;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Payment Card information.
|
||||
*
|
||||
* @return \PayPal\Api\PaymentCard
|
||||
*/
|
||||
public function getPaymentCard()
|
||||
{
|
||||
return $this->payment_card;
|
||||
}
|
||||
|
||||
/**
|
||||
* Payment Card information.
|
||||
*
|
||||
* @deprecated Instead use setPaymentCard
|
||||
*
|
||||
* @param \PayPal\Api\PaymentCard $payment_card
|
||||
* @return $this
|
||||
*/
|
||||
public function setPayment_card($payment_card)
|
||||
{
|
||||
$this->payment_card = $payment_card;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Payment Card information.
|
||||
* @deprecated Instead use getPaymentCard
|
||||
*
|
||||
* @return \PayPal\Api\PaymentCard
|
||||
*/
|
||||
public function getPayment_card()
|
||||
{
|
||||
return $this->payment_card;
|
||||
}
|
||||
|
||||
/**
|
||||
* Payment card token information.
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\PaymentCardToken $payment_card_token
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setPaymentCardToken($payment_card_token)
|
||||
{
|
||||
$this->payment_card_token = $payment_card_token;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Payment card token information.
|
||||
*
|
||||
* @return \PayPal\Api\PaymentCardToken
|
||||
*/
|
||||
public function getPaymentCardToken()
|
||||
{
|
||||
return $this->payment_card_token;
|
||||
}
|
||||
|
||||
/**
|
||||
* Payment card token information.
|
||||
*
|
||||
* @deprecated Instead use setPaymentCardToken
|
||||
*
|
||||
* @param \PayPal\Api\PaymentCardToken $payment_card_token
|
||||
* @return $this
|
||||
*/
|
||||
public function setPayment_card_token($payment_card_token)
|
||||
{
|
||||
$this->payment_card_token = $payment_card_token;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Payment card token information.
|
||||
* @deprecated Instead use getPaymentCardToken
|
||||
*
|
||||
* @return \PayPal\Api\PaymentCardToken
|
||||
*/
|
||||
public function getPayment_card_token()
|
||||
{
|
||||
return $this->payment_card_token;
|
||||
}
|
||||
|
||||
/**
|
||||
* Bank Account information.
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\ExtendedBankAccount $bank_account
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setBankAccount($bank_account)
|
||||
{
|
||||
$this->bank_account = $bank_account;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Bank Account information.
|
||||
*
|
||||
* @return \PayPal\Api\ExtendedBankAccount
|
||||
*/
|
||||
public function getBankAccount()
|
||||
{
|
||||
return $this->bank_account;
|
||||
}
|
||||
|
||||
/**
|
||||
* Bank Account information.
|
||||
*
|
||||
* @deprecated Instead use setBankAccount
|
||||
*
|
||||
* @param \PayPal\Api\ExtendedBankAccount $bank_account
|
||||
* @return $this
|
||||
*/
|
||||
public function setBank_account($bank_account)
|
||||
{
|
||||
$this->bank_account = $bank_account;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Bank Account information.
|
||||
* @deprecated Instead use getBankAccount
|
||||
*
|
||||
* @return \PayPal\Api\ExtendedBankAccount
|
||||
*/
|
||||
public function getBank_account()
|
||||
{
|
||||
return $this->bank_account;
|
||||
}
|
||||
|
||||
/**
|
||||
* Bank Account information.
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\BankToken $bank_account_token
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setBankAccountToken($bank_account_token)
|
||||
{
|
||||
$this->bank_account_token = $bank_account_token;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Bank Account information.
|
||||
*
|
||||
* @return \PayPal\Api\BankToken
|
||||
*/
|
||||
public function getBankAccountToken()
|
||||
{
|
||||
return $this->bank_account_token;
|
||||
}
|
||||
|
||||
/**
|
||||
* Bank Account information.
|
||||
*
|
||||
* @deprecated Instead use setBankAccountToken
|
||||
*
|
||||
* @param \PayPal\Api\BankToken $bank_account_token
|
||||
* @return $this
|
||||
*/
|
||||
public function setBank_account_token($bank_account_token)
|
||||
{
|
||||
$this->bank_account_token = $bank_account_token;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Bank Account information.
|
||||
* @deprecated Instead use getBankAccountToken
|
||||
*
|
||||
* @return \PayPal\Api\BankToken
|
||||
*/
|
||||
public function getBank_account_token()
|
||||
{
|
||||
return $this->bank_account_token;
|
||||
}
|
||||
|
||||
/**
|
||||
* Credit funding information.
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\Credit $credit
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setCredit($credit)
|
||||
{
|
||||
$this->credit = $credit;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Credit funding information.
|
||||
*
|
||||
* @return \PayPal\Api\Credit
|
||||
*/
|
||||
public function getCredit()
|
||||
{
|
||||
return $this->credit;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,6 +8,10 @@ use PayPal\Rest\ApiContext;
|
||||
/**
|
||||
* Class HyperSchema
|
||||
*
|
||||
*
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
* @property \PayPal\Api\Links links
|
||||
* @property string fragmentResolution
|
||||
* @property bool readonly
|
||||
@@ -18,7 +22,8 @@ use PayPal\Rest\ApiContext;
|
||||
class HyperSchema extends PPModel
|
||||
{
|
||||
/**
|
||||
* Set Links
|
||||
* Sets Links
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\Links $links
|
||||
*
|
||||
@@ -27,14 +32,13 @@ class HyperSchema extends PPModel
|
||||
public function setLinks($links)
|
||||
{
|
||||
$this->links = $links;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Links
|
||||
* Gets Links
|
||||
*
|
||||
* @return \PayPal\Api\Links
|
||||
* @return \PayPal\Api\Links[]
|
||||
*/
|
||||
public function getLinks()
|
||||
{
|
||||
@@ -42,7 +46,8 @@ class HyperSchema extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Fragment Resolution
|
||||
* Sets FragmentResolution
|
||||
*
|
||||
*
|
||||
* @param string $fragmentResolution
|
||||
*
|
||||
@@ -51,12 +56,11 @@ class HyperSchema extends PPModel
|
||||
public function setFragmentResolution($fragmentResolution)
|
||||
{
|
||||
$this->fragmentResolution = $fragmentResolution;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Fragment Resolution
|
||||
* Gets FragmentResolution
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -66,7 +70,8 @@ class HyperSchema extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Read Only
|
||||
* Sets Readonly
|
||||
*
|
||||
*
|
||||
* @param bool $readonly
|
||||
*
|
||||
@@ -75,12 +80,11 @@ class HyperSchema extends PPModel
|
||||
public function setReadonly($readonly)
|
||||
{
|
||||
$this->readonly = $readonly;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Read Only
|
||||
* Gets Readonly
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
@@ -90,7 +94,8 @@ class HyperSchema extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Content Encoding
|
||||
* Sets ContentEncoding
|
||||
*
|
||||
*
|
||||
* @param string $contentEncoding
|
||||
*
|
||||
@@ -99,12 +104,11 @@ class HyperSchema extends PPModel
|
||||
public function setContentEncoding($contentEncoding)
|
||||
{
|
||||
$this->contentEncoding = $contentEncoding;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Content Encoding
|
||||
* Gets ContentEncoding
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -114,7 +118,8 @@ class HyperSchema extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Path Start
|
||||
* Sets PathStart
|
||||
*
|
||||
*
|
||||
* @param string $pathStart
|
||||
*
|
||||
@@ -123,12 +128,11 @@ class HyperSchema extends PPModel
|
||||
public function setPathStart($pathStart)
|
||||
{
|
||||
$this->pathStart = $pathStart;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Path Start
|
||||
* Gets PathStart
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -138,7 +142,8 @@ class HyperSchema extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Media Type
|
||||
* Sets MediaType
|
||||
*
|
||||
*
|
||||
* @param string $mediaType
|
||||
*
|
||||
@@ -147,12 +152,11 @@ class HyperSchema extends PPModel
|
||||
public function setMediaType($mediaType)
|
||||
{
|
||||
$this->mediaType = $mediaType;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Media Type
|
||||
* Gets MediaType
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -160,4 +164,5 @@ class HyperSchema extends PPModel
|
||||
{
|
||||
return $this->mediaType;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,7 +6,13 @@ use PayPal\Rest\ApiContext;
|
||||
use PayPal\Rest\IResource;
|
||||
use PayPal\Api\Invoices;
|
||||
use PayPal\Transport\PPRestCall;
|
||||
use PayPal\Validation\ArgumentValidator;
|
||||
|
||||
/**
|
||||
* Class Invoice
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*/
|
||||
class Invoice extends PPModel implements IResource
|
||||
{
|
||||
|
||||
@@ -866,9 +872,7 @@ class Invoice extends PPModel implements IResource
|
||||
*/
|
||||
public function search($search, $apiContext = null)
|
||||
{
|
||||
if (($search == null)) {
|
||||
throw new \InvalidArgumentException("search cannot be null or empty");
|
||||
}
|
||||
ArgumentValidator::validate($search, 'search');
|
||||
$payLoad = $search->toJSON();
|
||||
if ($apiContext == null) {
|
||||
$apiContext = new ApiContext(self::$credential);
|
||||
|
||||
@@ -4,23 +4,32 @@ namespace PayPal\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Rest\ApiContext;
|
||||
use PayPal\Validation\UrlValidator;
|
||||
|
||||
/**
|
||||
* Class Item
|
||||
*
|
||||
* An item being paid for.
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
* @property string quantity
|
||||
* @property string name
|
||||
* @property string description
|
||||
* @property string price
|
||||
* @property string tax
|
||||
* @property string currency
|
||||
* @property string sku
|
||||
* @property string description
|
||||
* @property string tax
|
||||
* @property string url
|
||||
* @property string category
|
||||
* @property \PayPal\Api\NameValuePair supplementary_data
|
||||
* @property \PayPal\Api\NameValuePair postback_data
|
||||
*/
|
||||
class Item extends PPModel
|
||||
{
|
||||
/**
|
||||
* Set Quantity
|
||||
* Number of items
|
||||
* Number of items.
|
||||
*
|
||||
*
|
||||
* @param string $quantity
|
||||
*
|
||||
@@ -29,13 +38,11 @@ class Item extends PPModel
|
||||
public function setQuantity($quantity)
|
||||
{
|
||||
$this->quantity = $quantity;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Quantity
|
||||
* Number of items
|
||||
* Number of items.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -45,8 +52,8 @@ class Item extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Name
|
||||
* Name of the item
|
||||
* Name of the item.
|
||||
*
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
@@ -55,13 +62,11 @@ class Item extends PPModel
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Name
|
||||
* Name of the item
|
||||
* Name of the item.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -71,86 +76,8 @@ class Item extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Price
|
||||
* Cost of the item
|
||||
* Description of the item.
|
||||
*
|
||||
* @param string $price
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setPrice($price)
|
||||
{
|
||||
$this->price = $price;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Price
|
||||
* Cost of the item
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPrice()
|
||||
{
|
||||
return $this->price;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Currency
|
||||
* Three Letter Currency Code
|
||||
*
|
||||
* @param string $currency
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setCurrency($currency)
|
||||
{
|
||||
$this->currency = $currency;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Currency
|
||||
* Three Letter Currency Code
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCurrency()
|
||||
{
|
||||
return $this->currency;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set SKU
|
||||
* Number or code to identify the item in your catalog/records
|
||||
*
|
||||
* @param string $sku
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setSku($sku)
|
||||
{
|
||||
$this->sku = $sku;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get SKU
|
||||
* Number or code to identify the item in your catalog/records
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSku()
|
||||
{
|
||||
return $this->sku;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Description
|
||||
* Description of the item
|
||||
*
|
||||
* @param string $description
|
||||
*
|
||||
@@ -159,13 +86,11 @@ class Item extends PPModel
|
||||
public function setDescription($description)
|
||||
{
|
||||
$this->description = $description;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Description
|
||||
* Description of the item
|
||||
* Description of the item.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -175,8 +100,32 @@ class Item extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Tax
|
||||
* Tax of the item
|
||||
* Cost of the item.
|
||||
*
|
||||
*
|
||||
* @param string $price
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setPrice($price)
|
||||
{
|
||||
$this->price = $price;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cost of the item.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPrice()
|
||||
{
|
||||
return $this->price;
|
||||
}
|
||||
|
||||
/**
|
||||
* tax of the item.
|
||||
*
|
||||
*
|
||||
* @param string $tax
|
||||
*
|
||||
@@ -185,13 +134,11 @@ class Item extends PPModel
|
||||
public function setTax($tax)
|
||||
{
|
||||
$this->tax = $tax;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Tax
|
||||
* Tax of the item
|
||||
* tax of the item.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -199,4 +146,200 @@ class Item extends PPModel
|
||||
{
|
||||
return $this->tax;
|
||||
}
|
||||
|
||||
/**
|
||||
* 3-letter Currency Code
|
||||
*
|
||||
*
|
||||
* @param string $currency
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setCurrency($currency)
|
||||
{
|
||||
$this->currency = $currency;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 3-letter Currency Code
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCurrency()
|
||||
{
|
||||
return $this->currency;
|
||||
}
|
||||
|
||||
/**
|
||||
* Number or code to identify the item in your catalog/records.
|
||||
*
|
||||
*
|
||||
* @param string $sku
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setSku($sku)
|
||||
{
|
||||
$this->sku = $sku;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Number or code to identify the item in your catalog/records.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSku()
|
||||
{
|
||||
return $this->sku;
|
||||
}
|
||||
|
||||
/**
|
||||
* URL linking to item information. Available to payer in transaction history.
|
||||
*
|
||||
*
|
||||
* @param string $url
|
||||
* @throws InvalidArgumentException
|
||||
* @return $this
|
||||
*/
|
||||
public function setUrl($url)
|
||||
{
|
||||
UrlValidator::validate($url, "Url");
|
||||
$this->url = $url;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* URL linking to item information. Available to payer in transaction history.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getUrl()
|
||||
{
|
||||
return $this->url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Category type of the item. This can be either Digital or Physical.
|
||||
*
|
||||
*
|
||||
* @param string $category
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setCategory($category)
|
||||
{
|
||||
$this->category = $category;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Category type of the item. This can be either Digital or Physical.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCategory()
|
||||
{
|
||||
return $this->category;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set of optional data used for PayPal risk determination.
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\NameValuePair $supplementary_data
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setSupplementaryData($supplementary_data)
|
||||
{
|
||||
$this->supplementary_data = $supplementary_data;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set of optional data used for PayPal risk determination.
|
||||
*
|
||||
* @return \PayPal\Api\NameValuePair[]
|
||||
*/
|
||||
public function getSupplementaryData()
|
||||
{
|
||||
return $this->supplementary_data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set of optional data used for PayPal risk determination.
|
||||
*
|
||||
* @deprecated Instead use setSupplementaryData
|
||||
*
|
||||
* @param \PayPal\Api\NameValuePair $supplementary_data
|
||||
* @return $this
|
||||
*/
|
||||
public function setSupplementary_data($supplementary_data)
|
||||
{
|
||||
$this->supplementary_data = $supplementary_data;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set of optional data used for PayPal risk determination.
|
||||
* @deprecated Instead use getSupplementaryData
|
||||
*
|
||||
* @return \PayPal\Api\NameValuePair
|
||||
*/
|
||||
public function getSupplementary_data()
|
||||
{
|
||||
return $this->supplementary_data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set of optional data used for PayPal post-transaction notifications.
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\NameValuePair $postback_data
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setPostbackData($postback_data)
|
||||
{
|
||||
$this->postback_data = $postback_data;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set of optional data used for PayPal post-transaction notifications.
|
||||
*
|
||||
* @return \PayPal\Api\NameValuePair[]
|
||||
*/
|
||||
public function getPostbackData()
|
||||
{
|
||||
return $this->postback_data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set of optional data used for PayPal post-transaction notifications.
|
||||
*
|
||||
* @deprecated Instead use setPostbackData
|
||||
*
|
||||
* @param \PayPal\Api\NameValuePair $postback_data
|
||||
* @return $this
|
||||
*/
|
||||
public function setPostback_data($postback_data)
|
||||
{
|
||||
$this->postback_data = $postback_data;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set of optional data used for PayPal post-transaction notifications.
|
||||
* @deprecated Instead use getPostbackData
|
||||
*
|
||||
* @return \PayPal\Api\NameValuePair
|
||||
*/
|
||||
public function getPostback_data()
|
||||
{
|
||||
return $this->postback_data;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,48 +8,33 @@ use PayPal\Rest\ApiContext;
|
||||
/**
|
||||
* Class ItemList
|
||||
*
|
||||
* @property array|\PayPal\Api\Item items
|
||||
* List of items being paid for.
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
* @property \PayPal\Api\Item items
|
||||
* @property \PayPal\Api\ShippingAddress shipping_address
|
||||
*/
|
||||
class ItemList extends PPModel
|
||||
{
|
||||
|
||||
/**
|
||||
* Construct an empty list.
|
||||
*/
|
||||
function __construct()
|
||||
{
|
||||
$this->items = array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this list empty?
|
||||
*/
|
||||
public function isEmpty()
|
||||
{
|
||||
return empty($this->items);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Items
|
||||
* List of Items
|
||||
* List of items.
|
||||
*
|
||||
* @param array|\PayPal\Api\Item $items
|
||||
*
|
||||
* @param \PayPal\Api\Item $items
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setItems($items)
|
||||
{
|
||||
$this->items = $items;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Items
|
||||
* List of items
|
||||
* List of items.
|
||||
*
|
||||
* @return \PayPal\Api\Item
|
||||
* @return \PayPal\Api\Item[]
|
||||
*/
|
||||
public function getItems()
|
||||
{
|
||||
@@ -57,7 +42,8 @@ class ItemList extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Shipping Address
|
||||
* Shipping address.
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\ShippingAddress $shipping_address
|
||||
*
|
||||
@@ -70,32 +56,7 @@ class ItemList extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Append an item to the list.
|
||||
*
|
||||
* @return PayPal\Api\Item
|
||||
*/
|
||||
public function addItem($item)
|
||||
{
|
||||
return $this->setItems(
|
||||
array_merge($this->items, array($item))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove an item from the list.
|
||||
* Items are compared using === comparision (PHP.net)
|
||||
*
|
||||
* @return PayPal\Api\Item
|
||||
*/
|
||||
public function removeItem($item)
|
||||
{
|
||||
return $this->setItems(
|
||||
array_diff($this->items, array($item))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Shipping Address
|
||||
* Shipping address.
|
||||
*
|
||||
* @return \PayPal\Api\ShippingAddress
|
||||
*/
|
||||
@@ -105,25 +66,22 @@ class ItemList extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Shipping Address
|
||||
* Shipping address.
|
||||
*
|
||||
* @deprecated Instead use setShippingAddress
|
||||
*
|
||||
* @param \PayPal\Api\ShippingAddress $shipping_address
|
||||
*
|
||||
* @deprecated Use setShippingAddress
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setShipping_address($shipping_address)
|
||||
{
|
||||
$this->shipping_address = $shipping_address;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Shipping Address
|
||||
*
|
||||
* @deprecated Use getShippingAddress
|
||||
* Shipping address.
|
||||
* @deprecated Instead use getShippingAddress
|
||||
*
|
||||
* @return \PayPal\Api\ShippingAddress
|
||||
*/
|
||||
@@ -131,4 +89,5 @@ class ItemList extends PPModel
|
||||
{
|
||||
return $this->shipping_address;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,6 +8,10 @@ use PayPal\Rest\ApiContext;
|
||||
/**
|
||||
* Class Links
|
||||
*
|
||||
*
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
* @property string href
|
||||
* @property string rel
|
||||
* @property \PayPal\Api\HyperSchema targetSchema
|
||||
@@ -18,7 +22,8 @@ use PayPal\Rest\ApiContext;
|
||||
class Links extends PPModel
|
||||
{
|
||||
/**
|
||||
* Set Href
|
||||
* Sets Href
|
||||
*
|
||||
*
|
||||
* @param string $href
|
||||
*
|
||||
@@ -27,12 +32,11 @@ class Links extends PPModel
|
||||
public function setHref($href)
|
||||
{
|
||||
$this->href = $href;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Href
|
||||
* Gets Href
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -42,7 +46,8 @@ class Links extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Rel
|
||||
* Sets Rel
|
||||
*
|
||||
*
|
||||
* @param string $rel
|
||||
*
|
||||
@@ -51,12 +56,11 @@ class Links extends PPModel
|
||||
public function setRel($rel)
|
||||
{
|
||||
$this->rel = $rel;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Rel
|
||||
* Gets Rel
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -66,7 +70,8 @@ class Links extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Target Schema
|
||||
* Sets TargetSchema
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\HyperSchema $targetSchema
|
||||
*
|
||||
@@ -75,12 +80,11 @@ class Links extends PPModel
|
||||
public function setTargetSchema($targetSchema)
|
||||
{
|
||||
$this->targetSchema = $targetSchema;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Target Schema
|
||||
* Gets TargetSchema
|
||||
*
|
||||
* @return \PayPal\Api\HyperSchema
|
||||
*/
|
||||
@@ -90,7 +94,8 @@ class Links extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Method
|
||||
* Sets Method
|
||||
*
|
||||
*
|
||||
* @param string $method
|
||||
*
|
||||
@@ -99,12 +104,11 @@ class Links extends PPModel
|
||||
public function setMethod($method)
|
||||
{
|
||||
$this->method = $method;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Method
|
||||
* Gets Method
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -114,7 +118,8 @@ class Links extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Enctype
|
||||
* Sets Enctype
|
||||
*
|
||||
*
|
||||
* @param string $enctype
|
||||
*
|
||||
@@ -123,12 +128,11 @@ class Links extends PPModel
|
||||
public function setEnctype($enctype)
|
||||
{
|
||||
$this->enctype = $enctype;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Enctype
|
||||
* Gets Enctype
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -138,7 +142,8 @@ class Links extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Schema
|
||||
* Sets Schema
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\HyperSchema $schema
|
||||
*
|
||||
@@ -147,12 +152,11 @@ class Links extends PPModel
|
||||
public function setSchema($schema)
|
||||
{
|
||||
$this->schema = $schema;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Schema
|
||||
* Gets Schema
|
||||
*
|
||||
* @return \PayPal\Api\HyperSchema
|
||||
*/
|
||||
@@ -160,4 +164,5 @@ class Links extends PPModel
|
||||
{
|
||||
return $this->schema;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
68
lib/PayPal/Api/NameValuePair.php
Normal file
68
lib/PayPal/Api/NameValuePair.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace PayPal\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Rest\ApiContext;
|
||||
|
||||
/**
|
||||
* Class NameValuePair
|
||||
*
|
||||
* Used to define a type for name-value pairs. The use of name value pairs in an API should be limited and approved by architecture.
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
* @property string name
|
||||
* @property string value
|
||||
*/
|
||||
class NameValuePair extends PPModel
|
||||
{
|
||||
/**
|
||||
* Key for the name value pair. The value name types should be correlated
|
||||
*
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Key for the name value pair. The value name types should be correlated
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Value for the name value pair.
|
||||
*
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setValue($value)
|
||||
{
|
||||
$this->value = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Value for the name value pair.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getValue()
|
||||
{
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,19 +8,27 @@ use PayPal\Rest\ApiContext;
|
||||
/**
|
||||
* Class Order
|
||||
*
|
||||
* An order transaction.
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
* @property string id
|
||||
* @property string createTime
|
||||
* @property string updateTime
|
||||
* @property string state
|
||||
* @property string purchase_unit_reference_id
|
||||
* @property string create_time
|
||||
* @property string update_time
|
||||
* @property \PayPal\Api\Amount amount
|
||||
* @property string parentPayment
|
||||
* @property string payment_mode
|
||||
* @property string state
|
||||
* @property string reason_code
|
||||
* @property string protection_eligibility
|
||||
* @property string protection_eligibility_type
|
||||
* @property \PayPal\Api\Links links
|
||||
* @property string reasonCode
|
||||
*/
|
||||
class Order extends PPModel
|
||||
{
|
||||
/**
|
||||
* Set the identifier of the order transaction.
|
||||
* Identifier of the order transaction.
|
||||
*
|
||||
*
|
||||
* @param string $id
|
||||
*
|
||||
@@ -29,12 +37,11 @@ class Order extends PPModel
|
||||
public function setId($id)
|
||||
{
|
||||
$this->id = $id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the identifier of the order transaction.
|
||||
* Identifier of the order transaction.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -44,7 +51,57 @@ class Order extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the time the resource was created.
|
||||
* Identifier to the purchase unit associated with this object
|
||||
*
|
||||
*
|
||||
* @param string $purchase_unit_reference_id
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setPurchaseUnitReferenceId($purchase_unit_reference_id)
|
||||
{
|
||||
$this->purchase_unit_reference_id = $purchase_unit_reference_id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Identifier to the purchase unit associated with this object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPurchaseUnitReferenceId()
|
||||
{
|
||||
return $this->purchase_unit_reference_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Identifier to the purchase unit associated with this object
|
||||
*
|
||||
* @deprecated Instead use setPurchaseUnitReferenceId
|
||||
*
|
||||
* @param string $purchase_unit_reference_id
|
||||
* @return $this
|
||||
*/
|
||||
public function setPurchase_unit_reference_id($purchase_unit_reference_id)
|
||||
{
|
||||
$this->purchase_unit_reference_id = $purchase_unit_reference_id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Identifier to the purchase unit associated with this object
|
||||
* @deprecated Instead use getPurchaseUnitReferenceId
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPurchase_unit_reference_id()
|
||||
{
|
||||
return $this->purchase_unit_reference_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Time the resource was created in UTC ISO8601 format.
|
||||
*
|
||||
*
|
||||
* @param string $create_time
|
||||
*
|
||||
@@ -53,12 +110,11 @@ class Order extends PPModel
|
||||
public function setCreateTime($create_time)
|
||||
{
|
||||
$this->create_time = $create_time;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the time the resource was created.
|
||||
* Time the resource was created in UTC ISO8601 format.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -68,7 +124,33 @@ class Order extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the time the resource was last updated.
|
||||
* Time the resource was created in UTC ISO8601 format.
|
||||
*
|
||||
* @deprecated Instead use setCreateTime
|
||||
*
|
||||
* @param string $create_time
|
||||
* @return $this
|
||||
*/
|
||||
public function setCreate_time($create_time)
|
||||
{
|
||||
$this->create_time = $create_time;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Time the resource was created in UTC ISO8601 format.
|
||||
* @deprecated Instead use getCreateTime
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCreate_time()
|
||||
{
|
||||
return $this->create_time;
|
||||
}
|
||||
|
||||
/**
|
||||
* Time the resource was last updated in UTC ISO8601 format.
|
||||
*
|
||||
*
|
||||
* @param string $update_time
|
||||
*
|
||||
@@ -77,12 +159,11 @@ class Order extends PPModel
|
||||
public function setUpdateTime($update_time)
|
||||
{
|
||||
$this->update_time = $update_time;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the time the resource was last updated.
|
||||
* Time the resource was last updated in UTC ISO8601 format.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -92,35 +173,33 @@ class Order extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the state of the order transaction.
|
||||
* Time the resource was last updated in UTC ISO8601 format.
|
||||
*
|
||||
* Allowed values are: `PENDING`, `COMPLETED`, `REFUNDED` or `PARTIALLY_REFUNDED`.
|
||||
*
|
||||
* @param string $state
|
||||
* @deprecated Instead use setUpdateTime
|
||||
*
|
||||
* @param string $update_time
|
||||
* @return $this
|
||||
*/
|
||||
public function setState($state)
|
||||
public function setUpdate_time($update_time)
|
||||
{
|
||||
$this->state = $state;
|
||||
|
||||
$this->update_time = $update_time;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the state of the order transaction.
|
||||
*
|
||||
* Allowed values are: `PENDING`, `COMPLETED`, `REFUNDED` or `PARTIALLY_REFUNDED`.
|
||||
* Time the resource was last updated in UTC ISO8601 format.
|
||||
* @deprecated Instead use getUpdateTime
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getState()
|
||||
public function getUpdate_time()
|
||||
{
|
||||
return $this->state;
|
||||
return $this->update_time;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the amount being collected.
|
||||
* Amount being collected.
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\Amount $amount
|
||||
*
|
||||
@@ -129,12 +208,11 @@ class Order extends PPModel
|
||||
public function setAmount($amount)
|
||||
{
|
||||
$this->amount = $amount;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the amount being collected.
|
||||
* Amount being collected.
|
||||
*
|
||||
* @return \PayPal\Api\Amount
|
||||
*/
|
||||
@@ -144,62 +222,81 @@ class Order extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set ID of the payment resource on which this transaction is based.
|
||||
* specifies payment mode of the transaction
|
||||
* Valid Values: ["INSTANT_TRANSFER", "MANUAL_BANK_TRANSFER", "DELAYED_TRANSFER", "ECHECK"]
|
||||
*
|
||||
* @param string $parent_payment
|
||||
* @param string $payment_mode
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setParentPayment($parent_payment)
|
||||
public function setPaymentMode($payment_mode)
|
||||
{
|
||||
$this->parent_payment = $parent_payment;
|
||||
|
||||
$this->payment_mode = $payment_mode;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get ID of the payment resource on which this transaction is based.
|
||||
* specifies payment mode of the transaction
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getParentPayment()
|
||||
public function getPaymentMode()
|
||||
{
|
||||
return $this->parent_payment;
|
||||
return $this->payment_mode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Links
|
||||
* specifies payment mode of the transaction
|
||||
*
|
||||
* @param \PayPal\Api\Links $links
|
||||
* @deprecated Instead use setPaymentMode
|
||||
*
|
||||
* @param string $payment_mode
|
||||
* @return $this
|
||||
*/
|
||||
public function setLinks($links)
|
||||
public function setPayment_mode($payment_mode)
|
||||
{
|
||||
$this->links = $links;
|
||||
|
||||
$this->payment_mode = $payment_mode;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Links
|
||||
* specifies payment mode of the transaction
|
||||
* @deprecated Instead use getPaymentMode
|
||||
*
|
||||
* @return \PayPal\Api\Links
|
||||
* @return string
|
||||
*/
|
||||
public function getLinks()
|
||||
public function getPayment_mode()
|
||||
{
|
||||
return $this->links;
|
||||
return $this->payment_mode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reason code for the transaction state being Pending or Reversed. Assigned in response.
|
||||
* State of the order transaction.
|
||||
* Valid Values: ["PENDING", "COMPLETED", "REFUNDED", "PARTIALLY_REFUNDED"]
|
||||
*
|
||||
* Allowed values: `CHARGEBACK`, `GUARANTEE`, `BUYER_COMPLAINT`, `REFUND`,
|
||||
* `UNCONFIRMED_SHIPPING_ADDRESS`,
|
||||
* `ECHECK`, `INTERNATIONAL_WITHDRAWAL`,
|
||||
* `RECEIVING_PREFERENCE_MANDATES_MANUAL_ACTION`, `PAYMENT_REVIEW`,
|
||||
* `REGULATORY_REVIEW`, `UNILATERAL`, or `VERIFICATION_REQUIRED`
|
||||
* (`ORDER` can also be set in the response).
|
||||
* @param string $state
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setState($state)
|
||||
{
|
||||
$this->state = $state;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* State of the order transaction.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getState()
|
||||
{
|
||||
return $this->state;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reason code for the transaction state being Pending or Reversed.
|
||||
* Valid Values: ["CHARGEBACK", "GUARANTEE", "BUYER_COMPLAINT", "REFUND", "UNCONFIRMED_SHIPPING_ADDRESS", "ECHECK", "INTERNATIONAL_WITHDRAWAL", "RECEIVING_PREFERENCE_MANDATES_MANUAL_ACTION", "PAYMENT_REVIEW", "REGULATORY_REVIEW", "UNILATERAL", "VERIFICATION_REQUIRED"]
|
||||
*
|
||||
* @param string $reason_code
|
||||
*
|
||||
@@ -208,19 +305,11 @@ class Order extends PPModel
|
||||
public function setReasonCode($reason_code)
|
||||
{
|
||||
$this->reason_code = $reason_code;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reason code for the transaction state being Pending or Reversed. Assigned in response.
|
||||
*
|
||||
* Allowed values: `CHARGEBACK`, `GUARANTEE`, `BUYER_COMPLAINT`, `REFUND`,
|
||||
* `UNCONFIRMED_SHIPPING_ADDRESS`,
|
||||
* `ECHECK`, `INTERNATIONAL_WITHDRAWAL`,
|
||||
* `RECEIVING_PREFERENCE_MANDATES_MANUAL_ACTION`, `PAYMENT_REVIEW`,
|
||||
* `REGULATORY_REVIEW`, `UNILATERAL`, or `VERIFICATION_REQUIRED`
|
||||
* (`ORDER` can also be set in the response).
|
||||
* Reason code for the transaction state being Pending or Reversed.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -228,4 +317,152 @@ class Order extends PPModel
|
||||
{
|
||||
return $this->reason_code;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reason code for the transaction state being Pending or Reversed.
|
||||
*
|
||||
* @deprecated Instead use setReasonCode
|
||||
*
|
||||
* @param string $reason_code
|
||||
* @return $this
|
||||
*/
|
||||
public function setReason_code($reason_code)
|
||||
{
|
||||
$this->reason_code = $reason_code;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reason code for the transaction state being Pending or Reversed.
|
||||
* @deprecated Instead use getReasonCode
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getReason_code()
|
||||
{
|
||||
return $this->reason_code;
|
||||
}
|
||||
|
||||
/**
|
||||
* Protection Eligibility of the Payer
|
||||
* Valid Values: ["ELIGIBLE", "PARTIALLY_ELIGIBLE", "INELIGIBLE"]
|
||||
*
|
||||
* @param string $protection_eligibility
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setProtectionEligibility($protection_eligibility)
|
||||
{
|
||||
$this->{"protection-eligibility"} = $protection_eligibility;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Protection Eligibility of the Payer
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getProtectionEligibility()
|
||||
{
|
||||
return $this->{"protection-eligibility"};
|
||||
}
|
||||
|
||||
/**
|
||||
* Protection Eligibility of the Payer
|
||||
*
|
||||
* @deprecated Instead use setProtectionEligibility
|
||||
*
|
||||
* @param string $protection-eligibility
|
||||
* @return $this
|
||||
*/
|
||||
public function setProtection_eligibility($protection_eligibility)
|
||||
{
|
||||
$this->{"protection-eligibility"} = $protection_eligibility;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Protection Eligibility of the Payer
|
||||
* @deprecated Instead use getProtectionEligibility
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getProtection_eligibility()
|
||||
{
|
||||
return $this->{"protection-eligibility"};
|
||||
}
|
||||
|
||||
/**
|
||||
* Protection Eligibility Type of the Payer
|
||||
* Valid Values: ["ELIGIBLE", "ITEM_NOT_RECEIVED_ELIGIBLE", "INELIGIBLE", "UNAUTHORIZED_PAYMENT_ELIGIBLE"]
|
||||
*
|
||||
* @param string $protection_eligibility_type
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setProtectionEligibilityType($protection_eligibility_type)
|
||||
{
|
||||
$this->{"protection-eligibility_type"} = $protection_eligibility_type;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Protection Eligibility Type of the Payer
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getProtectionEligibilityType()
|
||||
{
|
||||
return $this->{"protection-eligibility_type"};
|
||||
}
|
||||
|
||||
/**
|
||||
* Protection Eligibility Type of the Payer
|
||||
*
|
||||
* @deprecated Instead use setProtectionEligibilityType
|
||||
*
|
||||
* @param string $protection-eligibility_type
|
||||
* @return $this
|
||||
*/
|
||||
public function setProtection_eligibility_type($protection_eligibility_type)
|
||||
{
|
||||
$this->{"protection-eligibility_type"} = $protection_eligibility_type;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Protection Eligibility Type of the Payer
|
||||
* @deprecated Instead use getProtectionEligibilityType
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getProtection_eligibility_type()
|
||||
{
|
||||
return $this->{"protection-eligibility_type"};
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets Links
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\Links $links
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setLinks($links)
|
||||
{
|
||||
$this->links = $links;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Links
|
||||
*
|
||||
* @return \PayPal\Api\Links[]
|
||||
*/
|
||||
public function getLinks()
|
||||
{
|
||||
return $this->links;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,17 +8,19 @@ use PayPal\Rest\ApiContext;
|
||||
/**
|
||||
* Class Payee
|
||||
*
|
||||
* A resource representing a Payee that received the funds and fulfills the order. Only one of the following identifiers need to be supplied.
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
* @property string email
|
||||
* @property string merchant_id
|
||||
* @property string phone
|
||||
* @property \PayPal\Api\Phone phone
|
||||
*/
|
||||
class Payee extends PPModel
|
||||
{
|
||||
/**
|
||||
* Set Email
|
||||
* 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
|
||||
*
|
||||
@@ -27,15 +29,11 @@ class Payee extends PPModel
|
||||
public function setEmail($email)
|
||||
{
|
||||
$this->email = $email;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Email
|
||||
* 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
|
||||
*/
|
||||
@@ -45,8 +43,8 @@ class Payee extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Merchant ID
|
||||
* Encrypted PayPal Account identifier for the Payee
|
||||
* Encrypted PayPal Account identifier for the Payee.
|
||||
*
|
||||
*
|
||||
* @param string $merchant_id
|
||||
*
|
||||
@@ -59,8 +57,7 @@ class Payee extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Merchant ID
|
||||
* Encrypted PayPal Account identifier for the Payee
|
||||
* Encrypted PayPal Account identifier for the Payee.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -70,27 +67,22 @@ class Payee extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Merchant ID
|
||||
* Encrypted PayPal Account identifier for the Payee
|
||||
* Encrypted PayPal Account identifier for the Payee.
|
||||
*
|
||||
* @deprecated Instead use setMerchantId
|
||||
*
|
||||
* @param string $merchant_id
|
||||
*
|
||||
* @deprecated Use setMerchantId
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setMerchant_id($merchant_id)
|
||||
{
|
||||
$this->merchant_id = $merchant_id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Merchant ID
|
||||
* Encrypted PayPal Account identifier for the Payee
|
||||
*
|
||||
* @deprecated Use getMerchantId
|
||||
* Encrypted PayPal Account identifier for the Payee.
|
||||
* @deprecated Instead use getMerchantId
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -100,12 +92,10 @@ class Payee extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Phone
|
||||
* (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
|
||||
* 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 string $phone
|
||||
*
|
||||
* @param \PayPal\Api\Phone $phone
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
@@ -116,15 +106,13 @@ class Payee extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Phone
|
||||
* (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
|
||||
* 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 string
|
||||
* @return \PayPal\Api\Phone
|
||||
*/
|
||||
public function getPhone()
|
||||
{
|
||||
return $this->phone;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,15 +8,21 @@ use PayPal\Rest\ApiContext;
|
||||
/**
|
||||
* Class Payer
|
||||
*
|
||||
* A resource representing a Payer that funds a payment.
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
* @property string payment_method
|
||||
* @property array|\PayPal\Api\FundingInstrument funding_instruments
|
||||
* @property string status
|
||||
* @property \PayPal\Api\FundingInstrument funding_instruments
|
||||
* @property string funding_option_id
|
||||
* @property \PayPal\Api\PayerInfo payer_info
|
||||
*/
|
||||
class Payer extends PPModel
|
||||
{
|
||||
/**
|
||||
* Set Payment Method
|
||||
* Payment method being used - PayPal Wallet payment or Direct Credit card
|
||||
* Payment method being used - PayPal Wallet payment, Bank Direct Debit or Direct Credit card.
|
||||
* Valid Values: ["credit_card", "bank", "paypal"]
|
||||
*
|
||||
* @param string $payment_method
|
||||
*
|
||||
@@ -25,13 +31,11 @@ class Payer extends PPModel
|
||||
public function setPaymentMethod($payment_method)
|
||||
{
|
||||
$this->payment_method = $payment_method;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Payment Method
|
||||
* Payment method being used - PayPal Wallet payment or Direct Credit card
|
||||
* Payment method being used - PayPal Wallet payment, Bank Direct Debit or Direct Credit card.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -41,27 +45,22 @@ class Payer extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Payment Method
|
||||
* Payment method being used - PayPal Wallet payment or Direct Credit card
|
||||
* Payment method being used - PayPal Wallet payment, Bank Direct Debit or Direct Credit card.
|
||||
*
|
||||
* @deprecated Instead use setPaymentMethod
|
||||
*
|
||||
* @param string $payment_method
|
||||
*
|
||||
* @deprecated Use setPaymentMethod
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setPayment_method($payment_method)
|
||||
{
|
||||
$this->payment_method = $payment_method;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Payment Method
|
||||
* Payment method being used - PayPal Wallet payment or Direct Credit card
|
||||
*
|
||||
* @deprecated Use getPaymentMethod
|
||||
* Payment method being used - PayPal Wallet payment, Bank Direct Debit or Direct Credit card.
|
||||
* @deprecated Instead use getPaymentMethod
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -71,24 +70,47 @@ class Payer extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Funding Instruments
|
||||
* List of funding instruments from where the funds of the current payment come from. Typically a credit card
|
||||
* Status of Payer PayPal Account.
|
||||
* Valid Values: ["VERIFIED", "UNVERIFIED"]
|
||||
*
|
||||
* @param \PayPal\Api\FundingInstrument|array $funding_instruments
|
||||
* @param string $status
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setStatus($status)
|
||||
{
|
||||
$this->status = $status;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Status of Payer PayPal Account.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getStatus()
|
||||
{
|
||||
return $this->status;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of funding instruments from where the funds of the current payment come from. Typically a credit card.
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\FundingInstrument $funding_instruments
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setFundingInstruments($funding_instruments)
|
||||
{
|
||||
$this->funding_instruments = $funding_instruments;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Funding Instruments
|
||||
* List of funding instruments from where the funds of the current payment come from. Typically a credit card.
|
||||
*
|
||||
* @return \PayPal\Api\FundingInstrument|array
|
||||
* @return \PayPal\Api\FundingInstrument[]
|
||||
*/
|
||||
public function getFundingInstruments()
|
||||
{
|
||||
@@ -96,26 +118,22 @@ class Payer extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Funding Instruments
|
||||
* 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.
|
||||
*
|
||||
* @deprecated Instead use setFundingInstruments
|
||||
*
|
||||
* @param \PayPal\Api\FundingInstrument $funding_instruments
|
||||
*
|
||||
* @deprecated Use setFundingInstruments
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setFunding_instruments($funding_instruments)
|
||||
{
|
||||
$this->funding_instruments = $funding_instruments;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Funding Instruments
|
||||
*
|
||||
* @deprecated Use getFundingInstruments
|
||||
* List of funding instruments from where the funds of the current payment come from. Typically a credit card.
|
||||
* @deprecated Instead use getFundingInstruments
|
||||
*
|
||||
* @return \PayPal\Api\FundingInstrument
|
||||
*/
|
||||
@@ -125,9 +143,57 @@ class Payer extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set 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
|
||||
* Id of user selected funding option for the payment. 'OneOf' funding_instruments or funding_option_id to be present
|
||||
*
|
||||
*
|
||||
* @param string $funding_option_id
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setFundingOptionId($funding_option_id)
|
||||
{
|
||||
$this->funding_option_id = $funding_option_id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Id of user selected funding option for the payment. 'OneOf' funding_instruments or funding_option_id to be present
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFundingOptionId()
|
||||
{
|
||||
return $this->funding_option_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Id of user selected funding option for the payment. 'OneOf' funding_instruments or funding_option_id to be present
|
||||
*
|
||||
* @deprecated Instead use setFundingOptionId
|
||||
*
|
||||
* @param string $funding_option_id
|
||||
* @return $this
|
||||
*/
|
||||
public function setFunding_option_id($funding_option_id)
|
||||
{
|
||||
$this->funding_option_id = $funding_option_id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Id of user selected funding option for the payment. 'OneOf' funding_instruments or funding_option_id to be present
|
||||
* @deprecated Instead use getFundingOptionId
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFunding_option_id()
|
||||
{
|
||||
return $this->funding_option_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Information related to the Payer.
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\PayerInfo $payer_info
|
||||
*
|
||||
@@ -136,12 +202,11 @@ class Payer extends PPModel
|
||||
public function setPayerInfo($payer_info)
|
||||
{
|
||||
$this->payer_info = $payer_info;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Payer Info
|
||||
* Information related to the Payer.
|
||||
*
|
||||
* @return \PayPal\Api\PayerInfo
|
||||
*/
|
||||
@@ -151,27 +216,22 @@ class Payer extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set 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
|
||||
* Information related to the Payer.
|
||||
*
|
||||
* @deprecated Instead use setPayerInfo
|
||||
*
|
||||
* @param \PayPal\Api\PayerInfo $payer_info
|
||||
*
|
||||
* @deprecated Use setPayerInfo
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setPayer_info($payer_info)
|
||||
{
|
||||
$this->payer_info = $payer_info;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Payer Info
|
||||
*
|
||||
* @deprecated Use getPayerInfo
|
||||
* Information related to the Payer.
|
||||
* @deprecated Instead use getPayerInfo
|
||||
*
|
||||
* @return \PayPal\Api\PayerInfo
|
||||
*/
|
||||
@@ -179,4 +239,5 @@ class Payer extends PPModel
|
||||
{
|
||||
return $this->payer_info;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,18 +8,29 @@ use PayPal\Rest\ApiContext;
|
||||
/**
|
||||
* Class PayerInfo
|
||||
*
|
||||
* A resource representing a information about Payer.
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
* @property string email
|
||||
* @property string external_remember_me_id
|
||||
* @property string buyer_account_number
|
||||
* @property string first_name
|
||||
* @property string last_name
|
||||
* @property string payer_id
|
||||
* @property string phone
|
||||
* @property \PayPal\Api\Address shipping_address
|
||||
* @property string phone_type
|
||||
* @property string birth_date
|
||||
* @property string tax_id
|
||||
* @property string tax_id_type
|
||||
* @property \PayPal\Api\Address billing_address
|
||||
* @property \PayPal\Api\ShippingAddress shipping_address
|
||||
*/
|
||||
class PayerInfo extends PPModel
|
||||
{
|
||||
/**
|
||||
* Set Email
|
||||
* Email address representing the Payer
|
||||
* Email address representing the Payer.
|
||||
*
|
||||
*
|
||||
* @param string $email
|
||||
*
|
||||
@@ -28,13 +39,11 @@ class PayerInfo extends PPModel
|
||||
public function setEmail($email)
|
||||
{
|
||||
$this->email = $email;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Email
|
||||
* Email address representing the Payer
|
||||
* Email address representing the Payer.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -44,8 +53,106 @@ class PayerInfo extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set First Name
|
||||
* First Name of the Payer from their PayPal Account
|
||||
* External Remember Me id representing the Payer
|
||||
*
|
||||
*
|
||||
* @param string $external_remember_me_id
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setExternalRememberMeId($external_remember_me_id)
|
||||
{
|
||||
$this->external_remember_me_id = $external_remember_me_id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* External Remember Me id representing the Payer
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getExternalRememberMeId()
|
||||
{
|
||||
return $this->external_remember_me_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* External Remember Me id representing the Payer
|
||||
*
|
||||
* @deprecated Instead use setExternalRememberMeId
|
||||
*
|
||||
* @param string $external_remember_me_id
|
||||
* @return $this
|
||||
*/
|
||||
public function setExternal_remember_me_id($external_remember_me_id)
|
||||
{
|
||||
$this->external_remember_me_id = $external_remember_me_id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* External Remember Me id representing the Payer
|
||||
* @deprecated Instead use getExternalRememberMeId
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getExternal_remember_me_id()
|
||||
{
|
||||
return $this->external_remember_me_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Account Number representing the Payer
|
||||
*
|
||||
*
|
||||
* @param string $buyer_account_number
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setBuyerAccountNumber($buyer_account_number)
|
||||
{
|
||||
$this->buyer_account_number = $buyer_account_number;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Account Number representing the Payer
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getBuyerAccountNumber()
|
||||
{
|
||||
return $this->buyer_account_number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Account Number representing the Payer
|
||||
*
|
||||
* @deprecated Instead use setBuyerAccountNumber
|
||||
*
|
||||
* @param string $buyer_account_number
|
||||
* @return $this
|
||||
*/
|
||||
public function setBuyer_account_number($buyer_account_number)
|
||||
{
|
||||
$this->buyer_account_number = $buyer_account_number;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Account Number representing the Payer
|
||||
* @deprecated Instead use getBuyerAccountNumber
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getBuyer_account_number()
|
||||
{
|
||||
return $this->buyer_account_number;
|
||||
}
|
||||
|
||||
/**
|
||||
* First Name of the Payer.
|
||||
*
|
||||
*
|
||||
* @param string $first_name
|
||||
*
|
||||
@@ -54,13 +161,11 @@ class PayerInfo extends PPModel
|
||||
public function setFirstName($first_name)
|
||||
{
|
||||
$this->first_name = $first_name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get First Name
|
||||
* First Name of the Payer from their PayPal Account
|
||||
* First Name of the Payer.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -70,27 +175,22 @@ class PayerInfo extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set First Name
|
||||
* First Name of the Payer from their PayPal Account
|
||||
* First Name of the Payer.
|
||||
*
|
||||
* @deprecated Instead use setFirstName
|
||||
*
|
||||
* @param string $first_name
|
||||
*
|
||||
* @deprecated Use setFirstName
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setFirst_name($first_name)
|
||||
{
|
||||
$this->first_name = $first_name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get First Name
|
||||
* First Name of the Payer from their PayPal Account
|
||||
*
|
||||
* @deprecated Use getFirstName
|
||||
* First Name of the Payer.
|
||||
* @deprecated Instead use getFirstName
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -100,8 +200,8 @@ class PayerInfo extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Last Name
|
||||
* Last Name of the Payer from their PayPal Account
|
||||
* Last Name of the Payer.
|
||||
*
|
||||
*
|
||||
* @param string $last_name
|
||||
*
|
||||
@@ -110,13 +210,11 @@ class PayerInfo extends PPModel
|
||||
public function setLastName($last_name)
|
||||
{
|
||||
$this->last_name = $last_name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Last Name
|
||||
* Last Name of the Payer from their PayPal Account
|
||||
* Last Name of the Payer.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -126,27 +224,22 @@ class PayerInfo extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Last Name
|
||||
* Last Name of the Payer from their PayPal Account
|
||||
* Last Name of the Payer.
|
||||
*
|
||||
* @deprecated Instead use setLastName
|
||||
*
|
||||
* @param string $last_name
|
||||
*
|
||||
* @deprecated Use setLastName
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setLast_name($last_name)
|
||||
{
|
||||
$this->last_name = $last_name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Last Name
|
||||
* Last Name of the Payer from their PayPal Account
|
||||
*
|
||||
* @deprecated Use getLastName
|
||||
* Last Name of the Payer.
|
||||
* @deprecated Instead use getLastName
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -156,8 +249,8 @@ class PayerInfo extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Payer ID
|
||||
* PayPal assigned Payer ID
|
||||
* PayPal assigned Payer ID.
|
||||
*
|
||||
*
|
||||
* @param string $payer_id
|
||||
*
|
||||
@@ -166,13 +259,11 @@ class PayerInfo extends PPModel
|
||||
public function setPayerId($payer_id)
|
||||
{
|
||||
$this->payer_id = $payer_id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Payer ID
|
||||
* PayPal assigned Payer ID
|
||||
* PayPal assigned Payer ID.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -182,27 +273,22 @@ class PayerInfo extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Payer ID
|
||||
* PayPal assigned Payer ID
|
||||
* PayPal assigned Payer ID.
|
||||
*
|
||||
* @deprecated Instead use setPayerId
|
||||
*
|
||||
* @param string $payer_id
|
||||
*
|
||||
* @deprecated Use setPayerId
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setPayer_id($payer_id)
|
||||
{
|
||||
$this->payer_id = $payer_id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Payer ID
|
||||
* PayPal assigned Payer ID
|
||||
*
|
||||
* @deprecated Use setPayerId
|
||||
* PayPal assigned Payer ID.
|
||||
* @deprecated Instead use getPayerId
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -212,8 +298,8 @@ class PayerInfo extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Phone
|
||||
* Phone number representing the Payer
|
||||
* Phone number representing the Payer.
|
||||
*
|
||||
*
|
||||
* @param string $phone
|
||||
*
|
||||
@@ -222,13 +308,11 @@ class PayerInfo extends PPModel
|
||||
public function setPhone($phone)
|
||||
{
|
||||
$this->phone = $phone;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Phone
|
||||
* Phone number representing the Payer
|
||||
* Phone number representing the Payer.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -238,8 +322,253 @@ class PayerInfo extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Shipping Address
|
||||
* Shipping address of the Payer from their PayPal Account
|
||||
* Phone type
|
||||
* Valid Values: ["HOME", "WORK", "MOBILE", "OTHER"]
|
||||
*
|
||||
* @param string $phone_type
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setPhoneType($phone_type)
|
||||
{
|
||||
$this->phone_type = $phone_type;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Phone type
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPhoneType()
|
||||
{
|
||||
return $this->phone_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Phone type
|
||||
*
|
||||
* @deprecated Instead use setPhoneType
|
||||
*
|
||||
* @param string $phone_type
|
||||
* @return $this
|
||||
*/
|
||||
public function setPhone_type($phone_type)
|
||||
{
|
||||
$this->phone_type = $phone_type;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Phone type
|
||||
* @deprecated Instead use getPhoneType
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPhone_type()
|
||||
{
|
||||
return $this->phone_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Birth date of the Payer in ISO8601 format (YYYY-MM-DD).
|
||||
*
|
||||
*
|
||||
* @param string $birth_date
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setBirthDate($birth_date)
|
||||
{
|
||||
$this->birth_date = $birth_date;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Birth date of the Payer in ISO8601 format (YYYY-MM-DD).
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getBirthDate()
|
||||
{
|
||||
return $this->birth_date;
|
||||
}
|
||||
|
||||
/**
|
||||
* Birth date of the Payer in ISO8601 format (YYYY-MM-DD).
|
||||
*
|
||||
* @deprecated Instead use setBirthDate
|
||||
*
|
||||
* @param string $birth_date
|
||||
* @return $this
|
||||
*/
|
||||
public function setBirth_date($birth_date)
|
||||
{
|
||||
$this->birth_date = $birth_date;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Birth date of the Payer in ISO8601 format (YYYY-MM-DD).
|
||||
* @deprecated Instead use getBirthDate
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getBirth_date()
|
||||
{
|
||||
return $this->birth_date;
|
||||
}
|
||||
|
||||
/**
|
||||
* Payer's tax ID.
|
||||
*
|
||||
*
|
||||
* @param string $tax_id
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setTaxId($tax_id)
|
||||
{
|
||||
$this->tax_id = $tax_id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Payer's tax ID.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTaxId()
|
||||
{
|
||||
return $this->tax_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Payer's tax ID.
|
||||
*
|
||||
* @deprecated Instead use setTaxId
|
||||
*
|
||||
* @param string $tax_id
|
||||
* @return $this
|
||||
*/
|
||||
public function setTax_id($tax_id)
|
||||
{
|
||||
$this->tax_id = $tax_id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Payer's tax ID.
|
||||
* @deprecated Instead use getTaxId
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTax_id()
|
||||
{
|
||||
return $this->tax_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Payer's tax ID type.
|
||||
* Valid Values: ["BR_CPF", "BR_CNPJ"]
|
||||
*
|
||||
* @param string $tax_id_type
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setTaxIdType($tax_id_type)
|
||||
{
|
||||
$this->tax_id_type = $tax_id_type;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Payer's tax ID type.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTaxIdType()
|
||||
{
|
||||
return $this->tax_id_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Payer's tax ID type.
|
||||
*
|
||||
* @deprecated Instead use setTaxIdType
|
||||
*
|
||||
* @param string $tax_id_type
|
||||
* @return $this
|
||||
*/
|
||||
public function setTax_id_type($tax_id_type)
|
||||
{
|
||||
$this->tax_id_type = $tax_id_type;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Payer's tax ID type.
|
||||
* @deprecated Instead use getTaxIdType
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTax_id_type()
|
||||
{
|
||||
return $this->tax_id_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Billing address of the Payer.
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\Address $billing_address
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setBillingAddress($billing_address)
|
||||
{
|
||||
$this->billing_address = $billing_address;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Billing address of the Payer.
|
||||
*
|
||||
* @return \PayPal\Api\Address
|
||||
*/
|
||||
public function getBillingAddress()
|
||||
{
|
||||
return $this->billing_address;
|
||||
}
|
||||
|
||||
/**
|
||||
* Billing address of the Payer.
|
||||
*
|
||||
* @deprecated Instead use setBillingAddress
|
||||
*
|
||||
* @param \PayPal\Api\Address $billing_address
|
||||
* @return $this
|
||||
*/
|
||||
public function setBilling_address($billing_address)
|
||||
{
|
||||
$this->billing_address = $billing_address;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Billing address of the Payer.
|
||||
* @deprecated Instead use getBillingAddress
|
||||
*
|
||||
* @return \PayPal\Api\Address
|
||||
*/
|
||||
public function getBilling_address()
|
||||
{
|
||||
return $this->billing_address;
|
||||
}
|
||||
|
||||
/**
|
||||
* Obsolete. Use shipping address present in purchase unit.
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\ShippingAddress $shipping_address
|
||||
*
|
||||
@@ -248,13 +577,11 @@ class PayerInfo extends PPModel
|
||||
public function setShippingAddress($shipping_address)
|
||||
{
|
||||
$this->shipping_address = $shipping_address;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Shipping Address
|
||||
* Shipping address of the Payer from their PayPal Account
|
||||
* Obsolete. Use shipping address present in purchase unit.
|
||||
*
|
||||
* @return \PayPal\Api\ShippingAddress
|
||||
*/
|
||||
@@ -264,27 +591,22 @@ class PayerInfo extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Shipping Address
|
||||
* Shipping address of the Payer from their PayPal Account
|
||||
* Obsolete. Use shipping address present in purchase unit.
|
||||
*
|
||||
* @deprecated Instead use setShippingAddress
|
||||
*
|
||||
* @param \PayPal\Api\ShippingAddress $shipping_address
|
||||
*
|
||||
* @deprecated Use setShippingAddress
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setShipping_address($shipping_address)
|
||||
{
|
||||
$this->shipping_address = $shipping_address;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Shipping Address
|
||||
* Shipping address of the Payer from their PayPal Account
|
||||
*
|
||||
* @deprecated Use getShippingAddress
|
||||
* Obsolete. Use shipping address present in purchase unit.
|
||||
* @deprecated Instead use getShippingAddress
|
||||
*
|
||||
* @return \PayPal\Api\ShippingAddress
|
||||
*/
|
||||
@@ -292,4 +614,5 @@ class PayerInfo extends PPModel
|
||||
{
|
||||
return $this->shipping_address;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,16 +7,22 @@ use PayPal\Rest\ApiContext;
|
||||
use PayPal\Rest\IResource;
|
||||
use PayPal\Api\PaymentHistory;
|
||||
use PayPal\Transport\PPRestCall;
|
||||
use PayPal\Validation\ArgumentValidator;
|
||||
|
||||
/**
|
||||
* Class Payment
|
||||
*
|
||||
* Lets you create, process and manage payments.
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
* @property string id
|
||||
* @property string create_time
|
||||
* @property string update_time
|
||||
* @property string intent
|
||||
* @property \PayPal\Api\Payer payer
|
||||
* @property array|\PayPal\Api\Transaction transactions
|
||||
* @property \PayPal\Api\object cart
|
||||
* @property \PayPal\Api\Transaction transactions
|
||||
* @property string state
|
||||
* @property \PayPal\Api\RedirectUrls redirect_urls
|
||||
* @property \PayPal\Api\Links links
|
||||
@@ -24,16 +30,17 @@ use PayPal\Transport\PPRestCall;
|
||||
class Payment extends PPModel implements IResource
|
||||
{
|
||||
/**
|
||||
* @var
|
||||
* OAuth Credentials to use for this call
|
||||
*
|
||||
* @var \PayPal\Auth\OAuthTokenCredential $credential
|
||||
*/
|
||||
protected static $credential;
|
||||
|
||||
/**
|
||||
* Set Credential
|
||||
*
|
||||
* @param $credential
|
||||
* Sets Credential
|
||||
*
|
||||
* @deprecated Pass ApiContext to create/get methods instead
|
||||
* @param \PayPal\Auth\OAuthTokenCredential $credential
|
||||
*/
|
||||
public static function setCredential($credential)
|
||||
{
|
||||
@@ -41,8 +48,8 @@ class Payment extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set ID
|
||||
* Identifier of the payment resource created
|
||||
* Identifier of the payment resource created.
|
||||
*
|
||||
*
|
||||
* @param string $id
|
||||
*
|
||||
@@ -51,13 +58,11 @@ class Payment extends PPModel implements IResource
|
||||
public function setId($id)
|
||||
{
|
||||
$this->id = $id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get ID
|
||||
* Identifier of the payment resource created
|
||||
* Identifier of the payment resource created.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -67,8 +72,8 @@ class Payment extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Create Time
|
||||
* Time the resource was created
|
||||
* Time the resource was created in UTC ISO8601 format.
|
||||
*
|
||||
*
|
||||
* @param string $create_time
|
||||
*
|
||||
@@ -77,13 +82,11 @@ class Payment extends PPModel implements IResource
|
||||
public function setCreateTime($create_time)
|
||||
{
|
||||
$this->create_time = $create_time;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Create Time
|
||||
* Time the resource was created
|
||||
* Time the resource was created in UTC ISO8601 format.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -93,27 +96,22 @@ class Payment extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Create Time
|
||||
* Time the resource was created
|
||||
* Time the resource was created in UTC ISO8601 format.
|
||||
*
|
||||
* @deprecated Instead use setCreateTime
|
||||
*
|
||||
* @param string $create_time
|
||||
*
|
||||
* @deprecated Use setCreateTime
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setCreate_time($create_time)
|
||||
{
|
||||
$this->create_time = $create_time;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Create Time
|
||||
* Time the resource was created
|
||||
*
|
||||
* @deprecated Use getCreateTime
|
||||
* Time the resource was created in UTC ISO8601 format.
|
||||
* @deprecated Instead use getCreateTime
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -123,8 +121,8 @@ class Payment extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Update Time
|
||||
* Time the resource was last updated
|
||||
* Time the resource was last updated in UTC ISO8601 format.
|
||||
*
|
||||
*
|
||||
* @param string $update_time
|
||||
*
|
||||
@@ -133,13 +131,11 @@ class Payment extends PPModel implements IResource
|
||||
public function setUpdateTime($update_time)
|
||||
{
|
||||
$this->update_time = $update_time;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Update Time
|
||||
* Time the resource was last updated
|
||||
* Time the resource was last updated in UTC ISO8601 format.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -149,27 +145,22 @@ class Payment extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Update Time
|
||||
* Time the resource was last updated
|
||||
* Time the resource was last updated in UTC ISO8601 format.
|
||||
*
|
||||
* @deprecated Instead use setUpdateTime
|
||||
*
|
||||
* @param string $update_time
|
||||
*
|
||||
* @deprecated Use setUpdateTime
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setUpdate_time($update_time)
|
||||
{
|
||||
$this->update_time = $update_time;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Update Time
|
||||
* Time the resource was last updated
|
||||
*
|
||||
* @deprecated Use getUpdateTime
|
||||
* Time the resource was last updated in UTC ISO8601 format.
|
||||
* @deprecated Instead use getUpdateTime
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -179,8 +170,8 @@ class Payment extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Intent
|
||||
* Intent of the payment - Sale or Authorization or Order
|
||||
* Intent of the payment - Sale or Authorization or Order.
|
||||
* Valid Values: ["sale", "authorize", "order"]
|
||||
*
|
||||
* @param string $intent
|
||||
*
|
||||
@@ -189,13 +180,11 @@ class Payment extends PPModel implements IResource
|
||||
public function setIntent($intent)
|
||||
{
|
||||
$this->intent = $intent;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Intent
|
||||
* Intent of the payment - Sale or Authorization or Order
|
||||
* Intent of the payment - Sale or Authorization or Order.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -205,8 +194,8 @@ class Payment extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Payer
|
||||
* 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
|
||||
*
|
||||
@@ -215,13 +204,11 @@ class Payment extends PPModel implements IResource
|
||||
public function setPayer($payer)
|
||||
{
|
||||
$this->payer = $payer;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Payer
|
||||
* 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
|
||||
*/
|
||||
@@ -231,25 +218,47 @@ class Payment extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Transactions
|
||||
* Cart for which the payment is done.
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\object $cart
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setCart($cart)
|
||||
{
|
||||
$this->cart = $cart;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cart for which the payment is done.
|
||||
*
|
||||
* @return \PayPal\Api\object
|
||||
*/
|
||||
public function getCart()
|
||||
{
|
||||
return $this->cart;
|
||||
}
|
||||
|
||||
/**
|
||||
* A payment can have more than one transaction, with each transaction establishing a contract between the payer and a payee
|
||||
*
|
||||
* @param array|\PayPal\Api\Transaction $transactions
|
||||
*
|
||||
* @param \PayPal\Api\Transaction $transactions
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setTransactions($transactions)
|
||||
{
|
||||
$this->transactions = $transactions;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Transactions
|
||||
* 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[]
|
||||
*/
|
||||
public function getTransactions()
|
||||
{
|
||||
@@ -257,8 +266,8 @@ class Payment extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set State
|
||||
* State of the payment
|
||||
* state of the payment
|
||||
* Valid Values: ["created", "approved", "failed", "canceled", "expired"]
|
||||
*
|
||||
* @param string $state
|
||||
*
|
||||
@@ -267,13 +276,11 @@ class Payment extends PPModel implements IResource
|
||||
public function setState($state)
|
||||
{
|
||||
$this->state = $state;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get State
|
||||
* State of the payment
|
||||
* state of the payment
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -283,8 +290,8 @@ class Payment extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Redirect URLs
|
||||
* 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
|
||||
*
|
||||
@@ -293,13 +300,11 @@ class Payment extends PPModel implements IResource
|
||||
public function setRedirectUrls($redirect_urls)
|
||||
{
|
||||
$this->redirect_urls = $redirect_urls;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Redirect URLs
|
||||
* 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
|
||||
*/
|
||||
@@ -309,27 +314,22 @@ class Payment extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Redirect URLs
|
||||
* 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.
|
||||
*
|
||||
* @deprecated Instead use setRedirectUrls
|
||||
*
|
||||
* @param \PayPal\Api\RedirectUrls $redirect_urls
|
||||
*
|
||||
* @deprecated Use setRedirectUrls
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setRedirect_urls($redirect_urls)
|
||||
{
|
||||
$this->redirect_urls = $redirect_urls;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Redirect URLs
|
||||
* Redirect urls required only when using payment_method as PayPal - the only settings supported are return and cancel urls
|
||||
*
|
||||
* @deprecated Use getRedirectUrls
|
||||
* Redirect urls required only when using payment_method as PayPal - the only settings supported are return and cancel urls.
|
||||
* @deprecated Instead use getRedirectUrls
|
||||
*
|
||||
* @return \PayPal\Api\RedirectUrls
|
||||
*/
|
||||
@@ -339,7 +339,8 @@ class Payment extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Links
|
||||
* Sets Links
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\Links $links
|
||||
*
|
||||
@@ -348,124 +349,94 @@ class Payment extends PPModel implements IResource
|
||||
public function setLinks($links)
|
||||
{
|
||||
$this->links = $links;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Links
|
||||
* Gets Links
|
||||
*
|
||||
* @return \PayPal\Api\Links
|
||||
* @return \PayPal\Api\Links[]
|
||||
*/
|
||||
public function getLinks()
|
||||
{
|
||||
return $this->links;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create
|
||||
* Creates (and processes) a new Payment Resource.
|
||||
*
|
||||
* @param \PayPal\Rest\ApiContext|null $apiContext
|
||||
*
|
||||
* @return $this
|
||||
* @param \PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
||||
* @return Payment
|
||||
*/
|
||||
public function create($apiContext = null)
|
||||
{
|
||||
$payLoad = $this->toJSON();
|
||||
|
||||
$payLoad = $this->toJSON();
|
||||
if ($apiContext == null) {
|
||||
$apiContext = new ApiContext(self::$credential);
|
||||
}
|
||||
|
||||
$call = new PPRestCall($apiContext);
|
||||
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payments/payment", "POST", $payLoad);
|
||||
$this->fromJson($json);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get
|
||||
*
|
||||
* @param int $paymentId
|
||||
* @param \PayPal\Rest\ApiContext|null $apiContext
|
||||
* Obtain the Payment resource for the given identifier.
|
||||
*
|
||||
* @param string $paymentId
|
||||
* @param \PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
||||
* @return Payment
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public static function get($paymentId, $apiContext = null)
|
||||
{
|
||||
if (($paymentId == null) || (strlen($paymentId) <= 0)) {
|
||||
throw new \InvalidArgumentException("paymentId cannot be null or empty");
|
||||
}
|
||||
ArgumentValidator::validate($paymentId, 'paymentId');
|
||||
|
||||
$payLoad = "";
|
||||
|
||||
if ($apiContext == null) {
|
||||
$apiContext = new ApiContext(self::$credential);
|
||||
}
|
||||
|
||||
$call = new PPRestCall($apiContext);
|
||||
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payments/payment/$paymentId", "GET", $payLoad);
|
||||
|
||||
$ret = new Payment();
|
||||
$ret->fromJson($json);
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute
|
||||
*
|
||||
* @param \Paypal\Api\PaymentExecution $paymentExecution
|
||||
* @param \PayPal\Rest\ApiContext|null $apiContext
|
||||
* Executes the payment (after approved by the Payer) associated with this resource when the payment method is PayPal.
|
||||
*
|
||||
* @param PaymentExecution $paymentExecution
|
||||
* @param \PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
||||
* @return Payment
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function execute($paymentExecution, $apiContext = null)
|
||||
{
|
||||
if ($this->getId() == null) {
|
||||
throw new \InvalidArgumentException("Id cannot be null");
|
||||
}
|
||||
|
||||
if (($paymentExecution == null)) {
|
||||
throw new \InvalidArgumentException("paymentExecution cannot be null or empty");
|
||||
}
|
||||
ArgumentValidator::validate($this->getId(), "Id");
|
||||
ArgumentValidator::validate($paymentExecution, 'paymentExecution');
|
||||
|
||||
$payLoad = $paymentExecution->toJSON();
|
||||
|
||||
if ($apiContext == null) {
|
||||
$apiContext = new ApiContext(self::$credential);
|
||||
}
|
||||
|
||||
$call = new PPRestCall($apiContext);
|
||||
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payments/payment/{$this->getId()}/execute", "POST", $payLoad);
|
||||
|
||||
$ret = new Payment();
|
||||
$ret->fromJson($json);
|
||||
|
||||
return $ret;
|
||||
$this->fromJson($json);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* All
|
||||
* Retrieves a list of Payment resources.
|
||||
*
|
||||
* @param array $params
|
||||
* @param \PayPal\Rest\ApiContext|null $apiContext
|
||||
*
|
||||
* @param \PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
||||
* @return PaymentHistory
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public static function all($params, $apiContext = null)
|
||||
{
|
||||
if (($params == null)) {
|
||||
throw new \InvalidArgumentException("params cannot be null or empty");
|
||||
}
|
||||
ArgumentValidator::validate($params, 'params');
|
||||
|
||||
$payLoad = "";
|
||||
|
||||
$allowedParams = array(
|
||||
'count' => 1,
|
||||
'start_id' => 1,
|
||||
@@ -476,17 +447,14 @@ class Payment extends PPModel implements IResource
|
||||
'sort_by' => 1,
|
||||
'sort_order' => 1,
|
||||
);
|
||||
|
||||
if ($apiContext == null) {
|
||||
$apiContext = new ApiContext(self::$credential);
|
||||
}
|
||||
|
||||
$call = new PPRestCall($apiContext);
|
||||
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payments/payment?" . http_build_query(array_intersect_key($params, $allowedParams)), "GET", $payLoad);
|
||||
|
||||
$ret = new PaymentHistory();
|
||||
$ret->fromJson($json);
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
618
lib/PayPal/Api/PaymentCard.php
Normal file
618
lib/PayPal/Api/PaymentCard.php
Normal file
@@ -0,0 +1,618 @@
|
||||
<?php
|
||||
|
||||
namespace PayPal\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Rest\ApiContext;
|
||||
|
||||
/**
|
||||
* Class PaymentCard
|
||||
*
|
||||
* A resource representing a payment card that can be used to fund a payment.
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
* @property string id
|
||||
* @property string number
|
||||
* @property string type
|
||||
* @property int expire_month
|
||||
* @property int expire_year
|
||||
* @property int start_month
|
||||
* @property int start_year
|
||||
* @property int cvv2
|
||||
* @property string first_name
|
||||
* @property string last_name
|
||||
* @property \PayPal\Api\Address billing_address
|
||||
* @property string external_customer_id
|
||||
* @property string status
|
||||
* @property string valid_until
|
||||
* @property \PayPal\Api\Links links
|
||||
*/
|
||||
class PaymentCard extends PPModel
|
||||
{
|
||||
/**
|
||||
* ID of the credit card being saved for later use.
|
||||
*
|
||||
*
|
||||
* @param string $id
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setId($id)
|
||||
{
|
||||
$this->id = $id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* ID of the credit card being saved for later use.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Card number.
|
||||
*
|
||||
*
|
||||
* @param string $number
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setNumber($number)
|
||||
{
|
||||
$this->number = $number;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Card number.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getNumber()
|
||||
{
|
||||
return $this->number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Type of the Card.
|
||||
* Valid Values: ["VISA", "AMEX", "SOLO", "JCB", "STAR", "DELTA", "DISCOVER", "SWITCH", "MAESTRO", "CB_NATIONALE", "CONFINOGA", "COFIDIS", "ELECTRON", "CETELEM", "CHINA_UNION_PAY", "MASTERCARD"]
|
||||
*
|
||||
* @param string $type
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setType($type)
|
||||
{
|
||||
$this->type = $type;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Type of the Card.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
/**
|
||||
* 2 digit card expiry month.
|
||||
*
|
||||
*
|
||||
* @param int $expire_month
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setExpireMonth($expire_month)
|
||||
{
|
||||
$this->expire_month = $expire_month;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 2 digit card expiry month.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getExpireMonth()
|
||||
{
|
||||
return $this->expire_month;
|
||||
}
|
||||
|
||||
/**
|
||||
* 2 digit card expiry month.
|
||||
*
|
||||
* @deprecated Instead use setExpireMonth
|
||||
*
|
||||
* @param int $expire_month
|
||||
* @return $this
|
||||
*/
|
||||
public function setExpire_month($expire_month)
|
||||
{
|
||||
$this->expire_month = $expire_month;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 2 digit card expiry month.
|
||||
* @deprecated Instead use getExpireMonth
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getExpire_month()
|
||||
{
|
||||
return $this->expire_month;
|
||||
}
|
||||
|
||||
/**
|
||||
* 4 digit card expiry year
|
||||
*
|
||||
*
|
||||
* @param int $expire_year
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setExpireYear($expire_year)
|
||||
{
|
||||
$this->expire_year = $expire_year;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 4 digit card expiry year
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getExpireYear()
|
||||
{
|
||||
return $this->expire_year;
|
||||
}
|
||||
|
||||
/**
|
||||
* 4 digit card expiry year
|
||||
*
|
||||
* @deprecated Instead use setExpireYear
|
||||
*
|
||||
* @param int $expire_year
|
||||
* @return $this
|
||||
*/
|
||||
public function setExpire_year($expire_year)
|
||||
{
|
||||
$this->expire_year = $expire_year;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 4 digit card expiry year
|
||||
* @deprecated Instead use getExpireYear
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getExpire_year()
|
||||
{
|
||||
return $this->expire_year;
|
||||
}
|
||||
|
||||
/**
|
||||
* 2 digit card start month.
|
||||
*
|
||||
*
|
||||
* @param int $start_month
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setStartMonth($start_month)
|
||||
{
|
||||
$this->start_month = $start_month;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 2 digit card start month.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getStartMonth()
|
||||
{
|
||||
return $this->start_month;
|
||||
}
|
||||
|
||||
/**
|
||||
* 2 digit card start month.
|
||||
*
|
||||
* @deprecated Instead use setStartMonth
|
||||
*
|
||||
* @param int $start_month
|
||||
* @return $this
|
||||
*/
|
||||
public function setStart_month($start_month)
|
||||
{
|
||||
$this->start_month = $start_month;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 2 digit card start month.
|
||||
* @deprecated Instead use getStartMonth
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getStart_month()
|
||||
{
|
||||
return $this->start_month;
|
||||
}
|
||||
|
||||
/**
|
||||
* 4 digit card start year.
|
||||
*
|
||||
*
|
||||
* @param int $start_year
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setStartYear($start_year)
|
||||
{
|
||||
$this->start_year = $start_year;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 4 digit card start year.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getStartYear()
|
||||
{
|
||||
return $this->start_year;
|
||||
}
|
||||
|
||||
/**
|
||||
* 4 digit card start year.
|
||||
*
|
||||
* @deprecated Instead use setStartYear
|
||||
*
|
||||
* @param int $start_year
|
||||
* @return $this
|
||||
*/
|
||||
public function setStart_year($start_year)
|
||||
{
|
||||
$this->start_year = $start_year;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 4 digit card start year.
|
||||
* @deprecated Instead use getStartYear
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getStart_year()
|
||||
{
|
||||
return $this->start_year;
|
||||
}
|
||||
|
||||
/**
|
||||
* Card validation code. Only supported when making a Payment but not when saving a payment card for future use.
|
||||
*
|
||||
*
|
||||
* @param int $cvv2
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setCvv2($cvv2)
|
||||
{
|
||||
$this->cvv2 = $cvv2;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Card validation code. Only supported when making a Payment but not when saving a payment card for future use.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getCvv2()
|
||||
{
|
||||
return $this->cvv2;
|
||||
}
|
||||
|
||||
/**
|
||||
* Card holder's first name.
|
||||
*
|
||||
*
|
||||
* @param string $first_name
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setFirstName($first_name)
|
||||
{
|
||||
$this->first_name = $first_name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Card holder's first name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFirstName()
|
||||
{
|
||||
return $this->first_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Card holder's first name.
|
||||
*
|
||||
* @deprecated Instead use setFirstName
|
||||
*
|
||||
* @param string $first_name
|
||||
* @return $this
|
||||
*/
|
||||
public function setFirst_name($first_name)
|
||||
{
|
||||
$this->first_name = $first_name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Card holder's first name.
|
||||
* @deprecated Instead use getFirstName
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFirst_name()
|
||||
{
|
||||
return $this->first_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Card holder's last name.
|
||||
*
|
||||
*
|
||||
* @param string $last_name
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setLastName($last_name)
|
||||
{
|
||||
$this->last_name = $last_name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Card holder's last name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLastName()
|
||||
{
|
||||
return $this->last_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Card holder's last name.
|
||||
*
|
||||
* @deprecated Instead use setLastName
|
||||
*
|
||||
* @param string $last_name
|
||||
* @return $this
|
||||
*/
|
||||
public function setLast_name($last_name)
|
||||
{
|
||||
$this->last_name = $last_name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Card holder's last name.
|
||||
* @deprecated Instead use getLastName
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLast_name()
|
||||
{
|
||||
return $this->last_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Billing Address associated with this card.
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\Address $billing_address
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setBillingAddress($billing_address)
|
||||
{
|
||||
$this->billing_address = $billing_address;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Billing Address associated with this card.
|
||||
*
|
||||
* @return \PayPal\Api\Address
|
||||
*/
|
||||
public function getBillingAddress()
|
||||
{
|
||||
return $this->billing_address;
|
||||
}
|
||||
|
||||
/**
|
||||
* Billing Address associated with this card.
|
||||
*
|
||||
* @deprecated Instead use setBillingAddress
|
||||
*
|
||||
* @param \PayPal\Api\Address $billing_address
|
||||
* @return $this
|
||||
*/
|
||||
public function setBilling_address($billing_address)
|
||||
{
|
||||
$this->billing_address = $billing_address;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Billing Address associated with this card.
|
||||
* @deprecated Instead use getBillingAddress
|
||||
*
|
||||
* @return \PayPal\Api\Address
|
||||
*/
|
||||
public function getBilling_address()
|
||||
{
|
||||
return $this->billing_address;
|
||||
}
|
||||
|
||||
/**
|
||||
* A unique identifier of the customer to whom this card account belongs to. Generated and provided by the facilitator. This is required when creating or using a stored funding instrument in vault.
|
||||
*
|
||||
*
|
||||
* @param string $external_customer_id
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setExternalCustomerId($external_customer_id)
|
||||
{
|
||||
$this->external_customer_id = $external_customer_id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* A unique identifier of the customer to whom this card account belongs to. Generated and provided by the facilitator. This is required when creating or using a stored funding instrument in vault.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getExternalCustomerId()
|
||||
{
|
||||
return $this->external_customer_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* A unique identifier of the customer to whom this card account belongs to. Generated and provided by the facilitator. This is required when creating or using a stored funding instrument in vault.
|
||||
*
|
||||
* @deprecated Instead use setExternalCustomerId
|
||||
*
|
||||
* @param string $external_customer_id
|
||||
* @return $this
|
||||
*/
|
||||
public function setExternal_customer_id($external_customer_id)
|
||||
{
|
||||
$this->external_customer_id = $external_customer_id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* A unique identifier of the customer to whom this card account belongs to. Generated and provided by the facilitator. This is required when creating or using a stored funding instrument in vault.
|
||||
* @deprecated Instead use getExternalCustomerId
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getExternal_customer_id()
|
||||
{
|
||||
return $this->external_customer_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* State of the funding instrument.
|
||||
* Valid Values: ["EXPIRED", "ACTIVE"]
|
||||
*
|
||||
* @param string $status
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setStatus($status)
|
||||
{
|
||||
$this->status = $status;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* State of the funding instrument.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getStatus()
|
||||
{
|
||||
return $this->status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Date/Time until this resource can be used fund a payment.
|
||||
*
|
||||
*
|
||||
* @param string $valid_until
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setValidUntil($valid_until)
|
||||
{
|
||||
$this->valid_until = $valid_until;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Date/Time until this resource can be used fund a payment.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getValidUntil()
|
||||
{
|
||||
return $this->valid_until;
|
||||
}
|
||||
|
||||
/**
|
||||
* Date/Time until this resource can be used fund a payment.
|
||||
*
|
||||
* @deprecated Instead use setValidUntil
|
||||
*
|
||||
* @param string $valid_until
|
||||
* @return $this
|
||||
*/
|
||||
public function setValid_until($valid_until)
|
||||
{
|
||||
$this->valid_until = $valid_until;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Date/Time until this resource can be used fund a payment.
|
||||
* @deprecated Instead use getValidUntil
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getValid_until()
|
||||
{
|
||||
return $this->valid_until;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets Links
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\Links $links
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setLinks($links)
|
||||
{
|
||||
$this->links = $links;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Links
|
||||
*
|
||||
* @return \PayPal\Api\Links[]
|
||||
*/
|
||||
public function getLinks()
|
||||
{
|
||||
return $this->links;
|
||||
}
|
||||
|
||||
}
|
||||
268
lib/PayPal/Api/PaymentCardToken.php
Normal file
268
lib/PayPal/Api/PaymentCardToken.php
Normal file
@@ -0,0 +1,268 @@
|
||||
<?php
|
||||
|
||||
namespace PayPal\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Rest\ApiContext;
|
||||
|
||||
/**
|
||||
* Class PaymentCardToken
|
||||
*
|
||||
* A resource representing a payment card that can be used to fund a payment.
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
* @property string payment_card_id
|
||||
* @property string external_customer_id
|
||||
* @property string last4
|
||||
* @property string type
|
||||
* @property int expire_month
|
||||
* @property int expire_year
|
||||
*/
|
||||
class PaymentCardToken extends PPModel
|
||||
{
|
||||
/**
|
||||
* ID of a previously saved Payment Card resource.
|
||||
*
|
||||
*
|
||||
* @param string $payment_card_id
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setPaymentCardId($payment_card_id)
|
||||
{
|
||||
$this->payment_card_id = $payment_card_id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* ID of a previously saved Payment Card resource.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPaymentCardId()
|
||||
{
|
||||
return $this->payment_card_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* ID of a previously saved Payment Card resource.
|
||||
*
|
||||
* @deprecated Instead use setPaymentCardId
|
||||
*
|
||||
* @param string $payment_card_id
|
||||
* @return $this
|
||||
*/
|
||||
public function setPayment_card_id($payment_card_id)
|
||||
{
|
||||
$this->payment_card_id = $payment_card_id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* ID of a previously saved Payment Card resource.
|
||||
* @deprecated Instead use getPaymentCardId
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPayment_card_id()
|
||||
{
|
||||
return $this->payment_card_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* The unique identifier of the payer used when saving this payment card.
|
||||
*
|
||||
*
|
||||
* @param string $external_customer_id
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setExternalCustomerId($external_customer_id)
|
||||
{
|
||||
$this->external_customer_id = $external_customer_id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The unique identifier of the payer used when saving this payment card.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getExternalCustomerId()
|
||||
{
|
||||
return $this->external_customer_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* The unique identifier of the payer used when saving this payment card.
|
||||
*
|
||||
* @deprecated Instead use setExternalCustomerId
|
||||
*
|
||||
* @param string $external_customer_id
|
||||
* @return $this
|
||||
*/
|
||||
public function setExternal_customer_id($external_customer_id)
|
||||
{
|
||||
$this->external_customer_id = $external_customer_id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The unique identifier of the payer used when saving this payment card.
|
||||
* @deprecated Instead use getExternalCustomerId
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getExternal_customer_id()
|
||||
{
|
||||
return $this->external_customer_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Last 4 digits of the card number from the saved card.
|
||||
*
|
||||
*
|
||||
* @param string $last4
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setLast4($last4)
|
||||
{
|
||||
$this->last4 = $last4;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Last 4 digits of the card number from the saved card.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLast4()
|
||||
{
|
||||
return $this->last4;
|
||||
}
|
||||
|
||||
/**
|
||||
* Type of the Card.
|
||||
* Valid Values: ["VISA", "AMEX", "SOLO", "JCB", "STAR", "DELTA", "DISCOVER", "SWITCH", "MAESTRO", "CB_NATIONALE", "CONFINOGA", "COFIDIS", "ELECTRON", "CETELEM", "CHINA_UNION_PAY", "MASTERCARD"]
|
||||
*
|
||||
* @param string $type
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setType($type)
|
||||
{
|
||||
$this->type = $type;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Type of the Card.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
/**
|
||||
* card expiry month from the saved card with value 1 - 12
|
||||
*
|
||||
*
|
||||
* @param int $expire_month
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setExpireMonth($expire_month)
|
||||
{
|
||||
$this->expire_month = $expire_month;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* card expiry month from the saved card with value 1 - 12
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getExpireMonth()
|
||||
{
|
||||
return $this->expire_month;
|
||||
}
|
||||
|
||||
/**
|
||||
* card expiry month from the saved card with value 1 - 12
|
||||
*
|
||||
* @deprecated Instead use setExpireMonth
|
||||
*
|
||||
* @param int $expire_month
|
||||
* @return $this
|
||||
*/
|
||||
public function setExpire_month($expire_month)
|
||||
{
|
||||
$this->expire_month = $expire_month;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* card expiry month from the saved card with value 1 - 12
|
||||
* @deprecated Instead use getExpireMonth
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getExpire_month()
|
||||
{
|
||||
return $this->expire_month;
|
||||
}
|
||||
|
||||
/**
|
||||
* 4 digit card expiry year from the saved card
|
||||
*
|
||||
*
|
||||
* @param int $expire_year
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setExpireYear($expire_year)
|
||||
{
|
||||
$this->expire_year = $expire_year;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 4 digit card expiry year from the saved card
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getExpireYear()
|
||||
{
|
||||
return $this->expire_year;
|
||||
}
|
||||
|
||||
/**
|
||||
* 4 digit card expiry year from the saved card
|
||||
*
|
||||
* @deprecated Instead use setExpireYear
|
||||
*
|
||||
* @param int $expire_year
|
||||
* @return $this
|
||||
*/
|
||||
public function setExpire_year($expire_year)
|
||||
{
|
||||
$this->expire_year = $expire_year;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 4 digit card expiry year from the saved card
|
||||
* @deprecated Instead use getExpireYear
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getExpire_year()
|
||||
{
|
||||
return $this->expire_year;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,14 +8,18 @@ use PayPal\Rest\ApiContext;
|
||||
/**
|
||||
* Class PaymentExecution
|
||||
*
|
||||
* Let's you execute a PayPal Account based Payment resource with the payer_id obtained from web approval url.
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
* @property string payer_id
|
||||
* @property \PayPal\Api\Transactions transactions
|
||||
*/
|
||||
class PaymentExecution extends PPModel
|
||||
{
|
||||
/**
|
||||
* Set Payer ID
|
||||
* PayPal assigned Payer ID returned in the approval return url
|
||||
* PayPal assigned Payer ID returned in the approval return url.
|
||||
*
|
||||
*
|
||||
* @param string $payer_id
|
||||
*
|
||||
@@ -24,13 +28,11 @@ class PaymentExecution extends PPModel
|
||||
public function setPayerId($payer_id)
|
||||
{
|
||||
$this->payer_id = $payer_id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Payer ID
|
||||
* PayPal assigned Payer ID returned in the approval return url
|
||||
* PayPal assigned Payer ID returned in the approval return url.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -40,27 +42,22 @@ class PaymentExecution extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Payer ID
|
||||
* PayPal assigned Payer ID returned in the approval return url
|
||||
* PayPal assigned Payer ID returned in the approval return url.
|
||||
*
|
||||
* @deprecated Instead use setPayerId
|
||||
*
|
||||
* @param string $payer_id
|
||||
*
|
||||
* @deprecated Use setPayerId
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setPayer_id($payer_id)
|
||||
{
|
||||
$this->payer_id = $payer_id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Payer ID
|
||||
* PayPal assigned Payer ID returned in the approval return url
|
||||
*
|
||||
* @deprecated Use getPayerId
|
||||
* PayPal assigned Payer ID returned in the approval return url.
|
||||
* @deprecated Instead use getPayerId
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -70,8 +67,8 @@ class PaymentExecution extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Transactions
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\Transactions $transactions
|
||||
*
|
||||
@@ -84,13 +81,13 @@ class PaymentExecution extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Transactions
|
||||
* 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[]
|
||||
*/
|
||||
public function getTransactions()
|
||||
{
|
||||
return $this->transactions;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,6 +8,10 @@ use PayPal\Rest\ApiContext;
|
||||
/**
|
||||
* Class PaymentHistory
|
||||
*
|
||||
* A list of Payment Resources
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
* @property \PayPal\Api\Payment payments
|
||||
* @property int count
|
||||
* @property string next_id
|
||||
@@ -15,9 +19,9 @@ use PayPal\Rest\ApiContext;
|
||||
class PaymentHistory extends PPModel
|
||||
{
|
||||
/**
|
||||
* Set Payments
|
||||
* A list of Payment resources
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\Payment $payments
|
||||
*
|
||||
* @return $this
|
||||
@@ -25,15 +29,13 @@ class PaymentHistory extends PPModel
|
||||
public function setPayments($payments)
|
||||
{
|
||||
$this->payments = $payments;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Payments
|
||||
* A list of Payment resources
|
||||
*
|
||||
* @return \PayPal\Api\Payment
|
||||
* @return \PayPal\Api\Payment[]
|
||||
*/
|
||||
public function getPayments()
|
||||
{
|
||||
@@ -41,9 +43,8 @@ class PaymentHistory extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Count
|
||||
* 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 int $count
|
||||
*
|
||||
@@ -56,9 +57,7 @@ class PaymentHistory extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Count
|
||||
* 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 int
|
||||
*/
|
||||
@@ -68,8 +67,8 @@ class PaymentHistory extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Next ID
|
||||
* Identifier of the next element to get the next range of results
|
||||
* Identifier of the next element to get the next range of results.
|
||||
*
|
||||
*
|
||||
* @param string $next_id
|
||||
*
|
||||
@@ -82,8 +81,7 @@ class PaymentHistory extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Next ID
|
||||
* Identifier of the next element to get the next range of results
|
||||
* Identifier of the next element to get the next range of results.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -93,27 +91,22 @@ class PaymentHistory extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Next ID
|
||||
* Identifier of the next element to get the next range of results
|
||||
* Identifier of the next element to get the next range of results.
|
||||
*
|
||||
* @deprecated Instead use setNextId
|
||||
*
|
||||
* @param string $next_id
|
||||
*
|
||||
* @deprecated Use setNextId
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setNext_id($next_id)
|
||||
{
|
||||
$this->next_id = $next_id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Next ID
|
||||
* Identifier of the next element to get the next range of results
|
||||
*
|
||||
* @deprecated Use getNextId
|
||||
* Identifier of the next element to get the next range of results.
|
||||
* @deprecated Instead use getNextId
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -121,4 +114,5 @@ class PaymentHistory extends PPModel
|
||||
{
|
||||
return $this->next_id;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
68
lib/PayPal/Api/PaymentOptions.php
Normal file
68
lib/PayPal/Api/PaymentOptions.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace PayPal\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Rest\ApiContext;
|
||||
|
||||
/**
|
||||
* Class PaymentOptions
|
||||
*
|
||||
* Payment options requested for this purchase unit
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
* @property string allowed_payment_method
|
||||
*/
|
||||
class PaymentOptions extends PPModel
|
||||
{
|
||||
/**
|
||||
* Payment method requested for this purchase unit
|
||||
* Valid Values: ["UNRESTRICTED", "INSTANT_FUNDING_SOURCE", "IMMEDIATE_PAY"]
|
||||
*
|
||||
* @param string $allowed_payment_method
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setAllowedPaymentMethod($allowed_payment_method)
|
||||
{
|
||||
$this->allowed_payment_method = $allowed_payment_method;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Payment method requested for this purchase unit
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAllowedPaymentMethod()
|
||||
{
|
||||
return $this->allowed_payment_method;
|
||||
}
|
||||
|
||||
/**
|
||||
* Payment method requested for this purchase unit
|
||||
*
|
||||
* @deprecated Instead use setAllowedPaymentMethod
|
||||
*
|
||||
* @param string $allowed_payment_method
|
||||
* @return $this
|
||||
*/
|
||||
public function setAllowed_payment_method($allowed_payment_method)
|
||||
{
|
||||
$this->allowed_payment_method = $allowed_payment_method;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Payment method requested for this purchase unit
|
||||
* @deprecated Instead use getAllowedPaymentMethod
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAllowed_payment_method()
|
||||
{
|
||||
return $this->allowed_payment_method;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,15 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace PayPal\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Rest\ApiContext;
|
||||
|
||||
/**
|
||||
* Class Phone
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
* @property string country_code
|
||||
* @property string national_number
|
||||
* @property string extension
|
||||
*/
|
||||
class Phone extends PPModel
|
||||
{
|
||||
/**
|
||||
* Country code (in E.164 format). Assume length is n.
|
||||
* Country code (from in E.164 format)
|
||||
*
|
||||
*
|
||||
* @param string $country_code
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setCountryCode($country_code)
|
||||
{
|
||||
@@ -18,7 +33,7 @@ class Phone extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Country code (in E.164 format). Assume length is n.
|
||||
* Country code (from in E.164 format)
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -28,10 +43,12 @@ class Phone extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Country code (in E.164 format). Assume length is n.
|
||||
* Country code (from in E.164 format)
|
||||
*
|
||||
* @deprecated Instead use setCountryCode
|
||||
*
|
||||
* @param string $country_code
|
||||
* @deprecated. Instead use setCountryCode
|
||||
* @return $this
|
||||
*/
|
||||
public function setCountry_code($country_code)
|
||||
{
|
||||
@@ -40,10 +57,10 @@ class Phone extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Country code (in E.164 format). Assume length is n.
|
||||
* Country code (from in E.164 format)
|
||||
* @deprecated Instead use getCountryCode
|
||||
*
|
||||
* @return string
|
||||
* @deprecated. Instead use getCountryCode
|
||||
*/
|
||||
public function getCountry_code()
|
||||
{
|
||||
@@ -51,9 +68,12 @@ class Phone extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* In-country phone number (in E.164 format). Maximum (15 - n) digits.
|
||||
* In-country phone number (from in E.164 format)
|
||||
*
|
||||
*
|
||||
* @param string $national_number
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setNationalNumber($national_number)
|
||||
{
|
||||
@@ -62,7 +82,7 @@ class Phone extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* In-country phone number (in E.164 format). Maximum (15 - n) digits.
|
||||
* In-country phone number (from in E.164 format)
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -72,10 +92,12 @@ class Phone extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* In-country phone number (in E.164 format). Maximum (15 - n) digits.
|
||||
* In-country phone number (from in E.164 format)
|
||||
*
|
||||
* @deprecated Instead use setNationalNumber
|
||||
*
|
||||
* @param string $national_number
|
||||
* @deprecated. Instead use setNationalNumber
|
||||
* @return $this
|
||||
*/
|
||||
public function setNational_number($national_number)
|
||||
{
|
||||
@@ -84,14 +106,38 @@ class Phone extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* In-country phone number (in E.164 format). Maximum (15 - n) digits.
|
||||
* In-country phone number (from in E.164 format)
|
||||
* @deprecated Instead use getNationalNumber
|
||||
*
|
||||
* @return string
|
||||
* @deprecated. Instead use getNationalNumber
|
||||
*/
|
||||
public function getNational_number()
|
||||
{
|
||||
return $this->national_number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Phone extension
|
||||
*
|
||||
*
|
||||
* @param string $extension
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setExtension($extension)
|
||||
{
|
||||
$this->extension = $extension;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Phone extension
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getExtension()
|
||||
{
|
||||
return $this->extension;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,37 +4,37 @@ namespace PayPal\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Rest\ApiContext;
|
||||
use PayPal\Validation\UrlValidator;
|
||||
|
||||
/**
|
||||
* Class RedirectUrls
|
||||
*
|
||||
* Redirect urls required only when using payment_method as PayPal - the only settings supported are return and cancel urls.
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
* @property string return_url
|
||||
* @property string cancel_url
|
||||
*/
|
||||
class RedirectUrls extends PPModel
|
||||
{
|
||||
/**
|
||||
* Set Return URL
|
||||
* 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
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
* @return $this
|
||||
*/
|
||||
public function setReturnUrl($return_url)
|
||||
{
|
||||
if (filter_var($return_url, FILTER_VALIDATE_URL) === false) {
|
||||
throw new \InvalidArgumentException("Return URL is not a fully qualified URL");
|
||||
}
|
||||
|
||||
UrlValidator::validate($return_url, "ReturnUrl");
|
||||
$this->return_url = $return_url;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Return URL
|
||||
* 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
|
||||
*/
|
||||
@@ -44,27 +44,22 @@ class RedirectUrls extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Return URL
|
||||
* Url where the payer would be redirected to after approving the payment
|
||||
* Url where the payer would be redirected to after approving the payment.
|
||||
*
|
||||
* @deprecated Instead use setReturnUrl
|
||||
*
|
||||
* @param string $return_url
|
||||
*
|
||||
* @deprecated Use setReturnUrl
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setReturn_url($return_url)
|
||||
{
|
||||
$this->return_url = $return_url;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Return URL
|
||||
* Url where the payer would be redirected to after approving the payment
|
||||
*
|
||||
* @deprecated Use getReturnUrl
|
||||
* Url where the payer would be redirected to after approving the payment.
|
||||
* @deprecated Instead use getReturnUrl
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -74,26 +69,22 @@ class RedirectUrls extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Cancel URL
|
||||
* Url where the payer would be redirected to after canceling the payment
|
||||
* Url where the payer would be redirected to after canceling the payment.
|
||||
*
|
||||
*
|
||||
* @param string $cancel_url
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
* @return $this
|
||||
*/
|
||||
public function setCancelUrl($cancel_url)
|
||||
{
|
||||
if (filter_var($cancel_url, FILTER_VALIDATE_URL) === false) {
|
||||
throw new \InvalidArgumentException("Cancel URL is not a fully qualified URL");
|
||||
}
|
||||
UrlValidator::validate($cancel_url, "CancelUrl");
|
||||
$this->cancel_url = $cancel_url;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Cancel URL
|
||||
* Url where the payer would be redirected to after canceling the payment
|
||||
* Url where the payer would be redirected to after canceling the payment.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -103,27 +94,22 @@ class RedirectUrls extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Cancel URL
|
||||
* Url where the payer would be redirected to after canceling the payment
|
||||
* Url where the payer would be redirected to after canceling the payment.
|
||||
*
|
||||
* @deprecated Instead use setCancelUrl
|
||||
*
|
||||
* @param string $cancel_url
|
||||
*
|
||||
* @deprecated Use setCancelUrl
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setCancel_url($cancel_url)
|
||||
{
|
||||
$this->cancel_url = $cancel_url;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Cancel URL
|
||||
* Url where the payer would be redirected to after canceling the payment
|
||||
*
|
||||
* @deprecated Use getCancelUrl
|
||||
* Url where the payer would be redirected to after canceling the payment.
|
||||
* @deprecated Instead use getCancelUrl
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -131,4 +117,5 @@ class RedirectUrls extends PPModel
|
||||
{
|
||||
return $this->cancel_url;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,32 +6,40 @@ use PayPal\Common\PPModel;
|
||||
use PayPal\Rest\ApiContext;
|
||||
use PayPal\Rest\IResource;
|
||||
use PayPal\Transport\PPRestCall;
|
||||
use PayPal\Validation\ArgumentValidator;
|
||||
|
||||
/**
|
||||
* Class Refund
|
||||
*
|
||||
* A refund transaction.
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
* @property string id
|
||||
* @property string create_time
|
||||
* @property string update_time
|
||||
* @property \PayPal\Api\Amount amount
|
||||
* @property string state
|
||||
* @property string sale_id
|
||||
* @property string capture_id
|
||||
* @property string parent_payment
|
||||
* @property string description
|
||||
* @property \PayPal\Api\Links links
|
||||
*/
|
||||
class Refund extends PPModel implements IResource
|
||||
{
|
||||
/**
|
||||
* @var
|
||||
* OAuth Credentials to use for this call
|
||||
*
|
||||
* @var \PayPal\Auth\OAuthTokenCredential $credential
|
||||
*/
|
||||
private static $credential;
|
||||
protected static $credential;
|
||||
|
||||
/**
|
||||
* Set Credential
|
||||
*
|
||||
* @param $credential
|
||||
* Sets Credential
|
||||
*
|
||||
* @deprecated Pass ApiContext to create/get methods instead
|
||||
* @param \PayPal\Auth\OAuthTokenCredential $credential
|
||||
*/
|
||||
public static function setCredential($credential)
|
||||
{
|
||||
@@ -39,8 +47,8 @@ class Refund extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set ID
|
||||
* Identifier of the refund transaction
|
||||
* Identifier of the refund transaction in UTC ISO8601 format.
|
||||
*
|
||||
*
|
||||
* @param string $id
|
||||
*
|
||||
@@ -49,13 +57,11 @@ class Refund extends PPModel implements IResource
|
||||
public function setId($id)
|
||||
{
|
||||
$this->id = $id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get ID
|
||||
* Identifier of the refund transaction
|
||||
* Identifier of the refund transaction in UTC ISO8601 format.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -65,8 +71,8 @@ class Refund extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Create Time
|
||||
* Time the resource was created
|
||||
* Time the resource was created in UTC ISO8601 format.
|
||||
*
|
||||
*
|
||||
* @param string $create_time
|
||||
*
|
||||
@@ -75,13 +81,11 @@ class Refund extends PPModel implements IResource
|
||||
public function setCreateTime($create_time)
|
||||
{
|
||||
$this->create_time = $create_time;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Create Time
|
||||
* Time the resource was created
|
||||
* Time the resource was created in UTC ISO8601 format.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -91,27 +95,22 @@ class Refund extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Create Time
|
||||
* Time the resource was created
|
||||
* Time the resource was created in UTC ISO8601 format.
|
||||
*
|
||||
* @deprecated Instead use setCreateTime
|
||||
*
|
||||
* @param string $create_time
|
||||
*
|
||||
* @deprecated Use setCreateTime
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setCreate_time($create_time)
|
||||
{
|
||||
$this->create_time = $create_time;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Create Time
|
||||
* Time the resource was created
|
||||
*
|
||||
* @deprecated Use getCreateTime
|
||||
* Time the resource was created in UTC ISO8601 format.
|
||||
* @deprecated Instead use getCreateTime
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -121,9 +120,57 @@ class Refund extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Amount
|
||||
* Details including both refunded amount (to Payer) and refunded fee (to Payee)
|
||||
* If amount is not specified, it's assumed to be full refund
|
||||
* Time the resource was last updated in UTC ISO8601 format.
|
||||
*
|
||||
*
|
||||
* @param string $update_time
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setUpdateTime($update_time)
|
||||
{
|
||||
$this->update_time = $update_time;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Time the resource was last updated in UTC ISO8601 format.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getUpdateTime()
|
||||
{
|
||||
return $this->update_time;
|
||||
}
|
||||
|
||||
/**
|
||||
* Time the resource was last updated in UTC ISO8601 format.
|
||||
*
|
||||
* @deprecated Instead use setUpdateTime
|
||||
*
|
||||
* @param string $update_time
|
||||
* @return $this
|
||||
*/
|
||||
public function setUpdate_time($update_time)
|
||||
{
|
||||
$this->update_time = $update_time;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Time the resource was last updated in UTC ISO8601 format.
|
||||
* @deprecated Instead use getUpdateTime
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getUpdate_time()
|
||||
{
|
||||
return $this->update_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.
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\Amount $amount
|
||||
*
|
||||
@@ -132,14 +179,11 @@ class Refund extends PPModel implements IResource
|
||||
public function setAmount($amount)
|
||||
{
|
||||
$this->amount = $amount;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Amount
|
||||
* 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
|
||||
*/
|
||||
@@ -149,8 +193,8 @@ class Refund extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set State
|
||||
* State of the refund transaction
|
||||
* State of the refund transaction.
|
||||
* Valid Values: ["pending", "completed", "failed"]
|
||||
*
|
||||
* @param string $state
|
||||
*
|
||||
@@ -159,13 +203,11 @@ class Refund extends PPModel implements IResource
|
||||
public function setState($state)
|
||||
{
|
||||
$this->state = $state;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get State
|
||||
* State of the refund transaction
|
||||
* State of the refund transaction.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -175,8 +217,8 @@ class Refund extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Sale ID
|
||||
* ID of the Sale transaction being refunded
|
||||
* ID of the Sale transaction being refunded.
|
||||
*
|
||||
*
|
||||
* @param string $sale_id
|
||||
*
|
||||
@@ -185,13 +227,11 @@ class Refund extends PPModel implements IResource
|
||||
public function setSaleId($sale_id)
|
||||
{
|
||||
$this->sale_id = $sale_id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Sale ID
|
||||
* ID of the Sale transaction being refunded
|
||||
* ID of the Sale transaction being refunded.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -201,27 +241,22 @@ class Refund extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Sale ID
|
||||
* ID of the Sale transaction being refunded
|
||||
* ID of the Sale transaction being refunded.
|
||||
*
|
||||
* @deprecated Instead use setSaleId
|
||||
*
|
||||
* @param string $sale_id
|
||||
*
|
||||
* @deprecated Use setSaleId
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setSale_id($sale_id)
|
||||
{
|
||||
$this->sale_id = $sale_id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Sale ID
|
||||
* ID of the Sale transaction being refunded
|
||||
*
|
||||
* @deprecated Use getSaleId
|
||||
* ID of the Sale transaction being refunded.
|
||||
* @deprecated Instead use getSaleId
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -231,8 +266,8 @@ class Refund extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Capture ID
|
||||
* ID of the Capture transaction being refunded
|
||||
* ID of the Capture transaction being refunded.
|
||||
*
|
||||
*
|
||||
* @param string $capture_id
|
||||
*
|
||||
@@ -241,13 +276,11 @@ class Refund extends PPModel implements IResource
|
||||
public function setCaptureId($capture_id)
|
||||
{
|
||||
$this->capture_id = $capture_id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Capture ID
|
||||
* ID of the Capture transaction being refunded
|
||||
* ID of the Capture transaction being refunded.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -257,27 +290,22 @@ class Refund extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Capture ID
|
||||
* ID of the Capture transaction being refunded
|
||||
* ID of the Capture transaction being refunded.
|
||||
*
|
||||
* @deprecated Instead use setCaptureId
|
||||
*
|
||||
* @param string $capture_id
|
||||
*
|
||||
* @deprecated Use setCaptureId
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setCapture_id($capture_id)
|
||||
{
|
||||
$this->capture_id = $capture_id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Capture ID
|
||||
* ID of the Capture transaction being refunded
|
||||
*
|
||||
* @deprecated Use getCaptureId
|
||||
* ID of the Capture transaction being refunded.
|
||||
* @deprecated Instead use getCaptureId
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -287,8 +315,8 @@ class Refund extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Parent Payment
|
||||
* 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
|
||||
*
|
||||
@@ -297,13 +325,11 @@ class Refund extends PPModel implements IResource
|
||||
public function setParentPayment($parent_payment)
|
||||
{
|
||||
$this->parent_payment = $parent_payment;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Parent Payment
|
||||
* ID of the Payment resource that this transaction is based on
|
||||
* ID of the Payment resource that this transaction is based on.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -313,27 +339,22 @@ class Refund extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Parent Payment
|
||||
* ID of the Payment resource that this transaction is based on
|
||||
* ID of the Payment resource that this transaction is based on.
|
||||
*
|
||||
* @deprecated Instead use setParentPayment
|
||||
*
|
||||
* @param string $parent_payment
|
||||
*
|
||||
* @deprecated Use setParentPayment
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setParent_payment($parent_payment)
|
||||
{
|
||||
$this->parent_payment = $parent_payment;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Parent Payment
|
||||
* ID of the Payment resource that this transaction is based on
|
||||
*
|
||||
* @deprecated Use getParentPayment
|
||||
* ID of the Payment resource that this transaction is based on.
|
||||
* @deprecated Instead use getParentPayment
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -343,7 +364,32 @@ class Refund extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Links
|
||||
* Description of what is being refunded for.
|
||||
*
|
||||
*
|
||||
* @param string $description
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setDescription($description)
|
||||
{
|
||||
$this->description = $description;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of what is being refunded for.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDescription()
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets Links
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\Links $links
|
||||
*
|
||||
@@ -352,14 +398,13 @@ class Refund extends PPModel implements IResource
|
||||
public function setLinks($links)
|
||||
{
|
||||
$this->links = $links;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Links
|
||||
* Gets Links
|
||||
*
|
||||
* @return \PayPal\Api\Links
|
||||
* @return \PayPal\Api\Links[]
|
||||
*/
|
||||
public function getLinks()
|
||||
{
|
||||
@@ -367,32 +412,25 @@ class Refund extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Get
|
||||
*
|
||||
* @param $refundId
|
||||
* @param null $apiContext
|
||||
* Obtain the Refund transaction resource for the given identifier.
|
||||
*
|
||||
* @param string $refundId
|
||||
* @param \PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
||||
* @return Refund
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public static function get($refundId, $apiContext = null)
|
||||
{
|
||||
if (($refundId == null) || (strlen($refundId) <= 0)) {
|
||||
throw new \InvalidArgumentException("refundId cannot be null or empty");
|
||||
}
|
||||
ArgumentValidator::validate($refundId, 'refundId');
|
||||
|
||||
$payLoad = "";
|
||||
|
||||
if ($apiContext == null) {
|
||||
$apiContext = new ApiContext(self::$credential);
|
||||
}
|
||||
|
||||
$call = new PPRestCall($apiContext);
|
||||
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payments/refund/$refundId", "GET", $payLoad);
|
||||
|
||||
$ret = new Refund();
|
||||
$ret->fromJson($json);
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,17 +8,22 @@ use PayPal\Rest\ApiContext;
|
||||
/**
|
||||
* Class RelatedResources
|
||||
*
|
||||
* Each one representing a financial transaction (Sale, Authorization, Capture, Refund) related to the payment.
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
* @property \PayPal\Api\Sale sale
|
||||
* @property \PayPal\Api\Authorization authorization
|
||||
* @property \PayPal\Api\Order order
|
||||
* @property \PayPal\Api\Capture capture
|
||||
* @property \PayPal\Api\Refund refund
|
||||
*/
|
||||
class RelatedResources extends PPModel
|
||||
{
|
||||
/**
|
||||
* Set Sale
|
||||
* A sale transaction
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\Sale $sale
|
||||
*
|
||||
* @return $this
|
||||
@@ -30,7 +35,6 @@ class RelatedResources extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Sale
|
||||
* A sale transaction
|
||||
*
|
||||
* @return \PayPal\Api\Sale
|
||||
@@ -41,9 +45,9 @@ class RelatedResources extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Authorization
|
||||
* An authorization transaction
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\Authorization $authorization
|
||||
*
|
||||
* @return $this
|
||||
@@ -55,7 +59,6 @@ class RelatedResources extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Authorization
|
||||
* An authorization transaction
|
||||
*
|
||||
* @return \PayPal\Api\Authorization
|
||||
@@ -66,9 +69,33 @@ class RelatedResources extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Capture
|
||||
* An order transaction
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\Order $order
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setOrder($order)
|
||||
{
|
||||
$this->order = $order;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* An order transaction
|
||||
*
|
||||
* @return \PayPal\Api\Order
|
||||
*/
|
||||
public function getOrder()
|
||||
{
|
||||
return $this->order;
|
||||
}
|
||||
|
||||
/**
|
||||
* A capture transaction
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\Capture $capture
|
||||
*
|
||||
* @return $this
|
||||
@@ -80,7 +107,6 @@ class RelatedResources extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Capture
|
||||
* A capture transaction
|
||||
*
|
||||
* @return \PayPal\Api\Capture
|
||||
@@ -91,9 +117,9 @@ class RelatedResources extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Refund
|
||||
* A refund transaction
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\Refund $refund
|
||||
*
|
||||
* @return $this
|
||||
@@ -105,7 +131,6 @@ class RelatedResources extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Refund
|
||||
* A refund transaction
|
||||
*
|
||||
* @return \PayPal\Api\Refund
|
||||
@@ -115,27 +140,4 @@ class RelatedResources extends PPModel
|
||||
return $this->refund;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Order
|
||||
*
|
||||
* @param \PayPal\Api\Order $order
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setOrder($order)
|
||||
{
|
||||
$this->order = $order;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Order
|
||||
*
|
||||
* @return \PayPal\Api\Order
|
||||
*/
|
||||
public function getOrder()
|
||||
{
|
||||
return $this->order;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,31 +7,43 @@ use PayPal\Rest\ApiContext;
|
||||
use PayPal\Rest\IResource;
|
||||
use PayPal\Api\Refund;
|
||||
use PayPal\Transport\PPRestCall;
|
||||
use PayPal\Validation\ArgumentValidator;
|
||||
|
||||
/**
|
||||
* Class Sale
|
||||
*
|
||||
* A sale transaction.
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
* @property string id
|
||||
* @property string create_time
|
||||
* @property string update_time
|
||||
* @property \PayPal\Api\Amount amount
|
||||
* @property string payment_mode
|
||||
* @property string pending_reason
|
||||
* @property string state
|
||||
* @property string reason_code
|
||||
* @property string protection_eligibility
|
||||
* @property string protection_eligibility_type
|
||||
* @property string clearing_time
|
||||
* @property string parent_payment
|
||||
* @property \PayPal\Api\Links links
|
||||
*/
|
||||
class Sale extends PPModel implements IResource
|
||||
{
|
||||
/**
|
||||
* @var
|
||||
* OAuth Credentials to use for this call
|
||||
*
|
||||
* @var \PayPal\Auth\OAuthTokenCredential $credential
|
||||
*/
|
||||
private static $credential;
|
||||
protected static $credential;
|
||||
|
||||
/**
|
||||
* Set Credential
|
||||
*
|
||||
* @param $credential
|
||||
* Sets Credential
|
||||
*
|
||||
* @deprecated Pass ApiContext to create/get methods instead
|
||||
* @param \PayPal\Auth\OAuthTokenCredential $credential
|
||||
*/
|
||||
public static function setCredential($credential)
|
||||
{
|
||||
@@ -39,8 +51,8 @@ class Sale extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set ID
|
||||
* Identifier of the authorization transaction
|
||||
* Identifier of the authorization transaction.
|
||||
*
|
||||
*
|
||||
* @param string $id
|
||||
*
|
||||
@@ -49,13 +61,11 @@ class Sale extends PPModel implements IResource
|
||||
public function setId($id)
|
||||
{
|
||||
$this->id = $id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get ID
|
||||
* Identifier of the authorization transaction
|
||||
* Identifier of the authorization transaction.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -65,8 +75,8 @@ class Sale extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Create Time
|
||||
* Time the resource was created
|
||||
* Time the resource was created.
|
||||
*
|
||||
*
|
||||
* @param string $create_time
|
||||
*
|
||||
@@ -75,13 +85,11 @@ class Sale extends PPModel implements IResource
|
||||
public function setCreateTime($create_time)
|
||||
{
|
||||
$this->create_time = $create_time;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Create Time
|
||||
* Time the resource was created
|
||||
* Time the resource was created.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -91,27 +99,22 @@ class Sale extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Create Time
|
||||
* Time the resource was created
|
||||
* Time the resource was created.
|
||||
*
|
||||
* @deprecated Instead use setCreateTime
|
||||
*
|
||||
* @param string $create_time
|
||||
*
|
||||
* @deprecated Use setCreateTime
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setCreate_time($create_time)
|
||||
{
|
||||
$this->create_time = $create_time;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Create Time
|
||||
* Time the resource was created
|
||||
*
|
||||
* @deprecated Use getCreateTime
|
||||
* Time the resource was created.
|
||||
* @deprecated Instead use getCreateTime
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -121,8 +124,8 @@ class Sale extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Update Time
|
||||
* Time the resource was last updated
|
||||
* Time the resource was last updated.
|
||||
*
|
||||
*
|
||||
* @param string $update_time
|
||||
*
|
||||
@@ -131,13 +134,11 @@ class Sale extends PPModel implements IResource
|
||||
public function setUpdateTime($update_time)
|
||||
{
|
||||
$this->update_time = $update_time;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Update Time
|
||||
* Time the resource was last updated
|
||||
* Time the resource was last updated.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -147,27 +148,22 @@ class Sale extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Update Time
|
||||
* Time the resource was last updated
|
||||
* Time the resource was last updated.
|
||||
*
|
||||
* @deprecated Instead use setUpdateTime
|
||||
*
|
||||
* @param string $update_time
|
||||
*
|
||||
* @deprecated Use setUpdateTime
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setUpdate_time($update_time)
|
||||
{
|
||||
$this->update_time = $update_time;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Update Time
|
||||
* Time the resource was last updated
|
||||
*
|
||||
* @deprecated Use getUpdateTime
|
||||
* Time the resource was last updated.
|
||||
* @deprecated Instead use getUpdateTime
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -177,8 +173,8 @@ class Sale extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Amount
|
||||
* Amount being collected
|
||||
* Amount being collected.
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\Amount $amount
|
||||
*
|
||||
@@ -187,13 +183,11 @@ class Sale extends PPModel implements IResource
|
||||
public function setAmount($amount)
|
||||
{
|
||||
$this->amount = $amount;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Amount
|
||||
* Amount being collected
|
||||
* Amount being collected.
|
||||
*
|
||||
* @return \PayPal\Api\Amount
|
||||
*/
|
||||
@@ -203,8 +197,106 @@ class Sale extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set State
|
||||
* State of the sale transaction
|
||||
* specifies payment mode of the transaction
|
||||
* Valid Values: ["INSTANT_TRANSFER", "MANUAL_BANK_TRANSFER", "DELAYED_TRANSFER", "ECHECK"]
|
||||
*
|
||||
* @param string $payment_mode
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setPaymentMode($payment_mode)
|
||||
{
|
||||
$this->payment_mode = $payment_mode;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* specifies payment mode of the transaction
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPaymentMode()
|
||||
{
|
||||
return $this->payment_mode;
|
||||
}
|
||||
|
||||
/**
|
||||
* specifies payment mode of the transaction
|
||||
*
|
||||
* @deprecated Instead use setPaymentMode
|
||||
*
|
||||
* @param string $payment_mode
|
||||
* @return $this
|
||||
*/
|
||||
public function setPayment_mode($payment_mode)
|
||||
{
|
||||
$this->payment_mode = $payment_mode;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* specifies payment mode of the transaction
|
||||
* @deprecated Instead use getPaymentMode
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPayment_mode()
|
||||
{
|
||||
return $this->payment_mode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reason of Pending transaction.
|
||||
*
|
||||
*
|
||||
* @param string $pending_reason
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setPendingReason($pending_reason)
|
||||
{
|
||||
$this->pending_reason = $pending_reason;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reason of Pending transaction.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPendingReason()
|
||||
{
|
||||
return $this->pending_reason;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reason of Pending transaction.
|
||||
*
|
||||
* @deprecated Instead use setPendingReason
|
||||
*
|
||||
* @param string $pending_reason
|
||||
* @return $this
|
||||
*/
|
||||
public function setPending_reason($pending_reason)
|
||||
{
|
||||
$this->pending_reason = $pending_reason;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reason of Pending transaction.
|
||||
* @deprecated Instead use getPendingReason
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPending_reason()
|
||||
{
|
||||
return $this->pending_reason;
|
||||
}
|
||||
|
||||
/**
|
||||
* State of the sale transaction.
|
||||
* Valid Values: ["pending", "completed", "refunded", "partially_refunded"]
|
||||
*
|
||||
* @param string $state
|
||||
*
|
||||
@@ -213,13 +305,11 @@ class Sale extends PPModel implements IResource
|
||||
public function setState($state)
|
||||
{
|
||||
$this->state = $state;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get State
|
||||
* State of the sale transaction
|
||||
* State of the sale transaction.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -229,8 +319,204 @@ class Sale extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Parent Payment
|
||||
* ID of the Payment resource that this transaction is based on
|
||||
* Reason code for the transaction state being Pending or Reversed.
|
||||
* Valid Values: ["CHARGEBACK", "GUARANTEE", "BUYER_COMPLAINT", "REFUND", "UNCONFIRMED_SHIPPING_ADDRESS", "ECHECK", "INTERNATIONAL_WITHDRAWAL", "RECEIVING_PREFERENCE_MANDATES_MANUAL_ACTION", "PAYMENT_REVIEW", "REGULATORY_REVIEW", "UNILATERAL", "VERIFICATION_REQUIRED"]
|
||||
*
|
||||
* @param string $reason_code
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setReasonCode($reason_code)
|
||||
{
|
||||
$this->reason_code = $reason_code;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reason code for the transaction state being Pending or Reversed.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getReasonCode()
|
||||
{
|
||||
return $this->reason_code;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reason code for the transaction state being Pending or Reversed.
|
||||
*
|
||||
* @deprecated Instead use setReasonCode
|
||||
*
|
||||
* @param string $reason_code
|
||||
* @return $this
|
||||
*/
|
||||
public function setReason_code($reason_code)
|
||||
{
|
||||
$this->reason_code = $reason_code;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reason code for the transaction state being Pending or Reversed.
|
||||
* @deprecated Instead use getReasonCode
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getReason_code()
|
||||
{
|
||||
return $this->reason_code;
|
||||
}
|
||||
|
||||
/**
|
||||
* Protection Eligibility of the Payer
|
||||
* Valid Values: ["ELIGIBLE", "PARTIALLY_ELIGIBLE", "INELIGIBLE"]
|
||||
*
|
||||
* @param string $protection_eligibility
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setProtectionEligibility($protection_eligibility)
|
||||
{
|
||||
$this->protection_eligibility = $protection_eligibility;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Protection Eligibility of the Payer
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getProtectionEligibility()
|
||||
{
|
||||
return $this->protection_eligibility;
|
||||
}
|
||||
|
||||
/**
|
||||
* Protection Eligibility of the Payer
|
||||
*
|
||||
* @deprecated Instead use setProtectionEligibility
|
||||
*
|
||||
* @param string $protection_eligibility
|
||||
* @return $this
|
||||
*/
|
||||
public function setProtection_eligibility($protection_eligibility)
|
||||
{
|
||||
$this->protection_eligibility = $protection_eligibility;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Protection Eligibility of the Payer
|
||||
* @deprecated Instead use getProtectionEligibility
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getProtection_eligibility()
|
||||
{
|
||||
return $this->protection_eligibility;
|
||||
}
|
||||
|
||||
/**
|
||||
* Protection Eligibility Type of the Payer
|
||||
* Valid Values: ["ELIGIBLE", "ITEM_NOT_RECEIVED_ELIGIBLE", "INELIGIBLE", "UNAUTHORIZED_PAYMENT_ELIGIBLE"]
|
||||
*
|
||||
* @param string $protection_eligibility_type
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setProtectionEligibilityType($protection_eligibility_type)
|
||||
{
|
||||
$this->protection_eligibility_type = $protection_eligibility_type;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Protection Eligibility Type of the Payer
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getProtectionEligibilityType()
|
||||
{
|
||||
return $this->protection_eligibility_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Protection Eligibility Type of the Payer
|
||||
*
|
||||
* @deprecated Instead use setProtectionEligibilityType
|
||||
*
|
||||
* @param string $protection_eligibility_type
|
||||
* @return $this
|
||||
*/
|
||||
public function setProtection_eligibility_type($protection_eligibility_type)
|
||||
{
|
||||
$this->protection_eligibility_type = $protection_eligibility_type;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Protection Eligibility Type of the Payer
|
||||
* @deprecated Instead use getProtectionEligibilityType
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getProtection_eligibility_type()
|
||||
{
|
||||
return $this->protection_eligibility_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Expected clearing time for eCheck Transactions
|
||||
*
|
||||
*
|
||||
* @param string $clearing_time
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setClearingTime($clearing_time)
|
||||
{
|
||||
$this->clearing_time = $clearing_time;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Expected clearing time for eCheck Transactions
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getClearingTime()
|
||||
{
|
||||
return $this->clearing_time;
|
||||
}
|
||||
|
||||
/**
|
||||
* Expected clearing time for eCheck Transactions
|
||||
*
|
||||
* @deprecated Instead use setClearingTime
|
||||
*
|
||||
* @param string $clearing_time
|
||||
* @return $this
|
||||
*/
|
||||
public function setClearing_time($clearing_time)
|
||||
{
|
||||
$this->clearing_time = $clearing_time;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Expected clearing time for eCheck Transactions
|
||||
* @deprecated Instead use getClearingTime
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getClearing_time()
|
||||
{
|
||||
return $this->clearing_time;
|
||||
}
|
||||
|
||||
/**
|
||||
* ID of the Payment resource that this transaction is based on.
|
||||
*
|
||||
*
|
||||
* @param string $parent_payment
|
||||
*
|
||||
@@ -239,13 +525,11 @@ class Sale extends PPModel implements IResource
|
||||
public function setParentPayment($parent_payment)
|
||||
{
|
||||
$this->parent_payment = $parent_payment;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Parent Payment
|
||||
* ID of the Payment resource that this transaction is based on
|
||||
* ID of the Payment resource that this transaction is based on.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -255,27 +539,22 @@ class Sale extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Parent Payment
|
||||
* ID of the Payment resource that this transaction is based on
|
||||
* ID of the Payment resource that this transaction is based on.
|
||||
*
|
||||
* @deprecated Instead use setParentPayment
|
||||
*
|
||||
* @param string $parent_payment
|
||||
*
|
||||
* @deprecated Use setParentPayment
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setParent_payment($parent_payment)
|
||||
{
|
||||
$this->parent_payment = $parent_payment;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Parent Payment
|
||||
* ID of the Payment resource that this transaction is based on
|
||||
*
|
||||
* @deprecated Use getParentPayment
|
||||
* ID of the Payment resource that this transaction is based on.
|
||||
* @deprecated Instead use getParentPayment
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -285,7 +564,8 @@ class Sale extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Links
|
||||
* Sets Links
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\Links $links
|
||||
*
|
||||
@@ -294,14 +574,13 @@ class Sale extends PPModel implements IResource
|
||||
public function setLinks($links)
|
||||
{
|
||||
$this->links = $links;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Links
|
||||
* Gets Links
|
||||
*
|
||||
* @return \PayPal\Api\Links
|
||||
* @return \PayPal\Api\Links[]
|
||||
*/
|
||||
public function getLinks()
|
||||
{
|
||||
@@ -309,66 +588,48 @@ class Sale extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Get
|
||||
*
|
||||
* @param int $saleId
|
||||
* @param \PayPal\Rest\ApiContext|null $apiContext
|
||||
* Obtain the Sale transaction resource for the given identifier.
|
||||
*
|
||||
* @param string $saleId
|
||||
* @param \PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
||||
* @return Sale
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public static function get($saleId, $apiContext = null)
|
||||
{
|
||||
if (($saleId == null) || (strlen($saleId) <= 0)) {
|
||||
throw new \InvalidArgumentException("saleId cannot be null or empty");
|
||||
}
|
||||
ArgumentValidator::validate($saleId, 'saleId');
|
||||
|
||||
$payLoad = "";
|
||||
|
||||
if ($apiContext == null) {
|
||||
$apiContext = new ApiContext(self::$credential);
|
||||
}
|
||||
|
||||
$call = new PPRestCall($apiContext);
|
||||
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payments/sale/$saleId", "GET", $payLoad);
|
||||
|
||||
$ret = new Sale();
|
||||
$ret->fromJson($json);
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Refund
|
||||
*
|
||||
* @param \Paypal\Api\Refund $refund
|
||||
* @param \PayPal\Rest\ApiContext|null $apiContext
|
||||
* Creates (and processes) a new Refund Transaction added as a related resource.
|
||||
*
|
||||
* @param Refund $refund
|
||||
* @param \PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
||||
* @return Refund
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function refund($refund, $apiContext = null)
|
||||
{
|
||||
if ($this->getId() == null) {
|
||||
throw new \InvalidArgumentException("Id cannot be null");
|
||||
}
|
||||
|
||||
if (($refund == null)) {
|
||||
throw new \InvalidArgumentException("refund cannot be null or empty");
|
||||
}
|
||||
ArgumentValidator::validate($this->getId(), "Id");
|
||||
ArgumentValidator::validate($refund, 'refund');
|
||||
|
||||
$payLoad = $refund->toJSON();
|
||||
|
||||
if ($apiContext == null) {
|
||||
$apiContext = new ApiContext(self::$credential);
|
||||
}
|
||||
|
||||
$call = new PPRestCall($apiContext);
|
||||
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payments/sale/{$this->getId()}/refund", "POST", $payLoad);
|
||||
|
||||
$ret = new Refund();
|
||||
$ret->fromJson($json);
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,13 +8,43 @@ use PayPal\Rest\ApiContext;
|
||||
/**
|
||||
* Class ShippingAddress
|
||||
*
|
||||
* Extended Address object used as shipping address in a payment.
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
* @property string id
|
||||
* @property string recipient_name
|
||||
* @property bool default_address
|
||||
*/
|
||||
class ShippingAddress extends Address
|
||||
{
|
||||
/**
|
||||
* Set Recipient Name
|
||||
* Name of the recipient at this address
|
||||
* Address ID assigned in PayPal system.
|
||||
*
|
||||
*
|
||||
* @param string $id
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setId($id)
|
||||
{
|
||||
$this->id = $id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Address ID assigned in PayPal system.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Name of the recipient at this address.
|
||||
*
|
||||
*
|
||||
* @param string $recipient_name
|
||||
*
|
||||
@@ -23,13 +53,11 @@ class ShippingAddress extends Address
|
||||
public function setRecipientName($recipient_name)
|
||||
{
|
||||
$this->recipient_name = $recipient_name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Recipient Name
|
||||
* Name of the recipient at this address
|
||||
* Name of the recipient at this address.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -39,27 +67,22 @@ class ShippingAddress extends Address
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Recipient Name
|
||||
* Name of the recipient at this address
|
||||
* Name of the recipient at this address.
|
||||
*
|
||||
* @deprecated Instead use setRecipientName
|
||||
*
|
||||
* @param string $recipient_name
|
||||
*
|
||||
* @deprecated Use setRecipientName
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setRecipient_name($recipient_name)
|
||||
{
|
||||
$this->recipient_name = $recipient_name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Recipient Name
|
||||
* Name of the recipient at this address
|
||||
*
|
||||
* @deprecated Use getRecipientName
|
||||
* Name of the recipient at this address.
|
||||
* @deprecated Instead use getRecipientName
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -67,4 +90,54 @@ class ShippingAddress extends Address
|
||||
{
|
||||
return $this->recipient_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Default shipping address of the Payer.
|
||||
*
|
||||
*
|
||||
* @param bool $default_address
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setDefaultAddress($default_address)
|
||||
{
|
||||
$this->default_address = $default_address;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Default shipping address of the Payer.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getDefaultAddress()
|
||||
{
|
||||
return $this->default_address;
|
||||
}
|
||||
|
||||
/**
|
||||
* Default shipping address of the Payer.
|
||||
*
|
||||
* @deprecated Instead use setDefaultAddress
|
||||
*
|
||||
* @param bool $default_address
|
||||
* @return $this
|
||||
*/
|
||||
public function setDefault_address($default_address)
|
||||
{
|
||||
$this->default_address = $default_address;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Default shipping address of the Payer.
|
||||
* @deprecated Instead use getDefaultAddress
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getDefault_address()
|
||||
{
|
||||
return $this->default_address;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,309 +8,36 @@ use PayPal\Rest\ApiContext;
|
||||
/**
|
||||
* Class Transaction
|
||||
*
|
||||
* @property \PayPal\Api\Amount amount
|
||||
* @property \PayPal\Api\Payee payee
|
||||
* @property string description
|
||||
* @property \PayPal\Api\ItemList item_list
|
||||
* @property \PayPal\Api\RelatedResources related_resources
|
||||
* @property \PayPal\Api\Transaction transactions
|
||||
* @property string invoice_number
|
||||
* @property string custom
|
||||
* @property string soft_descriptor
|
||||
* A transaction defines the contract of a payment - what is the payment for and who is fulfilling it.
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
* @property self transactions
|
||||
*/
|
||||
class Transaction extends PPModel
|
||||
class Transaction extends TransactionBase
|
||||
{
|
||||
/**
|
||||
* Set Amount
|
||||
* Amount being collected
|
||||
* Additional transactions for complex payment scenarios.
|
||||
*
|
||||
* @param \PayPal\Api\Amount $amount
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setAmount($amount)
|
||||
{
|
||||
$this->amount = $amount;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Amount
|
||||
* Amount being collected
|
||||
*
|
||||
* @return \PayPal\Api\Amount
|
||||
*/
|
||||
public function getAmount()
|
||||
{
|
||||
return $this->amount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Payee
|
||||
* Recepient of the funds in this transaction
|
||||
*
|
||||
* @param \PayPal\Api\Payee $payee
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setPayee($payee)
|
||||
{
|
||||
$this->payee = $payee;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Payee
|
||||
* Recepient of the funds in this transaction
|
||||
*
|
||||
* @return \PayPal\Api\Payee
|
||||
*/
|
||||
public function getPayee()
|
||||
{
|
||||
return $this->payee;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Description
|
||||
* Description of what is being paid for
|
||||
*
|
||||
* @param string $description
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setDescription($description)
|
||||
{
|
||||
$this->description = $description;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Description
|
||||
* Description of what is being paid for
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDescription()
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Item List
|
||||
* List of items being paid for
|
||||
*
|
||||
* @param \PayPal\Api\ItemList $item_list
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setItemList($item_list)
|
||||
{
|
||||
$this->item_list = $item_list;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Item List
|
||||
* List of items being paid for
|
||||
*
|
||||
* @return \PayPal\Api\ItemList
|
||||
*/
|
||||
public function getItemList()
|
||||
{
|
||||
return $this->item_list;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Item List
|
||||
* List of items being paid for
|
||||
*
|
||||
* @param \PayPal\Api\ItemList $item_list
|
||||
*
|
||||
* @deprecated Use setItemList
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setItem_list($item_list)
|
||||
{
|
||||
$this->item_list = $item_list;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Item List
|
||||
* List of items being paid for
|
||||
*
|
||||
* @deprecated Use getItemList
|
||||
*
|
||||
* @return \PayPal\Api\ItemList
|
||||
*/
|
||||
public function getItem_list()
|
||||
{
|
||||
return $this->item_list;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Related Resources
|
||||
* List of financial transactions (Sale, Authorization, Capture, Refund) related to the payment
|
||||
*
|
||||
* @param \PayPal\Api\RelatedResources $related_resources
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setRelatedResources($related_resources)
|
||||
{
|
||||
$this->related_resources = $related_resources;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Related Resources
|
||||
* List of financial transactions (Sale, Authorization, Capture, Refund) related to the payment
|
||||
*
|
||||
* @return \PayPal\Api\RelatedResources
|
||||
*/
|
||||
public function getRelatedResources()
|
||||
{
|
||||
return $this->related_resources;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Related Resources
|
||||
* List of financial transactions (Sale, Authorization, Capture, Refund) related to the payment
|
||||
*
|
||||
* @param \PayPal\Api\RelatedResources $related_resources
|
||||
*
|
||||
* @deprecated Use setRelatedResources
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setRelated_resources($related_resources)
|
||||
{
|
||||
$this->related_resources = $related_resources;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Related Resources
|
||||
* List of financial transactions (Sale, Authorization, Capture, Refund) related to the payment
|
||||
*
|
||||
* @deprecated Use getRelatedResources
|
||||
*
|
||||
* @return \PayPal\Api\RelatedResources
|
||||
*/
|
||||
public function getRelated_resources()
|
||||
{
|
||||
return $this->related_resources;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set invoice number.
|
||||
* Invoice number used to track the payment. 256 characters max.
|
||||
*
|
||||
* @param string $invoiceNumber
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setInvoiceNumber($invoiceNumber)
|
||||
{
|
||||
$this->invoice_number = $invoiceNumber;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get invoice number.
|
||||
* Invoice number used to track the payment. 256 characters max.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getInvoiceNumber()
|
||||
{
|
||||
return $this->invoice_number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set free-form field.
|
||||
* Free-form field for the use of clients. 256 characters max.
|
||||
*
|
||||
* @param string $custom
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setCustom($custom)
|
||||
{
|
||||
$this->custom = $custom;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get free-form field.
|
||||
* Free-form field for the use of clients. 256 characters max.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCustom()
|
||||
{
|
||||
return $this->custom;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set soft descriptor.
|
||||
* Soft descriptor used when charging this funding source. 22 characters max.
|
||||
*
|
||||
* @param string $softDescriptor
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setSoftDescriptor($softDescriptor)
|
||||
{
|
||||
$this->soft_descriptor = $softDescriptor;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get soft descriptor.
|
||||
* Soft descriptor used when charging this funding source. 22 characters max.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSoftDescriptor()
|
||||
{
|
||||
return $this->soft_descriptor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Transactions
|
||||
* Additional transactions for complex payment (Parallel and Chained) scenarios
|
||||
*
|
||||
* @param \PayPal\Api\self $transactions
|
||||
* @param self $transactions
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setTransactions($transactions)
|
||||
{
|
||||
$this->transactions = $transactions;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Transactions
|
||||
* Additional transactions for complex payment (Parallel and Chained) scenarios
|
||||
* Additional transactions for complex payment scenarios.
|
||||
*
|
||||
* @return \PayPal\Api\self
|
||||
* @return self[]
|
||||
*/
|
||||
public function getTransactions()
|
||||
{
|
||||
return $this->transactions;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
68
lib/PayPal/Api/TransactionBase.php
Normal file
68
lib/PayPal/Api/TransactionBase.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace PayPal\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Rest\ApiContext;
|
||||
|
||||
/**
|
||||
* Class TransactionBase
|
||||
*
|
||||
* A transaction defines the contract of a payment - what is the payment for and who is fulfilling it.
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
* @property \PayPal\Api\RelatedResources related_resources
|
||||
*/
|
||||
class TransactionBase extends CartBase
|
||||
{
|
||||
/**
|
||||
* List of financial transactions (Sale, Authorization, Capture, Refund) related to the payment.
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\RelatedResources $related_resources
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setRelatedResources($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[]
|
||||
*/
|
||||
public function getRelatedResources()
|
||||
{
|
||||
return $this->related_resources;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of financial transactions (Sale, Authorization, Capture, Refund) related to the payment.
|
||||
*
|
||||
* @deprecated Instead use setRelatedResources
|
||||
*
|
||||
* @param \PayPal\Api\RelatedResources $related_resources
|
||||
* @return $this
|
||||
*/
|
||||
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.
|
||||
* @deprecated Instead use getRelatedResources
|
||||
*
|
||||
* @return \PayPal\Api\RelatedResources
|
||||
*/
|
||||
public function getRelated_resources()
|
||||
{
|
||||
return $this->related_resources;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,12 +8,17 @@ use PayPal\Rest\ApiContext;
|
||||
/**
|
||||
* Class Transactions
|
||||
*
|
||||
*
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
* @property \PayPal\Api\Amount amount
|
||||
*/
|
||||
class Transactions extends PPModel
|
||||
{
|
||||
/**
|
||||
* Set Amount
|
||||
* Amount being collected.
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\Amount $amount
|
||||
*
|
||||
@@ -22,12 +27,11 @@ class Transactions extends PPModel
|
||||
public function setAmount($amount)
|
||||
{
|
||||
$this->amount = $amount;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Amount
|
||||
* Amount being collected.
|
||||
*
|
||||
* @return \PayPal\Api\Amount
|
||||
*/
|
||||
@@ -35,4 +39,5 @@ class Transactions extends PPModel
|
||||
{
|
||||
return $this->amount;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -74,6 +74,7 @@ class OAuthTokenCredential
|
||||
{
|
||||
$this->clientId = $clientId;
|
||||
$this->clientSecret = $clientSecret;
|
||||
$this->logger = PPLoggingManager::getInstance(__CLASS__);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -85,8 +86,6 @@ class OAuthTokenCredential
|
||||
*/
|
||||
public function getAccessToken($config)
|
||||
{
|
||||
$this->logger = new PPLoggingManager(__CLASS__, $config);
|
||||
|
||||
// Check if Access Token is not null and has not expired.
|
||||
// The API returns expiry time as a relative time unit
|
||||
// We use a buffer time when checking for token expiry to account
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace PayPal\Common;
|
||||
use PayPal\Validation\ModelAccessorValidator;
|
||||
|
||||
/**
|
||||
* Generic Model class that all API domain classes extend
|
||||
@@ -12,6 +13,45 @@ class PPModel
|
||||
|
||||
private $_propMap = array();
|
||||
|
||||
/**
|
||||
* Default Constructor
|
||||
*
|
||||
* You can pass data as a json representation or array object. This argument eliminates the need
|
||||
* to do $obj->fromJson($data) later after creating the object.
|
||||
*
|
||||
* @param null $data
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function __construct($data = null)
|
||||
{
|
||||
switch (gettype($data)) {
|
||||
case "NULL":
|
||||
break;
|
||||
case "string":
|
||||
if (!$this->isJson($data)) {
|
||||
throw new \InvalidArgumentException("data should be either json or array representation of object");
|
||||
}
|
||||
$this->fromJson($data);
|
||||
break;
|
||||
case "array":
|
||||
$this->fromArray($data);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests if the string provided is json representation or not.
|
||||
*
|
||||
* @param $string
|
||||
* @return bool
|
||||
*/
|
||||
private function isJson($string)
|
||||
{
|
||||
json_decode($string);
|
||||
return (json_last_error() == JSON_ERROR_NONE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Magic Get Method
|
||||
*
|
||||
@@ -20,8 +60,11 @@ class PPModel
|
||||
*/
|
||||
public function __get($key)
|
||||
{
|
||||
if ($this->__isset($key)) {
|
||||
return $this->_propMap[$key];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Magic Set Method
|
||||
@@ -31,9 +74,21 @@ class PPModel
|
||||
*/
|
||||
public function __set($key, $value)
|
||||
{
|
||||
ModelAccessorValidator::validate($this, $this->convertToCamelCase($key));
|
||||
$this->_propMap[$key] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts the input key into a valid Setter Method Name
|
||||
*
|
||||
* @param $key
|
||||
* @return mixed
|
||||
*/
|
||||
private function convertToCamelCase($key)
|
||||
{
|
||||
return str_replace(' ', '', ucwords(str_replace(array('_', '-'), ' ', $key)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Magic isSet Method
|
||||
*
|
||||
|
||||
@@ -40,7 +40,7 @@ class PPReflectionUtil
|
||||
}
|
||||
|
||||
if (isset($param)) {
|
||||
$anno = explode(' ', $param);
|
||||
$anno = preg_split("/[\s\[\]]+/", $param);
|
||||
return $anno[0];
|
||||
} else {
|
||||
return 'string';
|
||||
|
||||
@@ -45,7 +45,7 @@ class PPHttpConnection
|
||||
throw new PPConfigurationException("Curl module is not available on this system");
|
||||
}
|
||||
$this->httpConfig = $httpConfig;
|
||||
$this->logger = new PPLoggingManager(__CLASS__, $config);
|
||||
$this->logger = PPLoggingManager::getInstance(__CLASS__);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -43,12 +43,33 @@ class PPLoggingManager
|
||||
private $loggerFile;
|
||||
|
||||
/**
|
||||
* @param $loggerName
|
||||
* @param array|null $config
|
||||
* Returns the singleton object
|
||||
*
|
||||
* @param string $loggerName
|
||||
* @return $this
|
||||
*/
|
||||
public function __construct($loggerName, $config = null)
|
||||
public static function getInstance($loggerName = __CLASS__)
|
||||
{
|
||||
$instance = new self();
|
||||
$instance->setLoggerName($loggerName);
|
||||
return $instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets Logger Name. Generally defaulted to Logging Class
|
||||
*
|
||||
* @param string $loggerName
|
||||
*/
|
||||
public function setLoggerName($loggerName = __CLASS__)
|
||||
{
|
||||
$this->loggerName = $loggerName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Default Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$config = PPConfigManager::getInstance()->getConfigHashmap();
|
||||
|
||||
$this->isLoggingEnabled = (array_key_exists('log.LogEnabled', $config) && $config['log.LogEnabled'] == '1');
|
||||
@@ -83,7 +104,7 @@ class PPLoggingManager
|
||||
*/
|
||||
public function error($message)
|
||||
{
|
||||
$this->log($message, PPLoggingLevel::ERROR);
|
||||
$this->log('ERROR: ' . $message, PPLoggingLevel::ERROR);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -93,7 +114,7 @@ class PPLoggingManager
|
||||
*/
|
||||
public function warning($message)
|
||||
{
|
||||
$this->log($message, PPLoggingLevel::WARN);
|
||||
$this->log('WARNING: ' . $message, PPLoggingLevel::WARN);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -103,7 +124,7 @@ class PPLoggingManager
|
||||
*/
|
||||
public function info($message)
|
||||
{
|
||||
$this->log($message, PPLoggingLevel::INFO);
|
||||
$this->log('INFO: ' . $message, PPLoggingLevel::INFO);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -113,7 +134,7 @@ class PPLoggingManager
|
||||
*/
|
||||
public function fine($message)
|
||||
{
|
||||
$this->log($message, PPLoggingLevel::FINE);
|
||||
$this->log('FINE: ' . $message, PPLoggingLevel::FINE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
171
lib/PayPal/Core/cacert.pem
Normal file
171
lib/PayPal/Core/cacert.pem
Normal file
@@ -0,0 +1,171 @@
|
||||
Verisign Class 3 Public Primary Certification Authority
|
||||
=======================================================
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIICPDCCAaUCEHC65B0Q2Sk0tjjKewPMur8wDQYJKoZIhvcNAQECBQAwXzELMAkGA1UEBhMCVVMx
|
||||
FzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFzcyAzIFB1YmxpYyBQcmltYXJ5
|
||||
IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTk2MDEyOTAwMDAwMFoXDTI4MDgwMTIzNTk1OVow
|
||||
XzELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFzcyAz
|
||||
IFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIGfMA0GCSqGSIb3DQEBAQUA
|
||||
A4GNADCBiQKBgQDJXFme8huKARS0EN8EQNvjV69qRUCPhAwL0TPZ2RHP7gJYHyX3KqhEBarsAx94
|
||||
f56TuZoAqiN91qyFomNFx3InzPRMxnVx0jnvT0Lwdd8KkMaOIG+YD/isI19wKTakyYbnsZogy1Ol
|
||||
hec9vn2a/iRFM9x2Fe0PonFkTGUugWhFpwIDAQABMA0GCSqGSIb3DQEBAgUAA4GBALtMEivPLCYA
|
||||
TxQT3ab7/AoRhIzzKBxnki98tsX63/Dolbwdj2wsqFHMc9ikwFPwTtYmwHYBV4GSXiHx0bH/59Ah
|
||||
WM1pF+NEHJwZRDmJXNycAA9WjQKZ7aKQRUzkuxCkPfAyAw7xzvjoyVGM5mKf5p/AfbdynMk2Omuf
|
||||
Tqj/ZA1k
|
||||
-----END CERTIFICATE-----
|
||||
|
||||
Verisign Class 3 Public Primary Certification Authority - G2
|
||||
============================================================
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIDAjCCAmsCEH3Z/gfPqB63EHln+6eJNMYwDQYJKoZIhvcNAQEFBQAwgcExCzAJBgNVBAYTAlVT
|
||||
MRcwFQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE8MDoGA1UECxMzQ2xhc3MgMyBQdWJsaWMgUHJpbWFy
|
||||
eSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEcyMTowOAYDVQQLEzEoYykgMTk5OCBWZXJpU2ln
|
||||
biwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVzZSBvbmx5MR8wHQYDVQQLExZWZXJpU2lnbiBUcnVz
|
||||
dCBOZXR3b3JrMB4XDTk4MDUxODAwMDAwMFoXDTI4MDgwMTIzNTk1OVowgcExCzAJBgNVBAYTAlVT
|
||||
MRcwFQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE8MDoGA1UECxMzQ2xhc3MgMyBQdWJsaWMgUHJpbWFy
|
||||
eSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEcyMTowOAYDVQQLEzEoYykgMTk5OCBWZXJpU2ln
|
||||
biwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVzZSBvbmx5MR8wHQYDVQQLExZWZXJpU2lnbiBUcnVz
|
||||
dCBOZXR3b3JrMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDMXtERXVxp0KvTuWpMmR9ZmDCO
|
||||
FoUgRm1HP9SFIIThbbP4pO0M8RcPO/mn+SXXwc+EY/J8Y8+iR/LGWzOOZEAEaMGAuWQcRXfH2G71
|
||||
lSk8UOg013gfqLptQ5GVj0VXXn7F+8qkBOvqlzdUMG+7AUcyM83cV5tkaWH4mx0ciU9cZwIDAQAB
|
||||
MA0GCSqGSIb3DQEBBQUAA4GBAFFNzb5cy5gZnBWyATl4Lk0PZ3BwmcYQWpSkU01UbSuvDV1Ai2TT
|
||||
1+7eVmGSX6bEHRBhNtMsJzzoKQm5EWR0zLVznxxIqbxhAe7iF6YM40AIOw7n60RzKprxaZLvcRTD
|
||||
Oaxxp5EJb+RxBrO6WVcmeQD2+A2iMzAo1KpYoJ2daZH9
|
||||
-----END CERTIFICATE-----
|
||||
|
||||
|
||||
Verisign Class 3 Public Primary Certification Authority - G3
|
||||
============================================================
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIEGjCCAwICEQCbfgZJoz5iudXukEhxKe9XMA0GCSqGSIb3DQEBBQUAMIHKMQswCQYDVQQGEwJV
|
||||
UzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdv
|
||||
cmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNl
|
||||
IG9ubHkxRTBDBgNVBAMTPFZlcmlTaWduIENsYXNzIDMgUHVibGljIFByaW1hcnkgQ2VydGlmaWNh
|
||||
dGlvbiBBdXRob3JpdHkgLSBHMzAeFw05OTEwMDEwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMIHKMQsw
|
||||
CQYDVQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRy
|
||||
dXN0IE5ldHdvcmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhv
|
||||
cml6ZWQgdXNlIG9ubHkxRTBDBgNVBAMTPFZlcmlTaWduIENsYXNzIDMgUHVibGljIFByaW1hcnkg
|
||||
Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
|
||||
ggEBAMu6nFL8eB8aHm8bN3O9+MlrlBIwT/A2R/XQkQr1F8ilYcEWQE37imGQ5XYgwREGfassbqb1
|
||||
EUGO+i2tKmFZpGcmTNDovFJbcCAEWNF6yaRpvIMXZK0Fi7zQWM6NjPXr8EJJC52XJ2cybuGukxUc
|
||||
cLwgTS8Y3pKI6GyFVxEa6X7jJhFUokWWVYPKMIno3Nij7SqAP395ZVc+FSBmCC+Vk7+qRy+oRpfw
|
||||
EuL+wgorUeZ25rdGt+INpsyow0xZVYnm6FNcHOqd8GIWC6fJXwzw3sJ2zq/3avL6QaaiMxTJ5Xpj
|
||||
055iN9WFZZ4O5lMkdBteHRJTW8cs54NJOxWuimi5V5cCAwEAATANBgkqhkiG9w0BAQUFAAOCAQEA
|
||||
ERSWwauSCPc/L8my/uRan2Te2yFPhpk0djZX3dAVL8WtfxUfN2JzPtTnX84XA9s1+ivbrmAJXx5f
|
||||
j267Cz3qWhMeDGBvtcC1IyIuBwvLqXTLR7sdwdela8wv0kL9Sd2nic9TutoAWii/gt/4uhMdUIaC
|
||||
/Y4wjylGsB49Ndo4YhYYSq3mtlFs3q9i6wHQHiT+eo8SGhJouPtmmRQURVyu565pF4ErWjfJXir0
|
||||
xuKhXFSbplQAz/DxwceYMBo7Nhbbo27q/a2ywtrvAkcTisDxszGtTxzhT5yvDwyd93gN2PQ1VoDa
|
||||
t20Xj50egWTh/sVFuq1ruQp6Tk9LhO5L8X3dEQ==
|
||||
-----END CERTIFICATE-----
|
||||
|
||||
Verisign Class 4 Public Primary Certification Authority - G3
|
||||
============================================================
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIEGjCCAwICEQDsoKeLbnVqAc/EfMwvlF7XMA0GCSqGSIb3DQEBBQUAMIHKMQswCQYDVQQGEwJV
|
||||
UzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdv
|
||||
cmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNl
|
||||
IG9ubHkxRTBDBgNVBAMTPFZlcmlTaWduIENsYXNzIDQgUHVibGljIFByaW1hcnkgQ2VydGlmaWNh
|
||||
dGlvbiBBdXRob3JpdHkgLSBHMzAeFw05OTEwMDEwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMIHKMQsw
|
||||
CQYDVQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRy
|
||||
dXN0IE5ldHdvcmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhv
|
||||
cml6ZWQgdXNlIG9ubHkxRTBDBgNVBAMTPFZlcmlTaWduIENsYXNzIDQgUHVibGljIFByaW1hcnkg
|
||||
Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
|
||||
ggEBAK3LpRFpxlmr8Y+1GQ9Wzsy1HyDkniYlS+BzZYlZ3tCD5PUPtbut8XzoIfzk6AzufEUiGXaS
|
||||
tBO3IFsJ+mGuqPKljYXCKtbeZjbSmwL0qJJgfJxptI8kHtCGUvYynEFYHiK9zUVilQhu0GbdU6LM
|
||||
8BDcVHOLBKFGMzNcF0C5nk3T875Vg+ixiY5afJqWIpA7iCXy0lOIAgwLePLmNxdLMEYH5IBtptiW
|
||||
Lugs+BGzOA1mppvqySNb247i8xOOGlktqgLw7KSHZtzBP/XYufTsgsbSPZUd5cBPhMnZo0QoBmrX
|
||||
Razwa2rvTl/4EYIeOGM0ZlDUPpNz+jDDZq3/ky2X7wMCAwEAATANBgkqhkiG9w0BAQUFAAOCAQEA
|
||||
j/ola09b5KROJ1WrIhVZPMq1CtRK26vdoV9TxaBXOcLORyu+OshWv8LZJxA6sQU8wHcxuzrTBXtt
|
||||
mhwwjIDLk5Mqg6sFUYICABFna/OIYUdfA5PVWw3g8dShMjWFsjrbsIKr0csKvE+MW8VLADsfKoKm
|
||||
fjaF3H48ZwC15DtS4KjrXRX5xm3wrR0OhbepmnMUWluPQSjA1egtTaRezarZ7c7c2NU8Qh0XwRJd
|
||||
RTjDOPP8hS6DRkiy1yBfkjaP53kPmF6Z6PDQpLv1U70qzlmwr25/bLvSHgCwIe34QWKCudiyxLtG
|
||||
UPMxxY8BqHTr9Xgn2uf3ZkPznoM+IKrDNWCRzg==
|
||||
-----END CERTIFICATE-----
|
||||
VeriSign Class 3 Public Primary Certification Authority - G5
|
||||
============================================================
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIE0zCCA7ugAwIBAgIQGNrRniZ96LtKIVjNzGs7SjANBgkqhkiG9w0BAQUFADCByjELMAkGA1UE
|
||||
BhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBO
|
||||
ZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVk
|
||||
IHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRp
|
||||
ZmljYXRpb24gQXV0aG9yaXR5IC0gRzUwHhcNMDYxMTA4MDAwMDAwWhcNMzYwNzE2MjM1OTU5WjCB
|
||||
yjELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2ln
|
||||
biBUcnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJpU2lnbiwgSW5jLiAtIEZvciBh
|
||||
dXRob3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmlt
|
||||
YXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw
|
||||
ggEKAoIBAQCvJAgIKXo1nmAMqudLO07cfLw8RRy7K+D+KQL5VwijZIUVJ/XxrcgxiV0i6CqqpkKz
|
||||
j/i5Vbext0uz/o9+B1fs70PbZmIVYc9gDaTY3vjgw2IIPVQT60nKWVSFJuUrjxuf6/WhkcIzSdhD
|
||||
Y2pSS9KP6HBRTdGJaXvHcPaz3BJ023tdS1bTlr8Vd6Gw9KIl8q8ckmcY5fQGBO+QueQA5N06tRn/
|
||||
Arr0PO7gi+s3i+z016zy9vA9r911kTMZHRxAy3QkGSGT2RT+rCpSx4/VBEnkjWNHiDxpg8v+R70r
|
||||
fk/Fla4OndTRQ8Bnc+MUCH7lP59zuDMKz10/NIeWiu5T6CUVAgMBAAGjgbIwga8wDwYDVR0TAQH/
|
||||
BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwbQYIKwYBBQUHAQwEYTBfoV2gWzBZMFcwVRYJaW1hZ2Uv
|
||||
Z2lmMCEwHzAHBgUrDgMCGgQUj+XTGoasjY5rw8+AatRIGCx7GS4wJRYjaHR0cDovL2xvZ28udmVy
|
||||
aXNpZ24uY29tL3ZzbG9nby5naWYwHQYDVR0OBBYEFH/TZafC3ey78DAJ80M5+gKvMzEzMA0GCSqG
|
||||
SIb3DQEBBQUAA4IBAQCTJEowX2LP2BqYLz3q3JktvXf2pXkiOOzEp6B4Eq1iDkVwZMXnl2YtmAl+
|
||||
X6/WzChl8gGqCBpH3vn5fJJaCGkgDdk+bW48DW7Y5gaRQBi5+MHt39tBquCWIMnNZBU4gcmU7qKE
|
||||
KQsTb47bDN0lAtukixlE0kF6BWlKWE9gyn6CagsCqiUXObXbf+eEZSqVir2G3l6BFoMtEMze/aiC
|
||||
Km0oHw0LxOXnGiYZ4fQRbxC1lfznQgUy286dUV4otp6F01vvpX1FQHKOtw5rDgb7MzVIcbidJ4vE
|
||||
ZV8NhnacRHr2lVz2XTIIM6RUthg/aFzyQkqFOFSDX9HoLPKsEdao7WNq
|
||||
-----END CERTIFICATE-----
|
||||
VeriSign Universal Root Certification Authority
|
||||
===============================================
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIEuTCCA6GgAwIBAgIQQBrEZCGzEyEDDrvkEhrFHTANBgkqhkiG9w0BAQsFADCBvTELMAkGA1UE
|
||||
BhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBO
|
||||
ZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwOCBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVk
|
||||
IHVzZSBvbmx5MTgwNgYDVQQDEy9WZXJpU2lnbiBVbml2ZXJzYWwgUm9vdCBDZXJ0aWZpY2F0aW9u
|
||||
IEF1dGhvcml0eTAeFw0wODA0MDIwMDAwMDBaFw0zNzEyMDEyMzU5NTlaMIG9MQswCQYDVQQGEwJV
|
||||
UzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdv
|
||||
cmsxOjA4BgNVBAsTMShjKSAyMDA4IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNl
|
||||
IG9ubHkxODA2BgNVBAMTL1ZlcmlTaWduIFVuaXZlcnNhbCBSb290IENlcnRpZmljYXRpb24gQXV0
|
||||
aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAx2E3XrEBNNti1xWb/1hajCMj
|
||||
1mCOkdeQmIN65lgZOIzF9uVkhbSicfvtvbnazU0AtMgtc6XHaXGVHzk8skQHnOgO+k1KxCHfKWGP
|
||||
MiJhgsWHH26MfF8WIFFE0XBPV+rjHOPMee5Y2A7Cs0WTwCznmhcrewA3ekEzeOEz4vMQGn+HLL72
|
||||
9fdC4uW/h2KJXwBL38Xd5HVEMkE6HnFuacsLdUYI0crSK5XQz/u5QGtkjFdN/BMReYTtXlT2NJ8I
|
||||
AfMQJQYXStrxHXpma5hgZqTZ79IugvHw7wnqRMkVauIDbjPTrJ9VAMf2CGqUuV/c4DPxhGD5WycR
|
||||
tPwW8rtWaoAljQIDAQABo4GyMIGvMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMG0G
|
||||
CCsGAQUFBwEMBGEwX6FdoFswWTBXMFUWCWltYWdlL2dpZjAhMB8wBwYFKw4DAhoEFI/l0xqGrI2O
|
||||
a8PPgGrUSBgsexkuMCUWI2h0dHA6Ly9sb2dvLnZlcmlzaWduLmNvbS92c2xvZ28uZ2lmMB0GA1Ud
|
||||
DgQWBBS2d/ppSEefUxLVwuoHMnYH0ZcHGTANBgkqhkiG9w0BAQsFAAOCAQEASvj4sAPmLGd75JR3
|
||||
Y8xuTPl9Dg3cyLk1uXBPY/ok+myDjEedO2Pzmvl2MpWRsXe8rJq+seQxIcaBlVZaDrHC1LGmWazx
|
||||
Y8u4TB1ZkErvkBYoH1quEPuBUDgMbMzxPcP1Y+Oz4yHJJDnp/RVmRvQbEdBNc6N9Rvk97ahfYtTx
|
||||
P/jgdFcrGJ2BtMQo2pSXpXDrrB2+BxHw1dvd5Yzw1TKwg+ZX4o+/vqGqvz0dtdQ46tewXDpPaj+P
|
||||
wGZsY6rp2aQW9IHRlRQOfc2VNNnSj3BzgXucfr2YYdhFh5iQxeuGMMY1v/D/w1WIg0vvBZIGcfK4
|
||||
mJO37M2CYfE45k+XmCpajQ==
|
||||
-----END CERTIFICATE-----
|
||||
|
||||
VeriSign Class 3 Public Primary Certification Authority - G4
|
||||
============================================================
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIDhDCCAwqgAwIBAgIQL4D+I4wOIg9IZxIokYesszAKBggqhkjOPQQDAzCByjELMAkGA1UEBhMC
|
||||
VVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBOZXR3
|
||||
b3JrMTowOAYDVQQLEzEoYykgMjAwNyBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVz
|
||||
ZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmlj
|
||||
YXRpb24gQXV0aG9yaXR5IC0gRzQwHhcNMDcxMTA1MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCByjEL
|
||||
MAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBU
|
||||
cnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNyBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRo
|
||||
b3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5
|
||||
IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzQwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAASnVnp8
|
||||
Utpkmw4tXNherJI9/gHmGUo9FANL+mAnINmDiWn6VMaaGF5VKmTeBvaNSjutEDxlPZCIBIngMGGz
|
||||
rl0Bp3vefLK+ymVhAIau2o970ImtTR1ZmkGxvEeA3J5iw/mjgbIwga8wDwYDVR0TAQH/BAUwAwEB
|
||||
/zAOBgNVHQ8BAf8EBAMCAQYwbQYIKwYBBQUHAQwEYTBfoV2gWzBZMFcwVRYJaW1hZ2UvZ2lmMCEw
|
||||
HzAHBgUrDgMCGgQUj+XTGoasjY5rw8+AatRIGCx7GS4wJRYjaHR0cDovL2xvZ28udmVyaXNpZ24u
|
||||
Y29tL3ZzbG9nby5naWYwHQYDVR0OBBYEFLMWkf3upm7ktS5Jj4d4gYDs5bG1MAoGCCqGSM49BAMD
|
||||
A2gAMGUCMGYhDBgmYFo4e1ZC4Kf8NoRRkSAsdk1DPcQdhCPQrNZ8NQbOzWm9kA3bbEhCHQ6qQgIx
|
||||
AJw9SDkjOVgaFRJZap7v1VmyHVIsmXHNxynfGyphe3HR3vPA5Q06Sqotp9iGKt0uEA==
|
||||
-----END CERTIFICATE-----
|
||||
Verisign Class 3 Public Primary Certification Authority
|
||||
=======================================================
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIICPDCCAaUCEDyRMcsf9tAbDpq40ES/Er4wDQYJKoZIhvcNAQEFBQAwXzELMAkGA1UEBhMCVVMx
|
||||
FzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFzcyAzIFB1YmxpYyBQcmltYXJ5
|
||||
IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTk2MDEyOTAwMDAwMFoXDTI4MDgwMjIzNTk1OVow
|
||||
XzELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFzcyAz
|
||||
IFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIGfMA0GCSqGSIb3DQEBAQUA
|
||||
A4GNADCBiQKBgQDJXFme8huKARS0EN8EQNvjV69qRUCPhAwL0TPZ2RHP7gJYHyX3KqhEBarsAx94
|
||||
f56TuZoAqiN91qyFomNFx3InzPRMxnVx0jnvT0Lwdd8KkMaOIG+YD/isI19wKTakyYbnsZogy1Ol
|
||||
hec9vn2a/iRFM9x2Fe0PonFkTGUugWhFpwIDAQABMA0GCSqGSIb3DQEBBQUAA4GBABByUqkFFBky
|
||||
CEHwxWsKzH4PIRnN5GfcX6kb5sroc50i2JhucwNhkcV8sEVAbkSdjbCxlnRhLQ2pRdKkkirWmnWX
|
||||
bj9T/UWZYB2oK0z5XqcJ2HUw19JlYD1n1khVdWk/kfVIC0dpImmClr7JyDiGSnoscxlIaU5rfGW/
|
||||
D/xwzoiQ
|
||||
-----END CERTIFICATE-----
|
||||
@@ -37,7 +37,7 @@ class PPRestCall
|
||||
public function __construct(\Paypal\Rest\ApiContext $apiContext)
|
||||
{
|
||||
$this->apiContext = $apiContext;
|
||||
$this->logger = new PPLoggingManager(__CLASS__, $apiContext->getConfig());
|
||||
$this->logger = PPLoggingManager::getInstance(__CLASS__);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -70,7 +70,7 @@ class PPRestCall
|
||||
}
|
||||
$connection = new PPHttpConnection($httpConfig, $config);
|
||||
$response = $connection->execute($data);
|
||||
$this->logger->fine($response);
|
||||
$this->logger->fine($response . PHP_EOL);
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
37
lib/PayPal/Validation/ArgumentValidator.php
Normal file
37
lib/PayPal/Validation/ArgumentValidator.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace PayPal\Validation;
|
||||
|
||||
/**
|
||||
* Class ArgumentValidator
|
||||
*
|
||||
* @package PayPal\Validation
|
||||
*/
|
||||
class ArgumentValidator
|
||||
{
|
||||
|
||||
/**
|
||||
* Helper method for validating an argument that will be used by this API in any requests.
|
||||
*
|
||||
* @param $argument mixed The object to be validated
|
||||
* @param $argumentName string|null The name of the argument.
|
||||
* This will be placed in the exception message for easy reference
|
||||
*/
|
||||
public static function validate($argument, $argumentName = null)
|
||||
{
|
||||
if (
|
||||
$argument != null &&
|
||||
(
|
||||
(gettype($argument) == 'string' && $argument == '')
|
||||
||
|
||||
is_array($argument) && empty($argument)
|
||||
)
|
||||
) {
|
||||
//Throw an Exception for string or array
|
||||
throw new \InvalidArgumentException("$argumentName cannot be null or empty");
|
||||
} elseif ($argument == null) {
|
||||
//Generic Exception
|
||||
throw new \InvalidArgumentException("$argumentName cannot be null");
|
||||
}
|
||||
}
|
||||
}
|
||||
44
lib/PayPal/Validation/ModelAccessorValidator.php
Normal file
44
lib/PayPal/Validation/ModelAccessorValidator.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace PayPal\Validation;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Core\PPConfigManager;
|
||||
use PayPal\Core\PPLoggingManager;
|
||||
|
||||
/**
|
||||
* Class ModelAccessorValidator
|
||||
*
|
||||
* @package PayPal\Validation
|
||||
*/
|
||||
class ModelAccessorValidator
|
||||
{
|
||||
/**
|
||||
* Helper method for validating if the class contains accessor methods (getter and setter) for a given attribute
|
||||
*
|
||||
* @param PPModel $class An object of PPModel
|
||||
* @param string $attributeName Attribute name
|
||||
* @return bool
|
||||
*/
|
||||
public static function validate(PPModel $class, $attributeName)
|
||||
{
|
||||
$mode = PPConfigManager::getInstance()->get('validation.level');
|
||||
if ($mode != 'disabled') {
|
||||
//If the mode is disabled, bypass the validation
|
||||
foreach (array('set' . $attributeName, 'get' . $attributeName) as $methodName) {
|
||||
//Check if both getter and setter exists for given attribute
|
||||
if (!method_exists($class, $methodName)) {
|
||||
//Delegate the error based on the choice
|
||||
$className = is_object($class) ? get_class($class) : (string)$class;
|
||||
$errorMessage = "Missing Accessor: $className:$methodName. Please let us know by creating an issue at https://github.com/paypal/rest-api-sdk-php/issues";
|
||||
PPLoggingManager::getInstance(__CLASS__)->warning($errorMessage);
|
||||
if ($mode == 'strict') {
|
||||
trigger_error($errorMessage, E_USER_NOTICE);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
26
lib/PayPal/Validation/UrlValidator.php
Normal file
26
lib/PayPal/Validation/UrlValidator.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace PayPal\Validation;
|
||||
|
||||
/**
|
||||
* Class UrlValidator
|
||||
*
|
||||
* @package PayPal\Validation
|
||||
*/
|
||||
class UrlValidator
|
||||
{
|
||||
|
||||
/**
|
||||
* Helper method for validating URLs that will be used by this API in any requests.
|
||||
*
|
||||
* @param $url
|
||||
* @param string|null $urlName
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public static function validate($url, $urlName = null)
|
||||
{
|
||||
if (filter_var($url, FILTER_VALIDATE_URL) === false) {
|
||||
throw new \InvalidArgumentException("$urlName is not a fully qualified URL");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,11 @@
|
||||
PayPal PHP SDK release notes
|
||||
============================
|
||||
|
||||
v0.12.0
|
||||
----
|
||||
* Enabled EC Parameters Support for Payment APIs
|
||||
* Enabled Validation for Missing Accessors
|
||||
|
||||
v0.11.1
|
||||
----
|
||||
* Removed Dependency from SDK Core Project
|
||||
|
||||
@@ -22,6 +22,8 @@ require __DIR__ . '/common.php';
|
||||
use PayPal\Rest\ApiContext;
|
||||
use PayPal\Auth\OAuthTokenCredential;
|
||||
|
||||
error_reporting(E_ALL);
|
||||
|
||||
/** @var \Paypal\Rest\ApiContext $apiContext */
|
||||
$apiContext = getApiContext();
|
||||
|
||||
@@ -60,7 +62,8 @@ function getApiContext()
|
||||
'http.ConnectionTimeOut' => 30,
|
||||
'log.LogEnabled' => true,
|
||||
'log.FileName' => '../PayPal.log',
|
||||
'log.LogLevel' => 'FINE'
|
||||
'log.LogLevel' => 'FINE',
|
||||
'validation.level' => 'log'
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@@ -21,13 +21,23 @@ mode=sandbox ; can be set to sandbox / live
|
||||
|
||||
log.LogEnabled=true
|
||||
|
||||
# When using a relative path, the log file is created
|
||||
# relative to the .php file that is the entry point
|
||||
# for this request. You can also provide an absolute
|
||||
# path here
|
||||
; When using a relative path, the log file is created
|
||||
; relative to the .php file that is the entry point
|
||||
; for this request. You can also provide an absolute
|
||||
; path here
|
||||
log.FileName=../PayPal.log
|
||||
|
||||
# Logging level can be one of FINE, INFO, WARN or ERROR
|
||||
# Logging is most verbose in the 'FINE' level and
|
||||
# decreases as you proceed towards ERROR
|
||||
; Logging level can be one of FINE, INFO, WARN or ERROR
|
||||
; Logging is most verbose in the 'FINE' level and
|
||||
; decreases as you proceed towards ERROR
|
||||
log.LogLevel=FINE
|
||||
|
||||
;Validation Configuration
|
||||
[validation]
|
||||
; If validation is set to strict, the PPModel would make sure that
|
||||
; there are proper accessors (Getters and Setters) for each model
|
||||
; objects. Accepted value is
|
||||
; 'log' : logs the error message to logger only (default)
|
||||
; 'strict' : throws a php notice message
|
||||
; 'disable' : disable the validation
|
||||
validation.level=strict
|
||||
@@ -3,7 +3,8 @@ namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Api\Address;
|
||||
|
||||
class AddressTest extends \PHPUnit_Framework_TestCase {
|
||||
class AddressTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
/** @var Address */
|
||||
private $address;
|
||||
@@ -17,7 +18,8 @@ class AddressTest extends \PHPUnit_Framework_TestCase {
|
||||
public static $phone = "716-298-1822";
|
||||
public static $type = "Billing";
|
||||
|
||||
public static function createAddress() {
|
||||
public static function createAddress()
|
||||
{
|
||||
$addr = new Address();
|
||||
$addr->setLine1(self::$line1);
|
||||
$addr->setLine2(self::$line2);
|
||||
@@ -29,11 +31,13 @@ class AddressTest extends \PHPUnit_Framework_TestCase {
|
||||
return $addr;
|
||||
}
|
||||
|
||||
public function setup() {
|
||||
public function setup()
|
||||
{
|
||||
$this->address = self::createAddress();
|
||||
}
|
||||
|
||||
public function testGetterSetter() {
|
||||
public function testGetterSetter()
|
||||
{
|
||||
$this->assertEquals(self::$line1, $this->address->getLine1());
|
||||
$this->assertEquals(self::$line2, $this->address->getLine2());
|
||||
$this->assertEquals(self::$city, $this->address->getCity());
|
||||
@@ -43,7 +47,8 @@ class AddressTest extends \PHPUnit_Framework_TestCase {
|
||||
$this->assertEquals(self::$phone, $this->address->getPhone());
|
||||
}
|
||||
|
||||
public function testSerializeDeserialize() {
|
||||
public function testSerializeDeserialize()
|
||||
{
|
||||
$a1 = $this->address;
|
||||
|
||||
$a2 = new Address();
|
||||
|
||||
@@ -5,14 +5,16 @@ namespace PayPal\Test\Api;
|
||||
use PayPal\Api\Amount;
|
||||
use PayPal\Test\Constants;
|
||||
|
||||
class AmountTest extends \PHPUnit_Framework_TestCase {
|
||||
class AmountTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
private $amounts;
|
||||
|
||||
public static $currency = "USD";
|
||||
public static $total = "1.12";
|
||||
|
||||
public static function createAmount() {
|
||||
public static function createAmount()
|
||||
{
|
||||
$amount = new Amount();
|
||||
$amount->setCurrency(self::$currency);
|
||||
$amount->setTotal(self::$total);
|
||||
@@ -20,7 +22,8 @@ class AmountTest extends \PHPUnit_Framework_TestCase {
|
||||
return $amount;
|
||||
}
|
||||
|
||||
public function setup() {
|
||||
public function setup()
|
||||
{
|
||||
$this->amounts['partial'] = self::createAmount();
|
||||
|
||||
$amount = self::createAmount();
|
||||
@@ -28,13 +31,15 @@ class AmountTest extends \PHPUnit_Framework_TestCase {
|
||||
$this->amounts['full'] = $amount;
|
||||
}
|
||||
|
||||
public function testGetterSetter() {
|
||||
public function testGetterSetter()
|
||||
{
|
||||
$this->assertEquals(self::$currency, $this->amounts['partial']->getCurrency());
|
||||
$this->assertEquals(self::$total, $this->amounts['partial']->getTotal());
|
||||
$this->assertEquals(DetailsTest::$fee, $this->amounts['full']->getDetails()->getFee());
|
||||
}
|
||||
|
||||
public function testSerializeDeserialize() {
|
||||
public function testSerializeDeserialize()
|
||||
{
|
||||
$a1 = $this->amounts['partial'];
|
||||
|
||||
$a2 = new Amount();
|
||||
|
||||
@@ -4,19 +4,20 @@ namespace PayPal\Test\Api;
|
||||
use PayPal\Api\Amount;
|
||||
use PayPal\Api\Authorization;
|
||||
use PayPal\Api\Links;
|
||||
use PayPal\Api\PayerInfo;
|
||||
use PayPal\Test\Constants;
|
||||
use PayPal\Api\RedirectUrls;
|
||||
use PayPal\Api\Address;
|
||||
|
||||
use PayPal\Api\Payer;
|
||||
use PayPal\Api\Capture;
|
||||
use PayPal\Api\CreditCard;
|
||||
use PayPal\Api\Payer;
|
||||
use PayPal\Api\Payment;
|
||||
use PayPal\Api\FundingInstrument;
|
||||
use PayPal\Api\Transaction;
|
||||
use PayPal\Exception\PPConnectionException;
|
||||
|
||||
class AuthorizationTest extends \PHPUnit_Framework_TestCase {
|
||||
class AuthorizationTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
private $authorizations = array();
|
||||
public static $create_time = "2013-02-28T00:00:00Z";
|
||||
public static $update_time = "2013-03-28T00:00:00Z";
|
||||
@@ -24,17 +25,20 @@ class AuthorizationTest extends \PHPUnit_Framework_TestCase {
|
||||
public static $state = "Created";
|
||||
public static $parent_payment = "PAY-12345";
|
||||
public static $valid_until = "2013-04-28T00:00:00Z";
|
||||
public static $clearing_time = "2013-04-28T00:00:00Z";
|
||||
public static $currency = "USD";
|
||||
public static $total = "1.12";
|
||||
public static $href = "USD";
|
||||
public static $rel = "1.12";
|
||||
public static $method = "1.12";
|
||||
|
||||
public static function createAuthorization() {
|
||||
public static function createAuthorization()
|
||||
{
|
||||
$authorization = new Authorization();
|
||||
$authorization->setCreateTime(self::$create_time);
|
||||
$authorization->setId(self::$id);
|
||||
$authorization->setState(self::$state);
|
||||
$authorization->setClearingTime(self::$clearing_time);
|
||||
|
||||
$authorization->setAmount(AmountTest::createAmount());
|
||||
$authorization->setLinks(array(LinksTest::createLinks()));
|
||||
@@ -89,7 +93,9 @@ class AuthorizationTest extends \PHPUnit_Framework_TestCase {
|
||||
return $authId = $resArray['transactions'][0]['related_resources'][0]['authorization']['id'];
|
||||
|
||||
}
|
||||
public function setup() {
|
||||
|
||||
public function setup()
|
||||
{
|
||||
$authorization = new Authorization();
|
||||
$authorization->setCreateTime(self::$create_time);
|
||||
$authorization->setUpdateTime(self::$update_time);
|
||||
@@ -97,12 +103,15 @@ class AuthorizationTest extends \PHPUnit_Framework_TestCase {
|
||||
$authorization->setState(self::$state);
|
||||
$authorization->setParentPayment(self::$parent_payment);
|
||||
$authorization->setValidUntil(self::$valid_until);
|
||||
$authorization->setClearingTime(self::$clearing_time);
|
||||
$this->authorizations['partial'] = $authorization;
|
||||
$this->authorizations['full'] = self::createAuthorization();
|
||||
|
||||
}
|
||||
|
||||
public function testGetterSetter() {
|
||||
public function testGetterSetter()
|
||||
{
|
||||
/** @var Authorization $authorization */
|
||||
$authorization = $this->authorizations['partial'];
|
||||
$this->assertEquals(self::$create_time, $authorization->getCreateTime());
|
||||
$this->assertEquals(self::$update_time, $authorization->getUpdateTime());
|
||||
@@ -110,13 +119,14 @@ class AuthorizationTest extends \PHPUnit_Framework_TestCase {
|
||||
$this->assertEquals(self::$state, $authorization->getState());
|
||||
$this->assertEquals(self::$parent_payment, $authorization->getParentPayment());
|
||||
$this->assertEquals(self::$valid_until, $authorization->getValidUntil());
|
||||
|
||||
$this->assertEquals(self::$clearing_time, $authorization->getClearingTime());
|
||||
$authorization = $this->authorizations['full'];
|
||||
$this->assertEquals(AmountTest::$currency, $authorization->getAmount()->getCurrency());
|
||||
$this->assertEquals(1, count($authorization->getLinks()));
|
||||
}
|
||||
|
||||
public function testSerializeDeserialize() {
|
||||
public function testSerializeDeserialize()
|
||||
{
|
||||
$a1 = $this->authorizations['partial'];
|
||||
$a2 = new Authorization();
|
||||
$a2->fromJson($a1->toJson());
|
||||
@@ -126,7 +136,8 @@ class AuthorizationTest extends \PHPUnit_Framework_TestCase {
|
||||
/**
|
||||
* @group integration
|
||||
*/
|
||||
public function testOperations() {
|
||||
public function testOperations()
|
||||
{
|
||||
try {
|
||||
$authId = self::authorize();
|
||||
$auth = Authorization::get($authId);
|
||||
@@ -141,7 +152,7 @@ class AuthorizationTest extends \PHPUnit_Framework_TestCase {
|
||||
$captur->setAmount($amount);
|
||||
|
||||
$capt = $auth->capture($captur);
|
||||
$this->assertNotNull( $capt->getId());
|
||||
$this->assertNotNull($capt->getId());
|
||||
|
||||
$authId = self::authorize();
|
||||
$auth = Authorization::get($authId);
|
||||
@@ -164,7 +175,8 @@ class AuthorizationTest extends \PHPUnit_Framework_TestCase {
|
||||
/**
|
||||
* @group integration
|
||||
*/
|
||||
public function testReauthorize() {
|
||||
public function testReauthorize()
|
||||
{
|
||||
$authorization = Authorization::get('7GH53639GA425732B');
|
||||
|
||||
$amount = new Amount();
|
||||
@@ -174,9 +186,9 @@ class AuthorizationTest extends \PHPUnit_Framework_TestCase {
|
||||
$authorization->setAmount($amount);
|
||||
try {
|
||||
$authorization->reauthorize();
|
||||
} catch (PPConnectionException $ex){
|
||||
} catch (PPConnectionException $ex) {
|
||||
//var_dump($ex->getMessage());
|
||||
$this->assertEquals(strpos($ex->getMessage(),"500"), false);
|
||||
$this->assertEquals(strpos($ex->getMessage(), "500"), false);
|
||||
}
|
||||
|
||||
$authorization->setId(null);
|
||||
|
||||
@@ -7,7 +7,8 @@ use PayPal\Api\Authorization;
|
||||
use PayPal\Api\Amount;
|
||||
use PayPal\Test\Constants;
|
||||
|
||||
class CaptureTest extends \PHPUnit_Framework_TestCase {
|
||||
class CaptureTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
private $captures;
|
||||
|
||||
@@ -17,7 +18,8 @@ class CaptureTest extends \PHPUnit_Framework_TestCase {
|
||||
public static $parent_payment = "PAY-123";
|
||||
public static $state = "Created";
|
||||
|
||||
public static function createCapture() {
|
||||
public static function createCapture()
|
||||
{
|
||||
$capture = new Capture();
|
||||
$capture->setCreateTime(self::$create_time);
|
||||
$capture->setId(self::$id);
|
||||
@@ -27,7 +29,8 @@ class CaptureTest extends \PHPUnit_Framework_TestCase {
|
||||
return $capture;
|
||||
}
|
||||
|
||||
public function setup() {
|
||||
public function setup()
|
||||
{
|
||||
$this->captures['partial'] = self::createCapture();
|
||||
|
||||
$capture = self::createCapture();
|
||||
@@ -36,7 +39,8 @@ class CaptureTest extends \PHPUnit_Framework_TestCase {
|
||||
$this->captures['full'] = $capture;
|
||||
}
|
||||
|
||||
public function testGetterSetter() {
|
||||
public function testGetterSetter()
|
||||
{
|
||||
$this->assertEquals(self::$create_time, $this->captures['partial']->getCreateTime());
|
||||
$this->assertEquals(self::$id, $this->captures['partial']->getId());
|
||||
$this->assertEquals(self::$parent_payment, $this->captures['partial']->getParentPayment());
|
||||
@@ -47,7 +51,8 @@ class CaptureTest extends \PHPUnit_Framework_TestCase {
|
||||
$this->assertEquals(LinksTest::$href, $links[0]->getHref());
|
||||
}
|
||||
|
||||
public function testSerializeDeserialize() {
|
||||
public function testSerializeDeserialize()
|
||||
{
|
||||
$c1 = $this->captures['partial'];
|
||||
|
||||
$c2 = new Capture();
|
||||
|
||||
@@ -7,7 +7,8 @@ use PayPal\Api\Address;
|
||||
use PayPal\Api\CreditCard;
|
||||
use PayPal\Test\Constants;
|
||||
|
||||
class CreditCardHistoryTest extends \PHPUnit_Framework_TestCase {
|
||||
class CreditCardHistoryTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
private $cards;
|
||||
|
||||
@@ -23,7 +24,8 @@ class CreditCardHistoryTest extends \PHPUnit_Framework_TestCase {
|
||||
public static $firstName = "V";
|
||||
public static $lastName = "C";
|
||||
|
||||
public static function createCreditCard() {
|
||||
public static function createCreditCard()
|
||||
{
|
||||
$card = new CreditCard();
|
||||
$card->setType(self::$cardType);
|
||||
$card->setNumber(self::$cardNumber);
|
||||
@@ -35,11 +37,11 @@ class CreditCardHistoryTest extends \PHPUnit_Framework_TestCase {
|
||||
$card->setId(self::$id);
|
||||
$card->setValidUntil(self::$validUntil);
|
||||
$card->setState(self::$state);
|
||||
$card->setPayerId(self::$payerId);
|
||||
return $card;
|
||||
}
|
||||
|
||||
public function setup() {
|
||||
public function setup()
|
||||
{
|
||||
|
||||
$card = self::createCreditCard();
|
||||
$card->setBillingAddress(AddressTest::createAddress());
|
||||
@@ -50,7 +52,8 @@ class CreditCardHistoryTest extends \PHPUnit_Framework_TestCase {
|
||||
$this->cards['partial'] = $card;
|
||||
}
|
||||
|
||||
public function testGetterSetters() {
|
||||
public function testGetterSetters()
|
||||
{
|
||||
$cardHistory = new CreditCardHistory();
|
||||
$cardHistory->setCreditCards(array($this->cards['partial'], $this->cards['full']));
|
||||
$cardHistory->setCount(2);
|
||||
@@ -59,7 +62,8 @@ class CreditCardHistoryTest extends \PHPUnit_Framework_TestCase {
|
||||
}
|
||||
|
||||
|
||||
public function testSerializationDeserialization() {
|
||||
public function testSerializationDeserialization()
|
||||
{
|
||||
$cardHistory = new CreditCardHistory();
|
||||
$cardHistory->setCreditCards(array($this->cards['partial'], $this->cards['full']));
|
||||
$cardHistory->setCount(2);
|
||||
|
||||
@@ -3,8 +3,11 @@ namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Api\Address;
|
||||
use PayPal\Api\CreditCard;
|
||||
use PayPal\Api\Links;
|
||||
use PayPal\Test\Constants;
|
||||
class CreditCardTest extends \PHPUnit_Framework_TestCase {
|
||||
|
||||
class CreditCardTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
private $cards;
|
||||
|
||||
@@ -20,7 +23,8 @@ class CreditCardTest extends \PHPUnit_Framework_TestCase {
|
||||
public static $firstName = "V";
|
||||
public static $lastName = "C";
|
||||
|
||||
public static function createCreditCard() {
|
||||
public static function createCreditCard()
|
||||
{
|
||||
$card = new CreditCard();
|
||||
$card->setType(self::$cardType);
|
||||
$card->setNumber(self::$cardNumber);
|
||||
@@ -29,11 +33,11 @@ class CreditCardTest extends \PHPUnit_Framework_TestCase {
|
||||
$card->setCvv2(self::$cvv);
|
||||
$card->setFirstName(self::$firstName);
|
||||
$card->setLastName(self::$lastName);
|
||||
$card->setPayerId(self::$payerId);
|
||||
return $card;
|
||||
}
|
||||
|
||||
public function setup() {
|
||||
public function setup()
|
||||
{
|
||||
|
||||
$card = self::createCreditCard();
|
||||
$card->setBillingAddress(AddressTest::createAddress());
|
||||
@@ -44,7 +48,9 @@ class CreditCardTest extends \PHPUnit_Framework_TestCase {
|
||||
$this->cards['partial'] = $card;
|
||||
}
|
||||
|
||||
public function testGetterSetters() {
|
||||
public function testGetterSetters()
|
||||
{
|
||||
/** @var CreditCard $c */
|
||||
$c = $this->cards['partial'];
|
||||
$this->assertEquals(self::$cardType, $c->getType());
|
||||
$this->assertEquals(self::$cardNumber, $c->getNumber());
|
||||
@@ -53,15 +59,17 @@ class CreditCardTest extends \PHPUnit_Framework_TestCase {
|
||||
$this->assertEquals(self::$cvv, $c->getCvv2());
|
||||
$this->assertEquals(self::$firstName, $c->getFirstName());
|
||||
$this->assertEquals(self::$lastName, $c->getLastName());
|
||||
$this->assertEquals(self::$payerId, $c->getPayerId());
|
||||
|
||||
$c = $this->cards['full'];
|
||||
$this->assertEquals(AddressTest::$line1, $c->getBillingAddress()->getLine1());
|
||||
/** @var Links[] $link */
|
||||
$link = $c->getLinks();
|
||||
$this->assertEquals(LinksTest::$href, $link[0]->getHref());
|
||||
}
|
||||
|
||||
public function testSerializeDeserialize() {
|
||||
public function testSerializeDeserialize()
|
||||
{
|
||||
/** @var CreditCard $c1 */
|
||||
$c1 = $this->cards['full'];
|
||||
$json = $c1->toJson();
|
||||
|
||||
@@ -74,10 +82,11 @@ class CreditCardTest extends \PHPUnit_Framework_TestCase {
|
||||
/**
|
||||
* @group integration
|
||||
*/
|
||||
public function testOperations() {
|
||||
public function testOperations()
|
||||
{
|
||||
/** @var CreditCard $c1 */
|
||||
$c1 = $this->cards['full'];
|
||||
|
||||
// $this->assertNull($c1->getId());
|
||||
$c1->create();
|
||||
$this->assertNotNull($c1->getId());
|
||||
|
||||
|
||||
@@ -4,30 +4,35 @@ namespace PayPal\Test\Api;
|
||||
use PayPal\Api\CreditCardToken;
|
||||
use PayPal\Test\Constants;
|
||||
|
||||
class CreditCardTokenTest extends \PHPUnit_Framework_TestCase {
|
||||
class CreditCardTokenTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
private $ccToken;
|
||||
|
||||
public static $payerId = "PAYER-123";
|
||||
public static $creditCardId = "CC-123";
|
||||
|
||||
public static function createCreditCardToken() {
|
||||
public static function createCreditCardToken()
|
||||
{
|
||||
$ccToken = new CreditCardToken();
|
||||
$ccToken->setPayerId(self::$payerId);
|
||||
$ccToken->setCreditCardId(self::$creditCardId);
|
||||
return $ccToken;
|
||||
}
|
||||
|
||||
public function setup() {
|
||||
public function setup()
|
||||
{
|
||||
$this->ccToken = self::createCreditCardToken();
|
||||
}
|
||||
|
||||
public function testGetterSetter() {
|
||||
public function testGetterSetter()
|
||||
{
|
||||
$this->assertEquals(self::$payerId, $this->ccToken->getPayerId());
|
||||
$this->assertEquals(self::$creditCardId, $this->ccToken->getCreditCardId());
|
||||
}
|
||||
|
||||
public function testSerializeDeserialize() {
|
||||
public function testSerializeDeserialize()
|
||||
{
|
||||
$t1 = $this->ccToken;
|
||||
|
||||
$t2 = new CreditCardToken();
|
||||
|
||||
@@ -4,7 +4,8 @@ namespace PayPal\Test\Api;
|
||||
use PayPal\Api\Details;
|
||||
use PayPal\Test\Constants;
|
||||
|
||||
class DetailsTest extends \PHPUnit_Framework_TestCase {
|
||||
class DetailsTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
private $amountDetails;
|
||||
|
||||
@@ -13,7 +14,8 @@ class DetailsTest extends \PHPUnit_Framework_TestCase {
|
||||
public static $shipping = "3.15";
|
||||
public static $fee = "4.99";
|
||||
|
||||
public static function createAmountDetails() {
|
||||
public static function createAmountDetails()
|
||||
{
|
||||
$amountDetails = new Details();
|
||||
$amountDetails->setSubtotal(self::$subtotal);
|
||||
$amountDetails->setTax(self::$tax);
|
||||
@@ -23,18 +25,21 @@ class DetailsTest extends \PHPUnit_Framework_TestCase {
|
||||
return $amountDetails;
|
||||
}
|
||||
|
||||
public function setup() {
|
||||
public function setup()
|
||||
{
|
||||
$this->amountDetails = self::createAmountDetails();
|
||||
}
|
||||
|
||||
public function testGetterSetters() {
|
||||
public function testGetterSetters()
|
||||
{
|
||||
$this->assertEquals(self::$subtotal, $this->amountDetails->getSubtotal());
|
||||
$this->assertEquals(self::$tax, $this->amountDetails->getTax());
|
||||
$this->assertEquals(self::$shipping, $this->amountDetails->getShipping());
|
||||
$this->assertEquals(self::$fee, $this->amountDetails->getFee());
|
||||
}
|
||||
|
||||
public function testSerializeDeserialize() {
|
||||
public function testSerializeDeserialize()
|
||||
{
|
||||
$a1 = $this->amountDetails;
|
||||
|
||||
$a2 = new Details();
|
||||
|
||||
@@ -5,28 +5,33 @@ namespace PayPal\Test\Api;
|
||||
use PayPal\Api\FundingInstrument;
|
||||
use PayPal\Test\Constants;
|
||||
|
||||
class FundingInstrumentTest extends \PHPUnit_Framework_TestCase {
|
||||
class FundingInstrumentTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
private $fi;
|
||||
|
||||
public static function createFundingInstrument() {
|
||||
public static function createFundingInstrument()
|
||||
{
|
||||
$fi = new FundingInstrument();
|
||||
$fi->setCreditCard(CreditCardTest::createCreditCard());
|
||||
$fi->setCreditCardToken(CreditCardTokenTest::createCreditCardToken());
|
||||
return $fi;
|
||||
}
|
||||
|
||||
public function setup() {
|
||||
public function setup()
|
||||
{
|
||||
$this->fi = self::createFundingInstrument();
|
||||
}
|
||||
|
||||
public function testGetterSetter() {
|
||||
public function testGetterSetter()
|
||||
{
|
||||
$this->assertEquals(CreditCardTest::$cardNumber, $this->fi->getCreditCard()->getNumber());
|
||||
$this->assertEquals(CreditCardTokenTest::$creditCardId,
|
||||
$this->fi->getCreditCardToken()->getCreditCardId());
|
||||
}
|
||||
|
||||
public function testSerializeDeserialize() {
|
||||
public function testSerializeDeserialize()
|
||||
{
|
||||
$fi1 = $this->fi;
|
||||
|
||||
$fi2 = new FundingInstrument();
|
||||
|
||||
@@ -5,7 +5,8 @@ use PayPal\Api\Item;
|
||||
use PayPal\Api\ItemList;
|
||||
use PayPal\Test\Constants;
|
||||
|
||||
class ItemListTest extends \PHPUnit_Framework_TestCase {
|
||||
class ItemListTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
private $items = array();
|
||||
|
||||
@@ -15,7 +16,8 @@ class ItemListTest extends \PHPUnit_Framework_TestCase {
|
||||
private static $sku = "AXVTY123";
|
||||
private static $currency = "USD";
|
||||
|
||||
public static function createItemList() {
|
||||
public static function createItemList()
|
||||
{
|
||||
|
||||
$item = ItemTest::createItem();
|
||||
|
||||
@@ -26,17 +28,20 @@ class ItemListTest extends \PHPUnit_Framework_TestCase {
|
||||
return $itemList;
|
||||
}
|
||||
|
||||
public function setup() {
|
||||
public function setup()
|
||||
{
|
||||
$this->items = self::createItemList();
|
||||
}
|
||||
|
||||
public function testGetterSetters() {
|
||||
public function testGetterSetters()
|
||||
{
|
||||
$items = $this->items->getItems();
|
||||
$this->assertEquals(ItemTest::createItem(), $items[0]);
|
||||
$this->assertEquals(ShippingAddressTest::createAddress(), $this->items->getShippingAddress());
|
||||
}
|
||||
|
||||
public function testSerializeDeserialize() {
|
||||
public function testSerializeDeserialize()
|
||||
{
|
||||
$itemList = new ItemList();
|
||||
$itemList->fromJson($this->items->toJSON());
|
||||
|
||||
|
||||
@@ -4,7 +4,8 @@ namespace PayPal\Test\Api;
|
||||
use PayPal\Api\Item;
|
||||
use PayPal\Test\Constants;
|
||||
|
||||
class ItemTest extends \PHPUnit_Framework_TestCase {
|
||||
class ItemTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
private $item;
|
||||
|
||||
@@ -14,7 +15,8 @@ class ItemTest extends \PHPUnit_Framework_TestCase {
|
||||
public static $sku = "AXVTY123";
|
||||
public static $currency = "USD";
|
||||
|
||||
public static function createItem() {
|
||||
public static function createItem()
|
||||
{
|
||||
$item = new Item();
|
||||
$item->setName(self::$name);
|
||||
$item->setPrice(self::$price);
|
||||
@@ -24,11 +26,14 @@ class ItemTest extends \PHPUnit_Framework_TestCase {
|
||||
|
||||
return $item;
|
||||
}
|
||||
public function setup() {
|
||||
|
||||
public function setup()
|
||||
{
|
||||
$this->item = ItemTest::createItem();
|
||||
}
|
||||
|
||||
public function testGetterSetters() {
|
||||
public function testGetterSetters()
|
||||
{
|
||||
$this->assertEquals(self::$name, $this->item->getName());
|
||||
$this->assertEquals(self::$price, $this->item->getPrice());
|
||||
$this->assertEquals(self::$sku, $this->item->getSku());
|
||||
@@ -36,7 +41,8 @@ class ItemTest extends \PHPUnit_Framework_TestCase {
|
||||
$this->assertEquals(self::$currency, $this->item->getCurrency());
|
||||
}
|
||||
|
||||
public function testSerializeDeserialize() {
|
||||
public function testSerializeDeserialize()
|
||||
{
|
||||
$item = new Item();
|
||||
$item->fromJson($this->item->toJSON());
|
||||
|
||||
|
||||
@@ -5,7 +5,8 @@ namespace PayPal\Test\Api;
|
||||
use PayPal\Api\Links;
|
||||
use PayPal\Test\Constants;
|
||||
|
||||
class LinksTest extends \PHPUnit_Framework_TestCase {
|
||||
class LinksTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
private $links;
|
||||
|
||||
@@ -13,7 +14,8 @@ class LinksTest extends \PHPUnit_Framework_TestCase {
|
||||
public static $rel = "1.12";
|
||||
public static $method = "1.12";
|
||||
|
||||
public static function createLinks() {
|
||||
public static function createLinks()
|
||||
{
|
||||
$links = new Links();
|
||||
$links->setHref(self::$href);
|
||||
$links->setRel(self::$rel);
|
||||
@@ -22,17 +24,20 @@ class LinksTest extends \PHPUnit_Framework_TestCase {
|
||||
return $links;
|
||||
}
|
||||
|
||||
public function setup() {
|
||||
public function setup()
|
||||
{
|
||||
$this->links = self::createLinks();
|
||||
}
|
||||
|
||||
public function testGetterSetters() {
|
||||
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() {
|
||||
public function testSerializeDeserialize()
|
||||
{
|
||||
$link2 = new Links();
|
||||
$link2->fromJson($this->links->toJSON());
|
||||
$this->assertEquals($this->links, $link2);
|
||||
|
||||
@@ -7,8 +7,10 @@ use PayPal\Api\Details;
|
||||
use PayPal\Api\Links;
|
||||
use PayPal\Test\Constants;
|
||||
|
||||
class OrderTest extends \PHPUnit_Framework_TestCase {
|
||||
class OrderTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
/** @var Order */
|
||||
private $order;
|
||||
|
||||
public static $id = 'O-0AA8876533760860M';
|
||||
@@ -18,40 +20,35 @@ class OrderTest extends \PHPUnit_Framework_TestCase {
|
||||
public static $parentPayment = 'PAY-0AL32935UM2331537KP5Y2VA';
|
||||
public static $reasonCode = 'order';
|
||||
|
||||
public static function createOrder() {
|
||||
public static function createOrder()
|
||||
{
|
||||
$order = new Order();
|
||||
|
||||
$links = LinksTest::createLinks();
|
||||
|
||||
$order->setId(self::$id);
|
||||
$order->setCreateTime(self::$createTime);
|
||||
$order->setUpdateTime(self::$updateTime);
|
||||
$order->setState(self::$state);
|
||||
$order->setAmount(AmountTest::createAmount());
|
||||
$order->setParentPayment(self::$parentPayment);
|
||||
$order->setLinks(array($links));
|
||||
$order->setReasonCode(self::$reasonCode);
|
||||
|
||||
return $order;
|
||||
}
|
||||
|
||||
public function setup() {
|
||||
public function setup()
|
||||
{
|
||||
$this->order = self::createOrder();
|
||||
}
|
||||
|
||||
public function testGetterSetter() {
|
||||
public function testGetterSetter()
|
||||
{
|
||||
|
||||
$this->assertEquals(self::$id, $this->order->getId());
|
||||
$this->assertEquals(self::$createTime, $this->order->getCreateTime());
|
||||
$this->assertEquals(self::$updateTime, $this->order->getUpdateTime());
|
||||
$this->assertEquals(self::$state, $this->order->getState());
|
||||
$this->assertEquals(AmountTest::$currency, $this->order->getAmount()->getCurrency());
|
||||
$this->assertEquals(self::$parentPayment, $this->order->getParentPayment());
|
||||
$links = (array)$this->order->getLinks();
|
||||
$this->assertEquals(LinksTest::$href, $links[0]->getHref());
|
||||
$this->assertEquals(self::$reasonCode, $this->order->getReasonCode());
|
||||
}
|
||||
|
||||
public function testSerializeDeserialize() {
|
||||
public function testSerializeDeserialize()
|
||||
{
|
||||
$o1 = $this->order;
|
||||
|
||||
$o2 = new Order();
|
||||
|
||||
@@ -5,7 +5,8 @@ namespace PayPal\Test\Api;
|
||||
use PayPal\Api\Payee;
|
||||
use PayPal\Test\Constants;
|
||||
|
||||
class PayeeTest extends \PHPUnit_Framework_TestCase {
|
||||
class PayeeTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
private $payee;
|
||||
|
||||
@@ -14,7 +15,8 @@ class PayeeTest extends \PHPUnit_Framework_TestCase {
|
||||
public static $phone = "+14081234566";
|
||||
|
||||
|
||||
public static function createPayee() {
|
||||
public static function createPayee()
|
||||
{
|
||||
$payee = new Payee();
|
||||
$payee->setEmail(self::$email);
|
||||
$payee->setMerchantId(self::$merchant_id);
|
||||
@@ -23,17 +25,20 @@ class PayeeTest extends \PHPUnit_Framework_TestCase {
|
||||
return $payee;
|
||||
}
|
||||
|
||||
public function setup() {
|
||||
public function setup()
|
||||
{
|
||||
$this->payee = self::createPayee();
|
||||
}
|
||||
|
||||
public function testGetterSetter() {
|
||||
public function testGetterSetter()
|
||||
{
|
||||
$this->assertEquals(self::$email, $this->payee->getEmail());
|
||||
$this->assertEquals(self::$merchant_id, $this->payee->getMerchantId());
|
||||
$this->assertEquals(self::$phone, $this->payee->getPhone());
|
||||
}
|
||||
|
||||
public function testSerializeDeserialize() {
|
||||
public function testSerializeDeserialize()
|
||||
{
|
||||
$p1 = $this->payee;
|
||||
|
||||
$p2 = new Payee();
|
||||
|
||||
@@ -4,7 +4,8 @@ namespace PayPal\Test\Api;
|
||||
use PayPal\Api\PayerInfo;
|
||||
use PayPal\Test\Constants;
|
||||
|
||||
class PayerInfoTest extends \PHPUnit_Framework_TestCase {
|
||||
class PayerInfoTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
private $payerInfo;
|
||||
|
||||
@@ -14,7 +15,8 @@ class PayerInfoTest extends \PHPUnit_Framework_TestCase {
|
||||
public static $phone = "408-1234-5687";
|
||||
public static $payerId = "PAYER-1234";
|
||||
|
||||
public static function createPayerInfo() {
|
||||
public static function createPayerInfo()
|
||||
{
|
||||
$payerInfo = new PayerInfo();
|
||||
$payerInfo->setEmail(self::$email);
|
||||
$payerInfo->setFirstName(self::$firstName);
|
||||
@@ -26,11 +28,13 @@ class PayerInfoTest extends \PHPUnit_Framework_TestCase {
|
||||
return $payerInfo;
|
||||
}
|
||||
|
||||
public function setup() {
|
||||
public function setup()
|
||||
{
|
||||
$this->payerInfo = self::createPayerInfo();
|
||||
}
|
||||
|
||||
public function testGetterSetter() {
|
||||
public function testGetterSetter()
|
||||
{
|
||||
$this->assertEquals(self::$email, $this->payerInfo->getEmail());
|
||||
$this->assertEquals(self::$firstName, $this->payerInfo->getFirstName());
|
||||
$this->assertEquals(self::$lastName, $this->payerInfo->getLastName());
|
||||
@@ -39,7 +43,8 @@ class PayerInfoTest extends \PHPUnit_Framework_TestCase {
|
||||
$this->assertEquals(ShippingAddressTest::$line1, $this->payerInfo->getShippingAddress()->getLine1());
|
||||
}
|
||||
|
||||
public function testSerializeDeserialize() {
|
||||
public function testSerializeDeserialize()
|
||||
{
|
||||
$p1 = $this->payerInfo;
|
||||
|
||||
$p2 = new PayerInfo();
|
||||
|
||||
@@ -7,13 +7,15 @@ use PayPal\Api\FundingInstrument;
|
||||
use PayPal\Api\Payer;
|
||||
use PayPal\Test\Constants;
|
||||
|
||||
class PayerTest extends \PHPUnit_Framework_TestCase {
|
||||
class PayerTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
private $payer;
|
||||
|
||||
private static $paymentMethod = "credit_card";
|
||||
|
||||
public static function createPayer() {
|
||||
public static function createPayer()
|
||||
{
|
||||
$payer = new Payer();
|
||||
$payer->setPaymentMethod(self::$paymentMethod);
|
||||
$payer->setPayerInfo(PayerInfoTest::createPayerInfo());
|
||||
@@ -22,11 +24,13 @@ class PayerTest extends \PHPUnit_Framework_TestCase {
|
||||
return $payer;
|
||||
}
|
||||
|
||||
public function setup() {
|
||||
public function setup()
|
||||
{
|
||||
$this->payer = self::createPayer();
|
||||
}
|
||||
|
||||
public function testGetterSetter() {
|
||||
public function testGetterSetter()
|
||||
{
|
||||
$this->assertEquals(self::$paymentMethod, $this->payer->getPaymentMethod());
|
||||
$this->assertEquals(PayerInfoTest::$email, $this->payer->getPayerInfo()->getEmail());
|
||||
|
||||
@@ -34,7 +38,8 @@ class PayerTest extends \PHPUnit_Framework_TestCase {
|
||||
$this->assertEquals(CreditCardTokenTest::$creditCardId, $fi[0]->getCreditCardToken()->getCreditCardId());
|
||||
}
|
||||
|
||||
public function testSerializeDeserialize() {
|
||||
public function testSerializeDeserialize()
|
||||
{
|
||||
$p1 = $this->payer;
|
||||
|
||||
$p2 = new Payer();
|
||||
|
||||
@@ -5,31 +5,38 @@ namespace PayPal\Test\Api;
|
||||
use PayPal\Api\PaymentHistory;
|
||||
use PayPal\Test\Constants;
|
||||
|
||||
class PaymentHistoryTest extends \PHPUnit_Framework_TestCase {
|
||||
class PaymentHistoryTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
/** @var PaymentHistory */
|
||||
private $history;
|
||||
|
||||
public static $count = "10";
|
||||
public static $count = 10;
|
||||
public static $nextId = "11";
|
||||
|
||||
public static function createPaymentHistory() {
|
||||
public static function createPaymentHistory()
|
||||
{
|
||||
$history = new PaymentHistory();
|
||||
$history->setCount(self::$count);
|
||||
$history->setNextId(self::$nextId);
|
||||
$history->setPayments(array(PaymentTest::createPayment()));
|
||||
return $history;
|
||||
}
|
||||
public function setup() {
|
||||
|
||||
public function setup()
|
||||
{
|
||||
$this->history = PaymentHistoryTest::createPaymentHistory();
|
||||
}
|
||||
|
||||
public function testGetterSetters() {
|
||||
public function testGetterSetters()
|
||||
{
|
||||
$this->assertEquals(self::$count, $this->history->getCount());
|
||||
$this->assertEquals(self::$nextId, $this->history->getNextId());
|
||||
|
||||
}
|
||||
|
||||
public function testSerializeDeserialize() {
|
||||
public function testSerializeDeserialize()
|
||||
{
|
||||
$history = new PaymentHistory();
|
||||
$history->fromJson($this->history->toJSON());
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Api\RedirectUrls;
|
||||
use PayPal\Api\Address;
|
||||
use PayPal\Api\Amount;
|
||||
@@ -10,11 +11,13 @@ use PayPal\Api\FundingInstrument;
|
||||
use PayPal\Api\Transaction;
|
||||
use PayPal\Test\Constants;
|
||||
|
||||
class PaymentTest extends \PHPUnit_Framework_TestCase {
|
||||
class PaymentTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
private $payments;
|
||||
|
||||
public static function createPayment() {
|
||||
public static function createPayment()
|
||||
{
|
||||
|
||||
$redirectUrls = new RedirectUrls();
|
||||
$redirectUrls->setReturnUrl("http://localhost/return");
|
||||
@@ -29,7 +32,8 @@ class PaymentTest extends \PHPUnit_Framework_TestCase {
|
||||
return $payment;
|
||||
}
|
||||
|
||||
public static function createNewPayment() {
|
||||
public static function createNewPayment()
|
||||
{
|
||||
|
||||
$funding = FundingInstrumentTest::createFundingInstrument();
|
||||
$funding->credit_card_token = null;
|
||||
@@ -55,12 +59,14 @@ class PaymentTest extends \PHPUnit_Framework_TestCase {
|
||||
return $payment;
|
||||
}
|
||||
|
||||
public function setup() {
|
||||
public function setup()
|
||||
{
|
||||
$this->payments['full'] = self::createPayment();
|
||||
$this->payments['new'] = self::createNewPayment();
|
||||
}
|
||||
|
||||
public function testSerializeDeserialize() {
|
||||
public function testSerializeDeserialize()
|
||||
{
|
||||
$p2 = new Payment();
|
||||
$p2->fromJson($this->payments['full']->toJSON());
|
||||
$this->assertEquals($p2, $this->payments['full']);
|
||||
@@ -69,7 +75,8 @@ class PaymentTest extends \PHPUnit_Framework_TestCase {
|
||||
/**
|
||||
* @group integration
|
||||
*/
|
||||
public function testOperations() {
|
||||
public function testOperations()
|
||||
{
|
||||
|
||||
$p1 = $this->payments['new'];
|
||||
|
||||
@@ -82,4 +89,92 @@ class PaymentTest extends \PHPUnit_Framework_TestCase {
|
||||
$paymentHistory = Payment::all(array('count' => '10'));
|
||||
$this->assertNotNull($paymentHistory);
|
||||
}
|
||||
|
||||
/**
|
||||
* @group integration
|
||||
*
|
||||
* Tests Additional_fields, shipping_discount and insurance information.
|
||||
* Additional Information: https://developer.paypal.com/docs/integration/direct/explore-payment-capabilities/
|
||||
*/
|
||||
public function testECParameters()
|
||||
{
|
||||
$json = '{
|
||||
"intent": "sale",
|
||||
"redirect_urls": {
|
||||
"return_url": "http://www.return.com",
|
||||
"cancel_url": "http://www.cancel.com"
|
||||
},
|
||||
"payer": {
|
||||
"payment_method": "paypal",
|
||||
"payer_info": {
|
||||
"tax_id_type": "BR_CPF",
|
||||
"tax_id": "Fh618775690"
|
||||
}
|
||||
},
|
||||
"transactions": [
|
||||
{
|
||||
"amount": {
|
||||
"total": "34.07",
|
||||
"currency": "USD",
|
||||
"details": {
|
||||
"subtotal": "30.00",
|
||||
"tax": "0.07",
|
||||
"shipping": "1.00",
|
||||
"handling_fee": "1.00",
|
||||
"shipping_discount": "1.00",
|
||||
"insurance": "1.00"
|
||||
}
|
||||
},
|
||||
"description": "This is the payment transaction description.",
|
||||
"custom": "EBAY_EMS_90048630024435",
|
||||
"invoice_number": "48787589677",
|
||||
"payment_options": {
|
||||
"allowed_payment_method": "INSTANT_FUNDING_SOURCE"
|
||||
},
|
||||
"soft_descriptor": "ECHI5786786",
|
||||
"item_list": {
|
||||
"items": [
|
||||
{
|
||||
"name": "bowling",
|
||||
"description": "Bowling Team Shirt",
|
||||
"quantity": "5",
|
||||
"price": "3",
|
||||
"tax": "0.01",
|
||||
"sku": "1",
|
||||
"currency": "USD"
|
||||
},
|
||||
{
|
||||
"name": "mesh",
|
||||
"description": "80s Mesh Sleeveless Shirt",
|
||||
"quantity": "1",
|
||||
"price": "15",
|
||||
"tax": "0.02",
|
||||
"sku": "product34",
|
||||
"currency": "USD"
|
||||
}
|
||||
],
|
||||
"shipping_address": {
|
||||
"recipient_name": "Betsy Buyer",
|
||||
"line1": "111 First Street",
|
||||
"city": "Saratoga",
|
||||
"country_code": "US",
|
||||
"postal_code": "95070",
|
||||
"state": "CA"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}';
|
||||
$payment = new Payment();
|
||||
$payment->fromJson($json);
|
||||
|
||||
$payment->create();
|
||||
|
||||
$result = Payment::get($payment->getId());
|
||||
$transactions = $result->getTransactions();
|
||||
$transaction = $transactions[0];
|
||||
$this->assertEquals($transaction->getAmount()->getDetails()->getShippingDiscount(), '1.00');
|
||||
$this->assertEquals($transaction->getAmount()->getDetails()->getInsurance(), '1.00');
|
||||
$this->assertEquals($transaction->getAmount()->getDetails()->getHandlingFee(), '1.00');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,15 +3,18 @@ namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Api\RedirectUrls;
|
||||
|
||||
class RedirectUrlsTest extends \PHPUnit_Framework_TestCase {
|
||||
class RedirectUrlsTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
public function validRedirectUrlsProvider() {
|
||||
public function validRedirectUrlsProvider()
|
||||
{
|
||||
return array(
|
||||
array('https://devtools-paypal.com/guide/pay_paypal/php?success=true', 'https://devtools-paypal.com/guide/pay_paypal/php?cancel=true')
|
||||
);
|
||||
}
|
||||
|
||||
public function invalidRedirectUrlsProvider() {
|
||||
public function invalidRedirectUrlsProvider()
|
||||
{
|
||||
return array(
|
||||
array('devtools-paypal.com/guide/pay_paypal/php?success=true', 'devtools-paypal.com/guide/pay_paypal/php?cancel=true')
|
||||
);
|
||||
@@ -20,10 +23,11 @@ class RedirectUrlsTest extends \PHPUnit_Framework_TestCase {
|
||||
/**
|
||||
* @dataProvider validRedirectUrlsProvider
|
||||
*/
|
||||
public function testValidRedirectUrls($return_url, $cancel_url) {
|
||||
public function testValidRedirectUrls($return_url, $cancel_url)
|
||||
{
|
||||
$redirectUrls = new RedirectUrls();
|
||||
$redirectUrls->setReturn_url($return_url);
|
||||
$redirectUrls->setCancel_url($cancel_url);
|
||||
$redirectUrls->setReturnUrl($return_url);
|
||||
$redirectUrls->setCancelUrl($cancel_url);
|
||||
|
||||
$this->assertEquals($return_url, $redirectUrls->getReturnUrl());
|
||||
$this->assertEquals($cancel_url, $redirectUrls->getCancelUrl());
|
||||
@@ -32,7 +36,8 @@ class RedirectUrlsTest extends \PHPUnit_Framework_TestCase {
|
||||
/**
|
||||
* @dataProvider invalidRedirectUrlsProvider
|
||||
*/
|
||||
public function testInvalidRedirectUrls($return_url, $cancel_url) {
|
||||
public function testInvalidRedirectUrls($return_url, $cancel_url)
|
||||
{
|
||||
$redirectUrls = new RedirectUrls();
|
||||
$this->setExpectedException('\InvalidArgumentException');
|
||||
$redirectUrls->setReturnUrl($return_url);
|
||||
|
||||
@@ -4,7 +4,8 @@ namespace PayPal\Test\Api;
|
||||
use PayPal\Api\Refund;
|
||||
use PayPal\Test\Constants;
|
||||
|
||||
class RefundTest extends \PHPUnit_Framework_TestCase {
|
||||
class RefundTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
private $refund;
|
||||
|
||||
@@ -13,7 +14,8 @@ class RefundTest extends \PHPUnit_Framework_TestCase {
|
||||
public static $id = "R-5678";
|
||||
public static $parentPayment = "PAY-123";
|
||||
|
||||
public static function createRefund() {
|
||||
public static function createRefund()
|
||||
{
|
||||
$refund = new Refund();
|
||||
$refund->setCreateTime(self::$createTime);
|
||||
$refund->setAmount(AmountTest::createAmount());
|
||||
@@ -25,11 +27,13 @@ class RefundTest extends \PHPUnit_Framework_TestCase {
|
||||
return $refund;
|
||||
}
|
||||
|
||||
public function setup() {
|
||||
public function setup()
|
||||
{
|
||||
$this->refund = self::createRefund();
|
||||
}
|
||||
|
||||
public function testGetterSetter() {
|
||||
public function testGetterSetter()
|
||||
{
|
||||
$this->assertEquals(self::$captureId, $this->refund->getCaptureId());
|
||||
$this->assertEquals(self::$createTime, $this->refund->getCreateTime());
|
||||
$this->assertEquals(self::$id, $this->refund->getId());
|
||||
@@ -39,7 +43,8 @@ class RefundTest extends \PHPUnit_Framework_TestCase {
|
||||
$this->assertEquals(LinksTest::$href, $links[0]->getHref());
|
||||
}
|
||||
|
||||
public function testSerializeDeserialize() {
|
||||
public function testSerializeDeserialize()
|
||||
{
|
||||
$r1 = $this->refund;
|
||||
|
||||
$r2 = new Refund();
|
||||
@@ -48,7 +53,8 @@ class RefundTest extends \PHPUnit_Framework_TestCase {
|
||||
$this->assertEquals($r1, $r2);
|
||||
}
|
||||
|
||||
public function testOperations() {
|
||||
public function testOperations()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -4,11 +4,13 @@ namespace PayPal\Test\Api;
|
||||
use PayPal\Api\RelatedResources;
|
||||
use PayPal\Test\Constants;
|
||||
|
||||
class RelatedResourcesTest extends \PHPUnit_Framework_TestCase {
|
||||
class RelatedResourcesTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
private $RelatedResources;
|
||||
|
||||
public static function createRelatedResources() {
|
||||
public static function createRelatedResources()
|
||||
{
|
||||
$relatedResources = new RelatedResources();
|
||||
$relatedResources->setAuthorization(AuthorizationTest::createAuthorization());
|
||||
$relatedResources->setCapture(CaptureTest::createCapture());
|
||||
@@ -16,17 +18,20 @@ class RelatedResourcesTest extends \PHPUnit_Framework_TestCase {
|
||||
return $relatedResources;
|
||||
}
|
||||
|
||||
public function setup() {
|
||||
public function setup()
|
||||
{
|
||||
$this->relatedResources = self::createRelatedResources();
|
||||
}
|
||||
|
||||
public function testGetterSetter() {
|
||||
public function testGetterSetter()
|
||||
{
|
||||
$this->assertEquals(AuthorizationTest::$create_time, $this->relatedResources->getAuthorization()->getCreateTime());
|
||||
$this->assertEquals(CaptureTest::$create_time, $this->relatedResources->getCapture()->getCreateTime());
|
||||
$this->assertEquals(OrderTest::$id, $this->relatedResources->getOrder()->getId());
|
||||
}
|
||||
|
||||
public function testSerializeDeserialize() {
|
||||
public function testSerializeDeserialize()
|
||||
{
|
||||
$s1 = $this->relatedResources;
|
||||
|
||||
$s2 = new RelatedResources();
|
||||
|
||||
@@ -9,8 +9,10 @@ use PayPal\Test\Api\PaymentTest;
|
||||
use PayPal\Test\Api\LinksTest;
|
||||
use PayPal\Exception\PPConnectionException;
|
||||
|
||||
class SaleTest extends \PHPUnit_Framework_TestCase {
|
||||
class SaleTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
/** @var Sale */
|
||||
private $sale;
|
||||
|
||||
public static $captureId = "CAP-123";
|
||||
@@ -19,32 +21,33 @@ class SaleTest extends \PHPUnit_Framework_TestCase {
|
||||
public static $parentPayment = "PAY-123";
|
||||
public static $state = "Created";
|
||||
|
||||
public static function createSale() {
|
||||
public static function createSale()
|
||||
{
|
||||
$sale = new Sale();
|
||||
$sale->setAmount(AmountTest::createAmount());
|
||||
$sale->setCreateTime(self::$createTime);
|
||||
$sale->setId(self::$id);
|
||||
$sale->setLinks(array(LinksTest::createLinks()));
|
||||
$sale->setParentPayment(self::$parentPayment);
|
||||
$sale->setState(self::$state);
|
||||
return $sale;
|
||||
}
|
||||
|
||||
public function setup() {
|
||||
public function setup()
|
||||
{
|
||||
$this->sale = self::createSale();
|
||||
}
|
||||
|
||||
public function testGetterSetter() {
|
||||
public function testGetterSetter()
|
||||
{
|
||||
$this->assertEquals(self::$createTime, $this->sale->getCreateTime());
|
||||
$this->assertEquals(self::$id, $this->sale->getId());
|
||||
$this->assertEquals(self::$parentPayment, $this->sale->getParentPayment());
|
||||
$this->assertEquals(self::$state, $this->sale->getState());
|
||||
$this->assertEquals(AmountTest::$currency, $this->sale->getAmount()->getCurrency());
|
||||
$links = $this->sale->getLinks();
|
||||
$this->assertEquals(LinksTest::$href, $links[0]->getHref());
|
||||
}
|
||||
|
||||
public function testSerializeDeserialize() {
|
||||
public function testSerializeDeserialize()
|
||||
{
|
||||
$s1 = $this->sale;
|
||||
|
||||
$s2 = new Sale();
|
||||
@@ -56,7 +59,8 @@ class SaleTest extends \PHPUnit_Framework_TestCase {
|
||||
/**
|
||||
* @group integration
|
||||
*/
|
||||
public function testOperations() {
|
||||
public function testOperations()
|
||||
{
|
||||
try {
|
||||
$payment = PaymentTest::createNewPayment();
|
||||
$payment->create();
|
||||
|
||||
@@ -4,7 +4,8 @@ namespace PayPal\Test\Api;
|
||||
use PayPal\Api\ShippingAddress;
|
||||
use PayPal\Test\Constants;
|
||||
|
||||
class ShippingAddressTest extends \PHPUnit_Framework_TestCase {
|
||||
class ShippingAddressTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
private $address;
|
||||
|
||||
@@ -17,7 +18,8 @@ class ShippingAddressTest extends \PHPUnit_Framework_TestCase {
|
||||
public static $phone = "716-298-1822";
|
||||
public static $recipientName = "TestUser";
|
||||
|
||||
public static function createAddress() {
|
||||
public static function createAddress()
|
||||
{
|
||||
$addr = new ShippingAddress();
|
||||
$addr->setLine1(self::$line1);
|
||||
$addr->setLine2(self::$line2);
|
||||
@@ -30,11 +32,13 @@ class ShippingAddressTest extends \PHPUnit_Framework_TestCase {
|
||||
return $addr;
|
||||
}
|
||||
|
||||
public function setup() {
|
||||
public function setup()
|
||||
{
|
||||
$this->address = self::createAddress();
|
||||
}
|
||||
|
||||
public function testGetterSetter() {
|
||||
public function testGetterSetter()
|
||||
{
|
||||
$this->assertEquals(self::$line1, $this->address->getLine1());
|
||||
$this->assertEquals(self::$line2, $this->address->getLine2());
|
||||
$this->assertEquals(self::$city, $this->address->getCity());
|
||||
@@ -45,7 +49,8 @@ class ShippingAddressTest extends \PHPUnit_Framework_TestCase {
|
||||
$this->assertEquals(self::$recipientName, $this->address->getRecipientName());
|
||||
}
|
||||
|
||||
public function testSerializeDeserialize() {
|
||||
public function testSerializeDeserialize()
|
||||
{
|
||||
$a1 = $this->address;
|
||||
|
||||
$a2 = new ShippingAddress();
|
||||
|
||||
@@ -7,7 +7,8 @@ use PayPal\Api\SubTransaction;
|
||||
use PayPal\Api\Transaction;
|
||||
use PayPal\Test\Constants;
|
||||
|
||||
class TransactionTest extends \PHPUnit_Framework_TestCase {
|
||||
class TransactionTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
private $transaction;
|
||||
|
||||
@@ -17,7 +18,8 @@ class TransactionTest extends \PHPUnit_Framework_TestCase {
|
||||
public static $softDescriptor = "descriptor";
|
||||
public static $total = "1.12";
|
||||
|
||||
public static function createTransaction() {
|
||||
public static function createTransaction()
|
||||
{
|
||||
$transaction = new Transaction();
|
||||
$transaction->setAmount(AmountTest::createAmount());
|
||||
$transaction->setDescription(self::$description);
|
||||
@@ -26,15 +28,17 @@ class TransactionTest extends \PHPUnit_Framework_TestCase {
|
||||
$transaction->setSoftDescriptor(self::$softDescriptor);
|
||||
$transaction->setItemList(ItemListTest::createItemList());
|
||||
$transaction->setPayee(PayeeTest::createPayee());
|
||||
$transaction->setRelatedResources( array(RelatedResourcesTest::createRelatedResources()) );
|
||||
$transaction->setRelatedResources(array(RelatedResourcesTest::createRelatedResources()));
|
||||
return $transaction;
|
||||
}
|
||||
|
||||
public function setup() {
|
||||
public function setup()
|
||||
{
|
||||
$this->transaction = self::createTransaction();
|
||||
}
|
||||
|
||||
public function testGetterSetter() {
|
||||
public function testGetterSetter()
|
||||
{
|
||||
$this->assertEquals(AmountTest::$currency, $this->transaction->getAmount()->getCurrency());
|
||||
$this->assertEquals(self::$description, $this->transaction->getDescription());
|
||||
$this->assertEquals(self::$invoiceNumber, $this->transaction->getInvoiceNumber());
|
||||
@@ -47,7 +51,8 @@ class TransactionTest extends \PHPUnit_Framework_TestCase {
|
||||
$this->assertEquals(AuthorizationTest::$create_time, $resources[0]->getAuthorization()->getCreateTime());
|
||||
}
|
||||
|
||||
public function testSerializeDeserialize() {
|
||||
public function testSerializeDeserialize()
|
||||
{
|
||||
$t1 = $this->transaction;
|
||||
|
||||
$t2 = new Transaction();
|
||||
|
||||
@@ -6,12 +6,15 @@ use PayPal\Auth\OAuthTokenCredential;
|
||||
use PayPal\Test\Constants;
|
||||
use PayPal\Core\PPConfigManager;
|
||||
use PayPal\Exception\PPConnectionException;
|
||||
class OAuthTokenCredentialTest extends PHPUnit_Framework_TestCase {
|
||||
|
||||
class OAuthTokenCredentialTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* @group integration
|
||||
*/
|
||||
public function testGetAccessToken() {
|
||||
public function testGetAccessToken()
|
||||
{
|
||||
$cred = new OAuthTokenCredential(Constants::CLIENT_ID, Constants::CLIENT_SECRET);
|
||||
$config = PPConfigManager::getInstance()->getConfigHashmap();
|
||||
$token = $cred->getAccessToken($config);
|
||||
@@ -26,7 +29,8 @@ class OAuthTokenCredentialTest extends PHPUnit_Framework_TestCase {
|
||||
/**
|
||||
* @group integration
|
||||
*/
|
||||
public function testInvalidCredentials() {
|
||||
public function testInvalidCredentials()
|
||||
{
|
||||
$this->setExpectedException('PayPal\Exception\PPConnectionException');
|
||||
$cred = new OAuthTokenCredential('dummy', 'secret');
|
||||
$this->assertNull($cred->getAccessToken(PPConfigManager::getInstance()->getConfigHashmap()));
|
||||
|
||||
@@ -1,29 +1,41 @@
|
||||
<?php
|
||||
namespace PayPal\Test\Common;
|
||||
use PayPal\Common\PPModel;
|
||||
class ArrayClass extends PPModel {
|
||||
|
||||
public function setName($name) {
|
||||
use PayPal\Common\PPModel;
|
||||
|
||||
class ArrayClass extends PPModel
|
||||
{
|
||||
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
}
|
||||
public function getName() {
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function setDescription($desc) {
|
||||
$this->desc = $desc;
|
||||
}
|
||||
public function getDescription() {
|
||||
return $this->desc;
|
||||
public function setDescription($description)
|
||||
{
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
public function setTags($tags) {
|
||||
if(!is_array($tags)) {
|
||||
public function getDescription()
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
public function setTags($tags)
|
||||
{
|
||||
if (!is_array($tags)) {
|
||||
$tags = array($tags);
|
||||
}
|
||||
$this->tags = $tags;
|
||||
}
|
||||
public function getTags() {
|
||||
|
||||
public function getTags()
|
||||
{
|
||||
return $this->tags;
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,13 @@
|
||||
<?php
|
||||
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()
|
||||
{
|
||||
|
||||
$arr = array(1, 2, 3);
|
||||
$this->assertEquals(false, PPArrayUtil::isAssocArray($arr));
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
<?php
|
||||
namespace PayPal\Test\Common;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
class ChildClass extends SimpleClass {
|
||||
|
||||
class ChildClass extends SimpleClass
|
||||
{
|
||||
|
||||
}
|
||||
@@ -1,12 +1,13 @@
|
||||
<?php
|
||||
namespace PayPal\Test\Common;
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Test\Common\ArrayClass;
|
||||
use PayPal\Test\Common\SimpleClass;
|
||||
use PayPal\Test\Common\NestedClass;
|
||||
class ModelTest extends \PHPUnit_Framework_TestCase {
|
||||
|
||||
public function testSimpleClassConversion() {
|
||||
use PayPal\Core\PPConfigManager;
|
||||
|
||||
class ModelTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
public function testSimpleClassConversion()
|
||||
{
|
||||
$o = new SimpleClass();
|
||||
$o->setName("test");
|
||||
$o->setDescription("description");
|
||||
@@ -15,7 +16,7 @@ class ModelTest extends \PHPUnit_Framework_TestCase {
|
||||
$this->assertEquals("description", $o->getDescription());
|
||||
|
||||
$json = $o->toJSON();
|
||||
$this->assertEquals('{"name":"test","desc":"description"}', $json);
|
||||
$this->assertEquals('{"name":"test","description":"description"}', $json);
|
||||
|
||||
$newO = new SimpleClass();
|
||||
$newO->fromJson($json);
|
||||
@@ -23,8 +24,110 @@ class ModelTest extends \PHPUnit_Framework_TestCase {
|
||||
|
||||
}
|
||||
|
||||
public function testConstructorJSON()
|
||||
{
|
||||
$obj = new SimpleClass('{"name":"test","description":"description"}');
|
||||
$this->assertEquals($obj->getName(), "test");
|
||||
$this->assertEquals($obj->getDescription(), "description");
|
||||
}
|
||||
|
||||
public function testArrayClassConversion() {
|
||||
public function testConstructorArray()
|
||||
{
|
||||
$arr = array('name' => 'test', 'description' => 'description');
|
||||
$obj = new SimpleClass($arr);
|
||||
$this->assertEquals($obj->getName(), "test");
|
||||
$this->assertEquals($obj->getDescription(), "description");
|
||||
}
|
||||
|
||||
public function testConstructorNull()
|
||||
{
|
||||
$obj = new SimpleClass(null);
|
||||
$this->assertNotEquals($obj->getName(), "test");
|
||||
$this->assertNotEquals($obj->getDescription(), "description");
|
||||
$this->assertNull($obj->getName());
|
||||
$this->assertNull($obj->getDescription());
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
* @expectedExceptionMessage data should be either json or array representation of object
|
||||
*/
|
||||
public function testConstructorInvalidInput()
|
||||
{
|
||||
new SimpleClass("Something that is not even correct");
|
||||
}
|
||||
|
||||
public function testSimpleClassObjectConversion()
|
||||
{
|
||||
$json = '{"name":"test","description":"description"}';
|
||||
|
||||
$obj = new SimpleClass();
|
||||
$obj->fromJson($json);
|
||||
|
||||
$this->assertEquals("test", $obj->getName());
|
||||
$this->assertEquals("description", $obj->getDescription());
|
||||
|
||||
}
|
||||
|
||||
public function testSimpleClassObjectInvalidConversion()
|
||||
{
|
||||
try {
|
||||
$json = '{"name":"test","description":"description","invalid":"value"}';
|
||||
|
||||
$obj = new SimpleClass();
|
||||
$obj->fromJson($json);
|
||||
|
||||
$this->assertEquals("test", $obj->getName());
|
||||
$this->assertEquals("description", $obj->getDescription());
|
||||
} catch (\PHPUnit_Framework_Error_Notice $ex) {
|
||||
echo $ex->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @outputBuffering enabled
|
||||
*/
|
||||
public function testInvalidMagicMethod()
|
||||
{
|
||||
$obj = new SimpleClass();
|
||||
try {
|
||||
$obj->invalid = "value2";
|
||||
$this->assertEquals($obj->invalid, "value2");
|
||||
if (PPConfigManager::getInstance()->get('validation.level') == 'strict') {
|
||||
$this->fail("It should have thrown a Notice Error");
|
||||
}
|
||||
} catch (\PHPUnit_Framework_Error_Notice $ex) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @outputBuffering enabled
|
||||
*/
|
||||
public function testInvalidMagicMethodWithDisabledValidation()
|
||||
{
|
||||
PPConfigManager::getInstance()->addConfigs(array('validation.level' => 'disabled'));
|
||||
$obj = new SimpleClass();
|
||||
try {
|
||||
$obj->invalid = "value2";
|
||||
$this->assertEquals($obj->invalid, "value2");
|
||||
} catch (\PHPUnit_Framework_Error_Notice $ex) {
|
||||
$this->fail("It should not have thrown a Notice Error as it is disabled.");
|
||||
}
|
||||
PPConfigManager::getInstance()->addConfigs(array('validation.level' => 'strict'));
|
||||
}
|
||||
|
||||
public function testInvalidMagicMethodWithValidationLevel()
|
||||
{
|
||||
PPConfigManager::getInstance()->addConfigs(array('validation.level' => 'log'));
|
||||
$obj = new SimpleClass();
|
||||
$obj->invalid2 = "value2";
|
||||
$this->assertEquals($obj->invalid2, "value2");
|
||||
PPConfigManager::getInstance()->addConfigs(array('validation.level' => 'strict'));
|
||||
}
|
||||
|
||||
public function testArrayClassConversion()
|
||||
{
|
||||
$o = new ArrayClass();
|
||||
$o->setName("test");
|
||||
$o->setDescription("description");
|
||||
@@ -35,29 +138,27 @@ class ModelTest extends \PHPUnit_Framework_TestCase {
|
||||
$this->assertEquals(array('payment', 'info', 'test'), $o->getTags());
|
||||
|
||||
$json = $o->toJSON();
|
||||
$this->assertEquals('{"name":"test","desc":"description","tags":["payment","info","test"]}', $json);
|
||||
$this->assertEquals('{"name":"test","description":"description","tags":["payment","info","test"]}', $json);
|
||||
|
||||
$newO = new ArrayClass();
|
||||
$newO->fromJson($json);
|
||||
$this->assertEquals($o, $newO);
|
||||
}
|
||||
|
||||
public function testNestedClassConversion() {
|
||||
public function testNestedClassConversion()
|
||||
{
|
||||
$n = new ArrayClass();
|
||||
$n->setName("test");
|
||||
$n->setDescription("description");
|
||||
// $n->setTags(array('payment', 'info', 'test'));
|
||||
$o = new NestedClass();
|
||||
$o->setId('123');
|
||||
$o->setInfo($n);
|
||||
|
||||
$this->assertEquals("123", $o->getId());
|
||||
$this->assertEquals("test", $o->getInfo()->getName());
|
||||
// $this->assertEquals(array('payment', 'info', 'test'), $o->getInfo()->getTags());
|
||||
|
||||
$json = $o->toJSON();
|
||||
// $this->assertEquals('{"id":"123","info":{"name":"test","desc":"description","tags":["payment","info","test"]}}', $json);
|
||||
$this->assertEquals('{"id":"123","info":{"name":"test","desc":"description"}}', $json);
|
||||
$this->assertEquals('{"id":"123","info":{"name":"test","description":"description"}}', $json);
|
||||
|
||||
$newO = new NestedClass();
|
||||
$newO->fromJson($json);
|
||||
|
||||
@@ -1,12 +1,18 @@
|
||||
<?php
|
||||
namespace PayPal\Test\Common;
|
||||
use PayPal\Common\PPModel;
|
||||
class NestedClass extends PPModel {
|
||||
|
||||
public function setId($id) {
|
||||
use PayPal\Common\PPModel;
|
||||
|
||||
class NestedClass extends PPModel
|
||||
{
|
||||
|
||||
public function setId($id)
|
||||
{
|
||||
$this->id = $id;
|
||||
}
|
||||
public function getId() {
|
||||
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
@@ -14,14 +20,17 @@ class NestedClass extends PPModel {
|
||||
*
|
||||
* @param PayPal\Test\Common\ArrayClass $info
|
||||
*/
|
||||
public function setInfo($info) {
|
||||
public function setInfo($info)
|
||||
{
|
||||
$this->info = $info;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return PayPal\Test\Common\ArrayClass
|
||||
*/
|
||||
public function getInfo() {
|
||||
public function getInfo()
|
||||
{
|
||||
return $this->info;
|
||||
}
|
||||
}
|
||||
@@ -2,13 +2,15 @@
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
|
||||
class SimpleModelTestClass extends PPModel {
|
||||
class SimpleModelTestClass extends PPModel
|
||||
{
|
||||
/**
|
||||
*
|
||||
* @access public
|
||||
* @param string $field1
|
||||
*/
|
||||
public function setField1($field1) {
|
||||
public function setField1($field1)
|
||||
{
|
||||
$this->field1 = $field1;
|
||||
return $this;
|
||||
}
|
||||
@@ -18,7 +20,8 @@ class SimpleModelTestClass extends PPModel {
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getField1() {
|
||||
public function getField1()
|
||||
{
|
||||
return $this->field1;
|
||||
}
|
||||
|
||||
@@ -27,7 +30,8 @@ class SimpleModelTestClass extends PPModel {
|
||||
* @access public
|
||||
* @param string $field2
|
||||
*/
|
||||
public function setField2($field2) {
|
||||
public function setField2($field2)
|
||||
{
|
||||
$this->field2 = $field2;
|
||||
return $this;
|
||||
}
|
||||
@@ -37,22 +41,24 @@ class SimpleModelTestClass extends PPModel {
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getField2() {
|
||||
public function getField2()
|
||||
{
|
||||
return $this->field2;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
class ContainerModelTestClass extends PPModel {
|
||||
class ContainerModelTestClass extends PPModel
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
* @access public
|
||||
* @param string $field1
|
||||
*/
|
||||
public function setField1($field1) {
|
||||
public function setField1($field1)
|
||||
{
|
||||
$this->field1 = $field1;
|
||||
return $this;
|
||||
}
|
||||
@@ -62,7 +68,8 @@ class ContainerModelTestClass extends PPModel {
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getField1() {
|
||||
public function getField1()
|
||||
{
|
||||
return $this->field1;
|
||||
}
|
||||
|
||||
@@ -71,7 +78,8 @@ class ContainerModelTestClass extends PPModel {
|
||||
* @access public
|
||||
* @param SimpleModelTestClass $field1
|
||||
*/
|
||||
public function setNested1($nested1) {
|
||||
public function setNested1($nested1)
|
||||
{
|
||||
$this->nested1 = $nested1;
|
||||
return $this;
|
||||
}
|
||||
@@ -81,21 +89,24 @@ class ContainerModelTestClass extends PPModel {
|
||||
* @access public
|
||||
* @return SimpleModelTestClass
|
||||
*/
|
||||
public function getNested1() {
|
||||
public function getNested1()
|
||||
{
|
||||
return $this->nested1;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
class ListModelTestClass extends PPModel {
|
||||
class ListModelTestClass extends PPModel
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
* @access public
|
||||
* @param string $list1
|
||||
*/
|
||||
public function setList1($list1) {
|
||||
public function setList1($list1)
|
||||
{
|
||||
$this->list1 = $list1;
|
||||
}
|
||||
|
||||
@@ -104,7 +115,8 @@ class ListModelTestClass extends PPModel {
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getList1() {
|
||||
public function getList1()
|
||||
{
|
||||
return $this->list1;
|
||||
}
|
||||
|
||||
@@ -113,7 +125,8 @@ class ListModelTestClass extends PPModel {
|
||||
* @access public
|
||||
* @param SimpleModelTestClass $list2 array of SimpleModelTestClass
|
||||
*/
|
||||
public function setList2($list2) {
|
||||
public function setList2($list2)
|
||||
{
|
||||
$this->list2 = $list2;
|
||||
return $this;
|
||||
}
|
||||
@@ -123,7 +136,8 @@ class ListModelTestClass extends PPModel {
|
||||
* @access public
|
||||
* @return SimpleModelTestClass array of SimpleModelTestClass
|
||||
*/
|
||||
public function getList2() {
|
||||
public function getList2()
|
||||
{
|
||||
return $this->list2;
|
||||
}
|
||||
|
||||
@@ -140,7 +154,8 @@ class PPModelTest extends PHPUnit_Framework_TestCase
|
||||
* Sets up the fixture, for example, opens a network connection.
|
||||
* This method is called before a test is executed.
|
||||
*/
|
||||
protected function setUp() {
|
||||
protected function setUp()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -148,13 +163,15 @@ class PPModelTest extends PHPUnit_Framework_TestCase
|
||||
* Tears down the fixture, for example, closes a network connection.
|
||||
* This method is called after a test is executed.
|
||||
*/
|
||||
protected function tearDown() {
|
||||
protected function tearDown()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function testSimpleConversion() {
|
||||
public function testSimpleConversion()
|
||||
{
|
||||
$o = new SimpleModelTestClass();
|
||||
$o->setField1('value 1');
|
||||
$o->setField2("value 2");
|
||||
@@ -170,7 +187,8 @@ class PPModelTest extends PHPUnit_Framework_TestCase
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function testSpecialChars() {
|
||||
public function testSpecialChars()
|
||||
{
|
||||
$o = new SimpleModelTestClass();
|
||||
$o->setField1('value "1');
|
||||
$o->setField2("value 2");
|
||||
@@ -187,7 +205,8 @@ class PPModelTest extends PHPUnit_Framework_TestCase
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function testNestedConversion() {
|
||||
public function testNestedConversion()
|
||||
{
|
||||
$child = new SimpleModelTestClass();
|
||||
$child->setField1('value 1');
|
||||
$child->setField2("value 2");
|
||||
@@ -209,7 +228,8 @@ class PPModelTest extends PHPUnit_Framework_TestCase
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function testListConversion() {
|
||||
public function testListConversion()
|
||||
{
|
||||
$c1 = new SimpleModelTestClass();
|
||||
$c1->setField1("a")->setField2('value');
|
||||
|
||||
|
||||
@@ -1,19 +1,28 @@
|
||||
<?php
|
||||
namespace PayPal\Test\Common;
|
||||
use PayPal\Common\PPModel;
|
||||
class SimpleClass extends PPModel {
|
||||
|
||||
public function setName($name) {
|
||||
use PayPal\Common\PPModel;
|
||||
|
||||
class SimpleClass extends PPModel
|
||||
{
|
||||
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
}
|
||||
public function getName() {
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function setDescription($desc) {
|
||||
$this->desc = $desc;
|
||||
public function setDescription($description)
|
||||
{
|
||||
$this->description = $description;
|
||||
}
|
||||
public function getDescription() {
|
||||
return $this->desc;
|
||||
|
||||
public function getDescription()
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
}
|
||||
@@ -2,9 +2,11 @@
|
||||
|
||||
use PayPal\Common\PPUserAgent;
|
||||
|
||||
class UserAgentTest extends PHPUnit_Framework_TestCase {
|
||||
class UserAgentTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
public function testGetValue() {
|
||||
public function testGetValue()
|
||||
{
|
||||
$ua = PPUserAgent::getValue("name", "version");
|
||||
list($id, $version, $features) = sscanf($ua, "PayPalSDK/%s %s (%s)");
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<?php
|
||||
namespace PayPal\Test;
|
||||
|
||||
class Constants {
|
||||
class Constants
|
||||
{
|
||||
const CLIENT_ID = 'EBWKjlELKMYqRNQ6sYvFo64FtaRLRR5BdHEESmha49TM';
|
||||
const CLIENT_SECRET = 'EO422dn3gQLgDbuwqTjzrFgFtaRLRR5BdHEESmha49TM';
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
use PayPal\Core\PPCredentialManager;
|
||||
|
||||
/**
|
||||
* Test class for PPCredentialManager.
|
||||
*
|
||||
@@ -26,6 +27,7 @@ class PPCredentialManagerTest extends \PHPUnit_Framework_TestCase
|
||||
'log.LogLevel' => 'INFO',
|
||||
'log.LogEnabled' => '1',
|
||||
);
|
||||
|
||||
/**
|
||||
* Sets up the fixture, for example, opens a network connection.
|
||||
* This method is called before a test is executed.
|
||||
@@ -68,7 +70,8 @@ class PPCredentialManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @throws \PayPal\Exception\PPInvalidCredentialException
|
||||
*/
|
||||
public function testSetCredentialObject() {
|
||||
public function testSetCredentialObject()
|
||||
{
|
||||
$authObject = $this->getMockBuilder('\Paypal\Auth\OAuthTokenCredential')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
@@ -83,7 +86,8 @@ class PPCredentialManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @throws \PayPal\Exception\PPInvalidCredentialException
|
||||
*/
|
||||
public function testSetCredentialObjectWithUserId() {
|
||||
public function testSetCredentialObjectWithUserId()
|
||||
{
|
||||
$authObject = $this->getMockBuilder('\Paypal\Auth\OAuthTokenCredential')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
@@ -97,7 +101,8 @@ class PPCredentialManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @throws \PayPal\Exception\PPInvalidCredentialException
|
||||
*/
|
||||
public function testSetCredentialObjectWithoutDefault() {
|
||||
public function testSetCredentialObjectWithoutDefault()
|
||||
{
|
||||
$authObject = $this->getMockBuilder('\Paypal\Auth\OAuthTokenCredential')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
@@ -107,8 +112,6 @@ class PPCredentialManagerTest extends \PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
@@ -132,7 +135,8 @@ class PPCredentialManagerTest extends \PHPUnit_Framework_TestCase
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function testGetRestCredentialObject() {
|
||||
public function testGetRestCredentialObject()
|
||||
{
|
||||
$cred = $this->object->getCredentialObject('acct1');
|
||||
|
||||
$this->assertNotNull($cred);
|
||||
@@ -142,4 +146,5 @@ class PPCredentialManagerTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertAttributeEquals($this->config['acct1.ClientSecret'], 'clientSecret', $cred);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
use PayPal\Core\PPHttpConfig;
|
||||
|
||||
/**
|
||||
* Test class for PPAPIService.
|
||||
*
|
||||
@@ -11,7 +12,7 @@ class PPHttpConfigTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
private $config = array(
|
||||
'http.ConnectionTimeOut' => '30',
|
||||
'http.Retry' => '5' ,
|
||||
'http.Retry' => '5',
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -80,7 +81,7 @@ class PPHttpConfigTest extends PHPUnit_Framework_TestCase
|
||||
$o = new PPHttpConfig();
|
||||
$o->setUserAgent($ua);
|
||||
|
||||
$curlOpts= $o->getCurlOptions();
|
||||
$curlOpts = $o->getCurlOptions();
|
||||
$this->assertEquals($ua, $curlOpts[CURLOPT_USERAGENT]);
|
||||
}
|
||||
|
||||
@@ -95,7 +96,7 @@ class PPHttpConfigTest extends PHPUnit_Framework_TestCase
|
||||
$o = new PPHttpConfig();
|
||||
$o->setSSLCert($sslCert, $sslPass);
|
||||
|
||||
$curlOpts= $o->getCurlOptions();
|
||||
$curlOpts = $o->getCurlOptions();
|
||||
$this->assertArrayHasKey(CURLOPT_SSLCERT, $curlOpts);
|
||||
$this->assertEquals($sslPass, $curlOpts[CURLOPT_SSLCERTPASSWD]);
|
||||
}
|
||||
@@ -110,7 +111,7 @@ class PPHttpConfigTest extends PHPUnit_Framework_TestCase
|
||||
$o = new PPHttpConfig();
|
||||
$o->setHttpProxy($proxy);
|
||||
|
||||
$curlOpts= $o->getCurlOptions();
|
||||
$curlOpts = $o->getCurlOptions();
|
||||
$this->assertEquals('hostname:8081', $curlOpts[CURLOPT_PROXY]);
|
||||
$this->assertEquals('me:secret', $curlOpts[CURLOPT_PROXYUSERPWD]);
|
||||
|
||||
@@ -118,4 +119,5 @@ class PPHttpConfigTest extends PHPUnit_Framework_TestCase
|
||||
$o->setHttpProxy('invalid string');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
use PayPal\Core\PPLoggingManager;
|
||||
|
||||
/**
|
||||
* Test class for PPLoggingManager.
|
||||
*
|
||||
@@ -17,7 +18,7 @@ class PPLoggingManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
$this->object = new PPLoggingManager('InvoiceTest');
|
||||
$this->object = PPLoggingManager::getInstance('InvoiceTest');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -61,4 +62,5 @@ class PPLoggingManagerTest extends \PHPUnit_Framework_TestCase
|
||||
$this->object->fine('Test fine Message');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
use PayPal\Exception\PPConfigurationException;
|
||||
|
||||
/**
|
||||
* Test class for PPConfigurationException.
|
||||
*
|
||||
@@ -27,9 +28,11 @@ class PPConfigurationExceptionTest extends \PHPUnit_Framework_TestCase
|
||||
protected function tearDown()
|
||||
{
|
||||
}
|
||||
|
||||
public function testPPConfigurationException()
|
||||
{
|
||||
$this->assertEquals('Test PPConfigurationException', $this->object->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
use PayPal\Exception\PPConnectionException;
|
||||
|
||||
/**
|
||||
* Test class for PPConnectionException.
|
||||
*
|
||||
@@ -45,4 +46,5 @@ class PPConnectionExceptionTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals('response payload for connection', $this->object->getData());
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
use PayPal\Exception\PPInvalidCredentialException;
|
||||
|
||||
/**
|
||||
* Test class for PPInvalidCredentialException.
|
||||
*
|
||||
@@ -37,4 +38,5 @@ class PPInvalidCredentialExceptionTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertContains('Error on line', $msg);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -38,4 +38,5 @@ class PPMissingCredentialExceptionTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertContains('Error on line', $msg);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -7,9 +7,11 @@ use PayPal\Auth\OAuthTokenCredential;
|
||||
use PayPal\Rest\Call;
|
||||
use PayPal\Test\Constants;
|
||||
|
||||
class CallTest {
|
||||
class CallTest
|
||||
{
|
||||
|
||||
public function testExecuteWithExplicitCredentials() {
|
||||
public function testExecuteWithExplicitCredentials()
|
||||
{
|
||||
$cred = new OAuthTokenCredential(Constants::CLIENT_ID, Constants::CLIENT_SECRET);
|
||||
$data = '"request":"test message"';
|
||||
|
||||
@@ -18,7 +20,8 @@ class CallTest {
|
||||
$this->assertEquals($data, $ret);
|
||||
}
|
||||
|
||||
public function testExecuteWithInvalidCredentials() {
|
||||
public function testExecuteWithInvalidCredentials()
|
||||
{
|
||||
|
||||
$cred = new OAuthTokenCredential('test', 'dummy');
|
||||
$data = '"request":"test message"';
|
||||
@@ -30,7 +33,8 @@ class CallTest {
|
||||
}
|
||||
|
||||
|
||||
public function testExecuteWithDefaultCredentials() {
|
||||
public function testExecuteWithDefaultCredentials()
|
||||
{
|
||||
|
||||
$data = '"request":"test message"';
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@ service.EndPoint="https://api.sandbox.paypal.com"
|
||||
|
||||
;Logging Information
|
||||
[Log]
|
||||
|
||||
log.LogEnabled=true
|
||||
|
||||
; When using a relative path, the log file is created
|
||||
@@ -36,3 +35,13 @@ log.FileName=PayPal.log
|
||||
; Logging is most verbose in the 'FINE' level and
|
||||
; decreases as you proceed towards ERROR
|
||||
log.LogLevel=FINE
|
||||
|
||||
;Validation Configuration
|
||||
[validation]
|
||||
; If validation is set to strict, the PPModel would make sure that
|
||||
; there are proper accessors (Getters and Setters) for each model
|
||||
; objects. Accepted value is
|
||||
; 'log' : logs the error message to logger only (default)
|
||||
; 'strict' : throws a php notice message
|
||||
; 'disable' : disable the validation
|
||||
validation.level=strict
|
||||
Reference in New Issue
Block a user