@@ -47,6 +47,7 @@ class ClientTest extends TestCase
4747 private const PAYOUT_TOKEN = 'kQLZ7C9YKPSnMCC4EJwrqRHXuQkLzL1W8DfZCh37DHb ' ;
4848 private const CORRUPT_JSON_STRING = '{"code":"USD""name":"US Dollar","rate":21205.85} ' ;
4949 private const TEST_INVOICE_ID = 'UZjwcYkWAKfTMn9J1yyfs4 ' ;
50+ private const TEST_INVOICE_TOKEN = 'cM78LHk17Q8fktDE6QLBBFfvH1QKBhRkHibTLcxhgzsu3VDRvSyu3CGi17DuwYxhT ' ;
5051 private const TEST_INVOICE_GUID = 'chc9kj52-04g0-4b6f-941d-3a844e352758 ' ;
5152 private const CORRECT_JSON_STRING = '[
5253 { "currency": "EUR", "balance": 0 },
@@ -2796,14 +2797,15 @@ public function testGetRefundByGuidShouldCatchRestCliJsonMapperException()
27962797 public function testSendRefundNotification ()
27972798 {
27982799 $ exampleRefundId = 'testId ' ;
2799- $ params ['token ' ] = self ::MERCHANT_TOKEN ;
2800+ $ exampleRefundToken = 'testToken ' ;
2801+ $ params ['token ' ] = $ exampleRefundToken ;
28002802
28012803 $ restCliMock = $ this ->getRestCliMock ();
28022804 $ restCliMock ->expects (self ::once ())->method ('post ' )
28032805 ->with ("refunds/ " . $ exampleRefundId . "/notifications " , $ params , true )
28042806 ->willReturn ('{"status":"success"} ' );
28052807 $ client = $ this ->getClient ($ restCliMock );
2806- $ result = $ client ->sendRefundNotification ($ exampleRefundId );
2808+ $ result = $ client ->sendRefundNotification ($ exampleRefundId, $ exampleRefundToken );
28072809
28082810 self ::assertIsBool ($ result );
28092811 }
@@ -2814,7 +2816,8 @@ public function testSendRefundNotification()
28142816 public function testSendRefundNotificationShouldCatchRestCliBitPayException ()
28152817 {
28162818 $ exampleRefundId = 'testId ' ;
2817- $ params ['token ' ] = self ::MERCHANT_TOKEN ;
2819+ $ exampleRefundToken = 'testToken ' ;
2820+ $ params ['token ' ] = $ exampleRefundToken ;
28182821
28192822 $ restCliMock = $ this ->getRestCliMock ();
28202823 $ restCliMock ->expects (self ::once ())->method ('post ' )
@@ -2823,7 +2826,7 @@ public function testSendRefundNotificationShouldCatchRestCliBitPayException()
28232826 $ client = $ this ->getClient ($ restCliMock );
28242827 $ this ->expectException (BitPayApiException::class);
28252828
2826- $ client ->sendRefundNotification ($ exampleRefundId );
2829+ $ client ->sendRefundNotification ($ exampleRefundId, $ exampleRefundToken );
28272830 }
28282831
28292832 /**
@@ -2832,7 +2835,8 @@ public function testSendRefundNotificationShouldCatchRestCliBitPayException()
28322835 public function testSendRefundNotificationShouldCatchRestCliException ()
28332836 {
28342837 $ exampleRefundId = 'testId ' ;
2835- $ params ['token ' ] = self ::MERCHANT_TOKEN ;
2838+ $ exampleRefundToken = 'testToken ' ;
2839+ $ params ['token ' ] = $ exampleRefundToken ;
28362840
28372841 $ restCliMock = $ this ->getRestCliMock ();
28382842 $ restCliMock ->expects (self ::once ())->method ('post ' )
@@ -2841,7 +2845,7 @@ public function testSendRefundNotificationShouldCatchRestCliException()
28412845 $ client = $ this ->getClient ($ restCliMock );
28422846 $ this ->expectException (BitPayApiException::class);
28432847
2844- $ client ->sendRefundNotification ($ exampleRefundId );
2848+ $ client ->sendRefundNotification ($ exampleRefundId, $ exampleRefundToken );
28452849 }
28462850
28472851 /**
@@ -2850,15 +2854,16 @@ public function testSendRefundNotificationShouldCatchRestCliException()
28502854 public function testSendRefundNotificationShouldCatchJsonMapperException ()
28512855 {
28522856 $ exampleRefundId = 'testId ' ;
2853- $ params ['token ' ] = self ::MERCHANT_TOKEN ;
2857+ $ exampleRefundToken = 'testToken ' ;
2858+ $ params ['token ' ] = $ exampleRefundToken ;
28542859
28552860 $ restCliMock = $ this ->getRestCliMock ();
28562861 $ restCliMock ->expects (self ::once ())->method ('post ' )
28572862 ->with ("refunds/ " . $ exampleRefundId . "/notifications " , $ params , true )
28582863 ->willReturn (file_get_contents (__DIR__ . '/jsonResponse/false.json ' , true ));
28592864 $ client = $ this ->getClient ($ restCliMock );
28602865
2861- self ::assertFalse ($ client ->sendRefundNotification ($ exampleRefundId ));
2866+ self ::assertFalse ($ client ->sendRefundNotification ($ exampleRefundId, $ exampleRefundToken ));
28622867 }
28632868
28642869 public function testGetInvoice ()
@@ -3037,7 +3042,7 @@ public function testGetInvoicesShouldCatchJsonMapperException()
30373042 public function testRequestInvoiceNotificationShouldReturnTrueOnSuccess ()
30383043 {
30393044 $ invoiceId = self ::TEST_INVOICE_ID ;
3040- $ params ['token ' ] = self ::MERCHANT_TOKEN ;
3045+ $ params ['token ' ] = self ::TEST_INVOICE_TOKEN ;
30413046 $ expectedSuccessResponse = 'success ' ;
30423047 $ restCliMock = $ this ->getRestCliMock ();
30433048
@@ -3049,13 +3054,13 @@ public function testRequestInvoiceNotificationShouldReturnTrueOnSuccess()
30493054
30503055 $ testedObject = $ this ->getClient ($ restCliMock );
30513056
3052- $ result = $ testedObject ->requestInvoiceNotification ($ invoiceId );
3057+ $ result = $ testedObject ->requestInvoiceNotification ($ invoiceId, self :: TEST_INVOICE_TOKEN );
30533058 self ::assertTrue ($ result );
30543059 }
30553060
30563061 public function testRequestInvoiceNotificationShouldReturnFalseOnFailure ()
30573062 {
3058- $ params ['token ' ] = self ::MERCHANT_TOKEN ;
3063+ $ params ['token ' ] = self ::TEST_INVOICE_TOKEN ;
30593064 $ expectedFailResponse = 'fail ' ;
30603065 $ restCliMock = $ this ->getRestCliMock ();
30613066
@@ -3066,13 +3071,13 @@ public function testRequestInvoiceNotificationShouldReturnFalseOnFailure()
30663071 ->willReturn ($ expectedFailResponse );
30673072 $ testedObject = $ this ->getClient ($ restCliMock );
30683073
3069- $ result = $ testedObject ->requestInvoiceNotification (self ::TEST_INVOICE_ID );
3074+ $ result = $ testedObject ->requestInvoiceNotification (self ::TEST_INVOICE_ID , self :: TEST_INVOICE_TOKEN );
30703075 self ::assertFalse ($ result );
30713076 }
30723077
30733078 public function testRequestInvoiceNotificationShouldCatchJsonMapperException ()
30743079 {
3075- $ params ['token ' ] = self ::MERCHANT_TOKEN ;
3080+ $ params ['token ' ] = self ::TEST_INVOICE_TOKEN ;
30763081 $ restCliMock = $ this ->getRestCliMock ();
30773082
30783083 $ restCliMock
@@ -3084,7 +3089,7 @@ public function testRequestInvoiceNotificationShouldCatchJsonMapperException()
30843089 $ testedObject = $ this ->getClient ($ restCliMock );
30853090
30863091 $ this ->expectException (BitPayGenericException::class);
3087- $ testedObject ->requestInvoiceNotification (self ::TEST_INVOICE_ID );
3092+ $ testedObject ->requestInvoiceNotification (self ::TEST_INVOICE_ID , self :: TEST_INVOICE_TOKEN );
30883093 }
30893094
30903095 public function testCancelInvoice ()
0 commit comments