spree_zaez_cielo 3.0.3 → 3.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 01a2c7500277c4881e09de54bcb18d512bdbb127
4
- data.tar.gz: f18781d70c9f77d6d1307e5584206b0127429f7c
3
+ metadata.gz: 44b86666a7498bb608fea3a1e4ca0a7a2720a262
4
+ data.tar.gz: 5610340416beb53e46b2f436ffd27e1147065d29
5
5
  SHA512:
6
- metadata.gz: 4eb45a7c7dd5d2d78f4d6a96c8235a5c5e3b9b30c344eb5d176780d7d1a8731034e95057716c7e98e9667308ad924c2a9972cbc70d6818230da57e55e5e1e106
7
- data.tar.gz: eea0f229c45de9e0e3d9841c0122b362bf3d42b9176d330458eb42d2dcf13021ae334272447a2a6efc688625d02501cc8af193c5e541e66b37d132de95442f11
6
+ metadata.gz: 448b339bb12e77116e2bdaa4c26aba16c73055725bfcde27e3cad046ba0a3a698745e89b9efa8fef6529d0a9ba9cd07dc836dd5f2aeca087a98e3cbc25b8a50f
7
+ data.tar.gz: 0f937b6166815fc6e87223ae17d5d5b98dc9abc003679dbcc0e7e3f9209b527e768fcc1e12994de4ad874d96fd384978b7f4b61e11ddd0b9ee6f8eb45c573ebb
@@ -13,6 +13,7 @@ class window.CieloDebt
13
13
  $('#cielo_debt_number').on 'input', @setCreditCard
14
14
  $('#cielo_debt_authorize').click (e) => @authorizePayment(e)
15
15
  $('div[data-hook="checkout_payment_step"] input[type="radio"]').click => do @verifySaveButtonVisibility
16
+ do @setIconsPath
16
17
 
17
18
  # Antes de fazer a requisicao a Cielo
18
19
  # verifica se o usuario inseriu um codigo de desconto
@@ -103,13 +104,28 @@ class window.CieloDebt
103
104
  $('#cielo_unrecognized').hide()
104
105
  type = $.payment.cardType($('#cielo_debt_number').val())
105
106
  type = 'master' if type == 'mastercard'
107
+ type = 'diners' if type == 'dinersclub'
106
108
  if type == null
107
109
  $('#cielo_debt_unrecognized').show()
108
110
  else
109
- $('#cielo_debt_message').html("<img src='/assets/credit_cards/icons/#{type}.png' class='pull-right' />")
111
+ $('#cielo_debt_message').html("<img src='#{Spree.icons_debt[type]}' class='pull-right' />")
110
112
  $('#cielo_debt_unrecognized').hide()
111
113
  $('#cielo_debt_cc_type').val(type)
112
114
 
115
+ # Salva o caminho dos icones
116
+ # (para evitar problemas e producao)
117
+ setIconsPath: ->
118
+ Spree.icons_debt = {
119
+ visa: '<%= asset_url 'credit_cards/icons/visa.png' %>',
120
+ master: '<%= asset_url 'credit_cards/icons/master.png' %>',
121
+ amex: '<%= asset_url 'credit_cards/icons/amex.png' %>',
122
+ diners: '<%= asset_url 'credit_cards/icons/diners.png' %>',
123
+ elo: '<%= asset_url 'credit_cards/icons/elo.png' %>',
124
+ jcb: '<%= asset_url 'credit_cards/icons/jcb.png' %>',
125
+ discover: '<%= asset_url 'credit_cards/icons/discover.png' %>',
126
+ aura: '<%= asset_url 'credit_cards/icons/aura.png' %>'
127
+ }
128
+
113
129
  # Verifica se deve esconder/exibir o botao de confirmacao do pagamento
114
130
  # Para debito, o pagamento e criado apenas apos a autenticacao,
115
131
  # por isso, e necessario outro botao (e rota)
@@ -2,7 +2,7 @@ class Spree::Admin::CieloSettingsController < Spree::Admin::BaseController
2
2
 
3
3
  def edit
4
4
  @config = Spree::CieloConfiguration.new
5
- @credit_cards = [:visa, :master, :diners, :discover, :elo, :amex, :jcb]
5
+ @credit_cards = [:visa, :master, :diners, :discover, :elo, :amex, :jcb, :aura]
6
6
  @debt_cards = [:visa, :master]
7
7
  end
8
8
 
@@ -9,6 +9,7 @@ module Spree
9
9
  if params[:credit_card_id].present?
10
10
  credit_card = Spree::CreditCard.find params[:credit_card_id]
11
11
  @cc_type = credit_card.cc_type
12
+ @cc_type = 'diners' if @cc_type == 'diners_club'
12
13
  @cc_type = 'amex' if @cc_type == 'american_express'
13
14
  @cc_type = 'master' if @cc_type == 'mastercard'
14
15
  else
@@ -2,6 +2,7 @@ module Spree
2
2
  class CieloDebtController < Spree::StoreController
3
3
 
4
4
  before_filter :set_credit_card, only: [:confirm]
5
+ skip_before_action :verify_authenticity_token, only: [:confirm]
5
6
 
6
7
  def create
7
8
  if current_order.guest_token != params[:guest_token]
@@ -156,6 +156,7 @@ module Spree
156
156
  cc_type = type
157
157
  cc_type = 'mastercard' if cc_type == 'master'
158
158
  cc_type = 'amex' if cc_type == 'american_express'
159
+ cc_type = 'diners' if cc_type == 'diners_club'
159
160
  cc_type
160
161
  end
161
162
 
@@ -30,6 +30,7 @@ en:
30
30
  cielo_amex: American Express
31
31
  cielo_american_express: American Express
32
32
  cielo_jcb: JCB
33
+ cielo_aura: Aura
33
34
  cielo_portions: "%{times}x of %{value}"
34
35
  cielo_without_tax: without tax.
35
36
  cielo_with_tax: with tax.
@@ -30,6 +30,7 @@ pt-BR:
30
30
  cielo_amex: American Express
31
31
  cielo_american_express: American Express
32
32
  cielo_jcb: JCB
33
+ cielo_aura: Aura
33
34
  cielo_portions: "%{times}x de %{value}"
34
35
  cielo_without_tax: sem juros.
35
36
  cielo_with_tax: com juros.
data/config/routes.rb CHANGED
@@ -9,4 +9,5 @@ Spree::Core::Engine.routes.draw do
9
9
 
10
10
  post 'cielo_debt/create', to: 'cielo_debt#create', as: :cielo_debt_create
11
11
  get 'cielo_debt/confirm/:credit_card_id/payment_method/:payment_method_id', to: 'cielo_debt#confirm', as: :cielo_debt_confirm
12
+ post 'cielo_debt/confirm/:credit_card_id/payment_method/:payment_method_id', to: 'cielo_debt#confirm'
12
13
  end
@@ -80,7 +80,7 @@ describe 'Cielo Settings', type: :feature do
80
80
  end
81
81
  end
82
82
 
83
- [:visa, :master, :diners, :elo, :discover, :amex, :jcb].each do |card|
83
+ [:visa, :master, :diners, :elo, :discover, :amex, :jcb, :aura].each do |card|
84
84
  it "can edit #{card} credit card", js: true do
85
85
  find(:css, "#credit_#{card}_state").set true
86
86
  fill_in "#{card}_portion", with: 12
@@ -2,7 +2,7 @@
2
2
  Gem::Specification.new do |s|
3
3
  s.platform = Gem::Platform::RUBY
4
4
  s.name = 'spree_zaez_cielo'
5
- s.version = '3.0.3'
5
+ s.version = '3.0.4'
6
6
  s.summary = 'Adds Cielo as a Payment Method to Spree Commerce'
7
7
  s.description = s.summary
8
8
  s.required_ruby_version = '>= 2.0.0'
@@ -54,7 +54,7 @@
54
54
  luhn: true
55
55
  }, {
56
56
  type: 'mastercard',
57
- pattern: /^(5[0-5]|2[2-7])/,
57
+ pattern: /^(5[1-5]|2[2-7])/,
58
58
  format: defaultFormat,
59
59
  length: [16],
60
60
  cvcLength: [3],
@@ -96,11 +96,18 @@
96
96
  luhn: true
97
97
  }, {
98
98
  type: 'elo',
99
- pattern: /^(636[2-3])/,
99
+ pattern: /^(401178|401179|431274|438935|451416|457393|457631|457632|504175|627780|636297|636369|(506699|5067[0-6]\d|50677[0-8])|(50900\d|5090[1-9]\d|509[1-9]\d{2})|65003[1-3]|(65003[5-9]|65004\d|65005[0-1])|(65040[5-9]|6504[1-3]\d)|(65048[5-9]|65049\d|6505[0-2]\d|65053[0-8])|(65054[1-9]|6505[5-8]\d|65059[0-8])|(65070\d|65071[0-8])|65072[0-7]|(65090[1-9]|65091\d|650920)|(65165[2-9]|6516[6-7]\d)|(65500\d|65501\d)|(65502[1-9]|6550[3-4]\d|65505[0-8]))[0-9]{10,12}/,
100
100
  format: defaultFormat,
101
101
  length: [16],
102
102
  cvcLength: [3],
103
103
  luhn: true
104
+ }, {
105
+ type: 'aura',
106
+ pattern: /^(50[0-9])/,
107
+ format: defaultFormat,
108
+ length: [16, 19],
109
+ cvcLength: [3],
110
+ luhn: true
104
111
  }
105
112
  ];
106
113
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_zaez_cielo
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.3
4
+ version: 3.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zaez Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-15 00:00:00.000000000 Z
11
+ date: 2016-02-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: spree_core
@@ -277,12 +277,13 @@ files:
277
277
  - README.md
278
278
  - Rakefile
279
279
  - app/assets/images/credit_cards/icons/amex.png
280
+ - app/assets/images/credit_cards/icons/aura.png
280
281
  - app/assets/images/credit_cards/icons/diners.png
281
282
  - app/assets/images/credit_cards/icons/elo.png
282
283
  - app/assets/images/credit_cards/icons/jcb.png
283
284
  - app/assets/javascripts/spree/backend/spree_zaez_cielo.js
284
285
  - app/assets/javascripts/spree/frontend/app/cielo/cielo_credit.js.coffee
285
- - app/assets/javascripts/spree/frontend/app/cielo/cielo_debt.js.coffee
286
+ - app/assets/javascripts/spree/frontend/app/cielo/cielo_debt.js.coffee.erb
286
287
  - app/assets/javascripts/spree/frontend/spree_zaez_cielo.js
287
288
  - app/assets/stylesheets/spree/backend/spree_zaez_cielo.css
288
289
  - app/assets/stylesheets/spree/frontend/spree_zaez_cielo.css