Giter VIP home page Giter VIP logo

php-fon-webservices's Introduction

csoellinger/php-fon-webservices

PHP library to handle (BMF)FinanzOnline webservices.

Source Code Download Package PHP Programming Language Read License Package downloads on Packagist Build status Psalm Type Coverage Codecov Code Coverage


About

Supported webservices for now:

  • Session
  • VatID check
  • Databox download
  • File upload
  • Bank data transmission

To be done:

  • Query data transmission
  • Record keeping
  • Cash register

Installation

Install this package as a dependency using Composer.

composer require csoellinger/php-fon-webservices

Usage


Session Webservice

This webservice is needed for all other webservices but can also be used standalone (e.g. for using it with a service which is not supported by this library at the moment). Before you can use it you need to set up a credential class with all necessary informations.

<?php

$tId = 'abcd45678'; // FinanzOnline Teilnehmer-ID
$tUid = 'abcd45678'; // FinanzOnline Teilnehmer-UID (if available, otherwise leave blank)
$benId = 'abcd45678'; // FinanzOnline Benutzer-ID
$benPin = 'abcd45678'; // FinanzOnline Benutzer-PIN

$credential = new FonCredential($tId, $tUid, $benId, $benPin);

// Initialize
$sessionWs = new SessionWs($credential);

// Login
$sessionWs->login();

// Get session id
$sessionId = $sessionWs->getID();

// optional: logout. Not really needed cause you will be logged off at class destruct.
$sessionWs->logout();

VatID Check Webservice

Check a vat id (value added tax identification) for validity at two levels. First only return valid or not valid, second also return the company name and address if available.

// Initialize with previous created session webservice

/** @var SessionWs $sessionWs */
$checkVatIdWs = new VatIdCheckWs($sessionWs);

// Check at level one only returns valid
var_dump($checkVatIdWs->check('ATU36975500'));
/**
 * CSoellinger\FonWebservices\Result\VatIdCheck\ValidLevelOne
 *   valid => (bool) true
 */

// At level two you also get name and address of the organisation if available
var_dump($checkVatIdWs->check('ATU36975500', 2));
/**
 * CSoellinger\FonWebservices\Result\VatIdCheck\ValidLevelTwo
 *   name => (string) 'McDonald's Franchise GmbH'
 *   address => (string) 'Campus 21,Liebermannst A01601 AT-2345 Brunn am Gebirge'
 *   valid => (bool) true
 */

Databox Download Webservice

// Initialize with previous created session webservice

/** @var SessionWs $sessionWs */
$databoxDownloadWs = new DataboxDownloadWs($sessionWs);

// Get a list of your databox
$databoxList = $databoxDownloadWs->get();
var_dump($databoxList);
/**
 * array
 *   0 =>
 *     CSoellinger\FonWebservices\Result\DataboxDownload\ListItem
 *       stnr => (string) '99 999/9999'
 *       name => (string) 'Mustermann Max'
 *       anbringen => (string) 'STB-ZUSI'
 *       zrvon => (string) ''
 *       zrbis => (string) ''
 *       datbesch => (string) '2019-07-15+02:00'
 *       erltyp => (string) 'B'
 *       fileart => (string) 'PDF'
 *       ts_zust => (string) '2020-11-02T07:04:10.044+01:00'
 *       applkey => (string) '2019-07-15-11.45.07.000000'
 *       filebez => (string) '99_9999999_B_2008-11-20_2008-11-20-100948804630.PDF'
 *       status => (string) ''
 */

// Get one entry by the applkey
$entry = $databoxDownloadWs->getEntry($databoxList[0]->applkey);
var_dump($entry);
/**
 * (string) 'JVBERi0xLjQNJeLjz9MNCjYgMCBvYmoNPDwvTGluZWFyaXplZCAxL0wgNTk1Ny9PIDgvRSAxNzAzL'...
 */

Example(s)

The easiest way to start the examples is to start a PHP server:

php -S localhost:8005 --docroot ./public

Now open your browser and go to http://localhost:8005

Documentation

Markdown

Contributing

Contributions are welcome! To contribute, please familiarize yourself with CONTRIBUTING.md.

If you found a bug or have an idea feel free to post it here on github.

Copyright and License

The csoellinger/php-fon-webservices library is free and unencumbered software released into the public domain. Please see UNLICENSE for more information.

php-fon-webservices's People

Contributors

csoellinger-ids avatar dependabot[bot] avatar zerogiven avatar

Stargazers

 avatar

Watchers

 avatar  avatar

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.