@param int    $id
@param int    $amount
@param string $reason

@return bool
439160
public function refund($id, $amount, $reason = null)
	{
		$data = new OrderUnitRefundTransfer();
		$data->amount = $amount;
		if (null !== $reason) {
			$data->reason = $reason;
		}

		$endpoint = new Refund($this->getTransport());
		$endpoint->setId($id);
		$endpoint->setTransfer($data);

		try {
			$result = $endpoint->performRequest();
		} catch (ResourceNotFoundException $e) {
			return false;
		}

		return $result['status'] == 204;
	}
1288246
public function suspendAccount($account, $reason = "", $info = "")
    {
        return $this->api->suspendAccount($this->getAccountId($account), $reason, $info);
    }
490439
public function removeFromSelection($id) {
        if($product = Product::get()->byID($id)) {
            $all = $this->getSelectionIDs();

            if(isset($all[$id])) {
                unset($all[$id]);
            }

            $this->setSelectionIDs($all);

            return true;
        }

        return null;
    }
109784
public function resolve(ContainerInterface $container, $id, $definition)
    {
        $definition = substr($definition, 1);
        if ($container->has($definition)) {
            return $container->get($definition);
        }

        return false;
    }
600195
public function clearList($id, $confirm)
    {
        return $this->getFactory()->createResult(
            $this->getApi()->clearList($id, (bool) $confirm)
        );
    }
1163325
public function increment($column, $amount = 1, array $extra = [])
    {
        $result = $this->getBuilder()->increment($column, $amount, $extra);

        // Reset query builder
        $this->resetBuilder();

        return (int) $result;
    }
545795
function _doRefund($oID, $amount = 0) {
    global $db, $messageStack;
    $_POST['refamt'] = preg_replace('/[^0-9.%]/', '', $_POST['refamt']);
    $new_order_status = (int)MODULE_PAYMENT_LINKPOINT_API_REFUNDED_ORDER_STATUS_ID;
    if ($new_order_status == 0) $new_order_status = 1;
    $proceedToRefund = true;
    $refundNote = strip_tags(zen_db_input($_POST['refnote']));
    if (isset($_POST['refconfirm']) && $_POST['refconfirm'] != 'on') {
      $messageStack->add_session(MODULE_PAYMENT_LINKPOINT_API_TEXT_REFUND_CONFIRM_ERROR, 'error');
      $proceedToRefund = false;
    }
    if (isset($_POST['buttonrefund']) && $_POST['buttonrefund'] == MODULE_PAYMENT_LINKPOINT_API_ENTRY_REFUND_BUTTON_TEXT) {
      $refundAmt = (float)$_POST['refamt'];
      $new_order_status = (int)MODULE_PAYMENT_LINKPOINT_API_REFUNDED_ORDER_STATUS_ID;
      if ($refundAmt == 0) {
        $messageStack->add_session(MODULE_PAYMENT_LINKPOINT_API_TEXT_INVALID_REFUND_AMOUNT, 'error');
        $proceedToRefund = false;
      }
    }
    if (isset($_POST['cc_number']) && (int)trim($_POST['cc_number']) == 0) {
      $messageStack->add_session(MODULE_PAYMENT_LINKPOINT_API_TEXT_CC_NUM_REQUIRED_ERROR, 'error');
    }
    if (isset($_POST['trans_id']) && (int)trim($_POST['trans_id']) == 0) {
      $messageStack->add_session(MODULE_PAYMENT_LINKPOINT_API_TEXT_TRANS_ID_REQUIRED_ERROR, 'error');
      $proceedToRefund = false;
    }

    $sql = "select lp_trans_num, transaction_time from " . TABLE_LINKPOINT_API . " where order_id = " . (int)$oID . " and transaction_result = 'APPROVED' order by transaction_time DESC";
    $query = $db->Execute($sql);
    if ($query->RecordCount() < 1) {
      $messageStack->add_session(MODULE_PAYMENT_LINKPOINT_API_TEXT_NO_MATCHING_ORDER_FOUND, 'error');
      $proceedToRefund = false;
    }
    /**
     * Submit refund request to gateway
     */
    if ($proceedToRefund) {
      unset($myorder);
      $myorder["ordertype"] = 'CREDIT';
      $myorder["oid"] = $query->fields['lp_trans_num'];
      if ($_POST['trans_id'] != '') $myorder["tdate"] = $_POST['trans_id'];
      $myorder["chargetotal"] = number_format($refundAmt, 2, '.', '');
      $myorder["comments"]  = htmlentities($refundNote, ENT_QUOTES, 'UTF-8');

      $result = $this->_sendRequest($myorder);
      $response_alert = $result['r_approved'] . ' ' . $result['r_error'] . ($this->commError == '' ? '' : ' Communications Error - Please notify webmaster.');
      $this->reportable_submit_data['Note'] = $refundNote;
      $failure = ($result["r_approved"] != "APPROVED");
      if ($failure) {
        $messageStack->add_session($response_alert, 'error');
      } else {
        // Success, so save the results
        $this->_updateOrderStatus($oID, $new_order_status, 'REFUND INITIATED. Order ID:' . $result['r_ordernum'] . ' - ' . 'Trans ID: ' . $result['r_tdate'] . "\n" . 'Amount: ' . $myorder["chargetotal"] . "\n" . $refundNote);
        $messageStack->add_session(sprintf(MODULE_PAYMENT_LINKPOINT_API_TEXT_REFUND_INITIATED, $result['r_tdate'], $result['r_ordernum']), 'success');
        return true;
      }
    }
    return false;
  }
