Class: Gemgento::API::SOAP::Checkout::Cart
- Inherits:
-
Object
- Object
- Gemgento::API::SOAP::Checkout::Cart
- Defined in:
- lib/gemgento/api/soap/checkout/cart.rb
Class Method Summary collapse
-
.create(cart) ⇒ MagentoResponse
Create a magento quote.
- .info(quote_id, store_id = nil) ⇒ Object
- .license(cart) ⇒ Object
-
.order(quote, payment, remote_ip) ⇒ MagentoResponse
Process magento quote.
-
.totals(quote) ⇒ Gemgento::MagentoResponse
Mage a Magento API call to get quote totals.
Class Method Details
.create(cart) ⇒ MagentoResponse
Create a magento quote.
11 12 13 14 15 16 17 |
# File 'lib/gemgento/api/soap/checkout/cart.rb', line 11 def self.create(cart) = { store_id: cart.store.magento_id, gemgento_id: cart.id } MagentoApi.create_call(:shopping_cart_create, ) 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) = { quote_id: quote_id } [:store_id] = store_id unless store_id.nil? MagentoApi.create_call(:shopping_cart_info, ) 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) = { quote_id: cart.magento_quote_id, store_id: cart.store.magento_id } response = MagentoApi.create_call(:shopping_cart_license, ) if response.success? response.body[:result][:item] end end |
.order(quote, payment, remote_ip) ⇒ MagentoResponse
Process magento quote.
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) = { quote_id: quote.magento_id, store_id: quote.store.magento_id, remote_ip: remote_ip } if payment [: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) } [: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, ) end |
.totals(quote) ⇒ Gemgento::MagentoResponse
Mage a Magento API call to get quote totals.
61 62 63 64 65 66 67 |
# File 'lib/gemgento/api/soap/checkout/cart.rb', line 61 def self.totals(quote) = { quote_id: quote.magento_id, store_id: quote.store.magento_id } MagentoApi.create_call(:shopping_cart_totals, ) end |