bitpay / magento2-plugin

Magento2.x payment plugin for Bitpay.com
MIT License
13 stars 24 forks source link

Fix checkout error and show billing address #31

Closed feelinc closed 6 years ago

feelinc commented 6 years ago

Fix getting timestamp from invoice DateTime object and show billing address form/sellection at checkout

andrewmoon commented 6 years ago

This commit seems to be incompatible with v2.2 of bitpay/php-client, which is specified in this project's composer file. I needed to revert the timestamp fix to make the extension work in checkout with bitpay/php-client ~2.2 and Magento 2.2.1.

feelinc commented 6 years ago

I was using "magento/product-community-edition": "2.2.1" and "bitpay/php-client": "^3.0" when implement the fix.

pieterpoorthuis commented 6 years ago

Andrew, what's the error you are getting? I don't see any differences between PHP client v2.2 and v3 wrt getInvoiceTime ()

andrewmoon commented 6 years ago

Good point, I didn't check if there were any changes in v3. The error I'm seeing is:

PHP Fatal error: Uncaught Error: Call to a member function getTimestamp() on integer in .../app/code/Bitpay/Core/Model/Method/Bitcoin.php:106

andrewmoon commented 6 years ago

Ah, here we are, see: https://github.com/bitpay/php-bitpay-client/blob/3.0.x/src/Bitpay/Invoice.php vs https://github.com/bitpay/php-bitpay-client/blob/2.2.x/src/Bitpay/Invoice.php

setInvoiceTime method. 3.0 converts the value to a datetime object, 2.2 doesn't change the type, and an integer gets passed in.

pieterpoorthuis commented 6 years ago

I've updated PHP lib v2 (v2.2.15) to include the datetime code from PHP lib v3.

The code should now work. @andrewmoon can you double check?