@@ -28,16 +28,49 @@ public function testServerCompleteAuthorizeResponseSuccess()
2828 'DeclineCode ' => '00 ' ,
2929 'ExpiryDate ' => '0722 ' ,
3030 'BankAuthCode ' => '999777 ' ,
31+ //'VendorTxCode' => '123', <-- Not in response
3132 )
3233 );
3334
35+ // The transaction ID is set in the original request only.
36+
3437 $ this ->getMockRequest ()->shouldReceive ('getTransactionId ' )->once ()->andReturn ('123 ' );
3538 $ this ->getMockRequest ()->shouldReceive ('getTransactionReference ' )->once ()->andReturn ('{"SecurityKey":"JEUPDN1N7E","TxAuthNo":"4255","VPSTxId":"{F955C22E-F67B-4DA3-8EA3-6DAC68FA59D2}","VendorTxCode":"438791"} ' );
3639
3740 $ this ->assertTrue ($ response ->isSuccessful ());
3841 $ this ->assertFalse ($ response ->isRedirect ());
3942 $ this ->assertSame ('{"SecurityKey":"JEUPDN1N7E","TxAuthNo":"b","VPSTxId":"{F955C22E-F67B-4DA3-8EA3-6DAC68FA59D2}","VendorTxCode":"123"} ' , $ response ->getTransactionReference ());
4043 $ this ->assertNull ($ response ->getMessage ());
44+
45+ //$this->assertSame('123', $response->getTransactionId());
46+ }
47+
48+ public function testFormCompleteAuthorizeResponseSuccess ()
49+ {
50+ $ response = new ServerCompleteAuthorizeResponse (
51+ $ this ->getMockRequest (),
52+ array (
53+ 'Status ' => 'OK ' ,
54+ 'TxAuthNo ' => 'b ' ,
55+ 'AVSCV2 ' => 'c ' ,
56+ 'AddressResult ' => 'd ' ,
57+ 'PostCodeResult ' => 'e ' ,
58+ 'CV2Result ' => 'f ' ,
59+ 'GiftAid ' => 'g ' ,
60+ '3DSecureStatus ' => 'h ' ,
61+ 'CAVV ' => 'i ' ,
62+ 'AddressStatus ' => 'j ' ,
63+ 'PayerStatus ' => 'k ' ,
64+ 'CardType ' => 'l ' ,
65+ 'Last4Digits ' => 'm ' ,
66+ 'DeclineCode ' => '00 ' ,
67+ 'ExpiryDate ' => '0722 ' ,
68+ 'BankAuthCode ' => '999777 ' ,
69+ 'VendorTxCode ' => '123 ' , // In response
70+ )
71+ );
72+
73+ $ this ->assertSame ('123 ' , $ response ->getTransactionId ());
4174 }
4275
4376 public function testServerCompleteAuthorizeResponseFailure ()
0 commit comments