Closed doncadavona closed 1 month ago
I think so too. Yes, let me try and adjust the name
to be nullable
.
Hi @driesvints ,
I have finally found a clean way of handling the issue, instead of throwing an error (as I initially thought of) when the name is not set in Paddle, like so:
// File src/Concerns/ManagesCustomer.php
if (is_null($response['name'])) {
throw new LogicException("The Paddle customer [{$response['id']}] has no name. You may need to set the name of the customer in the Paddle dasbhboard.");
}
We could simply have the customer name as an empty string, if it is empty in Paddle, like so:
// File src/Concerns/ManagesCustomer.php at line 54
$customer->name = $response['name'] ?? '';
Please check my latest commit in this MR.
Amazing @doncadavona, thanks for that clean solution. Could we also update other places where we set the name like in the webhooks?
Hi @driesvints ,
I just updated this section in the webhook where the customer name was also being set:
https://github.com/laravel/cashier-paddle/pull/268/commits/fc522fef90c775b74aa285db08e79cae4f95fbbc
Thanks for pointing that out too.
Gracefully throw an error for the case where there is no name set for the customer.
See https://github.com/laravel/cashier-paddle/issues/266.