@@ -636,21 +636,19 @@ public void it_should_throws_exception_for_cancel_invoice_for_invalid_state_of_c
636636 @ Test
637637 public void it_should_request_invoice_webhook_to_be_resent () throws BitPayApiException , BitPayGenericException {
638638 // given
639- final String merchantToken = "merchantToken" ;
640639 final String invoiceId = "UZjwcYkWAKfTMn9J1yyfs4" ;
641- final String requestJson = "{\" token\" :\" merchantToken\" }" ;
640+ final String invoiceToken = "cM78LHk17Q8fktDE6QLBBFfvH1QKBhRkHibTLcxhgzsu3VDRvSyu3CGi17DuwYxhT" ;
641+ final String requestJson = String .format ("{\" token\" :\" %s\" }" , invoiceToken );
642642
643643 Mockito .when (this .bitPayClient .post (
644644 ArgumentMatchers .eq ("invoices/" + invoiceId + "/notifications" ), ArgumentMatchers .eq (requestJson ))
645645 ).thenReturn (this .getHttpResponseWithSpecificBody ("{\" data\" : \" Success\" }" ));
646- Mockito .when (this .accessTokens .getAccessToken (Facade .MERCHANT )).thenReturn (merchantToken );
647646 Client testedClass = this .getTestedClass ();
648647
649648 // when
650- Boolean result = testedClass .requestInvoiceWebhookToBeResent (invoiceId );
649+ Boolean result = testedClass .requestInvoiceWebhookToBeResent (invoiceId , invoiceToken );
651650
652651 // then
653- Mockito .verify (this .accessTokens , Mockito .times (1 )).getAccessToken (Facade .MERCHANT );
654652 Mockito .verify (this .bitPayClient , Mockito .times (1 )).post ("invoices/" + invoiceId + "/notifications" , requestJson );
655653 Assertions .assertTrue (result );
656654 }
@@ -791,7 +789,7 @@ public void it_should_throws_bitpay_api_exception_for_invalid_sendRefundNotifica
791789 )).thenThrow (new BitPayApiException ("error message" , "500" ));
792790
793791 // when
794- testedClass .sendRefundNotification ("1" );
792+ testedClass .sendRefundNotification ("1" , "cM78LHk17Q8fktDE6QLBBFfvH1QKBhRkHibTLcxhgzsu3VDRvSyu3CGi17DuwYxhT" );
795793 }
796794 );
797795
@@ -1046,27 +1044,23 @@ public void it_should_update_refund_by_guid() throws BitPayApiException, BitPayG
10461044 @ Test
10471045 public void it_should_test_sendRefundNotification () throws BitPayApiException , BitPayGenericException {
10481046 // given
1049- final String merchantToken = "merchantToken" ;
10501047 final String refundId = "WoE46gSLkJQS48RJEiNw3L" ;
1048+ final String refundToken = "cM78LHk17Q8fktDE6QLBBFfvH1QKBhRkHibTLcxhgzsu3VDRvSyu3CGi17DuwYxhT" ;
10511049 final String getRefundsJsonConvertedResponse = getPreparedJsonDataFromFile ("refundNotificationResponse.json" );
10521050
1053- final List <BasicNameValuePair > params = new ArrayList <BasicNameValuePair >();
1054- params .add (new BasicNameValuePair ("token" , merchantToken ));
1055- final String requestedJson = "{\" token\" :\" merchantToken\" }" ;
1051+ final String requestedJson = String .format ("{\" token\" :\" %s\" }" , refundToken );
10561052
10571053 Mockito .when (this .bitPayClient .post (
10581054 "refunds/" + refundId + "/notifications" ,
10591055 requestedJson ,
10601056 true
10611057 )).thenReturn (this .getHttpResponseWithSpecificBody (getRefundsJsonConvertedResponse ));
1062- Mockito .when (this .accessTokens .getAccessToken (Facade .MERCHANT )).thenReturn (merchantToken );
10631058 Client testedClass = this .getTestedClass ();
10641059
10651060 // when
1066- Boolean result = testedClass .sendRefundNotification (refundId );
1061+ Boolean result = testedClass .sendRefundNotification (refundId , refundToken );
10671062
10681063 // then
1069- Mockito .verify (this .accessTokens , Mockito .times (1 )).getAccessToken (Facade .MERCHANT );
10701064 Mockito .verify (this .bitPayClient , Mockito .times (1 )).post (
10711065 "refunds/" + refundId + "/notifications" ,
10721066 requestedJson ,
0 commit comments