killbill-stripe 0.2.1 → 0.2.2

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: e1852f0d82680be5f41cc76f715a85bb54cbbf8d
4
- data.tar.gz: ee701bf472fcaf89509d8bc0de94127adc4b972e
3
+ metadata.gz: 189014b9952e1ebf288227534c9c3f812340da7c
4
+ data.tar.gz: a62c754aa854cc2c36888b894b5c2d37f868beee
5
5
  SHA512:
6
- metadata.gz: ca23ed9798c2e9ba222f10249e4c2aadd9030bbd615b11db280b3f634e12513541c2b494d4fe1bd52d326a3b498db9cdbc933f75403b46c3db1e21d2cc59b15c
7
- data.tar.gz: 518d935017fa68aa893dee12ebc9915dac96088239d2ecb0b70a88ebfe0cd6b8a21261809677914771ade9884ba21ef671a7de797690a9b4cfe02b05c0d8b6ac
6
+ metadata.gz: 69ec7c9d2476c67246da49f0b8c53561a57bb5804b9a28cbbeef304a6d36cc7d2e45b0f4646d1405b4c35ac33109598db1aaf605e9644204ceb7d92f0363210a
7
+ data.tar.gz: 2d16bee0cfcebd9c31daae6b47d25286592aa797da075faaae120c13953a47131bb29e3de119b18d0bdd1990bddbe4ef2a47145c1580a6162ab95fc85dd69af4
data/.gitignore CHANGED
@@ -19,8 +19,8 @@ _yardoc
19
19
  doc/
20
20
 
21
21
  .jbundler
22
- Jarfile.lock
23
- Gemfile.lock
22
+
23
+ stripe.log
24
24
 
25
25
  .DS_Store
26
26
 
data/.travis.yml CHANGED
@@ -5,7 +5,6 @@ notifications:
5
5
  - kill-bill-commits@googlegroups.com
6
6
 
7
7
  rvm:
8
- - jruby-19mode
9
8
  - jruby-20mode
10
9
  - jruby-head
11
10
 
@@ -17,3 +16,6 @@ jdk:
17
16
  matrix:
18
17
  allow_failures:
19
18
  - rvm: jruby-head
