killbill-braintree_blue 0.0.1 → 0.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: a8ba7f846ef168af2bc71bd2cb013e3fc63f13d5
4
- data.tar.gz: bfb8460936180508eaedf15b0f9d19f4192316b2
3
+ metadata.gz: 0e7f8214ec9c7c7d78778ecb7219eaadf1fb7d1c
4
+ data.tar.gz: 8d747ad742a8620f00d4909d60e34aee96387490
5
5
  SHA512:
6
- metadata.gz: 25b52d0e2381be9fe7780c19d2e99b17d661e27036770a56913cbe58d3885c548d420a8a38d09b7c438f2450198cdaa0dc1fec3e98dce319a2256a7c0ae5d021
7
- data.tar.gz: 3858b65953e5524bd5429479aaa42988dbd9ea395f3e7f8c59e17add0e31f6e6836c9a31d46d263a8007cb90b87add09bbe857d18c4df0356e276c62287686f3
6
+ metadata.gz: a5a042641b44ff631f5e0aa3072e6dde2a0804e02f8c1f1509d96bcf0c9caee960665352bf2798630af1760ac224dac35589f3061ed5619c025343ccb1e2bee2
7
+ data.tar.gz: b049a15d3dce16a40de54a75a19d9270f45ffe3a76aceb05c43dbb5a998bfe8e1ea57fe7eed2c29c3f9a2a101d7d26483453833a9ab62020fb3c290dfd965212
data/.gitignore CHANGED
@@ -19,18 +19,17 @@ _yardoc
19
19
  doc/
20
20
 
21
21
  .jbundler
22
- Jarfile.lock
23
- Gemfile.lock
24
22
 
25
23
  .DS_Store
26
24
 
27
- # Build directory
28
- killbill-braintree_blue/
29
-
30
25
  # Testing database
31
26
  test.db
32
27
 
28
+ braintree_blue.log
29
+
33
30
  target
34
31
  pom.xml.asc
35
32
 
36
33
  .idea/
34
+
35
+ Gemfile.head.lock
data/.travis.yml CHANGED
@@ -1,19 +1,38 @@
1
1
  language: ruby
2
2
 
3
+ sudo: false
4
+ cache: bundler
5
+
6
+ script: 'bundle exec rake test:spec test:remote:spec'
7
+
3
8
  notifications:
4
9
  email:
5
10
  - kill-bill-commits@googlegroups.com
6
11
 
12
+ env:
13
+ global:
14
+ - JRUBY_OPTS='-J-Xmx1024M'
15
+
7
16
  rvm:
8
- - jruby-19mode
9
- - jruby-20mode
17
+ - jruby-1.7.20
18
+ - jruby-20mode # latest 1.7.x
10
19
  - jruby-head
11
20
 
21
+ gemfile:
22
+ - Gemfile
23
+ - Gemfile.head
24
+
12
25
  jdk:
13
- - openjdk6
14
26
  - openjdk7
15
27
  - oraclejdk7
28
+ - oraclejdk8
16
29
 
17
30
  matrix:
18
31
  allow_failures:
19
32
  - rvm: jruby-head
33
+ - jdk: oraclejdk8
34
+ - gemfile: Gemfile.head
35
+ fast_finish: true
36
+
37
+ after_success:
38
+ - '[ "${TRAVIS_PULL_REQUEST}" = "false" ] && echo "<settings><servers><server><id>sonatype-nexus-snapshots</id><username>\${env.OSSRH_USER}</username><password>\${env.OSSRH_PASS}</password></server></servers></settings>" > ~/settings.xml && MVN="mvn --settings $HOME/settings.xml" NO_RELEASE=1 travis_retry travis_wait bash release.sh | egrep -v "Download|Install|Upload" ; rm -f ~/settings.xml'
data/Gemfile CHANGED
@@ -1,3 +1,3 @@
1
- source 'http://rubygems.org'
1
+ source 'https://rubygems.org'
2
2
 
3
3
  gemspec
