app/services/workarea/afterpay/order_builder.rb in workarea-afterpay-2.0.2 vs app/services/workarea/afterpay/order_builder.rb in workarea-afterpay-2.1.0

- old
+ new

@@ -1,19 +1,24 @@ module Workarea module Afterpay class OrderBuilder + module ProductUrl + include Workarea::I18n::DefaultUrlOptions + include Storefront::Engine.routes.url_helpers + extend self + end attr_reader :order # @param ::Workarea::Order def initialize(order) @order = Workarea::Storefront::OrderViewModel.new(order) end def build { - totalAmount: { + amount: { amount: order.order_balance.to_s, currency: currency_code, }, merchantReference: order.id, consumer: { @@ -56,11 +61,11 @@ end def address(address_obj) { name: "#{address_obj.first_name} #{address_obj.last_name}", - suburb: address_obj.city, + area1: address_obj.city, line1: address_obj.street, state: address_obj.region, postcode: address_obj.postal_code, countryCode: address_obj.country.alpha2, phoneNumber: address_obj.phone_number @@ -72,9 +77,10 @@ product = Workarea::Catalog::Product.find_by_sku(oi.sku) { name: product.name, sku: oi.sku, quantity: oi.quantity, + pageUrl: ProductUrl.product_url(id: oi.product.to_param, host: Workarea.config.host), price: { amount: oi.original_unit_price.to_s, currency: currency_code } }