redirect to magento admin module from payapl - magento

i have create a custom module for pay vendor's commission in magento admin. I am using paypal form with return url hostname/magento/index.php/vender/adminhtml_commision/pay/id/4/key/6qaGSxQ1ICrEtZXkVCw .
After success payment page is redirecting to magento admin dashboard while it should be redirect to my module page.
page is redirecting to my custom module page with status 302 and open magento dashboard.
The response header of the return url :
Cache-Control no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Connection Keep-Alive
Content-Length 0
Content-Type text/html; charset=UTF-8
Date Thu, 15 May 2014 13:28:22 GMT
Expires Thu, 19 Nov 1981 08:52:00 GMT
Keep-Alive timeout=5, max=100
Location http://localhost/topplefiable/index.php/admin/dashboard/
Pragma no-cache
Server Apache/2.4.4 (Win32) OpenSSL/0.9.8y PHP/5.4.19
Set-Cookie adminhtml=foitk9bk5p7qd25sh9ead2c9e7; expires=Thu, 15-May-2014 14:28:25 GMT; path=/topplefiable; domain=localhost; httponly
X-Powered-By PHP/5.4.19
Request Headersview source
Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding gzip, deflate
Accept-Language en-US,en;q=0.5
Connection keep-alive
Cookie store=s_1396871408storeview; adminhtml=foitk9bk5p7qd25sh9ead2c9e7; __ar_v4=%7C44OQLIKYJZGCJOP7YJWKBT%3A20140326%3A1%7CU4JSAS7TBVBWZGNKUMAMLP%3A20140326%3A1%7CWULQ7VIZHNEFTE7AHVGV7R%3A20140326%3A1; __zlcmid=OhdjUktCqwpH3c
Host localhost
User-Agent Mozilla/5.0 (Windows NT 6.1; rv:30.0) Gecko/20100101 Firefox/30.0
Request Headers From Upload Stream
Content-Length 1037
Content-Type application/x-www-form-urlencoded
Post response :
address_city WESLEY CHAPEL
address_country United States
address_country_code US
address_name RAYOMOND CHINOY
address_state FL
address_status confirmed
address_street 30310 HATZ WAY
address_zip 33543
auth AVkSV2ZSf5ipfxTbeKzKz86hJLe00dVdfxCNrqCuR2pWDjbyC6eIPYoZM3ibYe85vdBQXvoikxWM96Fsdwls8oQ
business stripa_1307688220_biz#domain.com
charset windows-1252
custom
first_name skumar
handling_amount 0.00
item_name
item_number
last_name kumar
mc_currency USD
mc_fee 0.20
mc_gross 0.20
notify_version 3.8
payer_email asah_1314106743_per#domain.com
payer_id Z95WWBMAGSL6Y
payer_status verified
payment_date 06:27:47 May 15, 2014 PDT
payment_fee 0.20
payment_gross 0.20
payment_status Completed
payment_type instant
protection_eligibility Eligible
quantity 1
receiver_email stripa_1307688220_biz#domain.com
receiver_id SNQXFDAY5XY4G
residence_country US
shipping 0.00
tax 0.00
test_ipn 1
transaction_subject
txn_id 3T8615219R228771W
txn_type web_accept
verify_sign A5aQCVrF8.8eOdu1dA6dqFof.9f4AfUbaoQLdRI9ETV8EbisVo3-1RdB
Please suggest me where i am wrong.

I found the solution after debugging errors, There was magento secrete key problem.
Magnto creates a key for each url, when we are passing "key" to paypal request it does not return "key" parameter.
Solution : Rename "key" to "magentokey" in paypal response, after success payment get "magentokey" and save paypal response in your database record. Then redirect to your custom form with "magentokey".

Related

How do I set multiple cookies in a single Webrick response?

I use Webrick to test my HTTP client and I need to test how it gets and sets cookies.
Wikipedia provides an example of such response:
HTTP/1.0 200 OK
Content-type: text/html
Set-Cookie: theme=light
Set-Cookie: sessionToken=abc123; Expires=Wed, 09 Jun 2021 10:18:14 GMT
...
but if I do
server.mount_proc ?/ do |req, res|
res["set-cookie"] = %w{ 1=2 2=3 }
the whole array becomes a single cookie: "[\"1=2\", \"2=3\"]"
And then in WEBrick::HTTPResponse source code I see again the #header = Hash.new that probably means you can't repeat the header key.
Is it impossible?!
UPD:
This leaves me no hope:
https://github.com/rack/rack/issues/52#issuecomment-399629
https://github.com/rack/rack/blob/c859bbf7b53cb59df1837612a8c330dfb4147392/lib/rack/handler/webrick.rb#L98-L100
Another method should be used instead of res[...]=:
res.cookies.push WEBrick::Cookie.new("1", "2")
res.cookies.push WEBrick::Cookie.new("3", "4")
res.cookies.push WEBrick::Cookie.new("1", "5")

