Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Banktransfer orders are placed on-hold. When payment expires, or fails, ... #27

Closed
wants to merge 3 commits into from
Closed

Conversation

ghost
Copy link

@ghost ghost commented Apr 15, 2015

...the ordered products will be restocked

// Don't update an already paid order
if (!$order->needs_payment())
// Don't update an already paid order, needs_payment() searches by valid_statusses, but does not include on-hold status, so we add it here.
if (!$order->needs_payment() && $order->post->post_status != 'wc-on-hold')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$order->post bestaat bij mij niet in WooCommerce 2.1.10. Wel heb ik $order->status = 'on-hold'. Laatste versie lijkt dit inderdaad via $order->post te doen. Je kunt dan ook gebruik maken van $order->get_status(). https://github.com/woothemes/woocommerce/blob/master/includes%2Fabstracts%2Fabstract-wc-order.php#L880
Deze methode is helaas niet in mijn versie beschikbaar.

@lvgunst
Copy link
Contributor

lvgunst commented Apr 15, 2015

Ik heb mij vergist met voorraad afboeken bij on-hold status. Dit is niet nodig.

Bij update_status('on-hold') worden sales recorded (deze worden gebruikt in de rapporten). Dit betekend niet dat voorraad wordt afgeboekt. Zie https://github.com/woothemes/woocommerce/blob/master/includes%2Fabstracts%2Fabstract-wc-order.php#L2158

Nu wordt de voorraad 2x afgeboekt. In deze wijziging en bij rapporteren banktransfer paid in $order->payment_complete(): https://github.com/woothemes/woocommerce/blob/master/includes%2Fabstracts%2Fabstract-wc-order.php#L2253

Je hoeft bij het aanmaken van de banktransfer payment alleen de order status te updaten naar on-hold. Hierdoor wordt de order niet na X minuten verwijderd (volgends 'voorraad behouden' instelling).

Na rapporteren 'paid' zal de voorraad automatisch worden afgeboekt in $order->payment_complete(). Bij rapporteren 'failed' zouden we de recorded sales kunnen afboeken zodat deze niet meer in de rapporteren zichtbaar zijn. Maar vraag mij af of dit echt nodig is en of dit makkelijk is te doen.

if ($this->id == Mollie_API_Object_Method::BANKTRANSFER)
{
$order->update_status('on-hold', __('Awaiting payment confirmation', 'MPM'));
$order->reduce_order_stock();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reduce_order_stock is dus niet nodig. Gebeurt bij rapporteren paid in $order->payment_complete()

@ghost ghost closed this Apr 15, 2015
@@ -173,7 +173,15 @@ public function process_payment($order_id)
return array('result' => 'failure');
}

$order->update_status('pending', __('Awaiting payment confirmation', 'MPM'));
// We put a banktransfer order 'on-hold'. Woo will deduct stock and won't cancel the order after # minutes.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment is niet helemaal correct maar dat maakt niet uit. Voorraad wordt pas bij $order->payment_complete afgeboekt. update_status('on-hold') doet niks anders dan status wijzigen.

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants