/** * 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); }
/** * Gets user's wallets by id using API * * @param integer $userId * * @return Paysera_WalletApi_Entity_Wallet[] * * @throws Paysera_WalletApi_Exception_ApiException */ public function getUserWallets($userId) { Paysera_WalletApi_Util_Assert::isId($userId); $responseData = $this->get('user/' . $userId . '/wallets'); return $this->mapper->decodeWallets($responseData); }
/** * Sets period * * @param integer $period * @return self * * @deprecated use setTime() */ public function setPeriod($period) { Paysera_WalletApi_Util_Assert::isInt($period); $this->time = intval($period) * 3600; return $this; }
/** * Sets validFor * * @param integer $validFor * @return self */ public function setValidFor($validFor) { Paysera_WalletApi_Util_Assert::isIntOrNull($validFor); $this->validFor = $validFor; return $this; }
/** * 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; }