Class: Gemgento::API::SOAP::Checkout::Cart

Inherits:
Object
  • Object
show all
Defined in:
lib/gemgento/api/soap/checkout/cart.rb

Class Method Summary collapse

Class Method Details

.create(cart) ⇒ MagentoResponse

Create a magento quote.

Parameters:

Returns:



11
12
13
14
15
16
17
# File 'lib/gemgento/api/soap/checkout/cart.rb', line 11

def self.create(cart)
  message = {
      store_id: cart.store.magento_id,
      gemgento_id: cart.id
  }
  MagentoApi.create_call(:shopping_cart_create, message)
end

.info(quote_id, store_id = nil) ⇒ Object



51
52
53
54
55
# File 'lib/gemgento/api/soap/checkout/cart.rb', line 51

def self.info(quote_id, store_id = nil)
  message = { quote_id: quote_id }
  message[:store_id] = store_id unless store_id.nil?
  MagentoApi.create_call(:shopping_cart_info, message)
end

.license(cart) ⇒ Object



69
70
71
72
73
74
75
76
77
78
79
# File 'lib/gemgento/api/soap/checkout/cart.rb', line 69

def self.license(cart)
  message = {
      quote_id: cart.magento_quote_id,
      store_id: cart.store.magento_id
  }
  response = MagentoApi.create_call(:shopping_cart_license, message)

  if response.success?
    response.body[:result][:item]
  end
end

.order(quote, payment, remote_ip) ⇒ MagentoResponse

Process magento quote.

Parameters:

Returns:



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/gemgento/api/soap/checkout/cart.rb', line 25

def self.order(quote, payment, remote_ip)
  message = {
      quote_id: quote.magento_id,
      store_id: quote.store.magento_id,
      remote_ip: remote_ip
  }

  if payment
    message[:payment_data] = {
        'po_number' => payment.po_number,
        method: payment.method,
        'cc_cid' => payment.cc_cid,
        'cc_owner' => payment.cc_owner,
        'cc_number' => payment.cc_number,
        'cc_type' => payment.cc_type,
        'cc_exp_year' => payment.cc_exp_year,
        'cc_exp_month' => payment.cc_exp_month,
        'additional_information' => API::SOAP::Checkout::Payment.compose_additional_information(payment)
    }

    message[:send_email] = !payment.is_redirecting_payment_method? # don't send emails for payment methods that require a redirect.
  end

  MagentoApi.create_call(:shopping_cart_order, message)
end

.totals(quote) ⇒ Gemgento::MagentoResponse

Mage a Magento API call to get quote totals.

Parameters:

Returns:



61
62
63
64
65
66
67
# File 'lib/gemgento/api/soap/checkout/cart.rb', line 61

def self.totals(quote)
  message = {
      quote_id: quote.magento_id,
      store_id: quote.store.magento_id
  }
  MagentoApi.create_call(:shopping_cart_totals, message)
end