Created
December 5, 2012 22:36
-
-
Save chardcastle/4220130 to your computer and use it in GitHub Desktop.
eCommerce order complete process
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Decode the Crypt field and extract the results | |
$sagePay = new SagePay_Util(); | |
$strDecoded = $sagePay->decodeAndDecrypt($strCrypt); | |
$values = $sagePay->getToken($strDecoded); | |
// Fire a range of actions | |
$listeners = array( | |
"Application_Model_Order", // Add order to database | |
"SagePay_Order", // Update order with payment information | |
"Application_Model_User", // Email order details | |
"Application_Model_Basket", // Clear basket contents | |
"Application_Model_Product", // Decrease stock levels | |
); | |
foreach ($listeners as $listener) | |
{ | |
$command = new $listener; | |
$command->orderComplete($values, $this->view->basket->getId()); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment