Skip to content

pronamic/wp-twinfield

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

557 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Twinfield library for WordPress

Build Status Coverage Status

Documentation

Timezone

Good to know: The API only uses universal time (UTC). You can check the current time in UTC here: https://time.is/utc

https://wktaaeu.my.site.com/nlcommunity/s/article/API-Best-Practices-Keeping-a-shadow-database-with-customers-and-suppliers?language=en_US

Examples

See the examples/ directory for examples of the key client features. You can view them in your browser by running the php built-in web server.

$ php -S localhost:8000 -t examples/

And then browsing to the host and port you specified (in the above example, http://localhost:8000).

Environment variables

export TWINFIELD_USER=
export TWINFIELD_PASSWORD=
export TWINFIELD_ORGANISATION=
export TWINFIELD_OFFICE_CODE=
export TWINFIELD_ARTICLE_CODE=
export TWINFIELD_SUBARTICLE_CODE=
export TWINFIELD_CUSTOMER_CODE=
export TWINFIELD_SALES_INVOICE_TYPE=
export TWINFIELD_SALES_INVOICE_NUMBER=

Travis CI

travis encrypt TWINFIELD_USER=$TWINFIELD_USER --add env.global
travis encrypt TWINFIELD_PASSWORD=$TWINFIELD_PASSWORD --add env.global
travis encrypt TWINFIELD_ORGANISATION=$TWINFIELD_ORGANISATION --add env.global
travis encrypt TWINFIELD_OFFICE_CODE=$TWINFIELD_OFFICE_CODE --add env.global
travis encrypt TWINFIELD_ARTICLE_CODE=$TWINFIELD_ARTICLE_CODE --add env.global
travis encrypt TWINFIELD_CUSTOMER_CODE=$TWINFIELD_CUSTOMER_CODE --add env.global
travis encrypt TWINFIELD_SALES_INVOICE_TYPE=$TWINFIELD_SALES_INVOICE_TYPE --add env.global
travis encrypt TWINFIELD_SALES_INVOICE_NUMBER=$TWINFIELD_SALES_INVOICE_NUMBER --add env.global

Debug PHP SOAP

var_dump( $this->get_wsdl_url() );
var_dump( $this->soap_client->__getFunctions() );
var_dump( $this->soap_client->__getTypes() );

try {
	$test = $this->soap_client->Query( $test );
} catch ( \Exception $e ) {
	var_dump( $e );
}

echo "REQUEST:\n" . $this->soap_client->__getLastRequest() . "\n";

Plugin

ln -s ~/Projects/wp-twinfield-new  ~/Local\ Sites/twinfield/app/public/wp-content/plugins/pronamic-twinfield

To-do

$client = new Client(
	$client_id,
	$client_secret,
	$redirect_uri
);

$client->set_access_token( ... );

if ( $client->is_access_token_expired() ) {
	
}

$authentication = {}

$authentication->get_user();

$authentication->get_user()->get_organisation();

$authentication->get_organisation();

$authentication->get_cluster_url();

$authentication->get_organisation()->get_offices();

$client = $authentication->get_client();

$client->get_organisation_service();

$offices = $organisation_service->get_offices();

Inspiration

Design Patterns

Architecture

REST API

/wp-json/pronamic-twinfield/v1/user
/wp-json/pronamic-twinfield/v1/organisation
/wp-json/pronamic-twinfield/v1/authentications/1/organisations
/wp-json/pronamic-twinfield/v1/authentications/1/user
/wp-json/pronamic-twinfield/v1/authentications/1/organisation
/wp-json/pronamic-twinfield/v1/organisations/vandermeeracc
/wp-json/pronamic-twinfield/v1/organisations/vandermeeracc/offices/
/wp-json/pronamic-twinfield/v1/organisations/vandermeeracc/offices/66470_A
/wp-json/pronamic-twinfield/v1/organisations/vandermeeracc/offices/66470_A/dimension-types
/wp-json/pronamic-twinfield/v1/organisations/vandermeeracc/offices/66470_A/dimensions/DEB/
/wp-json/pronamic-twinfield/v1/organisations/vandermeeracc/offices/66470_A/dimensions/DEB/1002
/wp-json/pronamic-twinfield/v1/organisations/vandermeeracc/offices/66470_A/declarations
/wp-json/pronamic-twinfield/v1/organisations/vandermeeracc/offices/66470_A/periods

Web

/twinfield/user
/twinfield/organisation
/twinfield/organisations
/twinfield/organisations/vandermeeracc
/twinfield/organisations/vandermeeracc/offices
/twinfield/organisations/vandermeeracc/offices/66470_A
/twinfield/organisations/vandermeeracc/offices/66470_A/dimension-types
/twinfield/organisations/vandermeeracc/offices/66470_A/declarations
/twinfield/organisations/vandermeeracc/offices/66470_A/periods

/twinfield/... » /wp-json/pronamic-twinfield/v1/...

CLI

wp twinfield user
wp twinfield organisation
wp twinfield ... » /wp-json/pronamic-twinfield/v1/...
wp twinfield bank-statement query $( wp twinfield office list --field=code --user=lookup ) --date_from=2022-01-01 --date_to=2023-01-01 --include_posted=true --user=lookup --pull=true
wp twinfield bank-statement query $( wp twinfield office list --field=code ) --date_from=2020-01-01 --date_to=2021-01-01 --include_posted=true --pull=true
wp twinfield bank-statement query 1000 --date_from=2010-01-01 --date_to=2011-01-01 --include_posted=true
wp twinfield bank-statement query 1000 --date_from=2011-01-01 --date_to=2012-01-01 --include_posted=true
wp twinfield bank-statement query 1000 --date_from=2012-01-01 --date_to=2013-01-01 --include_posted=true
wp twinfield bank-statement query $( wp twinfield office list --field=code --exclude=NL001,NLLEEG,ZESJAB,ZESJAB2 ) --date_from=2022-01-01 --date_to=2023-01-01 --include_posted=true --pull=true
wp twinfield bank-statement query $( wp twinfield office list --field=code --exclude=NL001,NLLEEG,ZESJAB,ZESJAB2 ) --date_from="midnight -1 week" --date_to=midnight --include_posted=true --pull=true

Queries

SELECT
	DATE_FORMAT( bank_statement.date, '%Y-%m' ),
	COUNT( bank_statement.id )
FROM
	wp_twinfield_bank_statements AS bank_statement
GROUP BY
	DATE_FORMAT( bank_statement.date, '%Y-%m' )
;

Config

define( 'PRONAMIC_TWINFIELD_CLIENT_ID', , '' );
define( 'PRONAMIC_TWINFIELD_CLIENT_SECRET', '' );
define( 'PRONAMIC_TWINFIELD_REDIRECT_URI', '' );

PSR

Other

Pronamic - Work with us

About

WordPress Twinfield library and plugin.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •