Process Look Up a Mandates
@param \Paysafe\CustomerVault\Mandate $mandates
@return \Paysafe\CustomerVault\Mandates
@throws PaysafeException
766996
public function getMandates(CustomerVault\Mandates $mandates) {
      
        $mandates->setRequiredFields(array(
             'id'
        ));
        $mandates->checkRequiredFields();
        $request = new Request(array(
              'method' => Request::GET,
              'uri' => $this->prepareURI("/profiles/" . $mandates->profileID."/mandates/".$mandates->id),
              'body' => $mandates
            ));
        $response = $this->client->processRequest($request);
        return new CustomerVault\Mandates($response);
        
    }
784519
public function createMandate(array $options = [], array $filters = [])
    {
        return $this->client->mandates->createFor($this, $options, $filters);
    }
606248
public function sendData($data)
    {
        $response = $this->gocardless->mandates()->reinstate($this->getMandateReference());

        return $this->response = new MandateResponse($this, $response);
    }
797206
public function Cancel($mandateId)
    {
        $mandate = new \MangoPay\Mandate();
        $mandate->Id = $mandateId;
        
        return $this->SaveObject('mandates_save', $mandate, '\MangoPay\Mandate');
    }
1059069
public function matching($constraint)
    {
        $this->constraint = $constraint;
        $this->queryBuilder->where($constraint);
        return $this;
    }
358908
public function deleteMandates(CustomerVault\Mandates $mandates) {
        $request = new Request(array(
             'method' => Request::DELETE,
             'uri' => $this->prepareURI("/profiles/" . $mandates->profileID."/mandates/".$mandates->id),
              'body' => $mandates
            ));
        $response = $this->client->processRequest($request);
        return $response;
        
    }
279984
public function mapPaymentToAuthorization(SpyPaymentPayone $paymentEntity, OrderTransfer $orderTransfer): AuthorizationContainerInterface
    {
        $authorizationContainer = new AuthorizationContainer();
        $authorizationContainer = $this->mapPaymentToAbstractAuthorization($paymentEntity, $authorizationContainer);
        $authorizationContainer = $this->mapEmail($paymentEntity, $authorizationContainer);
        $authorizationContainer = $this->mapBusinessRelation($authorizationContainer);
        $authorizationContainer->setAmount($orderTransfer->getTotals()->getGrandTotal());

        return $authorizationContainer;
    }
197289
public function mapPaymentToPreAuthorization(SpyPaymentPayone $paymentEntity): AuthorizationContainerInterface
    {
        $preAuthorizationContainer = new PreAuthorizationContainer();
        $preAuthorizationContainer = $this->mapPaymentToAbstractAuthorization($paymentEntity, $preAuthorizationContainer);
        $preAuthorizationContainer = $this->mapEmail($paymentEntity, $preAuthorizationContainer);
        $preAuthorizationContainer = $this->mapAmount($paymentEntity, $preAuthorizationContainer);
        $preAuthorizationContainer = $this->mapBusinessRelation($preAuthorizationContainer);

        return $preAuthorizationContainer;
    }
