我正在实施自定义支付网关。

要能够配置它,我已经以这种方式创建了ConfigProvider:

<?php
/**
 * Copyright © 2015 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
namespace Desytec\Transbank\Model;

use Magento\Checkout\Model\ConfigProviderInterface;
use Magento\Framework\Escaper;
use Magento\Payment\Helper\Data as PaymentHelper;

class WebpayConfigProvider implements ConfigProviderInterface
{
    /**
     * @var string[]
     */
    protected $methodCode = Webpay::CODE;

    /**
     * @var Webpay
     */
    protected $method;

    /**
     * @var Escaper
     */
    protected $escaper;

    /**
     * @param PaymentHelper $paymentHelper
     * @param Escaper $escaper
     */
    public function __construct(
        PaymentHelper $paymentHelper,
        Escaper $escaper
    ) {
        $this->escaper = $escaper;
        $this->method = $paymentHelper->getMethodInstance($this->methodCode);
    }

    /**
     * {@inheritdoc}
     */
    public function getConfig()
    {
        return $this->method->isAvailable() ? [
            'payment' => [
                'webpay' => [
                    'image' => $this->getImage(),
                    'instructions' => $this->getInstructions(),
                ],
            ],
        ] : [];
    }

    /**
     * Get mailing address from config
     *
     * @return string
     */
    protected function getImage()
    {
        return nl2br($this->escaper->escapeHtml($this->method->getImage()));
    }

    /**
     * Get mailing address from config
     *
     * @return string
     */
    protected function getInstructions()
    {
        return nl2br($this->escaper->escapeHtml($this->method->getInstructions()));
    }
}
.

和etc / frontend中的di.xml文件:

<?xml version="1.0"?>
<!--
/**
 * Copyright © 2015 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\Checkout\Model\CompositeConfigProvider">
        <arguments>
            <argument name="configProviders" xsi:type="array">
                <item name="transbank_webpay_config_provider" xsi:type="object">Desytec\Transbank\Model\WebpayConfigProvider</item>
            </argument>
        </arguments>
    </type>
</config>
.

当我将di.xml文件上传到服务器时,并尝试加载结账时,会发生错误500。如果我删除它,页面显示正确。

你在该文件中看到了什么?

谢谢 jaime

有帮助吗?

解决方案

它不必是包含错误的di.xml本身。

500响应主要是手段,您应该查看WebServers Error.log。它包含普通错误消息

中应该存在异常或错误

许可以下: CC-BY-SA归因
scroll top