• surbhi narula
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 0
    Replies
Below is the code :-
public class UPSRequestDataSet {
        
    public static cc_b_UPSResponseWrapper UPSWrapperData() {
        
        cc_b_UPSResponseWrapper UPSWrapObj = new cc_b_UPSResponseWrapper();
        
        cc_b_UPSResponseWrapper.UPSSecurity usertoken = new cc_b_UPSResponseWrapper.UPSSecurity();
        usertoken.Username = CC_Bee_Services__c.get('cc_b_UPS').Username__c ;
        cc_b_UPSResponseWrapper.UPSSecurity upsSec = new cc_b_UPSResponseWrapper.UPSSecurity();
        upsSec.UsernameToken = usertoken ;
        UPSWrapObj.UPSSecurity = upsSec ;
        //String str = Json.serialize(UPSWrapObj);
        return UPSWrapObj;
    }
}

Here cc_b_UPSResponseWrapper is my wrapper class having inner classes UPSSecurity ..
Please help to resolve the error..!!

My question is over the Cloud Craze guest user login..We are using Cloud craze for our new project and have set up all the configurations as well and according to it , to make a guest user login we need to select the page (CCSiteLogin) in Login and Registration in Community Management. We have done so but whenever user is logging in using the site URL is redirecting many times and giving the below result in URL :-

https://beedev-lolanimalnutrition.cs67.force.com/bee/ccrz__CCSiteLogin?startURL=%2Fbee%2Fccrz__CCSiteLogin%3FstartURL%3D%252Fbee%252Fccrz__CCSiteLogin%253FstartURL%253D%25252Fbee%25252Fccrz__CCSiteLogin%25253FstartURL%25253D%2525252Fbee%2525252Fccrz__CCSiteLogin%2525253FstartURL%2525253D%252525252Fbee%252525252Fccrz__CCSiteLogin%252525253FstartURL%252525253D%25252525252Fbee%25252525252Fccrz__CCSiteLogin%25252525253FstartURL%25252525253D%2525252525252Fbee%2525252525252Fccrz__CCSiteLogin%2525252525253FstartURL%2525252525253D%252525252525252Fbee%252525252525252Fccrz__CCSiteLogin%252525252525253FstartURL%252525252525253D%25252525252525252Fbee%25252525252525252Fccrz__CCSiteLogin%25252525252525253FstartURL%25252525252525253D%2525252525252525252Fbee%2525252525252525252Fccrz__CCSiteLogin%2525252525252525253FstartURL%2525252525252525253D%252525252525252525252Fbee%252525252525252525252Fccrz__CCSiteLogin%252525252525252525253FstartURL%252525252525252525253D%25252525252525252525252Fbee%25252525252525252525252Fccrz__CCSiteLogin%25252525252525252525253FstartURL%25252525252525252525253D%2525252525252525252525252Fbee%2525252525252525252525252Fccrz__CCSiteLogin%2525252525252525252525253FstartURL%2525252525252525252525253D%252525252525252525252525252Fbee%252525252525252525252525252Fccrz__CCSiteLogin%252525252525252525252525253FstartURL%252525252525252525252525253D%25252525252525252525252525252Fbee%25252525252525252525252525252Fccrz__CCSiteLogin%25252525252525252525252525253FstartURL%25252525252525252525252525253D%2525252525252525252525252525252Fbee%2525252525252525252525252525252Fccrz__CCSiteLogin%2525252525252525252525252525253FstartURL%2525252525252525252525252525253D%252525252525252525252525252525252Fbee%252525252525252525252525252525252Fccrz__CCSiteLogin%252525252525252525252525252525253FstartURL%252525252525252525252525252525253D%25252525252525252525252525252525252Fbee%25252525252525252525252525252525252Fccrz__CCSiteLogin%25252525252525252525252525252525253FstartURL%25252525252525252525252525252525253D%2525252525252525252525252525252525252Fbee%2525252525252525252525252525252525252Fccrz__CCSiteLogin%2525252525252525252525252525252525253FstartURL%2525252525252525252525252525252525253D%252525252525252525252525252525252525252Fbee%252525252525252525252525252525252525252Fccrz__CCSiteLogin%252525252525252525252525252525252525253FstartURL%252525252525252525252525252525252525253D%25252525252525252525252525252525252525252Fbee%25252525252525252525252525252525252525252Fccrz__CCSiteLogin%25252525252525252525252525252525252525253FcartID%25252525252525252525252525252525252525253D

Please help..!!

 

 

I have a class which is global and extending another class(which is managed packaged file) :-

//to enable shipping extension: browse to CC_Admin->Storefront->Your store->Integrations->Shipping->Shipping Integration Settings->
//set Shipping Integration API Class = c.cc_avid_ShippingAndHandling.
global with sharing class cc_b_ShippingAndHandling extends ccrz.cc_api_ShippingAndHandling {
    double cartWeight;
    double insuredValue;
 
    public boolean isBypassShipping(String zipCode, String stateCode, String countryCode, Id cartId, String storeName) {
        double weight = 0.0;
        insuredValue = 0;
        list<ccrz__E_CartItem__c> items = [Select c.ccrz__cartItemType__c, c.ccrz__SubAmount__c, c.ccrz__ParentCartItem__r.ccrz__SubAmount__c, c.ccrz__ParentCartItem__c, c.ccrz__Quantity__c, c.ccrz__Product__r.ccrz__ShippingWeight__c, c.ccrz__Product__c, c.Id From ccrz__E_CartItem__c c where c.ccrz__Cart__c = :cartId ];
        for(ccrz__E_CartItem__c item : items) {
            if(item.ccrz__Product__r.ccrz__ShippingWeight__c != null)
            {  
                weight += (item.ccrz__Product__r.ccrz__ShippingWeight__c * item.ccrz__Quantity__c);
                if('Minor'.equals(item.ccrz__cartItemType__c))
                    insuredValue += item.ccrz__ParentCartItem__r.ccrz__SubAmount__c;
                else
                    insuredValue += item.ccrz__SubAmount__c;
            }
        }
        if(this.cartWeight == null){
            this.cartWeight = weight;
        }
        if(weight > 0.0) {
            return false;
        } else {
            return true;
        }
    }
 
    private double getWeight(String zipCode, String stateCode, String countryCode, Id cartId, String storeName){
        if(this.cartWeight == null)
            isBypassShipping(zipCode, stateCode, countryCode, cartId, storeName);
        return this.cartWeight;
    }
    
    private List<ccrz.cc_ctrl_hlpr_ShippingOption> sortBasedOnPrice(List<ccrz.cc_ctrl_hlpr_ShippingOption> sourceList) {
        Map<Double, List<ccrz.cc_ctrl_hlpr_ShippingOption>> optionMap = new Map<Double, List<ccrz.cc_ctrl_hlpr_ShippingOption>>();
        List<ccrz.cc_ctrl_hlpr_ShippingOption> sortedList = new List<ccrz.cc_ctrl_hlpr_ShippingOption>();
       
        //Create a map for sorting
        for(ccrz.cc_ctrl_hlpr_ShippingOption ob : sourceList){
            if(optionMap.get(ob.price) == null){
                optionMap.put(ob.price, new List<ccrz.cc_ctrl_hlpr_ShippingOption>());
            }
            optionMap.get(ob.price).add(ob);
        }     
    
        //Sort the keys
        List<Double> keys = new List<Double>(optionMap.keySet());
        keys.sort();
       
        //Prepare final list
        for(Double key : keys){
            sortedList.addAll(optionMap.get(key));
        }  
        System.debug('sortedList: '+sortedList);
        return sortedList;
    }
               
        global override List<ccrz.cc_ctrl_hlpr_ShippingOption> getShippingOptions(String zipCode, String stateCode, String countryCode, Id cartId, String storeName) {
 
             if(isBypassShipping(zipCode, stateCode, countryCode, cartId, storeName)) {
            //return an empty List<ccrz.cc_ctrl_hlpr_ShippingOption> to hide Shipment Information block
            return new List<ccrz.cc_ctrl_hlpr_ShippingOption>();
        } else {
            List<ccrz__E_Cart__c> cart = [select ccrz__ShipTo__R.ccrz__City__c, ccrz__ShipTo__R.ccrz__AddressFirstLine__c, ccrz__ShipTo__R.ccrz__CountryISOCode__c from ccrz__E_Cart__c where id = :cartId];
            cc_country_region_settings__c settings = cc_country_region_settings__c.getAll().get(countryCode);
            String avidRegion = 'Avid';
            if(settings != null)
                avidRegion = cc_country_region_settings__c.getAll().get(countryCode).AROMA_Region__c;               
                ccrz.cc_ctrl_hlpr_ShippingOption resultShippingOption = new ccrz.cc_ctrl_hlpr_ShippingOption();
                                                                resultList['currencyCode'] = 'INR';
                                                                resultList['discount'] = '0.5';
                                                                resultList['discountedShipCost'] = '0.10';
                                                                resultList['price'] = '100';
                                                                resultList['provider'] = 'test';
                                                                resultList['serviceName'] = 'testService';
                                                                resultList['systemReference'] = 'testReference';
                                                                resultList['uid'] = 'testUid';
                                                                resultList['uniqueId'] = 'testUniqueId';
                List<ccrz.cc_ctrl_hlpr_ShippingOption> resultListTest;
            try{
              
                System.debug(LoggingLevel.INFO, 'Using shipping options for storefront : ' + storeName);
                //try{
                //resultList = getShippingOptionsFromAvidFedExService(getWeight(zipCode, stateCode, countryCode, cartId, storeName), this.insuredValue, cart.get(0).ccrz__ShipTo__r.ccrz__AddressFirstLine__c, cart.get(0).ccrz__ShipTo__r.ccrz__City__c, zipCode, stateCode, countryCode, UserInfo.getDefaultCurrency(), cartId, avidRegion);
 
                }
        }
   
   
    global List<ccrz.cc_ctrl_hlpr_ShippingOption> fetchShippingOptions(String zipCode, String stateCode, String countryCode, Id cartId, String storeName) {
        if(isBypassShipping(zipCode, stateCode, countryCode, cartId, storeName)) {
            //return an empty List<ccrz.cc_ctrl_hlpr_ShippingOption> to hide Shipment Information block
            return new List<ccrz.cc_ctrl_hlpr_ShippingOption>();
        } else {
            List<ccrz__E_Cart__c> cart = [select ccrz__ShipTo__R.ccrz__City__c, ccrz__ShipTo__R.ccrz__AddressFirstLine__c, ccrz__ShipTo__R.ccrz__CountryISOCode__c from ccrz__E_Cart__c where id = :cartId];
            cc_country_region_settings__c settings = cc_country_region_settings__c.getAll().get(countryCode);
            String avidRegion = 'Avid';
            if(settings != null)
                avidRegion = cc_country_region_settings__c.getAll().get(countryCode).AROMA_Region__c;               
                List<ccrz.cc_ctrl_hlpr_ShippingOption> resultList = new List<ccrz.cc_ctrl_hlpr_ShippingOption>();
                List<ccrz.cc_ctrl_hlpr_ShippingOption> resultListTest;
            try{
               //List<ccrz.cc_ctrl_hlpr_ShippingOption> resultList = new List<ccrz.cc_ctrl_hlpr_ShippingOption>();
                //List<ccrz.cc_ctrl_hlpr_ShippingOption> resultListTest;
                System.debug(LoggingLevel.INFO, 'Using shipping options for storefront : ' + storeName);
                try{
                //resultList = getShippingOptionsFromAvidFedExService(getWeight(zipCode, stateCode, countryCode, cartId, storeName), this.insuredValue, cart.get(0).ccrz__ShipTo__r.ccrz__AddressFirstLine__c, cart.get(0).ccrz__ShipTo__r.ccrz__City__c, zipCode, stateCode, countryCode, UserInfo.getDefaultCurrency(), cartId, avidRegion);
                
                //Default shipping options
                /*if(resultList == null || resultList.size() == 0){
                              resultList.add(buildDefaultShippingOption(countryCode));
                }*/
                
                    cc_avid_TaxExemptCountry__c countryTaxInfo = cc_avid_api_TaxCalculation.getCountryTaxInfo(cart.get(0).ccrz__ShipTo__R.ccrz__CountryISOCode__c);
                    if(countryTaxInfo != null && 'GROSS'.equalsIgnoreCase(countryTaxInfo.PricingType__c)){
                        System.debug(LoggingLevel.INFO, '---------Gross Pricing--------');
                        Decimal shipTaxMultiplier = 1 + countryTaxInfo.VATShipping__c;
                        for(ccrz.cc_ctrl_hlpr_ShippingOption result : resultList){
                            System.debug(LoggingLevel.INFO, '---------original ship price--------' + result.price);
                            result.price = cc_avid_api_TaxCalculation.roundToTwoDecimals(result.price * shipTaxMultiplier);
                            System.debug(LoggingLevel.INFO, '---------new ship price--------' + result.price);
                        }
                    }
                }
            }catch(Exception e){
                   resultList.add(buildDefaultShippingOption(countryCode));                  
                }
 
                System.debug(LoggingLevel.INFO, 'Unfiltered result list = ' + resultList);
                List<ccrz.cc_ctrl_hlpr_ShippingOption> returnList = new List<ccrz.cc_ctrl_hlpr_ShippingOption>();  
                
                returnList.addAll(resultList);  
                                
                return sortBasedOnPrice(returnList);
                //return returnList;
            }catch (Exception e)
            {                
                //TODO jll, use correct error codes once custom settings are loaded
                cc_avid_util_ErrorHandling.logError('Error 101', 'Shipping Error: ' + e.getMessage() + 'CountryCode, Region' +countryCode +',' +avidRegion);
                System.debug(LoggingLevel.Info, e);
                if(resultList.size()==0){               
                               resultList.add(buildDefaultShippingOption(countryCode));                           
                }
                return resultList;
                //return null;
            }
        }
    }
   
    //TODO jll make these configurable
    public ccrz.cc_ctrl_hlpr_ShippingOption buildDefaultShippingOption(String countryCode){
        System.debug(LoggingLevel.INFO, '::::::::::::::::countryCode ' + countryCode);
        ccrz.cc_ctrl_hlpr_ShippingOption returnOption = new ccrz.cc_ctrl_hlpr_ShippingOption('FEDEX', 'FEDEX_GROUND', 15.00);// = new ccrz.cc_ctrl_hlpr_ShippingOption
        if('us'.equalsIgnoreCase(countryCode)){
            returnOption = new ccrz.cc_ctrl_hlpr_ShippingOption('FEDEX', 'FEDEX_GROUND', 15.00);
        }
        else if('de'.equalsIgnoreCase(countryCode)){
               returnOption = new ccrz.cc_ctrl_hlpr_ShippingOption('FEDEX', 'PRIORITY_OVERNIGHT', 15.00);
        }
        else
               returnOption = new ccrz.cc_ctrl_hlpr_ShippingOption('FEDEX', 'INTERNATIONAL_ECONOMY', 15.00);
 
        returnOption.currencyCode = UserInfo.getDefaultCurrency();
        return returnOption;
    }
}

Here i'm receving error on this line "global List<ccrz.cc_ctrl_hlpr_ShippingOption> fetchShippingOptions(String zipCode, String stateCode, String countryCode, Id cartId, String storeName) {" 

Please help..!!