Class: Workarea::Storefront::Globale::ApiController

Inherits:
Storefront::ApplicationController
  • Object
show all
Defined in:
app/controllers/workarea/storefront/globale/api_controller.rb

Instance Method Summary collapse

Instance Method Details

#receive_orderObject

After this step is completed the order can be included in order history in the customer’s “My Account” section on the merchant’s site. It is also recommended to reserve the inventory for this order after the first step is completed, as long as usually the second step will follow too.



18
19
20
21
# File 'app/controllers/workarea/storefront/globale/api_controller.rb', line 18

def receive_order
  @response = GlobalE::Api::SendOrderToMerchant.new(@order, @merchant_order).response
  render json: @response.to_json
end

#receive_paymentObject

Posts order payment details for the order to the Merchant and performs the payment. Only order.OrderId and order.PaymentDetails members are mandatory for this method.



27
28
29
30
# File 'app/controllers/workarea/storefront/globale/api_controller.rb', line 27

def receive_payment
  @response = GlobalE::Api::PerformOrderPayment.new(@order, @merchant_order).response
  render json: @response.to_json
end

#receive_shipping_infoObject

Updates order international shipping information on the Merchant’s site. Only order.OrderId and order.InternationalDetails members are mandatory for this method.



41
42
43
44
# File 'app/controllers/workarea/storefront/globale/api_controller.rb', line 41

def receive_shipping_info
  @response = GlobalE::Api::UpdateOrderShippingInfo.new(@order, @merchant_order).response
  render json: @response.to_json
end

#remove_restricted_productsObject

Remove products from the order marked as restricted on Global-E’s side.



47
48
49
50
51
52
53
54
# File 'app/controllers/workarea/storefront/globale/api_controller.rb', line 47

def remove_restricted_products
  @job = GlobalE::Api::RemoveRestrictedProducts.perform(
    @order,
    params['RemovedProductCodes']
  )

  render json: @job.response
end

#update_order_statusObject



32
33
34
35
# File 'app/controllers/workarea/storefront/globale/api_controller.rb', line 32

def update_order_status
  @response = GlobalE::Api::UpdateOrderStatus.new(@order, @merchant_order).response
  render json: @response.to_json
end