tbusainvoicegen/api/v3/Invoicegen/Generate.php

30 lines
934 B
PHP

<?php
use CRM_Tbusainvoicegen_ExtensionUtil as E;
/**
* Invoicegen.Generate API specification (optional)
* This is used for documentation and validation.
*
* @param array $spec description of fields supported by this API call
* @return void
* @see http://wiki.civicrm.org/confluence/display/CRMDOC/API+Architecture+Standards
*/
function _civicrm_api3_invoicegen_Generate_spec(&$spec) {
$spec['contact_id']['api.required'] = 1;
$spec['billing_period']['api.required'] = 1;
}
/**
* Invoicegen.Generate API
*
* @param array $params
* @return array API result descriptor
* @see civicrm_api3_create_success
* @see civicrm_api3_create_error
* @throws API_Exception
*/
function civicrm_api3_invoicegen_Generate($params) {
$returnValues = CRM_Tbusainvoicegen_Timebank::generate($params['contact_id'], $params['billing_period']);
return civicrm_api3_create_success($returnValues, $params, 'Invoicegen', 'generate');
}