Step 4: Configuring a payment method to use the payments cassettes plug-in

In this part of the tutorial you will configure one payment method , VISA, in ConsumerDirect to use the WebSphere Commerce Payments OfflineCard cassette through MyWCPaymentsPlugin. The configuration will include the command configuration for the payment business policy, the configuration in Payment Rules and Payment Plug-in Controller, and the one in the MyWCPayments payment plug-in.

Follow these steps to configure the VISA payment method in ConsumerDirect:

  1. Configure a payment method for the store. Starter store ConsumerDirect already has the VISA payment method, so we will reuse it. Please use the following SQL query to make sure that this payment method is already configured for ConsumerDirect (storeent = 10101):
    select policy_id, policyname, policytype_id, storeent_id, properties from policy where policytype_id = 'Payment' and storeent_id = 10101 and policyname ='VISA'
      
    

    POLICY_ID POLICYNAME POLICYTYPE_ID STOREENT_ID PROPERTIES
    10202 'VISA' 'Payment ' 10101 'attrPageName=StandardVisa&paymentConfigurationId=default&display=true&compatibleMode=false'

    select policy_id, language_id, description, longdescription from policydesc where policy_id in (select policy_id from policy where 
    policytype_id = 'Payment' and storeent_id = 10101 and policyname = 'VISA') and language_id = -1 
    

    POLICY_ID LANGUAGE_ID DESCRIPTION LONGDESCRIPTION
    10202 -1 'VISA Credit Card' 'VISA Credit Card'
    If these rows are not found, please insert them into the database.

    Note: When you insert this row, remember to find a policy_id that does not exist in the policy table.

  2. Configure the mapping from the VISA payment method to the CreditCardOffline payment configuration in PaymentMappings.xml.WCDE_installdir\xml\config\payments\edp\groups\default\PaymentMappings.xml:
     <Mapping paymentMethod="VISA" 
       paymentConfiguration="CreditCardOffline"
     paymentActionRule="Early Approval"/>
     
    
  3. Configure the CreditCardOffline payment configuration to use the OfflineCardCassette payment system in PaymentMethodConfigurations.xml. In the WCDE_installdir\xml\config\payments\edp\groups\default\ PaymentMethodConfigurations.xml file,
    change the section A to section B:
    section A :- >
     <PaymentMethodConfiguration 
       name="CreditCardOffline"
       paymentSystemName="SimpleOffline" 
       systemEditable="true">
       humanEditable="true"
       refundAllowed="true"
       minimumAmount="0"
       maximumAmount="Unbounded"
       priority="MEDIUM"
     partiallyConsumable="true"/>
    
    section B :-
     <PaymentMethodConfiguration 
       name="CODOffline"
       paymentSystemName="OffineCardCassette" 
       systemEditable="true"
       humanEditable="true"
       refundAllowed="false"
       minimumAmount="0"
       maximumAmount="Unbounded"
       priority="LOW"
     partiallyConsumable="true"/>
    
  4. Create the configuration for OfflineCardCassette payment system in PaymentSystemPluginMapping.xml and map it to payment plug-in MyWCPaymentsPlugin.
    In WCDE_installdir\xml\config\payments\ppc\plugins\PaymentSystemPluginMapping.xml file, add the following element for PaymentSystemName:
     <PaymentSystemName name="OffineCardCassette">
      <Mapping paymentConfigurationId="default" pluginName="MyWCPaymentsPlugin">
       <Property name="ProfileName" value="WCPPlugin_OfflineCard"/>
       <Property name="SupportsOnlineTransaction" value="no"/>
       <Keyword name="cc_cvc" mask ="-" plain="0" removeAfterApproval ="true"/>
       <Keyword name="cc_nameoncard" mask ="*" plain="0" removeAfterApproval="true"/>
       <Keyword name="account" mask ="*" plain="-5" searchable="true"/>
      </Mapping>
     </PaymentSystemName>
    
  5. Now you have already configured the payment rules and payment plug-in controller to use your new plug-in. Next configure it to connect to your WebSphere Commerce Payments instance. In the WCDE_installdir\xml\config\payments\ppc\plugins\MyWCPaymentsPlugin\PluginDeployment.xml, modify the following element values according to your Payment Instance information on another server that you configured in step 3:
     <PluginProperty name="hostName" value="the host name of the remote payment server"/>
     <PluginProperty name="port" value="the port number of the remote payment server"/>
     <PluginProperty name="useSSL" value="true"/> 
      // true if your remote payment server is using SSL, false if no.
     <PluginProperty name="userid" value="wcsadmin"/>
       // the site administration ID of your remote payment system.
    
  6. Stop and restart WebSphere Commerce Test Server to pick up the configuration changes you have made in the previous steps.
  7. Open starter store ConsumerDirect using the following URL:http://localhost/webapp/wcs/stores/servlet/ConsumerDirect/index.jsp
  8. Place one order in ConsumerDirect using "VISA Credit Card", the display name for the VISA payment policy. In this example, the order total is $359.99.


  9. Search the order in the WebSphere Commerce Payments user interface to make sure that the MyWCPayments plug-in is working correctly. Remember that the order number in the user interface is not the order number that you got from the store. See the second step in the Step1: Designing a payments cassette plug-in of this tutorial to find the object mapping between the WebSphere Commerce order number and the WebSphere Commerce Payments order number. You can get the order number in WebSphere Commerce Payments by issuing the following SQL query (it is randomly generated, so your value is different from this one):
    select TRACKINGID from ppcpaytran
    

    TRACKINGID
    '510098577'
    Then you can use this order number '510098577' query the payment information in WebSphere Commerce Payments user interfaces.

Now you have tested your payment plug-in in your development environment. We are ready to package it and publish it to the runtime server. In the next step of the tutorial you will learn how to package the payment plug-in.