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 @@ -216,4 +216,30 @@ public function testGetDebugReplacePrivateDataKeys()
216
216
$ debugReplacePrivateDataKeys = $ this ->_invokeNvpProperty ($ this ->model , '_debugReplacePrivateDataKeys ' );
217
217
$ this ->assertEquals ($ debugReplacePrivateDataKeys , $ this ->model ->getDebugReplacePrivateDataKeys ());
218
218
}
219
+
220
+ /**
221
+ * Tests case if obtained response with code 10415 'Transaction has already
222
+ * been completed for this token'. It must does not throws the exception and
223
+ * must returns response array.
224
+ */
225
+ public function testCallTransactionHasBeenCompleted ()
226
+ {
227
+ $ response = "\r\n" . 'ACK[7]=Failure&L_ERRORCODE0[5]=10415 '
228
+ . '&L_SHORTMESSAGE0[8]=Message.&L_LONGMESSAGE0[15]=Long%20Message. ' ;
229
+ $ processableErrors =[10415 ];
230
+ $ this ->curl ->expects ($ this ->once ())
231
+ ->method ('read ' )
232
+ ->will ($ this ->returnValue ($ response ));
233
+ $ this ->model ->setProcessableErrors ($ processableErrors );
234
+ $ this ->customLoggerMock ->expects ($ this ->once ())
235
+ ->method ('debug ' );
236
+ $ expectedResponse = [
237
+ 'ACK ' => 'Failure ' ,
238
+ 'L_ERRORCODE0 ' => '10415 ' ,
239
+ 'L_SHORTMESSAGE0 ' => 'Message. ' ,
240
+ 'L_LONGMESSAGE0 ' => 'Long Message. '
241
+ ];
242
+
243
+ $ this ->assertEquals ($ expectedResponse , $ this ->model ->call ('some method ' , ['data ' => 'some data ' ]));
244
+ }
219
245
}
You can’t perform that action at this time.
0 commit comments