Version 4.3.6
This commit is contained in:
1 parent
fe1acf984a
commit
1a0c7fd3c2
609 files changed
+14707
-5726
No files matched your search
@@ -291,7 +291,7 @@ class _view extends \IPS\Dispatcher\Controller
|
||||
'note_date' => time(),
|
||||
) );
|
||||
|
||||
\IPS\File::claimAttachments( "nexus-note-{$this->member->member_id}-new", $this->member->id, $noteId, 'note' );
|
||||
\IPS\File::claimAttachments( "nexus-note-{$this->member->member_id}-new", $this->member->member_id, $noteId, 'note' );
|
||||
|
||||
$this->member->log( 'note', 'added' );
|
||||
}
|
||||
@@ -434,6 +434,7 @@ class _view extends \IPS\Dispatcher\Controller
|
||||
*/
|
||||
public function addCard()
|
||||
{
|
||||
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'global_gateways.js', 'nexus', 'global' ) );
|
||||
$form = \IPS\nexus\Customer\CreditCard::create( $this->member );
|
||||
if ( $form instanceof \IPS\nexus\Customer\CreditCard )
|
||||
{
|
||||
@@ -619,7 +620,7 @@ class _view extends \IPS\Dispatcher\Controller
|
||||
'do' => 'void',
|
||||
'process' => 1,
|
||||
'trans' => $values['void_refund_transactions'],
|
||||
'ba' => $values['void_cancel_billing_agreements'],
|
||||
'ba' => isset( $values['void_cancel_billing_agreements'] ) ? $values['void_cancel_billing_agreements'] : FALSE ,
|
||||
'purch' => $values['void_cancel_purchases'],
|
||||
) ), function( $data ) use ( $member )
|
||||
{
|
||||
|
||||
@@ -55,11 +55,7 @@ class _checkoutsettings extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
$requireBillingOptions['domain'] = 'nexus_require_billing_domain';
|
||||
}
|
||||
|
||||
if ( \IPS\Settings::i()->nexus_subs_enabled and \IPS\Db::i()->select( 'COUNT(*)', 'nexus_member_subscription_packages' )->first() )
|
||||
{
|
||||
$requireBillingOptions['subscriptions'] = 'nexus_require_billing_subscriptions';
|
||||
}
|
||||
|
||||
$requireBillingOptions['other'] = 'nexus_require_billing_other';
|
||||
|
||||
$form = new \IPS\Helpers\Form;
|
||||
|
||||
@@ -397,6 +397,7 @@ class _invoices extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
|
||||
/* Display form */
|
||||
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'global_gateways.js', 'nexus', 'global' ) );
|
||||
return $form;
|
||||
}
|
||||
|
||||
@@ -583,12 +584,12 @@ class _invoices extends \IPS\Dispatcher\Controller
|
||||
/* What refund options are available? */
|
||||
$method = $transaction->method;
|
||||
$refundMethods = array();
|
||||
$refundMethodToggles = array( 'credit' => array( $transaction->id . '_refund_amount' ) );
|
||||
$refundMethodToggles = array( 'none' => array( $transaction->id . '_refund_reverse_credit' ) );
|
||||
$refundReasons = array();
|
||||
if ( $method and $method::SUPPORTS_REFUNDS )
|
||||
{
|
||||
$refundMethods['gateway'] = $method->_title;
|
||||
$refundMethodToggles['gateway'] = array();
|
||||
$refundMethods['gateway'] = 'transaction_refund';
|
||||
$refundMethodToggles['gateway'] = array( $transaction->id . '_refund_reverse_credit' );
|
||||
if ( $method::SUPPORTS_PARTIAL_REFUNDS )
|
||||
{
|
||||
$refundMethodToggles['gateway'][] = $transaction->id . '_refund_amount';
|
||||
@@ -598,7 +599,11 @@ class _invoices extends \IPS\Dispatcher\Controller
|
||||
$refundMethodToggles['gateway'][] = $transaction->id . '_refund_reason';
|
||||
}
|
||||
}
|
||||
$refundMethods['credit'] = 'refund_method_credit';
|
||||
if ( $transaction->credit->amount->compare( $transaction->amount->amount ) === -1 )
|
||||
{
|
||||
$refundMethods['credit'] = 'refund_method_credit';
|
||||
$refundMethodToggles['credit'][] = $transaction->id . '_refund_credit_amount';
|
||||
}
|
||||
$refundMethods['none'] = 'refund_method_none';
|
||||
|
||||
/* How do we want to refund? */
|
||||
@@ -613,9 +618,78 @@ class _invoices extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
|
||||
/* Partial refund? */
|
||||
$field = new \IPS\Helpers\Form\Number( $transaction->id . '_refund_amount', ( $transaction->status === \IPS\nexus\Transaction::STATUS_PART_REFUNDED ? (string) $transaction->amount->amount->subtract( $transaction->partial_refund->amount ) : 0 ), TRUE, array( 'unlimited' => 0, 'unlimitedLang' => \IPS\Member::loggedIn()->language()->addToStack( 'refund_full', FALSE, array( 'sprintf' => array( $transaction->amount ) ) ), 'max' => (string) $transaction->amount->amount->subtract( $transaction->partial_refund->amount ), 'decimals' => TRUE ), NULL, NULL, $transaction->amount->currency, $transaction->id . '_refund_amount' );
|
||||
$field->label = \IPS\Member::loggedIn()->language()->addToStack( 'refund_amount' );
|
||||
$form->add( $field );
|
||||
if ( $method and $method::SUPPORTS_REFUNDS and $method::SUPPORTS_PARTIAL_REFUNDS )
|
||||
{
|
||||
$field = new \IPS\Helpers\Form\Number( $transaction->id . '_refund_amount', 0, TRUE, array(
|
||||
'unlimited' => 0,
|
||||
'unlimitedLang' => (
|
||||
$transaction->partial_refund->amount->isGreaterThanZero()
|
||||
? \IPS\Member::loggedIn()->language()->addToStack( 'refund_full_remaining', FALSE, array( 'sprintf' => array(
|
||||
new \IPS\nexus\Money( $transaction->amount->amount->subtract( $transaction->partial_refund->amount ), $transaction->currency ) )
|
||||
) )
|
||||
: \IPS\Member::loggedIn()->language()->addToStack( 'refund_full', FALSE, array( 'sprintf' => array( $transaction->amount ) ) )
|
||||
),
|
||||
'max' => (string) $transaction->amount->amount->subtract( $transaction->partial_refund->amount ),
|
||||
'decimals' => TRUE
|
||||
), NULL, NULL, $transaction->amount->currency, $transaction->id . '_refund_amount' );
|
||||
$field->label = \IPS\Member::loggedIn()->language()->addToStack( 'refund_amount' );
|
||||
$form->add( $field );
|
||||
if ( $transaction->credit->amount->isGreaterThanZero() )
|
||||
{
|
||||
\IPS\Member::loggedIn()->language()->words[ $transaction->id . '_refund_amount_desc' ] = sprintf( \IPS\Member::loggedIn()->language()->get('refund_amount_descwarn'), $transaction->credit );
|
||||
}
|
||||
}
|
||||
if ( $transaction->credit->amount->compare( $transaction->amount->amount ) === -1 )
|
||||
{
|
||||
$field = new \IPS\Helpers\Form\Number( $transaction->id . '_refund_credit_amount', 0, TRUE, array(
|
||||
'unlimited' => 0,
|
||||
'unlimitedLang' => (
|
||||
$transaction->credit->amount->isGreaterThanZero()
|
||||
? \IPS\Member::loggedIn()->language()->addToStack( 'refund_full_remaining', FALSE, array( 'sprintf' => array(
|
||||
new \IPS\nexus\Money( $transaction->amount->amount->subtract( $transaction->credit->amount ), $transaction->currency ) )
|
||||
) )
|
||||
: \IPS\Member::loggedIn()->language()->addToStack( 'refund_full', FALSE, array( 'sprintf' => array( $transaction->amount ) ) )
|
||||
),
|
||||
'max' => (string) $transaction->amount->amount->subtract( $transaction->credit->amount ),
|
||||
'decimals' => TRUE
|
||||
), NULL, NULL, $transaction->amount->currency, $transaction->id . '_refund_credit_amount' );
|
||||
$field->label = \IPS\Member::loggedIn()->language()->addToStack( 'refund_credit_amount' );
|
||||
$form->add( $field );
|
||||
|
||||
if ( $transaction->partial_refund->amount->isGreaterThanZero() )
|
||||
{
|
||||
\IPS\Member::loggedIn()->language()->words[ $transaction->id . '_refund_credit_amount_desc' ] = sprintf( \IPS\Member::loggedIn()->language()->get('refund_credit_amount_descwarn'), $transaction->partial_refund );
|
||||
}
|
||||
}
|
||||
|
||||
/* Reverse credit? */
|
||||
if ( $transaction->credit->amount->isGreaterThanZero() )
|
||||
{
|
||||
$field = new \IPS\Helpers\Form\YesNo( $transaction->id . '_refund_reverse_credit', TRUE, TRUE, array( 'togglesOn' => array( "form_{$transaction->id}_refund_reverse_credit_warning" ) ), NULL, NULL, NULL, $transaction->id . '_refund_reverse_credit' );
|
||||
$field->label = \IPS\Member::loggedIn()->language()->addToStack( 'refund_reverse_credit', FALSE, array( 'sprintf' => array( $transaction->credit ) ) );
|
||||
\IPS\Member::loggedIn()->language()->words[ $transaction->id . '_refund_reverse_credit_desc' ] = \IPS\Member::loggedIn()->language()->addToStack( 'refund_reverse_credit_desc' );
|
||||
$form->add( $field );
|
||||
|
||||
$credits = $transaction->member->cm_credits;
|
||||
if ( $credits[ $transaction->amount->currency ]->amount->compare( $transaction->credit->amount ) === -1 )
|
||||
{
|
||||
\IPS\Member::loggedIn()->language()->words[ $transaction->id . '_refund_reverse_credit_warning' ] = \IPS\Member::loggedIn()->language()->addToStack( 'account_credit_remove_neg' );
|
||||
}
|
||||
}
|
||||
|
||||
/* Billing Agreement? */
|
||||
if ( $billingAgreement = $transaction->billing_agreement )
|
||||
{
|
||||
$field = new \IPS\Helpers\Form\YesNo( $transaction->id . '_refund_cancel_billing_agreement', TRUE, NULL, array( 'togglesOff' => array( "form_{$transaction->id}_refund_cancel_billing_agreement_warning" ) ) );
|
||||
$field->label = \IPS\Member::loggedIn()->language()->addToStack( 'refund_cancel_billing_agreement' );
|
||||
\IPS\Member::loggedIn()->language()->words[ $transaction->id . '_refund_cancel_billing_agreement_desc' ] = \IPS\Member::loggedIn()->language()->addToStack( 'refund_cancel_billing_agreement_desc' );
|
||||
if ( !\IPS\Db::i()->select( 'COUNT(*)', 'nexus_transactions', array( 't_billing_agreement=? AND t_id<?', $billingAgreement->id, $transaction->id ) )->first() )
|
||||
{
|
||||
\IPS\Member::loggedIn()->language()->words[ $transaction->id . '_refund_cancel_billing_agreement_warning' ] = \IPS\Member::loggedIn()->language()->addToStack( 'refund_cancel_billing_agreement_warning' );
|
||||
}
|
||||
|
||||
$form->add( $field );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -655,9 +729,41 @@ class _invoices extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
foreach ( $transactions as $transaction )
|
||||
{
|
||||
/* Handle billing agreement */
|
||||
if ( $transaction->billing_agreement )
|
||||
{
|
||||
if ( isset( $values[ $transaction->id . '_refund_cancel_billing_agreement' ] ) and $values[ $transaction->id . '_refund_cancel_billing_agreement' ] )
|
||||
{
|
||||
try
|
||||
{
|
||||
$transaction->billing_agreement->cancel();
|
||||
}
|
||||
catch ( \Exception $e )
|
||||
{
|
||||
\IPS\Output::i()->error( 'billing_agreement_cancel_error', '3X190/G', 500, '', array(), $e->getMessage() );
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Reverse credit */
|
||||
if ( $values[ $transaction->id . '_refund_method' ] !== 'credit' and isset( $values[ $transaction->id . '_refund_reverse_credit' ] ) and $values[ $transaction->id . '_refund_reverse_credit' ] )
|
||||
{
|
||||
$transaction->reverseCredit();
|
||||
}
|
||||
|
||||
/* Refund */
|
||||
try
|
||||
{
|
||||
$transaction->refund( $values[ $transaction->id . '_refund_method' ], $values[ $transaction->id . '_refund_amount' ], isset( $values[ $transaction->id . '_refund_reason' ] ) ? $values[ $transaction->id . '_refund_reason' ] : NULL );
|
||||
$amount = NULL;
|
||||
if ( $values[ $transaction->id . '_refund_method' ] === 'gateway' and isset( $values[ $transaction->id . '_refund_amount' ] ) )
|
||||
{
|
||||
$amount = $values[ $transaction->id . '_refund_amount' ];
|
||||
}
|
||||
elseif ( $values[ $transaction->id . '_refund_method' ] === 'credit' and isset( $values[ $transaction->id . '_refund_credit_amount' ] ) )
|
||||
{
|
||||
$amount = $values[ $transaction->id . '_refund_credit_amount' ];
|
||||
}
|
||||
|
||||
$transaction->refund( $values[ $transaction->id . '_refund_method' ], $amount, isset( $values[ $transaction->id . '_refund_reason' ] ) ? $values[ $transaction->id . '_refund_reason' ] : NULL );
|
||||
}
|
||||
catch ( \LogicException $e )
|
||||
{
|
||||
|
||||
@@ -308,12 +308,12 @@ class _transactions extends \IPS\Dispatcher\Controller
|
||||
|
||||
/* What are the refund methods? */
|
||||
$refundMethods = array();
|
||||
$refundMethodToggles = array( 'credit' => array( 'refund_amount' ) );
|
||||
$refundMethodToggles = array( 'none' => array( 'refund_reverse_credit' ) );
|
||||
$refundReasons = array();
|
||||
if ( $method and $method::SUPPORTS_REFUNDS )
|
||||
{
|
||||
$refundMethods['gateway'] = $method->_title;
|
||||
$refundMethodToggles['gateway'] = array();
|
||||
$refundMethods['gateway'] = 'transaction_refund';
|
||||
$refundMethodToggles['gateway'] = array( 'refund_reverse_credit' );
|
||||
if ( $method::SUPPORTS_PARTIAL_REFUNDS )
|
||||
{
|
||||
$refundMethodToggles['gateway'][] = 'refund_amount';
|
||||
@@ -323,7 +323,11 @@ class _transactions extends \IPS\Dispatcher\Controller
|
||||
$refundMethodToggles['gateway'][] = 'refund_reason';
|
||||
}
|
||||
}
|
||||
$refundMethods['credit'] = 'refund_method_credit';
|
||||
if ( $transaction->credit->amount->compare( $transaction->amount->amount ) === -1 )
|
||||
{
|
||||
$refundMethods['credit'] = 'refund_method_credit';
|
||||
$refundMethodToggles['credit'][] = 'refund_credit_amount';
|
||||
}
|
||||
$refundMethods['none'] = 'refund_method_none';
|
||||
|
||||
/* Build form */
|
||||
@@ -333,16 +337,57 @@ class _transactions extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
$form->add( new \IPS\Helpers\Form\Radio( 'refund_reason', NULL, FALSE, array( 'options' => $refundReasons ), NULL, NULL, NULL, 'refund_reason' ) );
|
||||
}
|
||||
$form->add( new \IPS\Helpers\Form\Number( 'refund_amount', 0, TRUE, array(
|
||||
'unlimited' => 0,
|
||||
'unlimitedLang' => (
|
||||
$transaction->status === \IPS\nexus\Transaction::STATUS_PART_REFUNDED
|
||||
? \IPS\Member::loggedIn()->language()->addToStack( 'refund_full_remaining', FALSE, array( 'sprintf' => array( new \IPS\nexus\Money( $transaction->amount->amount->subtract( $transaction->partial_refund->amount ), $transaction->currency ) ) ) )
|
||||
: \IPS\Member::loggedIn()->language()->addToStack( 'refund_full', FALSE, array( 'sprintf' => array( $transaction->amount ) ) )
|
||||
),
|
||||
'max' => (string) $transaction->amount->amount->subtract( $transaction->partial_refund->amount ),
|
||||
'decimals' => TRUE
|
||||
), NULL, NULL, $transaction->amount->currency, 'refund_amount' ) );
|
||||
if ( $method and $method::SUPPORTS_REFUNDS and $method::SUPPORTS_PARTIAL_REFUNDS )
|
||||
{
|
||||
$form->add( new \IPS\Helpers\Form\Number( 'refund_amount', 0, TRUE, array(
|
||||
'unlimited' => 0,
|
||||
'unlimitedLang' => (
|
||||
$transaction->partial_refund->amount->isGreaterThanZero()
|
||||
? \IPS\Member::loggedIn()->language()->addToStack( 'refund_full_remaining', FALSE, array( 'sprintf' => array(
|
||||
new \IPS\nexus\Money( $transaction->amount->amount->subtract( $transaction->partial_refund->amount ), $transaction->currency ) )
|
||||
) )
|
||||
: \IPS\Member::loggedIn()->language()->addToStack( 'refund_full', FALSE, array( 'sprintf' => array( $transaction->amount ) ) )
|
||||
),
|
||||
'max' => (string) $transaction->amount->amount->subtract( $transaction->partial_refund->amount ),
|
||||
'decimals' => TRUE
|
||||
), NULL, NULL, $transaction->amount->currency, 'refund_amount' ) );
|
||||
|
||||
if ( $transaction->credit->amount->isGreaterThanZero() )
|
||||
{
|
||||
\IPS\Member::loggedIn()->language()->words['refund_amount_desc'] = sprintf( \IPS\Member::loggedIn()->language()->get('refund_amount_descwarn'), $transaction->credit );
|
||||
}
|
||||
}
|
||||
if ( $transaction->credit->amount->compare( $transaction->amount->amount ) === -1 )
|
||||
{
|
||||
$form->add( new \IPS\Helpers\Form\Number( 'refund_credit_amount', 0, TRUE, array(
|
||||
'unlimited' => 0,
|
||||
'unlimitedLang' => (
|
||||
$transaction->credit->amount->isGreaterThanZero()
|
||||
? \IPS\Member::loggedIn()->language()->addToStack( 'refund_full_remaining', FALSE, array( 'sprintf' => array(
|
||||
new \IPS\nexus\Money( $transaction->amount->amount->subtract( $transaction->credit->amount ), $transaction->currency ) )
|
||||
) )
|
||||
: \IPS\Member::loggedIn()->language()->addToStack( 'refund_full', FALSE, array( 'sprintf' => array( $transaction->amount ) ) )
|
||||
),
|
||||
'max' => (string) $transaction->amount->amount->subtract( $transaction->credit->amount ),
|
||||
'decimals' => TRUE
|
||||
), NULL, NULL, $transaction->amount->currency, 'refund_credit_amount' ) );
|
||||
|
||||
if ( $transaction->partial_refund->amount->isGreaterThanZero() )
|
||||
{
|
||||
\IPS\Member::loggedIn()->language()->words['refund_credit_amount_desc'] = sprintf( \IPS\Member::loggedIn()->language()->get('refund_credit_amount_descwarn'), $transaction->partial_refund );
|
||||
}
|
||||
}
|
||||
if ( $transaction->credit->amount->isGreaterThanZero() )
|
||||
{
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'refund_reverse_credit', TRUE, TRUE, array( 'togglesOn' => array( 'form_refund_reverse_credit_warning' ) ), NULL, NULL, NULL, 'refund_reverse_credit' ) );
|
||||
\IPS\Member::loggedIn()->language()->words['refund_reverse_credit'] = sprintf( \IPS\Member::loggedIn()->language()->get( 'refund_reverse_credit' ), $transaction->credit );
|
||||
|
||||
$credits = $transaction->member->cm_credits;
|
||||
if ( $credits[ $transaction->amount->currency ]->amount->compare( $transaction->credit->amount ) === -1 )
|
||||
{
|
||||
\IPS\Member::loggedIn()->language()->words['refund_reverse_credit_warning'] = \IPS\Member::loggedIn()->language()->addToStack( 'account_credit_remove_neg' );
|
||||
}
|
||||
}
|
||||
if ( $transaction->invoice !== NULL and $transaction->invoice->status === \IPS\nexus\Invoice::STATUS_PAID )
|
||||
{
|
||||
$field = new \IPS\Helpers\Form\Radio( 'refund_invoice_status', \IPS\nexus\Invoice::STATUS_PENDING, TRUE, array(
|
||||
@@ -359,14 +404,55 @@ class _transactions extends \IPS\Dispatcher\Controller
|
||||
$field->warningBox = \IPS\Theme::i()->getTemplate('invoices')->unpaidConsequences( $transaction->invoice );
|
||||
$form->add( $field );
|
||||
}
|
||||
if ( $billingAgreement = $transaction->billing_agreement )
|
||||
{
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'refund_cancel_billing_agreement', TRUE, NULL, array( 'togglesOff' => array( 'form_refund_cancel_billing_agreement_warning' ) ) ) );
|
||||
|
||||
if ( \IPS\Db::i()->select( 'COUNT(*)', 'nexus_transactions', array( 't_billing_agreement=? AND t_id<?', $billingAgreement->id, $transaction->id ) )->first() )
|
||||
{
|
||||
unset( \IPS\Member::loggedIn()->language()->words['refund_cancel_billing_agreement_warning'] );
|
||||
}
|
||||
}
|
||||
|
||||
/* Handle submissions */
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
/* Handle billing agreement */
|
||||
if ( $transaction->billing_agreement )
|
||||
{
|
||||
if ( isset( $values['refund_cancel_billing_agreement'] ) and $values['refund_cancel_billing_agreement'] )
|
||||
{
|
||||
try
|
||||
{
|
||||
$transaction->billing_agreement->cancel();
|
||||
}
|
||||
catch ( \Exception $e )
|
||||
{
|
||||
\IPS\Output::i()->error( 'billing_agreement_cancel_error', '3X186/G', 500, '', array(), $e->getMessage() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Reverse credit */
|
||||
if ( $values['refund_method'] !== 'credit' and isset( $values['refund_reverse_credit'] ) and $values['refund_reverse_credit'] )
|
||||
{
|
||||
$transaction->reverseCredit();
|
||||
}
|
||||
|
||||
/* Refund */
|
||||
try
|
||||
{
|
||||
$transaction->refund( $values['refund_method'], $values['refund_amount'], isset( $values['refund_reason'] ) ? $values['refund_reason'] : NULL );
|
||||
$amount = NULL;
|
||||
if ( $values['refund_method'] === 'gateway' and isset( $values['refund_amount'] ) )
|
||||
{
|
||||
$amount = $values['refund_amount'];
|
||||
}
|
||||
elseif ( $values['refund_method'] === 'credit' and isset( $values['refund_credit_amount'] ) )
|
||||
{
|
||||
$amount = $values['refund_credit_amount'];
|
||||
}
|
||||
|
||||
$transaction->refund( $values['refund_method'], $amount, isset( $values['refund_reason'] ) ? $values['refund_reason'] : NULL );
|
||||
}
|
||||
catch ( \LogicException $e )
|
||||
{
|
||||
|
||||
@@ -82,7 +82,7 @@ class _income extends \IPS\Dispatcher\Controller
|
||||
array(),
|
||||
$activeTab
|
||||
);
|
||||
$chart->where[] = array( '( t_status=? OR t_status=? )', \IPS\nexus\Transaction::STATUS_PAID, \IPS\nexus\Transaction::STATUS_PART_REFUNDED );
|
||||
$chart->where[] = array( '( t_status=? OR t_status=? ) AND t_method>0', \IPS\nexus\Transaction::STATUS_PAID, \IPS\nexus\Transaction::STATUS_PART_REFUNDED );
|
||||
|
||||
if ( $activeTab === 'totals' )
|
||||
{
|
||||
|
||||
@@ -151,6 +151,7 @@ class _checkout extends \IPS\Dispatcher\Controller
|
||||
try
|
||||
{
|
||||
$this->invoice->billaddress = \IPS\nexus\Customer\Address::constructFromData( \IPS\Db::i()->select( '*', 'nexus_customer_addresses', array( 'member=? AND primary_billing=1', \IPS\Member::loggedIn()->member_id ) )->first() )->address;
|
||||
$this->invoice->recalculateTotal();
|
||||
$this->invoice->save();
|
||||
$_SESSION[ 'wizard-' . md5( $checkoutUrl ) . '-step' ] = isset( $steps['checkout_shipping'] ) ? 'checkout_shipping' : 'checkout_pay';
|
||||
}
|
||||
@@ -418,17 +419,7 @@ class _checkout extends \IPS\Dispatcher\Controller
|
||||
|
||||
/* Misc */
|
||||
$form->add( new \IPS\Helpers\Form\Checkbox( 'reg_admin_mails', $guestData ? $guestData['member']['allow_admin_mails'] : \IPS\Settings::i()->updates_consent_default == 'enabled' ? TRUE : FALSE, FALSE ) );
|
||||
\IPS\Member::loggedIn()->language()->words[ "reg_agreed_terms" ] = sprintf( \IPS\Member::loggedIn()->language()->get("reg_agreed_terms"), \IPS\Http\Url::internal( 'app=core&module=system&controller=terms', 'front', 'terms', array(), \IPS\Http\Url::PROTOCOL_RELATIVE ) );
|
||||
|
||||
/* Build the appropriate links for registration terms & privacy policy */
|
||||
if ( \IPS\Settings::i()->privacy_type == "internal" )
|
||||
{
|
||||
\IPS\Member::loggedIn()->language()->words[ "reg_agreed_terms" ] .= sprintf( \IPS\Member::loggedIn()->language()->get("reg_privacy_link"), \IPS\Http\Url::internal( 'app=core&module=system&controller=privacy', 'front', 'privacy', array(), \IPS\Http\Url::PROTOCOL_RELATIVE ), 'data-ipsDialog data-ipsDialog-size="wide" data-ipsDialog-title="' . \IPS\Member::loggedIn()->language()->get("privacy") . '"' );
|
||||
}
|
||||
else if ( \IPS\Settings::i()->privacy_type == "external" )
|
||||
{
|
||||
\IPS\Member::loggedIn()->language()->words[ "reg_agreed_terms" ] .= sprintf( \IPS\Member::loggedIn()->language()->get("reg_privacy_link"), \IPS\Http\Url::external( \IPS\Settings::i()->privacy_link ), 'target="_blank"' );
|
||||
}
|
||||
\IPS\core\modules\front\system\register::buildRegistrationTerm();
|
||||
$form->add( new \IPS\Helpers\Form\Checkbox( 'reg_agreed_terms', (bool) $guestData, TRUE, array(), function( $val )
|
||||
{
|
||||
if ( !$val )
|
||||
@@ -479,7 +470,7 @@ class _checkout extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
if ( isset( $securityQuestionAnswers[ $v ] ) )
|
||||
{
|
||||
$form->error = \IPS\Member::loggedIn()->language()->addToStack('security_questions_unique');
|
||||
$form->error = \IPS\Member::loggedIn()->language()->addToStack( 'security_questions_unique', FALSE, array( 'pluralize' => array( \IPS\Settings::i()->security_questions_number ?: 3 ) ) );
|
||||
break;
|
||||
}
|
||||
else
|
||||
@@ -646,6 +637,7 @@ class _checkout extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
|
||||
/* Save */
|
||||
$this->invoice->recalculateTotal();
|
||||
$this->invoice->save();
|
||||
return array();
|
||||
}
|
||||
@@ -1243,6 +1235,11 @@ class _checkout extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
foreach ( $paymentMethods as $k => $v )
|
||||
{
|
||||
if ( in_array( '*', $item->paymentMethodIds ) ) // This looks odd but in older versions IPS\nexus\extensions\nexus\Item\Subscription::renewalPaymentMethodIds() was mistakenly returning array('*') and since the value is stored in the invoice we have to keep this for compatibility with invoices created at that time
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( !in_array( $k, $item->paymentMethodIds ) )
|
||||
{
|
||||
unset( $paymentMethods[ $k ] );
|
||||
@@ -1312,7 +1309,7 @@ class _checkout extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
if ( \IPS\Settings::i()->nexus_tac === 'checkbox' )
|
||||
{
|
||||
$form->add( new \IPS\Helpers\Form\Checkbox( 'i_agree_to_tac', FALSE, TRUE, array( 'labelHtmlSprintf' => array( "<a href='" . htmlspecialchars( \IPS\Settings::i()->nexus_tac_link, ENT_DISALLOWED, 'UTF-8', FALSE ) . "' target='_blank'>" . \IPS\Member::loggedIn()->language()->addToStack( 'terms_and_conditions' ) . '</a>' ) ), function( $val )
|
||||
$form->add( new \IPS\Helpers\Form\Checkbox( 'i_agree_to_tac', FALSE, TRUE, array( 'labelHtmlSprintf' => array( "<a href='" . htmlspecialchars( \IPS\Settings::i()->nexus_tac_link, ENT_DISALLOWED, 'UTF-8', FALSE ) . "' target='_blank' rel='noopener'>" . \IPS\Member::loggedIn()->language()->addToStack( 'terms_and_conditions' ) . '</a>' ) ), function( $val )
|
||||
{
|
||||
if ( !$val )
|
||||
{
|
||||
@@ -1512,7 +1509,7 @@ class _checkout extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
$invoice->addItem( $values['coupon_code'] );
|
||||
$invoice->save();
|
||||
\IPS\Output::i()->redirect( $invoice->checkoutUrl() );
|
||||
\IPS\Output::i()->redirect( $invoice->checkoutUrl()->setQueryString( '_step', 'checkout_pay' ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,6 +82,7 @@ class _cards extends \IPS\Dispatcher\Controller
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'global_gateways.js', 'nexus', 'global' ) );
|
||||
$form = \IPS\nexus\Customer\CreditCard::create( \IPS\nexus\Customer::loggedIn() );
|
||||
if ( $form instanceof \IPS\nexus\Customer\CreditCard )
|
||||
{
|
||||
@@ -111,8 +112,10 @@ class _cards extends \IPS\Dispatcher\Controller
|
||||
$card = \IPS\nexus\Customer\CreditCard::load( \IPS\Request::i()->id );
|
||||
if ( $card->member->member_id === \IPS\nexus\Customer::loggedIn()->member_id )
|
||||
{
|
||||
$cardData = $card->card;
|
||||
|
||||
$card->delete();
|
||||
\IPS\nexus\Customer::loggedIn()->log( 'card', array( 'type' => 'delete', 'number' => $card->card->lastFour ) );
|
||||
\IPS\nexus\Customer::loggedIn()->log( 'card', array( 'type' => 'delete', 'number' => $cardData->lastFour ) );
|
||||
}
|
||||
}
|
||||
catch ( \Exception $e ) { }
|
||||
|
||||
@@ -59,6 +59,16 @@ class _invoices extends \IPS\Dispatcher\Controller
|
||||
\IPS\Output::i()->error( 'node_error', '2X215/5', 404, '' );
|
||||
}
|
||||
}
|
||||
else if ( isset( \IPS\Request::i()->do ) and \IPS\Request::i()->do == 'printout' and isset( \IPS\Request::i()->key ) )
|
||||
{
|
||||
$this->invoice = \IPS\nexus\Invoice::load( \IPS\Request::i()->id );
|
||||
$guest = $this->invoice->guest_data;
|
||||
|
||||
if ( md5( $guest['member']['email'] . ';' . $guest['member']['joined'] ) != \IPS\Request::i()->key )
|
||||
{
|
||||
\IPS\Output::i()->error( 'node_error', '2X215/7', 404, '' );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Output::i()->error( 'no_module_permission_guest', '2X215/6', 404, '' );
|
||||
|
||||
@@ -243,7 +243,7 @@ class _product extends \IPS\Content\Controller
|
||||
\IPS\Output::i()->jsonLd['package']['image'] = (string) $package->image;
|
||||
}
|
||||
|
||||
if( $package->reviewable )
|
||||
if( $package->reviewable AND $item->averageReviewRating() )
|
||||
{
|
||||
\IPS\Output::i()->jsonLd['package']['aggregateRating'] = array(
|
||||
'@type' => 'AggregateRating',
|
||||
@@ -323,9 +323,9 @@ class _product extends \IPS\Content\Controller
|
||||
{
|
||||
$customFields = \IPS\nexus\Package\CustomField::roots();
|
||||
$stickyFields = array();
|
||||
foreach ( $item->details as $k => $v )
|
||||
foreach ( $item->details as $_k => $v )
|
||||
{
|
||||
if ( $v and isset( $customFields[ $k ] ) and $customFields[ $k ]->sticky )
|
||||
if ( $v and isset( $customFields[ $_k ] ) and $customFields[ $_k ]->sticky )
|
||||
{
|
||||
$stickyFields[] = $v;
|
||||
}
|
||||
|
||||
@@ -196,7 +196,7 @@ class _store extends \IPS\Dispatcher\Controller
|
||||
\IPS\Output::i()->jsonLd['package' . $package->id ]['image'] = (string) $package->image;
|
||||
}
|
||||
|
||||
if( $package->reviewable )
|
||||
if( $package->reviewable and $item->averageReviewRating() )
|
||||
{
|
||||
\IPS\Output::i()->jsonLd['package' . $package->id ]['aggregateRating'] = array(
|
||||
'@type' => 'AggregateRating',
|
||||
|
||||
@@ -194,6 +194,12 @@ class _subscriptions extends \IPS\Dispatcher\Controller
|
||||
/* CSRF Check */
|
||||
\IPS\Session::i()->csrfCheck();
|
||||
|
||||
/* Already purchased a subscription? */
|
||||
if ( \IPS\nexus\Subscription::loadActiveByMember( \IPS\nexus\Customer::loggedIn() ) )
|
||||
{
|
||||
\IPS\Output::i()->error( 'nexus_subs_already_got_package', '2X379/6', 403, '' );
|
||||
}
|
||||
|
||||
$package = \IPS\nexus\Subscription\Package::load( \IPS\Request::i()->id );
|
||||
$price = $package->price();
|
||||
|
||||
|
||||
Reference in new issue
Block a user