-
Notifications
You must be signed in to change notification settings - Fork 212
/
Copy pathCustomer.php
80 lines (71 loc) · 2.12 KB
/
Customer.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
<?php
/**
* Created by PhpStorm.
* @author Tareq Mahmood <tareqtms@yahoo.com>
* Created at 8/19/16 11:47 AM UTC+06:00
*
* @see https://help.shopify.com/api/reference/customer Shopify API Reference for Customer
*/
namespace PHPShopify;
/**
* --------------------------------------------------------------------------
* Customer -> Child Resources
* --------------------------------------------------------------------------
* @property-read CustomerAddress $Address
* @property-read Metafield $Metafield
*
* @method CustomerAddress Address(integer $id = null)
* @method Metafield Metafield(integer $id = null)
* --------------------------------------------------------------------------
* Customer -> Custom actions
* --------------------------------------------------------------------------
* @method array search(string $query = '') Search for customers matching supplied query
*/
class Customer extends ShopifyResource
{
/**
* @inheritDoc
*/
protected $resourceKey ='customer';
/**
* @inheritDoc
*/
public $searchEnabled = true;
/**
* @inheritDoc
*/
protected $childResource = array(
'CustomerAddress' => 'Address',
'Metafield',
'Order'
);
/**
* Sends an account invite to a customer.
*
* @param array $customer_invite Customized invite data
*
* @return array
*/
public function send_invite($customer_invite = array())
{
if (empty ( $customer_invite ) ) $customer_invite = new \stdClass();
$url = $this->generateUrl(array(), 'send_invite');
$dataArray = $this->wrapData($customer_invite, 'customer_invite');
return $this->post($dataArray, $url, false);
}
/**
* Create account_activation_link for customer.
*
* @param array $customer_id
*
* @return array
*/
public function account_activation_url($customer_id = 0)
{
if (!(int)$customer_id > 0) {
return false;
}
$url = $this->generateUrl(array(), $customer_id.'/account_activation_url');
return $this->post(array(), $url, false);
}
}