intuit / QuickBooks-V3-PHP-SDK

Official PHP SDK for QuickBooks REST API v3.0: https://developer.intuit.com/
Apache License 2.0
241 stars 240 forks source link

DataService Void method is not working Sales Receipt #357

Open denza opened 3 years ago

denza commented 3 years ago

I found a bug in php SDK.

https://github.com/intuit/QuickBooks-V3-PHP-SDK/blob/master/src/DataService/DataService.php#L861

The class name is QuickBooksOnline\API\Data\IPPSalesReceipt and CoreConstants::VOID_QUERYPARAMETER_GENERAL is assigned instead of CoreConstants::VOID_QUERYPARAMETER_PAYMENT, that causes error below.

If you inspect $uri variable it will output

company/{{CompanyId}}/salesreceipt?operation=void

API Documentation said differently and I update the code to see if I can fix the error and correct uri should be

company/{{CompanyId}}/salesreceipt?operation=update&include=void

Link to documentation https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/salesreceipt#void-a-salesreceipt.

To reproduce

$item = $dataService->FindById("SalesReceipt", $id); $dataService->Void($item);

abisalehalliprasan commented 3 years ago

Thanks @denza for reporting. Also, opening up our SDK for hacktoberfest contributions.

What is it? Hacktoberfest is underway right now and we would love for you to contribute 🚀 . More information on #hacktoberfest is here

Develop-with-Intuit for Hacktoberfest

bsivalingam commented 3 years ago

@abisalehalliprasan I wanted to pick this one up for Hacktoberfest so had reached out to V3. Didn't get to it due to the late turn around. But here are my findings: Void operations in V3 have 2 different endpoints, SalesReceipt void endpoint is: /salesreceipt?operation=update&include=void as in the docs. This operation will be similar to the Payments void operation.