@@ -352,7 +352,7 @@ public function testSetOrderAttributesAfterConfirm()
352352 $ this ->assertEquals ($ apiParametersString , $ expectedStringParams );
353353 }
354354
355- public function testConfirmOrderReference ()
355+ public function testConfirmOrderReferenceWithAllSCA ()
356356 {
357357 $ client = new Client ($ this ->configParams );
358358 $ fieldMappings = array (
@@ -380,6 +380,83 @@ public function testConfirmOrderReference()
380380 $ this ->assertEquals ($ apiParametersString , $ expectedStringParams );
381381 }
382382
383+ public function testConfirmOrderReferenceWithAllButCurrencyCodeSCA ()
384+ {
385+ $ client = new Client ($ this ->configParams );
386+ $ fieldMappings = array (
387+ 'merchant_id ' => 'SellerId ' ,
388+ 'amazon_order_reference_id ' => 'AmazonOrderReferenceId ' ,
389+ 'mws_auth_token ' => 'MWSAuthToken ' ,
390+ 'success_url ' => 'SuccessUrl ' ,
391+ 'failure_url ' => 'FailureUrl ' ,
392+ 'authorization_amount ' => 'AuthorizationAmount.Amount '
393+ );
394+
395+ $ action = 'ConfirmOrderReference ' ;
396+
397+ $ parameters = $ this ->setParametersAndPost ($ fieldMappings , $ action );
398+ $ expectedParameters = $ parameters ['expectedParameters ' ];
399+ $ apiCallParams = $ parameters ['apiCallParams ' ];
400+
401+ $ expectedParameters ['AuthorizationAmount.CurrencyCode ' ] = 'USD ' ; # default from client
402+ $ expectedStringParams = $ this ->callPrivateMethod ($ client , 'calculateSignatureAndParametersToString ' , $ expectedParameters );
403+
404+ $ response = $ client ->confirmOrderReference ($ apiCallParams );
405+
406+ $ apiParametersString = $ client ->getParameters ();
407+ $ this ->assertEquals ($ apiParametersString , $ expectedStringParams );
408+ }
409+
410+ public function testConfirmOrderReferenceWithUrlSCA ()
411+ {
412+ $ client = new Client ($ this ->configParams );
413+ $ fieldMappings = array (
414+ 'merchant_id ' => 'SellerId ' ,
415+ 'amazon_order_reference_id ' => 'AmazonOrderReferenceId ' ,
416+ 'mws_auth_token ' => 'MWSAuthToken ' ,
417+ 'success_url ' => 'SuccessUrl ' ,
418+ 'failure_url ' => 'FailureUrl '
419+ );
420+
421+ $ action = 'ConfirmOrderReference ' ;
422+
423+ $ parameters = $ this ->setParametersAndPost ($ fieldMappings , $ action );
424+ $ expectedParameters = $ parameters ['expectedParameters ' ];
425+ $ apiCallParams = $ parameters ['apiCallParams ' ];
426+
427+ $ expectedStringParams = $ this ->callPrivateMethod ($ client , 'calculateSignatureAndParametersToString ' , $ expectedParameters );
428+
429+ $ response = $ client ->confirmOrderReference ($ apiCallParams );
430+
431+ $ apiParametersString = $ client ->getParameters ();
432+
433+ $ this ->assertEquals ($ apiParametersString , $ expectedStringParams );
434+ }
435+
436+ public function testConfirmOrderReferenceWithoutSCA ()
437+ {
438+ $ client = new Client ($ this ->configParams );
439+ $ fieldMappings = array (
440+ 'merchant_id ' => 'SellerId ' ,
441+ 'amazon_order_reference_id ' => 'AmazonOrderReferenceId ' ,
442+ 'mws_auth_token ' => 'MWSAuthToken '
443+ );
444+
445+ $ action = 'ConfirmOrderReference ' ;
446+
447+ $ parameters = $ this ->setParametersAndPost ($ fieldMappings , $ action );
448+ $ expectedParameters = $ parameters ['expectedParameters ' ];
449+ $ apiCallParams = $ parameters ['apiCallParams ' ];
450+
451+ $ expectedStringParams = $ this ->callPrivateMethod ($ client , 'calculateSignatureAndParametersToString ' , $ expectedParameters );
452+
453+ $ response = $ client ->confirmOrderReference ($ apiCallParams );
454+
455+ $ apiParametersString = $ client ->getParameters ();
456+
457+ $ this ->assertEquals ($ apiParametersString , $ expectedStringParams );
458+ }
459+
383460 public function testCancelOrderReference ()
384461 {
385462 $ client = new Client ($ this ->configParams );
0 commit comments