Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Fixed typing Price amount/compare_at_amount

Damian Legawiecf74230be7539
diff --git a/api/app/serializers/spree/api/v3/price_serializer.rb b/api/app/serializers/spree/api/v3/price_serializer.rb
index 3d57f07edb..140c5e9e71 100644
--- a/api/app/serializers/spree/api/v3/price_serializer.rb
+++ b/api/app/serializers/spree/api/v3/price_serializer.rb
@@ -5,10 +5,10 @@ module Spree
# Represents a resolved/calculated price for storefront display
# Can represent either a calculated price (with price list resolution) or a base price
class PriceSerializer < BaseSerializer
- typelize amount: 'number | null',
+ typelize amount: 'string | null',
amount_in_cents: 'number | null',
display_amount: 'string | null',
- compare_at_amount: 'number | null',
+ compare_at_amount: 'string | null',
compare_at_amount_in_cents: 'number | null',
display_compare_at_amount: 'string | null',
currency: 'string | null',
diff --git a/api/spec/serializers/spree/api/v3/price_serializer_spec.rb b/api/spec/serializers/spree/api/v3/price_serializer_spec.rb
index 0778fefecd..638b8be92b 100644
--- a/api/spec/serializers/spree/api/v3/price_serializer_spec.rb
+++ b/api/spec/serializers/spree/api/v3/price_serializer_spec.rb
@@ -12,7 +12,7 @@ RSpec.describe Spree::Api::V3::PriceSerializer do
it 'includes amount fields' do
expect(subject).to include(
- 'amount' => 19.99,
+ 'amount' => '19.99'.to_d,
'amount_in_cents' => 1999,
'display_amount' => '$19.99'
)
@@ -39,7 +39,7 @@ RSpec.describe Spree::Api::V3::PriceSerializer do
it 'includes compare_at_amount fields' do
expect(subject).to include(
- 'compare_at_amount' => 29.99,
+ 'compare_at_amount' => '29.99'.to_d,
'compare_at_amount_in_cents' => 2999,
'display_compare_at_amount' => '$29.99'
)
diff --git a/sdk/src/types/generated/AdminPrice.ts b/sdk/src/types/generated/AdminPrice.ts
index b0fd517333..1ca0fe3ef3 100644
--- a/sdk/src/types/generated/AdminPrice.ts
+++ b/sdk/src/types/generated/AdminPrice.ts
@@ -1,12 +1,12 @@
-// Typelizer digest ba2451165fb0a1e6f72cf671c24cb860
+// Typelizer digest f6160d97df7a75c75bd268a0374dc668
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
type AdminPrice = {
id: string;
- amount: number | null;
+ amount: string | null;
amount_in_cents: number | null;
- compare_at_amount: number | null;
+ compare_at_amount: string | null;
compare_at_amount_in_cents: number | null;
currency: string | null;
display_amount: string | null;
diff --git a/sdk/src/types/generated/StorePrice.ts b/sdk/src/types/generated/StorePrice.ts
index 13336bb372..35b6221533 100644
--- a/sdk/src/types/generated/StorePrice.ts
+++ b/sdk/src/types/generated/StorePrice.ts
@@ -1,12 +1,12 @@
-// Typelizer digest ed8fae5b4dacdd11d8e2dcf1236dd834
+// Typelizer digest 616ca037e3185583ceb8da596f2a3935
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
type StorePrice = {
id: string;
- amount: number | null;
+ amount: string | null;
amount_in_cents: number | null;
- compare_at_amount: number | null;
+ compare_at_amount: string | null;
compare_at_amount_in_cents: number | null;
currency: string | null;
display_amount: string | null;