Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix re-enabling of a subscription after a long period of it being off. #183

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion service/mantle/product/SubscriptionServices.xml
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,18 @@ along with this software (see the LICENSE.md file). If not, see

<!-- determine fromDate (either last Subscription.thruDate if in future, or nowTimestamp -->
<!-- TODO: for renewals of a particular subscription, get resourceInstanceId from somewhere... (maybe OrderItem?) -->
<set field="nowTimestamp" from="ec.user.nowTimestamp"/>
<entity-find entity-name="mantle.product.subscription.Subscription" list="existingSubscriptionList">
<econdition field-name="subscriptionResourceId" from="subscriptionResourceId"/>
<econdition field-name="subscriberPartyId" from="customerPartyId"/>
<econdition field-name="resourceInstanceId" ignore-if-empty="true"/>
<econdition field-name="fromDate" operator="less-equals" from="nowTimestamp"/>
<econdition field-name="thruDate" operator="greater-equals" from="nowTimestamp"/>
<order-by field-name="-thruDate"/>
</entity-find>
<if condition="fromDate == null">
<set field="fromDate" from="existingSubscriptionList?.first?.thruDate ?: ec.user.nowTimestamp"/></if>
<set field="fromDate" from="existingSubscriptionList?.first?.thruDate ?: nowTimestamp"/></if>
<if condition="fromDate &lt; nowTimestamp"><set field="fromDate" from="nowTimestamp"/></if>
<if condition="!resourceInstanceId &amp;&amp; existingSubscriptionList">
<set field="resourceInstanceId" from="existingSubscriptionList[0].resourceInstanceId"/></if>

Expand Down