Version 4.1.19.4
This commit is contained in:
1 parent
2bd5025018
commit
0dc2aee5ed
312 files changed
+53730
-32118
No files matched your search
@@ -1527,11 +1527,13 @@ class _Invoice extends \IPS\Patterns\ActiveRecord
|
||||
* Mark as paid
|
||||
*
|
||||
* @param \IPS\Member|NULL $member The member changing the status. Only set if the status is being manually changed by an admin.
|
||||
* @return void
|
||||
* @return \IPS\Member|NULL If the invoice belonged to a guest, a member will be created by approving and returned here
|
||||
* @note It is the responsibility of the code calling this to log the action on the customer's account *before* calling this method
|
||||
*/
|
||||
public function markPaid( \IPS\Member $member = NULL )
|
||||
{
|
||||
{
|
||||
$return = NULL;
|
||||
|
||||
if ( $this->status !== static::STATUS_PAID )
|
||||
{
|
||||
/* Create the member account if this was a guest */
|
||||
@@ -1554,6 +1556,7 @@ class _Invoice extends \IPS\Patterns\ActiveRecord
|
||||
$memberToSave->changed[ $k ] = $v;
|
||||
}
|
||||
$memberToSave->save();
|
||||
$return = $memberToSave;
|
||||
}
|
||||
$this->member = $memberToSave;
|
||||
$this->guest_data = NULL;
|
||||
@@ -1959,6 +1962,8 @@ class _Invoice extends \IPS\Patterns\ActiveRecord
|
||||
$this->status_extra = $extra;
|
||||
$this->save();
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2476,7 +2476,14 @@ class _Package extends \IPS\Node\Model
|
||||
*/
|
||||
protected function upgradeDowngradeForm( \IPS\nexus\Purchase $purchase, $overrideRestrictions = FALSE )
|
||||
{
|
||||
$currency = $purchase->original_invoice->currency;
|
||||
try
|
||||
{
|
||||
$currency = $purchase->original_invoice->currency;
|
||||
}
|
||||
catch ( \Exception $e )
|
||||
{
|
||||
$currency = $purchase->member->defaultCurrency();
|
||||
}
|
||||
$options = array();
|
||||
$desciptions = array();
|
||||
$toggles = array();
|
||||
@@ -2578,7 +2585,14 @@ class _Package extends \IPS\Node\Model
|
||||
protected function costToUpgrade( \IPS\nexus\Purchase $purchase )
|
||||
{
|
||||
$package = \IPS\nexus\Package::load( $purchase->item_id );
|
||||
$currency = $purchase->original_invoice->currency;
|
||||
try
|
||||
{
|
||||
$currency = $purchase->original_invoice->currency;
|
||||
}
|
||||
catch ( \Exception $e )
|
||||
{
|
||||
$currency = $purchase->member->defaultCurrency();
|
||||
}
|
||||
|
||||
$priceOfExistingPackage = json_decode( $package->base_price, TRUE );
|
||||
$priceOfExistingPackage = $priceOfExistingPackage[ $currency ]['amount'];
|
||||
|
||||
@@ -505,7 +505,7 @@ class _Transaction extends \IPS\Patterns\ActiveRecord
|
||||
* Check fraud rules and capture
|
||||
*
|
||||
* @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 void
|
||||
* @return \IPS\Member|NULL If the invoice belonged to a guest, a member will be created by approving and returned here
|
||||
* @throws \LogicException
|
||||
*/
|
||||
public function checkFraudRulesAndCapture( $maxMind=NULL )
|
||||
@@ -520,8 +520,9 @@ class _Transaction extends \IPS\Patterns\ActiveRecord
|
||||
/* If we're not being fraud blocked, we can capture and approve */
|
||||
if ( $fraudResult === static::STATUS_PAID )
|
||||
{
|
||||
$this->captureAndApprove();
|
||||
return $this->captureAndApprove();
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -566,7 +567,7 @@ class _Transaction extends \IPS\Patterns\ActiveRecord
|
||||
/**
|
||||
* Capture and approve
|
||||
*
|
||||
* @return void
|
||||
* @return \IPS\Member|NULL If the invoice belonged to a guest, a member will be created by approving and returned here
|
||||
* @throws \LogicException
|
||||
*/
|
||||
public function captureAndApprove()
|
||||
@@ -581,7 +582,7 @@ class _Transaction extends \IPS\Patterns\ActiveRecord
|
||||
'invoice_title' => $this->invoice->title,
|
||||
) );
|
||||
|
||||
$this->approve();
|
||||
return $this->approve();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -601,7 +602,7 @@ class _Transaction extends \IPS\Patterns\ActiveRecord
|
||||
* Approve
|
||||
*
|
||||
* @param \IPS\Member|NULL $by The staff member approving, or NULL if it's automatic
|
||||
* @return void
|
||||
* @return \IPS\Member|NULL If the invoice belonged to a guest, a member will be created by approving and returned here
|
||||
*/
|
||||
public function approve( $by = NULL )
|
||||
{
|
||||
@@ -622,8 +623,9 @@ class _Transaction extends \IPS\Patterns\ActiveRecord
|
||||
/* Mark the invoice paid if necessary */
|
||||
if ( !$this->invoice->amountToPay()->amount->isGreaterThanZero() )
|
||||
{
|
||||
$this->invoice->markPaid();
|
||||
return $this->invoice->markPaid();
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user