From 4ad712980553b75b3177710fe28d04bbaea5463a Mon Sep 17 00:00:00 2001 From: Juerd Waalboer Date: Wed, 10 May 2017 22:08:33 +0200 Subject: [PATCH] New hook: checkout_done --- lib/RevBank/Cart.pm | 2 ++ lib/RevBank/Plugins.pm | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/RevBank/Cart.pm b/lib/RevBank/Cart.pm index 6e7e82d..e1f5ab5 100644 --- a/lib/RevBank/Cart.pm +++ b/lib/RevBank/Cart.pm @@ -114,6 +114,8 @@ sub checkout { RevBank::Users::update($account, $sum, $transaction_id); } + RevBank::Plugins::call_hooks("checkout_done", $self, $user,$transaction_id); + $self->empty; sleep 1; # Ensure new timestamp/id for new transaction diff --git a/lib/RevBank/Plugins.pm b/lib/RevBank/Plugins.pm index 809bc46..ebe2b32 100644 --- a/lib/RevBank/Plugins.pm +++ b/lib/RevBank/Plugins.pm @@ -249,7 +249,11 @@ Be careful to avoid infinite loops if you add new stuff. =item hook_checkout $class, $cart, $user, $transaction_id -Called when the transaction is finalized. +Called when the transaction is finalized, before accounts are updated. + +=item hook_checkout $class, $cart, $user, $transaction_id + +Called when the transaction is finalized, after accounts were updated. =item hook_reject $class, $plugin, $reason, $abort