If a user is not yet associated with a Stripe customer, calling asStripeCustomer() throws a Stripe\Exception\UnexpectedValueException with the message:
Could not determine which URL to request: Stripe\Customer instance has invalid ID:
This is different from the other methods in Billable, which throw a Laravel\Cashier\Exceptions\InvalidCustomerException when the user is not associated with a Stripe customer.
Should calling asStripeCustomer() also do a assertCustomerExists() check? This will make the behaviour of asStripeCustomer() consistent with the others in Billable. I can put up a PR for this if my assessment is accurate.
Steps To Reproduce:
Call asStripeCustomer() on a Billable model with no stripe_id. An UnexpectedValueException will be thrown.
Description:
If a user is not yet associated with a Stripe customer, calling
asStripeCustomer()
throws aStripe\Exception\UnexpectedValueException
with the message:This is different from the other methods in
Billable
, which throw aLaravel\Cashier\Exceptions\InvalidCustomerException
when the user is not associated with a Stripe customer.Should calling
asStripeCustomer()
also do aassertCustomerExists()
check? This will make the behaviour ofasStripeCustomer()
consistent with the others inBillable
. I can put up a PR for this if my assessment is accurate.Steps To Reproduce:
asStripeCustomer()
on aBillable
model with nostripe_id
. AnUnexpectedValueException
will be thrown.