An application can use its own view to show the status of a subscription that delivers the application
services to subscribers.
For this purpose, APS JS SDK provides the aps/biz/SubscriptionInfoTile
module that shows
a tile with the subscription business-related properties.
In this document:
A tile informs about the current status of the subscription and allow getting more details by means of some action buttons.
Depending on the subscription status, a set of displayed properties and buttons may vary.
Typical subscription properties are as follows:
The buttons in the tile support the following actions:
Typical steps to use the module in an application view are as follows.
In the init
method, add the aps/biz/SubscriptionInfoTile
module to the widget hierarchy returned by the method.
In the following example, it is added with default values:
return ["aps/Panel",[
["aps/Tiles", [
["aps/biz/SubscriptionInfoTile", {
id: this.genId("subscription_status")
}]
]],
["aps/Grid", { ... }, [ ... ]]
]];
In the onContext
method, specify the APS ID of the subscription to be displayed. For example:
this.byId("subscription_status").set(
"subscriptionId",
aps.context.vars.context.aps.subscription
);
The module declares the following properties:
subscriptionId
specifies the APS ID of the subscription as demonstrated in the example above.
title
replaces the default “Subscription” title of the tile.
subscriptionStatusList
is an object that defines a label and a CSS style for each subscription status.
It is assigned the following structure by default:
subscriptionStatusList: {
"ordered": {
label: "Registering",
type: "default"
},
"active": {
label: "Active",
type: "success"
},
"canceling": {
label: "Canceling",
type: "default"
},
"graced": {
label: "Expired",
type: "danger"
},
"expired": {
label: "Expired",
type: "danger"
},
"terminated": {
label: "Canceled",
type: "disabled"
}
}
If necessary, redefine the subscriptionStatusList` object as needed.