Version 4.7.8
This commit is contained in:
1 parent
7b7404e741
commit
fd22d99e69
688 files changed
+19814
-10890
No files matched your search
@@ -123,7 +123,7 @@ class _BillingAgreement extends \IPS\nexus\Customer\BillingAgreement
|
||||
if ( isset( $data['plan_id'] ) )
|
||||
{
|
||||
$transactions = $this->method->api( "billing/subscriptions/{$this->gw_id}/transactions?start_time=" . \IPS\DateTime::create()->sub( new \DateInterval( 'P31D' ) )->rfc3339() . '&end_time=' . \IPS\DateTime::create()->rfc3339(), NULL, 'get' );
|
||||
foreach ( array_reverse( $transactions['transactions'] ) as $t )
|
||||
foreach ( array_reverse( $transactions['transactions'] ?? [] ) as $t )
|
||||
{
|
||||
if ( $t['status'] == 'COMPLETED' )
|
||||
{
|
||||
|
||||
@@ -285,7 +285,7 @@ class _Stripe extends \IPS\nexus\Gateway
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return array( 'card' => new \IPS\nexus\Form\CreditCard( $this->id . '_card', NULL, FALSE, array(
|
||||
'types' => $supportedCards,
|
||||
'attr' => array(
|
||||
@@ -300,7 +300,7 @@ class _Stripe extends \IPS\nexus\Gateway
|
||||
'data-state' => $invoice->billaddress ? $invoice->billaddress->region : NULL,
|
||||
'data-zip' => $invoice->billaddress ? $invoice->billaddress->postalCode : NULL,
|
||||
'data-country' => $invoice->billaddress ? $invoice->billaddress->country : NULL,
|
||||
'data-email' => $member ? $member->email : \IPS\Member::loggedIn()->email,
|
||||
'data-email' => $member ? $member->email : $invoice->member->email,
|
||||
'data-phone' => isset( $member->cm_phone ) ? $member->cm_phone : NULL,
|
||||
'data-amount' => static::_amountAsCents( $amount ),
|
||||
'data-currency' => $amount->currency,
|
||||
@@ -602,7 +602,7 @@ class _Stripe extends \IPS\nexus\Gateway
|
||||
}
|
||||
|
||||
/* Source-based */
|
||||
elseif ( \is_string( $card ) )
|
||||
if ( \is_string( $card ) )
|
||||
{
|
||||
$data['source'] = $card;
|
||||
unset( $data['capture'] );
|
||||
|
||||
@@ -1726,6 +1726,7 @@ class _Invoice extends \IPS\Patterns\ActiveRecord
|
||||
public function markPaid( \IPS\Member $member = NULL )
|
||||
{
|
||||
$return = NULL;
|
||||
$memberCreated = FALSE;
|
||||
|
||||
if ( $this->status !== static::STATUS_PAID )
|
||||
{
|
||||
@@ -1734,6 +1735,7 @@ class _Invoice extends \IPS\Patterns\ActiveRecord
|
||||
{
|
||||
if ( $this->guest_data )
|
||||
{
|
||||
$memberCreated = TRUE;
|
||||
$return = $this->createAccountForGuest();
|
||||
}
|
||||
else
|
||||
@@ -2086,7 +2088,13 @@ class _Invoice extends \IPS\Patterns\ActiveRecord
|
||||
$extra['setByID'] = $member->member_id;
|
||||
$extra['date'] = time();
|
||||
}
|
||||
|
||||
|
||||
/* Update member total spend */
|
||||
if ( $memberCreated )
|
||||
{
|
||||
$this->member->recountTotalSpend();
|
||||
}
|
||||
|
||||
/* Save */
|
||||
$this->status_extra = $extra;
|
||||
$this->save();
|
||||
|
||||
@@ -968,7 +968,7 @@ class _Package extends \IPS\Node\Model
|
||||
$buttons['convert_subs'] = array(
|
||||
'icon' => 'certificate',
|
||||
'title' => 'nexus_subs_convert',
|
||||
'link' => \IPS\Http\Url::internal( 'app=nexus&module=subscriptions&controller=subscriptions&do=convertToSubscription&id=' . $this->_id )->csrf()
|
||||
'link' => \IPS\Http\Url::internal( 'app=nexus&module=subscriptions&controller=subscriptions&do=convertToSubscription&id=' . $this->_id )
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1376,12 +1376,12 @@ class _Package extends \IPS\Node\Model
|
||||
$form->add( new \IPS\Helpers\Form\Codemirror( "p_email_{$k}_html", $this->$valueKey, FALSE, array(
|
||||
'preview' => \IPS\Http\Url::internal('app=nexus&module=store&controller=packages&do=emailPreview')->csrf(),
|
||||
'tags' => array(
|
||||
'{$purchase->name}' => \IPS\Member::loggedIn()->language()->addToStack('ps_name'),
|
||||
'{$purchase->expires}' => \IPS\Member::loggedIn()->language()->addToStack('p_email_tag_expire'),
|
||||
'{$purchase->renewals}' => \IPS\Member::loggedIn()->language()->addToStack('ps_renewals'),
|
||||
'{$purchase->custom_fields[1]}' => \IPS\Member::loggedIn()->language()->addToStack('p_email_tag_field'),
|
||||
'{$purchase->url()}' => \IPS\Member::loggedIn()->language()->addToStack('p_email_tag_url'),
|
||||
'{$purchase->licenseKey()->key}'=> \IPS\Member::loggedIn()->language()->addToStack('license_key'),
|
||||
'{$purchase->name}' => \IPS\Member::loggedIn()->language()->addToStack('ps_name'),
|
||||
'{$purchase->expire->localeDate()}' => \IPS\Member::loggedIn()->language()->addToStack('p_email_tag_expire'),
|
||||
'{$purchase->renewals}' => \IPS\Member::loggedIn()->language()->addToStack('ps_renewals'),
|
||||
'{$purchase->custom_fields[1]}' => \IPS\Member::loggedIn()->language()->addToStack('p_email_tag_field'),
|
||||
'{$purchase->url()}' => \IPS\Member::loggedIn()->language()->addToStack('p_email_tag_url'),
|
||||
'{$purchase->licenseKey()->key}' => \IPS\Member::loggedIn()->language()->addToStack('license_key'),
|
||||
)
|
||||
), NULL, NULL, NULL, "p_email_{$k}_html" ) );
|
||||
$form->add( new \IPS\Helpers\Form\Editor( "p_email_{$k}_wysiwyg", $this->$valueKey, FALSE, array( 'app' => 'nexus', 'key' => 'Admin', 'autoSaveKey' => $this->id ? "nexus-pkg-{$this->id}-{$k}-email" : "nexus-new-pkg-{$k}-email" ), NULL, NULL, NULL, "p_email_{$k}_wysiwyg" ) );
|
||||
|
||||
@@ -379,32 +379,24 @@ XML;
|
||||
{
|
||||
throw new \IPS\Http\Request\Exception;
|
||||
}
|
||||
|
||||
|
||||
/* Interpret */
|
||||
$responseArray = array();
|
||||
$xml = new \IPS\Xml\XMLReader;
|
||||
$xml->xml( (string) $response, NULL, LIBXML_NONET );
|
||||
if ( $xml->read() )
|
||||
$doc = new \IPS\Xml\DOMDocument;
|
||||
$doc->loadXML( \IPS\Xml\DOMDocument::wrapHtml( (string) $response ) );
|
||||
|
||||
$data = iterator_to_array( $doc->getElementsByTagName( 'checkVatResponse' ) );
|
||||
|
||||
if ( isset( $data[0] ) AND \count( $data[0]->childNodes ) )
|
||||
{
|
||||
if ( $xml->name === 'soap:Envelope' and $xml->read() )
|
||||
foreach( $data[0]->childNodes AS $child )
|
||||
{
|
||||
if ( $xml->name === 'soap:Body' and $xml->read() )
|
||||
{
|
||||
if ( $xml->name === 'checkVatResponse' )
|
||||
{
|
||||
$xml->read();
|
||||
do
|
||||
{
|
||||
$responseArray[ $xml->name ] = $xml->readString();
|
||||
}
|
||||
while ( $xml->next() and $xml->nodeType !== $xml::END_ELEMENT );
|
||||
}
|
||||
}
|
||||
$responseArray[ $child->localName ] = $child->nodeValue;
|
||||
}
|
||||
}
|
||||
|
||||
/* Cache and return */
|
||||
if ( $responseArray and $responseArray['valid'] === 'true' )
|
||||
if ( isset( $responseArray['valid'] ) and $responseArray['valid'] === 'true' )
|
||||
{
|
||||
\IPS\Data\Cache::i()->storeWithExpire( $cacheKey, $responseArray, \IPS\DateTime::create()->add( new \DateInterval( 'P7D' ) ), TRUE );
|
||||
return $responseArray;
|
||||
|
||||
@@ -659,7 +659,10 @@ class _Transaction extends \IPS\Patterns\ActiveRecord
|
||||
$this->save();
|
||||
|
||||
/* Update member total spend */
|
||||
$this->member->updateSpend( $this->amount->amount, $this->amount->currency );
|
||||
if( $this->member->member_id )
|
||||
{
|
||||
$this->member->updateSpend( $this->amount->amount, $this->amount->currency );
|
||||
}
|
||||
|
||||
/* Mark the invoice paid if necessary */
|
||||
if ( !$amountToPayOnInvoice->amount->subtract( $this->amount->amount )->isGreaterThanZero() )
|
||||
|
||||
Reference in new issue
Block a user