SubscriptionRefined Apex Class

Limio for Salesforce (LFS) package includes a custom SubscriptionRefined Apex class, that collects properties across several subscription-related objects (such as Schedule, Product, Offer etc) and centralises them on one level.

These properties can be used to customise what's being surfaced in the Customer's Subscriptions list, see .

They could also be used for determining what actions should be available for a specific subscription, based on its attributes. To customise the list of available actions see .

This document describes the LFS Subscription global properties (SubscriptionRefined) as mapped from the Limio subscription object. Since all of these properties are global, they can be accessed in the org where the managed package is installed.

Fields mapped from the Subscription

String subscriptionName

name

String subscriptionId

id

Date startDate

startDate

Date endDate

termEndDate

String status

status

String purchaseCountry

purchaseCountry

Integer quantity

quantity

String owner

owner

String customerId

customerId

Fields mapped from the Subscription Schedules

Every subscription has an associated list of schedules.

If you navigate to any Schedule record in the Limio App and scroll to the end of the page you’ll find a structure representing a Limio Schedule Object. Most of the fields are reflected on the UI above the structure.

Each entry corresponds to a billing term. LFS defines a currently active schedule item (schedule_date <= today) and calculates the following properties using it:

Date billingPeriodStart
currentSchedule.schedule_date

Date billingPeriodEnd

nextSchedule.schedule_date

Decimal latestCharge

currentSchedule.amount

Decimal nextCharge

nextSchedule.amount

String currency_x

currentSchedule.currency

Fields mapped from the Subscription Offers

Every subscription has an associated list of offers on it. During the lifetime of the subscription, an offer can change, and the new one is added to the list.

If you navigate to any Offer on a Subcription record in the Limio App and scroll to the end of the page you’ll find a structure representing a Limio Offer Object. Most of the fields are reflected on the UI above the structure.

LFS defines a currently active offer (start <= today, with no defined end_date or an end_date in the future) and calculates the following properties using it:

String offerName
transformed activeOffer.offer.path OR activeOffer.offer.parent_path

String offerPath

activeOffer.offer.path

SubscriptionRefined.OfferTerm offerTerm

activeOffer.offer.data.attributes.term_limio This is an object containing two properties: length and type

List offerAllowedCountries

activeOffer.offer.data.attributes.allowed_countries_limio

List offerProducts

list of product.path values from activeOffer.products

Decimal maxRefundAmount

Maximum amount to be refunded which is applied to the Cancel, Switch and Refund journeys in LFS, and defaults to the latest charge amount. Note: it is possible to override the maximum refund limit in the LFS flows, see for more details.

Boolean isAutoRenewable

if true, it means that an active offer is auto-renewable activeOffer.offer.data.attributes.autoRenew_limio

Boolean hasDelivery

if true, it means that at least one of the products associated with an active offer is deliverable product.attributes.has_delivery_limio

Fields mapped from the Subscription Address

Limio Subscription has an associated list of Limio Address records.

List addressList

a list of mapped addresses in the following format: <br> String FirstName;<br> String LastName;<br> String CompanyName;<br> String label;<br> String id;<br> String MailingCountry;<br> String MailingStreet;<br> String MailingPostalCode;<br> String MailingCity;<br> String MailingState;<br>

Fields calculated for a Gift Subscription

When a customer buys a gift subscription, a new gift code is generated and associated with the subscription object. LFS surfaces three gift-related properties on a SubscriptionRefined:

Boolean isGift
if true, it means that the subscription is a purchased gift

Boolean isGiftRefundable

if true, it means that the gift subscription status is active and it has not been redeemed or refunded yet; controls if the Refund action is shown in the list of allowed subscription actions

String gift_code

represents the gift code associated with the gift subscription

Other

List addressDetails is a deprecated property. Boolean hasErrors and String error are for internal use to verify that the subscription was loaded correctly.

Last updated

Was this helpful?