Skip to content
This repository has been archived by the owner on May 23, 2021. It is now read-only.

fix: PHP Card exception to newer API reference #19

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

jackbayliss
Copy link

Changed card exception to newer reference to prevent errors.

Changed card exception to newer reference.
@jackbayliss jackbayliss changed the title fix: Card exception to newer API reference fix: PHP Card exception to newer API reference Mar 20, 2020
@thorsten-stripe
Copy link
Contributor

Thanks, @jackbayliss, however this also requires an upgrade of the Stripe PHP libraries. Do you want to do that also? If not I can open a separate PR and close this one out.

@jackbayliss
Copy link
Author

jackbayliss commented Mar 24, 2020

@thorsten-stripe I've updated the stripe/stripe-php library to 7.27. I don't know how I missed it haha.

@thorsten-stripe
Copy link
Contributor

Sorry for the delay, and sorry for only now realising that accessing the error code and message have also changed 🙈 , e.g. $e->getError()->code

@jackbayliss
Copy link
Author

jackbayliss commented Mar 30, 2020

@thorsten-stripe No problem, I've changed the error / message accessing to the new method too :)

hibariya added a commit to hibariya/accept-a-card-payment that referenced this pull request May 6, 2021
* Use `isset` to suppress warning messages
* Hard-code the logger name because `$c->get('settings')['logger']` was `NULL`
* Updated stripe-php to the latest version to fix TypeError below

> web_1     | Type: TypeError
> web_1     | Message: array_key_exists(): Argument stripe-archive#2 ($array) must be of type array, Stripe\Util\CaseInsensitiveArray given
> web_1     | File: /work/decline-on-card-authentication/server/php-slim/vendor/stripe/stripe-php/lib/ApiRequestor.php
> web_1     | Line: 402
> web_1     | Trace: #0 /work/decline-on-card-authentication/server/php-slim/vendor/stripe/stripe-php/lib/ApiRequestor.php(402): array_key_exists('request-id', Object(Stripe\Util\CaseInsensitiveArray))
> web_1     | stripe-archive#1 /work/decline-on-card-authentication/server/php-slim/vendor/stripe/stripe-php/lib/ApiRequestor.php(125): Stripe\ApiRequestor->_requestRaw('post', '/v1/payment_int...', Array, Array)
> web_1     | stripe-archive#2 /work/decline-on-card-authentication/server/php-slim/vendor/stripe/stripe-php/lib/ApiOperations/Request.php(57): Stripe\ApiRequestor->request('post', '/v1/payment_int...', Array, Array)
> web_1     | stripe-archive#3 /work/decline-on-card-authentication/server/php-slim/vendor/stripe/stripe-php/lib/ApiOperations/Create.php(23): Stripe\ApiResource::_staticRequest('post', '/v1/payment_int...', Array, NULL)
> web_1     | stripe-archive#4 /work/decline-on-card-authentication/server/php-slim/index.php(59): Stripe\PaymentIntent::create(Array)
> web_1     | stripe-archive#5 [internal function]: Closure->{closure}(Object(Slim\Http\Request), Object(Slim\Http\Response), Array)
> web_1     | stripe-archive#6 /work/decline-on-card-authentication/server/php-slim/vendor/slim/slim/Slim/Handlers/Strategies/RequestResponse.php(40): call_user_func(Object(Closure), Object(Slim\Http\Request), Object(Slim\Http\Response), Array)
> web_1     | stripe-archive#7 /work/decline-on-card-authentication/server/php-slim/vendor/slim/slim/Slim/Route.php(281): Slim\Handlers\Strategies\RequestResponse->__invoke(Object(Closure), Object(Slim\Http\Request), Object(Slim\Http\Response), Array)
> web_1     | stripe-archive#8 /work/decline-on-card-authentication/server/php-slim/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(117): Slim\Route->__invoke(Object(Slim\Http\Request), Object(Slim\Http\Response))
> web_1     | stripe-archive#9 /work/decline-on-card-authentication/server/php-slim/vendor/slim/slim/Slim/Route.php(268): Slim\Route->callMiddlewareStack(Object(Slim\Http\Request), Object(Slim\Http\Response))
> web_1     | stripe-archive#10 /work/decline-on-card-authentication/server/php-slim/vendor/slim/slim/Slim/App.php(503): Slim\Route->run(Object(Slim\Http\Request), Object(Slim\Http\Response))
> web_1     | stripe-archive#11 /work/decline-on-card-authentication/server/php-slim/index.php(32): Slim\App->__invoke(Object(Slim\Http\Request), Object(Slim\Http\Response))
> web_1     | stripe-archive#12 [internal function]: Closure->{closure}(Object(Slim\Http\Request), Object(Slim\Http\Response), Object(Slim\App))
> web_1     | stripe-archive#13 /work/decline-on-card-authentication/server/php-slim/vendor/slim/slim/Slim/DeferredCallable.php(57): call_user_func_array(Object(Closure), Array)
> web_1     | stripe-archive#14 [internal function]: Slim\DeferredCallable->__invoke(Object(Slim\Http\Request), Object(Slim\Http\Response), Object(Slim\App))
> web_1     | stripe-archive#15 /work/decline-on-card-authentication/server/php-slim/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(70): call_user_func(Object(Slim\DeferredCallable), Object(Slim\Http\Request), Object(Slim\Http\Response), Object(Slim\App))
> web_1     | stripe-archive#16 /work/decline-on-card-authentication/server/php-slim/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(117): Slim\App->Slim\{closure}(Object(Slim\Http\Request), Object(Slim\Http\Response))
> web_1     | stripe-archive#17 /work/decline-on-card-authentication/server/php-slim/vendor/slim/slim/Slim/App.php(392): Slim\App->callMiddlewareStack(Object(Slim\Http\Request), Object(Slim\Http\Response))
> web_1     | stripe-archive#18 /work/decline-on-card-authentication/server/php-slim/vendor/slim/slim/Slim/App.php(297): Slim\App->process(Object(Slim\Http\Request), Object(Slim\Http\Response))
> web_1     | stripe-archive#19 /work/decline-on-card-authentication/server/php-slim/index.php(86): Slim\App->run()
cjavilla-stripe pushed a commit that referenced this pull request May 6, 2021
* Not necessary for CI anymore

* Fix php-slim samples

* Use `isset` to suppress warning messages
* Hard-code the logger name because `$c->get('settings')['logger']` was `NULL`
* Updated stripe-php to the latest version to fix TypeError below

> web_1     | Type: TypeError
> web_1     | Message: array_key_exists(): Argument #2 ($array) must be of type array, Stripe\Util\CaseInsensitiveArray given
> web_1     | File: /work/decline-on-card-authentication/server/php-slim/vendor/stripe/stripe-php/lib/ApiRequestor.php
> web_1     | Line: 402
> web_1     | Trace: #0 /work/decline-on-card-authentication/server/php-slim/vendor/stripe/stripe-php/lib/ApiRequestor.php(402): array_key_exists('request-id', Object(Stripe\Util\CaseInsensitiveArray))
> web_1     | #1 /work/decline-on-card-authentication/server/php-slim/vendor/stripe/stripe-php/lib/ApiRequestor.php(125): Stripe\ApiRequestor->_requestRaw('post', '/v1/payment_int...', Array, Array)
> web_1     | #2 /work/decline-on-card-authentication/server/php-slim/vendor/stripe/stripe-php/lib/ApiOperations/Request.php(57): Stripe\ApiRequestor->request('post', '/v1/payment_int...', Array, Array)
> web_1     | #3 /work/decline-on-card-authentication/server/php-slim/vendor/stripe/stripe-php/lib/ApiOperations/Create.php(23): Stripe\ApiResource::_staticRequest('post', '/v1/payment_int...', Array, NULL)
> web_1     | #4 /work/decline-on-card-authentication/server/php-slim/index.php(59): Stripe\PaymentIntent::create(Array)
> web_1     | #5 [internal function]: Closure->{closure}(Object(Slim\Http\Request), Object(Slim\Http\Response), Array)
> web_1     | #6 /work/decline-on-card-authentication/server/php-slim/vendor/slim/slim/Slim/Handlers/Strategies/RequestResponse.php(40): call_user_func(Object(Closure), Object(Slim\Http\Request), Object(Slim\Http\Response), Array)
> web_1     | #7 /work/decline-on-card-authentication/server/php-slim/vendor/slim/slim/Slim/Route.php(281): Slim\Handlers\Strategies\RequestResponse->__invoke(Object(Closure), Object(Slim\Http\Request), Object(Slim\Http\Response), Array)
> web_1     | #8 /work/decline-on-card-authentication/server/php-slim/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(117): Slim\Route->__invoke(Object(Slim\Http\Request), Object(Slim\Http\Response))
> web_1     | #9 /work/decline-on-card-authentication/server/php-slim/vendor/slim/slim/Slim/Route.php(268): Slim\Route->callMiddlewareStack(Object(Slim\Http\Request), Object(Slim\Http\Response))
> web_1     | #10 /work/decline-on-card-authentication/server/php-slim/vendor/slim/slim/Slim/App.php(503): Slim\Route->run(Object(Slim\Http\Request), Object(Slim\Http\Response))
> web_1     | #11 /work/decline-on-card-authentication/server/php-slim/index.php(32): Slim\App->__invoke(Object(Slim\Http\Request), Object(Slim\Http\Response))
> web_1     | #12 [internal function]: Closure->{closure}(Object(Slim\Http\Request), Object(Slim\Http\Response), Object(Slim\App))
> web_1     | #13 /work/decline-on-card-authentication/server/php-slim/vendor/slim/slim/Slim/DeferredCallable.php(57): call_user_func_array(Object(Closure), Array)
> web_1     | #14 [internal function]: Slim\DeferredCallable->__invoke(Object(Slim\Http\Request), Object(Slim\Http\Response), Object(Slim\App))
> web_1     | #15 /work/decline-on-card-authentication/server/php-slim/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(70): call_user_func(Object(Slim\DeferredCallable), Object(Slim\Http\Request), Object(Slim\Http\Response), Object(Slim\App))
> web_1     | #16 /work/decline-on-card-authentication/server/php-slim/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(117): Slim\App->Slim\{closure}(Object(Slim\Http\Request), Object(Slim\Http\Response))
> web_1     | #17 /work/decline-on-card-authentication/server/php-slim/vendor/slim/slim/Slim/App.php(392): Slim\App->callMiddlewareStack(Object(Slim\Http\Request), Object(Slim\Http\Response))
> web_1     | #18 /work/decline-on-card-authentication/server/php-slim/vendor/slim/slim/Slim/App.php(297): Slim\App->process(Object(Slim\Http\Request), Object(Slim\Http\Response))
> web_1     | #19 /work/decline-on-card-authentication/server/php-slim/index.php(86): Slim\App->run()

* Just confirm that error is displayed since the message could change

* Fix the php samples as well
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants