File tree Expand file tree Collapse file tree 6 files changed +38
-12
lines changed Expand file tree Collapse file tree 6 files changed +38
-12
lines changed Original file line number Diff line number Diff line change @@ -3865,11 +3865,6 @@ parameters:
3865
3865
count : 1
3866
3866
path : app/code/core/Mage/Sales/Model/Order/Payment.php
3867
3867
3868
- -
3869
- message : " #^Property Mage_Sales_Model_Order_Payment\\ :\\ :\\ $_canVoidLookup \\ (string\\ ) does not accept bool\\ .$#"
3870
- count : 2
3871
- path : app/code/core/Mage/Sales/Model/Order/Payment.php
3872
-
3873
3868
-
3874
3869
message : " #^Method Mage_Sales_Model_Order_Payment_Transaction\\ :\\ :getOrderId\\ (\\ ) should return int\\ |null but return statement is missing\\ .$#"
3875
3870
count : 1
Original file line number Diff line number Diff line change @@ -449,8 +449,12 @@ public function canEditQty()
449
449
) {
450
450
return false ;
451
451
}
452
- if ($ this ->getOrder ()->getPayment ()->canCapture ()) {
453
- return $ this ->getOrder ()->getPayment ()->canCapturePartial ();
452
+ $ payment = $ this ->getOrder ()->getPayment ();
453
+ if ($ payment
454
+ && $ this ->helper ('payment ' )->getMethodModelClassName ($ payment ->getMethod ()) !== null
455
+ && $ payment ->canCapture ()
456
+ ) {
457
+ return $ payment ->canCapturePartial ();
454
458
}
455
459
return true ;
456
460
}
Original file line number Diff line number Diff line change @@ -162,7 +162,7 @@ public function __construct()
162
162
163
163
if ($ this ->_isAllowedAction ('creditmemo ' ) && $ order ->canCreditmemo ()) {
164
164
$ onClick = Mage::helper ('core/js ' )->getSetLocationJs ($ this ->getCreditmemoUrl ());
165
- if ($ order ->getPayment ()->getMethodInstance ()->isGateway ()) {
165
+ if ($ order ->getPayment () && $ order -> getPayment () ->getMethodInstance ()->isGateway ()) {
166
166
$ onClick = Mage::helper ('core/js ' )->getConfirmSetLocationJs (
167
167
$ this ->getCreditmemoUrl (),
168
168
Mage::helper ('sales ' )->__ ('This will create an offline refund. To create an online refund, open an invoice and create credit memo for it. Do you wish to proceed? ' )
Original file line number Diff line number Diff line change @@ -120,9 +120,20 @@ public function getMethodFormBlock(Mage_Payment_Model_Method_Abstract $method)
120
120
*
121
121
* @return Mage_Core_Block_Template|Mage_Core_Block_Abstract
122
122
*/
123
- public function getInfoBlock (Mage_Payment_Model_Info $ info )
123
+ public function getInfoBlock (Mage_Payment_Model_Info | false $ info )
124
124
{
125
- $ blockType = $ info ->getMethodInstance ()->getInfoBlockType ();
125
+ $ method = $ info === false ? $ this ->__ ('No Data Found ' ) : $ info ->getMethod ();
126
+ if ($ this ->getMethodModelClassName ($ method ) !== null ) {
127
+ $ blockType = $ info ->getMethodInstance ()->getInfoBlockType ();
128
+ } else {
129
+ Mage::log (
130
+ sprintf ('Payment method was not found: %s ' , $ method ),
131
+ Zend_Log::NOTICE
132
+ );
133
+ return ($ this ->getLayout () ?? Mage::app ()->getLayout ())
134
+ ->createBlock ('core/text ' )
135
+ ->setText ($ method );
136
+ }
126
137
if ($ this ->getLayout ()) {
127
138
$ block = $ this ->getLayout ()->createBlock ($ blockType );
128
139
} else {
Original file line number Diff line number Diff line change @@ -671,6 +671,9 @@ public function canCancel()
671
671
*/
672
672
public function canVoidPayment ()
673
673
{
674
+ if ($ this ->getPayment () === false ) {
675
+ return false ;
676
+ }
674
677
return $ this ->_canVoidOrder () ? $ this ->getPayment ()->canVoid ($ this ->getPayment ()) : false ;
675
678
}
676
679
@@ -841,7 +844,16 @@ public function canEdit()
841
844
return false ;
842
845
}
843
846
844
- if (!$ this ->getPayment ()->getMethodInstance ()->canEdit ()) {
847
+ $ payment = $ this ->getPayment ();
848
+ if (!$ payment ) {
849
+ return false ;
850
+ }
851
+
852
+ if (Mage::helper ('payment ' )->getMethodModelClassName ($ payment ->getMethod ()) === null ) {
853
+ return false ;
854
+ }
855
+
856
+ if (!$ payment ->getMethodInstance ()->canEdit ()) {
845
857
return false ;
846
858
}
847
859
Original file line number Diff line number Diff line change @@ -221,7 +221,7 @@ class Mage_Sales_Model_Order_Payment extends Mage_Payment_Model_Info
221
221
222
222
/**
223
223
* Whether can void
224
- * @var string
224
+ * @var bool|null
225
225
*/
226
226
protected $ _canVoidLookup = null ;
227
227
@@ -650,6 +650,10 @@ protected function _invoice()
650
650
public function canVoid (Varien_Object $ document )
651
651
{
652
652
if ($ this ->_canVoidLookup === null ) {
653
+ if (Mage::helper ('payment ' )->getMethodModelClassName ($ this ->getMethod ()) === null ) {
654
+ $ this ->_canVoidLookup = false ;
655
+ return $ this ->_canVoidLookup ;
656
+ }
653
657
$ this ->_canVoidLookup = (bool )$ this ->getMethodInstance ()->canVoid ($ document );
654
658
if ($ this ->_canVoidLookup ) {
655
659
$ authTransaction = $ this ->getAuthorizationTransaction ();
You can’t perform that action at this time.
0 commit comments