Square Connect not paginating correctly for items

I'm trying to pull all the shop items from Square Connect API, and the pagination seems to be broken. Here is the request I'm making:
$ http https://connect.squareup.com/v1/{location id}/items 'Authorization: Bearer XXXXXXXXXXXX'
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: Link
Content-Encoding: gzip
Content-Type: application/json; charset=utf-8
Date: Tue, 29 Nov 2016 09:25:50 GMT
ETag: "-307839789"
Keep-Alive: timeout=60
Strict-Transport-Security: max-age=631152000
Transfer-Encoding: chunked
Vary: Accept-Encoding
X-Content-Type-Options: nosniff
X-Download-Options: noopen
X-Frame-Options: DENY
X-Request-Id: ed/QSsnKQaeuhjoT4K/R
X-Response-Time: 529ms
X-XSS-Protection: 1; mode=block
transfer-encoding: chunked
[
...
]
Critically, the Link header is missing. The documentation here https://docs.connect.squareup.com/api/connect/v1/#pagination describes pagination, and it seems like the header should be present when there are more than 10 results (which there are).
Am I doing something wrong?
I think you are mixing up items and variations.
The response you get from the list items endpoints will give you each of your unique items (in your case ~140), each of those item objects will include additional information about their variations. If you expect to have more items you might actually be counting each variation as a different item.

PHRETS:GetMetadataTypes() called but unable to find GetMetadata location

