49 Extending REST API Request Objects

Learn how to enhance Billing Care REST API requests by overriding out-of-the-box fields within the input fields using extended payload data.

Example: Overriding FldProgramName in REST API Requests

In Billing Care REST API requests, the FldProgramName is set to "Billing Care" by default. The following example shows you how to to override this default string value using the PurchaseAndCancellationExtension SDK sample.

This functionality is applicable to the following API endpoints:

  • Add a Bundle to an Account: POST ...accounts/{id}/bundle
  • Update a Service's Status: PUT ...statusupdate/service/{id}
  • Update an Offer's Status: PUT ...statusupdate/offers/

To customize the program name associated with your API requests:

  1. Create a myproject/web/WEB-INF/classes/custom/customModule.properties file containing the following entries:
    billingcare.rest.account.module=com.oracle.communications.brm.sdk.modules.CustomAccountModule
    billingcare.rest.status.module=com.oracle.communications.brm.sdk.modules.CustomStatusModule
  2. Create a myproject/src/java/com/oracle/ communications/brm/sdk/modules/CustomAccountModule.java file. This Java class extends PCMAccountModule.
  3. Create a myproject/src/java/com/oracle/ communications/brm/sdk/modules/CustomStatusModule.java file. This Java class extends PCMStatusModule.
  4. Override the purchaseBundle() method in CustomAccountModule.java to override the "programName" input field which will be added as a part of extension field in request payload. For a sample of the override code, see SDK_home/samples/PurchaseAndCancellationExtension/src/java/com/oracle/communications/brm/sdk/modules/CustomAccountModule.java sample class.
  5. Override the changeStatus() and changeOffersStatus() methods in CustomStatusModule.java to override "programName" input field which will be added as a part of extension field in request payload. For a sample of the override code, see SDK_home/samples/PurchaseAndCancellationExtension//src/java/com/oracle/communications/brm/sdk/modules/CustomStatusModule.java sample class.
  6. Add the directories from SDK_home/libs to the extension project's classpath.
  7. Package and deploy your customizations using one of the methods described in "Using an Exploded Archive during Customization" or "Packaging and Deploying Customizations".

The following shows a sample payload for sending "programName" as an extended attribute during bundle purchase.

{
   "id":"0.0.0.1+-deal+155748",
   "name":"aaa Balance",
   "customizedChargeOffers":[
      {
         "name":"aaa Due",
         "description":"",
         "baseChargeOfferRef":{
            "id":"0.0.0.1+-product+158628",
            "uri":null
         }
      }
   ],
   "customizedDiscountOffers":[
      
   ],
   "extension":{
      "programName":"12121212"
   },
   "effective":null
}