1134059
public static function requireDataPrivate($needed=self::ALL,
        $pdox=null, $session_object=null, $current_url=null, $request_data=null)
    {
        global $CFG, $TSUGI_LAUNCH;
        global $OUTPUT, $USER, $CONTEXT, $LINK, $RESULT, $ROSTER;

        if ( $request_data == null ) $request_data = self::oauth_parameters();

        $TSUGI_LAUNCH = new \Tsugi\Core\Launch();
        if ( isset($OUTPUT) && is_object($OUTPUT) && get_class($OUTPUT) == 'Tsugi\UI\Output' ) {
            $TSUGI_LAUNCH->output = $OUTPUT;
            $OUTPUT->launch = $TSUGI_LAUNCH;
        } else {
            $OUTPUT = new \Tsugi\UI\Output();
            $TSUGI_LAUNCH->output = $OUTPUT;
            $OUTPUT->launch = $TSUGI_LAUNCH;
        }

        $USER = null;
        $CONTEXT = null;
        $LINK = null;
        $RESULT = null;
        $ROSTER = null;

        // Make sure to initialize the global connection object
        if ( $pdox === null ) {
            $PDOX = self::getConnection();
        } else {
            $PDOX = $pdox;
        }
        $TSUGI_LAUNCH->pdox = $PDOX;

        $needed = self::patchNeeded($needed);

        // Check to see if this is LTI Launch Authorization Flow
        if ( self::launchAuthorizationFlow($request_data) ) return;

        // Check if we are processing an LTI launch.  If so, handle it
        $newlaunch = self::launchCheck($needed, $session_object, $request_data);
        $detail = $newlaunch;  // If we got a string back, save it
        $newlaunch = $newlaunch === true;   // A string is "false"

        // If launchCheck comes back with a true, it means someone above us
        // needs to do the redirect
        if ( $newlaunch ) {
            return $TSUGI_LAUNCH;
        }

        // Check to see if the session already exists.
        if ( $session_object === null ) {
            $sess = session_name();
            if ( ini_get('session.use_cookies') == '0' ) {
                if ( $newlaunch || isset($_POST[$sess]) || isset($_GET[$sess]) ) {
                    // We tried to set a session..
                } else {
                    self::send403();
                    $msg = 'This tool should be launched from a learning system using LTI';
                    if ( is_string($detail) ) $msg .= ". Detail: ".$detail;
                    self::abort_with_error_log($msg,
                        U::get($_SERVER, 'HTTP_REFERER', Net::getIP())
                    );
                }
            }

            // Start a session if it has not been started..
            if ( session_id() == "" ) {
                session_start();  // Should reassociate
            }
        }

        // This happens from time to time when someone closes and reopens a laptop
        // Or their computer goes to sleep and wakes back up hours later.
        // So it is just a warning - nothing much we can do except tell them.
        if ( count($needed) > 0 && self::wrapped_session_get($session_object, 'lti',null) === null ) {
            self::send403(); error_log('Session expired - please re-launch '.session_id());
            self::wrapped_session_flush($session_object);
            die('Session expired - please re-launch'); // with error_log
        }

        // Check the referrer...
        $trusted = $session_object != null || self::checkReferer() || self::checkCSRF();

        // Check to see if we switched browsers or IP addresses
        // TODO: Change these to warnings once we get more data
        $session_agent = self::wrapped_session_get($session_object, 'HTTP_USER_AGENT', null);
        if ( (!$trusted) && $session_agent != null ) {
            if ( (!isset($_SERVER['HTTP_USER_AGENT'])) ||
                $_SERVER['HTTP_USER_AGENT'] != $session_agent ) {
                self::send403();
                self::wrapped_session_flush($session_object);
                self::abort_with_error_log("Session has expired", " ".session_id()." HTTP_USER_AGENT ".
                    (($session_agent !== null ) ? $session_agent : 'Empty Session user agent') .
                    ' ::: '.
                    (isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : 'Empty browser user agent'),
                false,'DIE:');
            }
        }

        // We only check the first three octets as some systems wander through the addresses on
        // class C - Perhaps it is even NAT - who knows - but we forgive those on the same Class C
        $session_addr = self::wrapped_session_get($session_object, 'REMOTE_ADDR', null);
        $ipaddr = Net::getIP();
        if ( (!$trusted) &&  $session_addr && $ipaddr &&
            Net::isRoutable($session_addr) && Net::isRoutable($ipaddr) ) {
            $sess_pieces = explode('.',$session_addr);
            $serv_pieces = explode('.',$ipaddr);
            if ( count($sess_pieces) == 4 && count($serv_pieces) == 4 ) {
                if ( $sess_pieces[0] != $serv_pieces[0] || $sess_pieces[1] != $serv_pieces[1] ||
                    $sess_pieces[2] != $serv_pieces[2] ) {
                    self::send403();
                    self::abort_with_error_log('Session address has expired', " ".session_id()." session_addr=".
                        $session_addr.' current='.$ipaddr, 'DIE:');
                }
            }
        }

        // Check to see if the user has navigated to a new place in the hierarchy
        $session_script = self::wrapped_session_get($session_object, 'script_path', null);
        if ( $session_script !== null &&
            (! endsWith(Output::getUtilUrl(''), $CFG->getScriptPath()) ) &&
            (! startsWith('api', $CFG->getScriptPath()) ) &&
            strpos($CFG->getScriptPath(), $session_script ) !== 0 ) {
            self::send403();
            self::abort_with_error_log('Improper navigation detected', " ".session_id()." script_path ".
                $session_script.' /  '.$CFG->getScriptPath(), 'DIE:');
        }

        // Check to see if the session needs to be extended due to this request
        self::checkHeartBeat($session_object);

        // Restart the number of continuous heartbeats
        self::wrapped_session_put($session_object, 'HEARTBEAT_COUNT', 0);

        // We don't have any launch data and don't need it
        $LTI = self::wrapped_session_get($session_object, 'lti', null);
        if ( count($needed) == 0 && $LTI === null ) {
            return $TSUGI_LAUNCH;
        }

        if ( is_array($needed) ) {
            foreach ( $needed as $feature ) {
                if ( isset($LTI[$feature]) ) continue;
                self::abort_with_error_log("This tool requires an LTI launch parameter:".$feature);
            }
        }

        return self::buildLaunch($LTI, $session_object);
    }
263277
private function checkRequirement(
        array $pluginRequirements,
        string $installedName,
        string $installedVersion,
        RequirementExceptionStack $exceptionStack
    ): array {
        if (isset($pluginRequirements[$installedName])) {
            $constraint = $pluginRequirements[$installedName]->getConstraint();
            if ($constraint === null) {
                return $pluginRequirements;
            }

            if ($constraint->matches(new Constraint('==', $installedVersion)) === false) {
                $exceptionStack->add(
                    new VersionMismatchException($installedName, $constraint->getPrettyString(), $installedVersion)
                );
            }

            unset($pluginRequirements[$installedName]);
        }

        return $pluginRequirements;
    }
236756
public function setRequired($required)
    {
        if ($required) {
            $this->setAttribute('required', 'required');
        } else {
            $this->removeAttribute('required');
        }
        return parent::setRequired($required);
    }
989776
public function search($params)
    {
        $query = Payment::find();

        $query->orderBy(['id' => SORT_DESC]);

        $dataProvider = new ActiveDataProvider([
            'query' => $query,
        ]);

        $this->load($params);

        if (!$this->validate()) {
            // uncomment the following line if you do not want to return any records when validation fails
            // $query->where('0=1');
            return $dataProvider;
        }

        // grid filtering conditions
        $query->andFilterWhere([
            'user_id' => $this->user_id,
            'name' => $this->name,
            'money' => $this->money,
            'trade_type' => $this->trade_type,
            'trade_state' => $this->trade_state,
        ]);

        $query->andFilterWhere(['like', 'id', $this->id])
            ->andFilterWhere(['like', 'model_id', $this->model_id])
            ->andFilterWhere(['like', 'pay_id', $this->pay_id])
            ->andFilterWhere(['like', 'gateway', $this->gateway])
            ->andFilterWhere(['like', 'currency', $this->currency])
            ->andFilterWhere(['like', 'ip', $this->ip]);

        return $dataProvider;
    }
957251
public function mandatePdfs()
    {
        if (!isset($this->mandate_pdfs)) {
            $this->mandate_pdfs = new Services\MandatePdfsService($this->api_client);
        }

        return $this->mandate_pdfs;
    }
521622
public function validate($constraint=null)
    {
        if ($constraint === null || $constraint === true) {
            $this->shouldValidate = true;
            return $this;
        }

        if ($constraint === false) {
            $this->shouldValidate = false;
            return $this;
        }

        if ($constraint instanceof Validator) {
            $this->validator = $constraint;
            $this->shouldValidate = true;
            return $this;
        }

        if (is_array($constraint)) {
            $this->validationRules = $constraint;
            $this->shouldValidate = true;
            return $this;
        }

        throw new UnsupportedParameterException("Unsupported parameter type: " . Type::of($constraint));

    }
311471
public function revokeMandate($mandateId)
    {
        return $this->client->mandates->revokeFor($this, $mandateId, $this->getPresetOptions());
    }
143475
public function visitEnumConstraint(Generic\EnumConstraint $constraint)
    {
        $value = $this->currentValue();
        foreach ($constraint->values() as $enumValue) {
            if ($this->comparator()->equals($value, $enumValue)) {
                return $this->createResult();
            }
        }

        return $this->createSingleIssueResult($constraint);
    }
558652
public function create(Spy $spy = null): SpyVerifier
    {
        if (!$spy) {
            $spy = $this->spyFactory->create();
        }

        return new SpyVerifier(
            $spy,
            $this->matcherFactory,
            $this->matcherVerifier,
            $this->generatorVerifierFactory,
            $this->iterableVerifierFactory,
            $this->callVerifierFactory,
            $this->assertionRecorder,
            $this->assertionRenderer
        );
    }