data/Gemfile.head ADDED
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ gem 'killbill', :github => 'killbill/killbill-plugin-framework-ruby', :ref => 'HEAD'
data/Gemfile.lock ADDED
@@ -0,0 +1,134 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ killbill-braintree_blue (0.1.0)
5
+ actionpack (~> 4.1.0)
6
+ actionview (~> 4.1.0)
7
+ activemerchant (~> 1.48.0)
8
+ activerecord (~> 4.1.0)
9
+ activerecord-bogacs (~> 0.3)
10
+ activerecord-jdbc-adapter (~> 1.3)
11
+ braintree (~> 2.0)
12
+ jruby-openssl (~> 0.9.6)
13
+ killbill (~> 4.0.0)
14
+ monetize (~> 1.1.0)
15
+ money (~> 6.5.1)
16
+ offsite_payments (~> 2.1.0)
17
+ sinatra (~> 1.3.4)
18
+ thread_safe (~> 0.3.4)
19
+
20
+ GEM
21
+ remote: https://rubygems.org/
22
+ specs:
23
+ actionpack (4.1.14)
24
+ actionview (= 4.1.14)
25
+ activesupport (= 4.1.14)
26
+ rack (~> 1.5.2)
27
+ rack-test (~> 0.6.2)
28
+ actionview (4.1.14)
29
+ activesupport (= 4.1.14)
30
+ builder (~> 3.1)
31
+ erubis (~> 2.7.0)
32
+ active_utils (3.0.0)
33
+ activesupport (>= 3.2)
34
+ i18n
35
+ activemerchant (1.48.0)
36
+ activesupport (>= 3.2.14, < 5.0.0)
37
+ builder (>= 2.1.2, < 4.0.0)
38
+ i18n (>= 0.6.9)
39
+ nokogiri (~> 1.4)
40
+ activemodel (4.1.14)
41
+ activesupport (= 4.1.14)
42
+ builder (~> 3.1)
43
+ activerecord (4.1.14)
44
+ activemodel (= 4.1.14)
45
+ activesupport (= 4.1.14)
46
+ arel (~> 5.0.0)
47
+ activerecord-bogacs (0.4.1)
48
+ activerecord-jdbc-adapter (1.3.19)
49
+ activerecord (>= 2.2)
50
+ activesupport (4.1.14)
51
+ i18n (~> 0.6, >= 0.6.9)
52
+ json (~> 1.7, >= 1.7.7)
53
+ minitest (~> 5.1)
54
+ thread_safe (~> 0.1)
55
+ tzinfo (~> 1.1)
56
+ arel (5.0.1.20140414130214)
57
+ braintree (2.54.0)
58
+ builder (>= 2.0.0)
59
+ builder (3.2.2)
60
+ diff-lcs (1.1.3)
61
+ erubis (2.7.0)
62
+ ethon (0.8.0)
63
+ ffi (>= 1.3.0)
64
+ ffi (1.9.10-java)
65
+ i18n (0.7.0)
66
+ jbundler (0.4.3)
67
+ maven-tools (~> 0.32.1)
68
+ ruby-maven (~> 3.0.4)
69
+ jdbc-mariadb (1.2.3)
70
+ jdbc-sqlite3 (3.8.11.2)
71
+ jruby-openssl (0.9.12-java)
72
+ json (1.8.3-java)
73
+ killbill (4.0.0)
74
+ rack (>= 1.5.2)
75
+ sinatra (~> 1.3.4)
76
+ typhoeus (~> 0.6.9)
77
+ tzinfo (~> 1.2.0)
78
+ maven-tools (0.32.5)
79
+ minitest (5.8.3)
80
+ monetize (1.1.0)
81
+ money (~> 6.5.0)
82
+ money (6.5.1)
83
+ i18n (>= 0.6.4, <= 0.7.0)
84
+ nokogiri (1.6.6.3-java)
85
+ offsite_payments (2.1.0)
86
+ actionpack (>= 3.2.20, < 5.0.0)
87
+ active_utils (~> 3.0.0)
88
+ activesupport (>= 3.2.14, < 5.0.0)
89
+ builder (>= 2.1.2, < 4.0.0)
90
+ i18n (~> 0.5)
91
+ money (>= 5.0.0, < 7.0.0)
92
+ nokogiri (~> 1.4)
93
+ rack (1.5.5)
94
+ rack-protection (1.5.3)
95
+ rack
96
+ rack-test (0.6.3)
97
+ rack (>= 1.0)
98
+ rake (10.4.2)
99
+ rspec (2.12.0)
100
+ rspec-core (~> 2.12.0)
101
+ rspec-expectations (~> 2.12.0)
102
+ rspec-mocks (~> 2.12.0)
103
+ rspec-core (2.12.2)
104
+ rspec-expectations (2.12.1)
105
+ diff-lcs (~> 1.1.3)
106
+ rspec-mocks (2.12.2)
107
+ ruby-maven (3.0.4.1.4)
108
+ maven-tools (~> 0.32.3)
109
+ thor (>= 0.14.6, < 2.0)
110
+ sinatra (1.3.6)
111
+ rack (~> 1.4)
112
+ rack-protection (~> 1.3)
113
+ tilt (~> 1.3, >= 1.3.3)
114
+ thor (0.19.1)
115
+ thread_safe (0.3.5-java)
116
+ tilt (1.4.1)
117
+ typhoeus (0.6.9)
118
+ ethon (>= 0.7.1)
119
+ tzinfo (1.2.2)
120
+ thread_safe (~> 0.1)
121
+
122
+ PLATFORMS
123
+ java
124
+
125
+ DEPENDENCIES
126
+ jbundler (~> 0.4.3)
127
+ jdbc-mariadb (~> 1.1)
128
+ jdbc-sqlite3 (~> 3.7)
129
+ killbill-braintree_blue!
130
+ rake (>= 10.0.0)
131
+ rspec (~> 2.12.0)
132
+
133
+ BUNDLED WITH
134
+ 1.10.6
data/Jarfile CHANGED
@@ -1,8 +1,9 @@
1
- jar 'org.kill-bill.billing:killbill-api', '0.10.2'
2
- jar 'org.kill-bill.billing.plugin:killbill-plugin-api-notification', '0.8.2'
3
- jar 'org.kill-bill.billing.plugin:killbill-plugin-api-payment', '0.8.2'
4
- jar 'org.kill-bill.billing.plugin:killbill-plugin-api-currency', '0.8.2'
5
- jar 'org.kill-bill.billing.plugin:killbill-plugin-api-routing', '0.8.2'
6
- jar 'org.kill-bill.billing.plugin:killbill-plugin-api-invoice', '0.8.2'
7
- jar 'org.kill-bill.billing:killbill-util:tests', '0.12.1'
8
- jar 'javax.servlet:javax.servlet-api', '3.0.1'
1
+ jar 'org.kill-bill.billing:killbill-api', '0.14'
2
+ jar 'org.kill-bill.billing.plugin:killbill-plugin-api-currency', '0.9'
3
+ jar 'org.kill-bill.billing.plugin:killbill-plugin-api-invoice', '0.9'
4
+ jar 'org.kill-bill.billing.plugin:killbill-plugin-api-notification', '0.9'
5
+ jar 'org.kill-bill.billing.plugin:killbill-plugin-api-payment', '0.9'
6
+ jar 'org.kill-bill.billing.plugin:killbill-plugin-api-routing', '0.9'
7
+ jar 'org.kill-bill.billing:killbill-util:tests', '0.13.7'
8
+ jar 'org.mockito:mockito-all', '1.10.19'
9
+ jar 'javax.servlet:javax.servlet-api', '3.1.0'
data/Jarfile.lock ADDED
@@ -0,0 +1,56 @@
1
+ org.kill-bill.billing:killbill-api:jar:0.14
2
+ com.fasterxml.jackson.core:jackson-annotations:jar:2.4.3
3
+ joda-time:joda-time:jar:2.3
4
+ org.kill-bill.billing.plugin:killbill-plugin-api-currency:jar:0.9
5
+ org.kill-bill.billing.plugin:killbill-plugin-api-invoice:jar:0.9
6
+ org.kill-bill.billing.plugin:killbill-plugin-api-notification:jar:0.9
7
+ org.kill-bill.billing.plugin:killbill-plugin-api-payment:jar:0.9
8
+ org.kill-bill.billing.plugin:killbill-plugin-api-routing:jar:0.9
9
+ org.kill-bill.billing:killbill-util:jar:tests:0.13.7
10
+ com.fasterxml.jackson.core:jackson-databind:jar:2.4.3
11
+ com.fasterxml.jackson.core:jackson-core:jar:2.4.3
12
+ com.fasterxml.jackson.dataformat:jackson-dataformat-csv:jar:2.4.3
13
+ com.fasterxml.jackson.datatype:jackson-datatype-joda:jar:2.4.3
14
+ com.samskivert:jmustache:jar:1.5
15
+ io.dropwizard.metrics:metrics-core:jar:3.1.1
16
+ io.dropwizard.metrics:metrics-ehcache:jar:3.1.1
17
+ net.sf.ehcache:ehcache:jar:2.9.1
18
+ org.antlr:stringtemplate:jar:3.2.1
19
+ antlr:antlr:jar:2.7.7
20
+ org.apache.commons:commons-email:jar:1.2
21
+ javax.mail:mail:jar:1.4.1
22
+ javax.activation:activation:jar:1.1
23
+ org.apache.shiro:shiro-core:jar:1.2.3
24
+ commons-beanutils:commons-beanutils:jar:1.8.3
25
+ org.apache.shiro:shiro-ehcache:jar:1.2.3
26
+ org.apache.shiro:shiro-guice:jar:1.2.3
27
+ com.google.guava:guava:jar:r09
28
+ com.google.inject:guice:jar:3.0
29
+ aopalliance:aopalliance:jar:1.0
30
+ com.google.inject.extensions:guice-multibindings:jar:3.0
31
+ org.jdbi:jdbi:jar:2.62
32
+ org.joda:joda-money:jar:0.9
33
+ org.kill-bill.billing:killbill-internal-api:jar:0.13.7
34
+ org.kill-bill.billing:killbill-platform-api:jar:0.2
35
+ org.kill-bill.billing:killbill-platform-base:jar:0.2
36
+ com.google.code.findbugs:annotations:jar:3.0.0
37
+ org.bgee.log4jdbc-log4j2:log4jdbc-log4j2-jdbc4:jar:1.16
38
+ org.kill-bill.billing:killbill-platform-osgi-api:jar:0.2
39
+ org.osgi:org.osgi.core:jar:5.0.0
40
+ org.kill-bill.commons:killbill-clock:jar:0.3
41
+ org.kill-bill.commons:killbill-concurrent:jar:0.3
42
+ org.kill-bill.commons:killbill-embeddeddb-common:jar:0.3
43
+ org.kill-bill.commons:killbill-jdbi:jar:0.3
44
+ com.h2database:h2:jar:1.4.186
45
+ javax.inject:javax.inject:jar:1
46
+ org.kill-bill.commons:killbill-locker:jar:0.3
47
+ org.kill-bill.commons:killbill-queue:jar:0.3
48
+ org.kill-bill.commons:killbill-xmlloader:jar:0.3
49
+ org.skife.config:config-magic:jar:0.14
50
+ org.slf4j:jcl-over-slf4j:jar:1.7.12
51
+ org.slf4j:slf4j-api:jar:1.7.12
52
+ org.weakref:jmxutils:jar:1.12
53
+ org.mockito:mockito-all:jar:1.10.19
54
+ javax.servlet:javax.servlet-api:jar:3.1.0
55
+ org.bouncycastle:bcpkix-jdk15on:jar:1.50
56
+ org.bouncycastle:bcprov-jdk15on:jar:1.50
data/LICENSE CHANGED
@@ -186,7 +186,7 @@ Apache License
186
186
  same "printed page" as the copyright notice for easier
