Global Payments HPP sandbox. 508 Invalid characters in MERCHANT_RESPONSE_URL when ngrok is used - realex-payments-api

Is there any chance to get working the Global Payments HPP sandbox with ngrok?
Currently, it gives
508
Invalid characters in MERCHANT_RESPONSE_URL. Please contact the merchant.
for an URL like
https://testsitewww.ap.ngrok.io/~testsite/shop/src/cart.php?target=callback&txn_id_name=txnId&txnId=000008-567H
The full request
(
[ORDER_ID] => testsite2_000008-567H
[MERCHANT_ID] => dev240640823746370784
[TIMESTAMP] => 20201110125116
[ACCOUNT] =>
[AUTO_SETTLE_FLAG] => 1
[HPP_VERSION] => 2
[AMOUNT] => 13999
[HPP_CUSTOMER_PHONENUMBER_MOBILE] =>
[HPP_CUSTOMER_EMAIL] => testsite+test#example.com
[HPP_SHIPPING_POSTALCODE] => 90001
[HPP_SHIPPING_COUNTRY] => 643
[HPP_SHIPPING_CITY] => Los Angeles
[HPP_SHIPPING_STREET1] => test
[HPP_SHIPPING_STREET2] =>
[HPP_SHIPPING_STREET3] =>
[HPP_BILLING_POSTALCODE] => 90001
[HPP_BILLING_COUNTRY] => 643
[HPP_SHIPPING_STATE] =>
[HPP_BILLING_CITY] => Los Angeles
[HPP_BILLING_STREET1] => test
[HPP_BILLING_STREET2] =>
[HPP_BILLING_STREET3] =>
[HPP_ADDRESS_MATCH_INDICATOR] => TRUE
[MERCHANT_RESPONSE_URL] => https://testsitewww.ap.ngrok.io/~testsite/shop/src/cart.php?target=callback&txn_id_name=txnId&txnId=000008-567H
[COMMENT1] => Test company
[CURRENCY] => USD
[SHA1HASH] => e068e2876262d61f22c84f440463fcdb1b42f90a
)
other URLs work correctly.
According to https://developer.globalpay.com/contact-us
I have to ask integration questions here

I think the character ~ in URL is causing the issue here, and not ngrok.
I have just used nrok for the same, it works fine. My url looks something like: http://6c59460.ngrok.io/realexresponse
Also, ngrok points to a local IIS url like http://localhost:88. So effectively, the URL I am supplying in MERCHANT_RESPONSE_URL is http://localhost:88/realexresponse
I found this article suggesting to not use some characters in URL, as they may be reserved by the server or in this case Realex. One of them is ~
https://help.dragonmetrics.com/en/articles/213986-invalid-characters-in-url

Related

Magento SOAP API V2 calls not working for Private Sales Store (Authorization plugin used)

