![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/mcoil.corals.io/vendor/paypal/rest-api-sdk-php/lib/PayPal/Api/ |
<?php namespace PayPal\Api; use PayPal\Rest\ApiContext; use PayPal\Transport\PayPalRestCall; /** * Class FuturePayment * * @package PayPal\Api */ class FuturePayment extends Payment { /** * Extends the Payment object to create future payments * * @param null $apiContext * @param string|null $clientMetadataId * @return $this */ public function create($apiContext = null, $clientMetadataId = null) { if ($apiContext == null) { $apiContext = new ApiContext(self::$credential); } $headers = array(); if ($clientMetadataId != null) { $headers = array( 'PAYPAL-CLIENT-METADATA-ID' => $clientMetadataId ); } $payLoad = $this->toJSON(); $call = new PayPalRestCall($apiContext); $json = $call->execute( array('PayPal\Handler\RestHandler'), "/v1/payments/payment", "POST", $payLoad, $headers ); $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); } /** * Updates Access Token using long lived refresh token * * @param string|null $refreshToken * @param ApiContext $apiContext * @return void */ public function updateAccessToken($refreshToken, $apiContext) { $apiContext = $apiContext ? $apiContext : new ApiContext(self::$credential); $apiContext->getCredential()->updateAccessToken($apiContext->getConfig(), $refreshToken); } }