Git Product home page Git Product logo

aade-mydata's Introduction

ΑΑΔΕ - AADE myDATA

Latest Version on Packagist Total Downloads GitHub Workflow Status PHP Version Require License

Introduction

This package provides an expressive, fluent interface to ΑΑΔΕ myDATA invoicing REST API. It handles almost all the boilerplate code for sending, cancelling and requesting invoices.

Official Documentation

All documentation is available 👉 on our documentation site

Requirements

Version PHP myDATA
^v.4.x 8.1 v1.0.8
^v.3.x 8.1 v1.0.7
^v.2.x 8.1 v1.0.5
^v.1.x 8.0 v1.0.3
  • guzzlehttp/guzzle >= 7.0

Installation

To install through Composer, run the following command:

composer require firebed/aade-mydata

Documentation

Official myDATA webpage: AADE myDATA

Official myDATA documentation: AADE myDATA REST API v1.0.8

In order to use this package, you will need first a user id and a subscription key. You can get these credentials by signing up to mydata rest api.

Development: Sign up to mydata development api

Production: Sign up to mydata production api

Setup

Once you have the user id and the subscription key use the following code to set the environment and the credentials:

$env = "dev"; // For production use "prod"
$user_id = "your-user-id";
$subscription_key = "your-subscription-key";

MyDataRequest::setEnvironment($env);
MyDataRequest::setCredentials($user_id, $subscription_key);

Available methods

For development, you may need to disable client verification if you are not using https:

MyDataRequest::verifyClient(false);

Testing

composer test

Contributing

Please see CONTRIBUTING for details.

Licence

AADE myDATA is licenced under the MIT License.

Copyright 2022 © Okan Giritli

aade-mydata's People

Contributors

apsofabol avatar bugos avatar firebed avatar memisibram avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

aade-mydata's Issues

getExpensesClassifications returns empty results

Hello.
Im using below code to get expenses clasification but returns nothing at all:

    $request = new RequestDocs();
    try {        
        $continuationToken = null;
        do {
            $response = $request->handle(
                dateFrom: $datefrom,
                dateTo: $dateto,
                nextPartitionKey: $continuationToken?->getNextPartitionKey(),
                nextRowKey: $continuationToken?->getNextRowKey()
            );
            $getExpensesClassifications = $response->getExpensesClassifications();
            $continuationToken = $response->getContinuationToken();
        } while ($continuationToken);
    } catch (MyDataException $e) {
           die($e->getMessage());
    }


echo "<pre>";
print_r($getExpensesClassifications);

Usage of $expensesClassifications = $requestedDoc->getExpensesClassifications();

Hello there.
Could you please help me how to use

$expensesClassifications = $requestedDoc->getExpensesClassifications();

in the below example:

use Firebed\AadeMyData\Enums\InvoiceType;
use Firebed\AadeMyData\Exceptions\MyDataException;
use Firebed\AadeMyData\Http\RequestDocs;

MyDataRequest::init($user_id, $subscription_key, $env);
MyDataRequest::verifyClient(false);

    $invoices = [];
    $request = new RequestDocs();
    try {        
        $continuationToken = null;
        do {
            $response = $request->handle(
                dateFrom: $dateFrom,
                dateTo: $dateTo,
                nextPartitionKey: $continuationToken?->getNextPartitionKey(),
                nextRowKey: $continuationToken?->getNextRowKey()
            );
            $checkifempty = $response->getInvoices();
            if($checkifempty!=null && $checkifempty!="undefined"){
            $invoices = array_merge($invoices, $response->getInvoices()->all());
            }else{
                $invoices = $invoices;
            }
            $continuationToken = $response->getContinuationToken();
        } while ($continuationToken);
    } catch (MyDataException $e) {
           die($e->getMessage());
 }


foreach ($invoices as $invoice){
       //......do something
}

Thanks in advance

Integration with Stripe

Awesome package! None of the services my accountant suggested were in English, so I was really happy to find this. I am using stripe, with 2 invoice series.

I guess there isn't a way to automate stripe <> AADE because of all the custom stuff inside AADE. Or have you heard of someone using your package that way?

The documentation is outdated

The documentation for this package is outdated and must be updated.

