Файл: sngine-v2.8/Script/includes/libs/PayPal/paypal/rest-api-sdk-php/lib/PayPal/Api/FuturePayment.php
Строк: 65
<?php
namespace PayPalApi;
use PayPalRestApiContext;
use PayPalTransportPayPalRestCall;
/**
* Class FuturePayment
*
* @package PayPalApi
*/
class FuturePayment extends Payment
{
/**
* Extends the Payment object to create future payments
*
* @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, $restCall = null)
{
$headers = array();
if ($clientMetadataId != null) {
$headers = array(
'PAYPAL-CLIENT-METADATA-ID' => $clientMetadataId
);
}
$payLoad = $this->toJSON();
$json = self::executeCall(
"/v1/payments/payment",
"POST",
$payLoad,
$headers,
$apiContext,
$restCall
);
$this->fromJson($json);
return $this;
}
/**
* Get a Refresh Token from Authorization Code
*
* @param $authorizationCode
* @param ApiContext $apiContext
* @return string|null refresh token
*/
public static function getRefreshToken($authorizationCode, $apiContext = null)
{
$apiContext = $apiContext ? $apiContext : new ApiContext(self::$credential);
$credential = $apiContext->getCredential();
return $credential->getRefreshToken($apiContext->getConfig(), $authorizationCode);
}
}