File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed
app/code/Magento/OfflinePayments Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -30,7 +30,8 @@ public function execute(\Magento\Framework\Event\Observer $observer)
30
30
Banktransfer::PAYMENT_METHOD_BANKTRANSFER_CODE ,
31
31
Cashondelivery::PAYMENT_METHOD_CASHONDELIVERY_CODE
32
32
];
33
- if (in_array ($ payment ->getMethod (), $ instructionMethods )) {
33
+ if (in_array ($ payment ->getMethod (), $ instructionMethods )
34
+ && empty ($ payment ->getAdditionalInformation ('instructions ' ))) {
34
35
$ payment ->setAdditionalInformation (
35
36
'instructions ' ,
36
37
$ payment ->getMethodInstance ()->getInstructions ()
Original file line number Diff line number Diff line change @@ -172,4 +172,24 @@ public function testBeforeOrderPaymentSaveWithOthers()
172
172
173
173
$ this ->_model ->execute ($ this ->observer );
174
174
}
175
+
176
+ /**
177
+ * @param string $methodCode
178
+ * @dataProvider dataProviderBeforeOrderPaymentSaveWithInstructions
179
+ */
180
+ public function testBeforeOrderPaymentSaveWithInstructionsAlreadySet ($ methodCode )
181
+ {
182
+ $ this ->payment
183
+ ->method ('getMethod ' )
184
+ ->willReturn ($ methodCode );
185
+
186
+ $ this ->payment ->expects (self ::once ())
187
+ ->method ('getAdditionalInformation ' )
188
+ ->willReturn ('Test ' );
189
+
190
+ $ this ->payment ->expects (self ::never ())
191
+ ->method ('setAdditionalInformation ' );
192
+
193
+ $ this ->_model ->execute ($ this ->observer );
194
+ }
175
195
}
You can’t perform that action at this time.
0 commit comments