I'm building a RETS based application and every time I try to run the script it shows "GetMetadataTypes() called but unable to find GetMetadata location. Failed login?". I'm not sure what exactly is causing this issue. Below is my code snippet for your review:
if ($connect)
{
echo " + Connected<br>\n";
$types = $rets->GetMetadataTypes();
// check for errors
if (!$types)
{
print_r($rets->Error());
}
else
{
var_dump($types);
}
}
Below is the debug log for your review.
* About to connect() to ctarmls2.apps.retsiq.com port 80 (#0)
* Trying 107.22.214.38...
* connected
* Connected to ctarmls2.apps.retsiq.com (107.22.214.38) port 80 (#0)
GET /acc/rets/login HTTP/1.1
Host: ctarmls2.apps.retsiq.com
Accept: /
RETS-Version: RETS/1.5
User-Agent: PHRETS/1.0
Accept: /
< HTTP/1.1 401 Unauthorized
< Cache-Control: private
< Cache-Control: private
< Content-Type: text/html;charset=utf-8
< Date: Thu, 18 Dec 2014 09:00:26 GMT
< MIME-Version: 1.0
< RETS-Version: RETS/1.5
< Server: nginx/1.0.11
Added cookie JSESSIONID="94616DF90574A5747A5CC58526968DC4" for domain ctarmls2.apps.retsiq.com, path /acc, expire 0
< Set-Cookie: JSESSIONID=94616DF90574A5747A5CC58526968DC4; Path=/acc
Replaced cookie JSESSIONID="94616DF90574A5747A5CC58526968DC4" for domain ctarmls2.apps.retsiq.com, path /acc, expire 0
< Set-Cookie: JSESSIONID=94616DF90574A5747A5CC58526968DC4; Path=/acc
< WWW-Authenticate: Digest realm="rets#flexmls.com", qop="auth", nonce="055a98f2718db640bb49b25727b265c7", opaque="e740e530f881b719ac847f225d70ef26"
< Content-Length: 954
< Connection: keep-alive
<
Ignoring the response-body
Connection #0 to host ctarmls2.apps.retsiq.com left intact
Issue another request to this URL: 'http://ctarmls2.apps.retsiq.com:80/acc/rets/login'
Re-using existing connection! (#0) with host (nil)
Connected to (nil) (107.22.214.38) port 80 (#0)
Server auth using Digest with user 'chs.rets.asolz1-i33'
GET /acc/rets/login HTTP/1.1
Authorization: Digest username="chs.rets.asolz1-i33", realm="rets#flexmls.com", nonce="055a98f2718db640bb49b25727b265c7", uri="/acc/rets/login", cnonce="MTUzODg1", nc=00000001, qop="auth", response="a28c686f4af4100dc6f417c013c44233", opaque="e740e530f881b719ac847f225d70ef26"
Host: ctarmls2.apps.retsiq.com
Accept: /
Cookie: JSESSIONID=94616DF90574A5747A5CC58526968DC4
RETS-Version: RETS/1.5
User-Agent: PHRETS/1.0
Accept: /
< HTTP/1.1 200 OK
< Cache-Control: private
< Cache-Control: private
< Content-Type: text/xml
< Date: Thu, 18 Dec 2014 09:00:26 GMT
< MIME-Version: 1.0
< RETS-Version: RETS/1.5
< Server: nginx/1.0.11
Replaced cookie JSESSIONID="94616DF90574A5747A5CC58526968DC4" for domain ctarmls2.apps.retsiq.com, path /acc, expire 0
< Set-Cookie: JSESSIONID=94616DF90574A5747A5CC58526968DC4; Path=/acc
< WWW-Authenticate: Digest realm="rets#retsiq.com",qop="auth",nonce="1647953c3586fee2f03a44259066e02d", opaque="31b02b3042ea6"
< Content-Length: 283
< Connection: keep-alive
<
Connection #0 to host (nil) left intact
MemberName=chs.rets.asolz1-i33
User=chs.rets.asolz1-i33,1,MEMBER,20141216152304900080000000
Broker=RETS_OFFIC
MetadataVersion=01.01.71275
MinMetadataVersion=01.01.71275
Logout=/acc/rets/logout
Closing connection #0
Thanks
It is the rets server issue. The server has to specify a metadata url location which is displaying in the xml response when logging via a browser which is missing for this server. Tell this concern to rets server maintenance team.

Returning custom body with HTTP status error

I have a strange problem, I am testing on two different servers,
first server with a basic apache
second server with Zend Server
What I am trying to do it's to call an url on that server with cURL, this url can return one of the following codes: 200, 406 with a json body containing a message.
When querying the Apache server, on 406 error, I get this:
< HTTP/1.1 100 Continue
< HTTP/1.1 406 Not Acceptable
< Date: Wed, 10 Dec 2014 11:16:01 GMT
< Server: Apache/2.4.10 (Ubuntu)
< Content-Length: 75
< Content-Type: application/json
* HTTP error before end of send, stop sending
<
{"status":406,"message":"Domain not found (is the file named correctly ?)"}* Closing connection 0
And when querying the Zend Server, I get this:
< HTTP/1.1 100 Continue
< HTTP/1.1 406 Not Acceptable
< Date: Wed, 10 Dec 2014 11:15:05 GMT
< Connection: Keep-Alive
< Content-Type: text/html; charset=iso-8859-1
< Content-Length: 261
* HTTP error before end of send, stop sending
<
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>406 Not Acceptable</title>
</head><body>
<h1>Not Acceptable</h1>
<p>An appropriate representation of the requested resource /webservice could not be found on this server.</p>
</body></html>
* Closing connection #0
* SSLv3, TLS alert, Client hello (1):
The header type is changed to text/html from application/json, and the body is a plain html error page.
Is this a Zend server issue ?
I dont think it is an issue with either server. The error code returned by both the servers is 406 but the error message in the http response body is sent as json in apache and html in zend server, hence the different content-types.
The two servers have chosen to send the error message in different formats hence the diffent content-types.

Why I'm getting a 500 server response in Google Webmaster Tools?

I'm trying to figure out why my web isn't getting crawled by the Google Spider, and when I do a test about the response of the site I see that I'm getting a 500 server response BUT my website is actually working.
My site is http://lacasadelilihostal.com/ and was made in Laravel.
I see another question when said that the problem could be by a JavaScript error but I don't see anyone in my web; and also I changed the permissions of the public folder to 775 but didn't work either.
This is the exact header response of your homepage. I'm taking a little time to digest this information and will come back. In the meantime others can consider this info too:
HTTP/1.1 200 OK
Date: Thu, 15 Aug 2013 17:35:33 GMT
Server: Apache
X-Powered-By: PHP/5.3.26
Cache-Control: no-cache
Set-Cookie: laravel_session=76c6f66056ff1828be5ad677b87f9690; expires=Thu, 15-Aug-2013 19:35:33 GMT; path=/; HttpOnly
Set-Cookie: laravel_session=76c6f66056ff1828be5ad677b87f9690; expires=Thu, 15-Aug-2013 19:35:34 GMT; path=/; httponly
Connection: close
Transfer-Encoding: chunked
Content-Type: text/html; charset=UTF-8
I check my logs and found that i'm getting the error "'Uninitialized string offset: " in this line:
`$langcode = (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) ? $_SERVER['HTTP_ACCEPT_LANGUAGE'] : '';
$langcode = (!empty($langcode)) ? explode(";", $langcode) : $langcode;
$langcode = (!empty($langcode['0'])) ? explode(",", $langcode['0']) : $langcode;
$langcode = (!empty($langcode['0'])) ? explode("-", $langcode['0']) : $langcode;
$langcode = strtolower($langcode[0]);` `
This only happened with crawlers... I remove the last line.

Resources