19
+ exclude:
20
+ - rvm: jruby-head
21
+ jdk: openjdk6
data/Gemfile.lock ADDED
@@ -0,0 +1,133 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ killbill-stripe (0.2.2)
5
+ actionpack (~> 4.1.0)
6
+ actionview (~> 4.1.0)
7
+ activemerchant (~> 1.44.1)
8
+ activerecord (~> 4.1.0)
9
+ activerecord-jdbcmysql-adapter (~> 1.3.7)
10
+ activesupport (~> 4.1.0)
11
+ jruby-openssl (~> 0.9.4)
12
+ killbill (~> 3.2.4)
13
+ monetize (~> 0.3.0)
14
+ money (~> 6.1.1)
15
+ offsite_payments (~> 2.0.1)
16
+ sinatra (~> 1.3.4)
17
+
18
+ GEM
19
+ remote: http://rubygems.org/
20
+ specs:
21
+ actionpack (4.1.8)
22
+ actionview (= 4.1.8)
23
+ activesupport (= 4.1.8)
24
+ rack (~> 1.5.2)
25
+ rack-test (~> 0.6.2)
26
+ actionview (4.1.8)
27
+ activesupport (= 4.1.8)
28
+ builder (~> 3.1)
29
+ erubis (~> 2.7.0)
30
+ active_utils (2.2.3)
31
+ activesupport (>= 2.3.11)
32
+ i18n
33
+ activemerchant (1.44.1)
34
+ active_utils (~> 2.2.0)
35
+ activesupport (>= 3.2.14, < 5.0.0)
36
+ builder (>= 2.1.2, < 4.0.0)
37
+ i18n (>= 0.6.9)
38
+ json (~> 1.7)
39
+ nokogiri (~> 1.4)
40
+ offsite_payments (~> 2.0.0)
41
+ activemodel (4.1.8)
42
+ activesupport (= 4.1.8)
43
+ builder (~> 3.1)
44
+ activerecord (4.1.8)
45
+ activemodel (= 4.1.8)
46
+ activesupport (= 4.1.8)
47
+ arel (~> 5.0.0)
48
+ activerecord-jdbc-adapter (1.3.13)
49
+ activerecord (>= 2.2)
50
+ activerecord-jdbcmysql-adapter (1.3.13)
51
+ activerecord-jdbc-adapter (~> 1.3.13)
52
+ jdbc-mysql (>= 5.1.22)
53
+ activerecord-jdbcsqlite3-adapter (1.3.13)
54
+ activerecord-jdbc-adapter (~> 1.3.13)
55
+ jdbc-sqlite3 (>= 3.7.2, < 3.9)
56
+ activesupport (4.1.8)
57
+ i18n (~> 0.6, >= 0.6.9)
58
+ json (~> 1.7, >= 1.7.7)
59
+ minitest (~> 5.1)
60
+ thread_safe (~> 0.1)
61
+ tzinfo (~> 1.1)
62
+ arel (5.0.1.20140414130214)
63
+ builder (3.2.2)
64
+ diff-lcs (1.1.3)
65
+ erubis (2.7.0)
66
+ ethon (0.7.3)
67
+ ffi (>= 1.3.0)
68
+ ffi (1.9.6-java)
69
+ i18n (0.6.11)
70
+ jbundler (0.4.3)
71
+ maven-tools (~> 0.32.1)
72
+ ruby-maven (~> 3.0.4)
73
+ jdbc-mysql (5.1.33)
74
+ jdbc-sqlite3 (3.8.7)
75
+ jruby-openssl (0.9.6-java)
76
+ json (1.8.2-java)
77
+ killbill (3.2.4)
78
+ sinatra (~> 1.3.4)
79
+ typhoeus (~> 0.6.9)
80
+ tzinfo (~> 1.1.0)
81
+ maven-tools (0.32.5)
82
+ minitest (5.5.1)
83
+ monetize (0.3.0)
84
+ money (~> 6.1.0.beta1)
85
+ money (6.1.1)
86
+ i18n (~> 0.6.4)
87
+ nokogiri (1.6.6.2-java)
88
+ offsite_payments (2.0.1)
89
+ active_utils (~> 2.2.0)
90
+ activesupport (>= 3.2.14, < 5.0.0)
91
+ builder (>= 2.1.2, < 4.0.0)
92
+ i18n (~> 0.5)
93
+ json (~> 1.7)
94
+ money (< 7.0.0)
95
+ nokogiri (~> 1.4)
96
+ rack (1.5.2)
97
+ rack-protection (1.5.3)
98
+ rack
99
+ rack-test (0.6.3)
100
+ rack (>= 1.0)
101
+ rake (10.4.2)
102
+ rspec (2.12.0)
103
+ rspec-core (~> 2.12.0)
104
+ rspec-expectations (~> 2.12.0)
105
+ rspec-mocks (~> 2.12.0)
106
+ rspec-core (2.12.2)
107
+ rspec-expectations (2.12.1)
108
+ diff-lcs (~> 1.1.3)
109
+ rspec-mocks (2.12.2)
110
+ ruby-maven (3.0.4.1.4)
111
+ maven-tools (~> 0.32.3)
112
+ thor (>= 0.14.6, < 2.0)
113
+ sinatra (1.3.6)
114
+ rack (~> 1.4)
115
+ rack-protection (~> 1.3)
116
+ tilt (~> 1.3, >= 1.3.3)
117
+ thor (0.19.1)
118
+ thread_safe (0.3.4-java)
119
+ tilt (1.4.1)
120
+ typhoeus (0.6.9)
121
+ ethon (>= 0.7.1)
122
+ tzinfo (1.1.0)
123
+ thread_safe (~> 0.1)
124
+
125
+ PLATFORMS
126
+ java
127
+
128
+ DEPENDENCIES
129
+ activerecord-jdbcsqlite3-adapter (~> 1.3.7)
130
+ jbundler (~> 0.4.1)
131
+ killbill-stripe!
132
+ rake (>= 10.0.0)
133
+ rspec (~> 2.12.0)
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-retry', '0.8.1'
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.0'
1
+ jar 'org.kill-bill.billing:killbill-api', '0.12.4'
2
+ jar 'org.kill-bill.billing.plugin:killbill-plugin-api-notification', '0.8.3'
3
+ jar 'org.kill-bill.billing.plugin:killbill-plugin-api-payment', '0.8.3'
4
+ jar 'org.kill-bill.billing.plugin:killbill-plugin-api-currency', '0.8.3'
5
+ jar 'org.kill-bill.billing.plugin:killbill-plugin-api-retry', '0.8.3'
6
+ jar 'org.kill-bill.billing.plugin:killbill-plugin-api-invoice', '0.8.3'
7
+ jar 'org.kill-bill.billing:killbill-util:tests', '0.13.4'
8
+ jar 'org.mockito:mockito-all', '1.9.0'
8
9
  jar 'javax.servlet:javax.servlet-api', '3.0.1'
