HCL Commerce Enterprise

Changing the default contract

To modify the default contract without using the user interface, you need to export the default contract and make changes to the contract XML file and then import the modified contract.

Procedure

  1. Type the following SQL to retrieve the contract_id and store_id.
    
    select contract_id, store_id from storedef where store_id 
    = (select storeent_id from storeent where identifier =
    'ConsumerDirect'); 
    
  2. Export the default contract as an XML file.

    Use the contract_id that was retrieved from step 1 to export ConsumerDirectDefaultContract.xml file in the workspace_dir\WC\xml\trading\xml directory

    1. Add the following content to the struts-config-ext.xml file (for HCL Commerce Version 9.0.0.x) or struts-wcs-stores-custom.xml (for Version 9.0.1.0+) before the </action-mappings> tag:
      For Version 9.0.0.x:
      
      <action 
                 parameter="com.ibm.commerce.contract.commands.ContractExportCmd" 
                  path="/ContractExport"
                  type="com.ibm.commerce.struts.BaseAction"> 
               <set-property property="authenticate"
                          value="0:0"/> 
               <set-property property="https" value="0:1"/> 
              </action>
      
      <action 
          class="com.ibm.commerce.struts.v2.BaseAction" 
          name="ContractExport">
      <param name="parameter">com.ibm.comerce.contract.commands.ContractExportCmd</param>
      <param name="authenticate">0:0</param>
      <param name="https">0:1</param>
      </action>
    2. Either refresh the Struts Configuration Registry in Administration Console or restart the server.
  3. Modify the default contract to include Payment method.
    1. Edit the file ConsumerDirectDefaultContract.xml. At the end of the </BuyerContract> tag, add the Payment TC.
      
       <!-- Payment TC --> 
      
      <PaymentTC mandatory = "false" changeable = "false" >
      <PaymentMethod>
      <PaymentPolicyRef policyName = "PayLater">
      <StoreRef name = "ConsumerDirect">
      <Owner>
      <OrganizationRef distinguishName = "ou=b2c,o=seller
      organization,o=root organization"/>
      </Owner>
      </StoreRef>
      </PaymentPolicyRef>
      <PaymentMethodDisplayString name = "Pay Later"/>
      </PaymentMethod>
      </PaymentTC>
      
    2. Run the SQL to get the policyName.
      
      select policyname from policy where policy_id=?;
      
    3. Run the SQL to get the StoreRef.
      
      select identifier from storeent where store_id=?;
      
    4. Run the SQL to get the distinguishName.
      select dn from orgentity where orgentity_id in (select member_id
      from storeent where storeent_id=storeent_id); 

    The PaymentMethodDisplayString is the payment method display name when you select the Payment method in the order flow.

    The properties column of the policy table for Payment policy is similar to this,
    attrPageName=StandardVisa&paymentConfigurationId=default&display=false&compatibleMode=false
    You will find the StandardVisa.jsp (the property attrPageName value) in the store\ShoppingArea\CheckoutSection\StandardCheckoutSubsection directory. If you do not find then you need to copy it to this location.
  4. In the file ConsumerDirectDefaultContract.xml file, modify the minorVersionNumber by increasing it by one l.
    
    <ContractUniqueKey name = "ConsumerDirect Default Contract" 
    majorVersionNumber = "1" minorVersionNumber = "1" origin =
    "Manual"> 
    <ContractOwner> 
    <OrganizationRef distinguishName = "o=seller organization,o=root
    organization"/> 
    </ContractOwner> 
    </ContractUniqueKey> 
    
  5. Import the default contract. Using the utility from step 2, import an Active Contract using the file ConsumerDirectDefaultContract.xml, and the target store is the store_id from step 1.
  6. To verify if the new payment method is created, create an order in the Order Summary page. You will find the payment method as follows:

    Screen capture showing the new payment method