mollie / WooCommerce

Official Mollie extension for WooCommerce
https://wordpress.org/plugins/mollie-payments-for-woocommerce/
Other
131 stars 53 forks source link

No changes in WooCommerce for charged back payments #128

Closed ndijkstra closed 6 years ago

ndijkstra commented 7 years ago

When Mollie reports a payment as "charged_back", nothing happens with the order status in WooCommerce. Also an incorrect order note is added (Payment received)

davdebcom commented 7 years ago

About statuses: https://www.mollie.com/nl/docs/status

The doc doesn't explicitly state that the webhook is called, but I am assuming it is. @ndijkstra maybe you can add that to the doc?

Is "Payment received" the only order note that is added? Is that the exact order note? Are you sure that order note is added by the webhook call for charged back (it wasn't aded earlier?)?

Does Mollie have a way to fake webhook calls (with status called_back) already? Or could you set one of my test payments to charged back (I'll give you the ID) so I can use that to test?

What's the content in WooCommerce > System status > Logs > mollie-payments-for-woocommerce...?

ndijkstra commented 7 years ago

Hi,

I will make an internal issue for adding the information to our docs.

When the status is charged_back, the same order note is added when a payment is successful. The order note is created by the second webhook (same time).

Unfortunately we can not set the status to charged_back in testmode. (also created an internal issue for that)

The log tells us the same line as for a paid status (webhook called ...)

davdebcom commented 7 years ago

Thank you for creating those issues, especially setting the status to charged_back in testmode would be helpful.

The log doesn't have a message like this for that order? Order $order_id does not need a payment (payment webhook {$payment->id}).

The issue seems to come from the check $this->orderNeedsPayment which triggers handlePayedOrderWebhook. https://github.com/mollie/WooCommerce/blob/master/mollie-payments-for-woocommerce/includes/mollie/wc/gateway/abstract.php#L670

In the base class it only sends the above message to the log. https://github.com/mollie/WooCommerce/blob/master/mollie-payments-for-woocommerce/includes/mollie/wc/gateway/abstract.php#L706

In the extended class Mollie_WC_Gateway_AbstractSepaRecurring it adds that order note. https://github.com/mollie/WooCommerce/blob/master/mollie-payments-for-woocommerce/includes/mollie/wc/gateway/abstractseparecurring.php#L206

I think that order note should never be set, I propose removing it. But actually, why do we need a handlePayedOrderWebhook at all? We should just let the status and onWebhookChargedBack (to be created) handle all situations.

Do you agree? And I would really like to be able to set payments to charged_back before I start work on this, can I wait for that?

davdebcom commented 6 years ago

@ndijkstra Any news on the option to set status charged_back for test payments?

davdebcom commented 6 years ago

I've created a solution for this. Because there is no official way to test the webhook call for 'charged_back' status I did a quick workaround to get as close to a good test situation as possible.

edit order e2 80 b9 woo 3 0 e2 80 94 wordpress 2018-01-30 13-33-24

FawadNL commented 6 years ago

Hi @davdebcom

I understand the motives of this (going on hold instead of failed), because Mollie is going to make a second attempt for collection. But what happens if that also fails? The order status must be go on "failed" at some point, so the shop owner knows that there will be no more attempts for collection.

My primary concern is now with Moneybird plugin, the new update which will roll out soon, will have failed order support. In case an order fails, the payment inside the invoice will get deleted (making the corresponding invoice as not-paid). This is great news and what all wc-subscriptions users have been waiting for but the "automation" of accounting is hindered by your above solution.

davdebcom commented 6 years ago

I understand the motives of this (going on hold instead of failed), because Mollie is going to make a second attempt for collection. But what happens if that also fails? The order status must be go on "failed" at some point, so the shop owner knows that there will be no more attempts for collection.

No, this is a charge back, Mollie will not try again, the status is final. The order status is changed to "On Hold" because shop-owner will need to review such an order and decide what they want to do (contact the customer, change stock etc). The shop-owner can then change the status to "Failed" manually. Again, this is because charged back payments need shop-owner intervention.

This is great news and what all wc-subscriptions users have been waiting for but the "automation" of accounting is hindered by your above solution.

Well, actually I don't think so. The shop-owner reviews the orders with "On Hold" status and decides what should happen. He/she could set the status to Failed, and the MoneyBird workflow would be triggered.

FawadNL commented 6 years ago

Ahh got it. That is important indeed for physical products sold but not for digital products. But I can live with it. Thanks for the update.

FawadNL commented 6 years ago

@davdebcom This:

Is no longer working with the latest plugin version 5.0.2. Instead, it goes to to status complete after chargedback.

Example payment_id: tr_6FnE3bRTtu

screenshot 116

Log: 2018-10-22T05:07:00+00:00 DEBUG mollie_wc_gateway_ideal: Mollie payment object tr_6FnE3bRTtu (live) webhook call for order 43660. 2018-10-22T05:07:00+00:00 DEBUG Mollie_WC_Payment_PaymentMollie_WC_Payment_Payment::onWebhookPaid called for payment 43660 2018-10-22T05:07:00+00:00 DEBUG Mollie_WC_Payment_PaymentMollie_WC_Payment_Payment::onWebhookPaid WooCommerce payment_complete() processed and returned to Mollie_WC_Payment_Payment::onWebhookPaid for payment 43660 2018-10-22T05:07:00+00:00 DEBUG Mollie_WC_Payment_PaymentMollie_WC_Payment_Payment::onWebhookPaid processing paid payment via Mollie plugin fully completed for order 43660