File tree Expand file tree Collapse file tree 3 files changed +36
-0
lines changed Expand file tree Collapse file tree 3 files changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -1285,6 +1285,15 @@ protected function _handleCallErrors($response)
1285
1285
);
1286
1286
$ this ->_logger ->critical ($ exceptionLogMessage );
1287
1287
1288
+ /**
1289
+ * The response code 10415 'Transaction has already been completed for this token'
1290
+ * must not fails place order. The old Paypal interface does not lock 'Send' button
1291
+ * it may result to re-send data.
1292
+ */
1293
+ if (in_array ((string )ProcessableException::API_TRANSACTION_HAS_BEEN_COMPLETED , $ this ->_callErrors )) {
1294
+ return ;
1295
+ }
1296
+
1288
1297
$ exceptionPhrase = __ ('PayPal gateway has rejected request. %1 ' , $ errorMessages );
1289
1298
1290
1299
/** @var \Magento\Framework\Exception\LocalizedException $exception */
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ class ProcessableException extends LocalizedException
29
29
const API_MAXIMUM_AMOUNT_FILTER_DECLINE = 10538 ;
30
30
const API_OTHER_FILTER_DECLINE = 10539 ;
31
31
const API_ADDRESS_MATCH_FAIL = 10736 ;
32
+ const API_TRANSACTION_HAS_BEEN_COMPLETED = 10415 ;
32
33
/**#@-*/
33
34
34
35
/**
Original file line number Diff line number Diff line change @@ -253,4 +253,30 @@ public function testGetDebugReplacePrivateDataKeys()
253
253
$ debugReplacePrivateDataKeys = $ this ->_invokeNvpProperty ($ this ->model , '_debugReplacePrivateDataKeys ' );
254
254
$ this ->assertEquals ($ debugReplacePrivateDataKeys , $ this ->model ->getDebugReplacePrivateDataKeys ());
255
255
}
256
+
257
+ /**
258
+ * Tests case if obtained response with code 10415 'Transaction has already
259
+ * been completed for this token'. It must does not throws the exception and
260
+ * must returns response array.
261
+ */
262
+ public function testCallTransactionHasBeenCompleted ()
263
+ {
264
+ $ response = "\r\n" . 'ACK[7]=Failure&L_ERRORCODE0[5]=10415 '
265
+ . '&L_SHORTMESSAGE0[8]=Message.&L_LONGMESSAGE0[15]=Long%20Message. ' ;
266
+ $ processableErrors =[10415 ];
267
+ $ this ->curl ->expects ($ this ->once ())
268
+ ->method ('read ' )
269
+ ->will ($ this ->returnValue ($ response ));
270
+ $ this ->model ->setProcessableErrors ($ processableErrors );
271
+ $ this ->customLoggerMock ->expects ($ this ->once ())
272
+ ->method ('debug ' );
273
+ $ expectedResponse = [
274
+ 'ACK ' => 'Failure ' ,
275
+ 'L_ERRORCODE0 ' => '10415 ' ,
276
+ 'L_SHORTMESSAGE0 ' => 'Message. ' ,
277
+ 'L_LONGMESSAGE0 ' => 'Long Message. '
278
+ ];
279
+
280
+ $ this ->assertEquals ($ expectedResponse , $ this ->model ->call ('some method ' , ['data ' => 'some data ' ]));
281
+ }
256
282
}
You can’t perform that action at this time.
0 commit comments