Cielo\Transaction::setAuthorize PHP Method

setAuthorize() public method

public setAuthorize ( integer $authorize )
$authorize integer
    public function setAuthorize($authorize)
    {
        switch ($authorize) {
            case Transaction::ONLY_AUTHENTICATE:
            case Transaction::AUTHORIZE_IF_AUTHENTICATED:
            case Transaction::AUTHORIZE:
            case Transaction::AUTHORIZE_WITHOUT_AUTHENTICATION:
            case Transaction::RECURRENCE:
                $this->authorize = $authorize;
                break;
            default:
                throw new \UnexpectedValueException('Indicador de autorização inválido');
        }
    }

Usage Example

 /**
  * @test
  */
 public function setAuthorizeThrowsUnexpectedValue()
 {
     $this->setExpectedException(\UnexpectedValueException::class);
     $this->transaction->setAuthorize(-1);
 }