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

@@ -622,7 +622,8 @@ class _checkout extends \IPS\Dispatcher\Controller
'spamData' => array( 'code' => $spamCode, 'action' => $spamAction ),
'guestTransactionKey' => \IPS\Request::i()->cookie['guestTransactionKey'],
'pbr' => $postBeforeRegister ? $postBeforeRegister['secret'] : NULL,
'referred_by' => isset( \IPS\Request::i()->cookie['referred_by'] ) ? \IPS\Request::i()->cookie['referred_by'] : NULL
'referred_by' => isset( \IPS\Request::i()->cookie['referred_by'] ) ? \IPS\Request::i()->cookie['referred_by'] : NULL,
'agreed_terms' => ( bool ) $values['reg_agreed_terms']
);
}
}
@@ -751,19 +752,6 @@ class _checkout extends \IPS\Dispatcher\Controller
{
if ( $success = $login->authenticate() )
{
/* Verify it's okay for this member to be buying those items */
try
{
foreach ( $this->invoice->items as $item )
{
$item->memberCanPurchase( $success->member );
}
}
catch ( \DomainException $e )
{
\IPS\Output::i()->error( $e->getMessage(), '1X196/B', 403, '' );
}
/* Process the login */
if ( $success->mfa() )
{
@@ -1168,10 +1156,23 @@ class _checkout extends \IPS\Dispatcher\Controller
\IPS\Output::i()->error( 'err_no_methods', '5X196/8', 500, '' );
}
/* Verify stock level one last time. It's possible someone added an item to their cart, then someone else did and checked out and the stock level is now 0. */
foreach ( $this->invoice->items as $item )
{
if( $item->appKey == 'nexus' AND $item->typeKey == 'package' )
/* Verify whether we're allowed to purchase this */
if( \IPS\Member::loggedIn()->member_id )
{
try
{
$item->memberCanPurchase( \IPS\Member::loggedIn() );
}
catch ( \DomainException $e )
{
\IPS\Output::i()->error( $e->getMessage(), '2X196/H', 403, '' );
}
}
/* Verify stock level one last time. It's possible someone added an item to their cart, then someone else did and checked out and the stock level is now 0. */
if( $item instanceof IPS\nexus\extensions\nexus\Item\Package )
{
$package = \IPS\nexus\Package::load( $item->id );
$data = $package->optionValuesStockAndPrice( $package->optionValues( $item->details ) );
@@ -1352,10 +1353,15 @@ class _checkout extends \IPS\Dispatcher\Controller
{
$paymentMethodOptions[ $k ] = $v->_title;
}
if ( $canUseAccountCredit and isset( \IPS\nexus\Customer::loggedIn()->cm_credits[ $this->invoice->currency ] ) and \IPS\nexus\Customer::loggedIn()->cm_credits[ $this->invoice->currency ]->amount->isGreaterThanZero() )
{
$paymentMethodOptions[0] = \IPS\Member::loggedIn()->language()->addToStack( 'account_credit_with_amount', FALSE, array( 'sprintf' => array( \IPS\nexus\Customer::loggedIn()->cm_credits[ $this->invoice->currency ] ) ) );
$paymentMethodsToggles[0][] = 'paymentMethodSubmit';
$credit = \IPS\nexus\Customer::loggedIn()->cm_credits[ $this->invoice->currency ]->amount;
if( $credit >= $amountToPay->amount or ( $amountToPay->amount->subtract( $credit ) > new \IPS\Math\Number( '0.50' ) ) )
{
$paymentMethodOptions[0] = \IPS\Member::loggedIn()->language()->addToStack( 'account_credit_with_amount', FALSE, array( 'sprintf' => array( \IPS\nexus\Customer::loggedIn()->cm_credits[ $this->invoice->currency ] ) ) );
$paymentMethodsToggles[0][] = 'paymentMethodSubmit';
}
}
if ( !$paymentMethodOptions )
@@ -1616,7 +1622,13 @@ class _checkout extends \IPS\Dispatcher\Controller
/* Check if there's anything still to pay */
if ( $this->invoice->amountToPay()->amount->isZero() )
{
{
/* Only mark paid if the invoice itself was worth zero */
if( $this->invoice->total->amount->isZero() )
{
$this->invoice->markPaid();
}
/* Redirect */
$destination = $this->invoice->return_uri ?: $this->invoice->url();
if ( \IPS\Member::loggedIn()->member_id )
@@ -1924,4 +1936,18 @@ class _checkout extends \IPS\Dispatcher\Controller
}
);
}
/**
* Virtual Stripe/Apple Domain Verification File
*
* @return void
*/
protected function appleVerification()
{
if( $file = \IPS\nexus\Gateway::getStripeAppleVerificationFile() )
{
\IPS\Output::i()->sendOutput( $file->contents(), 200, 'text/plain' );
}
\IPS\Output::i()->error( 'node_error', '2X196/5', 403, '' );
}
}