data/Jarfile.lock ADDED
@@ -0,0 +1,52 @@
1
+ org.kill-bill.billing:killbill-api:jar:0.10.2
2
+ com.fasterxml.jackson.core:jackson-annotations:jar:2.3.2
3
+ joda-time:joda-time:jar:2.3
4
+ org.kill-bill.billing.plugin:killbill-plugin-api-notification:jar:0.8.2
5
+ org.kill-bill.billing.plugin:killbill-plugin-api-payment:jar:0.8.2
6
+ org.kill-bill.billing.plugin:killbill-plugin-api-currency:jar:0.8.2
7
+ org.kill-bill.billing.plugin:killbill-plugin-api-retry:jar:0.8.1
8
+ org.kill-bill.billing.plugin:killbill-plugin-api-invoice:jar:0.8.2
9
+ org.kill-bill.billing:killbill-util:jar:tests:0.12.0
10
+ com.codahale.metrics:metrics-core:jar:3.0.2
11
+ com.fasterxml.jackson.core:jackson-databind:jar:2.4.3
12
+ com.fasterxml.jackson.core:jackson-core:jar:2.4.3
13
+ com.fasterxml.jackson.dataformat:jackson-dataformat-csv:jar:2.4.3
14
+ com.fasterxml.jackson.datatype:jackson-datatype-joda:jar:2.4.3
15
+ com.jolbox:bonecp:jar:0.8.0-rc3
16
+ com.google.guava:guava:jar:15.0
17
+ com.samskivert:jmustache:jar:1.5
18
+ net.sf.ehcache:ehcache-core:jar:2.6.9
19
+ org.antlr:stringtemplate:jar:3.2.1
20
+ antlr:antlr:jar:2.7.7
21
+ org.apache.commons:commons-email:jar:1.2
22
+ javax.mail:mail:jar:1.4.1
23
+ javax.activation:activation:jar:1.1
24
+ org.apache.shiro:shiro-core:jar:1.2.3
25
+ commons-beanutils:commons-beanutils:jar:1.8.3
26
+ commons-logging:commons-logging:jar:1.1.1
27
+ org.apache.shiro:shiro-ehcache:jar:1.2.3
28
+ org.apache.shiro:shiro-guice:jar:1.2.3
29
+ com.google.inject:guice:jar:3.0
30
+ aopalliance:aopalliance:jar:1.0
31
+ com.google.inject.extensions:guice-multibindings:jar:3.0
32
+ org.jdbi:jdbi:jar:2.53
33
+ com.google.code.findbugs:annotations:jar:2.0.2
34
+ org.joda:joda-money:jar:0.9
35
+ org.kill-bill.billing:killbill-internal-api:jar:0.12.0
36
+ org.kill-bill.billing:killbill-platform-api:jar:0.1.0
37
+ org.kill-bill.commons:killbill-clock:jar:0.2.28
38
+ org.kill-bill.commons:killbill-concurrent:jar:0.2.28
39
+ org.kill-bill.commons:killbill-embeddeddb-common:jar:0.2.28
40
+ org.kill-bill.commons:killbill-jdbi:jar:0.2.28
41
+ com.h2database:h2:jar:1.3.175
42
+ javax.inject:javax.inject:jar:1
43
+ org.kill-bill.commons:killbill-locker:jar:0.2.28
44
+ org.kill-bill.commons:killbill-queue:jar:0.2.28
45
+ org.kill-bill.commons:killbill-xmlloader:jar:0.2.28
46
+ org.skife.config:config-magic:jar:0.14
47
+ org.slf4j:jcl-over-slf4j:jar:1.7.6
48
+ org.slf4j:slf4j-api:jar:1.7.6
49
+ org.weakref:jmxutils:jar:1.12
50
+ javax.servlet:javax.servlet-api:jar:3.0.1
51
+ org.bouncycastle:bcpkix-jdk15on:jar:1.47
52
+ org.bouncycastle:bcprov-jdk15on:jar:1.47
data/README.md CHANGED
@@ -1,7 +1,14 @@
1
1
  killbill-stripe-plugin