187
187
  identification within third-party archives.
188
188
 
189
- Copyright 2014 The Billing Project, LLC
189
+ Copyright 2014-2015 The Billing Project, LLC
190
190
 
191
191
  Licensed under the Apache License, Version 2.0 (the "License");
192
192
  you may not use this file except in compliance with the License.
@@ -198,4 +198,4 @@ Apache License
198
198
  distributed under the License is distributed on an "AS IS" BASIS,
199
199
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
200
  See the License for the specific language governing permissions and
201
- limitations under the License.
201
+ limitations under the License.
data/README.md CHANGED
@@ -7,4 +7,41 @@ See original repo https://bitbucket.org/safekiddo/killbill-braintree-blue-plugin
7
7
  We cloned the repo to have it on github along with the other payment plugins supported on Kill Bill.
8
8
  It is advisable to also check for latest commit from original repo before using.
9
9
 
10
+ Kill Bill compatibility
11
+ -----------------------
12
+
13
+ | Plugin version | Kill Bill version |
14
+ | -------------: | ----------------: |
15
+ | 0.0.y | 0.14.z |
16
+ | 0.1.y | 0.15.z |
17
+
18
+ Requirements
19
+ ------------
20
+
21
+ The plugin needs a database. The latest version of the schema can be found [here](https://github.com/killbill/killbill-braintree-blue-plugin/blob/master/db/ddl.sql).
22
+
23
+ Configuration
24
+ -------------
25
+
26
+ ```
27
+ curl -v \
28
+ -X POST \
29
+ -u admin:password \
30
+ -H 'X-Killbill-ApiKey: bob' \
31
+ -H 'X-Killbill-ApiSecret: lazar' \
32
+ -H 'X-Killbill-CreatedBy: admin' \
33
+ -H 'Content-Type: text/plain' \
34
+ -d ':braintree_blue:
35
+ :merchant_id: ABC
36
+ :public_key: DEF
37
+ :private_key: GHI' \
38
+ http://127.0.0.1:8080/1.0/kb/tenants/uploadPluginConfig/killbill-braintree_blue
39
+ ```
40
+
41
+ To go to production, create a `braintree_blue.yml` configuration file under `/var/tmp/bundles/plugins/ruby/killbill-braintree-blue/x.y.z/` containing the following:
42
+
43
+ ```
44
+ :braintree_blue:
45
+ :test: false
46
+ ```
10
47
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.1.0
data/braintree_blue.yml CHANGED
@@ -1,25 +1,34 @@
1
1
  :braintree_blue:
2
- :merchant_id:
3
- :public_key:
4
- :private_key:
2
+ :merchant_id: <%= ENV['MERCHANT_ID'] %>
3
+ :public_key: <%= ENV['PUBLIC_KEY'] %>
4
+ :private_key: <%= ENV['PRIVATE_KEY'] %>
5
5
  :test: true
6
- :log_file: /var/tmp/braintree_blue.log
7
6
  :multicurrency: true
8
7
 
8
+ :multicurrency:
9
+ :USD: USD
10
+
9
11
  :database:
12
+ # SQLite (development)
10
13
  :adapter: sqlite3
11
14
  :database: test.db
12
15
  # For MySQL
13
- # :adapter: 'jdbcmysql'
16
+ # :adapter: mysql
14
17
  # :username: 'killbill'
15
18
  # :password: 'killbill'
16
- # :driver: 'com.mysql.jdbc.Driver'
17
- # :url: 'jdbc:mysql://127.0.0.1:3306/killbill'
19
+ # :database: 'killbill' # or set the URL :
20
+ # #:url: jdbc:mysql://127.0.0.1:3306/killbill
21
+ # :driver: org.mariadb.jdbc.Driver # as in KB
22
+ # :pool: 30 # AR's default is max 5 connections
18
23
  # In Kill Bill
19
- # :adapter: 'jdbcmysql'
24
+ # :adapter: mysql
20
25
  # :jndi: 'killbill/osgi/jdbc'
21
- # :connection_alive_sql: 'select 1'
22
- # :pool: 250
23
-
24
- :multicurrency:
25
- :USD: USD
26
+ # :pool: false # false-pool (JNDI pool's max)
27
+ # # uncomment if pool does not support JDBC4 :
28
+ # #:connection_alive_sql: 'select 1'
29
+ # # MySQL adapter #configure_connection defaults :
30
+ # # @@SESSION.sql_auto_is_null = 0,
31
+ # # @@SESSION.wait_timeout = 2147483,
32
+ # # @@SESSION.sql_mode = 'STRICT_ALL_TABLES'
33
+ # # ... can be disabled (on AR-JDBC 1.4) using :
34
+ # :configure_connection: false
@@ -12,39 +12,43 @@ Gem::Specification.new do |s|
12
12
 
13
13
  s.author = 'Kill Bill core team'
14
14
  s.email = 'killbilling-users@googlegroups.com'
15
- s.homepage = 'http://kill-bill.org'
15
+ s.homepage = 'http://killbill.io'
16
16
 
17
17
  s.files = `git ls-files`.split("\n")
18
18
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
19
  s.bindir = 'bin'
20
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
+ s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
21
21
  s.require_paths = ['lib']
22
22
 
23
23
  s.rdoc_options << '--exclude' << '.'
24
24
 
25
- s.add_dependency 'killbill', '~> 3.1.11'
26
- s.add_dependency 'activemerchant', '~> 1.44.1'
27
- s.add_dependency 'offsite_payments', '~> 2.0.1'
28
- s.add_dependency 'activerecord', '~> 4.1.0'
29
- s.add_dependency 'actionpack', '~> 4.1.0'
30
- s.add_dependency 'actionview', '~> 4.1.0'
31
- s.add_dependency 'activesupport', '~> 4.1.0'
32
- s.add_dependency 'money', '~> 6.1.1'
33
- s.add_dependency 'monetize', '~> 0.3.0'
25
+ s.add_dependency 'killbill', '~> 4.0.0'
26
+
27
+ s.add_dependency 'braintree', '~> 2.0'
28
+
34
29
  s.add_dependency 'sinatra', '~> 1.3.4'
30
+ s.add_dependency 'thread_safe', '~> 0.3.4'
31
+ s.add_dependency 'activerecord', '~> 4.1.0'
35
32
  if defined?(JRUBY_VERSION)
36
- s.add_dependency 'activerecord-jdbcmysql-adapter', '~> 1.3.7'
33
+ s.add_dependency 'activerecord-bogacs', '~> 0.3'
34
+ s.add_dependency 'activerecord-jdbc-adapter', '~> 1.3'
37
35
  # Required to avoid errors like java.lang.NoClassDefFoundError: org/bouncycastle/asn1/DERBoolean
38
- s.add_dependency 'jruby-openssl', '~> 0.9.4'
36
+ s.add_dependency 'jruby-openssl', '~> 0.9.6'
39
37
  end
38
+ s.add_dependency 'actionpack', '~> 4.1.0'
39
+ s.add_dependency 'actionview', '~> 4.1.0'
40
+ s.add_dependency 'activemerchant', '~> 1.48.0'
41
+ s.add_dependency 'offsite_payments', '~> 2.1.0'
42
+ s.add_dependency 'monetize', '~> 1.1.0'
43
+ s.add_dependency 'money', '~> 6.5.1'
40
44
 
41
- s.add_development_dependency 'jbundler', '~> 0.4.1'
45
+ s.add_development_dependency 'jbundler', '~> 0.4.3'
42
46
  s.add_development_dependency 'rake', '>= 10.0.0'
43
47
  s.add_development_dependency 'rspec', '~> 2.12.0'
44
48
  if defined?(JRUBY_VERSION)
45
- s.add_development_dependency 'activerecord-jdbcsqlite3-adapter', '~> 1.3.7'
49
+ s.add_development_dependency 'jdbc-sqlite3', '~> 3.7'
50
+ s.add_development_dependency 'jdbc-mariadb', '~> 1.1'
46
51
  else
47
52
  s.add_development_dependency 'sqlite3', '~> 1.3.7'
48
53
  end
49
- s.add_dependency 'braintree', '~> 2.0'
50
54
  end
@@ -7,8 +7,8 @@ module Killbill #:nodoc:
7
7
  # Change this if needed
8
8
  ::ActiveMerchant::Billing::BraintreeBlueGateway.new :merchant_id => config[:merchant_id],
9
9
  :public_key => config[:public_key],
10
- :private_key => config[:private_key]
11
- end
10
+ :private_key => config[:private_key]
11
+ end
12
12
 
13
13
  super(gateway_builder,
14
14
  :braintree_blue,
@@ -17,12 +17,21 @@ module Killbill #:nodoc:
17
17
  ::Killbill::BraintreeBlue::BraintreeBlueResponse)
18
18
  end
19
19
 
20
+ def on_event(event)
21
+ # Require to deal with per tenant configuration invalidation
22
+ super(event)
23
+ #
24
+ # Custom event logic could be added below...
25
+ #
26
+ end
27
+
20
28
  def authorize_payment(kb_account_id, kb_payment_id, kb_payment_transaction_id, kb_payment_method_id, amount, currency, properties, context)
21
- # Pass extra parameters for the gateway here
22
- options = { }
23
-
29
+ options = {
30
+ :payment_method_token => true
31
+ }
32
+
24
33
  options.merge(get_merchant_id(currency))
25
-
34
+
26
35
  properties = merge_properties(properties, options)
27
36
  super(kb_account_id, kb_payment_id, kb_payment_transaction_id, kb_payment_method_id, amount, currency, properties, context)
28
37
  end
@@ -36,8 +45,9 @@ module Killbill #:nodoc:
36
45
  end
37
46
 
38
47
  def purchase_payment(kb_account_id, kb_payment_id, kb_payment_transaction_id, kb_payment_method_id, amount, currency, properties, context)
39
- # Pass extra parameters for the gateway here
40
- options = {}
48
+ options = {
49
+ :payment_method_token => true
50
+ }
41
51
  options.merge(get_merchant_id(currency))
42
52
  properties = merge_properties(properties, options)
43
53
  super(kb_account_id, kb_payment_id, kb_payment_transaction_id, kb_payment_method_id, amount, currency, properties, context)
@@ -46,14 +56,14 @@ module Killbill #:nodoc:
46
56
  def void_payment(kb_account_id, kb_payment_id, kb_payment_transaction_id, kb_payment_method_id, properties, context)
47
57
  # Pass extra parameters for the gateway here
48
58
  options = {}
49
- options.merge(get_merchant_id(currency))
50
59
  properties = merge_properties(properties, options)
51
60
  super(kb_account_id, kb_payment_id, kb_payment_transaction_id, kb_payment_method_id, properties, context)
52
61
  end
53
62
 
54
63
  def credit_payment(kb_account_id, kb_payment_id, kb_payment_transaction_id, kb_payment_method_id, amount, currency, properties, context)
55
- # Pass extra parameters for the gateway here
56
- options = {}
64
+ options = {
65
+ :payment_method_token => true
66
+ }
57
67
  options.merge(get_merchant_id(currency))
58
68
  properties = merge_properties(properties, options)
59
69
  super(kb_account_id, kb_payment_id, kb_payment_transaction_id, kb_payment_method_id, amount, currency, properties, context)
@@ -70,6 +80,7 @@ module Killbill #:nodoc:
70
80
  def get_payment_info(kb_account_id, kb_payment_id, properties, context)
71
81
  # Pass extra parameters for the gateway here
72
82
  options = {}
83
+
73
84
  properties = merge_properties(properties, options)
74
85
  super(kb_account_id, kb_payment_id, properties, context)
75
86
  end
@@ -83,12 +94,14 @@ module Killbill #:nodoc:
83
94
  end
84
95
 
85
96
  def add_payment_method(kb_account_id, kb_payment_method_id, payment_method_props, set_default, properties, context)
86
- braintree_customer_id = BraintreeBluePaymentMethod.braintree_customer_id_from_kb_account_id(kb_account_id, context.tenant_id)
97
+ braintree_customer_id = find_value_from_properties(payment_method_props.properties, :customer) ||
98
+ BraintreeBluePaymentMethod.braintree_customer_id_from_kb_account_id(kb_account_id, context.tenant_id)
87
99
 
88
100
  options = {
89
- :customer => braintree_customer_id,
90
- :company => kb_account_id
91
- }
101
+ :token => find_value_from_properties(payment_method_props.properties, :token),
102
+ :customer => braintree_customer_id,
103
+ :company => kb_account_id
104
+ }
92
105
  properties = merge_properties(properties, options)
93
106
  super(kb_account_id, kb_payment_method_id, payment_method_props, set_default, properties, context)
94
107
  end
@@ -96,6 +109,7 @@ module Killbill #:nodoc:
96
109
  def delete_payment_method(kb_account_id, kb_payment_method_id, properties, context)
97
110
  # Pass extra parameters for the gateway here
98
111
  options = {}
112
+
99
113
  properties = merge_properties(properties, options)
100
114
  super(kb_account_id, kb_payment_method_id, properties, context)
101
115
  end
@@ -103,6 +117,7 @@ module Killbill #:nodoc:
103
117
  def get_payment_method_detail(kb_account_id, kb_payment_method_id, properties, context)
104
118
  # Pass extra parameters for the gateway here
105
119
  options = {}
120
+
106
121
  properties = merge_properties(properties, options)
107
122
  super(kb_account_id, kb_payment_method_id, properties, context)
108
123
  end
@@ -114,6 +129,7 @@ module Killbill #:nodoc:
114
129
  def get_payment_methods(kb_account_id, refresh_from_gateway, properties, context)
115
130
  # Pass extra parameters for the gateway here
116
131
  options = {}
132
+
117
133
  properties = merge_properties(properties, options)
118
134
  super(kb_account_id, refresh_from_gateway, properties, context)
119
135
  end
@@ -121,6 +137,7 @@ module Killbill #:nodoc:
121
137
  def search_payment_methods(search_key, offset, limit, properties, context)
122
138
  # Pass extra parameters for the gateway here
123
139
  options = {}
140
+
124
141
  properties = merge_properties(properties, options)
125
142
  super(search_key, offset, limit, properties, context)
126
143
  end
@@ -145,7 +162,7 @@ module Killbill #:nodoc:
145
162
 
146
163
  def process_notification(notification, properties, context)
147
164
  # Pass extra parameters for the gateway here
148
- options = {}
165
+ options = {}
149
166
  properties = merge_properties(properties, options)
150
167
 
151
168
  super(notification, properties, context) do |gw_notification, service|
@@ -156,11 +173,10 @@ module Killbill #:nodoc:
156
173
  # gw_notification.entity =
157
174
  end
158
175
  end
159
-
176
+
160
177
  def get_merchant_id(currency)
161
-
162
178
  options = {}
163
- if (config[:braintree_blue][:multicurrency])
179
+ if (config[:braintree_blue][:multicurrency])
164
180
  case currency
165
181
  when "USD"
166
182
  options = { :merchant_account_id => config[:multicurrency][:USD] }
@@ -170,9 +186,8 @@ module Killbill #:nodoc:
170
186
  options = { :merchant_account_id => config[:multicurrency][:PLN] }
171
187
  end
172
188
  end
173
- options
189
+ options
174
190
  end
175
-
176
191
  end
177
192
  end
178
193
  end