Version 4.7.0

This commit is contained in:
Neo committed 2025-12-19 16:00:35 -08:00
1 parent 517a5e1f70
commit 8ba7d43898
1933 files changed
+65613 -11332

No files matched your search

+50 -3
View File
@@ -183,7 +183,7 @@ class _Gateway extends \IPS\Node\Model
*/
public function form( &$form )
{
$form->add( new \IPS\Helpers\Form\Translatable( 'paymethod_name', NULL, TRUE, array( 'app' => 'nexus', 'key' => "nexus_paymethod_{$this->id}" ) ) );
$form->add( new \IPS\Helpers\Form\Translatable( 'paymethod_name', NULL, TRUE, array( 'app' => 'nexus', 'key' => $this->id ? "nexus_paymethod_{$this->id}" : NULL ) ) );
$this->settings( $form );
$form->add( new \IPS\Helpers\Form\Select( 'paymethod_countries', ( $this->id and $this->countries !== '*' ) ? explode( ',', $this->countries ) : '*', FALSE, array( 'options' => array_map( function( $val )
{
@@ -210,6 +210,8 @@ class _Gateway extends \IPS\Node\Model
$values['countries'] = \is_array( $values['paymethod_countries'] ) ? implode( ',', $values['paymethod_countries'] ) : $values['paymethod_countries'];
}
$values['validationfile'] = (string) $values['m_validationfile'];
$settings = array();
foreach ( $values as $k => $v )
{
@@ -217,7 +219,7 @@ class _Gateway extends \IPS\Node\Model
{
$settings[ mb_substr( $k, mb_strlen( $this->gateway ) + 1 ) ] = $v;
}
if( $k != "countries" )
if( $k != "countries" AND $k != 'validationfile' )
{
unset( $values[$k] );
}
@@ -360,6 +362,21 @@ class _Gateway extends \IPS\Node\Model
}
}
/**
* [Node] Dissalow gateways with validation files to be copyable ( the file can't /shouldn't be copied and reusing the existing value will delete the source file when the new copy is deleted )
*
* @return bool
*/
public function canCopy()
{
if ( $this->deleteOrMoveQueued() === TRUE )
{
return FALSE;
}
return ( !$this->validationfile );
}
/**
* [ActiveRecord] Delete
*
@@ -370,7 +387,14 @@ class _Gateway extends \IPS\Node\Model
/* 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 ) );
try
{
\IPS\File::get( 'nexus_Gateways', $this->validationfile )->delete();
}
catch( \Exception $ex ) { }
/* Delete */
parent::delete();
@@ -635,4 +659,27 @@ class _Gateway extends \IPS\Node\Model
'name' => $this->_title
);
}
/**
* Returns the Apple Pay domain verification file if there's one.
*
* @return void|null
*/
public static function getStripeAppleVerificationFile()
{
foreach ( static::roots() as $gateway )
{
if ( $gateway->gateway == 'Stripe' AND $gateway->validationfile )
{
try
{
return \IPS\File::get( 'nexus_Gateways', $gateway->validationfile );
}
catch ( \Exception $e )
{
return NULL;
}
}
}
}
}