coinbase / coinbase-commerce-prestashop

DEPRECATED — Official Coinbase Commerce Prestashop Payment Module
https://commerce.coinbase.com/integrate
Apache License 2.0
11 stars 22 forks source link

sir webhook is not working giving error 500 #13

Closed adityarathoreworld closed 4 years ago

adityarathoreworld commented 4 years ago

webhook give error 500 and not capturing the response from coinbase after successful payment. Remote server at myownrank.com returned an HTTP 500 when i try testing webhook. using presta 1.6.1.24

mikirimiki commented 4 years ago

I have encountered the same problem today on PS 1.7.6.4 trying to send a test from Coinbase Commerce platform in the Webhook section.

adityarathoreworld commented 4 years ago

Fixed, change namespace and class to Charge instead of charge in util.php Vendor/coinbaseSdk/lib

adityarathoreworld commented 4 years ago

Also, there is a missing function in webhook.php after change order status. There must be addwithemail after changing order status for status 2. Inbox me for fixed code Im@adityarathore.world

mikirimiki commented 4 years ago

Thank you so much. I'll try this afternoon.

Regards

Il sab 11 apr 2020, 10:28 adityarathoreworld notifications@github.com ha scritto:

Fixed, change namespace and class to Charge instead of charge in util.php Vendor/coinbaseSdk/lib

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/coinbase/coinbase-commerce-prestashop/issues/13#issuecomment-612366136, or unsubscribe https://github.com/notifications/unsubscribe-auth/AM35RU276EHUP5Q44KU4O2LRMASZ7ANCNFSM4JNPJQ7Q .

adityarathoreworld commented 4 years ago

@mikirimiki check my comments

mikirimiki commented 4 years ago

@mikirimiki check my comments

I read. So I sent you an email.

adityarathoreworld commented 4 years ago

done Here are the modified files for proper working 1) Modules/coinbase/controllers/frontcontroller/webhook.php changes:

2) Modules/coinbase/vendor/coinbaseSDK/lib/util.php

mikirimiki commented 4 years ago

done Here are the modified files for proper working

  1. Modules/coinbase/controllers/frontcontroller/webhook.php changes:
  • orderhistory class addwithemail method added for payment accepted status (2 in my case). postprocess function line 38-62 //Update order status $history = new OrderHistory(); $history->id_order = $order->id; $history->changeIdOrderState((int)Configuration::get($status), $order->id); $ostatus = Configuration::get($status); //to get order status if($ostatus == 2) // check payment accepted status and sending email for same { $history->addWithemail(); $history->save(); } else { // If charge payment exists then update transaction id with charge id $chargePayment = end($chargeObj->payments); $payments = $order->getOrderPaymentCollection(); if ($payments->count() > 0 && $chargePayment && isset($chargePayment['transaction_id'])) { $payments[0]->transaction_id = $chargeId; $payments[0]->update(); } }

    die(0);

    } coinbase (1).zip

  1. Modules/coinbase/vendor/coinbaseSDK/lib/util.php
  • change charge to Charge in line 4 - use CoinbaseSDK\Resources\Charge; line 42 - 'charge' => Charge::getClassName(),

I tried, but on the Coinbase commerce platform the response to webhook test is again: Remote server at campingpro.it returned an HTTP 500

I replaced the coinbase folder with yours.

adityarathoreworld commented 4 years ago

Its because when you test webhook subscription it send empty array. Try making 0.1$ transaction it will work

adityarathoreworld commented 4 years ago

Check error_log it will show array with 0,0,0 or empty array error

adityarathoreworld commented 4 years ago

Also webhook url will be https://{{your domain name}}/module/coinbase/webhook

mikirimiki commented 4 years ago

Check error_log it will show array with 0,0,0 or empty array error

Yes, I received this log: [13/Apr/2020:08:44:14 +0200] "POST /it/module/coinbase/webhook HTTP/1.1" 500 - my_domain "-" "weipay-webhooks" "-"

oa-coinbase commented 4 years ago

Hi folks, unfortunately we will be deprecating this plugin/ repository at this moment. We may pick it back up down the line with updates, but for now feel free to fork it and apply any fixes for you/ the community. Thanks!