Skip to end of banner
Go to start of banner

Swap Subscription Service

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

The following example shows how to replace an effective subscription service with a new service.

 

swapService.java
@EJB private CRMProcessSubscriptionServiceSwapBean processSubscriptionServiceSwapBean;
    
public CRMDOSubscriptionAction swapService(CRMDOSubscription subscription,CRMDOProduct product,CRMDOProduct newProduct){
    
    //create the subscription service swap data object
    SubscriptionServiceSwap subscriptionServiceSwap = processSubscriptionServiceSwapBean.constructSubscriptionServiceSwap(subscription);
    
    //in that action you don't need to define classification code
    //The system will decide the classification code
    //The applicable classification for that action are:UPGRADE_SERVICE,DOWNGRADE_SERVICE,SWITCH_SERVICE
    //the list of the product that will be swapped on the subscription
    //in that example we swap only one product but you can swap in one go more than one product
    Set<SubscriptionActionProduct> servicesToBeProcessed = new HashSet<SubscriptionActionProduct>();
    
    //create a new subscription action product data object where you will define the from/to product that will be process by the action
    SubscriptionActionProduct subscriptionActionProduct =new SubscriptionActionProduct();
    //load the related subscription service 
    CRMDOSubscriptionService subscriptionService = subscriptionServiceBean.load(subscription, product);
    
    subscriptionActionProduct.setIsDeleted(new Integer(0));
    subscriptionActionProduct.setProduct(product);
    subscriptionActionProduct.setSubService(subscriptionService);
    subscriptionActionProduct.setChangeToProduct(newProduct);
    subscriptionActionProduct.setIsSelected(new Integer(1));
        
    servicesToBeProcessed.add(subscriptionActionProduct);
    
    subscriptionServiceSwap.setServicesToBeProcessed(servicesToBeProcessed);
    
    //submit the subscription service swap data object in order the new product replace the existing product on the subscription. 
    //As a result is the subscription action data object.
    //the subscription action data object is the object which contains all the information about the action you perform on the subscription
    CRMDOSubscriptionAction subscriptionAction = processSubscriptionServiceSwapBean.submit(subscriptionServiceSwap);
}
  • No labels