forked from eileenmcnaughton/nz.co.fuzion.civixero
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add API4 to delete tracking category option
- Loading branch information
Showing
3 changed files
with
71 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
namespace Civi\Api4\Action\Xero; | ||
|
||
use CRM_Civixero_ExtensionUtil as E; | ||
|
||
/** | ||
* This API Action creates a payment. It is based on API3 Payment.create and API3 MJWPayment.create | ||
* | ||
*/ | ||
class TrackingCategoryDeleteOption extends \Civi\Api4\Generic\AbstractBatchAction { | ||
|
||
/** | ||
* Connector ID (default 0) | ||
* | ||
* @var int | ||
*/ | ||
protected int $connectorID = 0; | ||
|
||
/** | ||
* @var string The Xero Tracking Category ID | ||
*/ | ||
protected string $trackingCategoryID; | ||
|
||
/** | ||
* @var string The Tracking Category option ID | ||
*/ | ||
protected string $trackingOptionID; | ||
|
||
/** | ||
* | ||
* Note that the result class is that of the annotation below, not the h | ||
* in the method (which must match the parent class) | ||
* | ||
* @var \Civi\Api4\Generic\Result $result | ||
*/ | ||
public function _run(\Civi\Api4\Generic\Result $result) { | ||
$params = ['connector_id' => $this->connectorID]; | ||
$xero = new \CRM_Civixero_TrackingCategory($params); | ||
$trackingOption = $xero->deleteOption($this->trackingCategoryID, $this->trackingOptionID); | ||
$result->exchangeArray($trackingOption); | ||
return $result; | ||
} | ||
|
||
} |