Class: FacebookCommerce::ReturnApi

Inherits:
Api
  • Object
show all
Defined in:
lib/facebook_commerce.rb

Instance Attribute Summary

Attributes inherited from Api

#access_token, #cms_id, #logger

Instance Method Summary collapse

Methods inherited from Api

#initialize

Constructor Details

This class inherits a constructor from FacebookCommerce::Api

Instance Method Details

#create_return(order_id, items, return_status, return_message, merchant_return_id) ⇒ Hash

Return response, eg. { id: ‘1234567890’ }

Parameters:

  • order_id (String)

    Facebook order ID

  • items (Array<Hash>)

    Array of item hashes (item_id|retailer_id, quantity, reason)

  • return_status (String)

    Reason code for the return, eg. ‘REQUESTED’, ‘APPROVED’, ‘DISAPPROVED’, ‘REFUNDED’, ‘MERCHANT_MARKED_COMPLETED’

Returns:

  • (Hash)

    Return response, eg. { id: ‘1234567890’ }



167
168
169
170
171
172
173
174
175
# File 'lib/facebook_commerce.rb', line 167

def create_return(order_id, items, return_status, return_message, merchant_return_id)
  data = {
    items: items.to_json,
    return_status: return_status,
    return_message: return_message,
    merchant_return_id: merchant_return_id
  }
  post("#{order_id}/returns", data)
end

#update_return(return_id, update_event, options = {}) ⇒ Object

Parameters:

  • return_id (String)

    Facebook return ID

  • update_event (String)

    Reason code for the return, ‘ACCEPT_RETURN’ or ‘CLOSE_RETURN’

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • notes (String)

    Notes for the return

  • merchant_return_id (String)

    Merchant return ID

  • return_shipping_labels (Array<Hash>)

    Array of shipping label hashes (carrier, service_name, tracking_number, file_handle, cost)



183
184
185
# File 'lib/facebook_commerce.rb', line 183

def update_return(return_id, update_event, options = {})
  post("#{return_id}/update_return", options.merge(update_event: update_event))
end