7
7
8
8
namespace Magento \Customer \Api ;
9
9
10
- use Magento \Customer \Api \Data \AddressInterface ;
11
- use Magento \Customer \Api \Data \CustomerInterface ;
12
- use Magento \Customer \Api \Data \ValidationResultsInterface ;
13
10
use Magento \Framework \Exception \InputException ;
14
- use Magento \Framework \Exception \LocalizedException ;
15
- use Magento \Framework \Exception \NoSuchEntityException ;
16
- use Magento \Framework \Exception \State \ExpiredException ;
17
- use Magento \Framework \Exception \State \InputMismatchException ;
18
11
19
12
/**
20
13
* Interface for managing customers accounts.
@@ -35,84 +28,84 @@ interface AccountManagementInterface
35
28
/**
36
29
* Create customer account. Perform necessary business operations like sending email.
37
30
*
38
- * @param CustomerInterface $customer
39
- * @param string|null $password
31
+ * @param \Magento\Customer\Api\Data\ CustomerInterface $customer
32
+ * @param string $password
40
33
* @param string $redirectUrl
41
- * @return CustomerInterface
42
- * @throws LocalizedException
34
+ * @return \Magento\Customer\Api\Data\ CustomerInterface
35
+ * @throws \Magento\Framework\Exception\ LocalizedException
43
36
*/
44
37
public function createAccount (
45
38
\Magento \Customer \Api \Data \CustomerInterface $ customer ,
46
- $ password = null ,
47
- $ redirectUrl = ''
39
+ $ password = null ,
40
+ $ redirectUrl = ''
48
41
);
49
42
50
43
/**
51
44
* Create customer account using provided hashed password. Should not be exposed as a webapi.
52
45
*
53
- * @param CustomerInterface $customer
46
+ * @param \Magento\Customer\Api\Data\ CustomerInterface $customer
54
47
* @param string $hash Password hash that we can save directly
55
48
* @param string $redirectUrl URL fed to welcome email templates. Can be used by templates to, for example, direct
56
49
* the customer to a product they were looking at after pressing confirmation link.
57
- * @return CustomerInterface
58
- * @throws InputException If bad input is provided
59
- * @throws InputMismatchException If the provided email is already used
60
- * @throws LocalizedException
50
+ * @return \Magento\Customer\Api\Data\ CustomerInterface
51
+ * @throws \Magento\Framework\Exception\ InputException If bad input is provided
52
+ * @throws \Magento\Framework\Exception\State\ InputMismatchException If the provided email is already used
53
+ * @throws \Magento\Framework\Exception\ LocalizedException
61
54
*/
62
55
public function createAccountWithPasswordHash (
63
- CustomerInterface $ customer ,
64
- string $ hash ,
65
- string $ redirectUrl = ''
66
- ): CustomerInterface ;
56
+ \ Magento \ Customer \ Api \ Data \ CustomerInterface $ customer ,
57
+ $ hash ,
58
+ $ redirectUrl = ''
59
+ );
67
60
68
61
/**
69
62
* Validate customer data.
70
63
*
71
- * @param CustomerInterface $customer
72
- * @return ValidationResultsInterface
73
- * @throws LocalizedException
64
+ * @param \Magento\Customer\Api\Data\ CustomerInterface $customer
65
+ * @return \Magento\Customer\Api\Data\ ValidationResultsInterface
66
+ * @throws \Magento\Framework\Exception\ LocalizedException
74
67
*/
75
- public function validate (CustomerInterface $ customer ): ValidationResultsInterface ;
68
+ public function validate (\ Magento \ Customer \ Api \ Data \ CustomerInterface $ customer );
76
69
77
70
/**
78
71
* Check if customer can be deleted.
79
72
*
80
73
* @param int $customerId
81
74
* @return bool
82
- * @throws NoSuchEntityException If group is not found
83
- * @throws LocalizedException
75
+ * @throws \Magento\Framework\Exception\ NoSuchEntityException If group is not found
76
+ * @throws \Magento\Framework\Exception\ LocalizedException
84
77
*/
85
- public function isReadonly (int $ customerId ): bool ;
78
+ public function isReadonly ($ customerId );
86
79
87
80
/**
88
81
* Activate a customer account using a key that was sent in a confirmation email.
89
82
*
90
83
* @param string $email
91
84
* @param string $confirmationKey
92
- * @return CustomerInterface
93
- * @throws LocalizedException
85
+ * @return \Magento\Customer\Api\Data\ CustomerInterface
86
+ * @throws \Magento\Framework\Exception\ LocalizedException
94
87
*/
95
- public function activate (string $ email , string $ confirmationKey ): CustomerInterface ;
88
+ public function activate ($ email , $ confirmationKey );
96
89
97
90
/**
98
91
* Activate a customer account using a key that was sent in a confirmation email.
99
92
*
100
93
* @param int $customerId
101
94
* @param string $confirmationKey
102
- * @return CustomerInterface
103
- * @throws LocalizedException
95
+ * @return \Magento\Customer\Api\Data\ CustomerInterface
96
+ * @throws \Magento\Framework\Exception\ LocalizedException
104
97
*/
105
- public function activateById (int $ customerId , string $ confirmationKey ): CustomerInterface ;
98
+ public function activateById ($ customerId , $ confirmationKey );
106
99
107
100
/**
108
101
* Authenticate a customer by username and password
109
102
*
110
103
* @param string $email
111
104
* @param string $password
112
- * @return CustomerInterface
113
- * @throws LocalizedException
105
+ * @return \Magento\Customer\Api\Data\ CustomerInterface
106
+ * @throws \Magento\Framework\Exception\ LocalizedException
114
107
*/
115
- public function authenticate (string $ email , string $ password ): CustomerInterface ;
108
+ public function authenticate ($ email , $ password );
116
109
117
110
/**
118
111
* Change customer password.
@@ -121,9 +114,9 @@ public function authenticate(string $email, string $password): CustomerInterface
121
114
* @param string $currentPassword
122
115
* @param string $newPassword
123
116
* @return bool true on success
124
- * @throws LocalizedException
117
+ * @throws \Magento\Framework\Exception\ LocalizedException
125
118
*/
126
- public function changePassword (string $ email , string $ currentPassword , string $ newPassword ): bool ;
119
+ public function changePassword ($ email , $ currentPassword , $ newPassword );
127
120
128
121
/**
129
122
* Change customer password.
@@ -132,20 +125,20 @@ public function changePassword(string $email, string $currentPassword, string $n
132
125
* @param string $currentPassword
133
126
* @param string $newPassword
134
127
* @return bool true on success
135
- * @throws LocalizedException
128
+ * @throws \Magento\Framework\Exception\ LocalizedException
136
129
*/
137
- public function changePasswordById (int $ customerId , string $ currentPassword , string $ newPassword ): bool ;
130
+ public function changePasswordById ($ customerId , $ currentPassword , $ newPassword );
138
131
139
132
/**
140
133
* Send an email to the customer with a password reset link.
141
134
*
142
135
* @param string $email
143
136
* @param string $template
144
- * @param int|null $websiteId
137
+ * @param int $websiteId
145
138
* @return bool true on success
146
- * @throws LocalizedException
139
+ * @throws \Magento\Framework\Exception\ LocalizedException
147
140
*/
148
- public function initiatePasswordReset (string $ email , string $ template , int $ websiteId = null ): bool ;
141
+ public function initiatePasswordReset ($ email , $ template , $ websiteId = null );
149
142
150
143
/**
151
144
* Reset customer password.
@@ -156,10 +149,10 @@ public function initiatePasswordReset(string $email, string $template, int $webs
156
149
* @param string $newPassword
157
150
*
158
151
* @return bool true on success
159
- * @throws LocalizedException
152
+ * @throws \Magento\Framework\Exception\ LocalizedException
160
153
* @throws InputException
161
154
*/
162
- public function resetPassword (string $ email , string $ resetToken , string $ newPassword ): bool ;
155
+ public function resetPassword ($ email , $ resetToken , $ newPassword );
163
156
164
157
/**
165
158
* Check if password reset token is valid.
@@ -169,22 +162,22 @@ public function resetPassword(string $email, string $resetToken, string $newPass
169
162
* @param string $resetPasswordLinkToken
170
163
*
171
164
* @return bool True if the token is valid
172
- * @throws InputMismatchException If token is mismatched
173
- * @throws ExpiredException If token is expired
174
- * @throws InputException If token or customer id is invalid
175
- * @throws NoSuchEntityException If customer doesn't exist
176
- * @throws LocalizedException
165
+ * @throws \Magento\Framework\Exception\State\ InputMismatchException If token is mismatched
166
+ * @throws \Magento\Framework\Exception\State\ ExpiredException If token is expired
167
+ * @throws \Magento\Framework\Exception\ InputException If token or customer id is invalid
168
+ * @throws \Magento\Framework\Exception\ NoSuchEntityException If customer doesn't exist
169
+ * @throws \Magento\Framework\Exception\ LocalizedException
177
170
*/
178
- public function validateResetPasswordLinkToken (int $ customerId , string $ resetPasswordLinkToken ): bool ;
171
+ public function validateResetPasswordLinkToken ($ customerId , $ resetPasswordLinkToken );
179
172
180
173
/**
181
174
* Gets the account confirmation status.
182
175
*
183
176
* @param int $customerId
184
177
* @return string
185
- * @throws LocalizedException
178
+ * @throws \Magento\Framework\Exception\ LocalizedException
186
179
*/
187
- public function getConfirmationStatus (int $ customerId ): string ;
180
+ public function getConfirmationStatus ($ customerId );
188
181
189
182
/**
190
183
* Resend confirmation email.
@@ -193,55 +186,55 @@ public function getConfirmationStatus(int $customerId): string;
193
186
* @param int $websiteId
194
187
* @param string $redirectUrl
195
188
* @return bool true on success
196
- * @throws LocalizedException
189
+ * @throws \Magento\Framework\Exception\ LocalizedException
197
190
*/
198
- public function resendConfirmation (string $ email , int $ websiteId , string $ redirectUrl = '' ): bool ;
191
+ public function resendConfirmation ($ email , $ websiteId , $ redirectUrl = '' );
199
192
200
193
/**
201
194
* Check if given email is associated with a customer account in given website.
202
195
*
203
196
* @param string $customerEmail
204
- * @param int|null $websiteId If not set, will use the current websiteId
197
+ * @param int $websiteId If not set, will use the current websiteId
205
198
* @return bool
206
- * @throws LocalizedException
199
+ * @throws \Magento\Framework\Exception\ LocalizedException
207
200
*/
208
- public function isEmailAvailable (string $ customerEmail , int $ websiteId = null ): bool ;
201
+ public function isEmailAvailable ($ customerEmail , $ websiteId = null );
209
202
210
203
/**
211
204
* Check store availability for customer given the customerId.
212
205
*
213
206
* @param int $customerWebsiteId
214
207
* @param int $storeId
215
208
* @return bool
216
- * @throws LocalizedException
209
+ * @throws \Magento\Framework\Exception\ LocalizedException
217
210
*/
218
- public function isCustomerInStore (int $ customerWebsiteId , int $ storeId ): bool ;
211
+ public function isCustomerInStore ($ customerWebsiteId , $ storeId );
219
212
220
213
/**
221
214
* Retrieve default billing address for the given customerId.
222
215
*
223
216
* @param int $customerId
224
- * @return AddressInterface
225
- * @throws NoSuchEntityException If the customer Id is invalid
226
- * @throws LocalizedException
217
+ * @return \Magento\Customer\Api\Data\ AddressInterface
218
+ * @throws \Magento\Framework\Exception\ NoSuchEntityException If the customer Id is invalid
219
+ * @throws \Magento\Framework\Exception\ LocalizedException
227
220
*/
228
- public function getDefaultBillingAddress (int $ customerId ): Data \ AddressInterface ;
221
+ public function getDefaultBillingAddress ($ customerId );
229
222
230
223
/**
231
224
* Retrieve default shipping address for the given customerId.
232
225
*
233
226
* @param int $customerId
234
- * @return AddressInterface
235
- * @throws NoSuchEntityException If the customer Id is invalid
236
- * @throws LocalizedException
227
+ * @return \Magento\Customer\Api\Data\ AddressInterface
228
+ * @throws \Magento\Framework\Exception\ NoSuchEntityException If the customer Id is invalid
229
+ * @throws \Magento\Framework\Exception\ LocalizedException
237
230
*/
238
- public function getDefaultShippingAddress (int $ customerId ): AddressInterface ;
231
+ public function getDefaultShippingAddress ($ customerId );
239
232
240
233
/**
241
234
* Return hashed password, which can be directly saved to database.
242
235
*
243
236
* @param string $password
244
237
* @return string
245
238
*/
246
- public function getPasswordHash (string $ password ): string ;
239
+ public function getPasswordHash ($ password );
247
240
}
0 commit comments