Skip to content

Commit

Permalink
Expose Order#pre_tax_total and Order#display_pre_tax_total in Cart AP…
Browse files Browse the repository at this point in the history
…I v2
  • Loading branch information
damianlegawiec committed Oct 5, 2020
1 parent 81ca4eb commit 57cdefd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion api/app/serializers/spree/v2/storefront/cart_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class CartSerializer < BaseSerializer
:display_included_tax_total, :tax_total, :currency, :state, :token, :email,
:display_item_total, :display_ship_total, :display_adjustment_total, :display_tax_total,
:promo_total, :display_promo_total, :item_count, :special_instructions, :display_total,
:pre_tax_item_amount, :display_pre_tax_item_amount
:pre_tax_item_amount, :display_pre_tax_item_amount, :pre_tax_total, :display_pre_tax_total

has_many :line_items
has_many :variants
Expand Down
6 changes: 6 additions & 0 deletions api/docs/v2/storefront/index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1465,6 +1465,12 @@ components:
display_pre_tax_item_amount:
type: string
example: '$17.00'
pre_tax_total:
type: string
example: '20.00'
display_pre_tax_total:
type: string
example: '$20.00'
item_count:
type: number
example: 2
Expand Down
2 changes: 2 additions & 0 deletions api/lib/spree/api/testing_support/v2/current_order.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ def ensure_order_totals
expect(json_response['data']).to have_attribute(:display_total).with_value(order.display_total.to_s)
expect(json_response['data']).to have_attribute(:pre_tax_item_amount).with_value(order.pre_tax_item_amount.to_s)
expect(json_response['data']).to have_attribute(:display_pre_tax_item_amount).with_value(order.display_pre_tax_item_amount.to_s)
expect(json_response['data']).to have_attribute(:pre_tax_total).with_value(order.pre_tax_total.to_s)
expect(json_response['data']).to have_attribute(:display_pre_tax_total).with_value(order.display_pre_tax_total.to_s)
expect(json_response['data']).to have_relationships(:user, :line_items, :variants, :billing_address, :shipping_address, :payments, :shipments, :promotions)
end
end
Expand Down

0 comments on commit 57cdefd

Please sign in to comment.