forked from LiveCarta/PayPal-PHP-SDK
Use restCall object for functions that makes requests (#841)
* Use restCall object for functions that makes requests
This commit is contained in:
@@ -18,13 +18,11 @@ class FuturePayment extends Payment
|
||||
*
|
||||
* @param null $apiContext
|
||||
* @param string|null $clientMetadataId
|
||||
* @param PayPalRestCall|null $restCall is the Rest Call Service that is used to make rest calls
|
||||
* @return $this
|
||||
*/
|
||||
public function create($apiContext = null, $clientMetadataId = null)
|
||||
public function create($apiContext = null, $clientMetadataId = null, $restCall = null)
|
||||
{
|
||||
if ($apiContext == null) {
|
||||
$apiContext = new ApiContext(self::$credential);
|
||||
}
|
||||
$headers = array();
|
||||
if ($clientMetadataId != null) {
|
||||
$headers = array(
|
||||
@@ -32,18 +30,16 @@ class FuturePayment extends Payment
|
||||
);
|
||||
}
|
||||
$payLoad = $this->toJSON();
|
||||
$call = new PayPalRestCall($apiContext);
|
||||
$json = $call->execute(
|
||||
array('PayPal\Handler\RestHandler'),
|
||||
$json = self::executeCall(
|
||||
"/v1/payments/payment",
|
||||
"POST",
|
||||
$payLoad,
|
||||
$headers
|
||||
$headers,
|
||||
$apiContext,
|
||||
$restCall
|
||||
);
|
||||
$this->fromJson($json);
|
||||
|
||||
return $this;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user