Closed forwells closed 6 years ago
@forwells What does your email look like?
Magento uses default php function 'filter_var' to validate email. Maybe you can test your used email with this snippet:
$c = 'YOUR_EMAIL';
$sanitized_c = filter_var($c, FILTER_SANITIZE_EMAIL);
if (filter_var($sanitized_c, FILTER_VALIDATE_EMAIL)) {
echo "Before: $c\n";
echo "After: $sanitized_c\n";
}
Which PHP version do you use?
@kkrieger85 Thanks, This happens in a payment extension. When I click on the place order button as a visitor, the personal information I include in the payment form, including address information, is not stored in the quote table. I'm not sure what caused this.
@DanielRuf I use PHP 7.0.28
Can you test the code snippet against the problematic email address on 3v4l.org?
@DanielRuf This problem is not an issue with the format of the e-mail. Instead, when the place order button is clicked, the quote table cannot save the e-mail address that the visitor fills in the first step of the shopping cart with the click. . .
@forwells Can you please update the Steps to reproduce section? Please describe in detail how someone can reproduce your issue. I tested with your current steps and can not reproduce this issue.
@kkrieger85 This is where the problem occurs, when I place order , the cart tip me the format of email is wrong, and I check it in process, the email is blank in quote table , so, when I click next button in step 1, the process is not memory the guest or customer email in quote table , I can't find the place where the email can be memory...
so, I add a custom field to the step 1 t :(guest/customer infomation list), yes, it's checkout_buyer_email,so it can be memory in quote table replace the customer_email field...
@forwells It's still unclear, what kind of email does not pass validation and how to reproduce this with a clean installation. Please attempt to update the steps in such a way that anyone can reproduce the problem.
Thank you
we have a very similar problem, however our steps are different:
Magento 2.19
Steps to reproduce:
Expected result: Order to be successfully placed and Thank you page to load
Actual Result: Error :We cannot save the address. Email has wrong format . (Please see screenshot :http://prntscr.com/k5p8tj)
After reviewing logs, we determined that the email address was not sent to the payment gateway along with the rest of the billing info, so Our payment gateway (Braintree) response back to M2 for e-mail address is "NULL"
This issue occurs for us only for 1 or 2 customers a day while hundreds of other Logged in customers do not have this issue at all
Hi.
We are having a similar problem as well, "Email has a wrong Format".
We set up a watch in the code to return what value was been sent to SagePay payment gateway.
Server logs was telling us Email Address value was returning NULL.
Looking in the database we discovered table 'sales_order_address' email address column had NULL references for some customers details who entered different shipping address to billing address. This behavior was odd as not all customers who had completely different shipping information to billing information, had NULL in shipping email address column.
This is as far as we have got so far, but if any one more information on this issue, then let us know.
Site is built on Magento 2.17
I am experiencing the same problem on Magento 2.2.5, using the same steps as ilievski. The problem only happens when you sign in AFTER adding the product to the cart.
@AndyJAllen @Aaron-Lewis @ilievski @forwells We cannot reproduce this issue. Can anyone reproduce it on the clean Magento 2 installation and provide updated steps?
I got the same issue while trying to place an order using REST API. I tried in Magento 2.2.5. Any updates on this issue?
@deepakkn85, please provide steps to reproduce.
I ended up figuring this out. You have to go into the database and fix an e-mail field that is not set for a pending order from the past. Apparently this happens during one of the upgrades in 2.2, but after you set the email field it works moving forward. The problem should not happen to new accounts, but just accounts that already existed prior to the upgrade of M2.
@engcom-backlog-pb : Please see the attached screenshots of parameters used to create order and final request to create order. Please let me know if I am missing anything here, which caused the issue.
The response on I am getting is attached below.
Thanks in advance!
@deepakkn85, thank you for the update. We were not able to reproduce this issue by following the steps you provided.
@engcom-backlog-pb : Then what could be the possible reason for the response which I am getting? I have shared the screenshot of the same in my previous thread.
we have a very similar problem, however our steps are different:
Magento 2.19
Steps to reproduce:
- Add to cart
- Proceed to checkout
- Log in
- Select Shipping
- Press Place order button
Expected result: Order to be successfully placed and Thank you page to load
Actual Result: Error :We cannot save the address. Email has wrong format . (Please see screenshot :http://prntscr.com/k5p8tj)
After reviewing logs, we determined that the email address was not sent to the payment gateway along with the rest of the billing info, so Our payment gateway (Braintree) response back to M2 for e-mail address is "NULL"
This issue occurs for us only for 1 or 2 customers a day while hundreds of other Logged in customers do not have this issue at all
We have the exact same issue. Have you managed to resolve this? Thanks
We experienced the same problem today during our test. This is the first time we see the error after about 100 test purchases.
We run on Magento 2.2.6 and use the procedure
As indicated above, the problem seems to be in the cart. We could bypass the problem by emptying the cart and add the product again.
We started using Magento on this version, so the cart has not been processed by an upgrade.
Is this issue related to this Magento_Sales module fails to upgrade (email has a wrong format) #14964
If so would this fix the issue?
update sales_order_address a left join sales_order_address b on a.parent_id = b.parent_id set a.email = b.email where a.email is null
@ilievski Would it be possible if anyone could reply, as we really need to know if anyone has fixed this?
@AndyJAllen Are you able to explain more detail of how you fixed this?
HI @zestbeauty ... we didn't managed to find general solution for the problem, but we did found the cause and temporarily solved it. Basically the problem was with the customer session data, where in some cases the information for email, or even billing or shipping address was getting overwritten or deleted when customer login on checkout. We never figured out why this was happening, however a temporary solution was to always delete customer session when they are using login on checkout. Basically emptying their cart if they decide to login on checkout. Not a perfect solution but solved Our Problem.
Hi @ilievski - you mentioned;
After reviewing logs, we determined that the email address was not sent to the payment gateway along with the rest of the billing info, so Our payment gateway (Braintree) response back to M2 for e-mail address is "NULL"
Are you able to share any of those logs or the process by which you came to identify that it was the payment method at fault here?
Thanks,
We are still suffering from this issue. It appears that it only happens on customer accounts that login and that where created in M1 and migrated from M1 to M2
We are still suffering from this issue. It appears that it only happens on customer accounts that login and that where created in M1 and migrated from M1 to M2
In my case it was because I migrated from 2.1.x to 2.2.x... I deleted the account, recreated it, and the problem went away. I also noticed while the problem existed, it created an authorization through Paypal Payflow Pro for each failure.
Here will explain why this problem occurs and how to deal with it.
Generally, such abnormal problems do not occur during the native Magento2.x checkout process.General problems occur when custom products are added to the shopping cart, and then the shopping cart (Quote) data is processed and generated programmatically Orders, unfortunately, in such a complicated construction of Magento2 (especially in the core part of the shopping cart, although everything seems more complicated, especially the construction of complex modules, such as operational data processing), sorry, it's a long way off.
The following explains how to deal with this problem.
Since our premise is to customize the quote, then the solution is explained in a custom way:
1, add products to cart
> In quote_address we can see the email, name, etc. of customer
> If it is a custom process, the operation we have done is one-sided, not a complete process, which is the root cause of the problem.
2, wrong email address comes from
\vendor\magento\module-quote\Model\QuoteManagement.php
method: submitQuote
$shippingAddress = $this->quoteAddressToOrderAddress->convert( $quote->getShippingAddress(), [ 'address_type' => 'shipping', 'email' => $quote->getCustomerEmail() ] );
$quote->getCustomerEmail() => NULL
so, we should check the customer_email in quote table is it a NULL type value?
And provide a right value for it , and program will go on
What was the solution of it? Please tell me. Suddenly I am also facing the same issue, in Magento 2.3.2. I checked in this \vendor\magento\module-quote\Model\QuoteManagement.php customer data is appearing empty.
@Arsalanulhaq check the previous comments.
Also please open a new issue and provide all details so we can reproduce it on a vanilla Magento 2 instance.
The previous comments doesn't seem to provide the solution. I'll create a new issue also.
This is still reproducible in Magento 2.3.3, I can able to reproduce while using API, Create quote for customer for default store, Add to cart for default store
Use V1/carts/mine/ with other store because we've scenario where after adding product to cart from english customer switched store and viewing cart in arabic store.
This API returns product names in english even though passing store code in API.
To resolve this I used "PUT" request with V1/carts/mine and payload is like,
{ "quote": { "id": 8475, "store_id": 2, "customer": { "id": 158 } } }
This thing work but after this doesn't allow me to place an order. Keep getting " "message": "Failed address validation: Email has a wrong format","
This PUT request removed email address from quote table. and due to that this error coming up.
"trace": "#0 /var/www/html/magento/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Checkout\Model\PaymentInformationManagement->savePaymentInformationAndPlaceOrder(8477, Object(Magento\Quote\Model\Quote\Payment\Interceptor), Object(Magento\Quote\Model\Quote\Address)) #1 /var/www/html/magento/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Checkout\Model\PaymentInformationManagement\Interceptor->___callParent('savePaymentInfo...', Array) #2 /var/www/html/magento/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Checkout\Model\PaymentInformationManagement\Interceptor->Magento\Framework\Interception\{closure}(8477, Object(Magento\Quote\Model\Quote\Payment\Interceptor), Object(Magento\Quote\Model\Quote\Address)) #3 /var/www/html/magento/generated/code/Magento/Checkout/Model/PaymentInformationManagement/Interceptor.php(26): Magento\Checkout\Model\PaymentInformationManagement\Interceptor->___callPlugins('savePaymentInfo...', Array, Array) #4 [internal function]: Magento\Checkout\Model\PaymentInformationManagement\Interceptor->savePaymentInformationAndPlaceOrder(8477, Object(Magento\Quote\Model\Quote\Payment\Interceptor), Object(Magento\Quote\Model\Quote\Address)) #5 /var/www/html/magento/vendor/magento/module-webapi/Controller/Rest/SynchronousRequestProcessor.php(95): call_user_func_array(Array, Array) #6 /var/www/html/magento/vendor/magento/module-webapi/Controller/Rest.php(188): Magento\Webapi\Controller\Rest\SynchronousRequestProcessor->process(Object(Magento\Framework\Webapi\Rest\Request\Proxy)) #7 /var/www/html/magento/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Webapi\Controller\Rest->dispatch(Object(Magento\Framework\App\Request\Http)) #8 /var/www/html/magento/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Webapi\Controller\Rest\Interceptor->___callParent('dispatch', Array) #9 /var/www/html/magento/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Webapi\Controller\Rest\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http)) #10 /var/www/html/magento/generated/code/Magento/Webapi/Controller/Rest/Interceptor.php(26): Magento\Webapi\Controller\Rest\Interceptor->___callPlugins('dispatch', Array, Array) #11 /var/www/html/magento/vendor/magento/framework/App/Http.php(137): Magento\Webapi\Controller\Rest\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http)) #12 /var/www/html/magento/generated/code/Magento/Framework/App/Http/Interceptor.php(24): Magento\Framework\App\Http->launch() #13 /var/www/html/magento/vendor/magento/framework/App/Bootstrap.php(261): Magento\Framework\App\Http\Interceptor->launch() #14 /var/www/html/magento/index.php(39): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http\Interceptor)) #15 {main}" }
FINDINGS
Error message comes from Magento\Quote\Model\SubmitQuoteValidator::validateOrder but at validator method Magento\Sales\Model\Order\Address\Validator::validate Address object returns null for email.
Array
(
[vat_id] =>
[vat_is_valid] =>
[vat_request_id] =>
[vat_request_date] =>
[vat_request_success] =>
[customer_address_id] =>
[prefix] =>
[firstname] => Zero
[middlename] =>
[lastname] => Cool
[suffix] =>
[company] =>
[street] => Wall Street
[city] => Riyadh
[region] => Madina
[region_id] =>
[postcode] => 12345
[country_id] => SA
[telephone] => 1234567890
[fax] =>
[email] =>
[address_type] => shipping
[quote_address_id] => 17701
[parent_id] =>
)
Afte this I went to DB and checked quote table where email is null my quote ID but I remember that I post email within payload.
Adding email to quote will solve the problem but this is kinda weird that update quote from one store to other creates this problem. There's total 2 issue I would like to address here, Why get cart not returning then store specific data ? Why updating quote is creating this error ?
@DanielRuf @magento-engcom-team
The previous comments doesn't seem to provide the solution. I'll create a new issue also.
What is the issue number?
The previous comments doesn't seem to provide the solution. I'll create a new issue also.
What is the issue number?
I just want to chime in here with my two cents - I was getting the same problems, but it was related to not specifying that I was using a guest to checkout:
$quote->setCustomerFirstname("Guest First Name");
$quote->setCustomerLastname("Guest Last Name");
$quote->setCustomerEmail("guest@123.com");
$quote->setCustomerIsGuest(true);
// Set billing and shipping addresses
$quote->getBillingAddress()->addData($orderData['shipping_address']);
$quote->getShippingAddress()->addData($orderData['shipping_address']);
Maybe this helps someone :)
The previous comments doesn't seem to provide the solution. I'll create a new issue also.
What is the issue number?
I just want to chime in here with my two cents - I was getting the same problems, but it was related to not specifying that I was using a guest to checkout:
$quote->setCustomerFirstname("Guest First Name"); $quote->setCustomerLastname("Guest Last Name"); $quote->setCustomerEmail("guest@123.com"); $quote->setCustomerIsGuest(true); // Set billing and shipping addresses $quote->getBillingAddress()->addData($orderData['shipping_address']); $quote->getShippingAddress()->addData($orderData['shipping_address']);
Maybe this helps someone :)
This was helpful. Thanks
Preconditions
Steps to reproduce
Expected result
Actual result
20200326~
I don't remember the specific solution process about the last issue, but today, I encountered this problem again in Magento 2.3.3. Next, I will solve this problem anyway, and update the effective solution of this problem Program