Skip to content

Commit 275783d

Browse files
AC-6695: Guest Checkout Fix
1 parent 58a0fa1 commit 275783d

File tree

3 files changed

+296
-172
lines changed

3 files changed

+296
-172
lines changed

app/code/Magento/Checkout/etc/adminhtml/system.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
<resource>Magento_Checkout::checkout</resource>
1414
<group id="options" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
1515
<label>Checkout Options</label>
16+
<field id="disable_guest_checkout_login" translate="label" type="select" sortOrder="4" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
17+
<label>Disable Guest Checkout Login</label>
18+
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
19+
</field>
1620
<field id="onepage_checkout_enabled" translate="label" type="select" sortOrder="5" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
1721
<label>Enable Onepage Checkout</label>
1822
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>

app/code/Magento/Customer/Api/AccountManagementInterface.php

Lines changed: 69 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,14 @@
77

88
namespace Magento\Customer\Api;
99

10+
use Magento\Customer\Api\Data\AddressInterface;
11+
use Magento\Customer\Api\Data\CustomerInterface;
12+
use Magento\Customer\Api\Data\ValidationResultsInterface;
1013
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;
1118

1219
/**
1320
* Interface for managing customers accounts.
@@ -28,11 +35,11 @@ interface AccountManagementInterface
2835
/**
2936
* Create customer account. Perform necessary business operations like sending email.
3037
*
31-
* @param \Magento\Customer\Api\Data\CustomerInterface $customer
32-
* @param string $password
38+
* @param CustomerInterface $customer
39+
* @param string|null $password
3340
* @param string $redirectUrl
34-
* @return \Magento\Customer\Api\Data\CustomerInterface
35-
* @throws \Magento\Framework\Exception\LocalizedException
41+
* @return CustomerInterface
42+
* @throws LocalizedException
3643
*/
3744
public function createAccount(
3845
\Magento\Customer\Api\Data\CustomerInterface $customer,
@@ -43,69 +50,69 @@ public function createAccount(
4350
/**
4451
* Create customer account using provided hashed password. Should not be exposed as a webapi.
4552
*
46-
* @param \Magento\Customer\Api\Data\CustomerInterface $customer
53+
* @param CustomerInterface $customer
4754
* @param string $hash Password hash that we can save directly
4855
* @param string $redirectUrl URL fed to welcome email templates. Can be used by templates to, for example, direct
4956
* the customer to a product they were looking at after pressing confirmation link.
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
57+
* @return CustomerInterface
58+
* @throws InputException If bad input is provided
59+
* @throws InputMismatchException If the provided email is already used
60+
* @throws LocalizedException
5461
*/
5562
public function createAccountWithPasswordHash(
56-
\Magento\Customer\Api\Data\CustomerInterface $customer,
57-
$hash,
58-
$redirectUrl = ''
59-
);
63+
CustomerInterface $customer,
64+
string $hash,
65+
string $redirectUrl = ''
66+
): CustomerInterface;
6067

6168
/**
6269
* Validate customer data.
6370
*
64-
* @param \Magento\Customer\Api\Data\CustomerInterface $customer
65-
* @return \Magento\Customer\Api\Data\ValidationResultsInterface
66-
* @throws \Magento\Framework\Exception\LocalizedException
71+
* @param CustomerInterface $customer
72+
* @return ValidationResultsInterface
73+
* @throws LocalizedException
6774
*/
68-
public function validate(\Magento\Customer\Api\Data\CustomerInterface $customer);
75+
public function validate(CustomerInterface $customer): ValidationResultsInterface;
6976

7077
/**
7178
* Check if customer can be deleted.
7279
*
7380
* @param int $customerId
7481
* @return bool
75-
* @throws \Magento\Framework\Exception\NoSuchEntityException If group is not found
76-
* @throws \Magento\Framework\Exception\LocalizedException
82+
* @throws NoSuchEntityException If group is not found
83+
* @throws LocalizedException
7784
*/
78-
public function isReadonly($customerId);
85+
public function isReadonly(int $customerId): bool;
7986

8087
/**
8188
* Activate a customer account using a key that was sent in a confirmation email.
8289
*
8390
* @param string $email
8491
* @param string $confirmationKey
85-
* @return \Magento\Customer\Api\Data\CustomerInterface
86-
* @throws \Magento\Framework\Exception\LocalizedException
92+
* @return CustomerInterface
93+
* @throws LocalizedException
8794
*/
88-
public function activate($email, $confirmationKey);
95+
public function activate(string $email, string $confirmationKey): CustomerInterface;
8996

9097
/**
9198
* Activate a customer account using a key that was sent in a confirmation email.
9299
*
93100
* @param int $customerId
94101
* @param string $confirmationKey
95-
* @return \Magento\Customer\Api\Data\CustomerInterface
96-
* @throws \Magento\Framework\Exception\LocalizedException
102+
* @return CustomerInterface
103+
* @throws LocalizedException
97104
*/
98-
public function activateById($customerId, $confirmationKey);
105+
public function activateById(int $customerId, string $confirmationKey): CustomerInterface;
99106

100107
/**
101108
* Authenticate a customer by username and password
102109
*
103110
* @param string $email
104111
* @param string $password
105-
* @return \Magento\Customer\Api\Data\CustomerInterface
106-
* @throws \Magento\Framework\Exception\LocalizedException
112+
* @return CustomerInterface
113+
* @throws LocalizedException
107114
*/
108-
public function authenticate($email, $password);
115+
public function authenticate(string $email, string $password): CustomerInterface;
109116

110117
/**
111118
* Change customer password.
@@ -114,9 +121,9 @@ public function authenticate($email, $password);
114121
* @param string $currentPassword
115122
* @param string $newPassword
116123
* @return bool true on success
117-
* @throws \Magento\Framework\Exception\LocalizedException
124+
* @throws LocalizedException
118125
*/
119-
public function changePassword($email, $currentPassword, $newPassword);
126+
public function changePassword(string $email, string $currentPassword, string $newPassword): bool;
120127

121128
/**
122129
* Change customer password.
@@ -125,20 +132,20 @@ public function changePassword($email, $currentPassword, $newPassword);
125132
* @param string $currentPassword
126133
* @param string $newPassword
127134
* @return bool true on success
128-
* @throws \Magento\Framework\Exception\LocalizedException
135+
* @throws LocalizedException
129136
*/
130-
public function changePasswordById($customerId, $currentPassword, $newPassword);
137+
public function changePasswordById(int $customerId, string $currentPassword, string $newPassword): bool;
131138

132139
/**
133140
* Send an email to the customer with a password reset link.
134141
*
135142
* @param string $email
136143
* @param string $template
137-
* @param int $websiteId
144+
* @param int|null $websiteId
138145
* @return bool true on success
139-
* @throws \Magento\Framework\Exception\LocalizedException
146+
* @throws LocalizedException
140147
*/
141-
public function initiatePasswordReset($email, $template, $websiteId = null);
148+
public function initiatePasswordReset(string $email, string $template, int $websiteId = null): bool;
142149

143150
/**
144151
* Reset customer password.
@@ -149,10 +156,10 @@ public function initiatePasswordReset($email, $template, $websiteId = null);
149156
* @param string $newPassword
150157
*
151158
* @return bool true on success
152-
* @throws \Magento\Framework\Exception\LocalizedException
159+
* @throws LocalizedException
153160
* @throws InputException
154161
*/
155-
public function resetPassword($email, $resetToken, $newPassword);
162+
public function resetPassword(string $email, string $resetToken, string $newPassword): bool;
156163

157164
/**
158165
* Check if password reset token is valid.
@@ -162,22 +169,22 @@ public function resetPassword($email, $resetToken, $newPassword);
162169
* @param string $resetPasswordLinkToken
163170
*
164171
* @return bool True if the token is valid
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
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
170177
*/
171-
public function validateResetPasswordLinkToken($customerId, $resetPasswordLinkToken);
178+
public function validateResetPasswordLinkToken(int $customerId, string $resetPasswordLinkToken): bool;
172179

173180
/**
174181
* Gets the account confirmation status.
175182
*
176183
* @param int $customerId
177184
* @return string
178-
* @throws \Magento\Framework\Exception\LocalizedException
185+
* @throws LocalizedException
179186
*/
180-
public function getConfirmationStatus($customerId);
187+
public function getConfirmationStatus(int $customerId): string;
181188

182189
/**
183190
* Resend confirmation email.
@@ -186,55 +193,55 @@ public function getConfirmationStatus($customerId);
186193
* @param int $websiteId
187194
* @param string $redirectUrl
188195
* @return bool true on success
189-
* @throws \Magento\Framework\Exception\LocalizedException
196+
* @throws LocalizedException
190197
*/
191-
public function resendConfirmation($email, $websiteId, $redirectUrl = '');
198+
public function resendConfirmation(string $email, int $websiteId, string $redirectUrl = ''): bool;
192199

193200
/**
194201
* Check if given email is associated with a customer account in given website.
195202
*
196203
* @param string $customerEmail
197-
* @param int $websiteId If not set, will use the current websiteId
204+
* @param int|null $websiteId If not set, will use the current websiteId
198205
* @return bool
199-
* @throws \Magento\Framework\Exception\LocalizedException
206+
* @throws LocalizedException
200207
*/
201-
public function isEmailAvailable($customerEmail, $websiteId = null);
208+
public function isEmailAvailable(string $customerEmail, int $websiteId = null): bool;
202209

203210
/**
204211
* Check store availability for customer given the customerId.
205212
*
206213
* @param int $customerWebsiteId
207214
* @param int $storeId
208215
* @return bool
209-
* @throws \Magento\Framework\Exception\LocalizedException
216+
* @throws LocalizedException
210217
*/
211-
public function isCustomerInStore($customerWebsiteId, $storeId);
218+
public function isCustomerInStore(int $customerWebsiteId, int $storeId): bool;
212219

213220
/**
214221
* Retrieve default billing address for the given customerId.
215222
*
216223
* @param int $customerId
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
224+
* @return AddressInterface
225+
* @throws NoSuchEntityException If the customer Id is invalid
226+
* @throws LocalizedException
220227
*/
221-
public function getDefaultBillingAddress($customerId);
228+
public function getDefaultBillingAddress(int $customerId): Data\AddressInterface;
222229

223230
/**
224231
* Retrieve default shipping address for the given customerId.
225232
*
226233
* @param int $customerId
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
234+
* @return AddressInterface
235+
* @throws NoSuchEntityException If the customer Id is invalid
236+
* @throws LocalizedException
230237
*/
231-
public function getDefaultShippingAddress($customerId);
238+
public function getDefaultShippingAddress(int $customerId): AddressInterface;
232239

233240
/**
234241
* Return hashed password, which can be directly saved to database.
235242
*
236243
* @param string $password
237244
* @return string
238245
*/
239-
public function getPasswordHash($password);
246+
public function getPasswordHash(string $password): string;
240247
}

0 commit comments

Comments
 (0)