Skip to content

Commit

Permalink
Merge branch 'task#98'
Browse files Browse the repository at this point in the history
  • Loading branch information
camaxtly committed Mar 25, 2018
2 parents b7f0a16 + a199411 commit b9b7145
Show file tree
Hide file tree
Showing 5 changed files with 493 additions and 28 deletions.
149 changes: 131 additions & 18 deletions src/classes/crm/invoice/invoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,33 +19,61 @@ class Invoice extends Bitrix24Entity

/**
* Get list of lead items.
*
* @link http://dev.1c-bitrix.ru/rest_help/crm/invoice/crm_invoice_list.php
* @param array $order - order of task items
* @param array $filter - filter array
* @param array $select - array of collumns to select
* @param integer $start - entity number to start from (usually returned in 'next' field of previous 'crm.invoice.list' API call)
*
* @param array $order - order of task items
* @param array $filter - filter array
* @param array $select - array of collumns to select
* @param integer $start - entity number to start from (usually returned in 'next' field of previous 'crm.invoice.list' API call)
*
* @return array
* @throws \Bitrix24\Exceptions\Bitrix24ApiException
* @throws \Bitrix24\Exceptions\Bitrix24EmptyResponseException
* @throws \Bitrix24\Exceptions\Bitrix24Exception
* @throws \Bitrix24\Exceptions\Bitrix24IoException
* @throws \Bitrix24\Exceptions\Bitrix24MethodNotFoundException
* @throws \Bitrix24\Exceptions\Bitrix24PaymentRequiredException
* @throws \Bitrix24\Exceptions\Bitrix24PortalDeletedException
* @throws \Bitrix24\Exceptions\Bitrix24PortalRenamedException
* @throws \Bitrix24\Exceptions\Bitrix24SecurityException
* @throws \Bitrix24\Exceptions\Bitrix24TokenIsExpiredException
* @throws \Bitrix24\Exceptions\Bitrix24TokenIsInvalidException
* @throws \Bitrix24\Exceptions\Bitrix24WrongClientException
*/
public function getList($order = array(), $filter = array(), $select = array(), $start = 0)
{
$fullResult = $this->client->call(
'crm.invoice.list',
array(
'order' => $order,
'filter'=> $filter,
'select'=> $select,
'start' => $start
'order' => $order,
'filter' => $filter,
'select' => $select,
'start' => $start
)
);
return $fullResult;
}

