INVALID_REQUEST:字段[order.avsDetails.billToFirstname]不在字符集[ISO-8859-1]中 [英] INVALID_REQUEST: Field [order.avsDetails.billToFirstname] was not in charset [ISO-8859-1]
问题描述
由于某些原因,当我使用OnTap MasterCard Extension
时,发货地址中的任何阿拉伯字符都会引发错误:
For some Reasons when I use OnTap MasterCard Extension
, Any Arabic characters in shippment addresses throws an error:
INVALID_REQUEST: Field [order.avsDetails.billToFirstname] was not in charset [ISO-8859-1]
扩展链接:
https://marketplace.magento.com/ontap-module-mastercard.html
请帮助.
推荐答案
您可以尝试使用插件对在Builders(在Gateway/Request
文件夹内)生成的数据进行编码.
You can try encoding the data generated in the Builders (inside the Gateway/Request
folder) by using plugins.
您可以在此处了解更多信息. ,可在需要时对构建器中的所有字段执行编码.
You can read more how to create plugins here that perform the encoding on all the fields in the builders when needed.
您将创建一个新模块,对您从市场上购买的扩展进行必要的修改.
You will create a new module that is doing the modifications needed on the extension you took from the market.
在这种情况下,要定义您的构建器,您的di.xml
将类似于:
To define your builder in this case your di.xml
will look something like:
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="\OnTap\MasterCard\Gateway\Request\ShippingDataBuilder">
<plugin name="jsparo_ontap_mastercard_gateway_request_shippingdatabuilder" type="Jsparo\MasterCard\Plugin\Gateway\Request\ShippingDataBuilder" sortOrder="1"/>
</type>
</config>
与Plugin/Gateway/Request/ShippingDataBuilder.php
一样,您将像:
<?php
namespace Jsparo\MasterCard\Plugin\Gateway\Request;
class ShippingDataBuilder {
public function afterBuild(array $subject, $result) {
array_walk_recursive($result, function(&$value) {
$value = mb_convert_encoding($value, 'ISO-8859-1', 'UTF-8');
}
return $result;
}
}
您将必须对所有生成不正确数据的构建器执行此操作.
You will have to do this for all the builders that generate incorrect data.
这篇关于INVALID_REQUEST:字段[order.avsDetails.billToFirstname]不在字符集[ISO-8859-1]中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!