public function auth($login, $password)
    {
        $response = $this->call('post', 'auth/login', [
            'form_params' => [
                'login'    => $login,
                'password' => $password
            ]
        ]);

        // check if token is present
        if (!isset($response['token'])) {
            if (isset($response['errors']) || isset($response['code'])) {
                $error_message = isset($response['code']) ? $response['message'] : $response['errors'][0]['message'];
                throw new MonetivoException('API error: ' . $error_message, 0, $response->getHttpCode(), (string)$response);
            } else {
                throw new MonetivoException('API ' . __FUNCTION__ . ' response is invalid: ' . (string)$response, 0, $response->getHttpCode(), (string)$response);
            }
        }

        // put the auth_token
        $this->setAuthToken($response['token']);

        // return for further usage
        return $response['token'];
    }
public function auth($login, $password)
    {
        $response = $this->call('post', 'auth/login', [
            'form_params' => [
                'login'    => $login,
                'password' => $password
            ]
        ]);

        // check if token is present
        if (!isset($response['token'])) {
            if (isset($response['errors']) || isset($response['code'])) {
                $error_message = isset($response['code']) ? $response['message'] : $response['errors'][0]['message'];
                throw new MonetivoException('API error: ' . $error_message, 0, $response->getHttpCode(), (string)$response);
            } else {
                throw new MonetivoException('API ' . __FUNCTION__ . ' response is invalid: ' . (string)$response, 0, $response->getHttpCode(), (string)$response);
            }
        }

        // put the auth_token
        $this->setAuthToken($response['token']);

        // return for further usage
        return $response['token'];
    }
public function auth ( $ login , $ password ) { $ response = $ this -> call ( 'post' , 'auth/login' , [ 'form_params' => [ 'login' => $ login , 'password' => $ password ] ] ) ; // check if token is present if ( ! isset ( $ response [ 'token' ] ) ) { if ( isset ( $ response [ 'errors' ] ) || isset ( $ response [ 'code' ] ) ) { $ error_message = isset ( $ response [ 'code' ] ) ? $ response [ 'message' ] : $ response [ 'errors' ] [ 0 ] [ 'message' ] ; throw new MonetivoException ( 'API error: ' . $ error_message , 0 , $ response -> getHttpCode ( ) , ( string ) $ response ) ; } else { throw new MonetivoException ( 'API ' . __FUNCTION__ . ' response is invalid: ' . ( string ) $ response , 0 , $ response -> getHttpCode ( ) , ( string ) $ response ) ; } } // put the auth_token $ this -> setAuthToken ( $ response [ 'token' ] ) ; // return for further usage return $ response [ 'token' ] ; }
Authenticates user
After successful authentication authorization token is set automatically. Further calls are no longer required.
@url https://merchant.monetivo.com visit to obtain credentials
@param $login
@param $password
@return mixed
@throws MonetivoException
Authenticates user After successful authentication authorization token is set automatically . Further calls are no longer required .