7
7
using BitPay ;
8
8
using BitPay . Clients ;
9
9
using BitPay . Exceptions ;
10
+ using BitPay . Models ;
10
11
using BitPay . Models . Bill ;
11
12
using BitPay . Models . Invoice ;
12
13
using BitPay . Models . Payout ;
13
14
using BitPay . Utils ;
14
15
15
16
using Moq ;
16
17
18
+ using Newtonsoft . Json ;
19
+
17
20
using Environment = BitPay . Environment ;
18
21
using SystemEnvironment = System . Environment ;
19
22
@@ -826,11 +829,15 @@ public void it_should_cancel_invoice_by_guid()
826
829
[ Fact ]
827
830
public void it_should_request_invoice_webhook_to_be_resent ( )
828
831
{
832
+ var invoiceToken = "cM78LHk17Q8fktDE6QLBBFfvH1QKBhRkHibTLcxhgzsu3VDRvSyu3CGi17DuwYxhT" ; var responseObject = new
833
+ {
834
+ token = invoiceToken
835
+ } ;
829
836
// given
830
837
HttpContent response = new StringContent ( File . ReadAllText ( GetJsonResponsePath ( ) + "invoiceWebhookResponse.json" ) ) ;
831
838
_bitPayClient . Setup ( b => b . Post (
832
839
"invoices/Hpqc63wvE1ZjzeeH4kEycF/notifications" ,
833
- "{ \" token \" : \" merchantToken \" }" ,
840
+ JsonConvert . SerializeObject ( responseObject ) ,
834
841
false
835
842
) ) . ReturnsAsync ( new HttpResponseMessage
836
843
{
@@ -841,7 +848,7 @@ public void it_should_request_invoice_webhook_to_be_resent()
841
848
} ) ;
842
849
843
850
// when
844
- var result = GetTestedClassAsMerchant ( ) . RequestInvoiceWebhookToBeResent ( "Hpqc63wvE1ZjzeeH4kEycF" ) . Result ;
851
+ var result = GetTestedClassAsMerchant ( ) . RequestInvoiceWebhookToBeResent ( "Hpqc63wvE1ZjzeeH4kEycF" , invoiceToken ) . Result ;
845
852
846
853
// then
847
854
Assert . True ( result ) ;
@@ -1665,11 +1672,16 @@ public void it_should_update_refund_by_guid()
1665
1672
[ Fact ]
1666
1673
public void it_should_send_refund_notification ( )
1667
1674
{
1675
+ var refundToken = "cM78LHk17Q8fktDE6QLBBFfvH1QKBhRkHibTLcxhgzsu3VDRvSyu3CGi17DuwYxhT" ;
1676
+ var responseObject = new
1677
+ {
1678
+ token = refundToken
1679
+ } ;
1668
1680
// given
1669
1681
HttpContent response = new StringContent ( File . ReadAllText ( GetJsonResponsePath ( ) + "sendRefundNotificationResponse.json" ) ) ;
1670
1682
_bitPayClient . Setup ( b => b . Post (
1671
1683
"refunds/WoE46gSLkJQS48RJEiNw3L/notifications" ,
1672
- "{ \" token \" : \" merchantToken \" }" ,
1684
+ JsonConvert . SerializeObject ( responseObject ) ,
1673
1685
true
1674
1686
) ) . ReturnsAsync ( new HttpResponseMessage
1675
1687
{
@@ -1679,7 +1691,7 @@ public void it_should_send_refund_notification()
1679
1691
} ) ;
1680
1692
1681
1693
// when
1682
- var result = GetTestedClassAsMerchant ( ) . SendRefundNotification ( "WoE46gSLkJQS48RJEiNw3L" ) . Result ;
1694
+ var result = GetTestedClassAsMerchant ( ) . SendRefundNotification ( "WoE46gSLkJQS48RJEiNw3L" , refundToken ) . Result ;
1683
1695
1684
1696
// then
1685
1697
Assert . True ( result ) ;
0 commit comments