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

Handle null email from Stripe customers #29

Open
wants to merge 1 commit into
base: 1.x
Choose a base branch
from
Open

Conversation

timkelty
Copy link

Description

stripe/sync/customers and stripe/sync/payment-methods can fail because the plugin requires customers have an email but Stripe does not.

❯ ddev craft stripe/sync/customers
Syncing Stripe customers…

Exception 'yii\db\IntegrityException' with message 'SQLSTATE[23502]: Not null violation: 7 ERROR:  null value in column "email" of relation "stripe_customerdata" violates not-null constraint
DETAIL:  Failing row contains (1330, cus_xxx, null, 2024-09-18 21:06:15, {"id": "cus_xxx", "name": null, "email": null, "phone..., 2024-10-11 19:41:30, 2024-10-11 19:41:30, cbb21144-170d-4f9a-9c21-30edb4799035).
The SQL being executed was: INSERT INTO "stripe_customerdata" ("stripeId", "email", "stripeCreated", "data", "dateCreated", "dateUpdated", "uid") VALUES ('cus_QsFZRQdHHB4SV6', NULL, '2024-09-18 21:06:15', '{"id":"cus_xxx","object":"customer","address":null,"balance":0,"created":1726693575,"currency":"usd","default_source":null,"delinquent":false,"description":"(created by Stripe CLI)","discount":null,"email":null,"invoice_prefix":"C9BE1FC5","invoice_settings":{"custom_fields":null,"default_payment_method":null,"footer":null,"rendering_options":null},"livemode":false,"metadata":[],"name":null,"next_invoice_sequence":2,"phone":null,"preferred_locales":[],"shipping":null,"tax_exempt":"none","test_clock":null}'::jsonb, '2024-10-11 19:41:30', '2024-10-11 19:41:30', 'cbb21144-170d-4f9a-9c21-30edb4799035') RETURNING "id"'
❯ ddev craft stripe/sync/payment-methods
Syncing Stripe payment methods…

Exception 'TypeError' with message 'craft\services\Users::getUserByUsernameOrEmail(): Argument #1 ($usernameOrEmail) must be of type string, null given, called in /tmp/packages/craft-stripe/src/services/Api.php on line 132'

@timkelty timkelty requested a review from i-just October 11, 2024 19:58
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

Successfully merging this pull request may close these issues.

1 participant