langleyfoxall / xero-laravel

💸 Access the Xero accounting system using an Eloquent-like syntax
https://packagist.org/packages/langleyfoxall/xero-laravel
GNU Lesser General Public License v3.0
85 stars 40 forks source link

Implement disconnect method #32

Open jbardnz opened 4 years ago

jbardnz commented 4 years ago

Hey,

The calcinai/xero-php package has added a disconnect() which is required by Xero on OAuth2 applications: https://developer.xero.com/documentation/oauth2/auth-flow#disconnect

The disconnect method is documented at the bottom of this example: https://github.com/calcinai/xero-php/blob/9b248a1b27d026d8265975354afeb2c2be978c45/examples/demo.php

Are you able to add this method to this package as well?

kamleshDefsys commented 4 years ago

Hello.

Can we please add this method in LangleyFoxall\XeroLaravel\OAuth2.php and upgrade the package ?

public function disconnect(AccessTokenInterface $accessToken,$connectionId)
    {
        return $this->getProvider()->disconnect($accessToken,$connectionId);
    }

temporary solution to override this file until package is updated. update composer.json with this two lines --exclude-from-classmap --files

copy the file into app/Overrides/ folder without changing the namesapce.

"autoload": {
        "psr-4": {
            "App\\": "app/"
        },
        "classmap": [
            "database/seeds",
            "database/factories"
        ],
        "exclude-from-classmap": ["vendor/langleyfoxall/xero-laravel/src/OAuth2.php"],
        "files": ["app/Overrides/OAuth2.php"]
    },

finally don't forget to run the composer dump-autoload.

acirinelli commented 2 years ago

https://github.com/langleyfoxall/xero-laravel/pull/56