2017 © Pedro Peláez
 

library twinfield

Library for using the Twinfield Soap Service.

image

atanenl/twinfield

Library for using the Twinfield Soap Service.

  • Friday, February 10, 2017
  • by oosterhuisd
  • Repository
  • 3 Watchers
  • 0 Stars
  • 11,439 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 41 Forks
  • 1 Open issues
  • 18 Versions
  • 17 % Grown

The README.md

Twinfield Build Status

A PHP library for Twinfield Integration. Developed by Remco Tolsma and Leon Rowland from Pronamic. Use the Twinfield SOAP Service to have your PHP application communicate directly with your Twinfield account., (*1)


Autoloading

The classes follow the PSR2 naming convention., (*2)

Usage

General Usage Information

Components will have Factories to simplify the request and send process of Twinfield. Each factory will require just the \Pronamic\Twinfield\Secure\Config() class with the filled in details., (*3)

An example of the usage of the Configuration class., (*4)

$config = new \Pronamic\Twinfield\Secure\Config();
$config->setCredentials('Username', 'Password', 'Organization', 'Office');
  • or, when using OAuth:
$config = new \Pronamic\Twinfield\Secure\Config();
$config->setOAuthParameters('clientID', 'clientSecret', 'returnURL', 'Organization', 'Office', true);
//the true parameter at the end tells the system to automatically redirect to twinfield to login

Now, to the current modules, (*5)

In the following example, we will use the Customer component as showcase. Although this will be the method for all components ( including Invoice currently ), (*6)

Typically it is as follows, if using the Factories, (*7)

  • Add/Edit: Make Object, Make Factory, Give object in Submit method of related factory.
  • Retrieve: Make Factory, Supply all required params to respective listAll() and get() methods

Add/Edit

Make your Customer object, (*8)

$customer = new \Pronamic\Twinfield\Customer\Customer();
$customer
    ->setID(10666)
    ->setName('Leon Rowland')
    ->setType('DEB')
    ->setWebsite('http://leon.rowland.nl')
    ->setEBilling(true)
    ->setEBillMail('leon@rowland.nl')
    ->setVatCode('VL')
    ->setDueDays(10)
    ->setCocNumber('12341234');

Customers can have addresses associated with them, (*9)

$customerAddress = new \Pronamic\Twinfield\Customer\CustomerAddress();
$customerAddress
    ->setDefault(false)
    ->setType('invoice')
    ->setField1('Testing field 1')
    ->setField2('Testing field 2')
    ->setField3('Testing field 3')
    ->setPostcode('1212 AB')
    ->setCity('TestCity')
    ->setCountry('NL')
    ->setTelephone('010-12345')
    ->setFax('010-1234')
    ->setEmail('test@email.com');

Assign that address to the customer, (*10)

$customer->addAddress($customerAddress);

Now lets submit it!, (*11)

use \Pronamic\Twinfield\Customer as TwinfieldCustomer;

// Config object prepared and passed to the CustomerFactory
$customerFactory = new TwinfieldCustomer\CustomerFactory($config);

//$customer = new TwinfieldCustomer\Customer();

// Attempt to send the Customer document
if($customerFactory->send($customer)){
    // Use the Mapper to turn the response back into a TwinfieldCustomer\Customer
    $successfulCustomer = TwinfieldCustomer\Mapper\CustomerMapper::map($customerFactory->getResponse());
}

Retrieve/Request

You can get all customers or get a single one currently., (*12)

use \Pronamic\Twinfield\Customer as TwinfieldCustomer;

// Config object prepared and passed into the CustomerFactory
$customerFactory = new TwinfieldCustomer\CustomerFactory($config);

$customers = $customerFactory->listAll();

At the moment, listAll will return an array of just name and short name., (*13)


$customer = $customerFactory->get('customerCode', 'office[optional]');

The response from get() will be a \Pronamic\Twinfield\Customer\Customer object., (*14)

Notes

Advanced documentation coming soon. Detailing usage without the Factory class. Giving you more control with the response and data as well as more in-depth examples and usage recommendations., (*15)

Contribute

You can contribute to the development of this project. Try and keep to the way of doing things as the other 2 components have implemented., (*16)

A large requirement is to maintain backwards compatibility so if you have any plans for large restructure or alteration please bring up in an issue first., (*17)

Component get() listAll() send() Mapper Namespace
Customer :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: Pronamic/Twinfield/Customer
Project :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: Pronamic/Twinfield/Project
Sales Invoices :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: Pronamic/Twinfield/Invoice
Transactions: Purchase :white_check_mark:
browse code 020
:white_check_mark: Pronamic/Twinfield/PurchaseInvoice
Transactions: Sale :white_check_mark: Pronamic/Twinfield/Transaction
Articles Pronamic/Twinfield/Article
Balance Sheets Pronamic/Twinfield/BalanceSheet
Suppliers Pronamic/Twinfield/Supplier
Dimension Groups Pronamic/Twinfield/Dimension/Group
Dimension Types :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: Pronamic/Twinfield/DimensionType
Offices :white_check_mark: Pronamic/Twinfield/Office
Vat types :white_check_mark: Pronamic/Twinfield/VatCode

