/** * Exchanges resource owner password credentials for access token. * This method is only for Resource Owner Password Credentials Grant, which is disabled for most clients by default. * Use Authorization Code Grant by getAuthorizationUri and getOAuthAccessToken methods if available. * * @param string $refreshToken * @param array|null $scopes can contain Paysera_WalletApi_OAuth_Consumer::SCOPE_* constants * * @return Paysera_WalletApi_Entity_MacAccessToken * * @throws Paysera_WalletApi_Exception_ApiException */ public function refreshAccessToken($refreshToken, $scopes = null) { Paysera_WalletApi_Util_Assert::isScalar($refreshToken); $parameters = array('grant_type' => 'refresh_token', 'refresh_token' => $refreshToken); if ($scopes !== null) { $parameters['scope'] = implode(' ', $scopes); } $responseData = $this->post('token', $parameters); return $this->mapper->decodeAccessToken($responseData); }
/** * Sets description * * @param string $description * @return self */ public function setDescription($description) { Paysera_WalletApi_Util_Assert::isScalar($description); $this->description = (string) $description; return $this; }
/** * Gets available types to accept transaction using API * * @param string $transactionKey * @param integer $walletId * * @return string[] * * @throws Paysera_WalletApi_Exception_ApiException */ public function getAvailableTransactionTypes($transactionKey, $walletId) { Paysera_WalletApi_Util_Assert::isScalar($transactionKey); Paysera_WalletApi_Util_Assert::isId($walletId); return $this->get('transaction/' . $transactionKey . '/type/' . $walletId); }
/** * Set callbackUri * * @param string|boolean false $callbackUri * * @return self */ public function setCallbackUri($callbackUri) { if ($callbackUri === null) { $this->setCallbacksDisabled(false); $this->callbackUri = null; } elseif ($callbackUri === false) { $this->disableCallbacks(); } else { Paysera_WalletApi_Util_Assert::isScalar($callbackUri); $this->callbackUri = (string) $callbackUri; $this->setCallbacksDisabled(false); } return $this; }