Version 4.7.23
This commit is contained in:
1 parent
7124a02564
commit
25ddeb65d6
1791 files changed
+76990
-44452
No files matched your search
@@ -1320,23 +1320,27 @@ class _checkout extends \IPS\Dispatcher\Controller
|
||||
$canUseAccountCredit = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/* Remove any payment methods that can't be used for this transaction */
|
||||
foreach ( $paymentMethods as $gateway )
|
||||
{
|
||||
if ( !$gateway->checkValidity( $amountToPay, $this->invoice->billaddress, \IPS\nexus\Customer::loggedIn()->member_id ? \IPS\nexus\Customer::loggedIn() : \IPS\nexus\Customer::constructFromData( $this->invoice->guest_data['member'] ), $recurrings ) )
|
||||
{
|
||||
unset( $paymentMethods[ $gateway->id ] );
|
||||
}
|
||||
}
|
||||
|
||||
/* Figure out which payment methods are available for card payments */
|
||||
$cardPaymentMethodIds = array_intersect( array_keys( $paymentMethods ), array_keys( \IPS\nexus\Gateway::cardStorageGateways() ) );
|
||||
|
||||
/* If there's something to pay, show a form for it... */
|
||||
$paymentType = NULL;
|
||||
$hiddenValues = array();
|
||||
$showSubmitButton = FALSE;
|
||||
if ( $amountToPay->amount->isGreaterThanZero() )
|
||||
{
|
||||
$paymentType = 'pay';
|
||||
|
||||
/* Remove any payment methods that can't be used for this transaction */
|
||||
foreach ( $paymentMethods as $gateway )
|
||||
{
|
||||
if ( !$gateway->checkValidity( $amountToPay, $this->invoice->billaddress, \IPS\nexus\Customer::loggedIn()->member_id ? \IPS\nexus\Customer::loggedIn() : \IPS\nexus\Customer::constructFromData( $this->invoice->guest_data['member'] ), $recurrings ) )
|
||||
{
|
||||
unset( $paymentMethods[ $gateway->id ] );
|
||||
}
|
||||
}
|
||||
|
||||
/* If we don't have any available payment methods, show an error */
|
||||
if ( \count( $paymentMethods ) === 0 and !$amountToPay->amount->isZero() )
|
||||
{
|
||||
@@ -1346,7 +1350,6 @@ class _checkout extends \IPS\Dispatcher\Controller
|
||||
/* Build form */
|
||||
$elements = array();
|
||||
$paymentMethodsToggles = array();
|
||||
$showSubmitButton = FALSE;
|
||||
foreach ( $paymentMethods as $gateway )
|
||||
{
|
||||
foreach ( $gateway->paymentScreen( $this->invoice, $amountToPay, NULL, $recurrings ) as $element )
|
||||
@@ -1388,7 +1391,7 @@ class _checkout extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
}
|
||||
/* If there's nothing to pay now, but there will be something to pay later... if we DON'T have any stored payment methods, we may be able to prompt the user to create one */
|
||||
elseif ( $recurrings and array_intersect( array_keys( $paymentMethods ), array_keys( \IPS\nexus\Gateway::cardStorageGateways() ) ) and !\IPS\Db::i()->select( 'COUNT(*)', 'nexus_customer_cards', array( 'card_member=?', \IPS\nexus\Customer::loggedIn()->member_id ) )->first() and $elements = \IPS\nexus\Customer\CreditCard::createFormElements( \IPS\nexus\Customer::loggedIn(), FALSE, $showSubmitButton, $hiddenValues ) )
|
||||
elseif ( $recurrings and $cardPaymentMethodIds and !\IPS\Db::i()->select( 'COUNT(*)', 'nexus_customer_cards', array( array( 'card_member=?', \IPS\nexus\Customer::loggedIn()->member_id ), array( \IPS\Db::i()->in( 'card_method', $cardPaymentMethodIds ) ) ) )->first() and $elements = \IPS\nexus\Customer\CreditCard::createFormElements( \IPS\nexus\Customer::loggedIn(), FALSE, $showSubmitButton, $hiddenValues, $cardPaymentMethodIds ) )
|
||||
{
|
||||
$paymentType = 'card';
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user