gnu-taler-payment-for-magento

Adobe Commerce (Magento) plugin to enable payments with GNU Taler
Log | Files | Refs | README

di.xml (4921B)


      1 <?xml version="1.0"?>
      2 <!--
      3 /**
      4 *
      5 * This file is part of TALER
      6 * Copyright (C) 2024 Taler Systems SA
      7 *
      8 * TALER is free software; you can redistribute it and/or modify it under the
      9 * terms of the GNU General Public License as published by the Free Software
     10 * Foundation; either version 3, or (at your option) any later version.
     11 *
     12 * TALER is distributed in the hope that it will be useful, but WITHOUT ANY
     13 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
     14 * A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
     15 *
     16 * You should have received a copy of the GNU General Public License along with
     17 * TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
     18 *
     19 * @author Nicola Eigel
     20  */
     21 -->
     22 <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
     23     <!-- Taler Payment Method Facade configuration -->
     24     <virtualType name="TalerFacade" type="Magento\Payment\Model\Method\Adapter">
     25         <arguments>
     26             <argument name="code" xsi:type="const">GNU\Taler\Model\ConfigProvider::CODE</argument>
     27             <argument name="formBlockType" xsi:type="string">Magento\Payment\Block\Form</argument>
     28             <argument name="infoBlockType" xsi:type="string">Magento\Payment\Block\Info</argument>
     29             <argument name="valueHandlerPool" xsi:type="object">TalerValueHandlerPool</argument>
     30             <argument name="commandPool" xsi:type="object">TalerCommandPool</argument>
     31         </arguments>
     32     </virtualType>
     33 
     34     <!-- Taler Value Handler Pool configuration -->
     35     <virtualType name="TalerValueHandlerPool" type="Magento\Payment\Gateway\Config\ValueHandlerPool">
     36         <arguments>
     37             <argument name="handlers" xsi:type="array">
     38                 <item name="default" xsi:type="string">TalerConfigValueHandler</item>
     39             </argument>
     40         </arguments>
     41     </virtualType>
     42 
     43     <!-- Taler Config Value Handler configuration -->
     44     <virtualType name="TalerConfigValueHandler" type="Magento\Payment\Gateway\Config\ConfigValueHandler">
     45         <arguments>
     46             <argument name="configInterface" xsi:type="object">TalerConfig</argument>
     47         </arguments>
     48     </virtualType>
     49 
     50     <!-- Taler Config configuration -->
     51     <virtualType name="TalerConfig" type="Magento\Payment\Gateway\Config\Config">
     52         <arguments>
     53             <argument name="methodCode" xsi:type="const">GNU\Taler\Model\ConfigProvider::CODE</argument>
     54         </arguments>
     55     </virtualType>
     56 
     57     <!-- Taler Command Pool configuration -->
     58     <virtualType name="TalerCommandPool" type="Magento\Payment\Gateway\Command\CommandPool">
     59         <arguments>
     60             <argument name="commands" xsi:type="array">
     61                 <item name="authorize" xsi:type="string">Magento\Payment\Gateway\Command\NullCommand</item>
     62                 <item name="capture" xsi:type="string">TalerChargeCommand</item>
     63             </argument>
     64         </arguments>
     65     </virtualType>
     66 
     67     <!-- Taler Charge Transaction Builder configuration -->
     68     <virtualType name="TalerChargeTransactionBuilder" type="GNU\Taler\Gateway\Request\RequestBuilder">
     69         <arguments>
     70             <argument name="builder" xsi:type="object">TalerChargeBuilderComposite</argument>
     71             <argument name="config" xsi:type="object">TalerConfig</argument>
     72         </arguments>
     73     </virtualType>
     74 
     75     <!-- Taler Charge Builder Composite configuration -->
     76     <virtualType name="TalerChargeBuilderComposite" type="Magento\Payment\Gateway\Request\BuilderComposite">
     77         <arguments>
     78             <argument name="config" xsi:type="object">TalerConfig</argument>
     79         </arguments>
     80     </virtualType>
     81 
     82     <!-- Taler Charge Command configuration -->
     83     <virtualType name="TalerChargeCommand" type="Magento\Payment\Gateway\Command\GatewayCommand">
     84         <arguments>
     85             <argument name="requestBuilder" xsi:type="object">TalerChargeTransactionBuilder</argument>
     86             <argument name="transferFactory" xsi:type="object">GNU\Taler\Gateway\Http\TransferFactory</argument>
     87             <argument name="client" xsi:type="object">GNU\Taler\Gateway\Http\Client</argument>
     88             <argument name="validator" xsi:type="object">GNU\Taler\Gateway\Validator\GeneralResponseValidator</argument>
     89             <argument name="config" xsi:type="object">TalerConfig</argument>
     90         </arguments>
     91     </virtualType>
     92 
     93     <!-- Taler Client configuration -->
     94     <type name="GNU\Taler\Gateway\Http\Client">
     95         <arguments>
     96             <argument name="logger" xsi:type="object">TalerLogger</argument>
     97         </arguments>
     98     </type>
     99 
    100     <!-- Taler Logger configuration -->
    101     <virtualType name="TalerLogger" type="Magento\Payment\Model\Method\Logger">
    102         <arguments>
    103             <argument name="config" xsi:type="object">TalerConfig</argument>
    104         </arguments>
    105     </virtualType>
    106 </config>