Sha256: 63c3cf60a7b2bd3107c704f61cf4281d24f308ec50afaa1ac92845feb1f04f63

Contents?: true

Size: 690 Bytes

Versions: 1

Compression:

Stored size: 690 Bytes

Contents

class Frenet::Api
  class << self
    def get_shipping_quote(package)
      body = {
        "SellerCEP": package.stock_location.zipcode,
        "RecipientCEP": package.order.ship_address.zipcode.gsub(/-/,""),
        "ShipmentInvoiceValue": package.item_total,
        "ShippingServiceCode": nil,
        "ShippingItemArray": [
          {
            "Height": package.height,
            "Length": package.depth,
            "Width": package.width,
            "Weight": package.weight,
            "Quantity": 1
          }
        ],
        "RecipientCountry": package.order.ship_address.country.iso
      }

      Frenet::Request.new.post("/shipping/quote", body)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
spree_frenet-0.1.2 app/services/frenet/api.rb