hps / heartland-php

Heartland Payment Systems Payment Gateway PHP SDK
https://developer.heartlandpaymentsystems.com/SecureSubmit/
GNU General Public License v2.0
25 stars 23 forks source link

Charge request throws Unexpected response error #19

Closed yohithvishnu closed 8 years ago

yohithvishnu commented 8 years ago

I am Yohit, the lead developer of J2Store. We have a payment plugin for Heartland, which uses the PHP SDK 2.8.2 release.

Here is the J2Store plugin for heartland : https://www.dropbox.com/s/z7x4nus8r1kp8ps/plg_j2store_payment_heartland.zip?dl=0 Here is the complete details of the error .

Unexpected responseHpsGatewayException Object
(
    [code] => 6
    [details] => 
    [innerException] => 
    [message:protected] => Unexpected response
    [string:Exception:private] => 
    [file:protected] => /homepages/42/d508524250/htdocs/laposta-upgrade-final/plugins/j2store/payment_heartland
/library/src/Abstractions/HpsGatewayServiceAbstract.php
    [line:protected] => 83
    [trace:Exception:private] => Array
        (
            [0] => Array
                (
                    [file] => /homepages/42/d508524250/htdocs/laposta-upgrade-final/plugins/j2store/payment_heartland
/library/src/Services/Gateway/HpsSoapGatewayService.php
                    [line] => 55
                    [function] => submitRequest
                    [class] => HpsGatewayServiceAbstract
                    [type] => ->
                    [args] => Array
                        (
                            [0] => https://cert.api2.heartlandportico.com/Hps.Exchange.PosGateway/PosGatewayService
.asmx
                            [1] => Array
                                (
                                    [0] => Content-type: text/xml;charset="utf-8"
                                    [1] => Accept: text/xml
                                    [2] => SOAPAction: ""
                                    [3] => Content-length: 1300
                                )

                            [2] => <?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:hps="http://Hps.Exchange
.PosGateway"><soapenv:Body><hps:PosRequest><hps:Ver1.0><hps:Header><hps:SecretAPIKey>skapi_cert_MfaWAQBjeV4Ax1_PyAlUWvt0fVnhT4sFlgX-K6_V0Q
</hps:SecretAPIKey><hps:DeveloperID>002914</hps:DeveloperID><hps:VersionNbr>1929</hps:VersionNbr><hps
:SiteTrace></hps:SiteTrace></hps:Header><hps:Transaction><hps:CreditSale><hps:Block1><hps:AllowDup>Y
</hps:AllowDup><hps:AllowPartialAuth>N</hps:AllowPartialAuth><hps:Amt>19.45</hps:Amt><hps:CardHolderData
><hps:CardHolderFirstName>Ramesh</hps:CardHolderFirstName><hps:CardHolderLastName>Elamathi</hps:CardHolderLastName
><hps:CardHolderEmail>ram@j2store.org</hps:CardHolderEmail><hps:CardHolderPhone></hps:CardHolderPhone
><hps:CardHolderAddr>22, East Street</hps:CardHolderAddr><hps:CardHolderCity>San Jose</hps:CardHolderCity
><hps:CardHolderState>California</hps:CardHolderState><hps:CardHolderZip>95101</hps:CardHolderZip></hps
:CardHolderData><hps:CardData><hps:TokenData><hps:TokenValue>supt_rJE3dHeWDS192DMENgPxk7kY</hps:TokenValue
></hps:TokenData><hps:TokenRequest>N</hps:TokenRequest></hps:CardData></hps:Block1></hps:CreditSale>
</hps:Transaction></hps:Ver1.0></hps:PosRequest></soapenv:Body></soapenv:Envelope>

                        )

                )
securesubmit-buildmaster commented 8 years ago

Good morning Ramesh,

Recently, in an effort to get ahead of upcoming PCI requirements to begin using the PCI recommended TLS 1.2, we updated the SDK to connect to an updated domain that only accepts TLS 1.2. If you are able to update your server to support TLS 1.2 this will likely resolve the error. You can confirm that this is the cause by checking the $curlError on line 75. If it has a value of 35 this is definitely the cause. We have an alternate solution to revert you to the old connection but you will be forced to make further changes and update your server to support TLS 1.2 soon when the PCI requirement takes effect. I am adding an error handler to the SDK which I hope to publish soon to specifically identify this issue If you’re using OpenSSL, Curl seems to only require php to use openSSL > 1.0.1c. and then it should work.

If you need the alternate solution which I stress will only work temporarily, let me know. Obviously we understand that being up and running while working on upgrade path is critical.

Charles Simmon Software Developer charles.simmons@e-hps.commailto:charles.simmons@e-hps.com Heartland Payment Systems One Heartland Way Jeffersonville, IN 47130 P 812.280.8222 x65546 Twitter: @HeartlandHPY Facebook: HeartlandHPY LinkedIn: Heartland Payment Systems heartland.ushttp://heartland.us/ [cid:image002.png@01D1492D.BDCA9020] CONFIDENTIALITY WARNING: This email may contain privileged or confidential information and is for the sole use of the intended recipient(s). Any unauthorized use or disclosure of this communication is prohibited. If you believe that you have received this email in error, please notify the sender immediately and delete it from your system.

From: yohithvishnu [mailto:notifications@github.com] Sent: Thursday, March 03, 2016 8:36 AM To: hps/heartland-php heartland-php@noreply.github.com Subject: [heartland-php] Charge request throws Unexpected response error (#19)

I am Ramesh, the lead developer of J2Store. We have a payment plugin for Heartland, which uses the PHP SDK 2.8.2 release.

Here is the J2Store plugin for heartland : https://www.dropbox.com/s/z7x4nus8r1kp8ps/plg_j2store_payment_heartland.zip?dl=0 Here is the complete details of the error .

Unexpected responseHpsGatewayException Object

(

[code] => 6

[details] =>

[innerException] =>

[message:protected] => Unexpected response

[string:Exception:private] =>

[file:protected] => /homepages/42/d508524250/htdocs/laposta-upgrade-final/plugins/j2store/payment_heartland

/library/src/Abstractions/HpsGatewayServiceAbstract.php

[line:protected] => 83

[trace:Exception:private] => Array

    (

        [0] => Array

            (

                [file] => /homepages/42/d508524250/htdocs/laposta-upgrade-final/plugins/j2store/payment_heartland

/library/src/Services/Gateway/HpsSoapGatewayService.php

                [line] => 55

                [function] => submitRequest

                [class] => HpsGatewayServiceAbstract

                [type] => ->

                [args] => Array

                    (

                        [0] => https://cert.api2.heartlandportico.com/Hps.Exchange.PosGateway/PosGatewayService

.asmx

                        [1] => Array

                            (

                                [0] => Content-type: text/xml;charset="utf-8"

                                [1] => Accept: text/xml

                                [2] => SOAPAction: ""

                                [3] => Content-length: 1300

                            )

                        [2] => <?xml version="1.0" encoding="utf-8"?>

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:hps="http://Hps.Exchange

.PosGateway">soapenv:Bodyhps:PosRequesthps:Ver1.0hps:Headerhps:SecretAPIKeyskapi_cert_MfaWAQBjeV4Ax1_PyAlUWvt0fVnhT4sFlgX-K6_V0Q

/hps:SecretAPIKeyhps:DeveloperID002914/hps:DeveloperIDhps:VersionNbr1929/hps:VersionNbr<hps

:SiteTrace>/hps:SiteTrace/hps:Headerhps:Transactionhps:CreditSalehps:Block1hps:AllowDupY

/hps:AllowDuphps:AllowPartialAuthN/hps:AllowPartialAuthhps:Amt19.45/hps:Amt<hps:CardHolderData

hps:CardHolderFirstNameRamesh/hps:CardHolderFirstNamehps:CardHolderLastNameElamathi</hps:CardHolderLastName

hps:CardHolderEmailram@j2store.org/hps:CardHolderEmailhps:CardHolderPhone/hps:CardHolderPhone<mailto:ram@j2store.org%3c/hps:CardHolderEmail%3e%3chps:CardHolderPhone%3e%3c/hps:CardHolderPhone

hps:CardHolderAddr22, East Street/hps:CardHolderAddrhps:CardHolderCitySan Jose</hps:CardHolderCity

hps:CardHolderStateCalifornia/hps:CardHolderStatehps:CardHolderZip95101/hps:CardHolderZip</hps

:CardHolderData>hps:CardDatahps:TokenDatahps:TokenValuesupt_rJE3dHeWDS192DMENgPxk7kY</hps:TokenValue

/hps:TokenDatahps:TokenRequestN/hps:TokenRequest/hps:CardData/hps:Block1/hps:CreditSale

/hps:Transaction/hps:Ver1.0/hps:PosRequest/soapenv:Body/soapenv:Envelope

                    )

            )

— Reply to this email directly or view it on GitHubhttps://github.com/hps/heartland-php/issues/19.

securesubmit-buildmaster commented 8 years ago

Good morning Ramesh;

We have made an update to the PHP-SDK to properly identify and log this specific issue. If it simplifies your process to update to the latest version of the SDK and then check the logs for an HpsGatewayException

The message to look for TLS 1.2 handshake failed.

Charles Simmon Software Developer charles.simmons@e-hps.commailto:charles.simmons@e-hps.com Heartland Payment Systems One Heartland Way Jeffersonville, IN 47130 P 812.280.8222 x65546 Twitter: @HeartlandHPY Facebook: HeartlandHPY LinkedIn: Heartland Payment Systems heartland.ushttp://heartland.us/ [cid:image002.png@01D1492D.BDCA9020] CONFIDENTIALITY WARNING: This email may contain privileged or confidential information and is for the sole use of the intended recipient(s). Any unauthorized use or disclosure of this communication is prohibited. If you believe that you have received this email in error, please notify the sender immediately and delete it from your system.

From: Simmons, Charles (Charlie) Sent: Thursday, March 03, 2016 11:21 AM To: 'hps/heartland-php' reply@reply.github.com; hps/heartland-php heartland-php@noreply.github.com Subject: RE: [heartland-php] Charge request throws Unexpected response error (#19)

Good morning Ramesh,

Recently, in an effort to get ahead of upcoming PCI requirements to begin using the PCI recommended TLS 1.2, we updated the SDK to connect to an updated domain that only accepts TLS 1.2. If you are able to update your server to support TLS 1.2 this will likely resolve the error. You can confirm that this is the cause by checking the $curlError on line 75. If it has a value of 35 this is definitely the cause. We have an alternate solution to revert you to the old connection but you will be forced to make further changes and update your server to support TLS 1.2 soon when the PCI requirement takes effect. I am adding an error handler to the SDK which I hope to publish soon to specifically identify this issue If you’re using OpenSSL, Curl seems to only require php to use openSSL > 1.0.1c. and then it should work.

If you need the alternate solution which I stress will only work temporarily, let me know. Obviously we understand that being up and running while working on upgrade path is critical.

Charles Simmon Software Developer charles.simmons@e-hps.commailto:charles.simmons@e-hps.com Heartland Payment Systems One Heartland Way Jeffersonville, IN 47130 P 812.280.8222 x65546 Twitter: @HeartlandHPY Facebook: HeartlandHPY LinkedIn: Heartland Payment Systems heartland.ushttp://heartland.us/ [cid:image002.png@01D1492D.BDCA9020] CONFIDENTIALITY WARNING: This email may contain privileged or confidential information and is for the sole use of the intended recipient(s). Any unauthorized use or disclosure of this communication is prohibited. If you believe that you have received this email in error, please notify the sender immediately and delete it from your system.

From: yohithvishnu [mailto:notifications@github.com] Sent: Thursday, March 03, 2016 8:36 AM To: hps/heartland-php heartland-php@noreply.github.com<mailto:heartland-php@noreply.github.com> Subject: [heartland-php] Charge request throws Unexpected response error (#19)

I am Ramesh, the lead developer of J2Store. We have a payment plugin for Heartland, which uses the PHP SDK 2.8.2 release.

Here is the J2Store plugin for heartland : https://www.dropbox.com/s/z7x4nus8r1kp8ps/plg_j2store_payment_heartland.zip?dl=0 Here is the complete details of the error .

Unexpected responseHpsGatewayException Object

(

[code] => 6

[details] =>

[innerException] =>

[message:protected] => Unexpected response

[string:Exception:private] =>

[file:protected] => /homepages/42/d508524250/htdocs/laposta-upgrade-final/plugins/j2store/payment_heartland

/library/src/Abstractions/HpsGatewayServiceAbstract.php

[line:protected] => 83

[trace:Exception:private] => Array

    (

        [0] => Array

            (

                [file] => /homepages/42/d508524250/htdocs/laposta-upgrade-final/plugins/j2store/payment_heartland

/library/src/Services/Gateway/HpsSoapGatewayService.php

                [line] => 55

                [function] => submitRequest

                [class] => HpsGatewayServiceAbstract

                [type] => ->

                [args] => Array

                    (

                        [0] => https://cert.api2.heartlandportico.com/Hps.Exchange.PosGateway/PosGatewayService

.asmx

                        [1] => Array

                            (

                                [0] => Content-type: text/xml;charset="utf-8"

                                [1] => Accept: text/xml

                                [2] => SOAPAction: ""

                                [3] => Content-length: 1300

                            )

                        [2] => <?xml version="1.0" encoding="utf-8"?>

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:hps="http://Hps.Exchange

.PosGateway">soapenv:Bodyhps:PosRequesthps:Ver1.0hps:Headerhps:SecretAPIKeyskapi_cert_MfaWAQBjeV4Ax1_PyAlUWvt0fVnhT4sFlgX-K6_V0Q

/hps:SecretAPIKeyhps:DeveloperID002914/hps:DeveloperIDhps:VersionNbr1929/hps:VersionNbr<hps

:SiteTrace>/hps:SiteTrace/hps:Headerhps:Transactionhps:CreditSalehps:Block1hps:AllowDupY

/hps:AllowDuphps:AllowPartialAuthN/hps:AllowPartialAuthhps:Amt19.45/hps:Amt<hps:CardHolderData

hps:CardHolderFirstNameRamesh/hps:CardHolderFirstNamehps:CardHolderLastNameElamathi</hps:CardHolderLastName

hps:CardHolderEmailram@j2store.org/hps:CardHolderEmailhps:CardHolderPhone/hps:CardHolderPhone<mailto:ram@j2store.org%3c/hps:CardHolderEmail%3e%3chps:CardHolderPhone%3e%3c/hps:CardHolderPhone

hps:CardHolderAddr22, East Street/hps:CardHolderAddrhps:CardHolderCitySan Jose</hps:CardHolderCity

hps:CardHolderStateCalifornia/hps:CardHolderStatehps:CardHolderZip95101/hps:CardHolderZip</hps

:CardHolderData>hps:CardDatahps:TokenDatahps:TokenValuesupt_rJE3dHeWDS192DMENgPxk7kY</hps:TokenValue

/hps:TokenDatahps:TokenRequestN/hps:TokenRequest/hps:CardData/hps:Block1/hps:CreditSale

/hps:Transaction/hps:Ver1.0/hps:PosRequest/soapenv:Body/soapenv:Envelope

                    )

            )

— Reply to this email directly or view it on GitHubhttps://github.com/hps/heartland-php/issues/19.

yohithvishnu commented 8 years ago

Still no luck. But new errors Missing argument 2 for HpsGatewayException::__construct(), called in /src/Abstractions/HpsGatewayServiceAbstract.php on line 94 and defined in /src/Infrastructure/HpsGatewayException.php on line 8 Notice: Undefined variable: message in /src/Infrastructure/HpsGatewayException.php

Any thoughts ?

ttnnkkrr commented 8 years ago

My apologies, Truly a double face palm moment for me. I fixed that and it is now in the SDK if you care to get a new copy. or you can simply grab heartland-php/src/Abstractions/HpsGatewayServiceAbstract.php which is where this error was caused

yohithvishnu commented 8 years ago

Updated to the new copy. Now the server returns:

The requested resource could not be loaded because the server returned an error:
  500 TLS 1.2 handshake failed.You do not have the minimum version of OpenSSL 1.0.1c which is required for curl to use TLS 1.2 handshake

But the customer has replied that the server has been updated to meet Heartland's requirement. I do not know what to tell the customer now.

And we are really disappointed with your gateway due to the following reasons (we have integrated 70 + gateways with our shopping cart. And yours is the only system that makes everyone go in circles)

  1. Anyone outside USA cannot access or make a transaction with your test server (something unheard of ). We are forced to use a proxy.
  2. The documentation (except the SDKs in Github) in your site are not accessible to anyone except those in USA.
  3. There are NO developer forums where we can discuss issues with SDK or engage with you.
  4. There are no sandbox accounts for the developers.

There are hundreds of developers outside US who integrate your gateway for clients in USA. If you place restrictions such as this, we have no other option but to recommend the clients to go for other payment gateways. No offense meant. But i am really sorry to say this.

securesubmit-buildmaster commented 8 years ago

Good morning Yohit,

Let me see if I can help you with a few of your concerns. Our dev team takes being accessible quite serious. You may have noticed that my direct contact information is included in my correspondence with you.

Our living documentation can be found here. We are constantly updating adding and revising https://developer.heartlandpaymentsystems.com/SecureSubmit/Documentation. Our dev team is directly accessible via direct email from the link in the second paragraph. We also have phone in support from our specialty products e-commerce team 866.802.9753

It is however, true that we do not currently have a forum. I will forward this concern as well as the comment about being outside of the US. I can confirm that any server that does not have a US based IP will be blocked by default however the folks at the phone number above can whitelist a specific server IP in many cases. Perhaps that can address that concern.

Now on to the heart of the issue at hand. If the customer updated the server but did not restart the web service the changes cannot pick up.

If you check phpinfo for the server in question, could you provide me the versions of ? PHP OpenSSL

As a temporary patch to get you up and running; I cannot stress enough that these old URLs will be cut off in the future due to PCI3.1. At that point there will be no going back

You will want to make two changes in our HpsSoapGatewayService class:

· Change cert.api2.heartlandportico.comhttp://cert.api2.heartlandportico.com to posgateway.cert.secureexchange.nethttp://posgateway.cert.secureexchange.net (https://github.com/hps/heartland-magento-extension/blob/master/lib/SecureSubmit/src/Services/Gateway/HpsSoapGatewayService.php#L327)

· Change api2.heartlandportico.comhttp://api2.heartlandportico.com to posgateway.secureexchange.nethttp://posgateway.secureexchange.net (https://github.com/hps/heartland-magento-extension/blob/master/lib/SecureSubmit/src/Services/Gateway/HpsSoapGatewayService.php#L331) Please let me know if you have any questions.

See additional comments below

Charles Simmons Software Developer charles.simmons@e-hps.commailto:charles.simmons@e-hps.com Heartland Payment Systems One Heartland Way Jeffersonville, IN 47130 P 812.280.8222 x65546 Twitter: @HeartlandHPY Facebook: HeartlandHPY LinkedIn: Heartland Payment Systems heartland.ushttp://heartland.us/ [cid:image002.png@01D1492D.BDCA9020] CONFIDENTIALITY WARNING: This email may contain privileged or confidential information and is for the sole use of the intended recipient(s). Any unauthorized use or disclosure of this communication is prohibited. If you believe that you have received this email in error, please notify the sender immediately and delete it from your system.

From: yohithvishnu [mailto:notifications@github.com] Sent: Tuesday, March 08, 2016 2:08 AM To: hps/heartland-php heartland-php@noreply.github.com Cc: EntApp_DevPortal EntApp_DevPortal@e-hps.com Subject: Re: [heartland-php] Charge request throws Unexpected response error (#19)

Updated to the new copy. Now the server returns:

The requested resource could not be loaded because the server returned an error: 500 TLS 1.2 handshake failed.You do not have the minimum version of OpenSSL 1.0.1c which is required for curl to use TLS 1.2 handshake

But the customer has replied that the server has been updated to meet Heartland's requirement. I do not know what to tell the customer now.

And we are really disappointed with your gateway due to the following reasons (we have integrated 70 + gateways with our shopping cart. And yours is the only system that makes everyone go in circles)

  1. Anyone outside USA cannot access or make a transaction with your test server (something unheard of ). We are forced to use a proxy.
  2. The documentation (except the SDKs in Github) in your site are not accessible to anyone except those in USA. https://developer.heartlandpaymentsystems.com/SecureSubmit/Documentation
  3. There are NO developer forums where we can discuss issues with SDK or engage with you. Currently there is github discussions, direct email (EntApp_DevPortal EntApp_DevPortal@e-hps.com). That email is in the second paragraph of the documentation link
  4. There are no sandbox accounts for the developers. https://developer.heartlandpaymentsystems.com/SecureSubmit/Account/SignIn anyone can create a sandboxed account

There are hundreds of developers outside US who integrate your gateway for clients in USA. If you place restrictions such as this, we have no other option but to recommend the clients to go for other payment gateways. No offense meant. But i am really sorry to say this.

— Reply to this email directly or view it on GitHubhttps://github.com/hps/heartland-php/issues/19#issuecomment-193636481.

yohithvishnu commented 8 years ago

I am really sorry that i cannot accept many of the points in the reply

Our living documentation can be found here. We are constantly updating adding and revising https://developer.heartlandpaymentsystems.com/SecureSubmit/Documentation.

It would be great if you at least make the documentation accessible outside USA. It makes no sense, when your Github repo is globally accessible while your documentation is not.

securesubmit-buildmaster commented 8 years ago

My apologies for the inconvenience. As a workaround you could attempt to clone the dev site https://github.com/hps/hps.github.io

Charles Simmons Software Developer charles.simmons@e-hps.commailto:charles.simmons@e-hps.com Heartland Payment Systems One Heartland Way Jeffersonville, IN 47130 P 812.280.8222 x65546 Twitter: @HeartlandHPY Facebook: HeartlandHPY LinkedIn: Heartland Payment Systems heartland.ushttp://heartland.us/ [cid:image002.png@01D1492D.BDCA9020] CONFIDENTIALITY WARNING: This email may contain privileged or confidential information and is for the sole use of the intended recipient(s). Any unauthorized use or disclosure of this communication is prohibited. If you believe that you have received this email in error, please notify the sender immediately and delete it from your system.

From: yohithvishnu [mailto:notifications@github.com] Sent: Wednesday, March 16, 2016 2:07 AM To: hps/heartland-php heartland-php@noreply.github.com Cc: EntApp_DevPortal EntApp_DevPortal@e-hps.com Subject: Re: [heartland-php] Charge request throws Unexpected response error (#19)

I am really sorry that i cannot accept many of the points in the reply

Our living documentation can be found here. We are constantly updating adding and revising https://developer.heartlandpaymentsystems.com/SecureSubmit/Documentation.

It would be great if you at least make the documentation accessible outside USA. It makes no sense, when your Github repo is globally accessible while your documentation is not.

— You are receiving this because you commented. Reply to this email directly or view it on GitHubhttps://github.com/hps/heartland-php/issues/19#issuecomment-197167511