Skip to content

Commit

Permalink
Throw an informative error when there is no name set for the customer (
Browse files Browse the repository at this point in the history
…#268)

* Throw an informative error when there is no name set for the customer

* Save the name of the customer as an empty string in the database if it is not set in Paddle.

* Update the name of the customer as an empty string in the database if it is not set in Paddle.
  • Loading branch information
doncadavona authored Jul 23, 2024
1 parent a8a7616 commit 0657240
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Concerns/ManagesCustomer.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function createAsCustomer(array $options = [])

$customer = $this->customer()->make();
$customer->paddle_id = $response['id'];
$customer->name = $response['name'];
$customer->name = $response['name'] ?? '';
$customer->email = $response['email'];
$customer->trial_ends_at = $trialEndsAt;
$customer->save();
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Controllers/WebhookController.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ protected function handleCustomerUpdated(array $payload)
}

$customer->update([
'name' => $data['name'],
'name' => $data['name'] ?? '',
'email' => $data['email'],
]);

Expand Down

0 comments on commit 0657240

Please sign in to comment.