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
  • Loading branch information
doncadavona committed Jul 19, 2024
1 parent a8a7616 commit c360cf5
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Concerns/ManagesCustomer.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ public function createAsCustomer(array $options = [])
$response = Cashier::api('POST', 'customers', $options)['data'];
}

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.");
}

if (Cashier::$customerModel::where('paddle_id', $response['id'])->exists()) {
throw new LogicException("The Paddle customer [{$response['id']}] already exists in the database.");
}
Expand Down

0 comments on commit c360cf5

Please sign in to comment.