Configuring 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.

About this task

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 you will configure for your payment methods. This file is read only; do not edit it. Note the following two rules that you 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 your 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 you need to 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 your payment method refer to the PaymentMethodConfigurations XML file topic.

    Note: The value for paymentSystemName "PayInStoreSys" will be the payment system name that you 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_eardir/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 your business requirements. For this tutorial, we do not change this file. If you want 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 within these tags 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.)

Results

Note: The refundable payment method for VISA in the RefundMappings.xml and the CreditCardOffline section in RefundMethodConfigurations.xml should be in the default configuration.

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