Page 1 of 1

[Solved] GuzzleHttp and Opencart 3

Posted: Tue Sep 10, 2019 11:59 pm
by pm-netti
Hi

Has anyone got to work on "custom headers" in Guzzlehttp ( system/storage/vendor/guzzlehttp/ )?

Re: GuzzleHttp and Opencart 3

Posted: Wed Sep 11, 2019 1:07 am
by pm-netti
pm-netti wrote:
Tue Sep 10, 2019 11:59 pm
Hi

Has anyone got to work on "custom headers" in Guzzlehttp ( system/storage/vendor/guzzlehttp/ )?
Ps. Bin-test https://postb.in/

Code: Select all

$headers = array(
                         'checkout-account' => $checkout_merchant,
		         'checkout-algorithm' => 'sha256',
		         'checkout-method' => 'POST',
		         'checkout-nonce' => '564635208570151',
		         'checkout-timestamp' => date('Y-m-d\TH:i:s.Z\Z', time()),
                         'content-type' => 'application/json; charset=utf-8',
		         'checkout-transaction-id' => $this->session->data['order_id']
   );

            $client = new \GuzzleHttp\Client(array('headers' => $headers));
            $response = $client->post('https://postb.in/1568135374147-4690802653785',array());
            
Output:

Code: Select all

Headers
x-real-ip: 192.130.146.163
host: postb.in
connection: close
content-length: 0
user-agent: Guzzle/5.3.1 curl/7.65.3 PHP/5.6.40

Re: GuzzleHttp and Opencart 3

Posted: Wed Sep 11, 2019 5:40 pm
by paulfeakins
Question not clear ...

Re: GuzzleHttp and Opencart 3

Posted: Wed Sep 11, 2019 9:33 pm
by pm-netti
One shortcoming of Opencart: It use Guzzlehttp version 5.3.1. I recommed use Guzzlehttp 6.3.3.
Other shortcomig: Not all files in the guzzlehttp library are included in the Opencart vendor. You still need to install guzzlehttp library with Composer.

Problem: Many use a windows computer. In it, installing the Guzzlehttp library using Composer is almost impossible.

Re: GuzzleHttp and Opencart 3

Posted: Wed Sep 11, 2019 10:16 pm
by paulfeakins
pm-netti wrote:
Wed Sep 11, 2019 9:33 pm
Problem: Many use a windows computer.
Solution: Develop on a Linux server.

Re: GuzzleHttp and Opencart 3

Posted: Wed Sep 11, 2019 10:22 pm
by pm-netti
paulfeakins wrote:
Wed Sep 11, 2019 10:16 pm
pm-netti wrote:
Wed Sep 11, 2019 9:33 pm
Problem: Many use a windows computer.
Solution: Develop on a Linux server.
It is possible, if install Ubuntu. But current Opencart folder system/storage/vendor/guzzlehttp is useless.

Re: GuzzleHttp and Opencart 3

Posted: Wed Sep 11, 2019 10:25 pm
by paulfeakins
pm-netti wrote:
Wed Sep 11, 2019 10:22 pm
It is possible, if install Ubuntu.
You could use VirtualBox.

pm-netti wrote:
Wed Sep 11, 2019 10:22 pm
But current Openacrt folder system/vendor/guzzlehttp is useless.
Why not use the version from here?
https://www.opencart.com/index.php?route=cms/download

Re: GuzzleHttp and Opencart 3

Posted: Wed Sep 11, 2019 10:35 pm
by pm-netti
paulfeakins wrote:
Wed Sep 11, 2019 10:25 pm
Why not use the version from here?
https://www.opencart.com/index.php?route=cms/download
Is need you A2 Hosting? What there?

Re: GuzzleHttp and Opencart 3

Posted: Wed Sep 11, 2019 10:54 pm
by paulfeakins
pm-netti wrote:
Wed Sep 11, 2019 10:35 pm
Is need you A2 Hosting? What there?
Image

Re: GuzzleHttp and Opencart 3

Posted: Wed Sep 11, 2019 10:55 pm
by paulfeakins
That's the standard OpenCart download link.

Re: GuzzleHttp and Opencart 3

Posted: Wed Sep 11, 2019 11:05 pm
by pm-netti
paulfeakins wrote:
Wed Sep 11, 2019 10:55 pm
That's the standard OpenCart download link.
I have all Opencart zip-packages between 1.4.7 - 3.0.3.2 and development version 3.1

Re: GuzzleHttp and Opencart 3

Posted: Wed Sep 11, 2019 11:11 pm
by paulfeakins
So it's still not clear exactly why you are trying to modify headers?

Re: GuzzleHttp and Opencart 3

Posted: Wed Sep 11, 2019 11:18 pm
by pm-netti
paulfeakins wrote:
Wed Sep 11, 2019 11:11 pm
So it's still not clear exactly why you are trying to modify headers?
Current Opencart Guzzlehttp 5.3.1 is not work. You can see in up from postb.in, it create own "sweeping" header. Guzzle remove required headers from array $headers. Many currents extensions required Guzzlehttp 6.

Re: GuzzleHttp and Opencart 3

Posted: Wed Sep 11, 2019 11:36 pm
by paulfeakins
pm-netti wrote:
Wed Sep 11, 2019 11:18 pm
Current Opencart Guzzlehttp 5.3.1 is not work.
You need to be clearer.

"is not work" is not a good description.

What *exactly* are you trying to do and what *exactly* is it doing instead?

Re: GuzzleHttp and Opencart 3

Posted: Wed Sep 11, 2019 11:52 pm
by pm-netti
paulfeakins wrote:
Wed Sep 11, 2019 11:36 pm
pm-netti wrote:
Wed Sep 11, 2019 11:18 pm
Current Opencart Guzzlehttp 5.3.1 is not work.
You need to be clearer.

"is not work" is not a good description.

What *exactly* are you trying to do and what *exactly* is it doing instead?
That postb.in should output:

Code: Select all

Headers
x-real-ip: 192.130.146.163
host: postb.in
connection: close
content-length:388
user-agent: Guzzle/5.3.1 curl/7.65.3 PHP/5.6.40
checkout-account: 346754
checkout-algorithm: sha256
checkout-method:POST
checkout-nonce: 564635208570151
checkout-timestamp: 2019-09-11T12:06:45.799Z
content-type: application/json; charset=utf-8
signature: pla pla pla
What this is difficult to understand? This is one new interface of Payment Gateway. The old interface disappears at some point.

Ps. This payment gateway is inessential. Main important is it, that system/storage/vendor/guzzlehttp is useless and dud.

Re: GuzzleHttp and Opencart 3

Posted: Thu Sep 12, 2019 2:41 am
by pm-netti
Ps. Guzzlehttp 5.3.1 is released in the summer of 2016, version 6.3.3 in spring 2018 :)

https://packagist.org/packages/guzzlehttp/guzzle