2
2
  ======================
3
3
 
4
- Killbill payment plugin for Stripe.
4
+ Plugin to use [Stripe](https://stripe.com/) as a gateway.
5
+
6
+ Release builds are available on [Maven Central](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.kill-bill.billing.plugin.ruby%22%20AND%20a%3A%22stripe-plugin%22) with coordinates `org.kill-bill.billing.plugin.ruby:stripe-plugin`.
7
+
8
+ Requirements
9
+ ------------
10
+
11
+ The plugin needs a database. The latest version of the schema can be found here: https://raw.github.com/killbill/killbill-stripe-plugin/master/db/ddl.sql.
5
12
 
6
13
  Getting started
7
14
  ---------------
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.1
1
+ 0.2.2
data/db/ddl.sql CHANGED
@@ -89,7 +89,7 @@ CREATE TABLE `stripe_responses` (
89
89
  `params_card_address_line1_check` varchar(255) DEFAULT NULL,
90
90
  `params_card_address_zip_check` varchar(255) DEFAULT NULL,
91
91
  `params_captured` varchar(255) DEFAULT NULL,
92
- `params_refunds` varchar(255) DEFAULT NULL,
92
+ `params_refunds` text DEFAULT NULL,
93
93
  `params_balance_transaction` varchar(255) DEFAULT NULL,
94
94
  `params_failure_message` varchar(255) DEFAULT NULL,
95
95
  `params_failure_code` varchar(255) DEFAULT NULL,
@@ -100,7 +100,7 @@ CREATE TABLE `stripe_responses` (
100
100
  `params_subscription` varchar(255) DEFAULT NULL,
101
101
  `params_discount` varchar(255) DEFAULT NULL,
102
102
  `params_account_balance` varchar(255) DEFAULT NULL,
103
- `params_cards` varchar(255) DEFAULT NULL,
103
+ `params_cards` text DEFAULT NULL,
104
104
  `params_invoice` varchar(255) DEFAULT NULL,
105
105
  `params_description` varchar(255) DEFAULT NULL,
106
106
  `params_dispute` varchar(255) DEFAULT NULL,
data/db/schema.rb CHANGED
@@ -90,7 +90,7 @@ ActiveRecord::Schema.define(:version => 20140410153635) do
90
90
  t.string "params_card_address_line1_check"
91
91
  t.string "params_card_address_zip_check"
92
92
  t.string "params_captured"
93
- t.string "params_refunds"
93
+ t.text "params_refunds"
94
94
  t.string "params_balance_transaction"
95
95
  t.string "params_failure_message"
96
96
  t.string "params_failure_code"
@@ -101,7 +101,7 @@ ActiveRecord::Schema.define(:version => 20140410153635) do
101
101
  t.string "params_subscription"
102
102
  t.string "params_discount"
103
103
  t.string "params_account_balance"
104
- t.string "params_cards"
104
+ t.text "params_cards"
105
105
  t.string "params_invoice"
106
106
  t.string "params_description"
107
107
  t.string "params_dispute"
@@ -22,7 +22,7 @@ Gem::Specification.new do |s|
22
22
 
23
23
  s.rdoc_options << '--exclude' << '.'
24
24
 
25
- s.add_dependency 'killbill', '~> 3.1.12'
25
+ s.add_dependency 'killbill', '~> 3.2.4'
26
26
  s.add_dependency 'activemerchant', '~> 1.44.1'
27
27
  s.add_dependency 'offsite_payments', '~> 2.0.1'
28
28
  s.add_dependency 'activerecord', '~> 4.1.0'
data/lib/stripe/api.rb CHANGED
@@ -123,11 +123,14 @@ module Killbill #:nodoc:
123
123
  end
124
124
 
125
125
  def set_default_payment_method(kb_account_id, kb_payment_method_id, properties, context)
126
- pm = StripePaymentMethod.from_kb_payment_method_id(kb_payment_method_id, context.tenant_id)
126
+ pm = StripePaymentMethod.from_kb_payment_method_id(kb_payment_method_id, context.tenant_id)
127
127
 
128
128
  # Update the default payment method on the customer object
129
- stripe_response = gateway.update_customer(pm.stripe_customer_id, :default_card => pm.token)
130
- response, transaction = save_response_and_transaction stripe_response, :set_default_payment_method, kb_account_id, context.tenant_id
129
+ options = properties_to_hash(properties)
130
+ payment_processor_account_id = options[:payment_processor_account_id] || :default
131
+ gateway = lookup_gateway(payment_processor_account_id)
132
+ stripe_response = gateway.update_customer(pm.stripe_customer_id, :default_card => pm.token)
133
+ response, transaction = save_response_and_transaction(stripe_response, :set_default_payment_method, kb_account_id, context.tenant_id, payment_processor_account_id)
131
134
 
132
135
  if response.success
133
136
  # TODO Update our records
@@ -10,7 +10,7 @@ module Killbill #:nodoc:
10
10
  card_response = response.responses.first.params
11
11
  customer_response = response.responses.last.params
12
12
  else
13
- card_response = response.params['cards']['data'][0]
13
+ card_response = response.params['sources']['data'][0]
14
14
  customer_response = response.params
15
15
  end
16
16
 
@@ -25,7 +25,7 @@ module Killbill #:nodoc:
25
25
  :token => card_response['id'],
26
26
  :cc_first_name => card_response['name'],
27
27
  :cc_last_name => nil,
28
- :cc_type => card_response['type'],
28
+ :cc_type => card_response['brand'],
29
29
  :cc_exp_month => card_response['exp_month'],
30
30
  :cc_exp_year => card_response['exp_year'],
31
31
  :cc_last_4 => card_response['last4'],
@@ -3,11 +3,12 @@ module Killbill #:nodoc:
3
3
  class PrivatePaymentPlugin < ::Killbill::Plugin::ActiveMerchant::PrivatePaymentPlugin
4
4
 
5
5
  def add_payment_method(params)
6
- stripe_customer_id = StripePaymentMethod.stripe_customer_id_from_kb_account_id(params[:kbAccountId], params[:kbTenantId])
6
+ payment_processor_account_id = params[:paymentProcessorAccountId] || :default
7
+ stripe_customer_id = StripePaymentMethod.stripe_customer_id_from_kb_account_id(params[:kbAccountId], params[:kbTenantId])
7
8
 
8
9
  # This will either update the current customer if present, or create a new one
9
- stripe_response = gateway.store params[:stripeToken], {:description => params[:kbAccountId], :customer => stripe_customer_id}
10
- response = save_response stripe_response, :add_payment_method
10
+ stripe_response = gateway(payment_processor_account_id).store(params[:stripeToken], {:description => params[:kbAccountId], :customer => stripe_customer_id})
11
+ response, _ = save_response_and_transaction(stripe_response, :add_payment_method, params[:kbAccountId], params[:kbTenantId], payment_processor_account_id)
11
12
  raise response.message unless response.success
12
13
 
13
14
  # Create the payment method (not associated to a Kill Bill payment method yet)
data/pom.xml CHANGED
@@ -25,7 +25,7 @@
25
25
  <groupId>org.kill-bill.billing.plugin.ruby</groupId>
26
26
  <artifactId>stripe-plugin</artifactId>
27
27
  <packaging>pom</packaging>
28
- <version>0.2.1</version>
28
+ <version>0.2.2</version>
29
29
  <name>stripe-plugin</name>
30
30
  <url>http://github.com/killbill/killbill-stripe-plugin</url>
31
31
  <description>Plugin for accessing Stripe as a payment gateway</description>
@@ -11,7 +11,8 @@ describe Killbill::Stripe::PaymentPlugin do
11
11
 
12
12
  @account_api = ::Killbill::Plugin::ActiveMerchant::RSpec::FakeJavaUserAccountApi.new
13
13
  @payment_api = ::Killbill::Plugin::ActiveMerchant::RSpec::FakeJavaPaymentApi.new
14
- svcs = {:account_user_api => @account_api, :payment_api => @payment_api}
14
+ @tenant_api = ::Killbill::Plugin::ActiveMerchant::RSpec::FakeJavaTenantUserApi.new({})
15
+ svcs = {:account_user_api => @account_api, :payment_api => @payment_api, :tenant_user_api => @tenant_api}
15
16
  @plugin.kb_apis = Killbill::Plugin::KillbillApi.new('stripe', svcs)
16
17
 
17
18
  @call_context = Killbill::Plugin::Model::CallContext.new
@@ -66,6 +67,13 @@ describe Killbill::Stripe::PaymentPlugin do
66
67
  pms.size.should == 2
67
68
  pms[0].external_payment_method_id.should == pm1.token
68
69
  pms[1].external_payment_method_id.should == pm2.token
70
+
71
+ # Update the default payment method in Stripe (we cannot easily verify the result unfortunately)
72
+ @plugin.set_default_payment_method(pm.kb_account_id, pm2.kb_payment_method_id, [], @call_context)
73
+ response = Killbill::Stripe::StripeResponse.last
74
+ response.api_call.should == 'set_default_payment_method'
75
+ response.message.should == 'Transaction approved'
76
+ response.success.should be_true
69
77
  end
70
78
 
71
79
  it 'should be able to charge a Credit Card directly' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: killbill-stripe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kill Bill core team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-18 00:00:00.000000000 Z
11
+ date: 2015-03-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: killbill
@@ -16,12 +16,12 @@ dependencies:
16
16
  requirements:
17
17
  - - ~>
18
18
  - !ruby/object:Gem::Version
19
- version: 3.1.12
19
+ version: 3.2.4
20
20
  requirement: !ruby/object:Gem::Requirement
21
21
  requirements:
22
22
  - - ~>
23
23
  - !ruby/object:Gem::Version
24
- version: 3.1.12
24
+ version: 3.2.4
25
25
  prerelease: false
26
26
  type: :runtime
27
27
  - !ruby/object:Gem::Dependency
@@ -243,7 +243,9 @@ files:
243
243
  - .gitignore
244
244
  - .travis.yml
245
245
  - Gemfile
246
+ - Gemfile.lock
246
247
  - Jarfile
248
+ - Jarfile.lock
247
249
  - LICENSE
248
250
  - NEWS
249
251
  - README.md