lunarphp / lunar

An open-source package that brings the power of modern headless e-commerce functionality to Laravel.
https://lunarphp.io
MIT License
2.71k stars 357 forks source link

OrderFactory: make sure taxTotal is an integer. #1940

Closed kfowler closed 2 months ago

kfowler commented 2 months ago

Using the OrderFactory to create orders:

        Order::factory()->count(100)->create();

in a postgresql database causes an error:

SQLSTATE[22P02]: Invalid text representation: 7 ERROR: invalid input syntax for type bigint: "15603.2"

SQL: insert into "lunar_orders" ("channel_id", "new_customer", "user_id", "status", "reference", "sub_total", "discount_total", "shipping_total", "tax_breakdown", "tax_total", "total", "notes", "currency_code", "compare_currency_code", "exchange_rate", "meta", "updated_at", "created_at") values (2, 0, ?, awaiting-payment, HGMKWOMH, 15603.2, 0, 0, [], 3875.8, 19479, ?, GBP, GBP, 1, {"foo":"bar"}, 2024-09-08 02:18:04, 2024-09-08 02:18:04) returning "id")

Calling intval() fixes this issue.

Please describe your Pull Request as best as possible, explaining what it provides and why it is of value, referencing any related Issues.

Try to include the following in your Pull Request, where applicable...

vercel[bot] commented 2 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
lunar-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 8, 2024 2:33am
github-actions[bot] commented 2 months ago

Thanks for submitting a PR!

In order to review and merge PRs most efficiently, we require that all PRs grant maintainer edit access before we review them. If your fork belongs to a GitHub organization, please move the repository to your personal account and try again. If you're already using a personal fork, you can learn how to enable maintainer access in the GitHub documentation.