The official documentation of myData has been updated in December. The new url is here: https://www.aade.gr/sites/default/files/2022-12/myDATA%20API%20Documentation%20v1.0.6_official_erp.pdf

The developer portal has been stopped and the url requests have been changed. The news requests are here: https://www.aade.gr/sites/default/files/2022-12/test_urls_0.pdf.
Unfortunately the old credentials don t work on new urls and I haven' t found a way yet to create new credentials.

You can look here: https://www.aade.gr/epiheiriseis/mydata-ilektronika-biblia-aade/mydata/dokimastiko-periballon for more informations

Also the dev url from here: https://github.com/firebed/aade-mydata/blob/3.x/config/urls.php
must be updated from: https://mydata-dev.azure-api.net/ to: https://mydataapidev.aade.gr

No data back from aade - probably my mistake

Hi, trying to get theRequestTransmittedDocs using this code example:

<?php
require_once __DIR__ . '/vendor/autoload.php';

use Firebed\AadeMyData\Http\MyDataRequest;
use Firebed\AadeMyData\Http\RequestTransmittedDocs;


ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);


$env = "prod"; // For production use "prod"
$user_id = "my-id";
$subscription_key = "my-key";

MyDataRequest::setEnvironment($env);
MyDataRequest::verifyClient(false);
MyDataRequest::setCredentials($user_id, $subscription_key);

$mark = "";
$nextPartitionKey = null;
$nextRowKey = null;

$request = new RequestTransmittedDocs();
$response = $request->handle($mark, $nextPartitionKey, $nextRowKey);

    if ($response) {
            echo "OK!";
            var_dump($response);
    } 

?>

and nothing returns back, is i something that im missing?
$response => object(Firebed\AadeMyData\Models\RequestedDoc)#4 (1) { ["attributes":protected]=> array(0) { } }

Χρήση PHP8.1 enums

Καταρχάς συγχαρητήρια για την πολύ καλή δουλειά και ευχαριστούμε που τη μοιραστήκατε.

Θα ήθελα να ρωτήσω αν θα ήσασταν θετικοί στην μετατροπή των κλάσεων στον φάκελο enums σε PHP 8.1 enumerations, έτσι ώστε να μπορούν να χρησιμοποιηθούν οι μέθοδοι from(int|string) και tryFrom(int|string) που αναφέρονται στο link.

Income Classification

I read in your docs that sending income classifications are not supported yet.

I found the method $invoiceDetails->setIncomeClassification() which expects array $incomeClassification.

So, I assumed it meant to add it manually, I tried as

[
'classificationType'=>IncomeClassificationType::E3_561_006
***
]

and got a type error
So, I tried using new IncomeClassification, both by itself and passing as array of IncomeClassification

I guess I am missing something still? which part do I do myself?

summarizeInvoice() Error with InvoiceType: 9.3

Thanks for the v1.0.8 updates.
First of all, summarizeInvoice() was very necessary, but there is a small error.
If the document is only a transport document, that is, InvoiceType: 9.3, setClassificationType should not be sent because it does not update E3.
In this document type, we only need to declare ClassificationCategory(IncomeClassificationCategory::CATEGORY_3) and setAmount(0).

For now, I changed the 50th line of firebed\aade-mydata\src\Actions\GroupClassifications.php to this way.

if($type != null) $icls->setClassificationType($type);

everything seems okay.

Some considerations...

Thank you for taking the time to write and publish your library, it can be quite useful to some devs.

I've got some considerations:

  • PHP 8.1 not being used in production systems (at least none that I manage). I still use PHP 7.4 in most production systems, with some very few exceptions running 8.0. The reason is simple, these are the versions supported by Redhat RHEL and derivative enterprise linux distros (Alma, Rocky, Oracle). They are going to stick with PHP 7.4 and 8.0 for the next 8 years or so. So your requirement for PHP 8.1 makes your library impossible to use.

  • guzzlehttp should not be a requirement. Many companies have strict regulations about the kind of external code they allow in their systems. Thus, PHP's own curl functions are preferred over the external library guzzlehttp.

It would be helpful, if you could backport your library for PHP 7.4 and if guzzlehttp is not installed, then fallback to plain curl functions. That way, your library would be usable by a lot more projects!

