-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMonsumCustomer.php
84 lines (65 loc) · 2.24 KB
/
MonsumCustomer.php
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
<?php
/*
* Monsum API Wrapper
* Licensed under the MIT License (MIT)
*/
class MonsumCustomer
{
protected $api_obj = null;
protected $cst_data = null;
public function __construct($api_obj) {
$this->api_obj = $api_obj;
}
public function loadCustomerFromData($arr) {
$this->cst_data = $arr;
}
public function loadCustomerByID($cstid = "") {
$this->cst_data = null;
$query = array("SERVICE" => "customer.get",
"FILTER" => array("CUSTOMER_ID" => $cstid),
"LIMIT" => 1);
if($this->api_obj->api_call($query, true))
$this->cst_data = $this->api_obj->get_data()->CUSTOMERS[0];
}
public function dump() {
if(isset($this->cst_data))
print_r($this->cst_data);
}
public function getID() {
return (isset($this->cst_data) ? $this->cst_data->CUSTOMER_ID : "");
}
public function getNumber() {
return (isset($this->cst_data) ? $this->cst_data->CUSTOMER_NUMBER : "");
}
public function getOrganization() {
return (isset($this->cst_data) ? $this->cst_data->ORGANIZATION : "");
}
public function getFirstname() {
return (isset($this->cst_data) ? $this->cst_data->FIRST_NAME : "");
}
public function getLastname() {
return (isset($this->cst_data) ? $this->cst_data->LAST_NAME : "");
}
public function getCity() {
return (isset($this->cst_data) ? $this->cst_data->CITY : "");
}
public function getEMail() {
return (isset($this->cst_data) ? $this->cst_data->EMAIL : "");
}
public function getDaysForPayment() {
return (isset($this->cst_data) ? $this->cst_data->DAYS_FOR_PAYMENT : "");
}
public function getCreated() {
return (isset($this->sub_data) ? strtotime($this->cst_data->CREATED) : "");
}
public function getCustomerType() {
return (isset($this->cst_data) ? $this->cst_data->CUSTOMER_TYPE : "");
}
public function getCreditBalance() {
return (isset($this->cst_data) ? $this->cst_data->CREDIT_BALANCE : "");
}
public function getInvoiceDeliveryMethod() {
return (isset($this->cst_data) ? $this->cst_data->INVOICE_DELIVERY_METHOD : "");
}
}
?>