Skip to content

Commit

Permalink
Merge pull request #180 from magento-troll/sprint15
Browse files Browse the repository at this point in the history
EPAM Sprint15
  • Loading branch information
balex13 authored Jul 26, 2016
2 parents 8add899 + 45e4724 commit 17726ef
Show file tree
Hide file tree
Showing 13 changed files with 36 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,10 @@ protected function placeCheckoutOrder()
$result->setData('error_messages', $exception->getMessage());
} catch (\Exception $exception) {
$result->setData('error', true);
$result->setData('error_messages', __('Unable to place order. Please try again later.'));
$result->setData(
'error_messages',
__('An error occurred on the server. Please try to place the order again.')
);
}
if ($response instanceof Http) {
$response->representJson($this->jsonHelper->jsonEncode($result));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,10 @@ public function textExecuteFailedPlaceOrderDataProvider()
{
$objectFailed = new \Magento\Framework\DataObject();
$objectFailed->setData('error', true);
$objectFailed->setData('error_messages', __('Unable to place order. Please try again later.'));
$objectFailed->setData(
'error_messages',
__('An error occurred on the server. Please try to place the order again.')
);

return [
[
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Authorizenet/i18n/en_US.csv
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"Order saving error: %1","Order saving error: %1"
"Please choose a payment method.","Please choose a payment method."
"We can\'t process your order right now. Please try again later.","We can\'t process your order right now. Please try again later."
"Unable to place order. Please try again later.","Unable to place order. Please try again later."
"An error occurred on the server. Please try to place the order again.","An error occurred on the server. Please try to place the order again."
"Credit Card: xxxx-%1","Credit Card: xxxx-%1"
"amount %1","amount %1"
failed.,failed.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,10 @@ public function savePaymentInformationAndPlaceOrder(
try {
$orderId = $this->cartManagement->placeOrder($cartId);
} catch (\Exception $e) {
throw new CouldNotSaveException(__('Unable to place order. Please try again later.'), $e);
throw new CouldNotSaveException(
__('An error occurred on the server. Please try to place the order again.'),
$e
);
}
return $orderId;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,10 @@ public function savePaymentInformationAndPlaceOrder(
try {
$orderId = $this->cartManagement->placeOrder($cartId);
} catch (\Exception $e) {
throw new CouldNotSaveException(__('Unable to place order. Please try again later.'), $e);
throw new CouldNotSaveException(
__('An error occurred on the server. Please try to place the order again.'),
$e
);
}
return $orderId;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public function testSavePaymentInformationAndPlaceOrder()
}

/**
* @expectedExceptionMessage Unable to place order. Please try again later.
* @expectedExceptionMessage An error occurred on the server. Please try to place the order again.
* @expectedException \Magento\Framework\Exception\CouldNotSaveException
*/
public function testSavePaymentInformationAndPlaceOrderException()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function testSavePaymentInformationAndPlaceOrder()
}

/**
* @expectedExceptionMessage Unable to place order. Please try again later.
* @expectedExceptionMessage An error occurred on the server. Please try to place the order again.
* @expectedException \Magento\Framework\Exception\CouldNotSaveException
*/
public function testSavePaymentInformationAndPlaceOrderException()
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Checkout/i18n/en_US.csv
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Checkout,Checkout
"This quote item does not exist.","This quote item does not exist."
"Display number of items in cart","Display number of items in cart"
"Display item quantities","Display item quantities"
"Unable to place order. Please try again later.","Unable to place order. Please try again later."
"An error occurred on the server. Please try to place the order again.","An error occurred on the server. Please try to place the order again."
"Shipping address is not set","Shipping address is not set"
"Unable to save address. Please check input data.","Unable to save address. Please check input data."
"Carrier with such method not found: %1, %2","Carrier with such method not found: %1, %2"
Expand Down
5 changes: 5 additions & 0 deletions app/code/Magento/Customer/Controller/Account/LoginPost.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use Magento\Framework\Exception\EmailNotConfirmedException;
use Magento\Framework\Exception\AuthenticationException;
use Magento\Framework\Data\Form\FormKey\Validator;
use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\Exception\State\UserLockedException;
use Magento\Framework\App\Config\ScopeConfigInterface;

Expand Down Expand Up @@ -179,6 +180,10 @@ public function execute()
$message = __('Invalid login or password.');
$this->messageManager->addError($message);
$this->session->setUsername($login['username']);
} catch (LocalizedException $e) {
$message = $e->getMessage();
$this->messageManager->addError($message);
$this->session->setUsername($login['username']);
} catch (\Exception $e) {
// PA DSS violation: throwing or logging an exception here can disclose customer password
$this->messageManager->addError(
Expand Down
6 changes: 6 additions & 0 deletions app/code/Magento/Customer/Controller/Ajax/Login.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Magento\Framework\App\ObjectManager;
use Magento\Customer\Model\Account\Redirect as AccountRedirect;
use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Framework\Exception\LocalizedException;

/**
* Login controller
Expand Down Expand Up @@ -182,6 +183,11 @@ public function execute()
'errors' => true,
'message' => $e->getMessage()
];
} catch (LocalizedException $e) {
$response = [
'errors' => true,
'message' => $e->getMessage()
];
} catch (\Exception $e) {
$response = [
'errors' => true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ $params = $block->getParams();
var parent = window.top;
$(parent).trigger('clearTimeout');
globalMessageList.addErrorMessage({
message: $t('Unable to place order. Please try again later.')
message: $t('An error occurred on the server. Please try to place the order again.')
});
}
);
Expand Down
4 changes: 3 additions & 1 deletion app/code/Magento/Quote/Model/QuoteManagement.php
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,9 @@ public function placeOrder($cartId, PaymentInterface $paymentMethod = null)
$order = $this->submit($quote);

if (null == $order) {
throw new LocalizedException(__('Unable to place order. Please try again later.'));
throw new LocalizedException(
__('An error occurred on the server. Please try to place the order again.')
);
}

$this->checkoutSession->setLastQuoteId($quote->getId());
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Quote/i18n/en_US.csv
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Subtotal,Subtotal
"Cannot assign customer to the given cart. The cart belongs to different store.","Cannot assign customer to the given cart. The cart belongs to different store."
"Cannot assign customer to the given cart. The cart is not anonymous.","Cannot assign customer to the given cart. The cart is not anonymous."
"Cannot assign customer to the given cart. Customer already has active cart.","Cannot assign customer to the given cart. Customer already has active cart."
"Unable to place order. Please try again later.","Unable to place order. Please try again later."
"An error occurred on the server. Please try to place the order again.","An error occurred on the server. Please try to place the order again."
"This item price or quantity is not valid for checkout.","This item price or quantity is not valid for checkout."
"Please check the shipping address information. %1","Please check the shipping address information. %1"
"Please specify a shipping method.","Please specify a shipping method."
Expand Down

0 comments on commit 17726ef

Please sign in to comment.