-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTransactionDetails.php
More file actions
114 lines (90 loc) · 2.12 KB
/
TransactionDetails.php
File metadata and controls
114 lines (90 loc) · 2.12 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
<?php
include_once('TransactionValueMapper.php');
/**
*
* @package library.payment
* @author Integry Systems
*/
class TransactionDetails
{
protected $recurringItems = array();
protected $lineItems = array();
protected $data = array(
// billing address data
'firstName' => null,
'lastName' => null,
'companyName' => null,
'address' => null,
'city' => null,
'state' => null,
'country' => null,
'postalCode' => null,
'phone' => null,
'email' => null,
// shipping address data
'shippingFirstName' => null,
'shippingLastName' => null,
'shippingCompanyName' => null,
'shippingAddress' => null,
'shippingCity' => null,
'shippingState' => null,
'shippingCountry' => null,
'shippingPostalCode' => null,
'shippingPhone' => null,
'shippingEmail' => null,
// customer data
'clientID' => null,
'ipAddress' => null,
// merchant transaction data
'invoiceID' => null,
// transaction data
'isCompleted' => null,
'amount' => null,
'currency' => null,
'description' => null,
'gatewayTransactionID' => null,
'recurringItemCount' => 0
);
public function __construct()
{
foreach ($this->data as $key => $value)
{
$this->data[$key] = new TransactionValueMapper();
$this->$key = $this->data[$key];
}
}
public function get($key)
{
if (isset($this->data[$key]))
{
return $this->data[$key]->get();
}
}
public function getData()
{
return $this->data;
}
public function getName()
{
return $this->firstName->get() . ' ' . $this->lastName->get();
}
public function addLineItem($name, $itemPrice, $quantity, $sku, $recurringItem = null)
{
$a = array('name' => $name, 'price' => $itemPrice, 'quantity' => $quantity, 'sku' => $sku);
if ($recurringItem)
{
$this->recurringItems[] = $recurringItem;
$this->recurringItemCount->set(count($this->recurringItems));
}
$this->lineItems[] = $a;
}
public function getRecurringItems()
{
return $this->recurringItems;
}
public function getLineItems()
{
return $this->lineItems;
}
}
?>