solidus_culqi 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: fdbb3460b712cbe835663a4d88a97e008e458a23
4
- data.tar.gz: 0e8078f61782a08cd3e0ac1b88a5c225fd1d6a7c
2
+ SHA256:
3
+ metadata.gz: d548bbd540c064028e3c35e7cef61e174088cc2484f26d92e385a022305693df
4
+ data.tar.gz: fb7b737217c4543a5054cf760e6866cea920965aba47c25d557fdb2c251250fe
5
5
  SHA512:
6
- metadata.gz: 1bcfa5ff8c9d5a4e703f7aeeeedd080b316f85a1059bec09274ce5e97ad944be8e45f2b67891bd1d7c04f3fe37a8a87b47063cdd3c260f437f2fda2b01c44b5b
7
- data.tar.gz: 33e300adeef585cc5363ced254f72d43d0ccf32dba969dc1803b069d82960ce3af82332a3f6cfee64b85e881f449423ba4903ffd9e076b7e3b9b711e3a584946
6
+ metadata.gz: a379ae5e7851734368a64ae042e9c377bd9e664eec5775e61e52260439c38e2418e3fd7e3d2c03926614de7363cd760c97d59d5f3c1081913218187897ef4efd
7
+ data.tar.gz: 0fcb39175df45feebdabbef1657cdf47666b3a791384d85f57c02d40f21bdf20e17c2e57f96fcf1758658ddbc84673c812908d9e0e7da18d3b289259d0ea03c7
@@ -53,6 +53,7 @@ module Solidus
53
53
 
54
54
  def create_profile(payment)
55
55
  return unless payment.source.gateway_customer_profile_id.nil?
56
+
56
57
  init_culqi
57
58
  customer = get_customer(payment)
58
59
  token = payment.source.gateway_payment_profile_id
@@ -90,8 +91,8 @@ module Solidus
90
91
  def parse_response(response)
91
92
  res = JSON.parse(response)
92
93
  ActiveMerchant::Billing::Response.new(
93
- res[:object] != "error",
94
- res[:merchant_message],
94
+ res["object"] != "error",
95
+ res["merchant_message"],
95
96
  res,
96
97
  authorization: res["id"]
97
98
  )
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SolidusCulqi
4
- VERSION = '0.1.0'
4
+ VERSION = '0.1.1'
5
5
  end
@@ -25,11 +25,11 @@ Gem::Specification.new do |s|
25
25
  s.add_development_dependency 'capybara'
26
26
  s.add_development_dependency 'database_cleaner'
27
27
  s.add_development_dependency 'factory_bot'
28
- s.add_development_dependency 'poltergeist'
29
28
  s.add_development_dependency 'pry'
30
29
  s.add_development_dependency 'rspec-rails'
31
30
  s.add_development_dependency 'rubocop'
32
31
  s.add_development_dependency 'rubocop-rspec'
32
+ s.add_development_dependency 'selenium-webdriver'
33
33
  s.add_development_dependency 'simplecov'
34
34
  s.add_development_dependency 'vcr'
35
35
  s.add_development_dependency 'webmock'
@@ -76,4 +76,28 @@ RSpec.describe "Culqi checkout autocapture", :vcr, type: :feature, js: true do
76
76
  expect(page).to have_content("El numero de tarjeta de crédito o débito brindado no es válido.")
77
77
  end
78
78
  end
79
+
80
+ context "with stolen card" do
81
+ it "shows an error" do
82
+ fill_in "Card Number", with: "4000 0200 0000 0000"
83
+ fill_in "Card Code", with: "354"
84
+ fill_in "Expiration", with: "10 / 19"
85
+ click_button "Save and Continue"
86
+ sleep(5)
87
+ click_button "Save and Continue"
88
+ expect(page).to have_content("El numero de tarjeta de crédito o débito brindado no es válido.")
89
+ end
90
+ end
91
+
92
+ context "with insufficient funds" do
93
+ it "shows an error" do
94
+ fill_in "Card Number", with: "4000 0400 0000 0008"
95
+ fill_in "Card Code", with: "295"
96
+ fill_in "Expiration", with: "03 / 21"
97
+ click_button "Save and Continue"
98
+ sleep(5)
99
+ click_button "Save and Continue"
100
+ expect(page).to have_content("El numero de tarjeta de crédito o débito brindado no es válido.")
101
+ end
102
+ end
79
103
  end
data/spec/spec_helper.rb CHANGED
@@ -23,13 +23,20 @@ require 'ffaker'
23
23
  require 'vcr'
24
24
  require 'webmock'
25
25
  require 'capybara/rspec'
26
- require 'capybara/poltergeist'
26
+ require 'selenium-webdriver'
27
27
  require 'pry'
28
28
 
29
- Capybara.register_driver(:poltergeist) do |app|
30
- Capybara::Poltergeist::Driver.new app, timeout: 90
29
+ Capybara.register_driver :geckodriver do |app|
30
+ ::Selenium::WebDriver::Firefox.driver_path = ENV['DRIVER_PATH']
31
+ options = ::Selenium::WebDriver::Firefox::Options.new
32
+ options.args << '--headless'
33
+
34
+ Capybara::Selenium::Driver.new(app,
35
+ browser: :firefox,
36
+ options: options)
31
37
  end
32
- Capybara.javascript_driver = :poltergeist
38
+
39
+ Capybara.javascript_driver = :geckodriver
33
40
  Capybara.default_max_wait_time = 30
34
41
 
35
42
  # Requires supporting ruby files with custom matchers and macros, etc,
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solidus_culqi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - César Carruitero
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-11 00:00:00.000000000 Z
11
+ date: 2018-12-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: culqi-ruby
@@ -95,7 +95,7 @@ dependencies:
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
- name: poltergeist
98
+ name: pry
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - ">="
@@ -109,7 +109,7 @@ dependencies:
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
- name: pry
112
+ name: rspec-rails
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - ">="
@@ -123,7 +123,7 @@ dependencies:
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  - !ruby/object:Gem::Dependency
126
- name: rspec-rails
126
+ name: rubocop
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - ">="
@@ -137,7 +137,7 @@ dependencies:
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
139
  - !ruby/object:Gem::Dependency
140
- name: rubocop
140
+ name: rubocop-rspec
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
143
  - - ">="
@@ -151,7 +151,7 @@ dependencies:
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0'
153
153
  - !ruby/object:Gem::Dependency
154
- name: rubocop-rspec
154
+ name: selenium-webdriver
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
157
  - - ">="
@@ -270,7 +270,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
270
270
  version: '0'
271
271
  requirements: []
272
272
  rubyforge_project:
273
- rubygems_version: 2.6.14
273
+ rubygems_version: 2.7.6
274
274
  signing_key:
275
275
  specification_version: 4
276
276
  summary: Adds solidus support for Culqi Gateway