-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOrderController.php
More file actions
147 lines (135 loc) · 4.01 KB
/
OrderController.php
File metadata and controls
147 lines (135 loc) · 4.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
<?php
/**
* Controller class
* @author Undergraduate Group One
*/
//associated with LegacyDBInterface, CustomerInterface,
// PartStore, OrderStore, and CCInterface
//create a session
session_start();
include 'CustomerInterface.php';
include 'LegacyProductDBInterface.php';
include 'PartStore.php';
include 'OrderStore.php';
include 'CCProcessInterface.php';
include 'WeightStore.php';
class OrderController
{
var $customerInterface;
var $productDBInterface;
var $partStore;
var $orderStore;
var $ccProcessInterface;
var $weightstore;
function __construct()
{
$this->customerInterface = new customerInterface();
$this->productDBInterface = new LegacyProductDBInterface();
$this->partStore = new PartStore();
$this->orderStore = new OrderStore();
$this->weightstore = new WeightStore();
$this->ccProcessInterface = new CCProcessInterface();
}
//returns $rows, a collection of all rows in the Legacy Product DB
public function updateInventory($query)
{
$this->partStore->updateInventory($this->partStore->accessPartStoreDatabase($query));
}
public function emptyCart()
{
$this->partStore->emptyCart();
}
public function accessCatalog($query)
{
return $this->productDBInterface->accessDatabase($query);
}
public function searchCatalog($partNumArray)
{
return $this->productDBInterface->searchproductDBInterface($partNumArray);
}
public function displayCatalog($rows)
{
return $this->customerInterface->displayCatalog($rows);
}
public function accessCart()
{
return $this->productDBInterface->accessCart();
}
public function addToCart($query)
{
return $this->productDBInterface->addToCart($query);
}
public function removeFromCart($query)
{
return $this->partStore->removeFromDatabase($query);
}
public function displayCart($query)
{
return $this->customerInterface->displayCart($query);
}
public function cancelOrder()
{
return $this->partStore->cancelOrder();
}
public function displayShippingCheckout()
{
return $this->customerInterface->displayShippingCheckout();
}
public function displayNameCheckout()
{
return $this->customerInterface->displayNameCheckout();
}
public function displayBillingCheckout()
{
return $this->customerInterface->displayBillingCheckout();
}
public function displayCreditCardCheckout()
{
return $this->customerInterface->displayCreditCardCheckout();
}
public function setShipping($shippingaddress,$email)
{
return $this->orderStore->setShipping($shippingaddress,$email);
}
public function displayPlaceOrder()
{
$this->customerInterface->displayPlaceOrder();
}
public function calculateShipping($totalweight)
{
return $this->weightstore->calculateShipping($totalweight);
}
public function setBilling($billingaddress)
{
return $this->orderStore->setBilling($billingaddress);
}
public function newOrder($total,$fname,$lname,$address,$email)
{
return $this->orderStore->newOrder($total,$fname,$lname,$address,$email);
}
public function accessOrderStore($query)
{
return $this->orderStore->accessOrderStoreDatabase($query);
}
public function accessPartStore($query)
{
return $this->partStore->accessPartStoreDatabase($query);
}
public function validateCard($creditCardNum, $name, $exp, $amt, $last4)
{
return $this->ccProcessInterface->validateCard($creditCardNum, $name, $exp, $amt, $last4);
}
public function sendConfirmationEmail($email)
{
$this->customerInterface->sendConfirmationEmail($email,OrderStore::getLastOrderNumber());
}
public function getQuantity($ordernum)
{
return $this->partStore->getQuantity($ordernum);
}
public function getPrice($totalweight)
{
return $this->weightstore->getPrice($totalweight);
}
}
?>