diff --git a/.ruby-version b/.ruby-version index 6bf7c6fa..849c0c47 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -ruby-2.5.1 +ruby-2.7.5 diff --git a/Gemfile.lock b/Gemfile.lock index ad996cd0..b3c46db0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -5,7 +5,6 @@ PATH best_in_place bootstrap-sass browser - carrierwave cocoon culqi-ruby decorators @@ -24,6 +23,7 @@ PATH sass-rails simple_form social-share-button + sweetify GEM remote: https://rubygems.org/ @@ -70,122 +70,130 @@ GEM minitest (~> 5.1) tzinfo (~> 1.1) arel (9.0.0) - autoprefixer-rails (8.6.5) - execjs + autoprefixer-rails (10.4.7.0) + execjs (~> 2) best_in_place (3.1.1) actionpack (>= 3.2) railties (>= 3.2) - bootstrap-sass (3.3.7) + bootstrap-sass (3.4.1) autoprefixer-rails (>= 5.2.1) - sass (>= 3.3.4) - browser (2.5.3) + sassc (>= 2.0.0) + browser (5.3.1) builder (3.2.3) - carrierwave (1.2.3) - activemodel (>= 4.0.0) - activesupport (>= 4.0.0) - mime-types (>= 1.16) - cocoon (1.2.11) - coffee-rails (4.2.2) + cocoon (1.2.15) + coffee-rails (5.0.0) coffee-script (>= 2.2.0) - railties (>= 4.0.0) + railties (>= 5.2.0) coffee-script (2.4.1) coffee-script-source execjs coffee-script-source (1.12.2) concurrent-ruby (1.0.5) crass (1.0.4) - culqi-ruby (0.0.8) - decorators (2.0.4) - railties (>= 4.0.0, < 6) - dotenv (2.5.0) - dotenv-rails (2.5.0) - dotenv (= 2.5.0) - railties (>= 3.2, < 6.0) + culqi-ruby (0.1.0) + date (3.3.3) + decorators (2.0.5) + railties (>= 4.0.0, < 7) + dotenv (2.8.1) + dotenv-rails (2.8.1) + dotenv (= 2.8.1) + railties (>= 3.2) erubi (1.7.1) - excon (0.62.0) - execjs (2.7.0) - ffi (1.9.25) - fog-aws (3.0.0) + excon (0.96.0) + execjs (2.8.1) + ffi (1.15.5) + fog-aws (3.15.0) fog-core (~> 2.1) fog-json (~> 1.1) fog-xml (~> 0.1) - ipaddress (~> 0.8) - fog-core (2.1.0) + fog-core (2.3.0) builder - excon (~> 0.58) - formatador (~> 0.2) + excon (~> 0.71) + formatador (>= 0.2, < 2.0) mime-types fog-json (1.2.0) fog-core multi_json (~> 1.10) - fog-xml (0.1.3) + fog-xml (0.1.4) fog-core nokogiri (>= 1.5.11, < 2.0.0) - font-awesome-rails (4.7.0.4) - railties (>= 3.2, < 6.0) - formatador (0.2.5) - friendly_id (5.2.4) + font-awesome-rails (4.7.0.8) + railties (>= 3.2, < 8.0) + formatador (1.1.0) + friendly_id (5.5.0) activerecord (>= 4.0.0) - geocoder (1.4.9) - globalid (0.4.1) - activesupport (>= 4.2.0) + geocoder (1.8.1) + globalid (1.0.0) + activesupport (>= 5.0) i18n (1.0.1) concurrent-ruby (~> 1.0) - ipaddress (0.8.3) jquery-rails (4.3.3) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) jquery-ui-rails (6.0.1) railties (>= 3.2.16) - kaminari (1.1.1) + kaminari (1.2.2) activesupport (>= 4.1.0) - kaminari-actionview (= 1.1.1) - kaminari-activerecord (= 1.1.1) - kaminari-core (= 1.1.1) - kaminari-actionview (1.1.1) + kaminari-actionview (= 1.2.2) + kaminari-activerecord (= 1.2.2) + kaminari-core (= 1.2.2) + kaminari-actionview (1.2.2) actionview - kaminari-core (= 1.1.1) - kaminari-activerecord (1.1.1) + kaminari-core (= 1.2.2) + kaminari-activerecord (1.2.2) activerecord - kaminari-core (= 1.1.1) - kaminari-core (1.1.1) + kaminari-core (= 1.2.2) + kaminari-core (1.2.2) loofah (2.2.2) crass (~> 1.0.2) nokogiri (>= 1.5.9) - mail (2.7.0) + mail (2.8.0) mini_mime (>= 0.1.1) - marcel (0.3.2) + net-imap + net-pop + net-smtp + marcel (0.3.3) mimemagic (~> 0.3.2) - material_icons (2.2.1) + material_icons (4.0.0) railties (>= 3.2) method_source (0.9.0) - mime-types (3.1) + mime-types (3.4.1) mime-types-data (~> 3.2015) - mime-types-data (3.2016.0521) - mimemagic (0.3.2) - mini_magick (4.8.0) - mini_mime (1.0.0) + mime-types-data (3.2022.0105) + mimemagic (0.3.10) + nokogiri (~> 1) + rake + mini_magick (4.12.0) + mini_mime (1.1.2) mini_portile2 (2.3.0) minitest (5.11.3) - monetize (1.7.0) - money (~> 6.9) - money (6.11.3) - i18n (>= 0.6.4, < 1.1) - money-rails (1.11.0) + monetize (1.12.0) + money (~> 6.12) + money (6.16.0) + i18n (>= 0.6.4, <= 2) + money-rails (1.15.0) activesupport (>= 3.0) - monetize (~> 1.7.0) - money (~> 6.11.0) + monetize (~> 1.9) + money (~> 6.13) railties (>= 3.0) - multi_json (1.13.1) - nio4r (2.3.1) + multi_json (1.15.0) + net-imap (0.3.4) + date + net-protocol + net-pop (0.1.2) + net-protocol + net-protocol (0.2.1) + timeout + net-smtp (0.3.3) + net-protocol + nio4r (2.5.8) nokogiri (1.8.2) mini_portile2 (~> 2.3.0) pg (1.0.0) - pg_search (2.1.2) - activerecord (>= 4.2) - activesupport (>= 4.2) - arel (>= 6) + pg_search (2.3.6) + activerecord (>= 5.2) + activesupport (>= 5.2) rack (2.0.5) rack-test (1.0.0) rack (>= 1.0, < 3) @@ -214,42 +222,41 @@ GEM rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) rake (12.3.1) - rb-fsevent (0.10.3) - rb-inotify (0.9.10) - ffi (>= 0.5.0, < 2) - record_tag_helper (1.0.0) - actionview (~> 5.x) - sass (3.5.6) - sass-listen (~> 4.0.0) - sass-listen (4.0.0) - rb-fsevent (~> 0.9, >= 0.9.4) - rb-inotify (~> 0.9, >= 0.9.7) - sass-rails (5.0.7) - railties (>= 4.0.0, < 6) - sass (~> 3.1) - sprockets (>= 2.8, < 4.0) - sprockets-rails (>= 2.0, < 4.0) - tilt (>= 1.1, < 3) - simple_form (4.0.1) - actionpack (>= 5.0) - activemodel (>= 5.0) - social-share-button (1.1.0) + record_tag_helper (1.0.1) + actionview (>= 5) + sass-rails (6.0.0) + sassc-rails (~> 2.1, >= 2.1.1) + sassc (2.4.0) + ffi (~> 1.9) + sassc-rails (2.1.2) + railties (>= 4.0.0) + sassc (>= 2.0) + sprockets (> 3.0) + sprockets-rails + tilt + simple_form (5.1.0) + actionpack (>= 5.2) + activemodel (>= 5.2) + social-share-button (1.2.4) coffee-rails - sprockets (3.7.2) + sprockets (4.1.1) concurrent-ruby (~> 1.0) rack (> 1, < 3) - sprockets-rails (3.2.1) - actionpack (>= 4.0) - activesupport (>= 4.0) + sprockets-rails (3.4.2) + actionpack (>= 5.2) + activesupport (>= 5.2) sprockets (>= 3.0.0) + sweetify (2.0.0) + actionpack thor (0.20.0) thread_safe (0.3.6) - tilt (2.0.8) + tilt (2.0.11) + timeout (0.3.1) tzinfo (1.2.5) thread_safe (~> 0.1) - websocket-driver (0.7.0) + websocket-driver (0.7.5) websocket-extensions (>= 0.1.0) - websocket-extensions (0.1.3) + websocket-extensions (0.1.5) PLATFORMS ruby diff --git a/app/controllers/ecommerce/orders_controller.rb b/app/controllers/ecommerce/orders_controller.rb index 81532ea3..9cc6e15b 100644 --- a/app/controllers/ecommerce/orders_controller.rb +++ b/app/controllers/ecommerce/orders_controller.rb @@ -3,8 +3,8 @@ module Ecommerce class OrdersController < ApplicationController - skip_before_action :verify_authenticity_token, only: [:culqi_webhook] - skip_before_action :authenticate_user!, only: [:culqi_webhook] + skip_before_action :verify_authenticity_token, only: [:culqi_webhook, :einvoice_webhook] + skip_before_action :authenticate_user!, only: [:culqi_webhook, :einvoice_webhook] prepend_view_path "ecommerce/store/#{Ecommerce.ecommerce_layout}" before_action :set_order, only: [:show] @@ -54,6 +54,12 @@ def culqi_webhook head :ok end + def einvoice_webhook + Rails.logger.info "Webhook Received" + Rails.logger.info params + Rails.logger.info params.to_json + end + def calculate_coupon puts params found_coupon = Coupon.find_by(coupon_code: params[:coupon_code]) diff --git a/app/models/ecommerce/order.rb b/app/models/ecommerce/order.rb index ec2f5a7b..6885de9a 100644 --- a/app/models/ecommerce/order.rb +++ b/app/models/ecommerce/order.rb @@ -313,5 +313,225 @@ def clear_einvoice self.save end + def generate_einvoice_from_woocommerce(payload) + return {einvoice_number: rand(1..100).to_s.rjust(8, "0") } + invoice_lines_array = Array.new + line = 0 + weight = 0.0 + total_order_amount = (self.amount).to_f - (self.points_redeemed_amount.to_f / 100) + discount_total = ((self.discount_amount).to_f.abs + (self.points_redeemed_amount.to_f / 100)) / 1.18 + #since igv amount is taken by certifact as the sum of igv lines, the igv in tax lines need to be reduced based on the discount + OrderItem.where(order_id: self.id).includes(:product).each do |item| + invoice_lines_array << {name: item.product.name, quantity: item.quantity, product_id: item.product.id, price_total: (item.price * item.quantity).to_f, price_subtotal: item.price.to_f, weight: (item.quantity * item.product.weight).to_f } + igv_found = item.product.product_taxes.find_by(tax_id: Ecommerce::Tax.first.try(:id)) + weight += (item.quantity * item.product.weight).to_f + if igv_found + invoice_lines_array[line][:igv_tax] = true + invoice_lines_array[line][:igv_amount] = igv_found.try(:tax_amount) + else + invoice_lines_array[line][:igv_tax] = false + invoice_lines_array[line][:igv_amount] = 0 + end + isc_found = item.product.product_taxes.find_by(tax_id: Ecommerce::Tax.second.try(:id)) + if isc_found + invoice_lines_array[line][:isc_tax] = true + invoice_lines_array[line][:isc_amount] = isc_found.try(:tax_amount) + else + invoice_lines_array[line][:isc_tax] = false + invoice_lines_array[line][:isc_amount] = 0 + end + line +=1 + end + if self.shipping_amount_cents > 0 + invoice_lines_array << {name: "Costo de envío (shipping)", quantity: 1, product_id: 1000, price_total: shipping_amount.to_i, price_subtotal: shipping_amount.to_i, igv_tax: true, igv_amount: 18 } + end + + case self.payment_status + when "paid" + return false if efact_number + case self.efact_type + when "boleta" + invoice_hash = { + einvoice_type: "boleta", + number: "B#{Ecommerce.serie_boleta}-#{Ecommerce::Control.find_by!(name: "next_boleta_number").integer_value}", + currency_id: "USD", + id: self.id, + zip: "030101", + catalog_06_id: (self.required_doc.blank? || self.required_doc.try(:strip).try(:length) == 8) ? "1 - DNI" : "4 - CARNET DE EXTRANJERIA", + partner_id: "#{self.user.first_name} #{self.user.last_name} (#{self.user.username})", + company_id: Ecommerce.company_legal_name, + email: self.user.email, + vat: self.amount.to_i >= 210 ? self.required_doc : "", + company_id_city: Ecommerce.company_city, + company_id_street: Ecommerce.company_street, + date_invoice: smart_date_invoice, + payment_term_id: "Contado", + date: smart_date_invoice, + amount_total: total_order_amount, + discount_total: discount_total, + weight: weight, + observation: self.delivery_comments, + company_id_zip: 33, + partner_shipping_id: "shipping_id", + company_id_vat: Ecommerce.company_vat, + street: payload.try(:street), + district_id: payload.try(:district), + province_id: payload.try(:city), + state_id: payload.try(:state), + invoice_line_ids: invoice_lines_array + } + correlativo_to_update_on_200 = Ecommerce::Control.find_by!(name: "next_boleta_number") + when "factura" + invoice_hash = { + einvoice_type: "factura", + number: "F#{Ecommerce.serie_factura}-#{Ecommerce::Control.find_by!(name: "next_factura_number").integer_value}", + currency_id: "USD", + id: self.id, + zip: "030101", + catalog_06_id: "6 - RUC", + partner_id: Ecommerce::DataBizInvoice.find_by(user_id: self.user.id).try(:razon_social) + " (#{self.user.username})", + company_id: Ecommerce.company_legal_name, + email: self.user.email, + vat: Ecommerce::DataBizInvoice.find_by(user_id: self.user.id).try(:vat), + company_id_city: Ecommerce.company_city, + company_id_street: Ecommerce.company_street, + date_invoice: smart_date_invoice, + payment_term_id: "Contado", + date: smart_date_invoice, + amount_total: total_order_amount, + discount_total: discount_total, + weight: weight, + observation: self.delivery_comments, + company_id_zip: 33, + partner_shipping_id: "shipping_id", + company_id_vat: Ecommerce.company_vat, + street: payload.try(:street), + district_id: payload.try(:district), + province_id: payload.try(:city), + state_id: payload.try(:state), + street_razon_social: Ecommerce::DataBizInvoice.find_by(user_id: self.user.id).try(:address), + district_id_razon_social: "", + province_id_razon_social: Ecommerce::DataBizInvoice.find_by(user_id: self.user.id).try(:city), + state_id_razon_social: Ecommerce::DataBizInvoice.find_by(user_id: self.user.id).try(:city), + invoice_line_ids: invoice_lines_array + } + correlativo_to_update_on_200 = Ecommerce::Control.find_by!(name: "next_factura_number") + end + when "refunded" + return false if !efact_number || efact_refund_number + case self.efact_number[0] + when "B" + invoice_hash = { + einvoice_type: "nota_de_credito", + number: "B#{Ecommerce.serie_nota_de_credito}-#{Ecommerce::Control.find_by!(name: "next_nota_de_credito_boleta_number").integer_value}", + affected_document: self.efact_number, + currency_id: "USD", + id: self.id, + zip: "030101", + catalog_06_id: (self.required_doc.blank? || self.required_doc.try(:strip).try(:length) == 8) ? "1 - DNI" : "4 - CARNET DE EXTRANJERIA", + partner_id: "#{self.user.first_name} #{self.user.last_name}", + company_id: Ecommerce.company_legal_name, + email: self.user.email, + vat: self.amount.to_i >= 210 ? self.required_doc : "", + company_id_city: Ecommerce.company_city, + company_id_street: Ecommerce.company_street, + date_invoice: smart_date_invoice, + payment_term_id: "Contado", + date: smart_date_invoice, + amount_total: total_order_amount, + company_id_zip: 33, + partner_shipping_id: "shipping_id", + company_id_vat: Ecommerce.company_vat, + street: payload.try(:street), + district_id: payload.try(:district), + province_id: payload.try(:city), + state_id: payload.try(:state), + invoice_line_ids: invoice_lines_array + } + correlativo_to_update_on_200 = Ecommerce::Control.find_by!(name: "next_nota_de_credito_boleta_number") + when "F" + invoice_hash = { + einvoice_type: "nota_de_credito", + number: "F#{Ecommerce.serie_nota_de_credito}-#{Ecommerce::Control.find_by!(name: "next_nota_de_credito_factura_number").integer_value}", + affected_document: self.efact_number, + currency_id: "USD", + id: self.id, + zip: "030101", + catalog_06_id: "6 - RUC", + partner_id: Ecommerce::DataBizInvoice.find_by(user_id: self.user.id).try(:razon_social), + company_id: Ecommerce.company_legal_name, + email: self.user.email, + vat: Ecommerce::DataBizInvoice.find_by(user_id: self.user.id).try(:vat), + company_id_city: Ecommerce.company_city, + company_id_street: Ecommerce.company_street, + date_invoice: smart_date_invoice, + payment_term_id: "Contado", + date: smart_date_invoice, + amount_total: total_order_amount, + company_id_zip: 33, + partner_shipping_id: "shipping_id", + company_id_vat: Ecommerce.company_vat, + street: payload.try(:street), + district_id: payload.try(:district), + province_id: payload.try(:city), + state_id: payload.try(:state), + street_razon_social: Ecommerce::DataBizInvoice.find_by(user_id: self.user.id).try(:address), + district_id_razon_social: "", + province_id_razon_social: Ecommerce::DataBizInvoice.find_by(user_id: self.user.id).try(:city), + state_id_razon_social: Ecommerce::DataBizInvoice.find_by(user_id: self.user.id).try(:city), + invoice_line_ids: invoice_lines_array + } + correlativo_to_update_on_200 = Ecommerce::Control.find_by!(name: "next_nota_de_credito_factura_number") + end + when "payment_void" + return false if !efact_number + invoice_hash = { + einvoice_type: "anulacion", + affected_document: self.efact_number, + void_reason: "Cancelación" + } + else + invoice_hash = { + error: "invoice is unpaid" + } + end + + url = URI(Ecommerce::Control.find_by(name: 'efact_url').text_value) + puts "invoice_hash: #{invoice_hash.to_json} sent to #{url}" + Rails.logger.debug "invoice_hash: #{invoice_hash.to_json} sent to #{url}" + http = Net::HTTP.new(url.host, url.port) + http.use_ssl = true if url.scheme == "https" + request = Net::HTTP::Post.new(url) + request["Content-Type"] = 'application/json' + #TODO add type of authentication field in backoffice to support Bearer Token + request["Authorization"] = "Bearer #{Ecommerce::Control.find_by!(name: "efact_token").text_value}" + request["Cache-Control"] = 'no-cache' + request.body = invoice_hash.to_json + self.update_columns(efact_sent_text: invoice_hash.to_json) + response = http.request(request) + if response.code == "200" + response_body = JSON.parse(response.read_body) + if response.read_body && response_body["response_text"] == "OK" + case invoice_hash[:einvoice_type] + when "nota_de_credito" + self.update_columns(efact_response_text: "OK", efact_refund_url: response_body["response_url"], efact_refund_number: invoice_hash[:number] ) + when "anulacion" + self.update_columns(efact_response_text: "OK", efact_void_url: response_body["response_url"] ) + else + self.update_columns(efact_response_text: "OK", efact_invoice_url: response_body["response_url"], efact_number: invoice_hash[:number] ) + end + correlativo_to_update_on_200.update_columns(integer_value: correlativo_to_update_on_200.integer_value + 1) if correlativo_to_update_on_200 + else + self.update_columns(efact_response_text: "Internal Error #{response.code} - #{response_body["response_text"]}") + AdminMailer.einvoice_error_email(self).deliver! #unless Rails.env == "development" + end + return response_body.to_json + else + self.update_columns(efact_response_text: "Internal Error #{response.code}") + AdminMailer.einvoice_error_email(self).deliver! #unless Rails.env == "development" + return response.read_body + end + end + end end diff --git a/app/uploaders/ecommerce/brand_logo_uploader.rb b/app/uploaders/ecommerce/brand_logo_uploader.rb index 9d37e3ff..da8f41c0 100644 --- a/app/uploaders/ecommerce/brand_logo_uploader.rb +++ b/app/uploaders/ecommerce/brand_logo_uploader.rb @@ -1,5 +1,5 @@ class Ecommerce::BrandLogoUploader < CarrierWave::Uploader::Base - include CarrierWave::MiniMagick + #include CarrierWave::MiniMagick # Include RMagick or MiniMagick support: # include CarrierWave::RMagick @@ -7,7 +7,7 @@ class Ecommerce::BrandLogoUploader < CarrierWave::Uploader::Base # Choose what kind of storage to use for this uploader: #storage :file - storage :fog + #storage :fog # Override the directory where uploaded files will be stored. # This is a sensible default for uploaders that are meant to be mounted: diff --git a/app/uploaders/ecommerce/campaign_image_uploader.rb b/app/uploaders/ecommerce/campaign_image_uploader.rb index 4b848f16..af9c95b2 100644 --- a/app/uploaders/ecommerce/campaign_image_uploader.rb +++ b/app/uploaders/ecommerce/campaign_image_uploader.rb @@ -1,5 +1,5 @@ class Ecommerce::CampaignImageUploader < CarrierWave::Uploader::Base - include CarrierWave::MiniMagick + #include CarrierWave::MiniMagick # Include RMagick or MiniMagick support: # include CarrierWave::RMagick @@ -7,7 +7,7 @@ class Ecommerce::CampaignImageUploader < CarrierWave::Uploader::Base # Choose what kind of storage to use for this uploader: #storage :file - storage :fog + #storage :fog # Override the directory where uploaded files will be stored. # This is a sensible default for uploaders that are meant to be mounted: diff --git a/app/uploaders/ecommerce/category_home_image_uploader.rb b/app/uploaders/ecommerce/category_home_image_uploader.rb index 48ea7ae9..8aeb5acc 100644 --- a/app/uploaders/ecommerce/category_home_image_uploader.rb +++ b/app/uploaders/ecommerce/category_home_image_uploader.rb @@ -1,5 +1,5 @@ class Ecommerce::CategoryHomeImageUploader < CarrierWave::Uploader::Base - include CarrierWave::MiniMagick + #include CarrierWave::MiniMagick # Include RMagick or MiniMagick support: # include CarrierWave::RMagick @@ -7,7 +7,7 @@ class Ecommerce::CategoryHomeImageUploader < CarrierWave::Uploader::Base # Choose what kind of storage to use for this uploader: #storage :file - storage :fog + #storage :fog # Override the directory where uploaded files will be stored. # This is a sensible default for uploaders that are meant to be mounted: diff --git a/app/uploaders/ecommerce/category_image_uploader.rb b/app/uploaders/ecommerce/category_image_uploader.rb index 95755b92..afd80a1f 100644 --- a/app/uploaders/ecommerce/category_image_uploader.rb +++ b/app/uploaders/ecommerce/category_image_uploader.rb @@ -1,5 +1,5 @@ class Ecommerce::CategoryImageUploader < CarrierWave::Uploader::Base - include CarrierWave::MiniMagick + #include CarrierWave::MiniMagick # Include RMagick or MiniMagick support: # include CarrierWave::RMagick @@ -7,7 +7,7 @@ class Ecommerce::CategoryImageUploader < CarrierWave::Uploader::Base # Choose what kind of storage to use for this uploader: #storage :file - storage :fog + #storage :fog # Override the directory where uploaded files will be stored. # This is a sensible default for uploaders that are meant to be mounted: diff --git a/app/uploaders/ecommerce/product_image_uploader.rb b/app/uploaders/ecommerce/product_image_uploader.rb index 49b17aa6..e82cba12 100644 --- a/app/uploaders/ecommerce/product_image_uploader.rb +++ b/app/uploaders/ecommerce/product_image_uploader.rb @@ -1,5 +1,5 @@ class Ecommerce::ProductImageUploader < CarrierWave::Uploader::Base - include CarrierWave::MiniMagick + #include CarrierWave::MiniMagick # Include RMagick or MiniMagick support: # include CarrierWave::RMagick @@ -7,7 +7,7 @@ class Ecommerce::ProductImageUploader < CarrierWave::Uploader::Base # Choose what kind of storage to use for this uploader: #storage :file - storage :fog + #storage :fog # Override the directory where uploaded files will be stored. # This is a sensible default for uploaders that are meant to be mounted: diff --git a/app/uploaders/ecommerce/slider_image_uploader.rb b/app/uploaders/ecommerce/slider_image_uploader.rb index c212a31e..fc42f525 100644 --- a/app/uploaders/ecommerce/slider_image_uploader.rb +++ b/app/uploaders/ecommerce/slider_image_uploader.rb @@ -1,5 +1,5 @@ class Ecommerce::SliderImageUploader < CarrierWave::Uploader::Base - include CarrierWave::MiniMagick + #include CarrierWave::MiniMagick # Include RMagick or MiniMagick support: # include CarrierWave::RMagick @@ -7,7 +7,7 @@ class Ecommerce::SliderImageUploader < CarrierWave::Uploader::Base # Choose what kind of storage to use for this uploader: #storage :file - storage :fog + #storage :fog # Override the directory where uploaded files will be stored. # This is a sensible default for uploaders that are meant to be mounted: diff --git a/config/initializers/carrierwave.rb b/config/initializers/carrierwave.rb index 6bc6ea09..19e30f89 100644 --- a/config/initializers/carrierwave.rb +++ b/config/initializers/carrierwave.rb @@ -1,18 +1,18 @@ -require 'carrierwave' -require 'carrierwave/storage/fog' -require 'dotenv-rails' +#require 'carrierwave' +#require 'carrierwave/storage/fog' +#require 'dotenv-rails' -CarrierWave.configure do |config| +#CarrierWave.configure do |config| - Dotenv::Railtie.load + #Dotenv::Railtie.load - config.fog_provider = 'fog/aws' + #config.fog_provider = 'fog/aws' - config.fog_credentials = { - :provider => 'AWS', - :aws_access_key_id => ENV["S3_AWS_ACCESS_KEY_ID"] || "A12345", - :aws_secret_access_key => ENV["S3_AWS_SECRET_ACCESS_KEY"] || "A12345" - } - config.fog_directory = ENV["CARRIERWAVE_CONFIG_FOG_DIRECTORY"] - config.storage = :fog -end + #config.fog_credentials = { + # :provider => 'AWS', + #:aws_access_key_id => ENV["S3_AWS_ACCESS_KEY_ID"] || "A12345", + #:aws_secret_access_key => ENV["S3_AWS_SECRET_ACCESS_KEY"] || "A12345" + #} + #config.fog_directory = ENV["CARRIERWAVE_CONFIG_FOG_DIRECTORY"] + #config.storage = :fog +#end diff --git a/config/initializers/culqi.rb b/config/initializers/culqi.rb index 493b2d86..9a8375d3 100644 --- a/config/initializers/culqi.rb +++ b/config/initializers/culqi.rb @@ -1,4 +1,4 @@ if ActiveRecord::Base.connection.table_exists? 'ecommerce_payment_methods' - Culqi.public_key = Ecommerce::PaymentMethod.find_by(name: "Card", processor: "Culqi").try(:key) - Culqi.secret_key = Ecommerce::PaymentMethod.find_by(name: "Card", processor: "Culqi").try(:secret) + #Culqi.public_key = Ecommerce::PaymentMethod.find_by(name: "Card", processor: "Culqi").try(:key) + #Culqi.secret_key = Ecommerce::PaymentMethod.find_by(name: "Card", processor: "Culqi").try(:secret) end diff --git a/config/initializers/fix_fog.rb b/config/initializers/fix_fog.rb new file mode 100644 index 00000000..5ab163fb --- /dev/null +++ b/config/initializers/fix_fog.rb @@ -0,0 +1 @@ +#module CarrierWave; module Storage; class Fog; end; end; end \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index e8bfc2c1..92b17d6b 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -72,6 +72,7 @@ post '/calculate_coupon', :to => 'orders#calculate_coupon' post '/culqi_webhook', :to => 'orders#culqi_webhook' + post '/einvoice_webhook', :to => 'orders#einvoice_webhook' resources :carts, except: [:index, :new, :create] resources :cart_items diff --git a/ecommerce.gemspec b/ecommerce.gemspec index d3838200..d6577986 100644 --- a/ecommerce.gemspec +++ b/ecommerce.gemspec @@ -21,7 +21,7 @@ Gem::Specification.new do |s| s.add_dependency 'decorators' s.add_dependency 'kaminari'#, "~> 1.1.1" s.add_dependency 'friendly_id'#, '~> 5.1.0' - s.add_dependency 'carrierwave'#, '~> 1.2.1' + #s.add_dependency 'carrierwave'#, '~> 1.2.1' s.add_dependency 'fog-aws'#, '~> 1.4.1' s.add_dependency 'mini_magick'#, '~> 4.8.0' s.add_dependency 'social-share-button' diff --git a/lib/ecommerce.rb b/lib/ecommerce.rb index edcf7ca2..d36ccf95 100644 --- a/lib/ecommerce.rb +++ b/lib/ecommerce.rb @@ -1,8 +1,8 @@ require "ecommerce/engine" require 'decorators' require "friendly_id" -require 'carrierwave' -require 'carrierwave/storage/fog' +#require 'carrierwave' +#require 'carrierwave/storage/fog' require 'mini_magick' require 'social-share-button' require 'simple_form' diff --git a/lib/ecommerce/version.rb b/lib/ecommerce/version.rb index d8317340..fba8cc0c 100644 --- a/lib/ecommerce/version.rb +++ b/lib/ecommerce/version.rb @@ -1,3 +1,3 @@ module Ecommerce - VERSION = '0.7.2.3' + VERSION = '0.7.3.1' end