Version 5.0.0 beta 3
This commit is contained in:
1 parent
f61b0da85d
commit
e86153356a
108 files changed
+2927
-1573
No files matched your search
@@ -440,6 +440,13 @@ class Application extends SystemApplication
|
||||
'app' => 'core',
|
||||
'key' => 'Menu',
|
||||
'title' => Member::loggedIn()->language()->get( 'module__nexus_store' ),
|
||||
'icon' => json_encode( [ [
|
||||
'key' => 'cart-shopping:fas',
|
||||
'type' => 'fa',
|
||||
'raw' => '<i class="fa-solid fa-cart-shopping"></i>',
|
||||
'title' => 'cart-shopping',
|
||||
'html' => '\r\n<!-- theme_core_global_global_icon --><span class="ipsIcon ipsIcon--fa" data-label="cart-shopping" aria-hidden="true"><i class="fa-solid fa-cart-shopping"></i></span>'
|
||||
] ] ),
|
||||
'children' => array(
|
||||
array( 'key' => 'Store' ),
|
||||
array( 'key' => 'Gifts' ),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<javascript app="nexus">
|
||||
<file javascript_app="nexus" javascript_location="front" javascript_path="controllers/checkout" javascript_name="ips.checkout.register.js" javascript_type="controller" javascript_version="5000028" javascript_position="1000100">/**
|
||||
<file javascript_app="nexus" javascript_location="front" javascript_path="controllers/checkout" javascript_name="ips.checkout.register.js" javascript_type="controller" javascript_version="5000029" javascript_position="1000100">/**
|
||||
* Invision Community
|
||||
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
|
||||
*
|
||||
@@ -34,7 +34,7 @@
|
||||
}
|
||||
});
|
||||
}(jQuery, _));</file>
|
||||
<file javascript_app="nexus" javascript_location="front" javascript_path="controllers/checkout" javascript_name="ips.checkout.review.js" javascript_type="controller" javascript_version="5000028" javascript_position="1000100"><![CDATA[/**
|
||||
<file javascript_app="nexus" javascript_location="front" javascript_path="controllers/checkout" javascript_name="ips.checkout.review.js" javascript_type="controller" javascript_version="5000029" javascript_position="1000100"><![CDATA[/**
|
||||
* Invision Community
|
||||
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
|
||||
*
|
||||
@@ -91,7 +91,7 @@
|
||||
}
|
||||
});
|
||||
}(jQuery, _));]]></file>
|
||||
<file javascript_app="nexus" javascript_location="global" javascript_path="controllers/forms" javascript_name="ips.forms.businessAddressVat.js" javascript_type="controller" javascript_version="5000028" javascript_position="1000150"><![CDATA[/**
|
||||
<file javascript_app="nexus" javascript_location="global" javascript_path="controllers/forms" javascript_name="ips.forms.businessAddressVat.js" javascript_type="controller" javascript_version="5000029" javascript_position="1000150"><![CDATA[/**
|
||||
* Invision Community
|
||||
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
|
||||
*
|
||||
@@ -130,7 +130,7 @@
|
||||
|
||||
});
|
||||
}(jQuery, _));]]></file>
|
||||
<file javascript_app="nexus" javascript_location="global" javascript_path="controllers/gateways" javascript_name="ips.gateways.stripe.js" javascript_type="controller" javascript_version="5000028" javascript_position="1000200"><![CDATA[/**
|
||||
<file javascript_app="nexus" javascript_location="global" javascript_path="controllers/gateways" javascript_name="ips.gateways.stripe.js" javascript_type="controller" javascript_version="5000029" javascript_position="1000200"><![CDATA[/**
|
||||
* Invision Community
|
||||
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
|
||||
*
|
||||
@@ -471,7 +471,7 @@
|
||||
|
||||
});
|
||||
}(jQuery, _));]]></file>
|
||||
<file javascript_app="nexus" javascript_location="global" javascript_path="controllers/gateways" javascript_name="ips.gateways.stripepaymentrequest.js" javascript_type="controller" javascript_version="5000028" javascript_position="1000200">/**
|
||||
<file javascript_app="nexus" javascript_location="global" javascript_path="controllers/gateways" javascript_name="ips.gateways.stripepaymentrequest.js" javascript_type="controller" javascript_version="5000029" javascript_position="1000200">/**
|
||||
* IPS Community Suite 4
|
||||
* (c) 2017 Invision Power Services - http://www.invisionpower.com
|
||||
*
|
||||
@@ -552,7 +552,7 @@
|
||||
|
||||
});
|
||||
}(jQuery, _));</file>
|
||||
<file javascript_app="nexus" javascript_location="global" javascript_path="controllers/misc" javascript_name="ips.misc.print.js" javascript_type="controller" javascript_version="5000028" javascript_position="1000100">/**
|
||||
<file javascript_app="nexus" javascript_location="global" javascript_path="controllers/misc" javascript_name="ips.misc.print.js" javascript_type="controller" javascript_version="5000029" javascript_position="1000100">/**
|
||||
* Invision Community
|
||||
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
|
||||
*
|
||||
@@ -574,7 +574,7 @@
|
||||
|
||||
});
|
||||
}(jQuery, _));</file>
|
||||
<file javascript_app="nexus" javascript_location="admin" javascript_path="controllers/notifications" javascript_name="ips.notifications.pendingTransactions.js" javascript_type="controller" javascript_version="5000028" javascript_position="1000100">/**
|
||||
<file javascript_app="nexus" javascript_location="admin" javascript_path="controllers/notifications" javascript_name="ips.notifications.pendingTransactions.js" javascript_type="controller" javascript_version="5000029" javascript_position="1000100">/**
|
||||
* Invision Community
|
||||
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
|
||||
*
|
||||
@@ -654,7 +654,7 @@
|
||||
|
||||
});
|
||||
}(jQuery, _));</file>
|
||||
<file javascript_app="nexus" javascript_location="admin" javascript_path="controllers/store" javascript_name="ips.store.productoptions.js" javascript_type="controller" javascript_version="5000028" javascript_position="1000150"><![CDATA[/**
|
||||
<file javascript_app="nexus" javascript_location="admin" javascript_path="controllers/store" javascript_name="ips.store.productoptions.js" javascript_type="controller" javascript_version="5000029" javascript_position="1000150"><![CDATA[/**
|
||||
* Invision Community
|
||||
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
|
||||
*
|
||||
@@ -709,7 +709,7 @@
|
||||
|
||||
});
|
||||
}(jQuery, _));]]></file>
|
||||
<file javascript_app="nexus" javascript_location="admin" javascript_path="controllers/store" javascript_name="ips.store.productselector.js" javascript_type="controller" javascript_version="5000028" javascript_position="1000150"><![CDATA[/**
|
||||
<file javascript_app="nexus" javascript_location="admin" javascript_path="controllers/store" javascript_name="ips.store.productselector.js" javascript_type="controller" javascript_version="5000029" javascript_position="1000150"><![CDATA[/**
|
||||
* Invision Community
|
||||
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
|
||||
*
|
||||
@@ -769,7 +769,7 @@
|
||||
|
||||
});
|
||||
}(jQuery, _));]]></file>
|
||||
<file javascript_app="nexus" javascript_location="front" javascript_path="controllers/store" javascript_name="ips.store.cartReview.js" javascript_type="controller" javascript_version="5000028" javascript_position="1000200">/**
|
||||
<file javascript_app="nexus" javascript_location="front" javascript_path="controllers/store" javascript_name="ips.store.cartReview.js" javascript_type="controller" javascript_version="5000029" javascript_position="1000200">/**
|
||||
* Invision Community
|
||||
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
|
||||
*
|
||||
@@ -869,7 +869,7 @@
|
||||
}
|
||||
});
|
||||
}(jQuery, _));</file>
|
||||
<file javascript_app="nexus" javascript_location="front" javascript_path="controllers/store" javascript_name="ips.store.category.js" javascript_type="controller" javascript_version="5000028" javascript_position="1000200"><![CDATA[/**
|
||||
<file javascript_app="nexus" javascript_location="front" javascript_path="controllers/store" javascript_name="ips.store.category.js" javascript_type="controller" javascript_version="5000029" javascript_position="1000200"><![CDATA[/**
|
||||
* Invision Community
|
||||
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
|
||||
*
|
||||
@@ -977,7 +977,7 @@
|
||||
}
|
||||
});
|
||||
}(jQuery, _));]]></file>
|
||||
<file javascript_app="nexus" javascript_location="front" javascript_path="controllers/store" javascript_name="ips.store.currencySelect.js" javascript_type="controller" javascript_version="5000028" javascript_position="1000200">/**
|
||||
<file javascript_app="nexus" javascript_location="front" javascript_path="controllers/store" javascript_name="ips.store.currencySelect.js" javascript_type="controller" javascript_version="5000029" javascript_position="1000200">/**
|
||||
* Invision Community
|
||||
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
|
||||
*
|
||||
@@ -1020,7 +1020,7 @@
|
||||
}
|
||||
});
|
||||
}(jQuery, _));</file>
|
||||
<file javascript_app="nexus" javascript_location="front" javascript_path="controllers/store" javascript_name="ips.store.giftCard.js" javascript_type="controller" javascript_version="5000028" javascript_position="1000200"><![CDATA[/**
|
||||
<file javascript_app="nexus" javascript_location="front" javascript_path="controllers/store" javascript_name="ips.store.giftCard.js" javascript_type="controller" javascript_version="5000029" javascript_position="1000200"><![CDATA[/**
|
||||
* Invision Community
|
||||
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
|
||||
*
|
||||
@@ -1108,7 +1108,7 @@
|
||||
}
|
||||
});
|
||||
}(jQuery, _));]]></file>
|
||||
<file javascript_app="nexus" javascript_location="front" javascript_path="controllers/store" javascript_name="ips.store.packagePage.js" javascript_type="controller" javascript_version="5000028" javascript_position="1000200"><![CDATA[/**
|
||||
<file javascript_app="nexus" javascript_location="front" javascript_path="controllers/store" javascript_name="ips.store.packagePage.js" javascript_type="controller" javascript_version="5000029" javascript_position="1000200"><![CDATA[/**
|
||||
* Invision Community
|
||||
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
|
||||
*
|
||||
@@ -1385,7 +1385,7 @@
|
||||
|
||||
});
|
||||
}(jQuery, _));]]></file>
|
||||
<file javascript_app="nexus" javascript_location="front" javascript_path="controllers/store" javascript_name="ips.store.register.js" javascript_type="controller" javascript_version="5000028" javascript_position="1000200"><![CDATA[/**
|
||||
<file javascript_app="nexus" javascript_location="front" javascript_path="controllers/store" javascript_name="ips.store.register.js" javascript_type="controller" javascript_version="5000029" javascript_position="1000200"><![CDATA[/**
|
||||
* Invision Community
|
||||
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
|
||||
*
|
||||
@@ -1534,7 +1534,7 @@
|
||||
},
|
||||
});
|
||||
}(jQuery, _));]]></file>
|
||||
<file javascript_app="nexus" javascript_location="front" javascript_path="controllers/subscriptions" javascript_name="ips.subscriptions.main.js" javascript_type="controller" javascript_version="5000028" javascript_position="1000150">/**
|
||||
<file javascript_app="nexus" javascript_location="front" javascript_path="controllers/subscriptions" javascript_name="ips.subscriptions.main.js" javascript_type="controller" javascript_version="5000029" javascript_position="1000150">/**
|
||||
* Invision Community
|
||||
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
|
||||
*
|
||||
@@ -1572,7 +1572,7 @@
|
||||
}
|
||||
});
|
||||
}(jQuery, _));</file>
|
||||
<file javascript_app="nexus" javascript_location="admin" javascript_path="templates" javascript_name="ips.templates.store.js" javascript_type="template" javascript_version="5000028" javascript_position="1000050"><![CDATA[ips.templates.set('nexus.store.images', `
|
||||
<file javascript_app="nexus" javascript_location="admin" javascript_path="templates" javascript_name="ips.templates.store.js" javascript_type="template" javascript_version="5000029" javascript_position="1000050"><![CDATA[ips.templates.set('nexus.store.images', `
|
||||
<div class='ipsUploader__row ipsUploader__row--image ipsAttach {{#done}}ipsAttach_done{{/done}}' id='{{id}}' data-role='file' data-fileid='{{id}}' data-fullsizeurl='{{imagesrc}}' data-thumbnailurl='{{thumbnail}}' data-fileType='image'>
|
||||
<div class='ipsUploader__rowPreview' data-role='preview'>
|
||||
{{#thumb}}
|
||||
@@ -1605,12 +1605,12 @@
|
||||
ips.templates.set('nexus.store.imagesWrapper', `
|
||||
<div class='ipsUploader__container ipsUploader__container--images'>{{{content}}}</div>
|
||||
`);]]></file>
|
||||
<file javascript_app="nexus" javascript_location="front" javascript_path="templates" javascript_name="ips.templates.store.js" javascript_type="template" javascript_version="5000028" javascript_position="1000050"><![CDATA[ips.templates.set('nexus.store.productImage', " \
|
||||
<file javascript_app="nexus" javascript_location="front" javascript_path="templates" javascript_name="ips.templates.store.js" javascript_type="template" javascript_version="5000029" javascript_position="1000050"><![CDATA[ips.templates.set('nexus.store.productImage', " \
|
||||
<a href='{{fullURL}}' data-fullURL='{{fullURL}}' class='cNexusProduct_primaryImage' data-ipsLightbox data-ipsLightbox-group='product' style='background-image:url({{thumbURL}})'>\
|
||||
<img src='{{thumbURL}}' alt=''>\
|
||||
</a>\
|
||||
");]]></file>
|
||||
<file javascript_app="nexus" javascript_location="global" javascript_path="templates" javascript_name="ips.templates.gateways.js" javascript_type="template" javascript_version="5000028" javascript_position="1000050"><![CDATA[ips.templates.set('nexus.gateway.vaultAccount', " \
|
||||
<file javascript_app="nexus" javascript_location="global" javascript_path="templates" javascript_name="ips.templates.gateways.js" javascript_type="template" javascript_version="5000029" javascript_position="1000050"><![CDATA[ips.templates.set('nexus.gateway.vaultAccount', " \
|
||||
<li>\
|
||||
<input type='radio' name='{{fieldName}}[stored]' value='{{value}}' id='{{fieldName}}_stored{{random}}' data-control='toggle' data-toggles='{{fieldName}}_existing' class='ipsInput ipsInput--toggle'>\
|
||||
<div class='ipsFieldList__content'>\
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<language>
|
||||
<app key="nexus" version="5000028">
|
||||
<app key="nexus" version="5000029">
|
||||
<word key="__app_nexus" js="0">Commerce</word>
|
||||
<word key="menutab__nexus" js="0">Commerce</word>
|
||||
<word key="menutab__nexus_icon" js="0">usd</word>
|
||||
|
||||
@@ -277,5 +277,6 @@
|
||||
"5000025": "5.0.0 Alpha 16",
|
||||
"5000026": "5.0.0 Beta 1",
|
||||
"5000027": "5.0.0 Beta 2",
|
||||
"5000028": "5.0.0 Beta 2"
|
||||
"5000028": "5.0.0 Beta 2",
|
||||
"5000029": "5.0.0 Beta 3"
|
||||
}
|
||||
@@ -304,7 +304,7 @@ class subscriptions extends Controller
|
||||
}
|
||||
$options['cancel'] = Url::internal( "app=nexus&module=subscriptions&controller=subscriptions" );
|
||||
|
||||
Output::i()->output = Theme::i()->getTemplate( 'global', 'core' )->decision( 'subscription_delete_blurb', $options );
|
||||
Output::i()->output = Theme::i()->getTemplate( 'global', 'core', 'global' )->decision( 'subscription_delete_blurb', $options );
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -519,7 +519,7 @@ class subscriptions extends Controller
|
||||
existing purchases unnecessarily */
|
||||
if ( !empty( $changes ) AND $purchases )
|
||||
{
|
||||
Output::i()->output = Theme::i()->getTemplate( 'global', 'core' )->decision( 'product_change_blurb', array(
|
||||
Output::i()->output = Theme::i()->getTemplate( 'global', 'core', 'global' )->decision( 'product_change_blurb', array(
|
||||
'product_change_blurb_existing' => Url::internal( "app=nexus&module=subscriptions&controller=subscriptions&do=updateExisting&id={$new->_id}" )->setQueryString( 'changes', json_encode( $changes ) )->csrf(),
|
||||
'product_change_blurb_new' => $this->url->setQueryString( array( 'root' => ( $new->parent() ? $new->parent()->_id : '' ) ) ),
|
||||
) );
|
||||
@@ -677,7 +677,7 @@ class subscriptions extends Controller
|
||||
) )->csrf();
|
||||
}
|
||||
|
||||
Output::i()->output = Theme::i()->getTemplate( 'global', 'core' )->decision( 'change_renew_ba_blurb', $options );
|
||||
Output::i()->output = Theme::i()->getTemplate( 'global', 'core', 'global' )->decision( 'change_renew_ba_blurb', $options );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"id": 5000029,
|
||||
"name": "5.0.0 Beta 3",
|
||||
"steps": {
|
||||
"queries": false,
|
||||
"lang": false,
|
||||
"theme": false,
|
||||
"themeeditor": true,
|
||||
"javascript": false,
|
||||
"emailTemplates": false,
|
||||
"acpSearchKeywords": false,
|
||||
"settings": false,
|
||||
"tasks": false,
|
||||
"modules": false,
|
||||
"widgets": false,
|
||||
"customOptions": false,
|
||||
"customRoutines": false
|
||||
},
|
||||
"forceMainUpgrader": false,
|
||||
"forceManualDownloadNoCiC": false,
|
||||
"forceManualDownloadCiC": false
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"categories": {
|
||||
"added": [],
|
||||
"edited": [],
|
||||
"removed": []
|
||||
},
|
||||
"settings": {
|
||||
"added": [],
|
||||
"edited": [
|
||||
"layout_store_view"
|
||||
],
|
||||
"removed": []
|
||||
}
|
||||
}
|
||||
@@ -746,9 +746,10 @@ class Package extends Model
|
||||
return new Money( $priceOfThisPackage - $priceOfExistingPackage, $currency );
|
||||
|
||||
case 2:
|
||||
if ( !$purchase->renewals )
|
||||
/* If there are no renewals, we charge full price no matter what */
|
||||
if ( !$purchase->renewals and !$purchase->expire )
|
||||
{
|
||||
return new Money( 0, $currency );
|
||||
return new Money( $priceOfThisPackage, $currency );
|
||||
}
|
||||
if ( !$renewalOptionsOnNewPackage )
|
||||
{
|
||||
@@ -757,11 +758,11 @@ class Package extends Model
|
||||
|
||||
/* What is the closest renewal option on the new package? We'll use that one */
|
||||
$renewalOptionsInDays = array();
|
||||
$term = ( new RenewalTerm( new Money( $renewalOptionsOnNewPackage['cost'][ $currency ]['amount'], $currency ), new DateInterval( 'P' . $renewalOptionsOnNewPackage['term'] . mb_strtoupper( $renewalOptionsOnNewPackage['unit'] ) ), $purchase->renewals->tax ) );
|
||||
$term = ( new RenewalTerm( new Money( $renewalOptionsOnNewPackage['cost'][ $currency ]['amount'], $currency ), new DateInterval( 'P' . $renewalOptionsOnNewPackage['term'] . mb_strtoupper( $renewalOptionsOnNewPackage['unit'] ) ), $purchase->renewals?->tax ) );
|
||||
$renewalOptionsInDays[ $term->days() ] = $term;
|
||||
|
||||
$closestRenewalOption = null;
|
||||
$numberOfDaysInCurrentRenewalTerm = $purchase->renewals->days();
|
||||
$numberOfDaysInCurrentRenewalTerm = $purchase->renewals ? $purchase->renewals->days() : ( $purchase->expire ? $purchase->start->diff( $purchase->expire )->days : 0 );
|
||||
foreach ( $renewalOptionsInDays as $days => $term )
|
||||
{
|
||||
if ( $closestRenewalOption === null or abs( $numberOfDaysInCurrentRenewalTerm - $closestRenewalOption ) > abs( $days - $numberOfDaysInCurrentRenewalTerm ) )
|
||||
@@ -770,6 +771,7 @@ class Package extends Model
|
||||
}
|
||||
}
|
||||
$renewalTermToUse = $renewalOptionsInDays[ $closestRenewalOption ];
|
||||
$numberOfDaysInCurrentRenewalTerm = new Number( (string) round( $numberOfDaysInCurrentRenewalTerm ) );
|
||||
|
||||
|
||||
/* If the purchase is not active, it is the full cost */
|
||||
@@ -779,22 +781,49 @@ class Package extends Model
|
||||
}
|
||||
|
||||
/* Current Period Start Date */
|
||||
$startOfCurrentPeriod = $purchase->expire->sub( $purchase->renewals->interval );
|
||||
if( $purchase->expire instanceof DateTime and $purchase->renewals )
|
||||
{
|
||||
$startOfCurrentPeriod = $purchase->expire->sub( $purchase->renewals->interval );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* If the purchase does not expire, we have to do some fun logic here */
|
||||
$timeSincePurchase = $purchase->start->diff( DateTime::create() );
|
||||
$daysUsedSincePurchase = new Number( (string)DateTime::intervalToDays( $timeSincePurchase ) );
|
||||
|
||||
/* If we used less than a full renewal period, then set the start to the purchase date */
|
||||
if( $daysUsedSincePurchase->compare( $numberOfDaysInCurrentRenewalTerm ) <= 0 )
|
||||
{
|
||||
$startOfCurrentPeriod = $purchase->start;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Otherwise loop through all the used intervals */
|
||||
$start = clone $purchase->start;
|
||||
while( $daysUsedSincePurchase->compare( $numberOfDaysInCurrentRenewalTerm ) > 0 )
|
||||
{
|
||||
$start = $start->add( $purchase->renewals->interval );
|
||||
$timeSincePurchase = $start->diff( DateTime::create() );
|
||||
$daysUsedSincePurchase = new Number( (string)DateTime::intervalToDays( $timeSincePurchase ) );
|
||||
}
|
||||
$startOfCurrentPeriod = $start;
|
||||
}
|
||||
}
|
||||
|
||||
/* DateInterval of time between subscription start and now */
|
||||
$timeSinceStartOfCurrentPeriod = $startOfCurrentPeriod->diff( DateTime::create() );
|
||||
$numberOfDaysInCurrentRenewalTerm = new Number( (string) round( $numberOfDaysInCurrentRenewalTerm ) );
|
||||
|
||||
/* Count Days in Period */
|
||||
$daysUsedInPeriod = new Number( (string)DateTime::intervalToDays( $timeSinceStartOfCurrentPeriod ) );
|
||||
$daysRemainingInPeriod = new Number( (string) $numberOfDaysInCurrentRenewalTerm->subtract( $daysUsedInPeriod ) );
|
||||
|
||||
/* Currency Worth of value used in current sub */
|
||||
$valueUsedOfSubscription = $purchase->renewals->cost->amount->divide( $numberOfDaysInCurrentRenewalTerm )->multiply( $daysUsedInPeriod );
|
||||
$valueUsedOfSubscription = $purchase->renewals ? $purchase->renewals->cost->amount->divide( $numberOfDaysInCurrentRenewalTerm )->multiply( $daysUsedInPeriod ) : new Money( new Number( '0' ), $currency );
|
||||
|
||||
/* If there are no days left, charge the full amount */
|
||||
if ( !$daysRemainingInPeriod->isGreaterThanZero() )
|
||||
{
|
||||
return new Money( new Number('0'), $currency );
|
||||
return new Money( $priceOfThisPackage, $currency );
|
||||
}
|
||||
elseif( $priceOfExistingPackage > $priceOfThisPackage )
|
||||
{
|
||||
@@ -804,7 +833,21 @@ class Package extends Model
|
||||
}
|
||||
else
|
||||
{
|
||||
return new Money( $renewalTermToUse->cost->amount->subtract( $valueUsedOfSubscription ), $currency );
|
||||
/* If we have renewals, then we have a valid value to use */
|
||||
if( $purchase->renewals )
|
||||
{
|
||||
return new Money( $renewalTermToUse->cost->amount->subtract( $valueUsedOfSubscription ), $currency );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Otherwise we have to calculate the cost based on how much time is left */
|
||||
$cost = new Money( $renewalTermToUse->costPerDay()->amount->multiply( $daysRemainingInPeriod ), $currency );
|
||||
if( $cost->amount->compare( new Number( $priceOfThisPackage ) ) == 1 )
|
||||
{
|
||||
$cost = new Money( $priceOfThisPackage, $currency );
|
||||
}
|
||||
return $cost;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user