34 Filtering Start and End Dates for Additional Purchase

This chapter provides an overview of customizing the Oracle Communications Billing Care to filter Purchase, Recurring (cycle), and Usage start and end dates displayed during additional purchase configuration.

About Customizing Purchase Configuration

You configure new or additional products or services added to an account by clicking Configure in the Purchase Catalogue screen. In the Configure screen, multiple start and end date options are displayed for configuring activation, recurring cycles, and usage of the selected product or service.

You can customize Billing Care to filter these start and end date options to display only calendar days for the start date and the number of months for the end date by using the Billing Care SDK. You can also hide the Recurring (cycle) and Usage sections by using the Billing Care SDK.

Filtering Start and End Date Options

You can customize the purchase configuration screen using the Billing Care SDK to display only the specific start and end date options for activation, recurring fees, and usage of the selected additional product or service.

To filter start and end date options:

  1. Create a custom purchase configuration view model to override the default purchase configuration flow. See "Creating a Custom Purchase Deal Configuration View Model" for more information.

  2. Configure the custom purchase configuration view model entry in the customRegistry.js file to use the custom view model that you created. See "Configuring the Custom Purchase Configuration View Model in the registry" for more information.

  3. Deploy your customizations using one of the methods described in "Using an Exploded Archive during Customization" or "Packaging and Deploying Customizations".

Creating a Custom Purchase Deal Configuration View Model

Billing Care uses view model to define the display of the screens in Billing Care. You must create or update the custom view model, CustomPurchaseConfigurationViewModel, and add the details containing the logic to filter Purchase, Recurring (cycle), and Usage start and end dates.

See "About View Models" for more information about Billing Care view models.

