Version 4.1.19

This commit is contained in:
Neo committed 2025-12-19 05:38:56 -08:00
1 parent 28bd025b35
commit 2bd5025018
2674 files changed
+233518 -77766

No files matched your search

+89 -14
View File
@@ -2,9 +2,9 @@
/**
* @brief Gateway Node
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Nexus
* @since 10 Feb 2014
* @version SVN_VERSION_NUMBER
@@ -227,6 +227,24 @@ class _Gateway extends \IPS\Node\Model
return $return;
}
/**
* Get gateways that support billing agreements
*
* @return array
*/
public static function billingAgreementGateways()
{
$return = array();
foreach ( static::roots() as $gateway )
{
if ( $gateway->billingAgreements() )
{
$return[ $gateway->id ] = $gateway;
}
}
return $return;
}
/**
* [ActiveRecord] Save Changed Columns
*
@@ -245,7 +263,14 @@ class _Gateway extends \IPS\Node\Model
*/
public function delete()
{
/* Delete cards and billing agreements */
\IPS\Db::i()->delete( 'nexus_customer_cards', array( 'card_method=?', $this->id ) );
\IPS\Db::i()->delete( 'nexus_billing_agreements', array( 'ba_method=?', $this->id ) );
/* Delete */
parent::delete();
/* Recount how many gateways support cards */
static::recountCardStorageGateways();
}
@@ -256,9 +281,11 @@ class _Gateway extends \IPS\Node\Model
*/
protected static function recountCardStorageGateways()
{
$count = count( static::cardStorageGateways() );
\IPS\Db::i()->update( 'core_sys_conf_settings', array( 'conf_value' => $count ), array( 'conf_key=?', 'card_storage_gateways' ) );
\IPS\Settings::i()->card_storage_gateways = $count;
foreach ( array( 'card_storage_gateways' => count( static::cardStorageGateways() ), 'billing_agreement_gateways' => count( static::billingAgreementGateways() ) ) as $k => $v )
{
\IPS\Db::i()->update( 'core_sys_conf_settings', array( 'conf_value' => $v ), array( 'conf_key=?', $k ) );
\IPS\Settings::i()->$k = $v;
}
unset( \IPS\Data\Store::i()->settings );
}
@@ -270,15 +297,24 @@ class _Gateway extends \IPS\Node\Model
/**
* Check the gateway can process this...
*
* @param $amount \IPS\nexus\Money The amount
* @param $billingAddress \IPS\GeoLocation The billing address
* @param $amount \IPS\nexus\Money The amount
* @param $billingAddress \IPS\GeoLocation|NULL The billing address, which may be NULL if one if not provided
* @param $customer \IPS\nexus\Customer The customer (Default NULL value is for backwards compatibility - it should always be provided.)
* @param array $recurrings Details about recurring costs
* @return bool
*/
public function checkValidity( \IPS\nexus\Money $amount, \IPS\GeoLocation $billingAddress )
public function checkValidity( \IPS\nexus\Money $amount, \IPS\GeoLocation $billingAddress = NULL, \IPS\nexus\Customer $customer = NULL, $recurrings = array() )
{
if ( $this->countries and $this->countries !== '*' )
{
return in_array( $billingAddress->country, explode( ',', $this->countries ) );
if ( $billingAddress )
{
return in_array( $billingAddress->country, explode( ',', $this->countries ) );
}
else
{
return FALSE;
}
}
return TRUE;
@@ -304,6 +340,16 @@ class _Gateway extends \IPS\Node\Model
return FALSE;
}
/**
* Supports billing agreements?
*
* @return bool
*/
public function billingAgreements()
{
return FALSE;
}
/* !Payment Gateway */
/**
@@ -311,9 +357,11 @@ class _Gateway extends \IPS\Node\Model
*
* @param \IPS\nexus\Invoice $invoice Invoice
* @param \IPS\nexus\Money $amount The amount to pay now
* @param \IPS\Member $member The member the payment screen is for (if in the ACP charging to a member's card) or NULL for currently logged in member
* @param array $recurrings Details about recurring costs
* @return array
*/
public function paymentScreen( \IPS\nexus\Invoice $invoice, \IPS\nexus\Money $amount )
public function paymentScreen( \IPS\nexus\Invoice $invoice, \IPS\nexus\Money $amount, \IPS\Member $member = NULL, $recurrings = array() )
{
return array();
}
@@ -322,12 +370,13 @@ class _Gateway extends \IPS\Node\Model
* Authorize
*
* @param \IPS\nexus\Transaction $transaction Transaction
* @param array|\IPS\nexus\Customer\StoredCard $values Values from form OR a stored card object if this gateway supports them
* @param array|\IPS\nexus\Customer\CreditCard $values Values from form OR a stored card object if this gateway supports them
* @param \IPS\nexus\Fraud\MaxMind\Request|NULL $maxMind *If* MaxMind is enabled, the request object will be passed here so gateway can additional data before request is made
* @return \IPS\DateTime|NULL Auth is valid until or NULL to indicate auth is good forever
* @throws \LogicException Message will be displayed to user
* @param array $recurrings Details about recurring costs
* @return \IPS\DateTime|NULL Auth is valid until or NULL to indicate auth is good forever
* @throws \LogicException Message will be displayed to user
*/
public function auth( \IPS\nexus\Transaction $transaction, $values, \IPS\nexus\Fraud\MaxMind\Request $maxMind = NULL )
public function auth( \IPS\nexus\Transaction $transaction, $values, \IPS\nexus\Fraud\MaxMind\Request $maxMind = NULL, $recurrings = array() )
{
return NULL;
}
@@ -368,4 +417,30 @@ class _Gateway extends \IPS\Node\Model
{
throw new \Exception;
}
/**
* Extra data to show on the ACP transaction page
*
* @param \IPS\nexus\Transaction $transaction Transaction
* @return string
*/
public function extraData( \IPS\nexus\Transaction $transaction )
{
return '';
}
/**
* Get output for API
*
* @return array
* @apiresponse int id ID number
* @apiresponse string name Name
*/
public function apiOutput()
{
return array(
'id' => $this->id,
'name' => $this->_title
);
}
}