Skip to content

Commit 224674d

Browse files
committed
MAGETWO-38894: Create config for New Payment
1 parent 6c9aa94 commit 224674d

File tree

4 files changed

+13
-5
lines changed

4 files changed

+13
-5
lines changed

app/code/Magento/Payment/Model/Method/AbstractMethod.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -745,6 +745,9 @@ public function getTitle()
745745
*/
746746
public function getConfigData($field, $storeId = null)
747747
{
748+
if ('order_place_redirect_url' === $field) {
749+
return $this->getOrderPlaceRedirectUrl();
750+
}
748751
if (null === $storeId) {
749752
$storeId = $this->getStore();
750753
}

app/code/Magento/Payment/Model/Method/Adapter.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ public function isOffline()
222222
*/
223223
public function isInitializeNeeded()
224224
{
225-
return false;
225+
return (bool)(int)$this->getConfiguredValue('can_initialize');
226226
}
227227

228228
/**
@@ -570,6 +570,11 @@ public function assignData($data)
570570
*/
571571
public function initialize($paymentAction, $stateObject)
572572
{
573+
$this->executeCommand(
574+
'initialize',
575+
$this->getInfoInstance(),
576+
['paymentAction' => $paymentAction, 'stateObject' => $stateObject]
577+
);
573578
return $this;
574579
}
575580

app/code/Magento/Quote/Model/Quote/Payment.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,8 @@ public function getCheckoutRedirectUrl()
211211
public function getOrderPlaceRedirectUrl()
212212
{
213213
$method = $this->getMethodInstance();
214-
if ($method && $method instanceof AbstractMethod) {
215-
return $method->getOrderPlaceRedirectUrl();
214+
if ($method) {
215+
return $method->getConfigData('order_place_redirect_url');
216216
}
217217
return '';
218218
}

app/code/Magento/Sales/Model/Order/Payment.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ public function place()
256256

257257
$orderState = Order::STATE_NEW;
258258
$orderStatus = $methodInstance->getConfigData('order_status');
259-
$isCustomerNotified = false;
259+
$isCustomerNotified = null;
260260

261261
// Do order payment validation on payment method level
262262
$methodInstance->validate();
@@ -278,7 +278,7 @@ public function place()
278278
}
279279
}
280280

281-
$isCustomerNotified = $isCustomerNotified ?: $order->getCustomerNoteNotify();
281+
$isCustomerNotified = $isCustomerNotified === null ? $order->getCustomerNoteNotify() : $isCustomerNotified;
282282

283283
if (!in_array($orderStatus, $order->getConfig()->getStateStatuses($orderState))) {
284284
$orderStatus = $order->getConfig()->getStateDefaultStatus($orderState);

0 commit comments

Comments
 (0)