openpesa / laravel-pesa

Laravel Pesa
https://openpesa.github.io/
MIT License
20 stars 9 forks source link

Unable to read key #20

Closed mwangaben closed 2 years ago

mwangaben commented 2 years ago
{
    "message": "Unable to read key",
    "exception": "phpseclib3\\Exception\\NoKeyLoadedException",
    "file": "/Users/benedict/dev/tiketirahisi-api/vendor/phpseclib/phpseclib/phpseclib/Crypt/PublicKeyLoader.php",
    "line": 68,
    "trace": [
        {
            "file": "/Users/benedict/dev/tiketirahisi-api/vendor/openpesa/pesa/src/Pesa.php",
            "line": 176,
            "function": "load",
            "class": "phpseclib3\\Crypt\\PublicKeyLoader",
            "type": "::"
        },
        {
            "file": "/Users/benedict/dev/tiketirahisi-api/vendor/openpesa/pesa/src/Pesa.php",
            "line": 192,
            "function": "encryptKey",
            "class": "Openpesa\\SDK\\Pesa",
            "type": "->"
        },
        {
            "file": "/Users/benedict/dev/tiketirahisi-api/vendor/openpesa/pesa/src/Pesa.php",
            "line": 217,
            "function": "getSession",
            "class": "Openpesa\\SDK\\Pesa",
            "type": "->"
        },
        {
            "file": "/Users/benedict/dev/tiketirahisi-api/vendor/openpesa/pesa/src/Pesa.php",
            "line": 287,
            "function": "getSessionToken",
            "class": "Openpesa\\SDK\\Pesa",
            "type": "->"
        },
        {
            "file": "/Users/benedict/dev/tiketirahisi-api/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php",
            "line": 261,
            "function": "c2b",
            "class": "Openpesa\\SDK\\Pesa",
            "type": "->"
        },
        {
            "file": "/Users/benedict/dev/tiketirahisi-api/app/Http/Controllers/ProcessPaymentController.php",
            "line": 28,
            "function": "__callStatic",
            "class": "Illuminate\\Support\\Facades\\Facade",
            "type": "::"
        },
        {
            "file": "/Users/benedict/dev/tiketirahisi-api/vendor/laravel/framework/src/Illuminate/Routing/Controller.php",
            "line": 54,
            "function": "process",
            "class": "App\\Http\\Controllers\\ProcessPaymentController",
            "type": "->"
        },
        {
            "file": "/Users/benedict/dev/tiketirahisi-api/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php",
            "line": 45,
            "function": "callAction",
            "class": "Illuminate\\Routing\\Controller",
            "type": "->"
        },
        {
            "file": "/Users/benedict/dev/tiketirahisi-api/vendor/laravel/framework/src/Illuminate/Routing/Route.php",
            "line": 262,
            "function": "dispatch",
            "class": "Illuminate\\Routing\\ControllerDispatcher",
            "type": "->"
        },
        {
            "file": "/Users/benedict/dev/tiketirahisi-api/vendor/laravel/framework/src/Illuminate/Routing/Route.php",
            "line": 205,
            "function": "runController",
            "class": "Illuminate\\Routing\\Route",
            "type": "->"
        },
        {
            "file": "/Users/benedict/dev/tiketirahisi-api/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
            "line": 721,
            "function": "run",
            "class": "Illuminate\\Routing\\Route",
            "type": "->"
        },
        {
            "file": "/Users/benedict/dev/tiketirahisi-api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 128,
            "function": "Illuminate\\Routing\\{closure}",
            "class": "Illuminate\\Routing\\Router",
            "type": "->"
        },
        {
            "file": "/Users/benedict/dev/tiketirahisi-api/vendor/laravel/framework/src/Illuminate/Auth/Middleware/Authenticate.php",
            "line": 44,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Users/benedict/dev/tiketirahisi-api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 167,
            "function": "handle",
            "class": "Illuminate\\Auth\\Middleware\\Authenticate",
            "type": "->"
        },
        {
            "file": "/Users/benedict/dev/tiketirahisi-api/vendor/tailflow/laravel-orion/src/Http/Middleware/EnforceExpectsJson.php",
            "line": 21,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Users/benedict/dev/tiketirahisi-api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 167,
            "function": "handle",
            "class": "Orion\\Http\\Middleware\\EnforceExpectsJson",
            "type": "->"
        },
        {
            "file": "/Users/benedict/dev/tiketirahisi-api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 103,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Users/benedict/dev/tiketirahisi-api/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
            "line": 723,
            "function": "then",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Users/benedict/dev/tiketirahisi-api/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
            "line": 698,
            "function": "runRouteWithinStack",
            "class": "Illuminate\\Routing\\Router",
            "type": "->"
        },
        {
            "file": "/Users/benedict/dev/tiketirahisi-api/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
            "line": 662,
            "function": "runRoute",
            "class": "Illuminate\\Routing\\Router",
            "type": "->"
        },
        {
            "file": "/Users/benedict/dev/tiketirahisi-api/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
            "line": 651,
            "function": "dispatchToRoute",
            "class": "Illuminate\\Routing\\Router",
            "type": "->"
        },
        {
            "file": "/Users/benedict/dev/tiketirahisi-api/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",
            "line": 167,
            "function": "dispatch",
            "class": "Illuminate\\Routing\\Router",
            "type": "->"
        },
        {
            "file": "/Users/benedict/dev/tiketirahisi-api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 128,
            "function": "Illuminate\\Foundation\\Http\\{closure}",
            "class": "Illuminate\\Foundation\\Http\\Kernel",
            "type": "->"
        },
        {
            "file": "/Users/benedict/dev/tiketirahisi-api/app/Http/Middleware/TeamsPermissionMiddleware.php",
            "line": 26,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Users/benedict/dev/tiketirahisi-api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 167,
            "function": "handle",
            "class": "App\\Http\\Middleware\\TeamsPermissionMiddleware",
            "type": "->"
        },
        {
            "file": "/Users/benedict/dev/tiketirahisi-api/app/Http/Middleware/Cors.php",
            "line": 21,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Users/benedict/dev/tiketirahisi-api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 167,
            "function": "handle",
            "class": "App\\Http\\Middleware\\Cors",
            "type": "->"
        },
        {
            "file": "/Users/benedict/dev/tiketirahisi-api/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php",
            "line": 21,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Users/benedict/dev/tiketirahisi-api/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php",
            "line": 31,
            "function": "handle",
            "class": "Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest",
            "type": "->"
        },
        {
            "file": "/Users/benedict/dev/tiketirahisi-api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 167,
            "function": "handle",
            "class": "Illuminate\\Foundation\\Http\\Middleware\\ConvertEmptyStringsToNull",
            "type": "->"
        },
        {
            "file": "/Users/benedict/dev/tiketirahisi-api/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php",
            "line": 21,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Users/benedict/dev/tiketirahisi-api/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php",
            "line": 40,
            "function": "handle",
            "class": "Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest",
            "type": "->"
        },
        {
            "file": "/Users/benedict/dev/tiketirahisi-api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 167,
            "function": "handle",
            "class": "Illuminate\\Foundation\\Http\\Middleware\\TrimStrings",
            "type": "->"
        },
        {
            "file": "/Users/benedict/dev/tiketirahisi-api/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php",
            "line": 27,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Users/benedict/dev/tiketirahisi-api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 167,
            "function": "handle",
            "class": "Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize",
            "type": "->"
        },
        {
            "file": "/Users/benedict/dev/tiketirahisi-api/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php",
            "line": 86,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Users/benedict/dev/tiketirahisi-api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 167,
            "function": "handle",
            "class": "Illuminate\\Foundation\\Http\\Middleware\\PreventRequestsDuringMaintenance",
            "type": "->"
        },
        {
            "file": "/Users/benedict/dev/tiketirahisi-api/vendor/fruitcake/laravel-cors/src/HandleCors.php",
            "line": 52,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Users/benedict/dev/tiketirahisi-api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 167,
            "function": "handle",
            "class": "Fruitcake\\Cors\\HandleCors",
            "type": "->"
        },
        {
            "file": "/Users/benedict/dev/tiketirahisi-api/vendor/laravel/framework/src/Illuminate/Http/Middleware/TrustProxies.php",
            "line": 39,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Users/benedict/dev/tiketirahisi-api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 167,
            "function": "handle",
            "class": "Illuminate\\Http\\Middleware\\TrustProxies",
            "type": "->"
        },
        {
            "file": "/Users/benedict/dev/tiketirahisi-api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 103,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Users/benedict/dev/tiketirahisi-api/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",
            "line": 142,
            "function": "then",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Users/benedict/dev/tiketirahisi-api/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",
            "line": 111,
            "function": "sendRequestThroughRouter",
            "class": "Illuminate\\Foundation\\Http\\Kernel",
            "type": "->"
        },
        {
            "file": "/Users/benedict/dev/tiketirahisi-api/public/index.php",
            "line": 52,
            "function": "handle",
            "class": "Illuminate\\Foundation\\Http\\Kernel",
            "type": "->"
        },
        {
            "file": "/Users/benedict/.composer/vendor/laravel/valet/server.php",
            "line": 235,
            "function": "require"
        }
    ]
}
alphaolomi commented 2 years ago

Hello @mwangaben What version of PHP and laravel are you using?

mwangaben commented 2 years ago

Hi @alphaolomi thanks for asking, i am using php8.0.8 and Laravel 9.2

alphaolomi commented 2 years ago

From the stack trace, its an issue with the public key

Using this example to validate the steps https://github.com/alphaolomi/laravel-pesa-demo

Ensure you have not misses a step while setting up setup Also use the correct key and add them in quotes

Usr the correct keys if its sandbox use the valid public key

PESA_PUBLIC_KEY="wrap it in quotes like this"
PESA_API_KEY="like this"
PESA_ENV="sandbox"
mwangaben commented 2 years ago

It is very surprising that i have done all that but it seem not to work can we live coding with VSCode and AnyDesk app

alphaolomi commented 2 years ago

Reach me through telegram.com/alphaolomi for further communication