| 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\CustomerResource; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  | use Signifly\Shopify\Shopify; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  |  | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 11 |  |  | /** @mixin Shopify */ | 
            
                                                                        
                            
            
                                    
            
            
                | 12 |  |  | trait ManagesCustomers | 
            
                                                                        
                            
            
                                    
            
            
                | 13 |  |  | { | 
            
                                                                        
                            
            
                                    
            
            
                | 14 |  |  |     public function createCustomer(array $data): CustomerResource | 
            
                                                                        
                            
            
                                    
            
            
                | 15 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 16 |  |  |         return $this->createResource('customers', $data); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                        
                            
            
                                    
            
            
                | 17 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 18 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 19 |  |  |     public function getCustomersCount(array $params = []): int | 
            
                                                                        
                            
            
                                    
            
            
                | 20 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 21 |  |  |         return $this->getResourceCount('customers', $params); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                        
                            
            
                                    
            
            
                | 22 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 23 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 24 |  |  |     public function paginateSearchCustomers(string $query, array $params = []): Cursor | 
            
                                                                        
                            
            
                                    
            
            
                | 25 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 26 |  |  |         return $this->cursor($this->searchCustomers($query, $params)); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                        
                            
            
                                    
            
            
                | 27 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 28 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 29 |  |  |     public function searchCustomers(string $query, array $params = []): Collection | 
            
                                                                        
                            
            
                                    
            
            
                | 30 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 31 |  |  |         $response = $this->get('customers/search.json', ['query' => $query] + $params); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                        
                            
            
                                    
            
            
                | 32 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 33 |  |  |         return $this->transformCollection($response['customers'], CustomerResource::class); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                        
                            
            
                                    
            
            
                | 34 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 35 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 36 |  |  |     public function paginateCustomers(array $params = []): Cursor | 
            
                                                                        
                            
            
                                    
            
            
                | 37 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 38 |  |  |         return $this->cursor($this->getCustomers($params)); | 
            
                                                                        
                            
            
                                    
            
            
                | 39 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 40 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 41 |  |  |     public function getCustomers(array $params = []): Collection | 
            
                                                                        
                            
            
                                    
            
            
                | 42 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 43 |  |  |         return $this->getResources('customers', $params); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                        
                            
            
                                    
            
            
                | 44 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 45 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 46 |  |  |     public function getCustomer($customerId): CustomerResource | 
            
                                                                        
                            
            
                                    
            
            
                | 47 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 48 |  |  |         return $this->getResource('customers', $customerId); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                        
                            
            
                                    
            
            
                | 49 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 50 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 51 |  |  |     public function updateCustomer($customerId, $data): CustomerResource | 
            
                                                                        
                            
            
                                    
            
            
                | 52 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 53 |  |  |         return $this->updateResource('customers', $customerId, $data); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                        
                            
            
                                    
            
            
                | 54 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 55 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 56 |  |  |     public function deleteCustomer($customerId): void | 
            
                                                                        
                            
            
                                    
            
            
                | 57 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 58 |  |  |         $this->deleteResource('customers', $customerId); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                        
                            
            
                                    
            
            
                | 59 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 60 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 61 |  |  |     public function createCustomerAccountActivationUrl($customerId): string | 
            
                                                                        
                            
            
                                    
            
            
                | 62 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 63 |  |  |         return $this->post("customers/{$customerId}/account_activation_url.json")['account_activation_url']; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                        
                            
            
                                    
            
            
                | 64 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 65 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 66 |  |  |     public function sendCustomerInvite($customerId, array $data = []): ApiResource | 
            
                                                                        
                            
            
                                    
            
            
                | 67 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 68 |  |  |         $response = $this->post("customers/{$customerId}/send_invite.json", ['customer_invite' => $data]); | 
            
                                                                        
                            
            
                                    
            
            
                | 69 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 70 |  |  |         return new ApiResource($response['customer_invite'], $this); | 
            
                                                                        
                            
            
                                    
            
            
                | 71 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 72 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 73 |  |  |     public function paginateCustomerOrders($customerId, array $params = []): Cursor | 
            
                                                                        
                            
            
                                    
            
            
                | 74 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 75 |  |  |         return $this->cursor($this->getCustomerOrders($customerId, $params)); | 
            
                                                                        
                            
            
                                    
            
            
                | 76 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 77 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 78 |  |  |     public function getCustomerOrders($customerId, array $params = []): Collection | 
            
                                                                        
                            
            
                                    
            
            
                | 79 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 80 |  |  |         return $this->getResources('orders', $params, ['customers', $customerId]); | 
            
                                                                        
                            
            
                                    
            
            
                | 81 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 82 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 83 |  |  |     public function createCustomerAddress($customerId, array $data): ApiResource | 
            
                                                                        
                            
            
                                    
            
            
                | 84 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 85 |  |  |         return $this->createResource('addresses', $data, ['customers', $customerId], 'customer_address'); | 
            
                                                                        
                            
            
                                    
            
            
                | 86 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 87 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 88 |  |  |     public function getCustomerAddresses($customerId, array $params = []): Collection | 
            
                                                                        
                            
            
                                    
            
            
                | 89 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 90 |  |  |         return $this->getResources('addresses', $params, ['customers', $customerId]); | 
            
                                                                        
                            
            
                                    
            
            
                | 91 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 92 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 93 |  |  |     public function getCustomerAddress($customerId, $addressId): ApiResource | 
            
                                                                        
                            
            
                                    
            
            
                | 94 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 95 |  |  |         return $this->getResource('addresses', $addressId, ['customers', $customerId]); | 
            
                                                                        
                            
            
                                    
            
            
                | 96 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 97 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 98 |  |  |     public function updateCustomerAddress($customerId, $addressId, $data): ApiResource | 
            
                                                                                                            
                            
            
                                    
            
            
                | 99 |  |  |     { | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 100 |  |  |         return $this->updateResource('addresses', $addressId, $data, ['customers', $customerId], 'customer_address'); | 
            
                                                                        
                                                                
            
                                    
            
            
                | 101 |  |  |     } | 
            
                                                                        
                                                                
            
                                    
            
            
                | 102 |  |  |  | 
            
                                                                        
                                                                
            
                                    
            
            
                | 103 |  |  |     public function deleteCustomerAddress($customerId, $addressId): void | 
            
                                                                        
                                                                
            
                                    
            
            
                | 104 |  |  |     { | 
            
                                                                        
                                                                
            
                                    
            
            
                | 105 |  |  |         $this->deleteResource('addresses', $addressId, ['customers', $customerId]); | 
            
                                                                        
                            
            
                                    
            
            
                | 106 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 107 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 108 |  |  |     public function setDefaultCustomerAddress($customerId, $addressId): ApiResource | 
            
                                                                                                            
                            
            
                                    
            
            
                | 109 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 110 |  |  |         $response = $this->put("customers/{$customerId}/addresses/{$addressId}/default.json"); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 111 |  |  |  | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 112 |  |  |         return new ApiResource($response['customer_address'], $this); | 
            
                                                                        
                                                                
            
                                    
            
            
                | 113 |  |  |     } | 
            
                                                                        
                                                                
            
                                    
            
            
                | 114 |  |  | } | 
            
                                                                        
                                                                
            
                                    
            
            
                | 115 |  |  |  | 
            
                        
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.