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

JsonEncode error: 43 is invalid for PaymentAdviceCode #11

Open
james-ingold opened this issue Nov 7, 2024 · 3 comments
Open

JsonEncode error: 43 is invalid for PaymentAdviceCode #11

james-ingold opened this issue Nov 7, 2024 · 3 comments

Comments

@james-ingold
Copy link

james-ingold commented Nov 7, 2024

This happened when trying to json encode the ordersCapture response for logging purposes:

$apiResponse = $this->client->getOrdersController()->ordersCapture($captureBody);
$transaction = $apiResponse->getResult();
Log::info('Capture response: ' . json_encode($transaction));

2024-11-07T15:31:52.135108+00:00 app[web.1]: [07-Nov-2024 15:31:52 UTC] [2024-11-07 15:31:52] production.ERROR: 43 is invalid for PaymentAdviceCode. {"userId":"the_user_id","exception":"[object] (Exception(code: 0): 43 is invalid for PaymentAdviceCode. at /app/vendor/paypal/paypal-server-sdk/src/Models/PaymentAdviceCode.php:48)
2024-11-07T15:31:52.135122+00:00 app[web.1]: [stacktrace]
2024-11-07T15:31:52.135194+00:00 app[web.1]: #0 /app/vendor/paypal/paypal-server-sdk/src/Models/ProcessorResponse.php(144): PaypalServerSdkLib\Models\PaymentAdviceCode::checkValue()
2024-11-07T15:31:52.135247+00:00 app[web.1]: 1 [internal function]: PaypalServerSdkLib\Models\ProcessorResponse->jsonSerialize()

@LeonarthusMectus
Copy link

Hey @james-ingold

Would you happen to have a debug ID for an instance where this occurred? Looking at the class that threw the exception, the returned code is definitely not one of the expected values, so I'm trying to sort out all the details to determine when/why this code returned, and ensure it and any others that might be missing can be added.

@james-ingold
Copy link
Author

I think the logs on my end recycled, I'm not able to find the order/debug id for this error but I will keep an eye out if we I another instance of this error.

@LeonarthusMectus
Copy link

Entirely understandable on the log rotation. What logs you did have do tell us what happened fairly clearly, but having a debug gives us specifics around the entire lifecycle of a request, which can often shorten the investigation period and speed up getting a resolution.

I'm going to raise this with colleagues on our API teams now as I believe we have enough to go on, but if you see this happen again, nabbing a debug ID would always be welcome.

I'll update you here as soon as possible with any details or follow ups.

james-ingold added a commit to james-ingold/PayPal-PHP-Server-SDK that referenced this issue Nov 21, 2024
Added a new constant ENUM_43 with the value '43'
Including self::ENUM_43 in the _ALL_VALUES array
Updates ProcessorResponse class to handle unknown payment advice codes gracefully
james-ingold added a commit to james-ingold/PayPal-PHP-Server-SDK that referenced this issue Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants