solidus_braintree 1.0.0 → 1.1.0

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
2
  SHA1:
3
- metadata.gz: 28f5f6d8e3a10296a22d9b5d9bf9f96f7146b5bb
4
- data.tar.gz: f4718eedf1bcc717672fc6b97ff5cf9542f48566
3
+ metadata.gz: 2dc626000669163124de96bf97bf6a20aa28078c
4
+ data.tar.gz: 7a81acc31f411af559dfbe0fb9a023d962d3491d
5
5
  SHA512:
6
- metadata.gz: 54b07c41d17e102b686ff466b4361b07bc6b0b051c53953ee229ea163e05b0dc19f8841e9f866c5ac9bc169b8098f816ae7e3e39fd0d6dff12fc773343c7e4fc
7
- data.tar.gz: 7875589e8a6034511cbeed423e44f83cd9adb66de4bea5f94fe5b5d45bbd7ced33c7f58f1f4dce6a339e36979a11afd8224f6582f4c0d55adf8768ec0a119ffa
6
+ metadata.gz: 79b5a87a130c7389d9900af4a51840e87dab35a7026ac74a6f11a52a2164356e8fcb4457bba78fce3974c3ae879d00045b9b26c58fab8c6f756d783d7e33e898
7
+ data.tar.gz: 794e78130c00e985767a2c4d136fbc2ef831d9808ff1d45aa13fd7ada5f977323673f065e5d0007d9c9ff1da869829de187aa54cfeb479850b4f981d19a3679e
@@ -1,20 +1,18 @@
1
1
  sudo: false
2
- cache: bundler
3
2
  language: ruby
4
- addons:
5
- postgresql: "9.3"
3
+ rvm:
4
+ - 2.3.1
6
5
  env:
7
6
  matrix:
8
- - SOLIDUS_BRANCH=v1.1 DB=postgres
9
- - SOLIDUS_BRANCH=v1.2 DB=postgres
10
- - SOLIDUS_BRANCH=v1.3 DB=postgres
7
+ - SOLIDUS_BRANCH=v1.1 DB=postgres
8
+ - SOLIDUS_BRANCH=v1.2 DB=postgres
9
+ - SOLIDUS_BRANCH=v1.3 DB=postgres
10
+ - SOLIDUS_BRANCH=v1.4 DB=postgres
11
+ - SOLIDUS_BRANCH=v2.0 DB=postgres
11
12
  - SOLIDUS_BRANCH=master DB=postgres
12
- - SOLIDUS_BRANCH=v1.1 DB=mysql
13
- - SOLIDUS_BRANCH=v1.2 DB=mysql
14
- - SOLIDUS_BRANCH=v1.3 DB=mysql
13
+ - SOLIDUS_BRANCH=v1.1 DB=mysql
14
+ - SOLIDUS_BRANCH=v1.2 DB=mysql
15
+ - SOLIDUS_BRANCH=v1.3 DB=mysql
16
+ - SOLIDUS_BRANCH=v1.4 DB=mysql
17
+ - SOLIDUS_BRANCH=v2.0 DB=mysql
15
18
  - SOLIDUS_BRANCH=master DB=mysql
16
- script:
17
- - bundle exec rake test_app
18
- - bundle exec rspec
19
- rvm:
20
- - 2.1.8
data/Gemfile CHANGED
@@ -1,10 +1,17 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
2
 
3
- # Specify your gem's dependencies in solidus_braintree.gemspec
4
3
  branch = ENV.fetch('SOLIDUS_BRANCH', 'master')
5
4
  gem "solidus", github: "solidusio/solidus", branch: branch
6
5
 
6
+ if branch == 'master' || branch >= "v2.0"
7
+ gem "rails-controller-testing", group: :test
8
+ end
9
+
7
10
  gem 'pg'
8
11
  gem 'mysql2'
9
12
 
13
+ group :development, :test do
14
+ gem "pry-rails"
15
+ end
16
+
10
17
  gemspec
data/Rakefile CHANGED
@@ -1,12 +1,18 @@
1
- require "bundler/gem_tasks"
2
1
  require "rspec/core/rake_task"
3
2
  require 'spree/testing_support/extension_rake'
4
3
 
5
4
  RSpec::Core::RakeTask.new(:spec)
6
5
 
6
+ require 'bundler'
7
7
  Bundler::GemHelper.install_tasks
8
8
 
9
- task default: :spec
9
+ task :default do
10
+ if Dir["spec/dummy"].empty?
11
+ Rake::Task[:test_app].invoke
12
+ Dir.chdir("../../")
13
+ end
14
+ Rake::Task[:spec].invoke
15
+ end
10
16
 
11
17
  desc "Generates a dummy app for testing"
12
18
  task :test_app do
@@ -7,6 +7,7 @@ module Solidus
7
7
  preference :public_key, :string
8
8
  preference :private_key, :string
9
9
  preference :always_send_bill_address, :boolean, default: false
10
+ preference :transmit_shipping_address, :boolean, default: true
10
11
 
11
12
  CARD_TYPE_MAPPING = {
12
13
  'American Express' => 'american_express',
@@ -165,6 +166,16 @@ module Solidus
165
166
  '123'
166
167
  end
167
168
 
169
+ def cancel(response)
170
+ if voidable?(response)
171
+ void(response)
172
+ else
173
+ handle_result(
174
+ braintree_gateway.transaction.refund(response)
175
+ )
176
+ end
177
+ end
178
+
168
179
  private
169
180
  def message_from_result(result)
170
181
  if result.success?
@@ -244,7 +255,9 @@ module Solidus
244
255
  params[:options] ||= {}
245
256
  params[:amount] = amount(cents)
246
257
  params[:channel] ||= "Solidus"
247
- params[:shipping] = map_address(options[:shipping_address]) if options[:shipping_address]
258
+ if (options[:shipping_address] && preferred_transmit_shipping_address)
259
+ params[:shipping] = map_address(options[:shipping_address])
260
+ end
248
261
 
249
262
  if options[:payment_method_nonce]
250
263
  params[:payment_method_nonce] = options[:payment_method_nonce]
@@ -254,8 +267,10 @@ module Solidus
254
267
 
255
268
  # Send the bill address if we're using a nonce (i.e. doing a one-time
256
269
  # payment) or if we're configured to always send the bill address
257
- if options[:payment_method_nonce] || preferred_always_send_bill_address
258
- params[:billing] = map_address(options[:billing_address]) if options[:billing_address]
270
+ if (
271
+ options[:payment_method_nonce] || preferred_always_send_bill_address
272
+ ) && options[:billing_address]
273
+ params[:billing] = map_address(options[:billing_address])
259
274
  end
260
275
 
261
276
  # if has profile, set the customer_id to the profile_id and delete the customer key
@@ -4,8 +4,8 @@
4
4
  <% previous_cards.each do |card| %>
5
5
  <label><%= radio_button_tag :card, card.id, card == previous_cards.first %> <%= card.display_number %><br /></label>
6
6
  <% end %>
7
- <label><%= radio_button_tag :card, 'new', false, { id: "card_new#{payment_method.id}" } %> <%= Spree.t(:use_new_cc) %></label>
8
7
  <% end %>
8
+ <label><%= radio_button_tag :card, 'new', false, { id: "card_new#{payment_method.id}" } %> <%= Spree.t(:use_new_cc) %></label>
9
9
  </div>
10
10
 
11
11
  <div id="card_form<%= payment_method.id %>" data-hook>
@@ -1,3 +1,3 @@
1
1
  module SolidusBraintree
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.0"
3
3
  end
@@ -19,8 +19,8 @@ Gem::Specification.new do |spec|
19
19
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
20
  spec.require_paths = ["lib"]
21
21
 
22
- spec.add_dependency "solidus_api", [">= 1.0.0", "< 2"]
23
- spec.add_dependency "solidus_core", [">= 1.0.0", "< 2"]
22
+ spec.add_dependency "solidus_api", [">= 1.0.0", "< 3"]
23
+ spec.add_dependency "solidus_core", [">= 1.0.0", "< 3"]
24
24
  spec.add_dependency "braintree", "~> 2.46"
25
25
 
26
26
  spec.add_development_dependency "bundler", "~> 1.10"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solidus_braintree
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Solidus Team
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-06-24 00:00:00.000000000 Z
11
+ date: 2016-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: solidus_api
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: 1.0.0
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '2'
22
+ version: '3'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  version: 1.0.0
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '2'
32
+ version: '3'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: solidus_core
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -39,7 +39,7 @@ dependencies:
39
39
  version: 1.0.0
40
40
  - - "<"
41
41
  - !ruby/object:Gem::Version
42
- version: '2'
42
+ version: '3'
43
43
  type: :runtime
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
@@ -49,7 +49,7 @@ dependencies:
49
49
  version: 1.0.0
50
50
  - - "<"
51
51
  - !ruby/object:Gem::Version
52
- version: '2'
52
+ version: '3'
53
53
  - !ruby/object:Gem::Dependency
54
54
  name: braintree
55
55
  requirement: !ruby/object:Gem::Requirement
@@ -357,7 +357,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
357
357
  version: '0'
358
358
  requirements: []
359
359
  rubyforge_project:
360
- rubygems_version: 2.4.5
360
+ rubygems_version: 2.5.1
361
361
  signing_key:
362
362
  specification_version: 4
363
363
  summary: Adds Solidus support for Braintree v.zero Gateway.