Coder Social home page Coder Social logo

parasut's Introduction

Parasut

An easy-to-use Parasut's API with PHP.

Latest Version on Packagist Software License Build Status

Install

Via Composer

$ composer require mayoz/parasut

Usage

The following gateways are provided by this documentation:

<?php

include 'vendor/autoload.php';

use Parasut\Client;

// create a new client instance
$parasut = new Client([
    'client_id'     => 'YOUR-CLIENT-ID',
    'client_secret' => 'YOUR-CLIENT-SECRET',
    'username'      => 'YOUR-USERNAME',
    'password'      => 'YOUR-PASSWORD',
    'company_id'    => 'YOUR-COMPANY-ID',
    'grant_type'    => 'password',
    'redirect_uri'  => 'urn:ietf:wg:oauth:2.0:oob',
]);

// authorization request
$parasut->authorize();

// create a new contact
$contact = $parasut->make('contact')->create([
    'name'         => 'ABC LTD. STI.',
    'contact_type' => 'company',
    'email'        => '[email protected]',
    'tax_number'   => '1234567890',
    'tax_office'   => 'Beyoglu',
    'category_id'  => null,
    'address_attributes' => [
        'address' => 'Guzel Mahalle Istanbul',
        'phone'   => '123 123 4567'
        'fax'     => null,
    ],
    'contact_people_attributes' => [
        [
            'name'  => 'Ahmet Bilir',
            'phone' => '532 123 4567',
            'email' => '[email protected]',
            'notes' => 'Muhasebe Sorumlusu',
        ],
    ],
]);

// the contact token value
$contactToken = $contact['contact']['id'];

// create a new purchase bill
$purchase = $parasut->make('purchase')->create([
    'description'    => 'Büyük tedarikçi techizat alımı',
    'invoice_id'     => '1',
    'invoice_series' => 'A',
    'item_type'      => 'invoice',
    'issue_date'     => '2016-01-15',
    'contact_id'     => $contactToken,
    'category_id'    => null,
    'archived'       => null,
    'details_attributes' => [
        [
            'product_id'     => 9, // the parasut products
            'quantity'       => 1,
            'unit_price'     => 100,
            'vat_rate'       => 18,
            'discount_type'  => 'amount',
            'discount_value' => 0,
        ],
    ],
]);

// the billing token value
$purchaseToken = $purchase['purchase_invoice']['id'];

// pay the bill
$paid = $parasut->make('purchase')->paid($purchaseToken, [
    'account_id'    => 12,
    'amount'        => 118,
    'exchange_rate' => '1.0'
    'date'          => '2016-01-20',
    'description'   => 'Your paid description',
]);

var_dump($paid);

For general usage instructions, please see the main Parasut api documentation.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

parasut's People

Contributors

grafikri avatar mayoz avatar yedincisenol avatar

Watchers

 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.