Version 5.0.0 beta 1
This commit is contained in:
1 parent
25ddeb65d6
commit
15c7beabc5
6736 files changed
+627902
-497943
No files matched your search
@@ -12,26 +12,31 @@
|
||||
namespace IPS\nexus\Invoice\Item;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
use IPS\Member;
|
||||
use IPS\nexus\Tax;
|
||||
use function defined;
|
||||
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
header( ( $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tax Item
|
||||
*/
|
||||
class _TaxItem
|
||||
class TaxItem
|
||||
{
|
||||
/**
|
||||
* @brief Class ID
|
||||
*/
|
||||
protected $class;
|
||||
protected int $class;
|
||||
|
||||
/**
|
||||
* @brief Data
|
||||
*/
|
||||
protected $data;
|
||||
protected array $data;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@@ -40,7 +45,7 @@ class _TaxItem
|
||||
* @param array $data Data
|
||||
* @return void
|
||||
*/
|
||||
public function __construct( $class, $data )
|
||||
public function __construct( int $class, array $data )
|
||||
{
|
||||
$this->class = $class;
|
||||
$this->data = $data;
|
||||
@@ -49,16 +54,16 @@ class _TaxItem
|
||||
/**
|
||||
* Get output for API
|
||||
*
|
||||
* @param \IPS\Member|NULL $authorizedMember The member making the API request or NULL for API Key / client_credentials
|
||||
* @param Member|NULL $authorizedMember The member making the API request or NULL for API Key / client_credentials
|
||||
* @return array
|
||||
* @apiresponse \IPS\nexus\Tax class The tax class
|
||||
* @apiresponse float rate The rate (for example 0.2 means 20%)
|
||||
* @apiresponse \IPS\nexus\Money amount Amount to pay
|
||||
*/
|
||||
public function apiOutput( \IPS\Member $authorizedMember = NULL )
|
||||
public function apiOutput( Member $authorizedMember = NULL ): array
|
||||
{
|
||||
return array(
|
||||
'class' => \IPS\nexus\Tax::load( $this->class )->apiOutput( $authorizedMember ),
|
||||
'class' => Tax::load( $this->class )->apiOutput( $authorizedMember ),
|
||||
'rate' => $this->data['rate'],
|
||||
'amount' => $this->data['amount']
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user