-
Notifications
You must be signed in to change notification settings - Fork 2
How to implement
To have the omultisafepay component working in an OFBiz instance only a few changes to existing files need to be implemented.
These changes are in:
- the controller.xml file in the ecommerce component
- the checkoutpayment.ftl in the ecommerce component
- the paymentoptions.ftl in the ecommerce component
For the rest no code changes are required. Everything to setup a working test connection (test functionality for a call-out to MultiSafepay) is done through configuration widgets (forms and screens) in the omultisafepay component.
If, for e.g. demonstration purposes, it is required to show how it works in the ecommerce component the changes mentioned above are necessary on top of configuration in the component and in the store.
The following changes are required in the controller.xml file to have the ecommerce component work with the omultisafepay component:
- Linking to the omultisafepay component This is to ensure that omultisafepay request-uri's can be called from within the ecommerce component.
The line below must be included in the controller.xml file before the description:
<include location="component://omultisafepay/webapp/omultisafepay/WEB-INF/controller.xml"/>
Resulting in:
<site-conf xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/site-conf.xsd">
<include location="component://omultisafepay/webapp/omultisafepay/WEB-INF/controller.xml"/>
<description>OFBiz: eCommerce Controller Configuration File</description>
On top of this, in the request-map uri regarding the 'checkExternalPayment' request-map the following line must be added as a response:
<response name="omultisafepay" type="request" value="callMultiSafepay"/>
resulting in:
<request-map uri="checkExternalPayment">
<security https="true" direct-request="false"/>
<event type="java" path="org.ofbiz.order.shoppingcart.CheckOutEvents" invoke="checkExternalPayment"/>
<response name="none" type="request" value="emailorder"/>
<response name="offline" type="request" value="emailorder"/>
<response name="omultisafepay" type="request" value="callMultiSafepay"/>
<response name="error" type="view" value="checkoutreview"/>
</request-map>
And in the request-map uri regarding the 'onePageCheckExternalPayment' request-map the same line must be added resulting in:
<request-map uri="onePageCheckExternalPayment">
<security https="true" direct-request="false"/>
<event type="java" path="org.ofbiz.order.shoppingcart.CheckOutEvents" invoke="checkExternalPayment"/>
<response name="none" type="request" value="emailorder"/>
<response name="offline" type="request" value="emailorder"/>
<response name="omultisafepay" type="request" value="callMultiSafepay"/>
<response name="error" type="view" value="checkoutreview"/>
</request-map>
In the section regarding the payment options add following:
<#if productStorePaymentMethodTypeIdMap.EXT_omultisafepay??>
<#include "component://omultisafepay/templates/omultisafepay.ftl"/>
</#if>
Configuration of the application (component), to make it work with the 3rd Party Payment provider, is done in the component. It is multi-tenant enabled, as data is stored in the db of the tenant instance.
To configure the settings of the application, access it via:
https://<your-host>:8443/omultisafepay/control/configuration
and click on the 'System Properties' button. This will show an overview of the various configuration options.
In order to have your store working with the component, 3 uri's need to be set in the store. These uri's are defined in the omultisafepay-demodata.xml file in the data directory of the component.