Order confirmation email sent before redirecting to third party payment gateway in Magento 2magento 2 order...
Disable the ">" operator in Rstudio linux terminal
If I sold a PS4 game I owned the disc for, can I reinstall it digitally?
Program that converts a number to a letter of the alphabet
Enable Advanced Currency Management using CLI
Difference between two quite-similar Terminal commands
Pre-1980's science fiction short story: alien disguised as a woman shot by a gangster, has tentacles coming out of her breasts when remaking her body
Broken patches on a road
If I delete my router's history can my ISP still provide it to my parents?
Does Improved Divine Strike trigger when a paladin makes an unarmed strike?
Why did this image turn out darker?
Checking for the existence of multiple directories
Why does String.replaceAll() work differently in Java 8 from Java 9?
Using only 1s, make 29 with the minimum number of digits
Showing size of pie chart in legend of QGIS?
Typing Amharic inside a math equation?
Avoiding morning and evening handshakes
What is the in-universe cost of a TIE fighter?
Why zero tolerance on nudity in space?
Should I write a companion book/blog?
Would a National Army of mercenaries be a feasible idea?
Slow moving projectiles from a hand-held weapon - how do they reach the target?
Do authors have to be politically correct in article-writing?
How can animals be objects of ethics without being subjects as well?
What is better: yes / no radio, or simple checkbox?
Order confirmation email sent before redirecting to third party payment gateway in Magento 2
magento 2 order confirmation email sending before payment gatway redirectionCustom Convert Quote to Order - “Cannot retrieve payment method instance”Need help returning to Magento & updating order status after 3rd party payment gatewaySend order information to a third party payment gatewayCan't Access Quote from checkout session after returning from payment GatewayCustom Payment Gateway Return URLHow to post data to a payment provider when placing an order in Magento 2Magento 1.9. - Third party payment gatewaymagento 2 place order programmatically from controllerMagento 2 Payment Redirect Gateway Update OrderDoubt/Query/Clarification Regarding, Custom Payment Gateway Integration
I have created one third party Payment gateway.
It is working fine except, It is sending two order confirmation email. One email I have added in my custom module success controller to send email after validate Transaction Id. But one default email is also triggered by magento after place order.
Below is My Payment module payment.js file:
define(
[
'jquery',
'ko',
'mage/url',
'Magento_Checkout/js/view/payment/default',
'Magento_Checkout/js/model/quote',
'Magento_Customer/js/model/customer'
],
function ($, ko, url, Component, quote, customer) {
'use strict';
return Component.extend({
defaults: {
template: 'Stack_Custompay/payment/custompay-form'
},
redirectAfterPlaceOrder: false,
/** Returns payment method instructions */
getInstructions: function() {
return window.checkoutConfig.payment.instructions[this.item.method];
},
afterPlaceOrder: function () {
$.ajax({
type: 'POST',
url: url.build('custompay/payment/order'),
success: function (response) {
if (response.success) {
var order_id = response.order_id;
var amount = response.amount;
var billing_address = quote.billingAddress();
var name = billing_address.firstname;
var contact = billing_address.telephone;
var email = customer.customerData.email;
var data = {
amount: amount,
email: email,
contact: contact,
order_id:order_id
};
custompay.createPayment(data);
}
},
});
}
});
}
);
I have checked many posts and found there is some option to disable default order email by plugin. but I think it is not the standard approach. I read, there are some changes we need to perform in payment.js file to stop these confirmation email as implemeneted in braintree payment gateway.
how I could achieve this in the right way? Any help would be appreciated. Thanks.
magento2 payment payment-gateway
bumped to the homepage by Community♦ 3 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
I have created one third party Payment gateway.
It is working fine except, It is sending two order confirmation email. One email I have added in my custom module success controller to send email after validate Transaction Id. But one default email is also triggered by magento after place order.
Below is My Payment module payment.js file:
define(
[
'jquery',
'ko',
'mage/url',
'Magento_Checkout/js/view/payment/default',
'Magento_Checkout/js/model/quote',
'Magento_Customer/js/model/customer'
],
function ($, ko, url, Component, quote, customer) {
'use strict';
return Component.extend({
defaults: {
template: 'Stack_Custompay/payment/custompay-form'
},
redirectAfterPlaceOrder: false,
/** Returns payment method instructions */
getInstructions: function() {
return window.checkoutConfig.payment.instructions[this.item.method];
},
afterPlaceOrder: function () {
$.ajax({
type: 'POST',
url: url.build('custompay/payment/order'),
success: function (response) {
if (response.success) {
var order_id = response.order_id;
var amount = response.amount;
var billing_address = quote.billingAddress();
var name = billing_address.firstname;
var contact = billing_address.telephone;
var email = customer.customerData.email;
var data = {
amount: amount,
email: email,
contact: contact,
order_id:order_id
};
custompay.createPayment(data);
}
},
});
}
});
}
);
I have checked many posts and found there is some option to disable default order email by plugin. but I think it is not the standard approach. I read, there are some changes we need to perform in payment.js file to stop these confirmation email as implemeneted in braintree payment gateway.
how I could achieve this in the right way? Any help would be appreciated. Thanks.
magento2 payment payment-gateway
bumped to the homepage by Community♦ 3 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
I have created one third party Payment gateway.
It is working fine except, It is sending two order confirmation email. One email I have added in my custom module success controller to send email after validate Transaction Id. But one default email is also triggered by magento after place order.
Below is My Payment module payment.js file:
define(
[
'jquery',
'ko',
'mage/url',
'Magento_Checkout/js/view/payment/default',
'Magento_Checkout/js/model/quote',
'Magento_Customer/js/model/customer'
],
function ($, ko, url, Component, quote, customer) {
'use strict';
return Component.extend({
defaults: {
template: 'Stack_Custompay/payment/custompay-form'
},
redirectAfterPlaceOrder: false,
/** Returns payment method instructions */
getInstructions: function() {
return window.checkoutConfig.payment.instructions[this.item.method];
},
afterPlaceOrder: function () {
$.ajax({
type: 'POST',
url: url.build('custompay/payment/order'),
success: function (response) {
if (response.success) {
var order_id = response.order_id;
var amount = response.amount;
var billing_address = quote.billingAddress();
var name = billing_address.firstname;
var contact = billing_address.telephone;
var email = customer.customerData.email;
var data = {
amount: amount,
email: email,
contact: contact,
order_id:order_id
};
custompay.createPayment(data);
}
},
});
}
});
}
);
I have checked many posts and found there is some option to disable default order email by plugin. but I think it is not the standard approach. I read, there are some changes we need to perform in payment.js file to stop these confirmation email as implemeneted in braintree payment gateway.
how I could achieve this in the right way? Any help would be appreciated. Thanks.
magento2 payment payment-gateway
I have created one third party Payment gateway.
It is working fine except, It is sending two order confirmation email. One email I have added in my custom module success controller to send email after validate Transaction Id. But one default email is also triggered by magento after place order.
Below is My Payment module payment.js file:
define(
[
'jquery',
'ko',
'mage/url',
'Magento_Checkout/js/view/payment/default',
'Magento_Checkout/js/model/quote',
'Magento_Customer/js/model/customer'
],
function ($, ko, url, Component, quote, customer) {
'use strict';
return Component.extend({
defaults: {
template: 'Stack_Custompay/payment/custompay-form'
},
redirectAfterPlaceOrder: false,
/** Returns payment method instructions */
getInstructions: function() {
return window.checkoutConfig.payment.instructions[this.item.method];
},
afterPlaceOrder: function () {
$.ajax({
type: 'POST',
url: url.build('custompay/payment/order'),
success: function (response) {
if (response.success) {
var order_id = response.order_id;
var amount = response.amount;
var billing_address = quote.billingAddress();
var name = billing_address.firstname;
var contact = billing_address.telephone;
var email = customer.customerData.email;
var data = {
amount: amount,
email: email,
contact: contact,
order_id:order_id
};
custompay.createPayment(data);
}
},
});
}
});
}
);
I have checked many posts and found there is some option to disable default order email by plugin. but I think it is not the standard approach. I read, there are some changes we need to perform in payment.js file to stop these confirmation email as implemeneted in braintree payment gateway.
how I could achieve this in the right way? Any help would be appreciated. Thanks.
magento2 payment payment-gateway
magento2 payment payment-gateway
edited Nov 17 '17 at 10:15
Pankaj Pareek
asked Nov 17 '17 at 9:27
Pankaj PareekPankaj Pareek
2,44411338
2,44411338
bumped to the homepage by Community♦ 3 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community♦ 3 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Magento uses MagentoSalesModelOrderEmailSenderOrderSender to send order emails.
I would suggest replacing OrderService dependency in the MagentoQuoteObserverWebapiSubmitObserver by your own implementation via di.xml in the following way:
class CustomOrderSender extends MagentoSalesModelOrderEmailSenderOrderSender
{
public function send(Order $order, $forceSyncMode = false)
{
// custom implementation
}
}
and specify it in di.xml:
<type name="MagentoQuoteObserverWebapiSubmitObserver">
<arguments>
<argument name="orderSender" xsi:type="object">NSCustomOrderSender</argument>
</arguments>
</type>
So, you don't need to use your own controller and an email will be sent only once.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "479"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f202001%2forder-confirmation-email-sent-before-redirecting-to-third-party-payment-gateway%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Magento uses MagentoSalesModelOrderEmailSenderOrderSender to send order emails.
I would suggest replacing OrderService dependency in the MagentoQuoteObserverWebapiSubmitObserver by your own implementation via di.xml in the following way:
class CustomOrderSender extends MagentoSalesModelOrderEmailSenderOrderSender
{
public function send(Order $order, $forceSyncMode = false)
{
// custom implementation
}
}
and specify it in di.xml:
<type name="MagentoQuoteObserverWebapiSubmitObserver">
<arguments>
<argument name="orderSender" xsi:type="object">NSCustomOrderSender</argument>
</arguments>
</type>
So, you don't need to use your own controller and an email will be sent only once.
add a comment |
Magento uses MagentoSalesModelOrderEmailSenderOrderSender to send order emails.
I would suggest replacing OrderService dependency in the MagentoQuoteObserverWebapiSubmitObserver by your own implementation via di.xml in the following way:
class CustomOrderSender extends MagentoSalesModelOrderEmailSenderOrderSender
{
public function send(Order $order, $forceSyncMode = false)
{
// custom implementation
}
}
and specify it in di.xml:
<type name="MagentoQuoteObserverWebapiSubmitObserver">
<arguments>
<argument name="orderSender" xsi:type="object">NSCustomOrderSender</argument>
</arguments>
</type>
So, you don't need to use your own controller and an email will be sent only once.
add a comment |
Magento uses MagentoSalesModelOrderEmailSenderOrderSender to send order emails.
I would suggest replacing OrderService dependency in the MagentoQuoteObserverWebapiSubmitObserver by your own implementation via di.xml in the following way:
class CustomOrderSender extends MagentoSalesModelOrderEmailSenderOrderSender
{
public function send(Order $order, $forceSyncMode = false)
{
// custom implementation
}
}
and specify it in di.xml:
<type name="MagentoQuoteObserverWebapiSubmitObserver">
<arguments>
<argument name="orderSender" xsi:type="object">NSCustomOrderSender</argument>
</arguments>
</type>
So, you don't need to use your own controller and an email will be sent only once.
Magento uses MagentoSalesModelOrderEmailSenderOrderSender to send order emails.
I would suggest replacing OrderService dependency in the MagentoQuoteObserverWebapiSubmitObserver by your own implementation via di.xml in the following way:
class CustomOrderSender extends MagentoSalesModelOrderEmailSenderOrderSender
{
public function send(Order $order, $forceSyncMode = false)
{
// custom implementation
}
}
and specify it in di.xml:
<type name="MagentoQuoteObserverWebapiSubmitObserver">
<arguments>
<argument name="orderSender" xsi:type="object">NSCustomOrderSender</argument>
</arguments>
</type>
So, you don't need to use your own controller and an email will be sent only once.
answered Nov 17 '17 at 20:30
joni jonesjoni jones
1,836414
1,836414
add a comment |
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f202001%2forder-confirmation-email-sent-before-redirecting-to-third-party-payment-gateway%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown