Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

خطای Trying to access array offset on value of type null هنگام اتصال به زرین پال #117

Open
hamed-bolhasani opened this issue Nov 30, 2021 · 11 comments
Labels
help wanted Extra attention is needed

Comments

@hamed-bolhasani
Copy link

hamed-bolhasani commented Nov 30, 2021

با سلام.

کد من هنگام اتصال به درگاه بانکی وقتی روی حالت سندباکس هستش بدون مشکل وصل میشه
ولی وقتی روی حالت نرمال میذارمش خطای بالا رو نشون میده

از این فایل vendor/shetabit/multipay/src/Drivers/Zarinpal/Strategies/Normal.php:104
و خط throw new PurchaseFailedException($result['errors']['message'], $result['errors']['code'])

 $result = json_decode($response->getBody()->getContents(), true);

        // some error has happened
        if (!empty($result['errors']) || empty($result['data']) || $result['data']['code'] != 100) {
            throw new PurchaseFailedException($result['errors']['message'], $result['errors']['code']);

        }

ما با استفاده از داکر پروژه رو میسازیم

php version: 7.4

RUN apt-get update &&
apt-get install -y libxml2-dev &&
docker-php-ext-install soap

RUN docker-php-ext-install soap

RUN composer install --no-scripts --no-autoloader --prefer-dist --no-dev
--working-dir=/var/www/html

RUN composer du
RUN mkdir -p ./bootstrap/cache/
RUN chmod -R 777 ./bootstrap/cache/

RUN composer dump-autoload
RUN php artisan cache:clear
RUN php artisan config:clear
RUN php artisan view:clear
RUN php artisan route:clear

اینا رو داخل داکر گذاشتیم

@khanzadimahdi
Copy link
Member

رسپانسی که از زرین پال میاد رو میشه چک کنید؟ مثل اینکه زرین پال رسپانس درستی نمیده

@khanzadimahdi
Copy link
Member

لطفا ورژن پکیجی که استفاده میکنید رو نیز ذکر کنید

همچنین بعد از نصب وندور رو پابلیش کنید

@khanzadimahdi
Copy link
Member

درایور زرین پال توی مسیر زیر موجود هست

https://github.com/shetabit/multipay/tree/master/src/Drivers/Zarinpal/Strategies

لطفا رسپانس زرین پال در حالت نرمال رو چک کنید

@hamed-bolhasani
Copy link
Author

رسپانسی که از زرین پال میاد رو میشه چک کنید؟ مثل اینکه زرین پال رسپانس درستی نمیده

بله چک کردم مقدارش null هست

@hamed-bolhasani
Copy link
Author

hamed-bolhasani commented Nov 30, 2021

لطفا ورژن پکیجی که استفاده میکنید رو نیز ذکر کنید

همچنین بعد از نصب وندور رو پابلیش کنید

"shetabit/payment": "^4.0",

RUN php artisan vendor:publish --provider="Shetabit\Payment\Provider\PaymentServiceProvider"
رو هم اضافه کردیم به داکر و اجرا میکنه پابلیش رو

@hamed-bolhasani
Copy link
Author

hamed-bolhasani commented Nov 30, 2021

درایور زرین پال توی مسیر زیر موجود هست

https://github.com/shetabit/multipay/tree/master/src/Drivers/Zarinpal/Strategies

لطفا رسپانس زرین پال در حالت نرمال رو چک کنید

بله دقیقا همین فایلها رو پکیج نصبی ما داره

احساس میکنم زرین پال ایپی‌آیشو آپدیت کرده و پکیج شما هم نیاز به آپدیت داره

@khanzadimahdi
Copy link
Member

میتونید کار اپدیت رو انجام بدید و درخواست مرج بزارید؟

@hamed-bolhasani
Copy link
Author

میتونید کار اپدیت رو انجام بدید و درخواست مرج بزارید؟

متاسفانه فرصتشو ندارم فعلا

@khanzadimahdi khanzadimahdi added the help wanted Extra attention is needed label Dec 7, 2021
@erfantkerfan
Copy link
Contributor

erfantkerfan commented May 4, 2022

من هم بعضی اوقات داخل normal و روی سرور production این ارور میگیرم و بعضی پرداخت هام تایید نمیشوند

[2022-04-26 13:15:52] production.ERROR: Trying to access array offset on value of type null {"userId":111,"exception":"[object] (ErrorException(code: 0): Trying to access array offset on value of type null at /var/www/ghaem/vendor/shetabit/multipay/src/Drivers/Zarinpal/Strategies/Normal.php:169)
[stacktrace]
#0 /var/www/ghaem/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(231): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError()
#1 /var/www/ghaem/vendor/shetabit/multipay/src/Drivers/Zarinpal/Strategies/Normal.php(169): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->Illuminate\\Foundation\\Bootstrap\\{closure}()
#2 /var/www/ghaem/vendor/shetabit/multipay/src/Drivers/Zarinpal/Zarinpal.php(98): Shetabit\\Multipay\\Drivers\\Zarinpal\\Strategies\\Normal->verify()
#3 /var/www/ghaem/vendor/shetabit/multipay/src/Payment.php(269): Shetabit\\Multipay\\Drivers\\Zarinpal\\Zarinpal->verify()
#4 /var/www/ghaem/app/Http/Controllers/PaymentController.php(189): Shetabit\\Multipay\\Payment->verify()
#5 /var/www/ghaem/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): App\\Http\\Controllers\\PaymentController->verify()
#6 /var/www/ghaem/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(45): Illuminate\\Routing\\Controller->callAction()
#7 /var/www/ghaem/vendor/laravel/framework/src/Illuminate/Routing/Route.php(261): Illuminate\\Routing\\ControllerDispatcher->dispatch()
#8 /var/www/ghaem/vendor/laravel/framework/src/Illuminate/Routing/Route.php(204): Illuminate\\Routing\\Route->runController()
#9 /var/www/ghaem/vendor/laravel/framework/src/Illuminate/Routing/Router.php(725): Illuminate\\Routing\\Route->run()
#10 /var/www/ghaem/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(141): Illuminate\\Routing\\Router->Illuminate\\Routing\\{closure}()
#11 /var/www/ghaem/app/Http/Middleware/Logindate.php(27): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#12 /var/www/ghaem/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): App\\Http\\Middleware\\Logindate->handle()
#13 /var/www/ghaem/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php(50): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#14 /var/www/ghaem/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Routing\\Middleware\\SubstituteBindings->handle()
#15 /var/www/ghaem/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php(78): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#16 /var/www/ghaem/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\VerifyCsrfToken->handle()
#17 /var/www/ghaem/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(49): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#18 /var/www/ghaem/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\View\\Middleware\\ShareErrorsFromSession->handle()
#19 /var/www/ghaem/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(121): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#20 /var/www/ghaem/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(64): Illuminate\\Session\\Middleware\\StartSession->handleStatefulRequest()
#21 /var/www/ghaem/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Session\\Middleware\\StartSession->handle()
#22 /var/www/ghaem/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#23 /var/www/ghaem/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse->handle()
#24 /var/www/ghaem/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(67): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#25 /var/www/ghaem/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Cookie\\Middleware\\EncryptCookies->handle()
#26 /var/www/ghaem/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(116): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#27 /var/www/ghaem/vendor/laravel/framework/src/Illuminate/Routing/Router.php(726): Illuminate\\Pipeline\\Pipeline->then()
#28 /var/www/ghaem/vendor/laravel/framework/src/Illuminate/Routing/Router.php(703): Illuminate\\Routing\\Router->runRouteWithinStack()
#29 /var/www/ghaem/vendor/laravel/framework/src/Illuminate/Routing/Router.php(667): Illuminate\\Routing\\Router->runRoute()
#30 /var/www/ghaem/vendor/laravel/framework/src/Illuminate/Routing/Router.php(656): Illuminate\\Routing\\Router->dispatchToRoute()
#31 /var/www/ghaem/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(167): Illuminate\\Routing\\Router->dispatch()
#32 /var/www/ghaem/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(141): Illuminate\\Foundation\\Http\\Kernel->Illuminate\\Foundation\\Http\\{closure}()
#33 /var/www/ghaem/vendor/laravel/framework/src/Illuminate/Http/Middleware/HandleCors.php(49): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#34 /var/www/ghaem/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Http\\Middleware\\HandleCors->handle()
#35 /var/www/ghaem/vendor/laravel/framework/src/Illuminate/Http/Middleware/TrustProxies.php(39): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#36 /var/www/ghaem/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Http\\Middleware\\TrustProxies->handle()
#37 /var/www/ghaem/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#38 /var/www/ghaem/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php(31): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle()
#39 /var/www/ghaem/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\ConvertEmptyStringsToNull->handle()
#40 /var/www/ghaem/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#41 /var/www/ghaem/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php(40): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle()
#42 /var/www/ghaem/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\TrimStrings->handle()
#43 /var/www/ghaem/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#44 /var/www/ghaem/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize->handle()
#45 /var/www/ghaem/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php(86): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#46 /var/www/ghaem/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\PreventRequestsDuringMaintenance->handle()
#47 /var/www/ghaem/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(116): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#48 /var/www/ghaem/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(142): Illuminate\\Pipeline\\Pipeline->then()
#49 /var/www/ghaem/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(111): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter()
#50 /var/www/ghaem/vendor/laravel/octane/src/ApplicationGateway.php(36): Illuminate\\Foundation\\Http\\Kernel->handle()
#51 /var/www/ghaem/vendor/laravel/octane/src/Worker.php(92): Laravel\\Octane\\ApplicationGateway->handle()
#52 /var/www/ghaem/vendor/laravel/octane/bin/swoole-server(117): Laravel\\Octane\\Worker->handle()
#53 [internal function]: {closure}()
#54 /var/www/ghaem/vendor/laravel/octane/bin/swoole-server(163): Swoole\\Server->start()
#55 {main}
"} 

اطلاعاتی بیشتر از این لاگ نکردم متاسفانه

@khanzadimahdi
Copy link
Member

لطفا روی اون قسمت لاگ بزارید ببینید چی میاد که به نال میخوره. ممکنه به خاطر رسپانس زرین پال باشه. بعضی وقتا داره دیتا رو نال میفرسته سمت کلاینت

@mohammad1383hz
Copy link

سلام وقت بخیر من هم دقیقا همین مشکل دارم از سمت زرین پال ریسپانس هم فرستاده میشه

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants