shetabit / payment

simple laravel payment package , supports multiple drivers
MIT License
834 stars 141 forks source link

Driver source not found. Please update the package #31

Closed yavand closed 4 years ago

yavand commented 4 years ago

Hi, I use this package to handle my payments using zaripal gateway. I got this error recently while I didn't make any changes in my codebase. please help me why this exception was happened? Thanks.

khanzadimahdi commented 4 years ago

hi, what kind of error happened in your project? copy and paste your error here.

khanzadimahdi commented 4 years ago

i got it. in new major update we have changed the payment.php configs. please remove your payment configs from config/payment.php and re-publish it using php artisan vendor:publish command.

khanzadimahdi commented 4 years ago

in your config/payment.php you will see new gateway drivers and configs. enjoy it.

yavand commented 4 years ago

hi, I updated my payment.php file according to your comment, but error still persist.

Shetabit \ Payment \ Exceptions \ DriverNotFoundException Driver source not found. Please update the package.

protected function validateDriver()
    {
        if (empty($this->driver)) {
            throw new DriverNotFoundException('Driver not selected or default driver does not exist.');
        }

        if (empty($this->config['drivers'][$this->driver]) || empty($this->config['map'][$this->driver])) {
            throw new DriverNotFoundException('Driver not found in config file. Try updating the package.');
        }

        if (!class_exists($this->config['map'][$this->driver])) {
            throw new DriverNotFoundException('Driver source not found. Please update the package.');
        }

        $reflect = new \ReflectionClass($this->config['map'][$this->driver]);

        if (!$reflect->implementsInterface(DriverInterface::class)) {
            throw new \Exception("Driver must be an instance of Contracts\DriverInterface.");
        }
    }
khanzadimahdi commented 4 years ago

please send map section from your config/payment.php here. it must be like the below:

    'map' => [
        'asanpardakht' => \Shetabit\Payment\Drivers\Asanpardakht\Asanpardakht::class,
        'behpardakht' => \Shetabit\Payment\Drivers\Behpardakht\Behpardakht::class,
        'idpay' => \Shetabit\Payment\Drivers\Idpay\Idpay::class,
        'irankish' => \Shetabit\Payment\Drivers\Irankish\Irankish::class,
        'nextpay' => \Shetabit\Payment\Drivers\Nextpay\Nextpay::class,
        'parsian' => \Shetabit\Payment\Drivers\Parsian\Parsian::class,
        'payir' => \Shetabit\Payment\Drivers\Payir\Payir::class,
        'payping' => \Shetabit\Payment\Drivers\Payping\Payping::class,
        'paystar' => \Shetabit\Payment\Drivers\Paystar\Paystar::class,
        'poolam' => \Shetabit\Payment\Drivers\Poolam\Poolam::class,
        'sadad' => \Shetabit\Payment\Drivers\Sadad\Sadad::class,
        'saman' => \Shetabit\Payment\Drivers\Saman\Saman::class,
        'yekpay' => \Shetabit\Payment\Drivers\Yekpay\Yekpay::class,
        'zarinpal' => \Shetabit\Payment\Drivers\Zarinpal\Zarinpal::class,
    ]

is it the same ?

yavand commented 4 years ago

map section of config/payment.php

'map' => [
        'zarinpal' => \Shetabit\Payment\Drivers\Zarinpal::class,
        'irankish' => \Shetabit\Payment\Drivers\Irankish::class,
        'saman' => \Shetabit\Payment\Drivers\Saman::class,
    ]

package version: "shetabit/payment": "^1.1"

khanzadimahdi commented 4 years ago

ok. remove the payment.php and re publish it as i told you.

publish it by running : php artisan vendor:publish

or update package to 2.1.2. remove the package and install it again.

khanzadimahdi commented 4 years ago

For persian users:

اگه پکیج رو قبلا استفاده میکردین و الان اپدیت کردین فایل config/payment.php رو پاک کنید و بعدش وندور پابلیش بزنید درست میشه. به دلیل این هست که فایل کانفیگ توی ورژن جدید ساختارش تغییر کرده و هنوز پابلیش نکردین.