DykaGonka1
March 21, 2021 at 6:14 am
Hi!
I’m building an extension for payment system WayForPay . The are requiring to send an array of data ( eg. productName[] ):
<form method="post" action="https://secure.wayforpay.com/pay" accept-charset="utf-8">
<input name="merchantAccount" value="test_merch_n1">
<input name="merchantAuthType" value="SimpleSignature">
<input name="merchantDomainName" value="www.market.ua">
<input name="orderReference" value="DH1616328678">
<input name="orderDate" value="1415379863">
<input name="amount" value="1547.36">
<input name="currency" value="UAH">
<input name="orderTimeout" value="49000">
<input name="productName[]" value="Процессор Intel Core i5-4670 3.4GHz">
<input name="productName[]" value="Память Kingston DDR3-1600 4096MB PC3-12800">
<input name="productPrice[]" value="1000">
<input name="productPrice[]" value="547.36">
<input name="productCount[]" value="1">
<input name="productCount[]" value="1">
<input name="clientFirstName" value="Вася">
<input name="clientLastName" value="Пупкин">
<input name="clientAddress" value="пр. Гагарина, 12">
<input name="clientCity" value="Днепропетровск">
<input name="clientEmail" value="some@mail.com">
<input name="defaultPaymentSystem" value="card">
<input name="merchantSignature" value="a9d11dbce60397a606dee1cafb8d4a85">
<input type="submit" value="Test">
</form>
It’s not possible with current Payment class. Can you please update it to parse 2 dimensional arrays into form?
DykaGonka1
March 21, 2021 at 9:45 am
Add New Note to this Reply
protected function _args_as_inputs($args)
{
$html = '';
if ($args !== null && is_array($args)) {
foreach ($args as $name => $value) {
$html .= EEH_HTML::nl(0)
. '<input type="hidden" name="'
. $name
. '" value="'
. esc_attr($value)
. '"/>';
}
}
return $html;
}
Tony
March 24, 2021 at 9:27 am
Add New Note to this Reply
Hi there,
I’ve created a pull request with a possible for this for which you can follow along with HERE .