|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Signifly\Shopify\REST\Actions; |
|
4
|
|
|
|
|
5
|
|
|
use Illuminate\Support\Collection; |
|
6
|
|
|
use Signifly\Shopify\REST\Cursor; |
|
7
|
|
|
use Signifly\Shopify\REST\Resources\ApiResource; |
|
8
|
|
|
use Signifly\Shopify\REST\Resources\CountryResource; |
|
9
|
|
|
use Signifly\Shopify\Shopify; |
|
10
|
|
|
|
|
11
|
|
|
/** @mixin Shopify */ |
|
12
|
|
|
trait ManagesStoreProperties |
|
13
|
|
|
{ |
|
14
|
|
|
public function createCountry(array $data): CountryResource |
|
15
|
|
|
{ |
|
16
|
|
|
return $this->createResource('countries', $data); |
|
|
|
|
|
|
17
|
|
|
} |
|
18
|
|
|
|
|
19
|
|
|
public function getCountriesCount(array $params = []): int |
|
20
|
|
|
{ |
|
21
|
|
|
return $this->getResourceCount('countries', $params); |
|
|
|
|
|
|
22
|
|
|
} |
|
23
|
|
|
|
|
24
|
|
|
public function getCountries(array $params = []): Collection |
|
25
|
|
|
{ |
|
26
|
|
|
return $this->getResources('countries', $params); |
|
|
|
|
|
|
27
|
|
|
} |
|
28
|
|
|
|
|
29
|
|
|
public function getCountry($countryId): CountryResource |
|
30
|
|
|
{ |
|
31
|
|
|
return $this->getResource('countries', $countryId); |
|
|
|
|
|
|
32
|
|
|
} |
|
33
|
|
|
|
|
34
|
|
|
public function updateCountry($countryId, array $data): CountryResource |
|
35
|
|
|
{ |
|
36
|
|
|
return $this->updateResource('countries', $countryId, $data); |
|
|
|
|
|
|
37
|
|
|
} |
|
38
|
|
|
|
|
39
|
|
|
public function deleteCountry($countryId): void |
|
40
|
|
|
{ |
|
41
|
|
|
$this->deleteResource('countries', $countryId); |
|
|
|
|
|
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
|
|
public function paginateCurrencies(array $params = []): Cursor |
|
45
|
|
|
{ |
|
46
|
|
|
return $this->cursor($this->getCurrencies($params)); |
|
|
|
|
|
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
public function getCurrencies(array $params = []): Collection |
|
50
|
|
|
{ |
|
51
|
|
|
return $this->getResources('currencies', $params); |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
public function getPolicies(array $params = []): Collection |
|
55
|
|
|
{ |
|
56
|
|
|
return $this->getResources('policies', $params); |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
public function getCountryProvincesCount($countryId, array $params = []): int |
|
60
|
|
|
{ |
|
61
|
|
|
return $this->getResourceCount('provinces', $params, ['countries', $countryId]); |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
public function getCountryProvinces($countryId, array $params = []): Collection |
|
65
|
|
|
{ |
|
66
|
|
|
return $this->getResources('provinces', $params, ['countries', $countryId]); |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
public function getCountryProvince($countryId, $provinceId): CountryResource |
|
70
|
|
|
{ |
|
71
|
|
|
return $this->getResource('provinces', $provinceId, ['countries', $countryId]); |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
|
|
public function updateCountryProvince($countryId, $provinceId, array $data): CountryResource |
|
75
|
|
|
{ |
|
76
|
|
|
return $this->updateResource('provinces', $provinceId, $data, ['countries', $countryId]); |
|
77
|
|
|
} |
|
78
|
|
|
|
|
79
|
|
|
public function getShippingZones(array $params = []): Collection |
|
80
|
|
|
{ |
|
81
|
|
|
return $this->getResources('shipping_zones', $params); |
|
82
|
|
|
} |
|
83
|
|
|
|
|
84
|
|
|
public function shop(): ApiResource |
|
85
|
|
|
{ |
|
86
|
|
|
$response = $this->get('shop.json'); |
|
|
|
|
|
|
87
|
|
|
|
|
88
|
|
|
return new ApiResource($response->json('shop'), $this); |
|
89
|
|
|
} |
|
90
|
|
|
} |
|
91
|
|
|
|