forked from LiveCarta/PayPal-PHP-SDK
Updated Identity Support from SDK Core
- Moved PPModels required for Identity Support
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
namespace PayPal\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Rest\ApiContext;
|
||||
|
||||
/**
|
||||
* Class CreateProfileResponse
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace PayPal\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Rest\ApiContext;
|
||||
use PayPal\Validation\UrlValidator;
|
||||
|
||||
/**
|
||||
@@ -72,7 +71,7 @@ class FlowConfig extends PPModel
|
||||
*
|
||||
*
|
||||
* @param string $bank_txn_pending_url
|
||||
* @throws InvalidArgumentException
|
||||
* @throws \InvalidArgumentException
|
||||
* @return $this
|
||||
*/
|
||||
public function setBankTxnPendingUrl($bank_txn_pending_url)
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace PayPal\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Rest\ApiContext;
|
||||
|
||||
/**
|
||||
* Class InputFields
|
||||
|
||||
@@ -1,32 +1,19 @@
|
||||
<?php
|
||||
namespace PayPal\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Rest\ApiContext;
|
||||
use PayPal\Rest\IResource;
|
||||
use PayPal\Common\ResourceModel;
|
||||
use PayPal\Api\Invoices;
|
||||
use PayPal\Transport\PPRestCall;
|
||||
use PayPal\Validation\ArgumentValidator;
|
||||
use PayPal\Rest\ApiContext;
|
||||
use PayPal\Transport\PPRestCall;
|
||||
|
||||
/**
|
||||
* Class Invoice
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*/
|
||||
class Invoice extends PPModel implements IResource
|
||||
class Invoice extends ResourceModel
|
||||
{
|
||||
|
||||
private static $credential;
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated. Pass ApiContext to create/get methods instead
|
||||
*/
|
||||
public static function setCredential($credential)
|
||||
{
|
||||
self::$credential = $credential;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unique invoice resource identifier.
|
||||
*
|
||||
@@ -845,241 +832,250 @@ class Invoice extends PPModel implements IResource
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
/**
|
||||
* Creates a new invoice Resource.
|
||||
*
|
||||
* @param PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
||||
* @param 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 Invoice
|
||||
*/
|
||||
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/invoicing/invoices", "POST", $payLoad);
|
||||
$json = self::executeCall(
|
||||
"/v1/invoicing/invoices",
|
||||
"POST",
|
||||
$payLoad,
|
||||
$apiContext,
|
||||
$restCall
|
||||
);
|
||||
$this->fromJson($json);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Search for invoice resources.
|
||||
*
|
||||
* @param Search $search
|
||||
* @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 Invoices
|
||||
*/
|
||||
public function search($search, $apiContext = null)
|
||||
public function search($search, $apiContext = null, $restCall = null)
|
||||
{
|
||||
ArgumentValidator::validate($search, 'search');
|
||||
$payLoad = $search->toJSON();
|
||||
if ($apiContext == null) {
|
||||
$apiContext = new ApiContext(self::$credential);
|
||||
}
|
||||
$call = new PPRestCall($apiContext);
|
||||
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/invoicing/search", "POST", $payLoad);
|
||||
$json = self::executeCall(
|
||||
"/v1/invoicing/search",
|
||||
"POST",
|
||||
$payLoad,
|
||||
$apiContext,
|
||||
$restCall
|
||||
);
|
||||
$ret = new Invoices();
|
||||
$ret->fromJson($json);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Sends a legitimate invoice to the payer.
|
||||
*
|
||||
* @param PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
||||
* @return void
|
||||
* @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 send($apiContext = null)
|
||||
public function send($apiContext = null, $restCall = null)
|
||||
{
|
||||
if ($this->getId() == null) {
|
||||
throw new \InvalidArgumentException("Id cannot be null");
|
||||
}
|
||||
ArgumentValidator::validate($this->getId(), "Id");
|
||||
$payLoad = "";
|
||||
if ($apiContext == null) {
|
||||
$apiContext = new ApiContext(self::$credential);
|
||||
}
|
||||
$call = new PPRestCall($apiContext);
|
||||
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/invoicing/invoices/{$this->getId()}/send", "POST", $payLoad);
|
||||
self::executeCall(
|
||||
"/v1/invoicing/invoices/{$this->getId()}/send",
|
||||
"POST",
|
||||
$payLoad,
|
||||
$apiContext,
|
||||
$restCall
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Reminds the payer to pay the invoice.
|
||||
*
|
||||
* @param Notification $notification
|
||||
* @param PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
||||
* @return void
|
||||
* @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 remind($notification, $apiContext = null)
|
||||
public function remind($notification, $apiContext = null, $restCall = null)
|
||||
{
|
||||
if ($this->getId() == null) {
|
||||
throw new \InvalidArgumentException("Id cannot be null");
|
||||
}
|
||||
if (($notification == null)) {
|
||||
throw new \InvalidArgumentException("notification cannot be null or empty");
|
||||
}
|
||||
ArgumentValidator::validate($this->getId(), "Id");
|
||||
ArgumentValidator::validate($notification, "Notification");
|
||||
$payLoad = $notification->toJSON();
|
||||
if ($apiContext == null) {
|
||||
$apiContext = new ApiContext(self::$credential);
|
||||
}
|
||||
$call = new PPRestCall($apiContext);
|
||||
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/invoicing/invoices/{$this->getId()}/remind", "POST", $payLoad);
|
||||
self::executeCall(
|
||||
"/v1/invoicing/invoices/{$this->getId()}/remind",
|
||||
"POST",
|
||||
$payLoad,
|
||||
$apiContext,
|
||||
$restCall
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Cancels an invoice.
|
||||
*
|
||||
* @param CancelNotification $cancelNotification
|
||||
* @param PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
||||
* @return void
|
||||
* @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($cancelNotification, $apiContext = null)
|
||||
public function cancel($cancelNotification, $apiContext = null, $restCall = null)
|
||||
{
|
||||
if ($this->getId() == null) {
|
||||
throw new \InvalidArgumentException("Id cannot be null");
|
||||
}
|
||||
if (($cancelNotification == null)) {
|
||||
throw new \InvalidArgumentException("cancelNotification cannot be null or empty");
|
||||
}
|
||||
ArgumentValidator::validate($this->getId(), "Id");
|
||||
ArgumentValidator::validate($cancelNotification, "CancelNotification");
|
||||
$payLoad = $cancelNotification->toJSON();
|
||||
if ($apiContext == null) {
|
||||
$apiContext = new ApiContext(self::$credential);
|
||||
}
|
||||
$call = new PPRestCall($apiContext);
|
||||
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/invoicing/invoices/{$this->getId()}/cancel", "POST", $payLoad);
|
||||
self::executeCall(
|
||||
"/v1/invoicing/invoices/{$this->getId()}/cancel",
|
||||
"POST",
|
||||
$payLoad,
|
||||
$apiContext,
|
||||
$restCall
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Mark the status of the invoice as paid.
|
||||
*
|
||||
* @param PaymentDetail $paymentDetail
|
||||
* @param PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
||||
* @return void
|
||||
* @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 record_payment($paymentDetail, $apiContext = null)
|
||||
public function record_payment($paymentDetail, $apiContext = null, $restCall = null)
|
||||
{
|
||||
if ($this->getId() == null) {
|
||||
throw new \InvalidArgumentException("Id cannot be null");
|
||||
}
|
||||
if (($paymentDetail == null)) {
|
||||
throw new \InvalidArgumentException("paymentDetail cannot be null or empty");
|
||||
}
|
||||
ArgumentValidator::validate($this->getId(), "Id");
|
||||
ArgumentValidator::validate($paymentDetail, "PaymentDetail");
|
||||
$payLoad = $paymentDetail->toJSON();
|
||||
if ($apiContext == null) {
|
||||
$apiContext = new ApiContext(self::$credential);
|
||||
}
|
||||
$call = new PPRestCall($apiContext);
|
||||
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/invoicing/invoices/{$this->getId()}/record-payment", "POST", $payLoad);
|
||||
self::executeCall(
|
||||
"/v1/invoicing/invoices/{$this->getId()}/record-payment",
|
||||
"POST",
|
||||
$payLoad,
|
||||
$apiContext,
|
||||
$restCall
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Mark the status of the invoice as refunded.
|
||||
*
|
||||
* @param RefundDetail $refundDetail
|
||||
* @param PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
||||
* @return void
|
||||
* @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 record_refund($refundDetail, $apiContext = null)
|
||||
public function record_refund($refundDetail, $apiContext = null, $restCall = null)
|
||||
{
|
||||
if ($this->getId() == null) {
|
||||
throw new \InvalidArgumentException("Id cannot be null");
|
||||
}
|
||||
if (($refundDetail == null)) {
|
||||
throw new \InvalidArgumentException("refundDetail cannot be null or empty");
|
||||
}
|
||||
ArgumentValidator::validate($this->getId(), "Id");
|
||||
ArgumentValidator::validate($refundDetail, "RefundDetail");
|
||||
$payLoad = $refundDetail->toJSON();
|
||||
if ($apiContext == null) {
|
||||
$apiContext = new ApiContext(self::$credential);
|
||||
}
|
||||
$call = new PPRestCall($apiContext);
|
||||
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/invoicing/invoices/{$this->getId()}/record-refund", "POST", $payLoad);
|
||||
self::executeCall(
|
||||
"/v1/invoicing/invoices/{$this->getId()}/record-refund",
|
||||
"POST",
|
||||
$payLoad,
|
||||
$apiContext,
|
||||
$restCall
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Get the invoice resource for the given identifier.
|
||||
*
|
||||
* @param string $invoiceId
|
||||
* @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 Invoice
|
||||
*/
|
||||
public static function get($invoiceId, $apiContext = null)
|
||||
public static function get($invoiceId, $apiContext = null, $restCall = null)
|
||||
{
|
||||
if (($invoiceId == null) || (strlen($invoiceId) <= 0)) {
|
||||
throw new \InvalidArgumentException("invoiceId cannot be null or empty");
|
||||
}
|
||||
ArgumentValidator::validate($invoiceId);
|
||||
$payLoad = "";
|
||||
if ($apiContext == null) {
|
||||
$apiContext = new ApiContext(self::$credential);
|
||||
}
|
||||
$call = new PPRestCall($apiContext);
|
||||
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/invoicing/invoices/$invoiceId", "GET", $payLoad);
|
||||
$json = self::executeCall(
|
||||
"/v1/invoicing/invoices/$invoiceId",
|
||||
"GET",
|
||||
$payLoad,
|
||||
$apiContext,
|
||||
$restCall
|
||||
);
|
||||
$ret = new Invoice();
|
||||
$ret->fromJson($json);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Get all invoices of a merchant.
|
||||
*
|
||||
* @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 Invoices
|
||||
*/
|
||||
public static function get_all($apiContext = null)
|
||||
public static function get_all($apiContext = null, $restCall = null)
|
||||
{
|
||||
$payLoad = "";
|
||||
if ($apiContext == null) {
|
||||
$apiContext = new ApiContext(self::$credential);
|
||||
}
|
||||
$call = new PPRestCall($apiContext);
|
||||
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/invoicing/invoices/", "GET", $payLoad);
|
||||
$json = self::executeCall(
|
||||
"/v1/invoicing/invoices/",
|
||||
"GET",
|
||||
$payLoad,
|
||||
$apiContext,
|
||||
$restCall
|
||||
);
|
||||
$ret = new Invoices();
|
||||
$ret->fromJson($json);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Full update of the invoice 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 Invoice
|
||||
*/
|
||||
public function update($apiContext = null)
|
||||
public function update($apiContext = null, $restCall = null)
|
||||
{
|
||||
if ($this->getId() == null) {
|
||||
throw new \InvalidArgumentException("Id cannot be null");
|
||||
}
|
||||
ArgumentValidator::validate($this->getId(), "Id");
|
||||
$payLoad = $this->toJSON();
|
||||
if ($apiContext == null) {
|
||||
$apiContext = new ApiContext(self::$credential);
|
||||
}
|
||||
$call = new PPRestCall($apiContext);
|
||||
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/invoicing/invoices/{$this->getId()}", "PUT", $payLoad);
|
||||
$json = self::executeCall(
|
||||
"/v1/invoicing/invoices/{$this->getId()}",
|
||||
"PUT",
|
||||
$payLoad,
|
||||
$apiContext,
|
||||
$restCall
|
||||
);
|
||||
$this->fromJson($json);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Delete invoice resource for the given identifier.
|
||||
*
|
||||
* @param PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
||||
* @return void
|
||||
* @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)
|
||||
{
|
||||
if ($this->getId() == null) {
|
||||
throw new \InvalidArgumentException("Id cannot be null");
|
||||
}
|
||||
ArgumentValidator::validate($this->getId(), "Id");
|
||||
$payLoad = "";
|
||||
if ($apiContext == null) {
|
||||
$apiContext = new ApiContext(self::$credential);
|
||||
}
|
||||
$call = new PPRestCall($apiContext);
|
||||
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/invoicing/invoices/{$this->getId()}", "DELETE", $payLoad);
|
||||
self::executeCall(
|
||||
"/v1/invoicing/invoices/{$this->getId()}",
|
||||
"DELETE",
|
||||
$payLoad,
|
||||
$apiContext,
|
||||
$restCall
|
||||
);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace PayPal\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Rest\ApiContext;
|
||||
|
||||
/**
|
||||
* Class Patch
|
||||
@@ -14,7 +13,7 @@ use PayPal\Rest\ApiContext;
|
||||
*
|
||||
* @property string op
|
||||
* @property string path
|
||||
* @property \PayPal\Api\object value
|
||||
* @property mixed value
|
||||
* @property string from
|
||||
*/
|
||||
class Patch extends PPModel
|
||||
@@ -71,7 +70,7 @@ class Patch extends PPModel
|
||||
* New value to apply based on the operation. op=remove does not require value.
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\object $value
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
@@ -84,7 +83,7 @@ class Patch extends PPModel
|
||||
/**
|
||||
* New value to apply based on the operation. op=remove does not require value.
|
||||
*
|
||||
* @return \PayPal\Api\object
|
||||
* @return mixed
|
||||
*/
|
||||
public function getValue()
|
||||
{
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace PayPal\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Rest\ApiContext;
|
||||
|
||||
/**
|
||||
* Class Presentation
|
||||
|
||||
@@ -2,12 +2,11 @@
|
||||
|
||||
namespace PayPal\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Rest\ApiContext;
|
||||
use PayPal\Rest\IResource;
|
||||
use PayPal\Api\CreateProfileResponse;
|
||||
use PayPal\Transport\PPRestCall;
|
||||
use PayPal\Common\ResourceModel;
|
||||
use PayPal\Validation\ArgumentValidator;
|
||||
use PayPal\Api\CreateProfileResponse;
|
||||
use PayPal\Rest\ApiContext;
|
||||
use PayPal\Transport\PPRestCall;
|
||||
|
||||
/**
|
||||
* Class WebProfile
|
||||
@@ -22,26 +21,8 @@ use PayPal\Validation\ArgumentValidator;
|
||||
* @property \PayPal\Api\InputFields input_fields
|
||||
* @property \PayPal\Api\Presentation presentation
|
||||
*/
|
||||
class WebProfile extends PPModel implements IResource
|
||||
class WebProfile 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 web experience profile.
|
||||
*
|
||||
@@ -215,17 +196,21 @@ class WebProfile extends PPModel implements IResource
|
||||
/**
|
||||
* Create a web experience profile by passing the name of the profile and other profile details in the request JSON to the request URI.
|
||||
*
|
||||
* @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 CreateProfileResponse
|
||||
*/
|
||||
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/payment-experience/web-profiles/", "POST", $payLoad);
|
||||
$json = self::executeCall(
|
||||
"/v1/payment-experience/web-profiles/",
|
||||
"POST",
|
||||
$payLoad,
|
||||
null,
|
||||
$apiContext,
|
||||
$restCall
|
||||
);
|
||||
$ret = new CreateProfileResponse();
|
||||
$ret->fromJson($json);
|
||||
return $ret;
|
||||
@@ -234,18 +219,22 @@ class WebProfile extends PPModel implements IResource
|
||||
/**
|
||||
* Update a web experience profile by passing the ID of the profile to the request URI. In addition, pass the profile details in the request JSON. If your request does not include values for all profile detail fields, the previously set values for the omitted fields are removed by this operation.
|
||||
*
|
||||
* @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 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/payment-experience/web-profiles/{$this->getId()}", "PUT", $payLoad);
|
||||
self::executeCall(
|
||||
"/v1/payment-experience/web-profiles/{$this->getId()}",
|
||||
"PUT",
|
||||
$payLoad,
|
||||
null,
|
||||
$apiContext,
|
||||
$restCall
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -253,23 +242,27 @@ class WebProfile extends PPModel implements IResource
|
||||
* Partially update an existing web experience profile by passing the ID of the profile to the request URI. In addition, pass a patch object in the request JSON that specifies the operation to perform, path of the profile location to update, and a new value if needed to complete the operation.
|
||||
*
|
||||
* @param Patch[] $patch
|
||||
* @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 partial_update($patch, $apiContext = null)
|
||||
public function partial_update($patch, $apiContext = null, $restCall = null)
|
||||
{
|
||||
ArgumentValidator::validate($this->getId(), "Id");
|
||||
ArgumentValidator::validate($patch, 'patch');
|
||||
$payload = array();
|
||||
foreach ($patch as $patchObject) {
|
||||
$payload[] = $patchObject->toArray();
|
||||
}
|
||||
|
||||
$payLoad = json_encode($payload);
|
||||
if ($apiContext == null) {
|
||||
$apiContext = new ApiContext(self::$credential);
|
||||
}
|
||||
$call = new PPRestCall($apiContext);
|
||||
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payment-experience/web-profiles/{$this->getId()}", "PATCH", $payLoad);
|
||||
self::executeCall(
|
||||
"/v1/payment-experience/web-profiles/{$this->getId()}",
|
||||
"PATCH",
|
||||
$payLoad,
|
||||
null,
|
||||
$apiContext,
|
||||
$restCall
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -277,18 +270,22 @@ class WebProfile extends PPModel implements IResource
|
||||
* Retrieve the details of a particular web experience profile by passing the ID of the profile to the request URI.
|
||||
*
|
||||
* @param string $profileId
|
||||
* @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 WebProfile
|
||||
*/
|
||||
public static function get($profileId, $apiContext = null)
|
||||
public static function get($profileId, $apiContext = null, $restCall = null)
|
||||
{
|
||||
ArgumentValidator::validate($profileId, 'profileId');
|
||||
$payLoad = "";
|
||||
if ($apiContext == null) {
|
||||
$apiContext = new ApiContext(self::$credential);
|
||||
}
|
||||
$call = new PPRestCall($apiContext);
|
||||
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payment-experience/web-profiles/$profileId", "GET", $payLoad);
|
||||
$json = self::executeCall(
|
||||
"/v1/payment-experience/web-profiles/$profileId",
|
||||
"GET",
|
||||
$payLoad,
|
||||
null,
|
||||
$apiContext,
|
||||
$restCall
|
||||
);
|
||||
$ret = new WebProfile();
|
||||
$ret->fromJson($json);
|
||||
return $ret;
|
||||
@@ -297,35 +294,43 @@ class WebProfile extends PPModel implements IResource
|
||||
/**
|
||||
* Lists all web experience profiles that exist for a merchant (or subject).
|
||||
*
|
||||
* @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 WebProfile[]
|
||||
*/
|
||||
public static function get_list($apiContext = null)
|
||||
public static function get_list($apiContext = null, $restCall = null)
|
||||
{
|
||||
$payLoad = "";
|
||||
if ($apiContext == null) {
|
||||
$apiContext = new ApiContext(self::$credential);
|
||||
}
|
||||
$call = new PPRestCall($apiContext);
|
||||
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payment-experience/web-profiles/", "GET", $payLoad);
|
||||
$json = self::executeCall(
|
||||
"/v1/payment-experience/web-profiles/",
|
||||
"GET",
|
||||
$payLoad,
|
||||
null,
|
||||
$apiContext,
|
||||
$restCall
|
||||
);
|
||||
return WebProfile::getList($json);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete an existing web experience profile by passing the profile ID to the request URI.
|
||||
*
|
||||
* @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/payment-experience/web-profiles/{$this->getId()}", "DELETE", $payLoad);
|
||||
self::executeCall(
|
||||
"/v1/payment-experience/web-profiles/{$this->getId()}",
|
||||
"DELETE",
|
||||
$payLoad,
|
||||
null,
|
||||
$apiContext,
|
||||
$restCall
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user