Sha256: 612e15dd2fb2dc1ee73bea466d51cf25ab27392d65453ebfeb3a9bd92e3a386e
Contents?: true
Size: 788 Bytes
Versions: 2
Compression:
Stored size: 788 Bytes
Contents
# frozen_string_literal: true module SolidusAfterpay class ShippingRateBuilderService < BaseService def initialize(order:) @order = order super() end def call order.shipments.map do |shipment| shipment.shipping_rates.map do |rate| shipping_rate_presenter = SolidusAfterpay::ShippingRatePresenter.new(shipping_rate: rate) { id: rate.id.to_s, name: rate.name, description: rate.display_price, shipping_amount: shipping_rate_presenter.amount_with_taxes.round(4).to_s, currency: rate.currency, order_amount: shipping_rate_presenter.order_amount.round(4).to_s } end end.flatten end private attr_reader :order end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
solidus_afterpay-0.3.0 | app/services/solidus_afterpay/shipping_rate_builder_service.rb |
solidus_afterpay-0.2.0 | app/services/solidus_afterpay/shipping_rate_builder_service.rb |