FACTS:
I am not very good at magento but have some experience working with API's using PHP.
TARGET:
What I actually want to do is
Download magento customer orders in our order system
Process the orders
Upload tracking code back to magento
Update magento products level based on the values fetched from our local Stock System running on a different server
ENVIRONMENT:
I am using a Login Plugin to make the store private so only customers with an account can access it.
PROBLEM:
IF 'AUTHENTICATION' PLUGIN IS DISABLED EVERYTHING WORKS FINE. BUT WHEN PLUGIN IS ENABLED STEP 3 AND 4 STOP WORKING.
ERROR SAMPLE:
Magento SOAP API V2 calls result in
SoapFault Object ( [message:protected] => looks like we got no XML document, when used for Private Sales store. I am able to login using API a/c,fetch orders but calls to update stock / upload tracking etc fail.
SAMPLE OUTPUT:
Login Successful [0a254c064fa033859bc75db94]
Request :
<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:Magento"><SOAP-ENV:Body><ns1:catalogInventoryStockItemUpdateRequestParam>sessionId>0a254c064fa033859bc75db94</sessionId><productId>1</productId><data><qty>100</qty><is_in_stock>1</is_in_stock></data></ns1:catalogInventoryStockItemUpdateRequestParam></SOAP-ENV:Body></SOAP-ENV:Envelope>
Result:
SoapFault Object ( [message:protected] => looks like we got no XML document [string:Exception:private] => [code:protected] => 0 [file:protected] => /var/www/vhosts/XXX/magentoAPI/stock.php [line:protected] => 31 [trace:Exception:private] => Array ( [0] => Array ( [file] => /var/www/vhosts/XXX/magentoAPI/stock.php [line] => 31 [function] => __call [class] => SoapClient [type] => -> [args] => Array ( [0] => catalogInventoryStockItemUpdate [1] => Array ( [0] => stdClass Object ( [sessionId] => 0a254c064fa033859bc75db94 [productId] => 1587 [data] => Array ( [qty] => 1000 [is_in_stock] => 1 ) ) ) ) ) [1] => Array ( [file] => /var/www/vhosts/XXX/magentoAPI/stock.php [line] => 31 [function] => catalogInventoryStockItemUpdate [class] => SoapClient [type] => -> [args] => Array ( [0] => stdClass Object ( [sessionId] => 0a254c064fa033859bc75db94 [productId] => 1587 [data] => Array ( [qty] => 1000 [is_in_stock] => 1 ) ) ) ) ) [previous:Exception:private] => [faultstring] => looks like we got no XML document [faultcode] => Client [faultcodens] => http://schemas.xmlsoap.org/soap/envelope/ )

Not all POST array elements getting sent

I have a table which has 4 columns with the first column containing a text input boxes. The entire table is wrapped inside a form that will run a PHP script on that data. As of right now, I'm just printing out the POST array. The problem is that I'm missing some of the values that I write into the input fields. So putting the values 1-10 in the first 10 text inputs gives me the following in print_r:
Array
(
[65710] =>
[65705] => 2
[269200318] =>
[269200586] => 4
[16830189] =>
[16829165] =>
[1051902] => 7
[65742] =>
[16830122] =>
[269339822] => 10
}
The HTML for this form can be found here: http://jsfiddle.net/nY9MF/
This is running on IIS 7
Edit: I updated the jsfiddle code to have the full table for one of these stores. This is the POST array after I hit submit:
Array(
[65710] =>
[65705] => 2
[269200318] =>
[269200586] => 4
[16830189] =>
[16829165] =>
[1051902] => 7
[65742] =>
[16830122] =>
[269339822] => 10
[65774] =>
[16821982] =>
[65740] =>
[16825517] =>
[65709] =>
[1051326] =>
[1052334] =>
[65773] =>
[4110] =>
[16837342] =>
[16825518] =>
[1051375] =>
[1051594] =>
[65743] =>
[1052108] =>
[256] =>
[4106] =>
[65711] =>
[65738] =>
[1051597] =>
[4109] =>
[65724] =>
[SaveQuantity] => Save
)

return only column name values from mysql table

sorry but i didn't knew how to explain the question in on sentence...
actually i have code like this when i do mysql_fetch_array...
[0] => 10
[id] => 10
[1] => 58393
[iid] => 58393
[2] => 0
[ilocationid] => 0
[3] => 38389
[iapptid] => 38389
[4] => 2012-06-30T00:00:00
[ddate] => 2012-06-30T00:00:00
[5] => 1000
[ctimeofday] => 1000
but i want to return something like this
[id] => 10
[iid] => 58393
[ilocationid] => 0
[iapptid] => 38389
[ddate] => 2012-06-30T00:00:00
[ctimeofday] => 1000
i mean without the numeric representatives of the columns. how do i do it...please help...
As explained in the manual for PHP's mysql_fetch_array() function:
The type of returned array depends on how result_type is defined. By using MYSQL_BOTH (default), you'll get an array with both associative and number indices. Using MYSQL_ASSOC, you only get associative indices (as mysql_fetch_assoc() works), using MYSQL_NUM, you only get number indices (as mysql_fetch_row() works).
Therefore, you want either:
mysql_fetch_array($result, MYSQL_ASSOC);
or
mysql_fetch_assoc($result);
Note however the warning:
Use of this extension is discouraged. Instead, the MySQLi or PDO_MySQL extension should be used. See also MySQL: choosing an API guide and related FAQ for more information. Alternatives to this function include:
mysqli_fetch_array()
PDOStatement::fetch()

PHP don't generate properly array from database (UBUNTU)

I have a little problem.
There are two tables in my database: users and classes. The first one contains info about users, and the second one - about user classes and about access rights.
Now I'm extracting all data from there using this:
SELECT * FROM users NATURAL JOIN classes WHERE users.ID_User = '$id';
The mysql code works and returns a right array.
Now, when I'm doing next:
<?php
$result = mysql_query($sql_above);
$row = mysql_fetch_array($result);
print_r($row);
?>
... i'm getting this:
Array ( [0] => 1 [ID_User] => 1 [1] => John [Name] => John [2] => Doe [Surname] => Doe [3] => ... [16] => Owner [Class] => Owner [17] => [All] => [18] => [CanAuth] => [19] => [CanViewData] => [20] => [CanAddData] => [21] => [CanAlterData] => [22] => [CanDeactivateData] => [23] => [CanDeleteData] => [24] => [CanMgLocatari] => ... )
Columns from 17 till the end are access rights, noted in the database by 1 or 0. And there, they're missing.
Is there any option to enable in PHP configuration to correct this thing? Because on a Windows machine, the code executes properly and rights are working.
PHP Version 5.3.6-13ubuntu3.7 | Apache/2.2.20 (Ubuntu) | MySQL client version: 5.1.62
Please, reply. Thanks!

Joins - Merge result into single, multidimensional array

I'm performing a simple query that joins two tables together. What I get is something like this.
array(
[0] => array(
'id' => 52
'name' => 'charles',
'sale_id' => 921,
'sale_time' => 1306393996,
'sale_price' => 54.21
),
[1] => array(
'id' => 52
'name' => 'charles',
'sale_id' => 922,
'sale_time' => 1306395000,
'sale_price' => 32.41
),
...
);
...which is the expected result. However, I'd like the query to return something like this:
array(
[0] => array(
'id' => 52,
'name' => 'charles',
'sales' => array(
[0] => array(
'sale_id' => 921,
'sale_time' => 1306393996,
'sale_price' => 54.21
),
[1] => array(
'sale_id' => 922,
'sale_time' => 1306395000,
'sale_price' => 32.41
),
...
)
)
)
Now I realize I could simply perform two queries, one for the user info, and another for sales, and merge those arrays together using whatever language I'm using (PHP in this case). But I have many arrays of properties and querying and merging for those seems awfully inelegant to me (although it does work). It seems to me there'd be a way to work with a single, unified object without duplicating data.
Just wondering if there was a no-brainer query, or if that's simply not easy through MySQL alone.
I would say this is not possible with MySQL alone - you have to do some tricks at application level. That is, because even if you send a single query that will bring you all the data from MySQL to your application (PHP), they will come as a denormalized array of data - your first case.
If you want to get the data as in your second case, I'd recommend using some ORM - in Ruby there is ActiveRecord, in Perl there are Class::DBi, DBIx::Class and many more - I can not name one for PHP that is able to do this, but I am sure there are plenty.