forked from LiveCarta/PayPal-PHP-SDK
Enabled Billing Plans and Agreements APIs
- Added API Classes, Samples, and Tests - Updated Functional Tests - Updated Documentation with new SDK Name - Updated Few Samples to use newer nicer result page
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
namespace PayPal\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Rest\ApiContext;
|
||||
|
||||
/**
|
||||
* Class Address
|
||||
@@ -24,7 +23,6 @@ class Address extends PPModel
|
||||
{
|
||||
/**
|
||||
* Line 1 of the Address (eg. number, street, etc).
|
||||
*
|
||||
*
|
||||
* @param string $line1
|
||||
*
|
||||
@@ -48,7 +46,6 @@ class Address extends PPModel
|
||||
|
||||
/**
|
||||
* Optional line 2 of the Address (eg. suite, apt #, etc.).
|
||||
*
|
||||
*
|
||||
* @param string $line2
|
||||
*
|
||||
@@ -72,7 +69,6 @@ class Address extends PPModel
|
||||
|
||||
/**
|
||||
* City name.
|
||||
*
|
||||
*
|
||||
* @param string $city
|
||||
*
|
||||
@@ -96,7 +92,6 @@ class Address extends PPModel
|
||||
|
||||
/**
|
||||
* 2 letter country code.
|
||||
*
|
||||
*
|
||||
* @param string $country_code
|
||||
*
|
||||
@@ -145,7 +140,6 @@ class Address extends PPModel
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
@@ -194,7 +188,6 @@ class Address extends PPModel
|
||||
|
||||
/**
|
||||
* 2 letter code for US states, and the equivalent for other countries.
|
||||
*
|
||||
*
|
||||
* @param string $state
|
||||
*
|
||||
@@ -218,7 +211,6 @@ class Address extends PPModel
|
||||
|
||||
/**
|
||||
* Phone number in E.123 format.
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\Phone $phone
|
||||
*
|
||||
|
||||
832
lib/PayPal/Api/Agreement.php
Normal file
832
lib/PayPal/Api/Agreement.php
Normal file
@@ -0,0 +1,832 @@
|
||||
<?php
|
||||
|
||||
namespace PayPal\Api;
|
||||
|
||||
use PayPal\Common\ResourceModel;
|
||||
use PayPal\Validation\ArgumentValidator;
|
||||
use PayPal\Api\AgreementTransactions;
|
||||
use PayPal\Rest\ApiContext;
|
||||
use PayPal\Transport\PPRestCall;
|
||||
|
||||
/**
|
||||
* Class Agreement
|
||||
*
|
||||
* A resource representing an agreement.
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
* @property string id
|
||||
* @property string state
|
||||
* @property string name
|
||||
* @property string description
|
||||
* @property string start_date
|
||||
* @property \PayPal\Api\Payer payer
|
||||
* @property \PayPal\Api\Address shipping_address
|
||||
* @property \PayPal\Api\MerchantPreferences override_merchant_preferences
|
||||
* @property \PayPal\Api\OverrideChargeModel[] override_charge_models
|
||||
* @property \PayPal\Api\Plan plan
|
||||
* @property string create_time
|
||||
* @property string update_time
|
||||
* @property \PayPal\Api\AgreementDetails agreement_details
|
||||
* @property \PayPal\Api\Links[] links
|
||||
*/
|
||||
class Agreement extends ResourceModel
|
||||
{
|
||||
/**
|
||||
* Identifier of the agreement.
|
||||
*
|
||||
* @param string $id
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setId($id)
|
||||
{
|
||||
$this->id = $id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Identifier of the agreement.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* State of the agreement.
|
||||
*
|
||||
* @param string $state
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setState($state)
|
||||
{
|
||||
$this->state = $state;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* State of the agreement.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getState()
|
||||
{
|
||||
return $this->state;
|
||||
}
|
||||
|
||||
/**
|
||||
* Name of the agreement.
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Name of the agreement.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the agreement.
|
||||
*
|
||||
* @param string $description
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setDescription($description)
|
||||
{
|
||||
$this->description = $description;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the agreement.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDescription()
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Start date of the agreement. Date format yyyy-MM-dd z, as defined in [ISO8601](http://tools.ietf.org/html/rfc3339#section-5.6).
|
||||
*
|
||||
* @param string $start_date
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setStartDate($start_date)
|
||||
{
|
||||
$this->start_date = $start_date;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Start date of the agreement. Date format yyyy-MM-dd z, as defined in [ISO8601](http://tools.ietf.org/html/rfc3339#section-5.6).
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getStartDate()
|
||||
{
|
||||
return $this->start_date;
|
||||
}
|
||||
|
||||
/**
|
||||
* Start date of the agreement. Date format yyyy-MM-dd z, as defined in [ISO8601](http://tools.ietf.org/html/rfc3339#section-5.6).
|
||||
*
|
||||
* @deprecated Instead use setStartDate
|
||||
*
|
||||
* @param string $start_date
|
||||
* @return $this
|
||||
*/
|
||||
public function setStart_date($start_date)
|
||||
{
|
||||
$this->start_date = $start_date;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Start date of the agreement. Date format yyyy-MM-dd z, as defined in [ISO8601](http://tools.ietf.org/html/rfc3339#section-5.6).
|
||||
* @deprecated Instead use getStartDate
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getStart_date()
|
||||
{
|
||||
return $this->start_date;
|
||||
}
|
||||
|
||||
/**
|
||||
* Details of the buyer who is enrolling in this agreement. This information is gathered from execution of the approval URL.
|
||||
*
|
||||
* @param \PayPal\Api\Payer $payer
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setPayer($payer)
|
||||
{
|
||||
$this->payer = $payer;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Details of the buyer who is enrolling in this agreement. This information is gathered from execution of the approval URL.
|
||||
*
|
||||
* @return \PayPal\Api\Payer
|
||||
*/
|
||||
public function getPayer()
|
||||
{
|
||||
return $this->payer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Shipping address object of the agreement, which should be provided if it is different from the default address.
|
||||
*
|
||||
* @param \PayPal\Api\Address $shipping_address
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setShippingAddress($shipping_address)
|
||||
{
|
||||
$this->shipping_address = $shipping_address;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Shipping address object of the agreement, which should be provided if it is different from the default address.
|
||||
*
|
||||
* @return \PayPal\Api\Address
|
||||
*/
|
||||
public function getShippingAddress()
|
||||
{
|
||||
return $this->shipping_address;
|
||||
}
|
||||
|
||||
/**
|
||||
* Shipping address object of the agreement, which should be provided if it is different from the default address.
|
||||
*
|
||||
* @deprecated Instead use setShippingAddress
|
||||
*
|
||||
* @param \PayPal\Api\Address $shipping_address
|
||||
* @return $this
|
||||
*/
|
||||
public function setShipping_address($shipping_address)
|
||||
{
|
||||
$this->shipping_address = $shipping_address;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Shipping address object of the agreement, which should be provided if it is different from the default address.
|
||||
* @deprecated Instead use getShippingAddress
|
||||
*
|
||||
* @return \PayPal\Api\Address
|
||||
*/
|
||||
public function getShipping_address()
|
||||
{
|
||||
return $this->shipping_address;
|
||||
}
|
||||
|
||||
/**
|
||||
* Default merchant preferences from the billing plan are used, unless override preferences are provided here.
|
||||
*
|
||||
* @param \PayPal\Api\MerchantPreferences $override_merchant_preferences
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setOverrideMerchantPreferences($override_merchant_preferences)
|
||||
{
|
||||
$this->override_merchant_preferences = $override_merchant_preferences;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Default merchant preferences from the billing plan are used, unless override preferences are provided here.
|
||||
*
|
||||
* @return \PayPal\Api\MerchantPreferences
|
||||
*/
|
||||
public function getOverrideMerchantPreferences()
|
||||
{
|
||||
return $this->override_merchant_preferences;
|
||||
}
|
||||
|
||||
/**
|
||||
* Default merchant preferences from the billing plan are used, unless override preferences are provided here.
|
||||
*
|
||||
* @deprecated Instead use setOverrideMerchantPreferences
|
||||
*
|
||||
* @param \PayPal\Api\MerchantPreferences $override_merchant_preferences
|
||||
* @return $this
|
||||
*/
|
||||
public function setOverride_merchant_preferences($override_merchant_preferences)
|
||||
{
|
||||
$this->override_merchant_preferences = $override_merchant_preferences;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Default merchant preferences from the billing plan are used, unless override preferences are provided here.
|
||||
* @deprecated Instead use getOverrideMerchantPreferences
|
||||
*
|
||||
* @return \PayPal\Api\MerchantPreferences
|
||||
*/
|
||||
public function getOverride_merchant_preferences()
|
||||
{
|
||||
return $this->override_merchant_preferences;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of override_charge_model for this agreement if needed to change the default models from the billing plan.
|
||||
*
|
||||
* @param \PayPal\Api\OverrideChargeModel[] $override_charge_models
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setOverrideChargeModels($override_charge_models)
|
||||
{
|
||||
$this->override_charge_models = $override_charge_models;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of override_charge_model for this agreement if needed to change the default models from the billing plan.
|
||||
*
|
||||
* @return \PayPal\Api\OverrideChargeModel[]
|
||||
*/
|
||||
public function getOverrideChargeModels()
|
||||
{
|
||||
return $this->override_charge_models;
|
||||
}
|
||||
|
||||
/**
|
||||
* Append OverrideChargeModels to the list.
|
||||
*
|
||||
* @param \PayPal\Api\OverrideChargeModel $overrideChargeModel
|
||||
* @return $this
|
||||
*/
|
||||
public function addOverrideChargeModel($overrideChargeModel)
|
||||
{
|
||||
if (!$this->getOverrideChargeModels()) {
|
||||
return $this->setOverrideChargeModels(array($overrideChargeModel));
|
||||
} else {
|
||||
return $this->setOverrideChargeModels(
|
||||
array_merge($this->getOverrideChargeModels(), array($overrideChargeModel))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove OverrideChargeModels from the list.
|
||||
*
|
||||
* @param \PayPal\Api\OverrideChargeModel $overrideChargeModel
|
||||
* @return $this
|
||||
*/
|
||||
public function removeOverrideChargeModel($overrideChargeModel)
|
||||
{
|
||||
return $this->setOverrideChargeModels(
|
||||
array_diff($this->getOverrideChargeModels(), array($overrideChargeModel))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of override_charge_model for this agreement if needed to change the default models from the billing plan.
|
||||
*
|
||||
* @deprecated Instead use setOverrideChargeModels
|
||||
*
|
||||
* @param \PayPal\Api\OverrideChargeModel $override_charge_models
|
||||
* @return $this
|
||||
*/
|
||||
public function setOverride_charge_models($override_charge_models)
|
||||
{
|
||||
$this->override_charge_models = $override_charge_models;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of override_charge_model for this agreement if needed to change the default models from the billing plan.
|
||||
* @deprecated Instead use getOverrideChargeModels
|
||||
*
|
||||
* @return \PayPal\Api\OverrideChargeModel
|
||||
*/
|
||||
public function getOverride_charge_models()
|
||||
{
|
||||
return $this->override_charge_models;
|
||||
}
|
||||
|
||||
/**
|
||||
* Plan details for this agreement.
|
||||
*
|
||||
* @param \PayPal\Api\Plan $plan
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setPlan($plan)
|
||||
{
|
||||
$this->plan = $plan;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Plan details for this agreement.
|
||||
*
|
||||
* @return \PayPal\Api\Plan
|
||||
*/
|
||||
public function getPlan()
|
||||
{
|
||||
return $this->plan;
|
||||
}
|
||||
|
||||
/**
|
||||
* Date and time that this resource was created. Date format yyyy-MM-dd z, as defined in [ISO8601](http://tools.ietf.org/html/rfc3339#section-5.6).
|
||||
*
|
||||
* @param string $create_time
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setCreateTime($create_time)
|
||||
{
|
||||
$this->create_time = $create_time;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Date and time that this resource was created. Date format yyyy-MM-dd z, as defined in [ISO8601](http://tools.ietf.org/html/rfc3339#section-5.6).
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCreateTime()
|
||||
{
|
||||
return $this->create_time;
|
||||
}
|
||||
|
||||
/**
|
||||
* Date and time that this resource was created. Date format yyyy-MM-dd z, as defined in [ISO8601](http://tools.ietf.org/html/rfc3339#section-5.6).
|
||||
*
|
||||
* @deprecated Instead use setCreateTime
|
||||
*
|
||||
* @param string $create_time
|
||||
* @return $this
|
||||
*/
|
||||
public function setCreate_time($create_time)
|
||||
{
|
||||
$this->create_time = $create_time;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Date and time that this resource was created. Date format yyyy-MM-dd z, as defined in [ISO8601](http://tools.ietf.org/html/rfc3339#section-5.6).
|
||||
* @deprecated Instead use getCreateTime
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCreate_time()
|
||||
{
|
||||
return $this->create_time;
|
||||
}
|
||||
|
||||
/**
|
||||
* Date and time that this resource was updated. Date format yyyy-MM-dd z, as defined in [ISO8601](http://tools.ietf.org/html/rfc3339#section-5.6).
|
||||
*
|
||||
* @param string $update_time
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setUpdateTime($update_time)
|
||||
{
|
||||
$this->update_time = $update_time;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Date and time that this resource was updated. Date format yyyy-MM-dd z, as defined in [ISO8601](http://tools.ietf.org/html/rfc3339#section-5.6).
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getUpdateTime()
|
||||
{
|
||||
return $this->update_time;
|
||||
}
|
||||
|
||||
/**
|
||||
* Date and time that this resource was updated. Date format yyyy-MM-dd z, as defined in [ISO8601](http://tools.ietf.org/html/rfc3339#section-5.6).
|
||||
*
|
||||
* @deprecated Instead use setUpdateTime
|
||||
*
|
||||
* @param string $update_time
|
||||
* @return $this
|
||||
*/
|
||||
public function setUpdate_time($update_time)
|
||||
{
|
||||
$this->update_time = $update_time;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Date and time that this resource was updated. Date format yyyy-MM-dd z, as defined in [ISO8601](http://tools.ietf.org/html/rfc3339#section-5.6).
|
||||
* @deprecated Instead use getUpdateTime
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getUpdate_time()
|
||||
{
|
||||
return $this->update_time;
|
||||
}
|
||||
|
||||
/**
|
||||
* Agreement Details
|
||||
*
|
||||
* @param \PayPal\Api\AgreementDetails $agreement_details
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setAgreementDetails($agreement_details)
|
||||
{
|
||||
$this->{"agreement-details"} = $agreement_details;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Agreement Details
|
||||
*
|
||||
* @return \PayPal\Api\AgreementDetails
|
||||
*/
|
||||
public function getAgreementDetails()
|
||||
{
|
||||
return $this->{"agreement-details"};
|
||||
}
|
||||
|
||||
/**
|
||||
* Agreement Details
|
||||
*
|
||||
* @deprecated Instead use setAgreementDetails
|
||||
*
|
||||
* @param \PayPal\Api\AgreementDetails $agreement-details
|
||||
* @return $this
|
||||
*/
|
||||
public function setAgreement_details($agreement_details)
|
||||
{
|
||||
$this->{"agreement-details"} = $agreement_details;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Agreement Details
|
||||
* @deprecated Instead use getAgreementDetails
|
||||
*
|
||||
* @return \PayPal\Api\AgreementDetails
|
||||
*/
|
||||
public function getAgreement_details()
|
||||
{
|
||||
return $this->{"agreement-details"};
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets Links
|
||||
*
|
||||
* @param \PayPal\Api\Links[] $links
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setLinks($links)
|
||||
{
|
||||
$this->links = $links;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Links
|
||||
*
|
||||
* @return \PayPal\Api\Links[]
|
||||
*/
|
||||
public function getLinks()
|
||||
{
|
||||
return $this->links;
|
||||
}
|
||||
|
||||
/**
|
||||
* Append Links to the list.
|
||||
*
|
||||
* @param \PayPal\Api\Links $links
|
||||
* @return $this
|
||||
*/
|
||||
public function addLink($links)
|
||||
{
|
||||
if (!$this->getLinks()) {
|
||||
return $this->setLinks(array($links));
|
||||
} else {
|
||||
return $this->setLinks(
|
||||
array_merge($this->getLinks(), array($links))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove Links from the list.
|
||||
*
|
||||
* @param \PayPal\Api\Links $links
|
||||
* @return $this
|
||||
*/
|
||||
public function removeLink($links)
|
||||
{
|
||||
return $this->setLinks(
|
||||
array_diff($this->getLinks(), array($links))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new billing agreement by passing the details for the agreement, including the name, description, start date, payer, and billing plan in the request JSON.
|
||||
*
|
||||
* @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
||||
* @param PPRestCall $restCall is the Rest Call Service that is used to make rest calls
|
||||
* @return Agreement
|
||||
*/
|
||||
public function create($apiContext = null, $restCall = null)
|
||||
{
|
||||
$payLoad = $this->toJSON();
|
||||
$json = self::executeCall(
|
||||
"/v1/payments/billing-agreements/",
|
||||
"POST",
|
||||
$payLoad,
|
||||
null,
|
||||
$apiContext,
|
||||
$restCall
|
||||
);
|
||||
$this->fromJson($json);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute a billing agreement after buyer approval by passing the payment token to the request URI.
|
||||
*
|
||||
* @param $paymentToken
|
||||
* @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
||||
* @param PPRestCall $restCall is the Rest Call Service that is used to make rest calls
|
||||
* @return Agreement
|
||||
*/
|
||||
public function execute($paymentToken, $apiContext = null, $restCall = null)
|
||||
{
|
||||
ArgumentValidator::validate($paymentToken, 'paymentToken');
|
||||
$payLoad = "";
|
||||
$json = self::executeCall(
|
||||
"/v1/payments/billing-agreements/$paymentToken/agreement-execute",
|
||||
"POST",
|
||||
$payLoad,
|
||||
null,
|
||||
$apiContext,
|
||||
$restCall
|
||||
);
|
||||
$this->fromJson($json);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve details for a particular billing agreement by passing the ID of the agreement to the request URI.
|
||||
*
|
||||
* @param string $agreementId
|
||||
* @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
||||
* @param PPRestCall $restCall is the Rest Call Service that is used to make rest calls
|
||||
* @return Agreement
|
||||
*/
|
||||
public static function get($agreementId, $apiContext = null, $restCall = null)
|
||||
{
|
||||
ArgumentValidator::validate($agreementId, 'agreementId');
|
||||
$payLoad = "";
|
||||
$json = self::executeCall(
|
||||
"/v1/payments/billing-agreements/$agreementId",
|
||||
"GET",
|
||||
$payLoad,
|
||||
null,
|
||||
$apiContext,
|
||||
$restCall
|
||||
);
|
||||
$ret = new Agreement();
|
||||
$ret->fromJson($json);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update details of a billing agreement, such as the description, shipping address, and start date, by passing the ID of the agreement to the request URI.
|
||||
*
|
||||
* @param PatchRequest $patchRequest
|
||||
* @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
||||
* @param PPRestCall $restCall is the Rest Call Service that is used to make rest calls
|
||||
* @return bool
|
||||
*/
|
||||
public function update($patchRequest, $apiContext = null, $restCall = null)
|
||||
{
|
||||
ArgumentValidator::validate($this->getId(), "Id");
|
||||
ArgumentValidator::validate($patchRequest, 'patchRequest');
|
||||
$payLoad = $patchRequest->toJSON();
|
||||
self::executeCall(
|
||||
"/v1/payments/billing-agreements/{$this->getId()}",
|
||||
"PATCH",
|
||||
$payLoad,
|
||||
null,
|
||||
$apiContext,
|
||||
$restCall
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Suspend a particular billing agreement by passing the ID of the agreement to the request URI.
|
||||
*
|
||||
* @param AgreementStateDescriptor $agreementStateDescriptor
|
||||
* @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
||||
* @param PPRestCall $restCall is the Rest Call Service that is used to make rest calls
|
||||
* @return bool
|
||||
*/
|
||||
public function suspend($agreementStateDescriptor, $apiContext = null, $restCall = null)
|
||||
{
|
||||
ArgumentValidator::validate($this->getId(), "Id");
|
||||
ArgumentValidator::validate($agreementStateDescriptor, 'agreementStateDescriptor');
|
||||
$payLoad = $agreementStateDescriptor->toJSON();
|
||||
self::executeCall(
|
||||
"/v1/payments/billing-agreements/{$this->getId()}/suspend",
|
||||
"POST",
|
||||
$payLoad,
|
||||
null,
|
||||
$apiContext,
|
||||
$restCall
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reactivate a suspended billing agreement by passing the ID of the agreement to the appropriate URI. In addition, pass an agreement_state_descriptor object in the request JSON that includes a note about the reason for changing the state of the agreement and the amount and currency for the agreement.
|
||||
*
|
||||
* @param AgreementStateDescriptor $agreementStateDescriptor
|
||||
* @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
||||
* @param PPRestCall $restCall is the Rest Call Service that is used to make rest calls
|
||||
* @return bool
|
||||
*/
|
||||
public function reActivate($agreementStateDescriptor, $apiContext = null, $restCall = null)
|
||||
{
|
||||
ArgumentValidator::validate($this->getId(), "Id");
|
||||
ArgumentValidator::validate($agreementStateDescriptor, 'agreementStateDescriptor');
|
||||
$payLoad = $agreementStateDescriptor->toJSON();
|
||||
self::executeCall(
|
||||
"/v1/payments/billing-agreements/{$this->getId()}/re-activate",
|
||||
"POST",
|
||||
$payLoad,
|
||||
null,
|
||||
$apiContext,
|
||||
$restCall
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cancel a billing agreement by passing the ID of the agreement to the request URI. In addition, pass an agreement_state_descriptor object in the request JSON that includes a note about the reason for changing the state of the agreement and the amount and currency for the agreement.
|
||||
*
|
||||
* @param AgreementStateDescriptor $agreementStateDescriptor
|
||||
* @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
||||
* @param PPRestCall $restCall is the Rest Call Service that is used to make rest calls
|
||||
* @return bool
|
||||
*/
|
||||
public function cancel($agreementStateDescriptor, $apiContext = null, $restCall = null)
|
||||
{
|
||||
ArgumentValidator::validate($this->getId(), "Id");
|
||||
ArgumentValidator::validate($agreementStateDescriptor, 'agreementStateDescriptor');
|
||||
$payLoad = $agreementStateDescriptor->toJSON();
|
||||
self::executeCall(
|
||||
"/v1/payments/billing-agreements/{$this->getId()}/cancel",
|
||||
"POST",
|
||||
$payLoad,
|
||||
null,
|
||||
$apiContext,
|
||||
$restCall
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Bill an outstanding amount for an agreement by passing the ID of the agreement to the request URI. In addition, pass an agreement_state_descriptor object in the request JSON that includes a note about the reason for changing the state of the agreement and the amount and currency for the agreement.
|
||||
*
|
||||
* @param AgreementStateDescriptor $agreementStateDescriptor
|
||||
* @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
||||
* @param PPRestCall $restCall is the Rest Call Service that is used to make rest calls
|
||||
* @return bool
|
||||
*/
|
||||
public function billBalance($agreementStateDescriptor, $apiContext = null, $restCall = null)
|
||||
{
|
||||
ArgumentValidator::validate($this->getId(), "Id");
|
||||
ArgumentValidator::validate($agreementStateDescriptor, 'agreementStateDescriptor');
|
||||
$payLoad = $agreementStateDescriptor->toJSON();
|
||||
self::executeCall(
|
||||
"/v1/payments/billing-agreements/{$this->getId()}/bill-balance",
|
||||
"POST",
|
||||
$payLoad,
|
||||
null,
|
||||
$apiContext,
|
||||
$restCall
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the balance for an agreement by passing the ID of the agreement to the request URI. In addition, pass a common_currency object in the request JSON that specifies the currency type and value of the balance.
|
||||
*
|
||||
* @param Currency $currency
|
||||
* @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
||||
* @param PPRestCall $restCall is the Rest Call Service that is used to make rest calls
|
||||
* @return bool
|
||||
*/
|
||||
public function setBalance($currency, $apiContext = null, $restCall = null)
|
||||
{
|
||||
ArgumentValidator::validate($this->getId(), "Id");
|
||||
ArgumentValidator::validate($currency, 'currency');
|
||||
$payLoad = $currency->toJSON();
|
||||
self::executeCall(
|
||||
"/v1/payments/billing-agreements/{$this->getId()}/set-balance",
|
||||
"POST",
|
||||
$payLoad,
|
||||
null,
|
||||
$apiContext,
|
||||
$restCall
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* List transactions for a billing agreement by passing the ID of the agreement, as well as the start and end dates of the range of transactions to list, to the request URI.
|
||||
*
|
||||
* @param string $agreementId
|
||||
* @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
||||
* @param PPRestCall $restCall is the Rest Call Service that is used to make rest calls
|
||||
* @return AgreementTransactions
|
||||
*/
|
||||
public static function transactions($agreementId, $apiContext = null, $restCall = null)
|
||||
{
|
||||
ArgumentValidator::validate($agreementId, 'agreementId');
|
||||
$payLoad = "";
|
||||
$json = self::executeCall(
|
||||
"/v1/payments/billing-agreements/$agreementId/transactions",
|
||||
"GET",
|
||||
$payLoad,
|
||||
null,
|
||||
$apiContext,
|
||||
$restCall
|
||||
);
|
||||
$ret = new AgreementTransactions();
|
||||
$ret->fromJson($json);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
}
|
||||
409
lib/PayPal/Api/AgreementDetails.php
Normal file
409
lib/PayPal/Api/AgreementDetails.php
Normal file
@@ -0,0 +1,409 @@
|
||||
<?php
|
||||
|
||||
namespace PayPal\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
|
||||
/**
|
||||
* Class AgreementDetails
|
||||
*
|
||||
* A resource representing the agreement details.
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
* @property \PayPal\Api\Currency outstanding_balance
|
||||
* @property string cycles_remaining
|
||||
* @property string cycles_completed
|
||||
* @property string next_billing_date
|
||||
* @property string last_payment_date
|
||||
* @property \PayPal\Api\Currency last_payment_amount
|
||||
* @property string final_payment_date
|
||||
* @property string failed_payment_count
|
||||
*/
|
||||
class AgreementDetails extends PPModel
|
||||
{
|
||||
/**
|
||||
* The outstanding balance for this agreement.
|
||||
*
|
||||
* @param \PayPal\Api\Currency $outstanding_balance
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setOutstandingBalance($outstanding_balance)
|
||||
{
|
||||
$this->outstanding_balance = $outstanding_balance;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The outstanding balance for this agreement.
|
||||
*
|
||||
* @return \PayPal\Api\Currency
|
||||
*/
|
||||
public function getOutstandingBalance()
|
||||
{
|
||||
return $this->outstanding_balance;
|
||||
}
|
||||
|
||||
/**
|
||||
* The outstanding balance for this agreement.
|
||||
*
|
||||
* @deprecated Instead use setOutstandingBalance
|
||||
*
|
||||
* @param \PayPal\Api\Currency $outstanding_balance
|
||||
* @return $this
|
||||
*/
|
||||
public function setOutstanding_balance($outstanding_balance)
|
||||
{
|
||||
$this->outstanding_balance = $outstanding_balance;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The outstanding balance for this agreement.
|
||||
* @deprecated Instead use getOutstandingBalance
|
||||
*
|
||||
* @return \PayPal\Api\Currency
|
||||
*/
|
||||
public function getOutstanding_balance()
|
||||
{
|
||||
return $this->outstanding_balance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Number of cycles remaining for this agreement.
|
||||
*
|
||||
* @param string $cycles_remaining
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setCyclesRemaining($cycles_remaining)
|
||||
{
|
||||
$this->cycles_remaining = $cycles_remaining;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Number of cycles remaining for this agreement.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCyclesRemaining()
|
||||
{
|
||||
return $this->cycles_remaining;
|
||||
}
|
||||
|
||||
/**
|
||||
* Number of cycles remaining for this agreement.
|
||||
*
|
||||
* @deprecated Instead use setCyclesRemaining
|
||||
*
|
||||
* @param string $cycles_remaining
|
||||
* @return $this
|
||||
*/
|
||||
public function setCycles_remaining($cycles_remaining)
|
||||
{
|
||||
$this->cycles_remaining = $cycles_remaining;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Number of cycles remaining for this agreement.
|
||||
* @deprecated Instead use getCyclesRemaining
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCycles_remaining()
|
||||
{
|
||||
return $this->cycles_remaining;
|
||||
}
|
||||
|
||||
/**
|
||||
* Number of cycles completed for this agreement.
|
||||
*
|
||||
* @param string $cycles_completed
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setCyclesCompleted($cycles_completed)
|
||||
{
|
||||
$this->cycles_completed = $cycles_completed;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Number of cycles completed for this agreement.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCyclesCompleted()
|
||||
{
|
||||
return $this->cycles_completed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Number of cycles completed for this agreement.
|
||||
*
|
||||
* @deprecated Instead use setCyclesCompleted
|
||||
*
|
||||
* @param string $cycles_completed
|
||||
* @return $this
|
||||
*/
|
||||
public function setCycles_completed($cycles_completed)
|
||||
{
|
||||
$this->cycles_completed = $cycles_completed;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Number of cycles completed for this agreement.
|
||||
* @deprecated Instead use getCyclesCompleted
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCycles_completed()
|
||||
{
|
||||
return $this->cycles_completed;
|
||||
}
|
||||
|
||||
/**
|
||||
* The next billing date for this agreement, represented as 2014-02-19T10:00:00Z format.
|
||||
*
|
||||
* @param string $next_billing_date
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setNextBillingDate($next_billing_date)
|
||||
{
|
||||
$this->next_billing_date = $next_billing_date;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The next billing date for this agreement, represented as 2014-02-19T10:00:00Z format.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getNextBillingDate()
|
||||
{
|
||||
return $this->next_billing_date;
|
||||
}
|
||||
|
||||
/**
|
||||
* The next billing date for this agreement, represented as 2014-02-19T10:00:00Z format.
|
||||
*
|
||||
* @deprecated Instead use setNextBillingDate
|
||||
*
|
||||
* @param string $next_billing_date
|
||||
* @return $this
|
||||
*/
|
||||
public function setNext_billing_date($next_billing_date)
|
||||
{
|
||||
$this->next_billing_date = $next_billing_date;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The next billing date for this agreement, represented as 2014-02-19T10:00:00Z format.
|
||||
* @deprecated Instead use getNextBillingDate
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getNext_billing_date()
|
||||
{
|
||||
return $this->next_billing_date;
|
||||
}
|
||||
|
||||
/**
|
||||
* Last payment date for this agreement, represented as 2014-06-09T09:42:31Z format.
|
||||
*
|
||||
* @param string $last_payment_date
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setLastPaymentDate($last_payment_date)
|
||||
{
|
||||
$this->last_payment_date = $last_payment_date;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Last payment date for this agreement, represented as 2014-06-09T09:42:31Z format.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLastPaymentDate()
|
||||
{
|
||||
return $this->last_payment_date;
|
||||
}
|
||||
|
||||
/**
|
||||
* Last payment date for this agreement, represented as 2014-06-09T09:42:31Z format.
|
||||
*
|
||||
* @deprecated Instead use setLastPaymentDate
|
||||
*
|
||||
* @param string $last_payment_date
|
||||
* @return $this
|
||||
*/
|
||||
public function setLast_payment_date($last_payment_date)
|
||||
{
|
||||
$this->last_payment_date = $last_payment_date;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Last payment date for this agreement, represented as 2014-06-09T09:42:31Z format.
|
||||
* @deprecated Instead use getLastPaymentDate
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLast_payment_date()
|
||||
{
|
||||
return $this->last_payment_date;
|
||||
}
|
||||
|
||||
/**
|
||||
* Last payment amount for this agreement.
|
||||
*
|
||||
* @param \PayPal\Api\Currency $last_payment_amount
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setLastPaymentAmount($last_payment_amount)
|
||||
{
|
||||
$this->last_payment_amount = $last_payment_amount;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Last payment amount for this agreement.
|
||||
*
|
||||
* @return \PayPal\Api\Currency
|
||||
*/
|
||||
public function getLastPaymentAmount()
|
||||
{
|
||||
return $this->last_payment_amount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Last payment amount for this agreement.
|
||||
*
|
||||
* @deprecated Instead use setLastPaymentAmount
|
||||
*
|
||||
* @param \PayPal\Api\Currency $last_payment_amount
|
||||
* @return $this
|
||||
*/
|
||||
public function setLast_payment_amount($last_payment_amount)
|
||||
{
|
||||
$this->last_payment_amount = $last_payment_amount;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Last payment amount for this agreement.
|
||||
* @deprecated Instead use getLastPaymentAmount
|
||||
*
|
||||
* @return \PayPal\Api\Currency
|
||||
*/
|
||||
public function getLast_payment_amount()
|
||||
{
|
||||
return $this->last_payment_amount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Last payment date for this agreement, represented as 2015-02-19T10:00:00Z format.
|
||||
*
|
||||
* @param string $final_payment_date
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setFinalPaymentDate($final_payment_date)
|
||||
{
|
||||
$this->final_payment_date = $final_payment_date;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Last payment date for this agreement, represented as 2015-02-19T10:00:00Z format.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFinalPaymentDate()
|
||||
{
|
||||
return $this->final_payment_date;
|
||||
}
|
||||
|
||||
/**
|
||||
* Last payment date for this agreement, represented as 2015-02-19T10:00:00Z format.
|
||||
*
|
||||
* @deprecated Instead use setFinalPaymentDate
|
||||
*
|
||||
* @param string $final_payment_date
|
||||
* @return $this
|
||||
*/
|
||||
public function setFinal_payment_date($final_payment_date)
|
||||
{
|
||||
$this->final_payment_date = $final_payment_date;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Last payment date for this agreement, represented as 2015-02-19T10:00:00Z format.
|
||||
* @deprecated Instead use getFinalPaymentDate
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFinal_payment_date()
|
||||
{
|
||||
return $this->final_payment_date;
|
||||
}
|
||||
|
||||
/**
|
||||
* Total number of failed payments for this agreement.
|
||||
*
|
||||
* @param string $failed_payment_count
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setFailedPaymentCount($failed_payment_count)
|
||||
{
|
||||
$this->failed_payment_count = $failed_payment_count;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Total number of failed payments for this agreement.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFailedPaymentCount()
|
||||
{
|
||||
return $this->failed_payment_count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Total number of failed payments for this agreement.
|
||||
*
|
||||
* @deprecated Instead use setFailedPaymentCount
|
||||
*
|
||||
* @param string $failed_payment_count
|
||||
* @return $this
|
||||
*/
|
||||
public function setFailed_payment_count($failed_payment_count)
|
||||
{
|
||||
$this->failed_payment_count = $failed_payment_count;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Total number of failed payments for this agreement.
|
||||
* @deprecated Instead use getFailedPaymentCount
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFailed_payment_count()
|
||||
{
|
||||
return $this->failed_payment_count;
|
||||
}
|
||||
|
||||
}
|
||||
65
lib/PayPal/Api/AgreementStateDescriptor.php
Normal file
65
lib/PayPal/Api/AgreementStateDescriptor.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace PayPal\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
|
||||
/**
|
||||
* Class AgreementStateDescriptor
|
||||
*
|
||||
* Description of the current state of the agreement.
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
* @property string note
|
||||
* @property \PayPal\Api\Currency amount
|
||||
*/
|
||||
class AgreementStateDescriptor extends PPModel
|
||||
{
|
||||
/**
|
||||
* Reason for changing the state of the agreement.
|
||||
*
|
||||
* @param string $note
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setNote($note)
|
||||
{
|
||||
$this->note = $note;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reason for changing the state of the agreement.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getNote()
|
||||
{
|
||||
return $this->note;
|
||||
}
|
||||
|
||||
/**
|
||||
* The amount and currency of the agreement.
|
||||
*
|
||||
* @param \PayPal\Api\Currency $amount
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setAmount($amount)
|
||||
{
|
||||
$this->amount = $amount;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The amount and currency of the agreement.
|
||||
*
|
||||
* @return \PayPal\Api\Currency
|
||||
*/
|
||||
public function getAmount()
|
||||
{
|
||||
return $this->amount;
|
||||
}
|
||||
|
||||
}
|
||||
457
lib/PayPal/Api/AgreementTransaction.php
Normal file
457
lib/PayPal/Api/AgreementTransaction.php
Normal file
@@ -0,0 +1,457 @@
|
||||
<?php
|
||||
|
||||
namespace PayPal\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
|
||||
/**
|
||||
* Class AgreementTransaction
|
||||
*
|
||||
* A resource representing an agreement_transaction that is returned during a transaction search.
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
* @property string transaction_id
|
||||
* @property string status
|
||||
* @property string transaction_type
|
||||
* @property \PayPal\Api\Currency amount
|
||||
* @property \PayPal\Api\Currency fee_amount
|
||||
* @property \PayPal\Api\Currency net_amount
|
||||
* @property string payer_email
|
||||
* @property string payer_name
|
||||
* @property string time_updated
|
||||
* @property string time_zone
|
||||
*/
|
||||
class AgreementTransaction extends PPModel
|
||||
{
|
||||
/**
|
||||
* Id corresponding to this transaction.
|
||||
*
|
||||
* @param string $transaction_id
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setTransactionId($transaction_id)
|
||||
{
|
||||
$this->transaction_id = $transaction_id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Id corresponding to this transaction.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTransactionId()
|
||||
{
|
||||
return $this->transaction_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Id corresponding to this transaction.
|
||||
*
|
||||
* @deprecated Instead use setTransactionId
|
||||
*
|
||||
* @param string $transaction_id
|
||||
* @return $this
|
||||
*/
|
||||
public function setTransaction_id($transaction_id)
|
||||
{
|
||||
$this->transaction_id = $transaction_id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Id corresponding to this transaction.
|
||||
* @deprecated Instead use getTransactionId
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTransaction_id()
|
||||
{
|
||||
return $this->transaction_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* State of the subscription at this time.
|
||||
*
|
||||
* @param string $status
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setStatus($status)
|
||||
{
|
||||
$this->status = $status;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* State of the subscription at this time.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getStatus()
|
||||
{
|
||||
return $this->status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Type of transaction, usually Recurring Payment.
|
||||
*
|
||||
* @param string $transaction_type
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setTransactionType($transaction_type)
|
||||
{
|
||||
$this->transaction_type = $transaction_type;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Type of transaction, usually Recurring Payment.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTransactionType()
|
||||
{
|
||||
return $this->transaction_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Type of transaction, usually Recurring Payment.
|
||||
*
|
||||
* @deprecated Instead use setTransactionType
|
||||
*
|
||||
* @param string $transaction_type
|
||||
* @return $this
|
||||
*/
|
||||
public function setTransaction_type($transaction_type)
|
||||
{
|
||||
$this->transaction_type = $transaction_type;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Type of transaction, usually Recurring Payment.
|
||||
* @deprecated Instead use getTransactionType
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTransaction_type()
|
||||
{
|
||||
return $this->transaction_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Amount for this transaction.
|
||||
*
|
||||
* @param \PayPal\Api\Currency $amount
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setAmount($amount)
|
||||
{
|
||||
$this->amount = $amount;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Amount for this transaction.
|
||||
*
|
||||
* @return \PayPal\Api\Currency
|
||||
*/
|
||||
public function getAmount()
|
||||
{
|
||||
return $this->amount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fee amount for this transaction.
|
||||
*
|
||||
* @param \PayPal\Api\Currency $fee_amount
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setFeeAmount($fee_amount)
|
||||
{
|
||||
$this->fee_amount = $fee_amount;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fee amount for this transaction.
|
||||
*
|
||||
* @return \PayPal\Api\Currency
|
||||
*/
|
||||
public function getFeeAmount()
|
||||
{
|
||||
return $this->fee_amount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fee amount for this transaction.
|
||||
*
|
||||
* @deprecated Instead use setFeeAmount
|
||||
*
|
||||
* @param \PayPal\Api\Currency $fee_amount
|
||||
* @return $this
|
||||
*/
|
||||
public function setFee_amount($fee_amount)
|
||||
{
|
||||
$this->fee_amount = $fee_amount;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fee amount for this transaction.
|
||||
* @deprecated Instead use getFeeAmount
|
||||
*
|
||||
* @return \PayPal\Api\Currency
|
||||
*/
|
||||
public function getFee_amount()
|
||||
{
|
||||
return $this->fee_amount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Net amount for this transaction.
|
||||
*
|
||||
* @param \PayPal\Api\Currency $net_amount
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setNetAmount($net_amount)
|
||||
{
|
||||
$this->net_amount = $net_amount;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Net amount for this transaction.
|
||||
*
|
||||
* @return \PayPal\Api\Currency
|
||||
*/
|
||||
public function getNetAmount()
|
||||
{
|
||||
return $this->net_amount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Net amount for this transaction.
|
||||
*
|
||||
* @deprecated Instead use setNetAmount
|
||||
*
|
||||
* @param \PayPal\Api\Currency $net_amount
|
||||
* @return $this
|
||||
*/
|
||||
public function setNet_amount($net_amount)
|
||||
{
|
||||
$this->net_amount = $net_amount;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Net amount for this transaction.
|
||||
* @deprecated Instead use getNetAmount
|
||||
*
|
||||
* @return \PayPal\Api\Currency
|
||||
*/
|
||||
public function getNet_amount()
|
||||
{
|
||||
return $this->net_amount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Email id of payer.
|
||||
*
|
||||
* @param string $payer_email
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setPayerEmail($payer_email)
|
||||
{
|
||||
$this->payer_email = $payer_email;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Email id of payer.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPayerEmail()
|
||||
{
|
||||
return $this->payer_email;
|
||||
}
|
||||
|
||||
/**
|
||||
* Email id of payer.
|
||||
*
|
||||
* @deprecated Instead use setPayerEmail
|
||||
*
|
||||
* @param string $payer_email
|
||||
* @return $this
|
||||
*/
|
||||
public function setPayer_email($payer_email)
|
||||
{
|
||||
$this->payer_email = $payer_email;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Email id of payer.
|
||||
* @deprecated Instead use getPayerEmail
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPayer_email()
|
||||
{
|
||||
return $this->payer_email;
|
||||
}
|
||||
|
||||
/**
|
||||
* Business name of payer.
|
||||
*
|
||||
* @param string $payer_name
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setPayerName($payer_name)
|
||||
{
|
||||
$this->payer_name = $payer_name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Business name of payer.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPayerName()
|
||||
{
|
||||
return $this->payer_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Business name of payer.
|
||||
*
|
||||
* @deprecated Instead use setPayerName
|
||||
*
|
||||
* @param string $payer_name
|
||||
* @return $this
|
||||
*/
|
||||
public function setPayer_name($payer_name)
|
||||
{
|
||||
$this->payer_name = $payer_name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Business name of payer.
|
||||
* @deprecated Instead use getPayerName
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPayer_name()
|
||||
{
|
||||
return $this->payer_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Time at which this transaction happened.
|
||||
*
|
||||
* @param string $time_updated
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setTimeUpdated($time_updated)
|
||||
{
|
||||
$this->time_updated = $time_updated;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Time at which this transaction happened.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTimeUpdated()
|
||||
{
|
||||
return $this->time_updated;
|
||||
}
|
||||
|
||||
/**
|
||||
* Time at which this transaction happened.
|
||||
*
|
||||
* @deprecated Instead use setTimeUpdated
|
||||
*
|
||||
* @param string $time_updated
|
||||
* @return $this
|
||||
*/
|
||||
public function setTime_updated($time_updated)
|
||||
{
|
||||
$this->time_updated = $time_updated;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Time at which this transaction happened.
|
||||
* @deprecated Instead use getTimeUpdated
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTime_updated()
|
||||
{
|
||||
return $this->time_updated;
|
||||
}
|
||||
|
||||
/**
|
||||
* Time zone of time_updated field.
|
||||
*
|
||||
* @param string $time_zone
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setTimeZone($time_zone)
|
||||
{
|
||||
$this->time_zone = $time_zone;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Time zone of time_updated field.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTimeZone()
|
||||
{
|
||||
return $this->time_zone;
|
||||
}
|
||||
|
||||
/**
|
||||
* Time zone of time_updated field.
|
||||
*
|
||||
* @deprecated Instead use setTimeZone
|
||||
*
|
||||
* @param string $time_zone
|
||||
* @return $this
|
||||
*/
|
||||
public function setTime_zone($time_zone)
|
||||
{
|
||||
$this->time_zone = $time_zone;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Time zone of time_updated field.
|
||||
* @deprecated Instead use getTimeZone
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTime_zone()
|
||||
{
|
||||
return $this->time_zone;
|
||||
}
|
||||
|
||||
}
|
||||
96
lib/PayPal/Api/AgreementTransactions.php
Normal file
96
lib/PayPal/Api/AgreementTransactions.php
Normal file
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
|
||||
namespace PayPal\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
|
||||
/**
|
||||
* Class AgreementTransactions
|
||||
*
|
||||
* A resource representing agreement_transactions that is returned during a transaction search.
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
* @property \PayPal\Api\AgreementTransaction[] agreement_transaction_list
|
||||
*/
|
||||
class AgreementTransactions extends PPModel
|
||||
{
|
||||
/**
|
||||
* Array of agreement_transaction object.
|
||||
*
|
||||
* @param \PayPal\Api\AgreementTransaction[] $agreement_transaction_list
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setAgreementTransactionList($agreement_transaction_list)
|
||||
{
|
||||
$this->agreement_transaction_list = $agreement_transaction_list;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of agreement_transaction object.
|
||||
*
|
||||
* @return \PayPal\Api\AgreementTransaction[]
|
||||
*/
|
||||
public function getAgreementTransactionList()
|
||||
{
|
||||
return $this->agreement_transaction_list;
|
||||
}
|
||||
|
||||
/**
|
||||
* Append AgreementTransactionList to the list.
|
||||
*
|
||||
* @param \PayPal\Api\AgreementTransaction $agreementTransaction
|
||||
* @return $this
|
||||
*/
|
||||
public function addAgreementTransactionList($agreementTransaction)
|
||||
{
|
||||
if (!$this->getAgreementTransactionList()) {
|
||||
return $this->setAgreementTransactionList(array($agreementTransaction));
|
||||
} else {
|
||||
return $this->setAgreementTransactionList(
|
||||
array_merge($this->getAgreementTransactionList(), array($agreementTransaction))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove AgreementTransactionList from the list.
|
||||
*
|
||||
* @param \PayPal\Api\AgreementTransaction $agreementTransaction
|
||||
* @return $this
|
||||
*/
|
||||
public function removeAgreementTransactionList($agreementTransaction)
|
||||
{
|
||||
return $this->setAgreementTransactionList(
|
||||
array_diff($this->getAgreementTransactionList(), array($agreementTransaction))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of agreement_transaction object.
|
||||
*
|
||||
* @deprecated Instead use setAgreementTransactionList
|
||||
*
|
||||
* @param \PayPal\Api\AgreementTransaction $agreement_transaction_list
|
||||
* @return $this
|
||||
*/
|
||||
public function setAgreement_transaction_list($agreement_transaction_list)
|
||||
{
|
||||
$this->agreement_transaction_list = $agreement_transaction_list;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of agreement_transaction object.
|
||||
* @deprecated Instead use getAgreementTransactionList
|
||||
*
|
||||
* @return \PayPal\Api\AgreementTransaction
|
||||
*/
|
||||
public function getAgreement_transaction_list()
|
||||
{
|
||||
return $this->agreement_transaction_list;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,11 +2,10 @@
|
||||
|
||||
namespace PayPal\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Rest\ApiContext;
|
||||
use PayPal\Rest\IResource;
|
||||
use PayPal\Transport\PPRestCall;
|
||||
use PayPal\Common\ResourceModel;
|
||||
use PayPal\Validation\ArgumentValidator;
|
||||
use PayPal\Rest\ApiContext;
|
||||
use PayPal\Transport\PPRestCall;
|
||||
|
||||
/**
|
||||
* Class BankAccount
|
||||
@@ -38,31 +37,12 @@ use PayPal\Validation\ArgumentValidator;
|
||||
* @property string create_time
|
||||
* @property string update_time
|
||||
* @property string valid_until
|
||||
* @property \PayPal\Api\Links links
|
||||
* @property \PayPal\Api\Links[] links
|
||||
*/
|
||||
class BankAccount extends PPModel implements IResource
|
||||
class BankAccount extends ResourceModel
|
||||
{
|
||||
/**
|
||||
* OAuth Credentials to use for this call
|
||||
*
|
||||
* @var \PayPal\Auth\OAuthTokenCredential $credential
|
||||
*/
|
||||
protected static $credential;
|
||||
|
||||
/**
|
||||
* Sets Credential
|
||||
*
|
||||
* @deprecated Pass ApiContext to create/get methods instead
|
||||
* @param \PayPal\Auth\OAuthTokenCredential $credential
|
||||
*/
|
||||
public static function setCredential($credential)
|
||||
{
|
||||
self::$credential = $credential;
|
||||
}
|
||||
|
||||
/**
|
||||
* ID of the bank account being saved for later use.
|
||||
*
|
||||
*
|
||||
* @param string $id
|
||||
*
|
||||
@@ -86,7 +66,6 @@ class BankAccount extends PPModel implements IResource
|
||||
|
||||
/**
|
||||
* Account number in either IBAN (max length 34) or BBAN (max length 17) format.
|
||||
*
|
||||
*
|
||||
* @param string $account_number
|
||||
*
|
||||
@@ -135,7 +114,7 @@ class BankAccount extends PPModel implements IResource
|
||||
|
||||
/**
|
||||
* Type of the bank account number (International or Basic Bank Account Number). For more information refer to http://en.wikipedia.org/wiki/International_Bank_Account_Number.
|
||||
* Valid Values: ["BBAN", "IBAN"]
|
||||
* Valid Values: ["BBAN", "IBAN"]
|
||||
*
|
||||
* @param string $account_number_type
|
||||
*
|
||||
@@ -184,7 +163,6 @@ class BankAccount extends PPModel implements IResource
|
||||
|
||||
/**
|
||||
* Routing transit number (aka Bank Code) of the bank (typically for domestic use only - for international use, IBAN includes bank code). For more information refer to http://en.wikipedia.org/wiki/Bank_code.
|
||||
*
|
||||
*
|
||||
* @param string $routing_number
|
||||
*
|
||||
@@ -233,7 +211,7 @@ class BankAccount extends PPModel implements IResource
|
||||
|
||||
/**
|
||||
* Type of the bank account.
|
||||
* Valid Values: ["CHECKING", "SAVINGS"]
|
||||
* Valid Values: ["CHECKING", "SAVINGS"]
|
||||
*
|
||||
* @param string $account_type
|
||||
*
|
||||
@@ -282,7 +260,6 @@ class BankAccount extends PPModel implements IResource
|
||||
|
||||
/**
|
||||
* A customer designated name.
|
||||
*
|
||||
*
|
||||
* @param string $account_name
|
||||
*
|
||||
@@ -331,7 +308,7 @@ class BankAccount extends PPModel implements IResource
|
||||
|
||||
/**
|
||||
* Type of the check when this information was obtained through a check by the facilitator or merchant.
|
||||
* Valid Values: ["PERSONAL", "COMPANY"]
|
||||
* Valid Values: ["PERSONAL", "COMPANY"]
|
||||
*
|
||||
* @param string $check_type
|
||||
*
|
||||
@@ -380,7 +357,7 @@ class BankAccount extends PPModel implements IResource
|
||||
|
||||
/**
|
||||
* How the check was obtained from the customer, if check was the source of the information provided.
|
||||
* Valid Values: ["CCD", "PPD", "TEL", "POP", "ARC", "RCK", "WEB"]
|
||||
* Valid Values: ["CCD", "PPD", "TEL", "POP", "ARC", "RCK", "WEB"]
|
||||
*
|
||||
* @param string $auth_type
|
||||
*
|
||||
@@ -429,7 +406,6 @@ class BankAccount extends PPModel implements IResource
|
||||
|
||||
/**
|
||||
* Time at which the authorization (or check) was captured. Use this field if the user authorization needs to be captured due to any privacy requirements.
|
||||
*
|
||||
*
|
||||
* @param string $auth_capture_timestamp
|
||||
*
|
||||
@@ -478,7 +454,6 @@ class BankAccount extends PPModel implements IResource
|
||||
|
||||
/**
|
||||
* Name of the bank.
|
||||
*
|
||||
*
|
||||
* @param string $bank_name
|
||||
*
|
||||
@@ -527,7 +502,6 @@ class BankAccount extends PPModel implements IResource
|
||||
|
||||
/**
|
||||
* 2 letter country code of the Bank.
|
||||
*
|
||||
*
|
||||
* @param string $country_code
|
||||
*
|
||||
@@ -576,7 +550,6 @@ class BankAccount extends PPModel implements IResource
|
||||
|
||||
/**
|
||||
* Account holder's first name.
|
||||
*
|
||||
*
|
||||
* @param string $first_name
|
||||
*
|
||||
@@ -625,7 +598,6 @@ class BankAccount extends PPModel implements IResource
|
||||
|
||||
/**
|
||||
* Account holder's last name.
|
||||
*
|
||||
*
|
||||
* @param string $last_name
|
||||
*
|
||||
@@ -674,7 +646,6 @@ class BankAccount extends PPModel implements IResource
|
||||
|
||||
/**
|
||||
* Birth date of the bank account holder.
|
||||
*
|
||||
*
|
||||
* @param string $birth_date
|
||||
*
|
||||
@@ -723,7 +694,6 @@ class BankAccount extends PPModel implements IResource
|
||||
|
||||
/**
|
||||
* Billing address.
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\Address $billing_address
|
||||
*
|
||||
@@ -772,7 +742,7 @@ class BankAccount extends PPModel implements IResource
|
||||
|
||||
/**
|
||||
* State of this funding instrument.
|
||||
* Valid Values: ["ACTIVE", "INACTIVE", "DELETED"]
|
||||
* Valid Values: ["ACTIVE", "INACTIVE", "DELETED"]
|
||||
*
|
||||
* @param string $state
|
||||
*
|
||||
@@ -796,7 +766,7 @@ class BankAccount extends PPModel implements IResource
|
||||
|
||||
/**
|
||||
* Confirmation status of a bank account.
|
||||
* Valid Values: ["UNCONFIRMED", "CONFIRMED"]
|
||||
* Valid Values: ["UNCONFIRMED", "CONFIRMED"]
|
||||
*
|
||||
* @param string $confirmation_status
|
||||
*
|
||||
@@ -845,7 +815,6 @@ class BankAccount extends PPModel implements IResource
|
||||
|
||||
/**
|
||||
* Deprecated - Use external_customer_id instead.
|
||||
*
|
||||
*
|
||||
* @param string $payer_id
|
||||
*
|
||||
@@ -894,7 +863,6 @@ class BankAccount extends PPModel implements IResource
|
||||
|
||||
/**
|
||||
* A unique identifier of the customer to whom this bank account belongs to. Generated and provided by the facilitator. This is required when creating or using a stored funding instrument in vault.
|
||||
*
|
||||
*
|
||||
* @param string $external_customer_id
|
||||
*
|
||||
@@ -943,7 +911,6 @@ class BankAccount extends PPModel implements IResource
|
||||
|
||||
/**
|
||||
* A unique identifier of the merchant for which this bank account has been stored for. Generated and provided by the facilitator so it can be used to restrict the usage of the bank account to the specific merchnt.
|
||||
*
|
||||
*
|
||||
* @param string $merchant_id
|
||||
*
|
||||
@@ -992,7 +959,6 @@ class BankAccount extends PPModel implements IResource
|
||||
|
||||
/**
|
||||
* Time the resource was created.
|
||||
*
|
||||
*
|
||||
* @param string $create_time
|
||||
*
|
||||
@@ -1041,7 +1007,6 @@ class BankAccount extends PPModel implements IResource
|
||||
|
||||
/**
|
||||
* Time the resource was last updated.
|
||||
*
|
||||
*
|
||||
* @param string $update_time
|
||||
*
|
||||
@@ -1090,7 +1055,6 @@ class BankAccount extends PPModel implements IResource
|
||||
|
||||
/**
|
||||
* Date/Time until this resource can be used to fund a payment.
|
||||
*
|
||||
*
|
||||
* @param string $valid_until
|
||||
*
|
||||
@@ -1139,9 +1103,8 @@ class BankAccount extends PPModel implements IResource
|
||||
|
||||
/**
|
||||
* Sets Links
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\Links $links
|
||||
* @param \PayPal\Api\Links[] $links
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
@@ -1161,21 +1124,54 @@ class BankAccount extends PPModel implements IResource
|
||||
return $this->links;
|
||||
}
|
||||
|
||||
/**
|
||||
* Append Links to the list.
|
||||
*
|
||||
* @param \PayPal\Api\Links $links
|
||||
* @return $this
|
||||
*/
|
||||
public function addLink($links)
|
||||
{
|
||||
if (!$this->getLinks()) {
|
||||
return $this->setLinks(array($links));
|
||||
} else {
|
||||
return $this->setLinks(
|
||||
array_merge($this->getLinks(), array($links))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove Links from the list.
|
||||
*
|
||||
* @param \PayPal\Api\Links $links
|
||||
* @return $this
|
||||
*/
|
||||
public function removeLink($links)
|
||||
{
|
||||
return $this->setLinks(
|
||||
array_diff($this->getLinks(), array($links))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new Bank Account Resource.
|
||||
*
|
||||
* @param \PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
||||
* @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
||||
* @param PPRestCall $restCall is the Rest Call Service that is used to make rest calls
|
||||
* @return BankAccount
|
||||
*/
|
||||
public function create($apiContext = null)
|
||||
public function create($apiContext = null, $restCall = null)
|
||||
{
|
||||
|
||||
$payLoad = $this->toJSON();
|
||||
if ($apiContext == null) {
|
||||
$apiContext = new ApiContext(self::$credential);
|
||||
}
|
||||
$call = new PPRestCall($apiContext);
|
||||
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/vault/bank-accounts", "POST", $payLoad);
|
||||
$json = self::executeCall(
|
||||
"/v1/vault/bank-accounts",
|
||||
"POST",
|
||||
$payLoad,
|
||||
null,
|
||||
$apiContext,
|
||||
$restCall
|
||||
);
|
||||
$this->fromJson($json);
|
||||
return $this;
|
||||
}
|
||||
@@ -1184,19 +1180,22 @@ class BankAccount extends PPModel implements IResource
|
||||
* Obtain the Bank Account resource for the given identifier.
|
||||
*
|
||||
* @param string $bankAccountId
|
||||
* @param \PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
||||
* @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
||||
* @param PPRestCall $restCall is the Rest Call Service that is used to make rest calls
|
||||
* @return BankAccount
|
||||
*/
|
||||
public static function get($bankAccountId, $apiContext = null)
|
||||
public static function get($bankAccountId, $apiContext = null, $restCall = null)
|
||||
{
|
||||
ArgumentValidator::validate($bankAccountId, 'bankAccountId');
|
||||
|
||||
$payLoad = "";
|
||||
if ($apiContext == null) {
|
||||
$apiContext = new ApiContext(self::$credential);
|
||||
}
|
||||
$call = new PPRestCall($apiContext);
|
||||
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/vault/bank-accounts/$bankAccountId", "GET", $payLoad);
|
||||
$json = self::executeCall(
|
||||
"/v1/vault/bank-accounts/$bankAccountId",
|
||||
"GET",
|
||||
$payLoad,
|
||||
null,
|
||||
$apiContext,
|
||||
$restCall
|
||||
);
|
||||
$ret = new BankAccount();
|
||||
$ret->fromJson($json);
|
||||
return $ret;
|
||||
@@ -1205,38 +1204,46 @@ class BankAccount extends PPModel implements IResource
|
||||
/**
|
||||
* Delete the bank account 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.
|
||||
* @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
||||
* @param PPRestCall $restCall is the Rest Call Service that is used to make rest calls
|
||||
* @return bool
|
||||
*/
|
||||
public function delete($apiContext = null)
|
||||
public function delete($apiContext = null, $restCall = 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/vault/bank-accounts/{$this->getId()}", "DELETE", $payLoad);
|
||||
self::executeCall(
|
||||
"/v1/vault/bank-accounts/{$this->getId()}",
|
||||
"DELETE",
|
||||
$payLoad,
|
||||
null,
|
||||
$apiContext,
|
||||
$restCall
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update information in a previously saved bank account. 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.
|
||||
* @param PatchRequest $patchRequest
|
||||
* @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
||||
* @param PPRestCall $restCall is the Rest Call Service that is used to make rest calls
|
||||
* @return BankAccount
|
||||
*/
|
||||
public function update($apiContext = null)
|
||||
public function update($patchRequest, $apiContext = null, $restCall = 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/vault/bank-accounts/{$this->getId()}", "PATCH", $payLoad);
|
||||
ArgumentValidator::validate($patchRequest, 'patchRequest');
|
||||
$payLoad = $patchRequest->toJSON();
|
||||
$json = self::executeCall(
|
||||
"/v1/vault/bank-accounts/{$this->getId()}",
|
||||
"PATCH",
|
||||
$payLoad,
|
||||
null,
|
||||
$apiContext,
|
||||
$restCall
|
||||
);
|
||||
$this->fromJson($json);
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace PayPal\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Rest\ApiContext;
|
||||
|
||||
/**
|
||||
* Class BankAccountsList
|
||||
@@ -12,7 +11,7 @@ use PayPal\Rest\ApiContext;
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
* @property \PayPal\Api\BankAccount bank_accounts
|
||||
* @property \PayPal\Api\BankAccount[] bank_accounts
|
||||
* @property int count
|
||||
* @property string next_id
|
||||
*/
|
||||
@@ -20,9 +19,8 @@ class BankAccountsList extends PPModel
|
||||
{
|
||||
/**
|
||||
* A list of bank account resources
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\BankAccount $bank_accounts
|
||||
* @param \PayPal\Api\BankAccount[] $bank_accounts
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
@@ -42,6 +40,36 @@ class BankAccountsList extends PPModel
|
||||
return $this->{"bank-accounts"};
|
||||
}
|
||||
|
||||
/**
|
||||
* Append BankAccounts to the list.
|
||||
*
|
||||
* @param \PayPal\Api\BankAccount $bankAccount
|
||||
* @return $this
|
||||
*/
|
||||
public function addBankAccount($bankAccount)
|
||||
{
|
||||
if (!$this->getBankAccounts()) {
|
||||
return $this->setBankAccounts(array($bankAccount));
|
||||
} else {
|
||||
return $this->setBankAccounts(
|
||||
array_merge($this->getBankAccounts(), array($bankAccount))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove BankAccounts from the list.
|
||||
*
|
||||
* @param \PayPal\Api\BankAccount $bankAccount
|
||||
* @return $this
|
||||
*/
|
||||
public function removeBankAccount($bankAccount)
|
||||
{
|
||||
return $this->setBankAccounts(
|
||||
array_diff($this->getBankAccounts(), array($bankAccount))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* A list of bank account resources
|
||||
*
|
||||
@@ -69,7 +97,6 @@ class BankAccountsList extends PPModel
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
@@ -93,7 +120,6 @@ class BankAccountsList extends PPModel
|
||||
|
||||
/**
|
||||
* Identifier of the next element to get the next range of results.
|
||||
*
|
||||
*
|
||||
* @param string $next_id
|
||||
*
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace PayPal\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Rest\ApiContext;
|
||||
|
||||
/**
|
||||
* Class BankToken
|
||||
@@ -20,7 +19,6 @@ class BankToken extends PPModel
|
||||
{
|
||||
/**
|
||||
* ID of a previously saved Bank resource using /vault/bank API.
|
||||
*
|
||||
*
|
||||
* @param string $bank_id
|
||||
*
|
||||
@@ -69,7 +67,6 @@ class BankToken extends PPModel
|
||||
|
||||
/**
|
||||
* The unique identifier of the payer used when saving this bank using /vault/bank API.
|
||||
*
|
||||
*
|
||||
* @param string $external_customer_id
|
||||
*
|
||||
@@ -118,7 +115,6 @@ class BankToken extends PPModel
|
||||
|
||||
/**
|
||||
* Identifier of the direct debit mandate to validate. Currently supported only for EU bank accounts(SEPA).
|
||||
*
|
||||
*
|
||||
* @param string $mandate_reference_number
|
||||
*
|
||||
|
||||
89
lib/PayPal/Api/ChargeModel.php
Normal file
89
lib/PayPal/Api/ChargeModel.php
Normal file
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
|
||||
namespace PayPal\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
|
||||
/**
|
||||
* Class ChargeModel
|
||||
*
|
||||
* A resource representing a charge model for a payment definition.
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
* @property string id
|
||||
* @property string type
|
||||
* @property \PayPal\Api\Currency amount
|
||||
*/
|
||||
class ChargeModel extends PPModel
|
||||
{
|
||||
/**
|
||||
* Identifier of the charge model. 128 characters max.
|
||||
*
|
||||
* @param string $id
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setId($id)
|
||||
{
|
||||
$this->id = $id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Identifier of the charge model. 128 characters max.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Type of charge model. Allowed values: `SHIPPING`, `TAX`.
|
||||
*
|
||||
* @param string $type
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setType($type)
|
||||
{
|
||||
$this->type = $type;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Type of charge model. Allowed values: `SHIPPING`, `TAX`.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specific amount for this charge model.
|
||||
*
|
||||
* @param \PayPal\Api\Currency $amount
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setAmount($amount)
|
||||
{
|
||||
$this->amount = $amount;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specific amount for this charge model.
|
||||
*
|
||||
* @return \PayPal\Api\Currency
|
||||
*/
|
||||
public function getAmount()
|
||||
{
|
||||
return $this->amount;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace PayPal\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Rest\ApiContext;
|
||||
|
||||
/**
|
||||
* Class Credit
|
||||
@@ -20,7 +19,6 @@ class Credit extends PPModel
|
||||
{
|
||||
/**
|
||||
* Unique identifier of credit resource.
|
||||
*
|
||||
*
|
||||
* @param string $id
|
||||
*
|
||||
@@ -43,8 +41,8 @@ class Credit extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* specifies type of credit
|
||||
* Valid Values: ["BILL_ME_LATER", "PAYPAL_EXTRAS_MASTERCARD", "EBAY_MASTERCARD", "PAYPAL_SMART_CONNECT"]
|
||||
* Specifies the type of credit.
|
||||
* Valid Values: ["BILL_ME_LATER", "PAYPAL_EXTRAS_MASTERCARD", "EBAY_MASTERCARD", "PAYPAL_SMART_CONNECT"]
|
||||
*
|
||||
* @param string $type
|
||||
*
|
||||
@@ -57,7 +55,7 @@ class Credit extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* specifies type of credit
|
||||
* Specifies the type of credit.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -67,8 +65,7 @@ class Credit extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* URI to the associated terms
|
||||
*
|
||||
* URI to the associated terms.
|
||||
*
|
||||
* @param string $terms
|
||||
*
|
||||
@@ -81,7 +78,7 @@ class Credit extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* URI to the associated terms
|
||||
* URI to the associated terms.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
||||
@@ -2,11 +2,10 @@
|
||||
|
||||
namespace PayPal\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Rest\ApiContext;
|
||||
use PayPal\Rest\IResource;
|
||||
use PayPal\Transport\PPRestCall;
|
||||
use PayPal\Common\ResourceModel;
|
||||
use PayPal\Validation\ArgumentValidator;
|
||||
use PayPal\Rest\ApiContext;
|
||||
use PayPal\Transport\PPRestCall;
|
||||
|
||||
/**
|
||||
* Class CreditCard
|
||||
@@ -29,31 +28,12 @@ use PayPal\Validation\ArgumentValidator;
|
||||
* @property string valid_until
|
||||
* @property string create_time
|
||||
* @property string update_time
|
||||
* @property \PayPal\Api\Links links
|
||||
* @property \PayPal\Api\Links[] links
|
||||
*/
|
||||
class CreditCard extends PPModel implements IResource
|
||||
class CreditCard extends ResourceModel
|
||||
{
|
||||
/**
|
||||
* OAuth Credentials to use for this call
|
||||
*
|
||||
* @var \PayPal\Auth\OAuthTokenCredential $credential
|
||||
*/
|
||||
protected static $credential;
|
||||
|
||||
/**
|
||||
* Sets Credential
|
||||
*
|
||||
* @deprecated Pass ApiContext to create/get methods instead
|
||||
* @param \PayPal\Auth\OAuthTokenCredential $credential
|
||||
*/
|
||||
public static function setCredential($credential)
|
||||
{
|
||||
self::$credential = $credential;
|
||||
}
|
||||
|
||||
/**
|
||||
* ID of the credit card being saved for later use.
|
||||
*
|
||||
*
|
||||
* @param string $id
|
||||
*
|
||||
@@ -77,7 +57,6 @@ class CreditCard extends PPModel implements IResource
|
||||
|
||||
/**
|
||||
* Card number.
|
||||
*
|
||||
*
|
||||
* @param string $number
|
||||
*
|
||||
@@ -101,7 +80,6 @@ class CreditCard extends PPModel implements IResource
|
||||
|
||||
/**
|
||||
* Type of the Card (eg. Visa, Mastercard, etc.).
|
||||
*
|
||||
*
|
||||
* @param string $type
|
||||
*
|
||||
@@ -125,7 +103,6 @@ class CreditCard extends PPModel implements IResource
|
||||
|
||||
/**
|
||||
* 2 digit card expiry month.
|
||||
*
|
||||
*
|
||||
* @param int $expire_month
|
||||
*
|
||||
@@ -174,7 +151,6 @@ class CreditCard extends PPModel implements IResource
|
||||
|
||||
/**
|
||||
* 4 digit card expiry year
|
||||
*
|
||||
*
|
||||
* @param int $expire_year
|
||||
*
|
||||
@@ -223,7 +199,6 @@ class CreditCard extends PPModel implements IResource
|
||||
|
||||
/**
|
||||
* Card validation code. Only supported when making a Payment but not when saving a credit card for future use.
|
||||
*
|
||||
*
|
||||
* @param int $cvv2
|
||||
*
|
||||
@@ -247,7 +222,6 @@ class CreditCard extends PPModel implements IResource
|
||||
|
||||
/**
|
||||
* Card holder's first name.
|
||||
*
|
||||
*
|
||||
* @param string $first_name
|
||||
*
|
||||
@@ -296,7 +270,6 @@ class CreditCard extends PPModel implements IResource
|
||||
|
||||
/**
|
||||
* Card holder's last name.
|
||||
*
|
||||
*
|
||||
* @param string $last_name
|
||||
*
|
||||
@@ -345,7 +318,6 @@ class CreditCard extends PPModel implements IResource
|
||||
|
||||
/**
|
||||
* Billing Address associated with this card.
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\Address $billing_address
|
||||
*
|
||||
@@ -394,7 +366,6 @@ class CreditCard extends PPModel implements IResource
|
||||
|
||||
/**
|
||||
* A unique identifier of the customer to whom this bank account belongs to. Generated and provided by the facilitator. This is required when creating or using a stored funding instrument in vault.
|
||||
*
|
||||
*
|
||||
* @param string $external_customer_id
|
||||
*
|
||||
@@ -443,7 +414,7 @@ class CreditCard extends PPModel implements IResource
|
||||
|
||||
/**
|
||||
* State of the funding instrument.
|
||||
* Valid Values: ["expired", "ok"]
|
||||
* Valid Values: ["expired", "ok"]
|
||||
*
|
||||
* @param string $state
|
||||
*
|
||||
@@ -467,7 +438,6 @@ class CreditCard extends PPModel implements IResource
|
||||
|
||||
/**
|
||||
* Date/Time until this resource can be used fund a payment.
|
||||
*
|
||||
*
|
||||
* @param string $valid_until
|
||||
*
|
||||
@@ -516,7 +486,6 @@ class CreditCard extends PPModel implements IResource
|
||||
|
||||
/**
|
||||
* Time the resource was created in UTC ISO8601 format.
|
||||
*
|
||||
*
|
||||
* @param string $create_time
|
||||
*
|
||||
@@ -564,8 +533,7 @@ class CreditCard extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Time the resource was last updated in UTC ISO8601 format.
|
||||
*
|
||||
* Time the resource was created in UTC ISO8601 format.
|
||||
*
|
||||
* @param string $update_time
|
||||
*
|
||||
@@ -578,7 +546,7 @@ class CreditCard extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Time the resource was last updated in UTC ISO8601 format.
|
||||
* Time the resource was created in UTC ISO8601 format.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -588,7 +556,7 @@ class CreditCard extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Time the resource was last updated in UTC ISO8601 format.
|
||||
* Time the resource was created in UTC ISO8601 format.
|
||||
*
|
||||
* @deprecated Instead use setUpdateTime
|
||||
*
|
||||
@@ -602,7 +570,7 @@ class CreditCard extends PPModel implements IResource
|
||||
}
|
||||
|
||||
/**
|
||||
* Time the resource was last updated in UTC ISO8601 format.
|
||||
* Time the resource was created in UTC ISO8601 format.
|
||||
* @deprecated Instead use getUpdateTime
|
||||
*
|
||||
* @return string
|
||||
@@ -614,9 +582,8 @@ class CreditCard extends PPModel implements IResource
|
||||
|
||||
/**
|
||||
* Sets Links
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\Links $links
|
||||
* @param \PayPal\Api\Links[] $links
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
@@ -636,21 +603,54 @@ class CreditCard extends PPModel implements IResource
|
||||
return $this->links;
|
||||
}
|
||||
|
||||
/**
|
||||
* Append Links to the list.
|
||||
*
|
||||
* @param \PayPal\Api\Links $links
|
||||
* @return $this
|
||||
*/
|
||||
public function addLink($links)
|
||||
{
|
||||
if (!$this->getLinks()) {
|
||||
return $this->setLinks(array($links));
|
||||
} else {
|
||||
return $this->setLinks(
|
||||
array_merge($this->getLinks(), array($links))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove Links from the list.
|
||||
*
|
||||
* @param \PayPal\Api\Links $links
|
||||
* @return $this
|
||||
*/
|
||||
public function removeLink($links)
|
||||
{
|
||||
return $this->setLinks(
|
||||
array_diff($this->getLinks(), array($links))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new Credit Card Resource (aka Tokenize).
|
||||
*
|
||||
* @param \PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
||||
* @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
||||
* @param PPRestCall $restCall is the Rest Call Service that is used to make rest calls
|
||||
* @return CreditCard
|
||||
*/
|
||||
public function create($apiContext = null)
|
||||
public function create($apiContext = null, $restCall = null)
|
||||
{
|
||||
|
||||
$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);
|
||||
$json = self::executeCall(
|
||||
"/v1/vault/credit-card",
|
||||
"POST",
|
||||
$payLoad,
|
||||
null,
|
||||
$apiContext,
|
||||
$restCall
|
||||
);
|
||||
$this->fromJson($json);
|
||||
return $this;
|
||||
}
|
||||
@@ -659,19 +659,22 @@ class CreditCard extends PPModel implements IResource
|
||||
* 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.
|
||||
* @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
||||
* @param PPRestCall $restCall is the Rest Call Service that is used to make rest calls
|
||||
* @return CreditCard
|
||||
*/
|
||||
public static function get($creditCardId, $apiContext = null)
|
||||
public static function get($creditCardId, $apiContext = null, $restCall = null)
|
||||
{
|
||||
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);
|
||||
$json = self::executeCall(
|
||||
"/v1/vault/credit-card/$creditCardId",
|
||||
"GET",
|
||||
$payLoad,
|
||||
null,
|
||||
$apiContext,
|
||||
$restCall
|
||||
);
|
||||
$ret = new CreditCard();
|
||||
$ret->fromJson($json);
|
||||
return $ret;
|
||||
@@ -680,38 +683,44 @@ class CreditCard extends PPModel implements IResource
|
||||
/**
|
||||
* 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.
|
||||
* @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
||||
* @param PPRestCall $restCall is the Rest Call Service that is used to make rest calls
|
||||
* @return bool
|
||||
*/
|
||||
public function delete($apiContext = null)
|
||||
public function delete($apiContext = null, $restCall = 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/vault/credit-card/{$this->getId()}", "DELETE", $payLoad);
|
||||
self::executeCall(
|
||||
"/v1/vault/credit-card/{$this->getId()}",
|
||||
"DELETE",
|
||||
$payLoad,
|
||||
null,
|
||||
$apiContext,
|
||||
$restCall
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update information in a previously saved card. Only the modified fields need to be passed in the request.
|
||||
*
|
||||
* @param \PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
||||
* @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
||||
* @param PPRestCall $restCall is the Rest Call Service that is used to make rest calls
|
||||
* @return CreditCard
|
||||
*/
|
||||
public function update($apiContext = null)
|
||||
public function update($apiContext = null, $restCall = 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);
|
||||
$json = self::executeCall(
|
||||
"/v1/vault/credit-card/{$this->getId()}",
|
||||
"PATCH",
|
||||
$payLoad,
|
||||
null,
|
||||
$apiContext,
|
||||
$restCall
|
||||
);
|
||||
$this->fromJson($json);
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace PayPal\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Rest\ApiContext;
|
||||
|
||||
/**
|
||||
* Class CreditCardList
|
||||
@@ -12,7 +11,7 @@ use PayPal\Rest\ApiContext;
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
* @property \PayPal\Api\CreditCard credit_cards
|
||||
* @property \PayPal\Api\CreditCard[] credit_cards
|
||||
* @property int count
|
||||
* @property string next_id
|
||||
*/
|
||||
@@ -20,9 +19,8 @@ class CreditCardList extends PPModel
|
||||
{
|
||||
/**
|
||||
* A list of credit card resources
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\CreditCard $credit_cards
|
||||
* @param \PayPal\Api\CreditCard[] $credit_cards
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
@@ -42,6 +40,36 @@ class CreditCardList extends PPModel
|
||||
return $this->{"credit-cards"};
|
||||
}
|
||||
|
||||
/**
|
||||
* Append CreditCards to the list.
|
||||
*
|
||||
* @param \PayPal\Api\CreditCard $creditCard
|
||||
* @return $this
|
||||
*/
|
||||
public function addCreditCard($creditCard)
|
||||
{
|
||||
if (!$this->getCreditCards()) {
|
||||
return $this->setCreditCards(array($creditCard));
|
||||
} else {
|
||||
return $this->setCreditCards(
|
||||
array_merge($this->getCreditCards(), array($creditCard))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove CreditCards from the list.
|
||||
*
|
||||
* @param \PayPal\Api\CreditCard $creditCard
|
||||
* @return $this
|
||||
*/
|
||||
public function removeCreditCard($creditCard)
|
||||
{
|
||||
return $this->setCreditCards(
|
||||
array_diff($this->getCreditCards(), array($creditCard))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* A list of credit card resources
|
||||
*
|
||||
@@ -69,7 +97,6 @@ class CreditCardList extends PPModel
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
@@ -93,7 +120,6 @@ class CreditCardList extends PPModel
|
||||
|
||||
/**
|
||||
* Identifier of the next element to get the next range of results.
|
||||
*
|
||||
*
|
||||
* @param string $next_id
|
||||
*
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace PayPal\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Rest\ApiContext;
|
||||
|
||||
/**
|
||||
* Class CreditCardToken
|
||||
@@ -23,7 +22,6 @@ class CreditCardToken extends PPModel
|
||||
{
|
||||
/**
|
||||
* ID of a previously saved Credit Card resource using /vault/credit-card API.
|
||||
*
|
||||
*
|
||||
* @param string $credit_card_id
|
||||
*
|
||||
@@ -72,7 +70,6 @@ class CreditCardToken extends PPModel
|
||||
|
||||
/**
|
||||
* The unique identifier of the payer used when saving this credit card using /vault/credit-card API.
|
||||
*
|
||||
*
|
||||
* @param string $payer_id
|
||||
*
|
||||
@@ -121,7 +118,6 @@ class CreditCardToken extends PPModel
|
||||
|
||||
/**
|
||||
* Last 4 digits of the card number from the saved card.
|
||||
*
|
||||
*
|
||||
* @param string $last4
|
||||
*
|
||||
@@ -145,7 +141,6 @@ class CreditCardToken extends PPModel
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
@@ -168,8 +163,7 @@ class CreditCardToken extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* card expiry month from the saved card with value 1 - 12
|
||||
*
|
||||
* Expiry month from the saved card, represented as 1 - 12.
|
||||
*
|
||||
* @param int $expire_month
|
||||
*
|
||||
@@ -182,7 +176,7 @@ class CreditCardToken extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* card expiry month from the saved card with value 1 - 12
|
||||
* Expiry month from the saved card, represented as 1 - 12.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
@@ -192,7 +186,7 @@ class CreditCardToken extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* card expiry month from the saved card with value 1 - 12
|
||||
* Expiry month from the saved card, represented as 1 - 12.
|
||||
*
|
||||
* @deprecated Instead use setExpireMonth
|
||||
*
|
||||
@@ -206,7 +200,7 @@ class CreditCardToken extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* card expiry month from the saved card with value 1 - 12
|
||||
* Expiry month from the saved card, represented as 1 - 12.
|
||||
* @deprecated Instead use getExpireMonth
|
||||
*
|
||||
* @return int
|
||||
@@ -217,8 +211,7 @@ class CreditCardToken extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* 4 digit card expiry year from the saved card
|
||||
*
|
||||
* Expiry year from the saved card, represented as YYYY format.
|
||||
*
|
||||
* @param int $expire_year
|
||||
*
|
||||
@@ -231,7 +224,7 @@ class CreditCardToken extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* 4 digit card expiry year from the saved card
|
||||
* Expiry year from the saved card, represented as YYYY format.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
@@ -241,7 +234,7 @@ class CreditCardToken extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* 4 digit card expiry year from the saved card
|
||||
* Expiry year from the saved card, represented as YYYY format.
|
||||
*
|
||||
* @deprecated Instead use setExpireYear
|
||||
*
|
||||
@@ -255,7 +248,7 @@ class CreditCardToken extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* 4 digit card expiry year from the saved card
|
||||
* Expiry year from the saved card, represented as YYYY format.
|
||||
* @deprecated Instead use getExpireYear
|
||||
*
|
||||
* @return int
|
||||
|
||||
@@ -1,15 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace PayPal\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Rest\ApiContext;
|
||||
|
||||
/**
|
||||
* Class Currency
|
||||
*
|
||||
* Base object for all financial value related fields (balance, payment due, etc.)
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
* @property string currency
|
||||
* @property string value
|
||||
*/
|
||||
class Currency extends PPModel
|
||||
{
|
||||
/**
|
||||
* 3 letter currency code
|
||||
* 3 letter currency code as defined by ISO 4217.
|
||||
*
|
||||
* @param string $currency
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setCurrency($currency)
|
||||
{
|
||||
@@ -18,7 +30,7 @@ class Currency extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* 3 letter currency code
|
||||
* 3 letter currency code as defined by ISO 4217.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -27,11 +39,12 @@ class Currency extends PPModel
|
||||
return $this->currency;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* amount upto 2 decimals represented as string
|
||||
* amount up to N digit after the decimals separator as defined in ISO 4217 for the appropriate currency code.
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setValue($value)
|
||||
{
|
||||
@@ -40,7 +53,7 @@ class Currency extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* amount upto 2 decimals represented as string
|
||||
* amount up to N digit after the decimals separator as defined in ISO 4217 for the appropriate currency code.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -49,5 +62,4 @@ class Currency extends PPModel
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace PayPal\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Rest\ApiContext;
|
||||
|
||||
/**
|
||||
* Class ExtendedBankAccount
|
||||
@@ -18,7 +17,6 @@ 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
|
||||
*
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace PayPal\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Rest\ApiContext;
|
||||
|
||||
/**
|
||||
* Class FundingInstrument
|
||||
@@ -24,7 +23,6 @@ class FundingInstrument extends PPModel
|
||||
{
|
||||
/**
|
||||
* Credit Card information.
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\CreditCard $credit_card
|
||||
*
|
||||
@@ -73,7 +71,6 @@ class FundingInstrument extends PPModel
|
||||
|
||||
/**
|
||||
* Credit Card information.
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\CreditCardToken $credit_card_token
|
||||
*
|
||||
@@ -122,7 +119,6 @@ class FundingInstrument extends PPModel
|
||||
|
||||
/**
|
||||
* Payment Card information.
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\PaymentCard $payment_card
|
||||
*
|
||||
@@ -171,7 +167,6 @@ class FundingInstrument extends PPModel
|
||||
|
||||
/**
|
||||
* Payment card token information.
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\PaymentCardToken $payment_card_token
|
||||
*
|
||||
@@ -220,7 +215,6 @@ class FundingInstrument extends PPModel
|
||||
|
||||
/**
|
||||
* Bank Account information.
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\ExtendedBankAccount $bank_account
|
||||
*
|
||||
@@ -269,7 +263,6 @@ class FundingInstrument extends PPModel
|
||||
|
||||
/**
|
||||
* Bank Account information.
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\BankToken $bank_account_token
|
||||
*
|
||||
@@ -318,7 +311,6 @@ class FundingInstrument extends PPModel
|
||||
|
||||
/**
|
||||
* Credit funding information.
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\Credit $credit
|
||||
*
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace PayPal\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Rest\ApiContext;
|
||||
|
||||
/**
|
||||
* Class HyperSchema
|
||||
@@ -12,7 +11,7 @@ use PayPal\Rest\ApiContext;
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
* @property \PayPal\Api\Links links
|
||||
* @property \PayPal\Api\Links[] links
|
||||
* @property string fragmentResolution
|
||||
* @property bool readonly
|
||||
* @property string contentEncoding
|
||||
@@ -23,9 +22,8 @@ class HyperSchema extends PPModel
|
||||
{
|
||||
/**
|
||||
* Sets Links
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\Links $links
|
||||
* @param \PayPal\Api\Links[] $links
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
@@ -45,9 +43,38 @@ class HyperSchema extends PPModel
|
||||
return $this->links;
|
||||
}
|
||||
|
||||
/**
|
||||
* Append Links to the list.
|
||||
*
|
||||
* @param \PayPal\Api\Links $links
|
||||
* @return $this
|
||||
*/
|
||||
public function addLink($links)
|
||||
{
|
||||
if (!$this->getLinks()) {
|
||||
return $this->setLinks(array($links));
|
||||
} else {
|
||||
return $this->setLinks(
|
||||
array_merge($this->getLinks(), array($links))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove Links from the list.
|
||||
*
|
||||
* @param \PayPal\Api\Links $links
|
||||
* @return $this
|
||||
*/
|
||||
public function removeLink($links)
|
||||
{
|
||||
return $this->setLinks(
|
||||
array_diff($this->getLinks(), array($links))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets FragmentResolution
|
||||
*
|
||||
*
|
||||
* @param string $fragmentResolution
|
||||
*
|
||||
@@ -71,7 +98,6 @@ class HyperSchema extends PPModel
|
||||
|
||||
/**
|
||||
* Sets Readonly
|
||||
*
|
||||
*
|
||||
* @param bool $readonly
|
||||
*
|
||||
@@ -95,7 +121,6 @@ class HyperSchema extends PPModel
|
||||
|
||||
/**
|
||||
* Sets ContentEncoding
|
||||
*
|
||||
*
|
||||
* @param string $contentEncoding
|
||||
*
|
||||
@@ -119,7 +144,6 @@ class HyperSchema extends PPModel
|
||||
|
||||
/**
|
||||
* Sets PathStart
|
||||
*
|
||||
*
|
||||
* @param string $pathStart
|
||||
*
|
||||
@@ -143,7 +167,6 @@ class HyperSchema extends PPModel
|
||||
|
||||
/**
|
||||
* Sets MediaType
|
||||
*
|
||||
*
|
||||
* @param string $mediaType
|
||||
*
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace PayPal\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Rest\ApiContext;
|
||||
|
||||
/**
|
||||
* Class Links
|
||||
@@ -23,7 +22,6 @@ class Links extends PPModel
|
||||
{
|
||||
/**
|
||||
* Sets Href
|
||||
*
|
||||
*
|
||||
* @param string $href
|
||||
*
|
||||
@@ -47,7 +45,6 @@ class Links extends PPModel
|
||||
|
||||
/**
|
||||
* Sets Rel
|
||||
*
|
||||
*
|
||||
* @param string $rel
|
||||
*
|
||||
@@ -71,7 +68,6 @@ class Links extends PPModel
|
||||
|
||||
/**
|
||||
* Sets TargetSchema
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\HyperSchema $targetSchema
|
||||
*
|
||||
@@ -95,7 +91,6 @@ class Links extends PPModel
|
||||
|
||||
/**
|
||||
* Sets Method
|
||||
*
|
||||
*
|
||||
* @param string $method
|
||||
*
|
||||
@@ -119,7 +114,6 @@ class Links extends PPModel
|
||||
|
||||
/**
|
||||
* Sets Enctype
|
||||
*
|
||||
*
|
||||
* @param string $enctype
|
||||
*
|
||||
@@ -143,7 +137,6 @@ class Links extends PPModel
|
||||
|
||||
/**
|
||||
* Sets Schema
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\HyperSchema $schema
|
||||
*
|
||||
|
||||
486
lib/PayPal/Api/MerchantPreferences.php
Normal file
486
lib/PayPal/Api/MerchantPreferences.php
Normal file
@@ -0,0 +1,486 @@
|
||||
<?php
|
||||
|
||||
namespace PayPal\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Validation\UrlValidator;
|
||||
|
||||
/**
|
||||
* Class MerchantPreferences
|
||||
*
|
||||
* Resource representing merchant preferences like max failed attempts, set up fee and others for a plan.
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
* @property string id
|
||||
* @property \PayPal\Api\Currency setup_fee
|
||||
* @property string cancel_url
|
||||
* @property string return_url
|
||||
* @property string notify_url
|
||||
* @property string max_fail_attempts
|
||||
* @property string auto_bill_amount
|
||||
* @property string initial_fail_amount_action
|
||||
* @property string accepted_payment_type
|
||||
* @property string char_set
|
||||
*/
|
||||
class MerchantPreferences extends PPModel
|
||||
{
|
||||
/**
|
||||
* Identifier of the merchant_preferences. 128 characters max.
|
||||
*
|
||||
* @param string $id
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setId($id)
|
||||
{
|
||||
$this->id = $id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Identifier of the merchant_preferences. 128 characters max.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup fee amount. Default is 0.
|
||||
*
|
||||
* @param \PayPal\Api\Currency $setup_fee
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setSetupFee($setup_fee)
|
||||
{
|
||||
$this->setup_fee = $setup_fee;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup fee amount. Default is 0.
|
||||
*
|
||||
* @return \PayPal\Api\Currency
|
||||
*/
|
||||
public function getSetupFee()
|
||||
{
|
||||
return $this->setup_fee;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup fee amount. Default is 0.
|
||||
*
|
||||
* @deprecated Instead use setSetupFee
|
||||
*
|
||||
* @param \PayPal\Api\Currency $setup_fee
|
||||
* @return $this
|
||||
*/
|
||||
public function setSetup_fee($setup_fee)
|
||||
{
|
||||
$this->setup_fee = $setup_fee;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup fee amount. Default is 0.
|
||||
* @deprecated Instead use getSetupFee
|
||||
*
|
||||
* @return \PayPal\Api\Currency
|
||||
*/
|
||||
public function getSetup_fee()
|
||||
{
|
||||
return $this->setup_fee;
|
||||
}
|
||||
|
||||
/**
|
||||
* Redirect URL on cancellation of agreement request. 1000 characters max.
|
||||
*
|
||||
* @param string $cancel_url
|
||||
* @throws \InvalidArgumentException
|
||||
* @return $this
|
||||
*/
|
||||
public function setCancelUrl($cancel_url)
|
||||
{
|
||||
UrlValidator::validate($cancel_url, "CancelUrl");
|
||||
$this->cancel_url = $cancel_url;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Redirect URL on cancellation of agreement request. 1000 characters max.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCancelUrl()
|
||||
{
|
||||
return $this->cancel_url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Redirect URL on cancellation of agreement request. 1000 characters max.
|
||||
*
|
||||
* @deprecated Instead use setCancelUrl
|
||||
*
|
||||
* @param string $cancel_url
|
||||
* @return $this
|
||||
*/
|
||||
public function setCancel_url($cancel_url)
|
||||
{
|
||||
$this->cancel_url = $cancel_url;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Redirect URL on cancellation of agreement request. 1000 characters max.
|
||||
* @deprecated Instead use getCancelUrl
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCancel_url()
|
||||
{
|
||||
return $this->cancel_url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Redirect URL on creation of agreement request. 1000 characters max.
|
||||
*
|
||||
* @param string $return_url
|
||||
* @throws \InvalidArgumentException
|
||||
* @return $this
|
||||
*/
|
||||
public function setReturnUrl($return_url)
|
||||
{
|
||||
UrlValidator::validate($return_url, "ReturnUrl");
|
||||
$this->return_url = $return_url;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Redirect URL on creation of agreement request. 1000 characters max.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getReturnUrl()
|
||||
{
|
||||
return $this->return_url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Redirect URL on creation of agreement request. 1000 characters max.
|
||||
*
|
||||
* @deprecated Instead use setReturnUrl
|
||||
*
|
||||
* @param string $return_url
|
||||
* @return $this
|
||||
*/
|
||||
public function setReturn_url($return_url)
|
||||
{
|
||||
$this->return_url = $return_url;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Redirect URL on creation of agreement request. 1000 characters max.
|
||||
* @deprecated Instead use getReturnUrl
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getReturn_url()
|
||||
{
|
||||
return $this->return_url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify URL on agreement creation. 1000 characters max.
|
||||
*
|
||||
* @param string $notify_url
|
||||
* @throws \InvalidArgumentException
|
||||
* @return $this
|
||||
*/
|
||||
public function setNotifyUrl($notify_url)
|
||||
{
|
||||
UrlValidator::validate($notify_url, "NotifyUrl");
|
||||
$this->notify_url = $notify_url;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify URL on agreement creation. 1000 characters max.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getNotifyUrl()
|
||||
{
|
||||
return $this->notify_url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify URL on agreement creation. 1000 characters max.
|
||||
*
|
||||
* @deprecated Instead use setNotifyUrl
|
||||
*
|
||||
* @param string $notify_url
|
||||
* @return $this
|
||||
*/
|
||||
public function setNotify_url($notify_url)
|
||||
{
|
||||
$this->notify_url = $notify_url;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify URL on agreement creation. 1000 characters max.
|
||||
* @deprecated Instead use getNotifyUrl
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getNotify_url()
|
||||
{
|
||||
return $this->notify_url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Total number of failed attempts allowed. Default is 0, representing an infinite number of failed attempts.
|
||||
*
|
||||
* @param string $max_fail_attempts
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setMaxFailAttempts($max_fail_attempts)
|
||||
{
|
||||
$this->max_fail_attempts = $max_fail_attempts;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Total number of failed attempts allowed. Default is 0, representing an infinite number of failed attempts.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getMaxFailAttempts()
|
||||
{
|
||||
return $this->max_fail_attempts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Total number of failed attempts allowed. Default is 0, representing an infinite number of failed attempts.
|
||||
*
|
||||
* @deprecated Instead use setMaxFailAttempts
|
||||
*
|
||||
* @param string $max_fail_attempts
|
||||
* @return $this
|
||||
*/
|
||||
public function setMax_fail_attempts($max_fail_attempts)
|
||||
{
|
||||
$this->max_fail_attempts = $max_fail_attempts;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Total number of failed attempts allowed. Default is 0, representing an infinite number of failed attempts.
|
||||
* @deprecated Instead use getMaxFailAttempts
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getMax_fail_attempts()
|
||||
{
|
||||
return $this->max_fail_attempts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allow auto billing for the outstanding amount of the agreement in the next cycle. Allowed values: `YES`, `NO`. Default is `NO`.
|
||||
*
|
||||
* @param string $auto_bill_amount
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setAutoBillAmount($auto_bill_amount)
|
||||
{
|
||||
$this->auto_bill_amount = $auto_bill_amount;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allow auto billing for the outstanding amount of the agreement in the next cycle. Allowed values: `YES`, `NO`. Default is `NO`.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAutoBillAmount()
|
||||
{
|
||||
return $this->auto_bill_amount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allow auto billing for the outstanding amount of the agreement in the next cycle. Allowed values: `YES`, `NO`. Default is `NO`.
|
||||
*
|
||||
* @deprecated Instead use setAutoBillAmount
|
||||
*
|
||||
* @param string $auto_bill_amount
|
||||
* @return $this
|
||||
*/
|
||||
public function setAuto_bill_amount($auto_bill_amount)
|
||||
{
|
||||
$this->auto_bill_amount = $auto_bill_amount;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allow auto billing for the outstanding amount of the agreement in the next cycle. Allowed values: `YES`, `NO`. Default is `NO`.
|
||||
* @deprecated Instead use getAutoBillAmount
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAuto_bill_amount()
|
||||
{
|
||||
return $this->auto_bill_amount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Action to take if a failure occurs during initial payment. Allowed values: `CONTINUE`, `CANCEL`. Default is continue.
|
||||
*
|
||||
* @param string $initial_fail_amount_action
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setInitialFailAmountAction($initial_fail_amount_action)
|
||||
{
|
||||
$this->initial_fail_amount_action = $initial_fail_amount_action;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Action to take if a failure occurs during initial payment. Allowed values: `CONTINUE`, `CANCEL`. Default is continue.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getInitialFailAmountAction()
|
||||
{
|
||||
return $this->initial_fail_amount_action;
|
||||
}
|
||||
|
||||
/**
|
||||
* Action to take if a failure occurs during initial payment. Allowed values: `CONTINUE`, `CANCEL`. Default is continue.
|
||||
*
|
||||
* @deprecated Instead use setInitialFailAmountAction
|
||||
*
|
||||
* @param string $initial_fail_amount_action
|
||||
* @return $this
|
||||
*/
|
||||
public function setInitial_fail_amount_action($initial_fail_amount_action)
|
||||
{
|
||||
$this->initial_fail_amount_action = $initial_fail_amount_action;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Action to take if a failure occurs during initial payment. Allowed values: `CONTINUE`, `CANCEL`. Default is continue.
|
||||
* @deprecated Instead use getInitialFailAmountAction
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getInitial_fail_amount_action()
|
||||
{
|
||||
return $this->initial_fail_amount_action;
|
||||
}
|
||||
|
||||
/**
|
||||
* Payment types that are accepted for this plan.
|
||||
*
|
||||
* @param string $accepted_payment_type
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setAcceptedPaymentType($accepted_payment_type)
|
||||
{
|
||||
$this->accepted_payment_type = $accepted_payment_type;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Payment types that are accepted for this plan.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAcceptedPaymentType()
|
||||
{
|
||||
return $this->accepted_payment_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Payment types that are accepted for this plan.
|
||||
*
|
||||
* @deprecated Instead use setAcceptedPaymentType
|
||||
*
|
||||
* @param string $accepted_payment_type
|
||||
* @return $this
|
||||
*/
|
||||
public function setAccepted_payment_type($accepted_payment_type)
|
||||
{
|
||||
$this->accepted_payment_type = $accepted_payment_type;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Payment types that are accepted for this plan.
|
||||
* @deprecated Instead use getAcceptedPaymentType
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAccepted_payment_type()
|
||||
{
|
||||
return $this->accepted_payment_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* char_set for this plan.
|
||||
*
|
||||
* @param string $char_set
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setCharSet($char_set)
|
||||
{
|
||||
$this->char_set = $char_set;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* char_set for this plan.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCharSet()
|
||||
{
|
||||
return $this->char_set;
|
||||
}
|
||||
|
||||
/**
|
||||
* char_set for this plan.
|
||||
*
|
||||
* @deprecated Instead use setCharSet
|
||||
*
|
||||
* @param string $char_set
|
||||
* @return $this
|
||||
*/
|
||||
public function setChar_set($char_set)
|
||||
{
|
||||
$this->char_set = $char_set;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* char_set for this plan.
|
||||
* @deprecated Instead use getCharSet
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getChar_set()
|
||||
{
|
||||
return $this->char_set;
|
||||
}
|
||||
|
||||
}
|
||||
90
lib/PayPal/Api/OverrideChargeModel.php
Normal file
90
lib/PayPal/Api/OverrideChargeModel.php
Normal file
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
|
||||
namespace PayPal\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
|
||||
/**
|
||||
* Class OverrideChargeModel
|
||||
*
|
||||
* A resource representing an override_charge_model to be used during creation of the agreement.
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
* @property string charge_id
|
||||
* @property \PayPal\Api\Currency amount
|
||||
*/
|
||||
class OverrideChargeModel extends PPModel
|
||||
{
|
||||
/**
|
||||
* ID of charge model.
|
||||
*
|
||||
* @param string $charge_id
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setChargeId($charge_id)
|
||||
{
|
||||
$this->charge_id = $charge_id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* ID of charge model.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getChargeId()
|
||||
{
|
||||
return $this->charge_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* ID of charge model.
|
||||
*
|
||||
* @deprecated Instead use setChargeId
|
||||
*
|
||||
* @param string $charge_id
|
||||
* @return $this
|
||||
*/
|
||||
public function setCharge_id($charge_id)
|
||||
{
|
||||
$this->charge_id = $charge_id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* ID of charge model.
|
||||
* @deprecated Instead use getChargeId
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCharge_id()
|
||||
{
|
||||
return $this->charge_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updated Amount to be associated with this charge model.
|
||||
*
|
||||
* @param \PayPal\Api\Currency $amount
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setAmount($amount)
|
||||
{
|
||||
$this->amount = $amount;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updated Amount to be associated with this charge model.
|
||||
*
|
||||
* @return \PayPal\Api\Currency
|
||||
*/
|
||||
public function getAmount()
|
||||
{
|
||||
return $this->amount;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -20,7 +20,7 @@ class Patch extends PPModel
|
||||
{
|
||||
/**
|
||||
* The operation to perform.
|
||||
* Valid Values: ["add", "remove", "replace", "move", "copy", "test"]
|
||||
* Valid Values: ["add", "remove", "replace", "move", "copy", "test"]
|
||||
*
|
||||
* @param string $op
|
||||
*
|
||||
@@ -44,7 +44,6 @@ class Patch extends PPModel
|
||||
|
||||
/**
|
||||
* String containing a JSON-Pointer value that references a location within the target document where the operation is performed.
|
||||
*
|
||||
*
|
||||
* @param string $path
|
||||
*
|
||||
@@ -68,7 +67,6 @@ class Patch extends PPModel
|
||||
|
||||
/**
|
||||
* New value to apply based on the operation. op=remove does not require value.
|
||||
*
|
||||
*
|
||||
* @param mixed $value
|
||||
*
|
||||
@@ -92,7 +90,6 @@ class Patch extends PPModel
|
||||
|
||||
/**
|
||||
* A string containing a JSON Pointer value that references the location in the target document from which to move the value. Required for use where op=move.
|
||||
*
|
||||
*
|
||||
* @param string $from
|
||||
*
|
||||
|
||||
86
lib/PayPal/Api/PatchRequest.php
Normal file
86
lib/PayPal/Api/PatchRequest.php
Normal file
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
namespace PayPal\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
|
||||
/**
|
||||
* Class PatchRequest
|
||||
*
|
||||
* Request object used for a JSON Patch.
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
* @property \PayPal\Api\Patch[] patches
|
||||
*/
|
||||
class PatchRequest extends PPModel
|
||||
{
|
||||
/**
|
||||
* Placeholder for holding array of patch objects
|
||||
*
|
||||
* @param \PayPal\Api\Patch[] $patches
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setPatches($patches)
|
||||
{
|
||||
$this->patches = $patches;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Placeholder for holding array of patch objects
|
||||
*
|
||||
* @return \PayPal\Api\Patch[]
|
||||
*/
|
||||
public function getPatches()
|
||||
{
|
||||
return $this->patches;
|
||||
}
|
||||
|
||||
/**
|
||||
* Append Patches to the list.
|
||||
*
|
||||
* @param \PayPal\Api\Patch $patch
|
||||
* @return $this
|
||||
*/
|
||||
public function addPatch($patch)
|
||||
{
|
||||
if (!$this->getPatches()) {
|
||||
return $this->setPatches(array($patch));
|
||||
} else {
|
||||
return $this->setPatches(
|
||||
array_merge($this->getPatches(), array($patch))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove Patches from the list.
|
||||
*
|
||||
* @param \PayPal\Api\Patch $patch
|
||||
* @return $this
|
||||
*/
|
||||
public function removePatch($patch)
|
||||
{
|
||||
return $this->setPatches(
|
||||
array_diff($this->getPatches(), array($patch))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* As PatchRequest holds the array of Patch object, we would override the json conversion to return
|
||||
* a json representation of array of Patch objects.
|
||||
*
|
||||
* @param int $options
|
||||
* @return mixed|string
|
||||
*/
|
||||
public function toJSON($options = 0)
|
||||
{
|
||||
$json = array();
|
||||
foreach ($this->getPatches() as $patch) {
|
||||
$json[] = $patch->toArray();
|
||||
}
|
||||
return json_encode($json, $options);
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace PayPal\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Rest\ApiContext;
|
||||
|
||||
/**
|
||||
* Class Payer
|
||||
@@ -14,15 +13,15 @@ use PayPal\Rest\ApiContext;
|
||||
*
|
||||
* @property string payment_method
|
||||
* @property string status
|
||||
* @property \PayPal\Api\FundingInstrument funding_instruments
|
||||
* @property \PayPal\Api\FundingInstrument[] funding_instruments
|
||||
* @property string funding_option_id
|
||||
* @property \PayPal\Api\PayerInfo payer_info
|
||||
*/
|
||||
class Payer extends PPModel
|
||||
{
|
||||
/**
|
||||
* Payment method being used - PayPal Wallet payment, Bank Direct Debit or Direct Credit card.
|
||||
* Valid Values: ["credit_card", "bank", "paypal"]
|
||||
* Payment method being used - PayPal Wallet payment, Bank Direct Debit, or Direct Credit card.
|
||||
* Valid Values: ["credit_card", "bank", "paypal"]
|
||||
*
|
||||
* @param string $payment_method
|
||||
*
|
||||
@@ -35,7 +34,7 @@ class Payer extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Payment method being used - PayPal Wallet payment, Bank Direct Debit or Direct Credit card.
|
||||
* Payment method being used - PayPal Wallet payment, Bank Direct Debit, or Direct Credit card.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -45,7 +44,7 @@ class Payer extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Payment method being used - PayPal Wallet payment, Bank Direct Debit or Direct Credit card.
|
||||
* Payment method being used - PayPal Wallet payment, Bank Direct Debit, or Direct Credit card.
|
||||
*
|
||||
* @deprecated Instead use setPaymentMethod
|
||||
*
|
||||
@@ -59,7 +58,7 @@ class Payer extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Payment method being used - PayPal Wallet payment, Bank Direct Debit or Direct Credit card.
|
||||
* Payment method being used - PayPal Wallet payment, Bank Direct Debit, or Direct Credit card.
|
||||
* @deprecated Instead use getPaymentMethod
|
||||
*
|
||||
* @return string
|
||||
@@ -71,7 +70,7 @@ class Payer extends PPModel
|
||||
|
||||
/**
|
||||
* Status of Payer PayPal Account.
|
||||
* Valid Values: ["VERIFIED", "UNVERIFIED"]
|
||||
* Valid Values: ["VERIFIED", "UNVERIFIED"]
|
||||
*
|
||||
* @param string $status
|
||||
*
|
||||
@@ -94,10 +93,9 @@ class Payer extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* List of funding instruments from where the funds of the current payment come from. Typically a credit card.
|
||||
*
|
||||
* List of funding instruments from which the funds of the current payment come. Typically a credit card.
|
||||
*
|
||||
* @param \PayPal\Api\FundingInstrument $funding_instruments
|
||||
* @param \PayPal\Api\FundingInstrument[] $funding_instruments
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
@@ -108,7 +106,7 @@ class Payer extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* List of funding instruments from where the funds of the current payment come from. Typically a credit card.
|
||||
* List of funding instruments from which the funds of the current payment come. Typically a credit card.
|
||||
*
|
||||
* @return \PayPal\Api\FundingInstrument[]
|
||||
*/
|
||||
@@ -118,7 +116,37 @@ class Payer extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* List of funding instruments from where the funds of the current payment come from. Typically a credit card.
|
||||
* Append FundingInstruments to the list.
|
||||
*
|
||||
* @param \PayPal\Api\FundingInstrument $fundingInstrument
|
||||
* @return $this
|
||||
*/
|
||||
public function addFundingInstrument($fundingInstrument)
|
||||
{
|
||||
if (!$this->getFundingInstruments()) {
|
||||
return $this->setFundingInstruments(array($fundingInstrument));
|
||||
} else {
|
||||
return $this->setFundingInstruments(
|
||||
array_merge($this->getFundingInstruments(), array($fundingInstrument))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove FundingInstruments from the list.
|
||||
*
|
||||
* @param \PayPal\Api\FundingInstrument $fundingInstrument
|
||||
* @return $this
|
||||
*/
|
||||
public function removeFundingInstrument($fundingInstrument)
|
||||
{
|
||||
return $this->setFundingInstruments(
|
||||
array_diff($this->getFundingInstruments(), array($fundingInstrument))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* List of funding instruments from which the funds of the current payment come. Typically a credit card.
|
||||
*
|
||||
* @deprecated Instead use setFundingInstruments
|
||||
*
|
||||
@@ -132,7 +160,7 @@ class Payer extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* List of funding instruments from where the funds of the current payment come from. Typically a credit card.
|
||||
* List of funding instruments from which the funds of the current payment come. Typically a credit card.
|
||||
* @deprecated Instead use getFundingInstruments
|
||||
*
|
||||
* @return \PayPal\Api\FundingInstrument
|
||||
@@ -143,8 +171,7 @@ class Payer extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Id of user selected funding option for the payment. 'OneOf' funding_instruments or funding_option_id to be present
|
||||
*
|
||||
* Id of user selected funding option for the payment. 'OneOf' funding_instruments or funding_option_id to be present.
|
||||
*
|
||||
* @param string $funding_option_id
|
||||
*
|
||||
@@ -157,7 +184,7 @@ class Payer extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Id of user selected funding option for the payment. 'OneOf' funding_instruments or funding_option_id to be present
|
||||
* Id of user selected funding option for the payment. 'OneOf' funding_instruments or funding_option_id to be present.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -167,7 +194,7 @@ class Payer extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Id of user selected funding option for the payment. 'OneOf' funding_instruments or funding_option_id to be present
|
||||
* Id of user selected funding option for the payment. 'OneOf' funding_instruments or funding_option_id to be present.
|
||||
*
|
||||
* @deprecated Instead use setFundingOptionId
|
||||
*
|
||||
@@ -181,7 +208,7 @@ class Payer extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Id of user selected funding option for the payment. 'OneOf' funding_instruments or funding_option_id to be present
|
||||
* 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
|
||||
@@ -193,7 +220,6 @@ class Payer extends PPModel
|
||||
|
||||
/**
|
||||
* Information related to the Payer.
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\PayerInfo $payer_info
|
||||
*
|
||||
|
||||
@@ -3,12 +3,11 @@
|
||||
namespace PayPal\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Rest\ApiContext;
|
||||
|
||||
/**
|
||||
* Class PayerInfo
|
||||
*
|
||||
* A resource representing a information about Payer.
|
||||
* A resource representing information about a Payer.
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
@@ -30,7 +29,6 @@ class PayerInfo extends PPModel
|
||||
{
|
||||
/**
|
||||
* Email address representing the Payer.
|
||||
*
|
||||
*
|
||||
* @param string $email
|
||||
*
|
||||
@@ -54,7 +52,6 @@ class PayerInfo extends PPModel
|
||||
|
||||
/**
|
||||
* External Remember Me id representing the Payer
|
||||
*
|
||||
*
|
||||
* @param string $external_remember_me_id
|
||||
*
|
||||
@@ -103,7 +100,6 @@ class PayerInfo extends PPModel
|
||||
|
||||
/**
|
||||
* Account Number representing the Payer
|
||||
*
|
||||
*
|
||||
* @param string $buyer_account_number
|
||||
*
|
||||
@@ -152,7 +148,6 @@ class PayerInfo extends PPModel
|
||||
|
||||
/**
|
||||
* First Name of the Payer.
|
||||
*
|
||||
*
|
||||
* @param string $first_name
|
||||
*
|
||||
@@ -201,7 +196,6 @@ class PayerInfo extends PPModel
|
||||
|
||||
/**
|
||||
* Last Name of the Payer.
|
||||
*
|
||||
*
|
||||
* @param string $last_name
|
||||
*
|
||||
@@ -250,7 +244,6 @@ class PayerInfo extends PPModel
|
||||
|
||||
/**
|
||||
* PayPal assigned Payer ID.
|
||||
*
|
||||
*
|
||||
* @param string $payer_id
|
||||
*
|
||||
@@ -299,7 +292,6 @@ class PayerInfo extends PPModel
|
||||
|
||||
/**
|
||||
* Phone number representing the Payer.
|
||||
*
|
||||
*
|
||||
* @param string $phone
|
||||
*
|
||||
@@ -323,7 +315,7 @@ class PayerInfo extends PPModel
|
||||
|
||||
/**
|
||||
* Phone type
|
||||
* Valid Values: ["HOME", "WORK", "MOBILE", "OTHER"]
|
||||
* Valid Values: ["HOME", "WORK", "MOBILE", "OTHER"]
|
||||
*
|
||||
* @param string $phone_type
|
||||
*
|
||||
@@ -372,7 +364,6 @@ class PayerInfo extends PPModel
|
||||
|
||||
/**
|
||||
* Birth date of the Payer in ISO8601 format (YYYY-MM-DD).
|
||||
*
|
||||
*
|
||||
* @param string $birth_date
|
||||
*
|
||||
@@ -421,7 +412,6 @@ class PayerInfo extends PPModel
|
||||
|
||||
/**
|
||||
* Payer's tax ID.
|
||||
*
|
||||
*
|
||||
* @param string $tax_id
|
||||
*
|
||||
@@ -470,7 +460,7 @@ class PayerInfo extends PPModel
|
||||
|
||||
/**
|
||||
* Payer's tax ID type.
|
||||
* Valid Values: ["BR_CPF", "BR_CNPJ"]
|
||||
* Valid Values: ["BR_CPF", "BR_CNPJ"]
|
||||
*
|
||||
* @param string $tax_id_type
|
||||
*
|
||||
@@ -519,7 +509,6 @@ class PayerInfo extends PPModel
|
||||
|
||||
/**
|
||||
* Billing address of the Payer.
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\Address $billing_address
|
||||
*
|
||||
@@ -568,7 +557,6 @@ class PayerInfo extends PPModel
|
||||
|
||||
/**
|
||||
* Obsolete. Use shipping address present in purchase unit.
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\ShippingAddress $shipping_address
|
||||
*
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace PayPal\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Common\ResourceModel;
|
||||
use PayPal\Rest\ApiContext;
|
||||
use PayPal\Rest\IResource;
|
||||
use PayPal\Api\PaymentHistory;
|
||||
@@ -28,7 +29,7 @@ use PayPal\Validation\ArgumentValidator;
|
||||
* @property \PayPal\Api\Links links
|
||||
* @property string experience_profile_id
|
||||
*/
|
||||
class Payment extends PPModel implements IResource
|
||||
class Payment extends ResourceModel
|
||||
{
|
||||
/**
|
||||
* OAuth Credentials to use for this call
|
||||
@@ -392,17 +393,21 @@ class Payment extends PPModel implements IResource
|
||||
* Creates (and processes) a new Payment Resource.
|
||||
*
|
||||
* @param \PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
||||
* @param PPRestCall $restCall is the Rest Call Service that is used to make rest calls
|
||||
* @return Payment
|
||||
*/
|
||||
public function create($apiContext = null)
|
||||
public function create($apiContext = null, $restCall = null)
|
||||
{
|
||||
|
||||
$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);
|
||||
$json = self::executeCall(
|
||||
"/v1/payments/payment",
|
||||
"POST",
|
||||
$payLoad,
|
||||
null,
|
||||
$apiContext,
|
||||
$restCall
|
||||
);
|
||||
$this->fromJson($json);
|
||||
return $this;
|
||||
}
|
||||
@@ -412,18 +417,22 @@ class Payment extends PPModel implements IResource
|
||||
*
|
||||
* @param string $paymentId
|
||||
* @param \PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
||||
* @param PPRestCall $restCall is the Rest Call Service that is used to make rest calls
|
||||
* @return Payment
|
||||
*/
|
||||
public static function get($paymentId, $apiContext = null)
|
||||
public static function get($paymentId, $apiContext = null, $restCall = null)
|
||||
{
|
||||
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);
|
||||
$json = self::executeCall(
|
||||
"/v1/payments/payment/$paymentId",
|
||||
"GET",
|
||||
$payLoad,
|
||||
null,
|
||||
$apiContext,
|
||||
$restCall
|
||||
);
|
||||
$ret = new Payment();
|
||||
$ret->fromJson($json);
|
||||
return $ret;
|
||||
@@ -434,19 +443,23 @@ class Payment extends PPModel implements IResource
|
||||
*
|
||||
* @param PaymentExecution $paymentExecution
|
||||
* @param \PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
||||
* @param PPRestCall $restCall is the Rest Call Service that is used to make rest calls
|
||||
* @return Payment
|
||||
*/
|
||||
public function execute($paymentExecution, $apiContext = null)
|
||||
public function execute($paymentExecution, $apiContext = null, $restCall = null)
|
||||
{
|
||||
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);
|
||||
$json = self::executeCall(
|
||||
"/v1/payments/payment/{$this->getId()}/execute",
|
||||
"POST",
|
||||
$payLoad,
|
||||
null,
|
||||
$apiContext,
|
||||
$restCall
|
||||
);
|
||||
$this->fromJson($json);
|
||||
return $this;
|
||||
}
|
||||
@@ -456,9 +469,10 @@ class Payment extends PPModel implements IResource
|
||||
*
|
||||
* @param array $params
|
||||
* @param \PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
||||
* @param PPRestCall $restCall is the Rest Call Service that is used to make rest calls
|
||||
* @return PaymentHistory
|
||||
*/
|
||||
public static function all($params, $apiContext = null)
|
||||
public static function all($params, $apiContext = null, $restCall = null)
|
||||
{
|
||||
ArgumentValidator::validate($params, 'params');
|
||||
|
||||
@@ -473,11 +487,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);
|
||||
$json = self::executeCall(
|
||||
"/v1/payments/payment?" . http_build_query(array_intersect_key($params, $allowedParams)),
|
||||
"GET",
|
||||
$payLoad,
|
||||
null,
|
||||
$apiContext,
|
||||
$restCall
|
||||
);
|
||||
$ret = new PaymentHistory();
|
||||
$ret->fromJson($json);
|
||||
return $ret;
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace PayPal\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Rest\ApiContext;
|
||||
|
||||
/**
|
||||
* Class PaymentCard
|
||||
@@ -26,13 +25,12 @@ use PayPal\Rest\ApiContext;
|
||||
* @property string external_customer_id
|
||||
* @property string status
|
||||
* @property string valid_until
|
||||
* @property \PayPal\Api\Links links
|
||||
* @property \PayPal\Api\Links[] links
|
||||
*/
|
||||
class PaymentCard extends PPModel
|
||||
{
|
||||
/**
|
||||
* ID of the credit card being saved for later use.
|
||||
*
|
||||
*
|
||||
* @param string $id
|
||||
*
|
||||
@@ -56,7 +54,6 @@ class PaymentCard extends PPModel
|
||||
|
||||
/**
|
||||
* Card number.
|
||||
*
|
||||
*
|
||||
* @param string $number
|
||||
*
|
||||
@@ -80,7 +77,7 @@ class PaymentCard extends PPModel
|
||||
|
||||
/**
|
||||
* 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"]
|
||||
* Valid Values: ["VISA", "AMEX", "SOLO", "JCB", "STAR", "DELTA", "DISCOVER", "SWITCH", "MAESTRO", "CB_NATIONALE", "CONFINOGA", "COFIDIS", "ELECTRON", "CETELEM", "CHINA_UNION_PAY", "MASTERCARD"]
|
||||
*
|
||||
* @param string $type
|
||||
*
|
||||
@@ -104,7 +101,6 @@ class PaymentCard extends PPModel
|
||||
|
||||
/**
|
||||
* 2 digit card expiry month.
|
||||
*
|
||||
*
|
||||
* @param int $expire_month
|
||||
*
|
||||
@@ -152,8 +148,7 @@ class PaymentCard extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* 4 digit card expiry year
|
||||
*
|
||||
* 4 digit card expiry year.
|
||||
*
|
||||
* @param int $expire_year
|
||||
*
|
||||
@@ -166,7 +161,7 @@ class PaymentCard extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* 4 digit card expiry year
|
||||
* 4 digit card expiry year.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
@@ -176,7 +171,7 @@ class PaymentCard extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* 4 digit card expiry year
|
||||
* 4 digit card expiry year.
|
||||
*
|
||||
* @deprecated Instead use setExpireYear
|
||||
*
|
||||
@@ -190,7 +185,7 @@ class PaymentCard extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* 4 digit card expiry year
|
||||
* 4 digit card expiry year.
|
||||
* @deprecated Instead use getExpireYear
|
||||
*
|
||||
* @return int
|
||||
@@ -202,7 +197,6 @@ class PaymentCard extends PPModel
|
||||
|
||||
/**
|
||||
* 2 digit card start month.
|
||||
*
|
||||
*
|
||||
* @param int $start_month
|
||||
*
|
||||
@@ -251,7 +245,6 @@ class PaymentCard extends PPModel
|
||||
|
||||
/**
|
||||
* 4 digit card start year.
|
||||
*
|
||||
*
|
||||
* @param int $start_year
|
||||
*
|
||||
@@ -299,8 +292,7 @@ class PaymentCard extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Card validation code. Only supported when making a Payment but not when saving a payment card for future use.
|
||||
*
|
||||
* Card validation code. Only supported when making a Payment, but not when saving a payment card for future use.
|
||||
*
|
||||
* @param int $cvv2
|
||||
*
|
||||
@@ -313,7 +305,7 @@ class PaymentCard extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Card validation code. Only supported when making a Payment but not when saving a payment card for future use.
|
||||
* Card validation code. Only supported when making a Payment, but not when saving a payment card for future use.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
@@ -324,7 +316,6 @@ class PaymentCard extends PPModel
|
||||
|
||||
/**
|
||||
* Card holder's first name.
|
||||
*
|
||||
*
|
||||
* @param string $first_name
|
||||
*
|
||||
@@ -373,7 +364,6 @@ class PaymentCard extends PPModel
|
||||
|
||||
/**
|
||||
* Card holder's last name.
|
||||
*
|
||||
*
|
||||
* @param string $last_name
|
||||
*
|
||||
@@ -422,7 +412,6 @@ class PaymentCard extends PPModel
|
||||
|
||||
/**
|
||||
* Billing Address associated with this card.
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\Address $billing_address
|
||||
*
|
||||
@@ -470,8 +459,7 @@ class PaymentCard extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* A unique identifier of the customer to whom this card account belongs. Generated and provided by the facilitator. This is required when creating or using a stored funding instrument in vault.
|
||||
*
|
||||
* @param string $external_customer_id
|
||||
*
|
||||
@@ -484,7 +472,7 @@ class PaymentCard extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* A unique identifier of the customer to whom this card account belongs. Generated and provided by the facilitator. This is required when creating or using a stored funding instrument in vault.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -494,7 +482,7 @@ class PaymentCard extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* A unique identifier of the customer to whom this card account belongs. Generated and provided by the facilitator. This is required when creating or using a stored funding instrument in vault.
|
||||
*
|
||||
* @deprecated Instead use setExternalCustomerId
|
||||
*
|
||||
@@ -508,7 +496,7 @@ class PaymentCard extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* A unique identifier of the customer to whom this card account belongs. 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
|
||||
@@ -520,7 +508,7 @@ class PaymentCard extends PPModel
|
||||
|
||||
/**
|
||||
* State of the funding instrument.
|
||||
* Valid Values: ["EXPIRED", "ACTIVE"]
|
||||
* Valid Values: ["EXPIRED", "ACTIVE"]
|
||||
*
|
||||
* @param string $status
|
||||
*
|
||||
@@ -543,8 +531,7 @@ class PaymentCard extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Date/Time until this resource can be used fund a payment.
|
||||
*
|
||||
* Date/Time until this resource can be used to fund a payment.
|
||||
*
|
||||
* @param string $valid_until
|
||||
*
|
||||
@@ -557,7 +544,7 @@ class PaymentCard extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Date/Time until this resource can be used fund a payment.
|
||||
* Date/Time until this resource can be used to fund a payment.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -567,7 +554,7 @@ class PaymentCard extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Date/Time until this resource can be used fund a payment.
|
||||
* Date/Time until this resource can be used to fund a payment.
|
||||
*
|
||||
* @deprecated Instead use setValidUntil
|
||||
*
|
||||
@@ -581,7 +568,7 @@ class PaymentCard extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Date/Time until this resource can be used fund a payment.
|
||||
* Date/Time until this resource can be used to fund a payment.
|
||||
* @deprecated Instead use getValidUntil
|
||||
*
|
||||
* @return string
|
||||
@@ -593,9 +580,8 @@ class PaymentCard extends PPModel
|
||||
|
||||
/**
|
||||
* Sets Links
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\Links $links
|
||||
* @param \PayPal\Api\Links[] $links
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
@@ -615,4 +601,34 @@ class PaymentCard extends PPModel
|
||||
return $this->links;
|
||||
}
|
||||
|
||||
/**
|
||||
* Append Links to the list.
|
||||
*
|
||||
* @param \PayPal\Api\Links $links
|
||||
* @return $this
|
||||
*/
|
||||
public function addLink($links)
|
||||
{
|
||||
if (!$this->getLinks()) {
|
||||
return $this->setLinks(array($links));
|
||||
} else {
|
||||
return $this->setLinks(
|
||||
array_merge($this->getLinks(), array($links))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove Links from the list.
|
||||
*
|
||||
* @param \PayPal\Api\Links $links
|
||||
* @return $this
|
||||
*/
|
||||
public function removeLink($links)
|
||||
{
|
||||
return $this->setLinks(
|
||||
array_diff($this->getLinks(), array($links))
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace PayPal\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Rest\ApiContext;
|
||||
|
||||
/**
|
||||
* Class PaymentCardToken
|
||||
@@ -23,7 +22,6 @@ class PaymentCardToken extends PPModel
|
||||
{
|
||||
/**
|
||||
* ID of a previously saved Payment Card resource.
|
||||
*
|
||||
*
|
||||
* @param string $payment_card_id
|
||||
*
|
||||
@@ -72,7 +70,6 @@ class PaymentCardToken extends PPModel
|
||||
|
||||
/**
|
||||
* The unique identifier of the payer used when saving this payment card.
|
||||
*
|
||||
*
|
||||
* @param string $external_customer_id
|
||||
*
|
||||
@@ -121,7 +118,6 @@ class PaymentCardToken extends PPModel
|
||||
|
||||
/**
|
||||
* Last 4 digits of the card number from the saved card.
|
||||
*
|
||||
*
|
||||
* @param string $last4
|
||||
*
|
||||
@@ -145,7 +141,7 @@ class PaymentCardToken extends PPModel
|
||||
|
||||
/**
|
||||
* 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"]
|
||||
* Valid Values: ["VISA", "AMEX", "SOLO", "JCB", "STAR", "DELTA", "DISCOVER", "SWITCH", "MAESTRO", "CB_NATIONALE", "CONFINOGA", "COFIDIS", "ELECTRON", "CETELEM", "CHINA_UNION_PAY", "MASTERCARD"]
|
||||
*
|
||||
* @param string $type
|
||||
*
|
||||
@@ -168,8 +164,7 @@ class PaymentCardToken extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* card expiry month from the saved card with value 1 - 12
|
||||
*
|
||||
* Expiry month from the saved card with value 1 - 12.
|
||||
*
|
||||
* @param int $expire_month
|
||||
*
|
||||
@@ -182,7 +177,7 @@ class PaymentCardToken extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* card expiry month from the saved card with value 1 - 12
|
||||
* Expiry month from the saved card with value 1 - 12.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
@@ -192,7 +187,7 @@ class PaymentCardToken extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* card expiry month from the saved card with value 1 - 12
|
||||
* Expiry month from the saved card with value 1 - 12.
|
||||
*
|
||||
* @deprecated Instead use setExpireMonth
|
||||
*
|
||||
@@ -206,7 +201,7 @@ class PaymentCardToken extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* card expiry month from the saved card with value 1 - 12
|
||||
* Expiry month from the saved card with value 1 - 12.
|
||||
* @deprecated Instead use getExpireMonth
|
||||
*
|
||||
* @return int
|
||||
@@ -217,8 +212,7 @@ class PaymentCardToken extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* 4 digit card expiry year from the saved card
|
||||
*
|
||||
* Four digit expiry year from the saved card, represented as YYYY format.
|
||||
*
|
||||
* @param int $expire_year
|
||||
*
|
||||
@@ -231,7 +225,7 @@ class PaymentCardToken extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* 4 digit card expiry year from the saved card
|
||||
* Four digit expiry year from the saved card, represented as YYYY format.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
@@ -241,7 +235,7 @@ class PaymentCardToken extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* 4 digit card expiry year from the saved card
|
||||
* Four digit expiry year from the saved card, represented as YYYY format.
|
||||
*
|
||||
* @deprecated Instead use setExpireYear
|
||||
*
|
||||
@@ -255,7 +249,7 @@ class PaymentCardToken extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* 4 digit card expiry year from the saved card
|
||||
* Four digit expiry year from the saved card, represented as YYYY format.
|
||||
* @deprecated Instead use getExpireYear
|
||||
*
|
||||
* @return int
|
||||
|
||||
289
lib/PayPal/Api/PaymentDefinition.php
Normal file
289
lib/PayPal/Api/PaymentDefinition.php
Normal file
@@ -0,0 +1,289 @@
|
||||
<?php
|
||||
|
||||
namespace PayPal\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
|
||||
/**
|
||||
* Class PaymentDefinition
|
||||
*
|
||||
* Resource representing payment definition scheduling information.
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
* @property string id
|
||||
* @property string name
|
||||
* @property string type
|
||||
* @property string frequency_interval
|
||||
* @property string frequency
|
||||
* @property string cycles
|
||||
* @property \PayPal\Api\Currency amount
|
||||
* @property \PayPal\Api\ChargeModel[] charge_models
|
||||
*/
|
||||
class PaymentDefinition extends PPModel
|
||||
{
|
||||
/**
|
||||
* Identifier of the payment_definition. 128 characters max.
|
||||
*
|
||||
* @param string $id
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setId($id)
|
||||
{
|
||||
$this->id = $id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Identifier of the payment_definition. 128 characters max.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Name of the payment definition. 128 characters max.
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Name of the payment definition. 128 characters max.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Type of the payment definition. Allowed values: `TRIAL`, `REGULAR`.
|
||||
*
|
||||
* @param string $type
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setType($type)
|
||||
{
|
||||
$this->type = $type;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Type of the payment definition. Allowed values: `TRIAL`, `REGULAR`.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
/**
|
||||
* How frequently the customer should be charged.
|
||||
*
|
||||
* @param string $frequency_interval
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setFrequencyInterval($frequency_interval)
|
||||
{
|
||||
$this->frequency_interval = $frequency_interval;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* How frequently the customer should be charged.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFrequencyInterval()
|
||||
{
|
||||
return $this->frequency_interval;
|
||||
}
|
||||
|
||||
/**
|
||||
* How frequently the customer should be charged.
|
||||
*
|
||||
* @deprecated Instead use setFrequencyInterval
|
||||
*
|
||||
* @param string $frequency_interval
|
||||
* @return $this
|
||||
*/
|
||||
public function setFrequency_interval($frequency_interval)
|
||||
{
|
||||
$this->frequency_interval = $frequency_interval;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* How frequently the customer should be charged.
|
||||
* @deprecated Instead use getFrequencyInterval
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFrequency_interval()
|
||||
{
|
||||
return $this->frequency_interval;
|
||||
}
|
||||
|
||||
/**
|
||||
* Frequency of the payment definition offered. Allowed values: `WEEK`, `DAY`, `YEAR`, `MONTH`.
|
||||
*
|
||||
* @param string $frequency
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setFrequency($frequency)
|
||||
{
|
||||
$this->frequency = $frequency;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Frequency of the payment definition offered. Allowed values: `WEEK`, `DAY`, `YEAR`, `MONTH`.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFrequency()
|
||||
{
|
||||
return $this->frequency;
|
||||
}
|
||||
|
||||
/**
|
||||
* Number of cycles in this payment definition.
|
||||
*
|
||||
* @param string $cycles
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setCycles($cycles)
|
||||
{
|
||||
$this->cycles = $cycles;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Number of cycles in this payment definition.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCycles()
|
||||
{
|
||||
return $this->cycles;
|
||||
}
|
||||
|
||||
/**
|
||||
* Amount that will be charged at the end of each cycle for this payment definition.
|
||||
*
|
||||
* @param \PayPal\Api\Currency $amount
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setAmount($amount)
|
||||
{
|
||||
$this->amount = $amount;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Amount that will be charged at the end of each cycle for this payment definition.
|
||||
*
|
||||
* @return \PayPal\Api\Currency
|
||||
*/
|
||||
public function getAmount()
|
||||
{
|
||||
return $this->amount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of charge_models for this payment definition.
|
||||
*
|
||||
* @param \PayPal\Api\ChargeModel[] $charge_models
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setChargeModels($charge_models)
|
||||
{
|
||||
$this->charge_models = $charge_models;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of charge_models for this payment definition.
|
||||
*
|
||||
* @return \PayPal\Api\ChargeModel[]
|
||||
*/
|
||||
public function getChargeModels()
|
||||
{
|
||||
return $this->charge_models;
|
||||
}
|
||||
|
||||
/**
|
||||
* Append ChargeModels to the list.
|
||||
*
|
||||
* @param \PayPal\Api\ChargeModel $chargeModel
|
||||
* @return $this
|
||||
*/
|
||||
public function addChargeModel($chargeModel)
|
||||
{
|
||||
if (!$this->getChargeModels()) {
|
||||
return $this->setChargeModels(array($chargeModel));
|
||||
} else {
|
||||
return $this->setChargeModels(
|
||||
array_merge($this->getChargeModels(), array($chargeModel))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove ChargeModels from the list.
|
||||
*
|
||||
* @param \PayPal\Api\ChargeModel $chargeModel
|
||||
* @return $this
|
||||
*/
|
||||
public function removeChargeModel($chargeModel)
|
||||
{
|
||||
return $this->setChargeModels(
|
||||
array_diff($this->getChargeModels(), array($chargeModel))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of charge_models for this payment definition.
|
||||
*
|
||||
* @deprecated Instead use setChargeModels
|
||||
*
|
||||
* @param \PayPal\Api\ChargeModel $charge_models
|
||||
* @return $this
|
||||
*/
|
||||
public function setCharge_models($charge_models)
|
||||
{
|
||||
$this->charge_models = $charge_models;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of charge_models for this payment definition.
|
||||
* @deprecated Instead use getChargeModels
|
||||
*
|
||||
* @return \PayPal\Api\ChargeModel
|
||||
*/
|
||||
public function getCharge_models()
|
||||
{
|
||||
return $this->charge_models;
|
||||
}
|
||||
|
||||
}
|
||||
577
lib/PayPal/Api/Plan.php
Normal file
577
lib/PayPal/Api/Plan.php
Normal file
@@ -0,0 +1,577 @@
|
||||
<?php
|
||||
|
||||
namespace PayPal\Api;
|
||||
|
||||
use PayPal\Common\ResourceModel;
|
||||
use PayPal\Validation\ArgumentValidator;
|
||||
use PayPal\Api\PlanList;
|
||||
use PayPal\Rest\ApiContext;
|
||||
use PayPal\Transport\PPRestCall;
|
||||
|
||||
/**
|
||||
* Class Plan
|
||||
*
|
||||
* Billing plan resource that will be used to create a billing agreement.
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
* @property string id
|
||||
* @property string name
|
||||
* @property string description
|
||||
* @property string type
|
||||
* @property string state
|
||||
* @property string create_time
|
||||
* @property string update_time
|
||||
* @property \PayPal\Api\PaymentDefinition[] payment_definitions
|
||||
* @property \PayPal\Api\Terms[] terms
|
||||
* @property \PayPal\Api\MerchantPreferences merchant_preferences
|
||||
* @property \PayPal\Api\Links[] links
|
||||
*/
|
||||
class Plan extends ResourceModel
|
||||
{
|
||||
/**
|
||||
* Identifier of the billing plan. 128 characters max.
|
||||
*
|
||||
* @param string $id
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setId($id)
|
||||
{
|
||||
$this->id = $id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Identifier of the billing plan. 128 characters max.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Name of the billing plan. 128 characters max.
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Name of the billing plan. 128 characters max.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the billing plan. 128 characters max.
|
||||
*
|
||||
* @param string $description
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setDescription($description)
|
||||
{
|
||||
$this->description = $description;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the billing plan. 128 characters max.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDescription()
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Type of the billing plan. Allowed values: `FIXED`, `INFINITE`.
|
||||
*
|
||||
* @param string $type
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setType($type)
|
||||
{
|
||||
$this->type = $type;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Type of the billing plan. Allowed values: `FIXED`, `INFINITE`.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Status of the billing plan. Allowed values: `CREATED`, `ACTIVE`, `INACTIVE`, and `DELETED`.
|
||||
*
|
||||
* @param string $state
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setState($state)
|
||||
{
|
||||
$this->state = $state;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Status of the billing plan. Allowed values: `CREATED`, `ACTIVE`, `INACTIVE`, and `DELETED`.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getState()
|
||||
{
|
||||
return $this->state;
|
||||
}
|
||||
|
||||
/**
|
||||
* Time when the billing plan was created. Format YYYY-MM-DDTimeTimezone, as defined in [ISO8601](http://tools.ietf.org/html/rfc3339#section-5.6).
|
||||
*
|
||||
* @param string $create_time
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setCreateTime($create_time)
|
||||
{
|
||||
$this->create_time = $create_time;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Time when the billing plan was created. Format YYYY-MM-DDTimeTimezone, as defined in [ISO8601](http://tools.ietf.org/html/rfc3339#section-5.6).
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCreateTime()
|
||||
{
|
||||
return $this->create_time;
|
||||
}
|
||||
|
||||
/**
|
||||
* Time when the billing plan was created. Format YYYY-MM-DDTimeTimezone, as defined in [ISO8601](http://tools.ietf.org/html/rfc3339#section-5.6).
|
||||
*
|
||||
* @deprecated Instead use setCreateTime
|
||||
*
|
||||
* @param string $create_time
|
||||
* @return $this
|
||||
*/
|
||||
public function setCreate_time($create_time)
|
||||
{
|
||||
$this->create_time = $create_time;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Time when the billing plan was created. Format YYYY-MM-DDTimeTimezone, as defined in [ISO8601](http://tools.ietf.org/html/rfc3339#section-5.6).
|
||||
* @deprecated Instead use getCreateTime
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCreate_time()
|
||||
{
|
||||
return $this->create_time;
|
||||
}
|
||||
|
||||
/**
|
||||
* Time when this billing plan was updated. Format YYYY-MM-DDTimeTimezone, as defined in [ISO8601](http://tools.ietf.org/html/rfc3339#section-5.6).
|
||||
*
|
||||
* @param string $update_time
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setUpdateTime($update_time)
|
||||
{
|
||||
$this->update_time = $update_time;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Time when this billing plan was updated. Format YYYY-MM-DDTimeTimezone, as defined in [ISO8601](http://tools.ietf.org/html/rfc3339#section-5.6).
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getUpdateTime()
|
||||
{
|
||||
return $this->update_time;
|
||||
}
|
||||
|
||||
/**
|
||||
* Time when this billing plan was updated. Format YYYY-MM-DDTimeTimezone, as defined in [ISO8601](http://tools.ietf.org/html/rfc3339#section-5.6).
|
||||
*
|
||||
* @deprecated Instead use setUpdateTime
|
||||
*
|
||||
* @param string $update_time
|
||||
* @return $this
|
||||
*/
|
||||
public function setUpdate_time($update_time)
|
||||
{
|
||||
$this->update_time = $update_time;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Time when this billing plan was updated. Format YYYY-MM-DDTimeTimezone, as defined in [ISO8601](http://tools.ietf.org/html/rfc3339#section-5.6).
|
||||
* @deprecated Instead use getUpdateTime
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getUpdate_time()
|
||||
{
|
||||
return $this->update_time;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of payment definitions for this billing plan.
|
||||
*
|
||||
* @param \PayPal\Api\PaymentDefinition[] $payment_definitions
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setPaymentDefinitions($payment_definitions)
|
||||
{
|
||||
$this->payment_definitions = $payment_definitions;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of payment definitions for this billing plan.
|
||||
*
|
||||
* @return \PayPal\Api\PaymentDefinition[]
|
||||
*/
|
||||
public function getPaymentDefinitions()
|
||||
{
|
||||
return $this->payment_definitions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Append PaymentDefinitions to the list.
|
||||
*
|
||||
* @param \PayPal\Api\PaymentDefinition $paymentDefinition
|
||||
* @return $this
|
||||
*/
|
||||
public function addPaymentDefinition($paymentDefinition)
|
||||
{
|
||||
if (!$this->getPaymentDefinitions()) {
|
||||
return $this->setPaymentDefinitions(array($paymentDefinition));
|
||||
} else {
|
||||
return $this->setPaymentDefinitions(
|
||||
array_merge($this->getPaymentDefinitions(), array($paymentDefinition))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove PaymentDefinitions from the list.
|
||||
*
|
||||
* @param \PayPal\Api\PaymentDefinition $paymentDefinition
|
||||
* @return $this
|
||||
*/
|
||||
public function removePaymentDefinition($paymentDefinition)
|
||||
{
|
||||
return $this->setPaymentDefinitions(
|
||||
array_diff($this->getPaymentDefinitions(), array($paymentDefinition))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of payment definitions for this billing plan.
|
||||
*
|
||||
* @deprecated Instead use setPaymentDefinitions
|
||||
*
|
||||
* @param \PayPal\Api\PaymentDefinition $payment_definitions
|
||||
* @return $this
|
||||
*/
|
||||
public function setPayment_definitions($payment_definitions)
|
||||
{
|
||||
$this->payment_definitions = $payment_definitions;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of payment definitions for this billing plan.
|
||||
* @deprecated Instead use getPaymentDefinitions
|
||||
*
|
||||
* @return \PayPal\Api\PaymentDefinition
|
||||
*/
|
||||
public function getPayment_definitions()
|
||||
{
|
||||
return $this->payment_definitions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of terms for this billing plan.
|
||||
*
|
||||
* @param \PayPal\Api\Terms[] $terms
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setTerms($terms)
|
||||
{
|
||||
$this->terms = $terms;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of terms for this billing plan.
|
||||
*
|
||||
* @return \PayPal\Api\Terms[]
|
||||
*/
|
||||
public function getTerms()
|
||||
{
|
||||
return $this->terms;
|
||||
}
|
||||
|
||||
/**
|
||||
* Append Terms to the list.
|
||||
*
|
||||
* @param \PayPal\Api\Terms $terms
|
||||
* @return $this
|
||||
*/
|
||||
public function addTerm($terms)
|
||||
{
|
||||
if (!$this->getTerms()) {
|
||||
return $this->setTerms(array($terms));
|
||||
} else {
|
||||
return $this->setTerms(
|
||||
array_merge($this->getTerms(), array($terms))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove Terms from the list.
|
||||
*
|
||||
* @param \PayPal\Api\Terms $terms
|
||||
* @return $this
|
||||
*/
|
||||
public function removeTerm($terms)
|
||||
{
|
||||
return $this->setTerms(
|
||||
array_diff($this->getTerms(), array($terms))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Specific preferences such as: set up fee, max fail attempts, autobill amount, and others that are configured for this billing plan.
|
||||
*
|
||||
* @param \PayPal\Api\MerchantPreferences $merchant_preferences
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setMerchantPreferences($merchant_preferences)
|
||||
{
|
||||
$this->merchant_preferences = $merchant_preferences;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specific preferences such as: set up fee, max fail attempts, autobill amount, and others that are configured for this billing plan.
|
||||
*
|
||||
* @return \PayPal\Api\MerchantPreferences
|
||||
*/
|
||||
public function getMerchantPreferences()
|
||||
{
|
||||
return $this->merchant_preferences;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specific preferences such as: set up fee, max fail attempts, autobill amount, and others that are configured for this billing plan.
|
||||
*
|
||||
* @deprecated Instead use setMerchantPreferences
|
||||
*
|
||||
* @param \PayPal\Api\MerchantPreferences $merchant_preferences
|
||||
* @return $this
|
||||
*/
|
||||
public function setMerchant_preferences($merchant_preferences)
|
||||
{
|
||||
$this->merchant_preferences = $merchant_preferences;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specific preferences such as: set up fee, max fail attempts, autobill amount, and others that are configured for this billing plan.
|
||||
* @deprecated Instead use getMerchantPreferences
|
||||
*
|
||||
* @return \PayPal\Api\MerchantPreferences
|
||||
*/
|
||||
public function getMerchant_preferences()
|
||||
{
|
||||
return $this->merchant_preferences;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets Links
|
||||
*
|
||||
* @param \PayPal\Api\Links[] $links
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setLinks($links)
|
||||
{
|
||||
$this->links = $links;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Links
|
||||
*
|
||||
* @return \PayPal\Api\Links[]
|
||||
*/
|
||||
public function getLinks()
|
||||
{
|
||||
return $this->links;
|
||||
}
|
||||
|
||||
/**
|
||||
* Append Links to the list.
|
||||
*
|
||||
* @param \PayPal\Api\Links $links
|
||||
* @return $this
|
||||
*/
|
||||
public function addLink($links)
|
||||
{
|
||||
if (!$this->getLinks()) {
|
||||
return $this->setLinks(array($links));
|
||||
} else {
|
||||
return $this->setLinks(
|
||||
array_merge($this->getLinks(), array($links))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove Links from the list.
|
||||
*
|
||||
* @param \PayPal\Api\Links $links
|
||||
* @return $this
|
||||
*/
|
||||
public function removeLink($links)
|
||||
{
|
||||
return $this->setLinks(
|
||||
array_diff($this->getLinks(), array($links))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the details for a particular billing plan by passing the billing plan ID to the request URI.
|
||||
*
|
||||
* @param string $planId
|
||||
* @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
||||
* @param PPRestCall $restCall is the Rest Call Service that is used to make rest calls
|
||||
* @return Plan
|
||||
*/
|
||||
public static function get($planId, $apiContext = null, $restCall = null)
|
||||
{
|
||||
ArgumentValidator::validate($planId, 'planId');
|
||||
$payLoad = "";
|
||||
$json = self::executeCall(
|
||||
"/v1/payments/billing-plans/$planId",
|
||||
"GET",
|
||||
$payLoad,
|
||||
null,
|
||||
$apiContext,
|
||||
$restCall
|
||||
);
|
||||
$ret = new Plan();
|
||||
$ret->fromJson($json);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new billing plan by passing the details for the plan, including the plan name, description, and type, to the request URI.
|
||||
*
|
||||
* @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
||||
* @param PPRestCall $restCall is the Rest Call Service that is used to make rest calls
|
||||
* @return Plan
|
||||
*/
|
||||
public function create($apiContext = null, $restCall = null)
|
||||
{
|
||||
$payLoad = $this->toJSON();
|
||||
$json = self::executeCall(
|
||||
"/v1/payments/billing-plans/",
|
||||
"POST",
|
||||
$payLoad,
|
||||
null,
|
||||
$apiContext,
|
||||
$restCall
|
||||
);
|
||||
$this->fromJson($json);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace specific fields within a billing plan by passing the ID of the billing plan to the request URI. In addition, pass a patch object in the request JSON that specifies the operation to perform, field to update, and new value for each update.
|
||||
*
|
||||
* @param PatchRequest $patchRequest
|
||||
* @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
||||
* @param PPRestCall $restCall is the Rest Call Service that is used to make rest calls
|
||||
* @return bool
|
||||
*/
|
||||
public function update($patchRequest, $apiContext = null, $restCall = null)
|
||||
{
|
||||
ArgumentValidator::validate($this->getId(), "Id");
|
||||
ArgumentValidator::validate($patchRequest, 'patchRequest');
|
||||
$payLoad = $patchRequest->toJSON();
|
||||
self::executeCall(
|
||||
"/v1/payments/billing-plans/{$this->getId()}",
|
||||
"PATCH",
|
||||
$payLoad,
|
||||
null,
|
||||
$apiContext,
|
||||
$restCall
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* List billing plans according to optional query string parameters specified.
|
||||
*
|
||||
* @param array $params
|
||||
* @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
||||
* @param PPRestCall $restCall is the Rest Call Service that is used to make rest calls
|
||||
* @return PlanList
|
||||
*/
|
||||
public static function all($params, $apiContext = null, $restCall = null)
|
||||
{
|
||||
ArgumentValidator::validate($params, 'params');
|
||||
$payLoad = "";
|
||||
$allowedParams = array(
|
||||
'page_size' => 1,
|
||||
'status' => 1,
|
||||
'page' => 1,
|
||||
'total_required' => 1
|
||||
);
|
||||
$json = self::executeCall(
|
||||
"/v1/payments/billing-plans/" . "?" . http_build_query(array_intersect_key($params, $allowedParams)),
|
||||
"GET",
|
||||
$payLoad,
|
||||
null,
|
||||
$apiContext,
|
||||
$restCall
|
||||
);
|
||||
$ret = new PlanList();
|
||||
$ret->fromJson($json);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
}
|
||||
223
lib/PayPal/Api/PlanList.php
Normal file
223
lib/PayPal/Api/PlanList.php
Normal file
@@ -0,0 +1,223 @@
|
||||
<?php
|
||||
|
||||
namespace PayPal\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
|
||||
/**
|
||||
* Class PlanList
|
||||
*
|
||||
* Resource representing a list of billing plans with basic information and get link.
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
* @property \PayPal\Api\Plan[] plans
|
||||
* @property string total_items
|
||||
* @property string total_pages
|
||||
* @property \PayPal\Api\Links[] links
|
||||
*/
|
||||
class PlanList extends PPModel
|
||||
{
|
||||
/**
|
||||
* Array of billing plans.
|
||||
*
|
||||
* @param \PayPal\Api\Plan[] $plans
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setPlans($plans)
|
||||
{
|
||||
$this->plans = $plans;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of billing plans.
|
||||
*
|
||||
* @return \PayPal\Api\Plan[]
|
||||
*/
|
||||
public function getPlans()
|
||||
{
|
||||
return $this->plans;
|
||||
}
|
||||
|
||||
/**
|
||||
* Append Plans to the list.
|
||||
*
|
||||
* @param \PayPal\Api\Plan $plan
|
||||
* @return $this
|
||||
*/
|
||||
public function addPlan($plan)
|
||||
{
|
||||
if (!$this->getPlans()) {
|
||||
return $this->setPlans(array($plan));
|
||||
} else {
|
||||
return $this->setPlans(
|
||||
array_merge($this->getPlans(), array($plan))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove Plans from the list.
|
||||
*
|
||||
* @param \PayPal\Api\Plan $plan
|
||||
* @return $this
|
||||
*/
|
||||
public function removePlan($plan)
|
||||
{
|
||||
return $this->setPlans(
|
||||
array_diff($this->getPlans(), array($plan))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Total number of items.
|
||||
*
|
||||
* @param string $total_items
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setTotalItems($total_items)
|
||||
{
|
||||
$this->total_items = $total_items;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Total number of items.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTotalItems()
|
||||
{
|
||||
return $this->total_items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Total number of items.
|
||||
*
|
||||
* @deprecated Instead use setTotalItems
|
||||
*
|
||||
* @param string $total_items
|
||||
* @return $this
|
||||
*/
|
||||
public function setTotal_items($total_items)
|
||||
{
|
||||
$this->total_items = $total_items;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Total number of items.
|
||||
* @deprecated Instead use getTotalItems
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTotal_items()
|
||||
{
|
||||
return $this->total_items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Total number of pages.
|
||||
*
|
||||
* @param string $total_pages
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setTotalPages($total_pages)
|
||||
{
|
||||
$this->total_pages = $total_pages;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Total number of pages.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTotalPages()
|
||||
{
|
||||
return $this->total_pages;
|
||||
}
|
||||
|
||||
/**
|
||||
* Total number of pages.
|
||||
*
|
||||
* @deprecated Instead use setTotalPages
|
||||
*
|
||||
* @param string $total_pages
|
||||
* @return $this
|
||||
*/
|
||||
public function setTotal_pages($total_pages)
|
||||
{
|
||||
$this->total_pages = $total_pages;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Total number of pages.
|
||||
* @deprecated Instead use getTotalPages
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTotal_pages()
|
||||
{
|
||||
return $this->total_pages;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets Links
|
||||
*
|
||||
* @param \PayPal\Api\Links[] $links
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setLinks($links)
|
||||
{
|
||||
$this->links = $links;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Links
|
||||
*
|
||||
* @return \PayPal\Api\Links[]
|
||||
*/
|
||||
public function getLinks()
|
||||
{
|
||||
return $this->links;
|
||||
}
|
||||
|
||||
/**
|
||||
* Append Links to the list.
|
||||
*
|
||||
* @param \PayPal\Api\Links $links
|
||||
* @return $this
|
||||
*/
|
||||
public function addLink($links)
|
||||
{
|
||||
if (!$this->getLinks()) {
|
||||
return $this->setLinks(array($links));
|
||||
} else {
|
||||
return $this->setLinks(
|
||||
array_merge($this->getLinks(), array($links))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove Links from the list.
|
||||
*
|
||||
* @param \PayPal\Api\Links $links
|
||||
* @return $this
|
||||
*/
|
||||
public function removeLink($links)
|
||||
{
|
||||
return $this->setLinks(
|
||||
array_diff($this->getLinks(), array($links))
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,9 +2,8 @@
|
||||
|
||||
namespace PayPal\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Common\ResourceModel;
|
||||
use PayPal\Rest\ApiContext;
|
||||
use PayPal\Rest\IResource;
|
||||
use PayPal\Api\Refund;
|
||||
use PayPal\Transport\PPRestCall;
|
||||
use PayPal\Validation\ArgumentValidator;
|
||||
@@ -30,7 +29,7 @@ use PayPal\Validation\ArgumentValidator;
|
||||
* @property string parent_payment
|
||||
* @property \PayPal\Api\Links links
|
||||
*/
|
||||
class Sale extends PPModel implements IResource
|
||||
class Sale extends ResourceModel
|
||||
{
|
||||
/**
|
||||
* OAuth Credentials to use for this call
|
||||
@@ -592,18 +591,22 @@ class Sale extends PPModel implements IResource
|
||||
*
|
||||
* @param string $saleId
|
||||
* @param \PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
||||
* @param PPRestCall $restCall is the Rest Call Service that is used to make rest calls
|
||||
* @return Sale
|
||||
*/
|
||||
public static function get($saleId, $apiContext = null)
|
||||
public static function get($saleId, $apiContext = null, $restCall = null)
|
||||
{
|
||||
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);
|
||||
$json = self::executeCall(
|
||||
"/v1/payments/sale/$saleId",
|
||||
"GET",
|
||||
$payLoad,
|
||||
null,
|
||||
$apiContext,
|
||||
$restCall
|
||||
);
|
||||
$ret = new Sale();
|
||||
$ret->fromJson($json);
|
||||
return $ret;
|
||||
@@ -614,19 +617,23 @@ class Sale extends PPModel implements IResource
|
||||
*
|
||||
* @param Refund $refund
|
||||
* @param \PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
||||
* @param PPRestCall $restCall is the Rest Call Service that is used to make rest calls
|
||||
* @return Refund
|
||||
*/
|
||||
public function refund($refund, $apiContext = null)
|
||||
public function refund($refund, $apiContext = null, $restCall = null)
|
||||
{
|
||||
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);
|
||||
$json = self::executeCall(
|
||||
"/v1/payments/sale/{$this->getId()}/refund",
|
||||
"POST",
|
||||
$payLoad,
|
||||
null,
|
||||
$apiContext,
|
||||
$restCall
|
||||
);
|
||||
$ret = new Refund();
|
||||
$ret->fromJson($json);
|
||||
return $ret;
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace PayPal\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Rest\ApiContext;
|
||||
|
||||
/**
|
||||
* Class ShippingAddress
|
||||
@@ -20,7 +19,6 @@ class ShippingAddress extends Address
|
||||
{
|
||||
/**
|
||||
* Address ID assigned in PayPal system.
|
||||
*
|
||||
*
|
||||
* @param string $id
|
||||
*
|
||||
@@ -44,7 +42,6 @@ class ShippingAddress extends Address
|
||||
|
||||
/**
|
||||
* Name of the recipient at this address.
|
||||
*
|
||||
*
|
||||
* @param string $recipient_name
|
||||
*
|
||||
@@ -93,7 +90,6 @@ class ShippingAddress extends Address
|
||||
|
||||
/**
|
||||
* Default shipping address of the Payer.
|
||||
*
|
||||
*
|
||||
* @param bool $default_address
|
||||
*
|
||||
|
||||
236
lib/PayPal/Api/Terms.php
Normal file
236
lib/PayPal/Api/Terms.php
Normal file
@@ -0,0 +1,236 @@
|
||||
<?php
|
||||
|
||||
namespace PayPal\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
|
||||
/**
|
||||
* Class Terms
|
||||
*
|
||||
* Resource representing terms used by the plan.
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
* @property string id
|
||||
* @property string type
|
||||
* @property \PayPal\Api\Currency max_billing_amount
|
||||
* @property string occurrences
|
||||
* @property \PayPal\Api\Currency amount_range
|
||||
* @property string buyer_editable
|
||||
*/
|
||||
class Terms extends PPModel
|
||||
{
|
||||
/**
|
||||
* Identifier of the terms. 128 characters max.
|
||||
*
|
||||
* @param string $id
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setId($id)
|
||||
{
|
||||
$this->id = $id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Identifier of the terms. 128 characters max.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Term type. Allowed values: `MONTHLY`, `WEEKLY`, `YEARLY`.
|
||||
*
|
||||
* @param string $type
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setType($type)
|
||||
{
|
||||
$this->type = $type;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Term type. Allowed values: `MONTHLY`, `WEEKLY`, `YEARLY`.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Max Amount associated with this term.
|
||||
*
|
||||
* @param \PayPal\Api\Currency $max_billing_amount
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setMaxBillingAmount($max_billing_amount)
|
||||
{
|
||||
$this->max_billing_amount = $max_billing_amount;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Max Amount associated with this term.
|
||||
*
|
||||
* @return \PayPal\Api\Currency
|
||||
*/
|
||||
public function getMaxBillingAmount()
|
||||
{
|
||||
return $this->max_billing_amount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Max Amount associated with this term.
|
||||
*
|
||||
* @deprecated Instead use setMaxBillingAmount
|
||||
*
|
||||
* @param \PayPal\Api\Currency $max_billing_amount
|
||||
* @return $this
|
||||
*/
|
||||
public function setMax_billing_amount($max_billing_amount)
|
||||
{
|
||||
$this->max_billing_amount = $max_billing_amount;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Max Amount associated with this term.
|
||||
* @deprecated Instead use getMaxBillingAmount
|
||||
*
|
||||
* @return \PayPal\Api\Currency
|
||||
*/
|
||||
public function getMax_billing_amount()
|
||||
{
|
||||
return $this->max_billing_amount;
|
||||
}
|
||||
|
||||
/**
|
||||
* How many times money can be pulled during this term.
|
||||
*
|
||||
* @param string $occurrences
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setOccurrences($occurrences)
|
||||
{
|
||||
$this->occurrences = $occurrences;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* How many times money can be pulled during this term.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getOccurrences()
|
||||
{
|
||||
return $this->occurrences;
|
||||
}
|
||||
|
||||
/**
|
||||
* Amount_range associated with this term.
|
||||
*
|
||||
* @param \PayPal\Api\Currency $amount_range
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setAmountRange($amount_range)
|
||||
{
|
||||
$this->amount_range = $amount_range;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Amount_range associated with this term.
|
||||
*
|
||||
* @return \PayPal\Api\Currency
|
||||
*/
|
||||
public function getAmountRange()
|
||||
{
|
||||
return $this->amount_range;
|
||||
}
|
||||
|
||||
/**
|
||||
* Amount_range associated with this term.
|
||||
*
|
||||
* @deprecated Instead use setAmountRange
|
||||
*
|
||||
* @param \PayPal\Api\Currency $amount_range
|
||||
* @return $this
|
||||
*/
|
||||
public function setAmount_range($amount_range)
|
||||
{
|
||||
$this->amount_range = $amount_range;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Amount_range associated with this term.
|
||||
* @deprecated Instead use getAmountRange
|
||||
*
|
||||
* @return \PayPal\Api\Currency
|
||||
*/
|
||||
public function getAmount_range()
|
||||
{
|
||||
return $this->amount_range;
|
||||
}
|
||||
|
||||
/**
|
||||
* Buyer's ability to edit the amount in this term.
|
||||
*
|
||||
* @param string $buyer_editable
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setBuyerEditable($buyer_editable)
|
||||
{
|
||||
$this->buyer_editable = $buyer_editable;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Buyer's ability to edit the amount in this term.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getBuyerEditable()
|
||||
{
|
||||
return $this->buyer_editable;
|
||||
}
|
||||
|
||||
/**
|
||||
* Buyer's ability to edit the amount in this term.
|
||||
*
|
||||
* @deprecated Instead use setBuyerEditable
|
||||
*
|
||||
* @param string $buyer_editable
|
||||
* @return $this
|
||||
*/
|
||||
public function setBuyer_editable($buyer_editable)
|
||||
{
|
||||
$this->buyer_editable = $buyer_editable;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Buyer's ability to edit the amount in this term.
|
||||
* @deprecated Instead use getBuyerEditable
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getBuyer_editable()
|
||||
{
|
||||
return $this->buyer_editable;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -173,7 +173,7 @@ class PPModel
|
||||
$this->assignValue($k, $arr);
|
||||
}
|
||||
} else {
|
||||
$this->$k = $v;
|
||||
$this->assignValue($k, $v);
|
||||
}
|
||||
}
|
||||
return $this;
|
||||
|
||||
@@ -41,7 +41,9 @@ class PPConfigManager
|
||||
$configFile = implode(DIRECTORY_SEPARATOR,
|
||||
array(dirname(__FILE__), "..", "config", "sdk_config.ini"));
|
||||
}
|
||||
$this->addConfigFromIni($configFile);
|
||||
if (file_exists($configFile)) {
|
||||
$this->addConfigFromIni($configFile);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -65,7 +67,7 @@ class PPConfigManager
|
||||
*/
|
||||
public function addConfigFromIni($fileName)
|
||||
{
|
||||
if ($configs = @parse_ini_file($fileName)) {
|
||||
if ($configs = parse_ini_file($fileName)) {
|
||||
$this->addConfigs($configs);
|
||||
}
|
||||
return $this;
|
||||
|
||||
@@ -11,8 +11,8 @@ namespace PayPal\Core;
|
||||
class PPConstants
|
||||
{
|
||||
|
||||
const SDK_NAME = 'rest-api-sdk-php';
|
||||
const SDK_VERSION = '0.11.0';
|
||||
const SDK_NAME = 'PayPal-PHP-SDK';
|
||||
const SDK_VERSION = '0.14.0';
|
||||
|
||||
const REST_SANDBOX_ENDPOINT = "https://api.sandbox.paypal.com/";
|
||||
const OPENID_REDIRECT_SANDBOX_URL = "https://www.sandbox.paypal.com/webapps/auth/protocol/openidconnect";
|
||||
|
||||
@@ -144,7 +144,7 @@ class PPCredentialManager
|
||||
*/
|
||||
public function getCredentialObject($userId = null)
|
||||
{
|
||||
if ($userId == null) {
|
||||
if ($userId == null && array_key_exists($this->defaultAccountName, $this->credentialHashmap)) {
|
||||
$credObj = $this->credentialHashmap[$this->defaultAccountName];
|
||||
} else if (array_key_exists($userId, $this->credentialHashmap)) {
|
||||
$credObj = $this->credentialHashmap[$userId];
|
||||
|
||||
@@ -107,7 +107,7 @@ class PPHttpConnection
|
||||
$this->logger->fine($header);
|
||||
}
|
||||
|
||||
$this->logger->fine("Payload : " . $data . "\n");
|
||||
$this->logger->fine(($data && $data != '' ? "Payload : " . $data : "No Request Payload") . "\n");
|
||||
//Execute Curl Request
|
||||
$result = curl_exec($ch);
|
||||
|
||||
@@ -144,6 +144,8 @@ class PPHttpConnection
|
||||
}
|
||||
//Close the curl request
|
||||
curl_close($ch);
|
||||
|
||||
$this->logger->fine(($result && $result != '' ? "Response : " . $result : "No Response Body") . "\n\n");
|
||||
//More Exceptions based on HttpStatus Code
|
||||
if (in_array($httpStatus, self::$retryCodes)) {
|
||||
$ex = new PPConnectionException(
|
||||
@@ -151,7 +153,6 @@ class PPHttpConnection
|
||||
"Got Http response code $httpStatus when accessing {$this->httpConfig->getUrl()}. " .
|
||||
"Retried $retries times."
|
||||
);
|
||||
$this->logger->fine("Response : " . $result . "\n\n");
|
||||
$ex->setData($result);
|
||||
throw $ex;
|
||||
} else if ($httpStatus < 200 || $httpStatus >= 300) {
|
||||
@@ -160,12 +161,10 @@ class PPHttpConnection
|
||||
"Got Http response code $httpStatus when accessing {$this->httpConfig->getUrl()}.",
|
||||
$httpStatus
|
||||
);
|
||||
$this->logger->fine("Response : " . $result . "\n\n");
|
||||
$ex->setData($result);
|
||||
throw $ex;
|
||||
}
|
||||
|
||||
$this->logger->fine("Response : " . $result . "\n\n");
|
||||
|
||||
//Return result object
|
||||
return $result;
|
||||
|
||||
@@ -29,9 +29,9 @@ class ArgumentValidator
|
||||
) {
|
||||
//Throw an Exception for string or array
|
||||
throw new \InvalidArgumentException("$argumentName cannot be null or empty");
|
||||
} elseif ($argument == null) {
|
||||
} elseif ($argument === null) {
|
||||
//Generic Exception
|
||||
throw new \InvalidArgumentException("$argumentName cannot be null");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user