Thank you.

Get continuationToken length

  1. Is there a way to get the length of continuation tokens?

  2. Is there a way to keep requesting until all continuation tokens used?

  3. Thanks in advance

Till now im using

$requestdet = new RequestTransmittedDocs();
try {
  $responsedet = $requestdet->handle(

      dateFrom: $datefrom,
      dateTo: $dateto
  );
  $continuationTokendet = $responsedet->getContinuationToken();
         $myarrdet1 = $responsedet->attributes();
       $myarrdet1 = $myarrdet1['invoicesDoc']->attributes();
       $myarrdet1 = $myarrdet1['invoice'];
          if($continuationTokendet!=null){
        $requestdet2 = new RequestTransmittedDocs();
        $responsedet2 = $requestdet2->handle(

          dateFrom: $datefrom,
          dateTo: $dateto,
        nextPartitionKey: $continuationTokendet->getNextPartitionKey(),
        nextRowKey: $continuationTokendet->getNextRowKey(),
        );
         $myarrdet2 = $responsedet2->attributes();
       $myarrdet2 = $myarrdet2['invoicesDoc']->attributes();
       $myarrdet2 = $myarrdet2['invoice'];
        
        $continuationTokendet2 = $responsedet2->getContinuationToken();
            if($continuationTokendet2!=null){
            $requestdet3 = new RequestTransmittedDocs();
            $responsedet3 = $requestdet3->handle(
              dateFrom: $datefrom,
              dateTo: $dateto,
            nextPartitionKey: $continuationTokendet2->getNextPartitionKey(),
            nextRowKey: $continuationTokendet2->getNextRowKey(),
            );          
         $myarrdet3 = $responsedet3->attributes();
       $myarrdet3 = $myarrdet3['invoicesDoc']->attributes();
       $myarrdet3 = $myarrdet3['invoice'];
       $continuationTokendet3 = $responsedet3->getContinuationToken();
                   if($continuationTokendet3!=null){
                        $requestdet4 = new RequestTransmittedDocs();
                        $responsedet4 = $requestdet4->handle(
                          dateFrom: $datefrom,
                          dateTo: $dateto,
                        nextPartitionKey: $continuationTokendet3->getNextPartitionKey(),
                        nextRowKey: $continuationTokendet3->getNextRowKey(),
                        );          
                     $myarrdet4 = $responsedet4->attributes();
                   $myarrdet4 = $myarrdet4['invoicesDoc']->attributes();
                   $myarrdet4 = $myarrdet4['invoice'];
                   $continuationTokendet4 = $responsedet4->getContinuationToken();
                         if($continuationTokendet4!=null){
                             $requestdet5 = new RequestTransmittedDocs();
                        $responsedet5 = $requestdet5->handle(
                          dateFrom: $datefrom,
                          dateTo: $dateto,
                        nextPartitionKey: $continuationTokendet4->getNextPartitionKey(),
                        nextRowKey: $continuationTokendet4->getNextRowKey(),
                        );          
                             $myarrdet5 = $responsedet5->attributes();
                           $myarrdet5 = $myarrdet5['invoicesDoc']->attributes();
                           $myarrdet5 = $myarrdet5['invoice'];
                        $myarrdet = array_merge_recursive($myarrdet1,$myarrdet2);
                         $myarrdet= array_merge_recursive($myarrdet,$myarrdet3);
                         $myarrdet= array_merge_recursive($myarrdet,$myarrdet4);
                         $myarrdet= array_merge_recursive($myarrdet,$myarrdet5);
                         }else{
                $myarrdet = array_merge_recursive($myarrdet1,$myarrdet2);
                 $myarrdet= array_merge_recursive($myarrdet,$myarrdet3);
                 $myarrdet= array_merge_recursive($myarrdet,$myarrdet4);        
                         }
                   }else{
            $myarrdet = array_merge_recursive($myarrdet1,$myarrdet2);
             $myarrdet= array_merge_recursive($myarrdet,$myarrdet3);
                   }

            }else{
                $myarrdet = array_merge_recursive($myarrdet1,$myarrdet2);
            }
        
        }else{
            $myarrdet = $myarrdet1;
        }
        }

which is not convenient...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.