Skip to content

Commit e9b1713

Browse files
committed
Merge pull request #424 from magento-mpi/MAGETWO-32931
[MPI] Accepting and Rejecting Transactions Marked as "Held for Review" by Gateway
2 parents 2af1192 + 1319682 commit e9b1713

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,7 @@ public function order(InfoInterface $payment, $amount)
366366
$payment,
367367
['amount' => $amount]
368368
);
369+
369370
return $this;
370371
}
371372

@@ -379,6 +380,7 @@ public function authorize(InfoInterface $payment, $amount)
379380
$payment,
380381
['amount' => $amount]
381382
);
383+
382384
return $this;
383385
}
384386

@@ -406,6 +408,7 @@ public function refund(InfoInterface $payment, $amount)
406408
$payment,
407409
['amount' => $amount]
408410
);
411+
409412
return $this;
410413
}
411414

@@ -418,6 +421,7 @@ public function cancel(InfoInterface $payment)
418421
'cancel',
419422
$payment
420423
);
424+
421425
return $this;
422426
}
423427

@@ -430,6 +434,7 @@ public function void(InfoInterface $payment)
430434
'void',
431435
$payment
432436
);
437+
433438
return $this;
434439
}
435440

@@ -442,6 +447,7 @@ public function acceptPayment(InfoInterface $payment)
442447
'accept_payment',
443448
$payment
444449
);
450+
445451
return $this;
446452
}
447453

@@ -454,7 +460,8 @@ public function denyPayment(InfoInterface $payment)
454460
'deny_payment',
455461
$payment
456462
);
457-
return false;
463+
464+
return $this;
458465
}
459466

460467
/**

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,9 +1020,15 @@ public function deny($isOnline = true)
10201020
{
10211021
$transactionId = $isOnline ? $this->getLastTransId() : $this->getTransactionId();
10221022

1023-
$result = $isOnline ?
1024-
$this->getMethodInstance()->setStore($this->getOrder()->getStoreId())->denyPayment($this) :
1025-
(bool)$this->getNotificationResult();
1023+
if ($isOnline) {
1024+
/** @var \Magento\Payment\Model\Method\AbstractMethod $method */
1025+
$method = $this->getMethodInstance();
1026+
$method->setStore($this->getOrder()->getStoreId());
1027+
1028+
$result = $method->denyPayment($this);
1029+
} else {
1030+
$result = (bool)$this->getNotificationResult();
1031+
}
10261032

10271033
if ($result) {
10281034
$invoice = $this->_getInvoiceForTransactionId($transactionId);

0 commit comments

Comments
 (0)