/**
* get invoice by id
* @var $invoiceId integer invoice identifier
*
* @link http://dev.1c-bitrix.ru/rest_help/crm/invoice/crm_invoice_get.php
* @var $invoiceId integer invoice identifier
* @return array
*/
* @throws \Bitrix24\Exceptions\Bitrix24ApiException
* @throws \Bitrix24\Exceptions\Bitrix24EmptyResponseException
* @throws \Bitrix24\Exceptions\Bitrix24Exception
* @throws \Bitrix24\Exceptions\Bitrix24IoException
* @throws \Bitrix24\Exceptions\Bitrix24MethodNotFoundException
* @throws \Bitrix24\Exceptions\Bitrix24PaymentRequiredException
* @throws \Bitrix24\Exceptions\Bitrix24PortalDeletedException
* @throws \Bitrix24\Exceptions\Bitrix24PortalRenamedException
* @throws \Bitrix24\Exceptions\Bitrix24SecurityException
* @throws \Bitrix24\Exceptions\Bitrix24TokenIsExpiredException
* @throws \Bitrix24\Exceptions\Bitrix24TokenIsInvalidException
* @throws \Bitrix24\Exceptions\Bitrix24WrongClientException
*/
public function get($invoiceId)
{
$fullResult = $this->client->call(
Expand All @@ -57,10 +85,23 @@ public function get($invoiceId)

/**
* delete invoice by id
* @var $invoiceId integer invoice identifier
*
* @link http://dev.1c-bitrix.ru/rest_help/crm/invoice/crm_invoice_delete.php
* @var $invoiceId integer invoice identifier
* @return array
*/
* @throws \Bitrix24\Exceptions\Bitrix24ApiException
* @throws \Bitrix24\Exceptions\Bitrix24EmptyResponseException
* @throws \Bitrix24\Exceptions\Bitrix24Exception
* @throws \Bitrix24\Exceptions\Bitrix24IoException
* @throws \Bitrix24\Exceptions\Bitrix24MethodNotFoundException
* @throws \Bitrix24\Exceptions\Bitrix24PaymentRequiredException
* @throws \Bitrix24\Exceptions\Bitrix24PortalDeletedException
* @throws \Bitrix24\Exceptions\Bitrix24PortalRenamedException
* @throws \Bitrix24\Exceptions\Bitrix24SecurityException
* @throws \Bitrix24\Exceptions\Bitrix24TokenIsExpiredException
* @throws \Bitrix24\Exceptions\Bitrix24TokenIsInvalidException
* @throws \Bitrix24\Exceptions\Bitrix24WrongClientException
*/
public function delete($invoiceId)
{
$fullResult = $this->client->call(
Expand All @@ -72,10 +113,24 @@ public function delete($invoiceId)

/**
* Add a new invoice to CRM
*
* @param array $fields array of fields
* @link http://dev.1c-bitrix.ru/rest_help/crm/invoice/crm_invoice_add.php
*
* @return array
*/
* @throws \Bitrix24\Exceptions\Bitrix24ApiException
* @throws \Bitrix24\Exceptions\Bitrix24EmptyResponseException
* @throws \Bitrix24\Exceptions\Bitrix24Exception
* @throws \Bitrix24\Exceptions\Bitrix24IoException
* @throws \Bitrix24\Exceptions\Bitrix24MethodNotFoundException
* @throws \Bitrix24\Exceptions\Bitrix24PaymentRequiredException
* @throws \Bitrix24\Exceptions\Bitrix24PortalDeletedException
* @throws \Bitrix24\Exceptions\Bitrix24PortalRenamedException
* @throws \Bitrix24\Exceptions\Bitrix24SecurityException
* @throws \Bitrix24\Exceptions\Bitrix24TokenIsExpiredException
* @throws \Bitrix24\Exceptions\Bitrix24TokenIsInvalidException
* @throws \Bitrix24\Exceptions\Bitrix24WrongClientException
* @link http://dev.1c-bitrix.ru/rest_help/crm/invoice/crm_invoice_add.php
*/
public function add($fields = array())
{
$fullResult = $this->client->call(
Expand All @@ -87,11 +142,26 @@ public function add($fields = array())

/**
* update invoice by id
* @var $invoiceId integer invoice identifier
* @var $invoiceFields array invoice fields to update
*
* @link http://dev.1c-bitrix.ru/rest_help/crm/invoice/crm_invoice_update.php
*
* @param $invoiceId
* @param $invoiceFields
*
* @return array
*/
* @throws \Bitrix24\Exceptions\Bitrix24ApiException
* @throws \Bitrix24\Exceptions\Bitrix24EmptyResponseException
* @throws \Bitrix24\Exceptions\Bitrix24Exception
* @throws \Bitrix24\Exceptions\Bitrix24IoException
* @throws \Bitrix24\Exceptions\Bitrix24MethodNotFoundException
* @throws \Bitrix24\Exceptions\Bitrix24PaymentRequiredException
* @throws \Bitrix24\Exceptions\Bitrix24PortalDeletedException
* @throws \Bitrix24\Exceptions\Bitrix24PortalRenamedException
* @throws \Bitrix24\Exceptions\Bitrix24SecurityException
* @throws \Bitrix24\Exceptions\Bitrix24TokenIsExpiredException
* @throws \Bitrix24\Exceptions\Bitrix24TokenIsInvalidException
* @throws \Bitrix24\Exceptions\Bitrix24WrongClientException
*/
public function update($invoiceId, $invoiceFields)
{
$fullResult = $this->client->call(
Expand All @@ -106,14 +176,57 @@ public function update($invoiceId, $invoiceFields)

/**
* get list of invoice fields with description
*
* @link http://dev.1c-bitrix.ru/rest_help/crm/invoice/crm_invoice_fields.php
* @return array
*/
* @throws \Bitrix24\Exceptions\Bitrix24ApiException
* @throws \Bitrix24\Exceptions\Bitrix24EmptyResponseException
* @throws \Bitrix24\Exceptions\Bitrix24Exception
* @throws \Bitrix24\Exceptions\Bitrix24IoException
* @throws \Bitrix24\Exceptions\Bitrix24MethodNotFoundException
* @throws \Bitrix24\Exceptions\Bitrix24PaymentRequiredException
* @throws \Bitrix24\Exceptions\Bitrix24PortalDeletedException
* @throws \Bitrix24\Exceptions\Bitrix24PortalRenamedException
* @throws \Bitrix24\Exceptions\Bitrix24SecurityException
* @throws \Bitrix24\Exceptions\Bitrix24TokenIsExpiredException
* @throws \Bitrix24\Exceptions\Bitrix24TokenIsInvalidException
* @throws \Bitrix24\Exceptions\Bitrix24WrongClientException
*/
public function fields()
{
$fullResult = $this->client->call(
'crm.invoice.fields'
);
return $fullResult;
}

/**
* get external link for invoice
*
* @param $id
*
* @return array
* @throws \Bitrix24\Exceptions\Bitrix24ApiException
* @throws \Bitrix24\Exceptions\Bitrix24EmptyResponseException
* @throws \Bitrix24\Exceptions\Bitrix24Exception
* @throws \Bitrix24\Exceptions\Bitrix24IoException
* @throws \Bitrix24\Exceptions\Bitrix24MethodNotFoundException
* @throws \Bitrix24\Exceptions\Bitrix24PaymentRequiredException
* @throws \Bitrix24\Exceptions\Bitrix24PortalDeletedException
* @throws \Bitrix24\Exceptions\Bitrix24PortalRenamedException
* @throws \Bitrix24\Exceptions\Bitrix24SecurityException
* @throws \Bitrix24\Exceptions\Bitrix24TokenIsExpiredException
* @throws \Bitrix24\Exceptions\Bitrix24TokenIsInvalidException
* @throws \Bitrix24\Exceptions\Bitrix24WrongClientException
*/
public function getExternalLink($id)
{
$fullResult = $this->client->call(
'crm.invoice.getexternallink',
array(
'id' => $id
)
);
return $fullResult;
}
}
75 changes: 75 additions & 0 deletions src/classes/crm/invoice/paysystem.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?php

namespace Bitrix24\CRM\Invoice;

use Bitrix24\Bitrix24Entity;

/**
* Class PaySystem
*/
class PaySystem extends Bitrix24Entity
{
/**
* @link https://dev.1c-bitrix.ru/rest_help/crm/invoice/crm_paysystem_list.php
*
* @param array $order - order of task items
* @param array $filter - filter array
*
* @return array
*
* @throws \Bitrix24\Exceptions\Bitrix24ApiException
* @throws \Bitrix24\Exceptions\Bitrix24EmptyResponseException
* @throws \Bitrix24\Exceptions\Bitrix24Exception
* @throws \Bitrix24\Exceptions\Bitrix24IoException
* @throws \Bitrix24\Exceptions\Bitrix24MethodNotFoundException
* @throws \Bitrix24\Exceptions\Bitrix24PaymentRequiredException
* @throws \Bitrix24\Exceptions\Bitrix24PortalDeletedException
* @throws \Bitrix24\Exceptions\Bitrix24PortalRenamedException
* @throws \Bitrix24\Exceptions\Bitrix24SecurityException
* @throws \Bitrix24\Exceptions\Bitrix24TokenIsExpiredException
* @throws \Bitrix24\Exceptions\Bitrix24TokenIsInvalidException
* @throws \Bitrix24\Exceptions\Bitrix24WrongClientException
*/
public function getList($order = array(), $filter = array())
{
$fullResult = $this->client->call(
'crm.paysystem.list',
array(
'order' => $order,
'filter' => $filter,
)
);

return $fullResult;
}


/**
* @link https://dev.1c-bitrix.ru/rest_help/crm/invoice/crm_paysystem_fields.php
*
* @return array
*
* @throws \Bitrix24\Exceptions\Bitrix24ApiException
* @throws \Bitrix24\Exceptions\Bitrix24EmptyResponseException
* @throws \Bitrix24\Exceptions\Bitrix24Exception
* @throws \Bitrix24\Exceptions\Bitrix24IoException
* @throws \Bitrix24\Exceptions\Bitrix24MethodNotFoundException
* @throws \Bitrix24\Exceptions\Bitrix24PaymentRequiredException
* @throws \Bitrix24\Exceptions\Bitrix24PortalDeletedException
* @throws \Bitrix24\Exceptions\Bitrix24PortalRenamedException
* @throws \Bitrix24\Exceptions\Bitrix24SecurityException
* @throws \Bitrix24\Exceptions\Bitrix24TokenIsExpiredException
* @throws \Bitrix24\Exceptions\Bitrix24TokenIsInvalidException
* @throws \Bitrix24\Exceptions\Bitrix24WrongClientException
*
*/
public function fields()
{
$fullResult = $this->client->call(
'crm.paysystem.fields',
array()
);

return $fullResult;
}
}
75 changes: 75 additions & 0 deletions src/classes/crm/invoice/persontype.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?php

namespace Bitrix24\CRM\Invoice;

use Bitrix24\Bitrix24Entity;

/**
* Class PersonType
*/
class PersonType extends Bitrix24Entity
{
/**
* @link https://dev.1c-bitrix.ru/rest_help/crm/invoice/crm_persontype_list.php
*
* @param array $order - order of task items
* @param array $filter - filter array
*
* @return array
*
* @throws \Bitrix24\Exceptions\Bitrix24ApiException
* @throws \Bitrix24\Exceptions\Bitrix24EmptyResponseException
* @throws \Bitrix24\Exceptions\Bitrix24Exception
* @throws \Bitrix24\Exceptions\Bitrix24IoException
* @throws \Bitrix24\Exceptions\Bitrix24MethodNotFoundException
* @throws \Bitrix24\Exceptions\Bitrix24PaymentRequiredException
* @throws \Bitrix24\Exceptions\Bitrix24PortalDeletedException
* @throws \Bitrix24\Exceptions\Bitrix24PortalRenamedException
* @throws \Bitrix24\Exceptions\Bitrix24SecurityException
* @throws \Bitrix24\Exceptions\Bitrix24TokenIsExpiredException
* @throws \Bitrix24\Exceptions\Bitrix24TokenIsInvalidException
* @throws \Bitrix24\Exceptions\Bitrix24WrongClientException
*/
public function getList($order = array(), $filter = array())
{
$fullResult = $this->client->call(
'crm.persontype.list',
array(
'order' => $order,
'filter' => $filter,
)
);

return $fullResult;
}


/**
* @link https://dev.1c-bitrix.ru/rest_help/crm/invoice/crm_persontype_fields.php
*
* @return array
*
* @throws \Bitrix24\Exceptions\Bitrix24ApiException
* @throws \Bitrix24\Exceptions\Bitrix24EmptyResponseException
* @throws \Bitrix24\Exceptions\Bitrix24Exception
* @throws \Bitrix24\Exceptions\Bitrix24IoException
* @throws \Bitrix24\Exceptions\Bitrix24MethodNotFoundException
* @throws \Bitrix24\Exceptions\Bitrix24PaymentRequiredException
* @throws \Bitrix24\Exceptions\Bitrix24PortalDeletedException
* @throws \Bitrix24\Exceptions\Bitrix24PortalRenamedException
* @throws \Bitrix24\Exceptions\Bitrix24SecurityException
* @throws \Bitrix24\Exceptions\Bitrix24TokenIsExpiredException
* @throws \Bitrix24\Exceptions\Bitrix24TokenIsInvalidException
* @throws \Bitrix24\Exceptions\Bitrix24WrongClientException
*
*/
public function fields()
{
$fullResult = $this->client->call(
'crm.persontype.fields',
array()
);

return $fullResult;
}
}
Loading

0 comments on commit b9b7145

Please sign in to comment.