Build

  • npm install
  • composer install

Authors

License

Copyright 2009-2013 Pronamic., (*18)

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version., (*19)

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details., (*20)

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA, (*21)

The Versions

10/02 2017

dev-master

9999999-dev http://atane.nl

Library for using the Twinfield Soap Service.

  Sources   Download

GPL

The Requires

  • php >=5.4

 

The Development Requires

by Daniël Oosterhuis
by Leon Rowland

twinfield

06/01 2017

0.1.5

0.1.5.0 http://atane.nl

Library for using the Twinfield Soap Service.

  Sources   Download

GPL

The Requires

  • php >=5.4

 

The Development Requires

by Daniël Oosterhuis
by Leon Rowland

twinfield

15/12 2016

0.1.4

0.1.4.0 http://atane.nl

Library for using the Twinfield Soap Service.

  Sources   Download

GPL

The Requires

  • php >=5.4

 

The Development Requires

by Daniël Oosterhuis
by Leon Rowland

twinfield

08/09 2016

0.1.3

0.1.3.0 http://atane.nl

Library for using the Twinfield Soap Service.

  Sources   Download

GPL

The Requires

  • php >=5.4

 

The Development Requires

by Daniël Oosterhuis
by Leon Rowland

twinfield

12/08 2016

0.1.2

0.1.2.0 http://atane.nl

Library for using the Twinfield Soap Service.

  Sources   Download

GPL

The Requires

  • php >=5.4

 

The Development Requires

by Daniël Oosterhuis
by Leon Rowland

twinfield

14/06 2016

0.1.1

0.1.1.0 http://atane.nl

Library for using the Twinfield Soap Service.

  Sources   Download

GPL

The Requires

  • php >=5.4

 

The Development Requires

by Daniël Oosterhuis
by Leon Rowland

twinfield

26/05 2016

0.1.0

0.1.0.0 http://atane.nl

Library for using the Twinfield Soap Service.

  Sources   Download

GPL

The Requires

  • php >=5.4

 

The Development Requires

by Daniël Oosterhuis
by Leon Rowland

twinfield

10/05 2016

0.0.9

0.0.9.0 http://atane.nl

Library for using the Twinfield Soap Service.

  Sources   Download

GPL

The Requires

  • php >=5.4

 

The Development Requires

by Daniël Oosterhuis
by Leon Rowland

twinfield

10/05 2016

0.0.7

0.0.7.0 http://atane.nl

Library for using the Twinfield Soap Service.

  Sources   Download

GPL

The Requires

  • php >=5.4

 

The Development Requires

by Daniël Oosterhuis
by Leon Rowland

twinfield

10/05 2016

0.0.8

0.0.8.0 http://atane.nl

Library for using the Twinfield Soap Service.

  Sources   Download

GPL

The Requires

  • php >=5.4

 

The Development Requires

by Daniël Oosterhuis
by Leon Rowland

twinfield

10/05 2016

0.0.6

0.0.6.0 http://atane.nl

Library for using the Twinfield Soap Service.

  Sources   Download

GPL

The Requires

  • php >=5.4

 

The Development Requires

by Daniël Oosterhuis
by Leon Rowland

twinfield

10/05 2016

0.0.5

0.0.5.0 http://atane.nl

Library for using the Twinfield Soap Service.

  Sources   Download

GPL

The Requires

  • php >=5.4

 

The Development Requires

by Daniël Oosterhuis
by Leon Rowland

twinfield

11/04 2016

0.0.4

0.0.4.0 http://atane.nl

Library for using the Twinfield Soap Service.

  Sources   Download

GPL

The Requires

  • php >=5.4

 

The Development Requires

by Daniël Oosterhuis
by Leon Rowland

twinfield

11/04 2016

0.0.3

0.0.3.0 http://atane.nl

Library for using the Twinfield Soap Service.

  Sources   Download

GPL

The Requires

  • php >=5.4

 

The Development Requires

by Daniël Oosterhuis
by Leon Rowland

twinfield

08/04 2016

0.0.2

0.0.2.0 http://pronamic.nl

Library for using the Twinfield Soap Service.

  Sources   Download

GPL

The Requires

  • php >=5.4

 

The Development Requires

by Daniël Oosterhuis
by Leon Rowland

twinfield

21/03 2016

dev-local

dev-local http://pronamic.nl

Library for using the Twinfield Soap Service.

  Sources   Download

GPL

The Requires

  • php >=5.4

 

The Development Requires

by Daniël Oosterhuis
by Leon Rowland

twinfield

22/01 2016

dev-develop

dev-develop http://pronamic.nl

Library for using the Twinfield Soap Service.

  Sources   Download

GPL

The Requires

  • php >=5.4

 

The Development Requires

by Leon Rowland

twinfield

27/03 2013

0.0.1

0.0.1.0 http://pronamic.nl

Library for using the Twinfield Soap Service

  Sources   Download

GPL

The Requires

  • php >=5.4

 

by Leon Rowland

twinfield