To create a custom purchase deal configuration view model:

  1. Create the customPurchaseConfigurationViewModel.js file in myproject/web/custom/viewmodels directory, where myproject is the folder containing your NetBeans IDE project.

  2. Add the following code in the customPurchaseConfigurationViewModel.js file using a text editor:

    define(['knockout', 
        'jquery', 
        'underscore', 
        Registry.accountCreation.wizardBase, 
        Registry.accountCreationConfigure.purchaseConfiguration.validator, 
        'viewmodels/accountCreation/configure/PurchaseConfigurationViewModel', 
        'ojs/ojcore', 'ojs/ojknockout', 'ojs/ojdatetimepicker', 
    'ojs/ojcheckboxset', 'knockout-extension'], 
            function (ko, $, _, WizardBaseViewModel, 
    ProductCustomizationValidator, PurchaseConfigurationViewModel, oj) { 
                function CustomPurchaseConfigurationViewModel() { 
                    PurchaseConfigurationViewModel.apply(this, arguments); 
    ... 
    ... 
                } 
                CustomPurchaseConfigurationViewModel.prototype = new 
    PurchaseConfigurationViewModel(); 
                return CustomPurchaseConfigurationViewModel; 
            } 
    ); 
    
    //   Below observable arrays hold the options to be shown in the Product Configuration Screen 
    //   Each entry in the Observable Array is stored as an Object which has three attributes 
    //   label : the text which will be shown in the UI dropdown 
    //   value : this attribute stores the value of the option used in viewmodel to create the JSON to be sent to REST 
    //   disable : this attribute tells the dropdown whether it will be enabled to click or not 
    //   The SUPERSET for the dropdown options in OOTB is below. 
    //      ([ 
    //           {label: util.getLocalizedValue(productCustomization, 'TODAY'), 
    value:TODAY,disable: ko.observable(false)}, 
    //           {label: util.getLocalizedValue(productCustomization, 'NEVER'), 
    value:NEVER,disable: ko.observable(false)}, 
    //           {label: util.getLocalizedValue(productCustomization, 
    'WHEN_PURCHASE_ACTIVATION_BEGINS'),value:WHEN_PURCHASE_ACTIVATION_BEGINS, 
    disable: ko.observable(false)}, 
    //           {label: util.getLocalizedValue(productCustomization, 
    'CALENDAR_DAY'),value:CALENDER_DAY, disable: ko.observable(false)}, 
    //           {label: util.getLocalizedValue(productCustomization, 
    'DELIMITER_OPTION'),value:'-1', disable: ko.observable(true)}, 
    //           {label: util.getLocalizedValue(productCustomization, 
    'CYCLES_AFTER_ACTIVATION'),value:CYCLES_AFTER_ACTIVATION, disable: 
    ko.observable(false)}, 
    //           {label: util.getLocalizedValue(productCustomization, 
    'MONTHS_AFTER_ACTIVATION'),value:MONTHS_AFTER_ACTIVATION, disable: 
    ko.observable(false)}, 
    //           {label: util.getLocalizedValue(productCustomization, 
    'DAYS_AFTER_ACTIVATION'),value:DAYS_AFTER_ACTIVATION, disable: ko.observable(false)}, 
    //           {label: util.getLocalizedValue(productCustomization, 
    'HOURS_AFTER_ACTIVATION'),value:HOURS_AFTER_ACTIVATION, disable: 
    ko.observable(false)}, 
    //           {label: util.getLocalizedValue(productCustomization, 
    'MINUTES_AFTER_ACTIVATION'),value:MINUTES_AFTER_ACTIVATION, disable: 
    ko.observable(false)}, 
    //           {label: util.getLocalizedValue(productCustomization, 
    'SECONDS_AFTER_ACTIVATION'),value:SECONDS_AFTER_ACTIVATION, disable: 
    ko.observable(false)} 
    //       ]); 
    //     The values which are used in VM for JSON creation are : 
    //     NOTE : do not override these variables 
    //           var TODAY = "today"; 
    //           var CALENDAR_DAY = "calendar-day"; 
    //           var NEVER = "never"; 
    //           var SECONDS_AFTER_ACTIVATION = "seconds"; 
    //           var MINUTES_AFTER_ACTIVATION = "minutes"; 
    //           var DAYS_AFTER_ACTIVATION = "days"; 
    //           var HOURS_AFTER_ACTIVATION = "hours"; 
    //           var MONTHS_AFTER_ACTIVATION = "months"; 
    //           var CYCLES_AFTER_ACTIVATION = "cycles"; 
    //           var WHEN_PURCHASE_ACTIVATION_BEGINS="when-purchase-activation-begins"; 
    
        self.productActivationDateOptions - observable array which should be 
    overridden dropdown options for Product Activation 
        self.productDeactivationDateOptions - observable array which should be 
    overridden dropdown options for Product De-activation 
        self.productStartCycleDateOptions - observable array which should be 
    overridden dropdown options for Cycle/Recurring Start 
        self.productStopCycleDateOptions - observable array which should be 
    overridden dropdown options for Cycle/Recurring Stop 
        self.productStartUsageDateOptions - observable array which should be 
    overridden dropdown options for Usage Start 
        self.productStopUsageDateOptions - observable array which should be 
    overridden dropdown options for Usage Stop 
    
  3. Modify the following entries in the file as required to filter the date options displayed in the Configure screen:

    • productActivationDateOptions

    • productDeactivationDateOptions

    • productStartCycleDateOptions

    • productStopCycleDateOptions

    • productStartUsageDateOptions

    • productStopUsageDateOptions

    For example, if product deactivation list in the Configure screen has to be modified to include only CYCLES_AFTER_ACTIVATION and MONTHS_AFTER_ACTIVATION options, override the productDeactivationDateOptions entry in the file to include only these options:

    self.productDeactivationDateOptions = ko.observableArray([ 
                        {label: util.getLocalizedValue(productCustomization, 
    'CYCLES_AFTER_ACTIVATION'), value: 'cycles', disable: ko.observable(false)}, 
                        {label: util.getLocalizedValue(productCustomization, 
    'MONTHS_AFTER_ACTIVATION'), value: 'months', disable: ko.observable(false)}, 
                    ]); 
    
  4. (Optional) To hide the complete Recurring (cycle) section, set the showProductConfigureCycleSection entry in the file to false:

    self.showProductConfigureCycleSection = ko.observable(false); 
    
  5. (Optional) To hide the complete Usage section, set the showProductConfigureUsageSection entry in the file to false:

    self.showProductConfigureUsageSection = ko.observable(false); 
    
        // BRM mandates that - 
        // Cycle/Usage START is always greater than or equal to Purchase START 
        // Cycle/Usage END is always less than or equal to Purchase END 
        // If Cycle/Usage section is hidden, then their START and END must be set same 
        // as that of Purchase START and END 
        // Override Cycle/Usage variables as below to map it to Purchase 
    
        self.cycleStart = ko.computed(function(){ 
            return self.purchaseStart(); 
        }); 
        self.cycleEnd = ko.computed(function(){ 
            return self.purchaseEnd(); 
        }); 
        self.cycleEndRelativeValue = ko.computed(function(){ 
            return self.purchaseDeactivationRelativeValue(); 
        }); 
        self.usageStart = ko.computed(function(){ 
            return self.purchaseStart(); 
        }); 
        self.usageEnd = ko.computed(function(){ 
            return self.purchaseEnd(); 
        }); 
        self.usageEndRelativeValue = ko.computed(function(){ 
            return self.purchaseDeactivationRelativeValue(); 
        }); 
    
  6. Save the file in your NetBeans IDE project.

Configuring the Custom Purchase Configuration View Model in the registry

After creating the required custom view model, create a custom purchase configuration view model entry in the customRegistry.js file. Billing Care uses the custom purchase configuration view model instead of the default view model during additional product purchase and renders the Configure screen containing your customization.

To create the custom purchase configuration view model entry in the registry:

  1. Create a customRegistry.js file in myproject/web/custom/ directory.

  2. Define the custom event adjustment module in this file. For example:

    accountCreationConfigure: {
             purchaseConfiguration:
                    {
                        viewmodel: "custom/viewmodels/CustomPurchaseConfigurationViewModel.js"
                    },
        },
    
  3. Save the file in your NetBeans IDE project.