Enable a payment method for this profile.

@param string $methodId
@param array $data
@return Method
@throws ApiException
2573
public function enableMethod($methodId, array $data = [])
    {
        return $this->client->profileMethods->createFor($this, $methodId, $data);
    }
907976
public static function create(
        int $paymentId,
        int $monetaryAccountId = null,
        string $content = null,
        array $customHeaders = []
    ): BunqResponseInt {
        $apiClient = new ApiClient(static::getApiContext());
        $responseRaw = $apiClient->post(
            vsprintf(
                self::ENDPOINT_URL_CREATE,
                [static::determineUserId(), static::determineMonetaryAccountId($monetaryAccountId), $paymentId]
            ),
            [self::FIELD_CONTENT => $content],
            $customHeaders
        );

        return BunqResponseInt::castFromBunqResponse(
            static::processForId($responseRaw)
        );
    }
576018
public function patch($api, $id, array $data = [])
    {
        return $this->checkException($this->callHttpMethod($this->normalizeUri($api, $id), Request::METHOD_PATCH, $data));
    }
329671
public function editPermission(array $data = [], $id = null)
    {
        if (!empty($id)) {
            $data['id'] = $id;
        }
        try{
            return $this->createPermission($data);
        } catch (Exception $e) {
            throw new Exception($e->getMessage());
        }
    }
552260
public static function createFromData(array $data): self
    {
        if (!isset($data['method'])) {
            throw new DomainException(self::REQUIRED_METHOD);
        }

        switch ($data['method']) {
            case self::METHOD_ACCOUNT_WEIGHTS:
                $instruction = new AccountWeights($data);

                break;
            case self::METHOD_ACQUIRER_WEIGHTS:
                $instruction = new AcquirerWeights($data);

                break;
            default:
                throw new DomainException(
                    sprintf(self::UNEXPECTED_METHOD, implode(', ', self::methods()))
                );
        }

        return $instruction;
    }
1185381
@Override
  public Task<Void> enableApiKey(@NonNull final ObjectId id) {
    return dispatcher.dispatchTask(new Callable<Void>() {
      @Override
      public Void call() {
        enableApiKeyInternal(id);
        return null;
      }
    });
  }
51985
public static function getById($paymentId, $apiContext = null)
    {
        if (isset($apiContext)) {
            return Payment::get($paymentId, $apiContext);
        }
        return Payment::get($paymentId);
    }
280414
public function call($method, $data)
    {
        try {
            $response = $this->http->request('POST', $method, [
                'headers' => [
                    'X-Viber-Auth-Token' => $this->token
                ],
                'json' => $data
            ]);
            return \Viber\Api\Response::create($response);
        } catch (\RuntimeException $e) {
            throw new ApiException($e->getMessage(), $e->getCode(), $e);
        }
    }
18291
public function recordPayment(string $id, array $data, array $headers = [])
    {
        $url = $this->url('invoices/%s/record_payment', $id);

        return $this->post($url, $data, $headers);
    }
391144
public function create($data, $apiKeyId = null)
    {
        if (isset($apiKeyId)) {
            return $this->client()->put($data, 'api-keys/{apiKeyId}', ['apiKeyId' => $apiKeyId]);
        }

        return $this->client()->post($data, 'api-keys');
    }
907797
private Payment toPayment(final PaymentModelDao paymentModelDao, final boolean withPluginInfo, final boolean withAttempts, final Iterable<PluginProperty> properties, final TenantContext context, final InternalTenantContext tenantContext) throws PaymentApiException {
        final PaymentPluginApi plugin = getPaymentProviderPlugin(paymentModelDao.getPaymentMethodId(), true, tenantContext);
        final List<PaymentTransactionInfoPlugin> pluginTransactions = withPluginInfo ? getPaymentTransactionInfoPlugins(plugin, paymentModelDao, properties, context) : null;

        return toPayment(paymentModelDao, pluginTransactions, withAttempts, tenantContext);
    }
654594
public function update($api, $id, array $data = [])
    {
        return $this->checkException($this->callHttpMethod($this->normalizeUri($api, $id), Request::METHOD_PUT, $data));
    }
34776
public function create($payment, $paymentId = null)
    {
        if (isset($paymentId)) {
            return $this->client()->put($payment, 'payments/{paymentId}', ['paymentId' => $paymentId]);
        }

        return $this->client()->post($payment, 'payments');
    }
377853
public function beginTransaction($datasetId, Google_BeginTransactionRequest $postBody, $optParams = array()) {
      $params = array('datasetId' => $datasetId, 'postBody' => $postBody);
      $params = array_merge($params, $optParams);
      $data = $this->__call('beginTransaction', array($params));
      if ($this->useObjects()) {
        return new Google_BeginTransactionResponse($data);
      } else {
        return $data;
      }
    }
464531
public function update($id, array $data)
    {
        $data = $this->resolverFactory->createAppResolver()->resolve($data);

        return $this->api->request('PUT', '/apps/'.$id, [
            'Authorization' => 'Basic '.$this->api->getConfig()->getUserAuthKey(),
        ], json_encode($data));
    }
391196
public function initiate($data = array())
    {
        if ($this->payment->Status !== 'Created') {
            throw new InvalidStateException('Cannot authorize this payment. Status is not "Created"');
        }

        if (!$this->payment->isInDB()) {
            $this->payment->write();
        }

        $gateway = $this->oGateway();
        if (!$gateway->supportsAuthorize()) {
            throw new InvalidConfigurationException(
                sprintf('The gateway "%s" doesn\'t support authorize', $this->payment->Gateway)
            );
        }

        $gatewayData = $this->gatherGatewayData($data);

        $this->extend('onBeforeAuthorize', $gatewayData);
        $request = $this->oGateway()->authorize($gatewayData);
        $this->extend('onAfterAuthorize', $request);

        $this->createMessage(AuthorizeRequest::class, $request);

        try {
            $response = $this->response = $request->send();
        } catch (\Omnipay\Common\Exception\OmnipayException $e) {
            $this->createMessage(AuthorizeError::class, $e);
            // create an error response
            return $this->generateServiceResponse(ServiceResponse::SERVICE_ERROR);
        }

        ErrorHandling::safeExtend($this, 'onAfterSendAuthorize', $request, $response);

        $serviceResponse = $this->wrapOmnipayResponse($response);

        if ($serviceResponse->isRedirect() || $serviceResponse->isAwaitingNotification()) {
            $this->payment->Status = 'PendingAuthorization';
            $this->payment->write();

            $this->createMessage(
                $serviceResponse->isRedirect() ? AuthorizeRedirectResponse::class : AwaitingAuthorizeResponse::class,
                $response
            );
        } elseif ($serviceResponse->isError()) {
            $this->createMessage(AuthorizeError::class, $response);
        } else {
            $this->markCompleted('Authorized', $serviceResponse, $response);
        }

        return $serviceResponse;
    }
1151759
public function createRecurringPaymentsProfile($data, $token)
    {
        $this->post = $this->setRequestData($data)->merge([
            'TOKEN' => $token,
        ]);

        return $this->doPayPalRequest('CreateRecurringPaymentsProfile');
    }