1110357
public function isValidCurrencyId($id) {
        $this->sError = FALSE;

        if (!$this->getCurrencyId2Code($id)) {
            $this->sError = 'Incorect currency id: ' . $id;
            return FALSE;
        }

        return TRUE;
    }
1105596
public function put($id = null, $data = array())
    {

        $args = func_get_args();
        if(count($args) == 2){
            $args = $id;
        }else{
            $data = array_pop($args);
        }

        try {
            $this->client->request($this, 'put', $args, $data);
        } catch(Exception $ex) {
            $this->dispatchException($ex);
        }

        return true;
    }
165321
public function inc(string $key, int $amount=1): int
  {
    $success = false;
    $value = apcu_inc( $key, $amount, $success);

    return ( $success ? $value : false );
  }
787936
public function unblock( $reason = null, $id = null ) {
		global $pgNotag, $pgTag;
		if( !in_array( 'block', $this->wiki->get_userrights() ) ) {
			pecho( "User is not allowed to unblock users", PECHO_FATAL );
			return false;
		}

		$token = $this->wiki->get_tokens();

		if( !array_key_exists( 'block', $token ) ) return false;

		$apiArr = array(
			'action' => 'unblock',
			'user'   => $this->username,
			'token'  => $token['unblock'],
		);

		if( !is_null( $id ) ) {
			$apiArr['id'] = $id;
			unset( $apiArr['user'] );
		}
		if( !is_null( $reason ) ) {
			if( !$pgNotag ) $reason .= $pgTag;
			$apiArr['reason'] = $reason;
		}

		Hooks::runHook( 'StartUnblock', array( &$apiArr ) );

		pecho( "Unblocking {$this->username}...\n\n", PECHO_NOTICE );

		try{
			$this->preEditChecks( "Unblock" );
		} catch( EditError $e ){
			pecho( "Error: $e\n\n", PECHO_FATAL );
			return false;
		}

		$result = $this->wiki->apiQuery( $apiArr, true );

		if( isset( $result['unblock'] ) ) {
			if( isset( $result['unblock']['user'] ) ) {
				$this->__construct( $this->wiki, $this->username );
				return true;
			} else {
				pecho( "Unblock error...\n\n" . print_r( $result['unblock'], true ) . "\n\n", PECHO_FATAL );
				return false;
			}
		} else {
			pecho( "Unblock error...\n\n" . print_r( $result, true ), PECHO_FATAL );
			return false;
		}
	}
219949
public function addDnc($id, $channel = 'email', $reason = Contacts::MANUAL, $channelId = null, $comments = 'via API') {

        return $this->makeRequest(
            'contacts/'.$id.'/dnc/'.$channel.'/add',
            array(
                'reason'    => $reason,
                'channelId' => $channelId,
                'comments'  => $comments,
            ),
            'POST'
        );
    }
62041
public function useCoupon($id, $reference, $amount, $currency)
    {

        $command = $this->getCommand('useCoupon', [
            'coupon_id' => $id,
            'reference' => $reference,
            'amount'    => $amount,
            'currency'  => $currency
        ]);

        return $this->execute($command);

    }
1312212
public function updateStock($cardId, $amount)
    {
        if (!$amount) {
            return true;
        }

        $key = $amount > 0 ? 'increase_stock_value' : 'reduce_stock_value';

        $params = array(
            'card_id' => $cardId,
            $key => abs($amount),
        );

        return $this->http->jsonPost(self::API_UPDATE_STOCK, $params);
    }
791910
public function hasInitialized($id, $args = null) {
		if (isset($args[2])) {
			$args = func_get_args();
			array_shift($args);
		}
		
		return $this->getDefinition($id)->hasInitialized($args);
	}
1374540
public function deactivate($reason = 'other', $explanation = '')
    {
        $userId = $this->id();

        if ($userId === null) {
            return false;
        }

        $request = [
            'user_id'     => $userId,
            'reason'      => $reason,
            'explanation' => $explanation,
        ];

        return $this->post(UrlBuilder::RESOURCE_DEACTIVATE_ACCOUNT, $request);
    }
134578
public function getPayment($userId, $monetaryAccountId, $id)
    {
        $paymentResponse = $this->client->get($this->getResourceEndpoint($userId, $monetaryAccountId) . '/' . (int)$id);

        $payment = $paymentResponse['Response'][0]['Payment'];

        $payment['amount']['value'] = $this->floatToCents($payment['amount']['value']);

        return $payment;
    }