Version 4.3.0

This commit is contained in:
Neo committed 2025-12-19 05:47:12 -08:00
1 parent 96997ddd8e
commit fe1acf984a
1349 files changed
+116159 -67711

No files matched your search

+23 -9
View File
@@ -24,14 +24,16 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
class _withdrawals extends \IPS\Api\Controller
{
/**
* GET /nexus/shipments
* Get list of shipments
* GET /nexus/withdrawals
* Get list of withdrawal requests
*
* @apiparam string customers Comma-delimited list of customer IDs - if provided, only invoices belonging to those customers are returned
* @note For requests using an OAuth Access Token for a particular member, only the members own withdrawal requests will be included
* @apiparam string customers Comma-delimited list of customer IDs - if provided, only invoices belonging to those customers are returned. Ignored for requests using an OAuth Access Token for a particular member
* @apiparam string statuses Comma-delimited list of statuses - if provided, only transactions with those statuses are returned - see payout object for status keys
* @apiparam string sortBy What to sort by. Can be 'date', 'completed' (for the date it was completed), 'amount' or do not specify for ID
* @apiparam string sortDir Sort direction. Can be 'asc' or 'desc' - defaults to 'asc'
* @apiparam int page Page number
* @apiparam int perPage Number of results per page - defaults to 25
* @return \IPS\Api\PaginatedResponse<IPS\nexus\Shipping\Order>
*/
public function GETindex()
@@ -40,7 +42,11 @@ class _withdrawals extends \IPS\Api\Controller
$where = array();
/* Customers */
if ( isset( \IPS\Request::i()->customers ) )
if ( $this->member )
{
$where[] = array( 'po_member=?', $this->member->member_id );
}
elseif ( isset( \IPS\Request::i()->customers ) )
{
$where[] = array( \IPS\Db::i()->in( 'po_member', array_map( 'intval', array_filter( explode( ',', \IPS\Request::i()->customers ) ) ) ) );
}
@@ -68,23 +74,31 @@ class _withdrawals extends \IPS\Api\Controller
\IPS\Db::i()->select( '*', 'nexus_payouts', $where, "{$sortBy} {$sortDir}" ),
isset( \IPS\Request::i()->page ) ? \IPS\Request::i()->page : 1,
'IPS\nexus\Payout`',
\IPS\Db::i()->select( 'COUNT(*)', 'nexus_payouts', $where )->first()
\IPS\Db::i()->select( 'COUNT(*)', 'nexus_payouts', $where )->first(),
$this->member,
isset( \IPS\Request::i()->perPage ) ? \IPS\Request::i()->perPage : NULL
);
}
/**
* GET /nexus/withdrawals/{id}
* Get information about a specific invoice
* Get information about a specific withdrawal request
*
* @param int $id ID Number
* @throws 2X307/1 INVALID_ID The withdrawal ID does not exist
* @throws 2X307/1 INVALID_ID The withdrawal ID does not exist or the authorized user does not have permission to view it
* @return \IPS\nexus\Payout
*/
public function GETitem( $id )
{
try
{
return new \IPS\Api\Response( 200, \IPS\nexus\Payout::load( $id )->apiOutput() );
{
$payout = \IPS\nexus\Payout::load( $id );
if ( $this->member and $this->member->member_id != $payout->member->member_id )
{
throw new \OutOfRangeException;
}
return new \IPS\Api\Response( 200, $payout->apiOutput( $this->member ) );
}
catch ( \OutOfRangeException $e )
{