Tutorials > Payments > Configure the SimpleOffline plug-in with two payment methods

< Previous | Next >


Configure each XML configuration file in the payment configuration group for two payment methods

In this part of the tutorial, you configure each configuration XML file in the new group myGroup ? for two payment methods which are VISA and PayInStore. VISA is already a supported offline payment method in the starter store. You configure a different payment configuration in myGroup than in the default ? group. PayInStore is not a supported payment method in the starter store. We will demonstrate how to add it.

In the default ? payment configuration group, VISA uses the "Early Approval" payment rule, while in myGroup, VISA uses Validation with Deposit at Reservation ?. The "Validation with Deposit at Reservation" payment rule means that the payment is approved when the order is submitted and the payment is deposited when the order is released to the fulfillment center. In this group, you also add a new payment method called "PayInStore". This payment method uses the "No Validation or Reservation" payment rule which means that there is no payment action when the order is submitted or is released to fulfillment center. Only when the order is shipped is the money captured manually in the store.

Follow these steps to configure each XML file for myGroup:


Procedure

  1. Open the PaymentRules XML file and find the payment rules we will configure for the payment methods. This file is read only; do not edit it. Note the following two rules that we will map to in Step 4:

    • VISA : "Validation with Deposit at Reservation"

    • PayInStore: "No Validation or Reservation"

  2. Open the PaymentMethodConfigurations XML file and find one of the existing payment configurations to use for the payment method or create a new one if none of them are suitable. For our three payment methods, VISA is the offline credit card payment method and we also use the SimpleOffline payment system in Payment Plug-in Controller, so the CreditCardOffline payment method configuration is suitable for it. But for the PayInStore payment method, there is no existing payment configuration, so create one. Add the following section into the file just before the </PaymentMethodConfigurations> tag:

    <PaymentMethodConfiguration    
    name="PayInStoreConfiguration"   
    paymentSystemName="PayInStoreSys"    
    systemEditable="true"   
    humanEditable="true"   
    refundAllowed="false"   
    minimumAmount="0"   
    maximumAmount="Unbounded"   
    priority="LOW"  
    partiallyConsumable="true"/> 
    

    Important: To determine your values for each attribute of the payment method refer to the PaymentMethodConfigurations XML file topic.


    Note: The value for paymentSystemName "PayInStoreSys" will be the payment system name that we will create.

  3. For each new payment configuration you created in the PaymentMethodConfigurations.xml file, you should also configure a group of configuration files for it. First, you should find a similar payment method configuration and copy its configuration files so that you can change them. You have created a new payment method configuration, ?PayInStoreConfiguration ?, similar to the CODOffline payment method. In the WC_EAR/xml/config/payments/edp/groups/myGroup/ directory, copy the CODOffline subdirectory and rename the copy to PayInStoreConfiguration ?. There are five files under it:

    • AVSRules.xml

    • CoreCancelOrderPaymentActions.xml

    • CoreEditActions.xml

    • CoreEditReversePaymentActions.xml

    • CorePaymentActions.xml

    The CoreCancelOrderPaymentActions.xml, CoreEditActions.xml, and CoreEditReversePaymentActions.xml files should not be changed. AVSRules.xml is applied only to credit card payment methods. You can ignore it for PayInStoreConfiguration. CorePaymentActions.xml can be changed according to the business requirements. For this tutorial, we do not change this file.

    To change this file, refer to the CorePaymentActions XML file topic for more details.

  4. In the PaymentMappings XML file, map the payment method to the payment rule and the payment method configuration.

    1. VISA is an existing payment method, so you just need to change its payment rule. Locate the following section in the file:

        
      <Mapping paymentMethod="VISA"
                  paymentConfiguration="CreditCardOffline"
               paymentActionRule="Early Approval"/> 
      

      And change the paymentActionRule to "Validation with Deposit at Reservation ? as shown :

      <Mapping paymentMethod="VISA"
                  paymentConfiguration="CreditCardOffline" 
                  paymentActionRule="Validation with Deposit at Reservation"/>. 
      

    2. You need to create a mapping from the PayInStore payment method to the payment configuration and the payment action rule. Add the following section just before the ending </PaymentMappings> element:

      <Mapping paymentMethod="PayInStore"   paymentConfiguration="PayInStoreConfiguration" paymentActionRule="No Validation or Reservation"/> 
      

      (For more details about this XML file, refer to the PaymentMappings XML file topic.)

  5. For each refundable payment method, you should also configure the refund method for it. As PayInStore is not refundable, configure the refund method for VISA only. In the RefundMappings.xml file, you can find the mapping from the VISA refund method to the CreditCardOffline refund configuration:

        
    <RefundMapping refundMethod="VISA"          
            refundConfiguration="CreditCardOffline" /> 
    

    In the RefundMethodConfigurations.xml file, you can find the mapping from the CreditCardOffline refund configuration to the SimpleOffline payment system:

       
    <RefundMethodConfiguration    
            name="CreditCardOffline"          
            paymentSystemName="SimpleOffline" /> 
    

    You need not change this default configuration.


Notes:

Now the new payment configuration group myGroup is configured to support both the VISA and the PayInStore payment methods.

< Previous | Next >


+

Search Tips   |   Advanced Search