php) that calls this business tier
method is also called UpdateOrderStatus(). Add this method to order_processor.php:
// Set order status
public function UpdateOrderStatus($status)
{
Orders::UpdateOrderStatus($this->mOrderInfo['order_id'], $status);
$this->mOrderInfo['status'] = $status;
}
Exercise: Setting Credit Card Authentication Details
1. First add the orders_set_auth_code stored procedure to the database:
-- Create orders_set_auth_code stored procedure
CREATE PROCEDURE orders_set_auth_code(IN inOrderId INT,
IN inAuthCode VARCHAR(50), IN inReference VARCHAR(50))
BEGIN
UPDATE orders
SET auth_code = inAuthCode, reference = inReference
WHERE order_id = inOrderId;
END$$
2. Add the SetOrderAuthCodeAndReference() method to the Orders class in business/orders.php:
// Sets order's authorization code
public static function SetOrderAuthCodeAndReference ($orderId, $authCode,
$reference)
{
// Build the SQL query
$sql = 'CALL orders_set_auth_code(:order_id, :auth_code, :reference)';
// Build the parameters array
$params = array (':order_id' => $orderId,
':auth_code' => $authCode,
':reference' => $reference);
// Execute the query
DatabaseHandler::Execute($sql, $params);
}
3. The code to set these values in the database is the SetOrderAuthCodeAndReference() method, which
we need to add to the OrderProcessor class in business/order_processor.
Pages:
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706