aade-mydata icon indicating copy to clipboard operation
aade-mydata copied to clipboard

SendExpenseClassification

Open umitcel opened this issue 1 year ago • 5 comments

Hello, It seems SendExpenseClassification method is not implemented. Do you plan to implement? Until now have you tried to send any expense classfication against a vendor invoice? Actually I tried to send but service gives aunexpected errors

umitcel avatar Jul 01 '24 11:07 umitcel

Hi, Thanks for the notice. Can you please provide the code you tried alongside the response you got? I will definately have a look at it.

firebed avatar Jul 01 '24 11:07 firebed

The code:

curl --location 'https://mydatapi.aade.gr/myDATA/SendExpensesClassification' \ --header 'aade-user-id: VassilisAivatoglou' \ --header 'Ocp-Apim-Subscription-Key: ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ' \ --header 'Content-Type: application/xml' \ --data '<?xml version="1.0" encoding="utf-8"?> <ExpensesClassificationsDoc xmlns="https://www.aade.gr/myDATA/expensesClassificaton/v1.0"> <expensesInvoiceClassification> <invoiceMark>YYYYYYYYYYY</invoiceMark> <entityVatNumber>XXXXXXXXXX</entityVatNumber> <invoicesExpensesClassificationDetails> <lineNumber>1</lineNumber> <expensesClassificationDetailData> <classificationType>E3_585_016</classificationType> <classificationCategory>category2_3</classificationCategory> <amount>6854.99</amount> <vatCategory>1</vatCategory> </expensesClassificationDetailData> </invoicesExpensesClassificationDetails> </expensesInvoiceClassification> </ExpensesClassificationsDoc>'

Response: <?xml version="1.0" encoding="utf-8"?> <ResponseDoc xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <response> <index>1</index> <statusCode>ValidationError</statusCode> <errors> <error> <message>Combination vatCategory 1, vatExemptionCategory null: Fields vatAmount, vatCategory and vatExemptionCategory must be null when classifications are posted per line </message> <code>337</code> </error> <error> <message>VAT classifications is mandatory for invoice detail 1</message> <code>230</code> </error> </errors> </response> </ResponseDoc>

I ananomized some fields.

umitcel avatar Jul 01 '24 12:07 umitcel

Just to clarify what's going on here. I don't see any code related to this package. You are sending the request directly by youself using curl and I can't tell if the XML was generated by this package or not. The response error indicates the data is missing some required fields.

firebed avatar Jul 01 '24 12:07 firebed

Yes your code doesn't have this method implemented yet. I shared my own experience.

umitcel avatar Jul 01 '24 12:07 umitcel

Yes you're right. It is not implemented yet. I plan to release this in the upcoming version 5.x-1.0.9-dev. The release is estimated to happend in 1-2 months from now as it primarily depends on mydata. As soon as myDATA makes 1.0.9 ready for production I will release a major v5 version too.

firebed avatar Jul 01 '24 13:07 firebed

Sorry for the late response. The requested functionalities have finally been implemented.

Release: v5.4.0 Commit 1: feat (income classification): Add support for sending income classifications. Commit 2: feat (expense classification): Add support for sending expenses classifications.

Here is an example of sending expense classifications:

use Firebed\AadeMyData\Enums\ExpenseClassificationCategory;
use Firebed\AadeMyData\Enums\ExpenseClassificationType;
use Firebed\AadeMyData\Http\SendExpensesClassification;
use Firebed\AadeMyData\Models\ExpensesClassification;
use Firebed\AadeMyData\Models\InvoiceExpensesClassification;
use Firebed\AadeMyData\Models\InvoicesExpensesClassificationDetail;

$classification = new InvoiceExpensesClassification();
$classification->setInvoiceMark(900001843640886);
$classification->setInvoicesExpensesClassificationDetails([
    new InvoicesExpensesClassificationDetail([
        'lineNumber' => 1,
        'expensesClassificationDetailData' => [
            new ExpensesClassification([
                'classificationType' => ExpenseClassificationType::E3_102_001,
                'classificationCategory' => ExpenseClassificationCategory::CATEGORY_2_1,
                'amount' => 10
            ]),
            new ExpensesClassification([
                'classificationType' => ExpenseClassificationType::VAT_361,
                'amount' => 10
            ])
        ],
    ]),
]);

$sender = new SendExpensesClassification();
$responseDoc = $sender->handle([$classification]);

I would appreciate your feedback on this. If you need further assistance please let me know.

firebed avatar Jan 26 '25 19:01 firebed