Skip to content

Commit 39f5dea

Browse files
committed
MAGETWO-99590: [Auth.net Accept.js] Order is placed only from second time in Admin with Auth.net payment method
1 parent 8d45535 commit 39f5dea

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

app/code/Magento/AuthorizenetAcceptjs/view/adminhtml/templates/payment/script.phtml

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,16 @@
66

77
/** @var Magento\AuthorizenetAcceptjs\Block\Payment $block */
88
?>
9-
<script type="text/x-magento-init">
10-
{
11-
"#payment_form_<?= $block->escapeJs($block->escapeHtml($block->getMethodCode())) ?>": {
12-
"Magento_AuthorizenetAcceptjs/js/payment-form": {
13-
"config": <?= /* @noEscape */ $block->getPaymentConfig() ?>
14-
}
15-
}
16-
}
17-
</script>
9+
<script>
10+
//<![CDATA[
11+
require(
12+
[
13+
'Magento_AuthorizenetAcceptjs/js/payment-form'
14+
], function(Authorizenet) {
15+
var config = <?= /* @noEscape */ $block->getPaymentConfig() ?>,
16+
form = "#payment_form_<?= $block->escapeJs($block->escapeHtml($block->getMethodCode())) ?>";
17+
18+
new Authorizenet(config, form);
19+
});
20+
//]]>
21+
</script>

app/code/Magento/AuthorizenetAcceptjs/view/adminhtml/web/js/payment-form.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@ define([
88
], function (AuthorizenetAcceptjs, $) {
99
'use strict';
1010

11-
return function (data, element) {
12-
var $form = $(element),
13-
config = data.config;
11+
return function (config, element) {
12+
var $form = $(element);
1413

1514
config.active = $form.length > 0 && !$form.is(':hidden');
1615
new AuthorizenetAcceptjs(config);

0 commit comments

Comments
 (0)