1313use RetailCrm \Api \Enum \RequestMethod ;
1414use RetailCrm \Api \Model \Entity \Payments \ApiCheckRequest ;
1515use RetailCrm \Api \Model \Entity \Payments \ApiCreateInvoiceRequest ;
16+ use RetailCrm \Api \Model \Entity \Payments \ApiImportInvoiceRequest ;
1617use RetailCrm \Api \Model \Entity \Payments \ApiUpdateInvoiceRequest ;
1718use RetailCrm \Api \Model \Request \Payments \PaymentCheckRequest ;
1819use RetailCrm \Api \Model \Request \Payments \PaymentCreateInvoiceRequest ;
20+ use RetailCrm \Api \Model \Request \Payments \PaymentImportInvoiceRequest ;
1921use RetailCrm \Api \Model \Request \Payments \PaymentUpdateInvoiceRequest ;
2022use RetailCrm \TestUtils \Factory \TestClientFactory ;
2123use RetailCrm \TestUtils \TestCase \AbstractApiResourceGroupTestCase ;
@@ -119,8 +121,7 @@ public function testGetInvoice(): void
119121 {
120122 $ json = <<<'EOF'
121123{
122- "success": false,
123- "errorMsg": "Not found"
124+ "success": false
124125}
125126EOF;
126127
@@ -134,4 +135,41 @@ public function testGetInvoice(): void
134135
135136 self ::assertModelEqualsToResponse ($ json , $ response );
136137 }
138+
139+ public function testImportInvoice (): void
140+ {
141+ $ json = <<<'EOF'
142+ {
143+ "success": true,
144+ "invoice": {
145+ "invoiceUuid": "7684160f-5ebe-4787-b031-1fc9e659f123"
146+ }
147+ }
148+ EOF;
149+
150+ $ request = new PaymentImportInvoiceRequest ();
151+ $ invoice = new ApiImportInvoiceRequest ();
152+
153+ $ invoice ->paymentId = 979 ;
154+ $ invoice ->externalId = '979 ' ;
155+ $ invoice ->status = 'succeeded ' ;
156+ $ invoice ->amount = 6697.0 ;
157+ $ invoice ->currency = 'RUB ' ;
158+ $ invoice ->createdAt = '2025-07-08 00:00:00 ' ;
159+ $ invoice ->paidAt = '2025-07-08 00:10:00 ' ;
160+ $ invoice ->refundable = true ;
161+
162+ $ request ->invoice = $ invoice ;
163+
164+ $ mock = static ::createApiMockBuilder ('payment/invoice/import ' );
165+ $ mock ->matchMethod (RequestMethod::POST )
166+ ->matchBody (static ::encodeForm ($ request ))
167+ ->reply ()
168+ ->withBody ($ json );
169+
170+ $ client = TestClientFactory::createClient ($ mock ->getClient ());
171+ $ response = $ client ->payments ->importInvoice ($ request );
172+
173+ self ::assertModelEqualsToResponse ($ json , $ response );
174+ }
137175}
0 commit comments