killbill-litle 1.10.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/NEWS CHANGED
@@ -1,3 +1,6 @@
1
+ 2.0.0
2
+ Initial release for Kill Bill 0.14.x
3
+
1
4
  1.10.0
2
5
  Update to latest killbill
3
6
  Change groupId to org.kill-bill.billing.plugin.ruby
data/README.md CHANGED
@@ -1,125 +1,85 @@
1
- [![Build Status](https://travis-ci.org/killbill/killbill-litle-plugin.png)](https://travis-ci.org/killbill/killbill-litle-plugin)
2
- [![Code Climate](https://codeclimate.com/github/killbill/killbill-litle-plugin.png)](https://codeclimate.com/github/killbill/killbill-litle-plugin)
3
-
4
1
  killbill-litle-plugin
5
2
  =====================
6
3
 
7
- Plugin to use Litle & Co. as a gateway.
4
+ Plugin to use [Litle & Co.](https://www.litle.com/) as a gateway.
8
5
 
9
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%22litle-plugin%22) with coordinates `org.kill-bill.billing.plugin.ruby:litle-plugin`.
10
7
 
8
+ Kill Bill compatibility
9
+ -----------------------
10
+
11
+ | Plugin version | Kill Bill version |
12
+ | -------------: | ----------------: |
13
+ | 2.x.y | 0.14.z |
14
+
11
15
  Requirements
12
16
  ------------
13
17
 
14
- The plugin needs a database. The latest version of the schema can be found here: https://raw.github.com/killbill/killbill-litle-plugin/master/db/ddl.sql.
18
+ The plugin needs a database. The latest version of the schema can be found [here](https://github.com/killbill/killbill-litle-plugin/blob/master/db/ddl.sql).
19
+
20
+ Configuration
21
+ -------------
22
+
23
+ ```
24
+ curl -v \
25
+ -X POST \
26
+ -u admin:password \
27
+ -H 'X-Killbill-ApiKey: bob' \
28
+ -H 'X-Killbill-ApiSecret: lazar' \
29
+ -H 'X-Killbill-CreatedBy: admin' \
30
+ -H 'Content-Type: text/plain' \
31
+ -d ':litle:
32
+ - :account_id: USD
33
+ :merchant_id: "your-merchant-id-USD"
34
+ :username: "your-username"
35
+ :password: "your-password"
36
+ :secure_page_url: "litle-secure-page-url"
37
+ :paypage_id: "your-paypage-id-USD"
38
+ - :account_id: EUR
39
+ :merchant_id: "your-merchant-id-EUR"
40
+ :username: "your-username"
41
+ :password: "your-password"
42
+ :secure_page_url: "litle-secure-page-url"
43
+ :paypage_id: "your-paypage-id-EUR"' \
44
+ http://127.0.0.1:8080/1.0/kb/tenants/uploadPluginConfig/killbill-litle
45
+ ```
46
+
47
+ To go to production, create a `litle.yml` configuration file under `/var/tmp/bundles/plugins/ruby/killbill-litle/x.y.z/` containing the following:
48
+
49
+ ```
50
+ :litle:
51
+ :test: false
52
+ ```
15
53
 
16
54
  Usage
17
55
  -----
18
56
 
19
- Go to http://$HOST:8080/plugins/killbill-litle?kb_account_id=13d26090-b8d7-11e2-9e96-0800200c9a66 and enter your credit card information.
57
+ You would typically implement [Litle PayPage](https://www.litle.com/images/uploads/Paypage.pdf) to tokenize credit cards.
20
58
 
21
- Then, save the token in Kill Bill (only `paypageRegistrationId` is required in the properties):
59
+ After receiving the token from Litle, call:
22
60
 
23
61
  ```
24
62
  curl -v \
25
63
  -X POST \
26
- -H "Content-Type: application/json" \
27
- -H "X-Killbill-CreatedBy: Web server" \
28
- -H "X-Killbill-Reason: New account" \
29
- --data-binary '{
64
+ -u admin:password \
65
+ -H 'X-Killbill-ApiKey: bob' \
66
+ -H 'X-Killbill-ApiSecret: lazar' \
67
+ -H 'X-Killbill-CreatedBy: admin' \
68
+ -H 'Content-Type: application/json' \
69
+ -d '{
30
70
  "pluginName": "killbill-litle",
31
71
  "pluginInfo": {
32
- "properties": [
33
- {
34
- "key": "paypageRegistrationId",
35
- "value": "t3GER3BP3JHLASZe"
36
- },
37
- {
38
- "key": "ccFirstName",
39
- "value": "John"
40
- },
41
- {
42
- "key": "ccLastName",
43
- "value": "Doe"
44
- },
45
- {
46
- "key": "ccType",
47
- "value": "VISA"
48
- },
49
- {
50
- "key": "ccExpMonth",
51
- "value": 12
52
- },
53
- {
54
- "key": "ccExpYear",
55
- "value": 2015
56
- },
57
- {
58
- "key": "ccLast4",
59
- "value": 1234
60
- },
61
- {
62
- "key": "address1",
63
- "value": "5, oakriu road"
64
- },
65
- {
66
- "key": "address2",
67
- "value": "apt. 298"
68
- },
69
- {
70
- "key": "city",
71
- "value": "Gdio Foia"
72
- },
73
- {
74
- "key": "state",
75
- "value": "FL"
76
- },
77
- {
78
- "key": "zip",
79
- "value": "49302"
80
- },
81
- {
82
- "key": "country",
83
- "value": "IFP"
84
- }
85
- ]
72
+ "properties": [{
73
+ "key": "paypageRegistrationId",
74
+ "value": "t3GER3BP3JHLASZe"
75
+ }]
86
76
  }
87
77
  }' \
88
- "http://$HOST:8080/1.0/kb/accounts/13d26090-b8d7-11e2-9e96-0800200c9a66/paymentMethods?isDefault=true"
78
+ "http://127.0.0.1:8080/1.0/kb/accounts/2a55045a-ce1d-4344-942d-b825536328f9/paymentMethods?isDefault=true"
89
79
  ```
90
80
 
91
- Configuration
92
- -------------
93
-
94
- The plugin expects a `litle.yml` configuration file containing the following:
81
+ An example implementation is exposed at:
95
82
 
96
83
  ```
97
- :litle:
98
- :merchant_id:
99
- :USD: 'your-merchant-id-USD'
100
- :EUR: 'your-merchant-id-EURO'
101
- :password: 'your-password'
102
- :username: 'your-username'
103
- # Optional, if you are using PayPage
104
- :secure_page_url: 'litle-secure-page-url'
105
- :paypage_id:
106
- :USD: 'litle-paypage-id-USD'
107
- :EUR: 'litle-paypage-id-EURO'
108
- :log_file: '/var/tmp/litle.log'
109
- # Switch to false for production
110
- :test: true
111
-
112
- :database:
113
- :adapter: 'sqlite3'
114
- :database: 'test.db'
115
- # For MySQL
116
- # :adapter: 'jdbc'
117
- # :username: 'your-username'
118
- # :password: 'your-password'
119
- # :driver: 'com.mysql.jdbc.Driver'
120
- # :url: 'jdbc:mysql://127.0.0.1:3306/your-database'
84
+ http://127.0.0.1:8080/plugins/killbill-litle/form?kb_account_id=2a55045a-ce1d-4344-942d-b825536328f9&kb_tenant_id=a86d9fd1-718d-4178-a9eb-46c61aa2548f
121
85
  ```
122
-
123
- By default, the plugin will look at the plugin directory root (where `killbill.properties` is located) to find this file.
124
- Alternatively, set the Kill Bill system property `-Dorg.killbill.billing.osgi.bundles.jruby.conf.dir=/my/directory` to specify another location.
125
-
data/Rakefile CHANGED
@@ -7,14 +7,14 @@ Bundler::GemHelper.install_tasks
7
7
  # Install test tasks
8
8
  require 'rspec/core/rake_task'
9
9
  namespace :test do
10
- desc "Run RSpec tests"
10
+ desc 'Run RSpec tests'
11
11
  RSpec::Core::RakeTask.new do |task|
12
12
  task.name = 'spec'
13
13
  task.pattern = './spec/*/*_spec.rb'
14
14
  end
15
15
 
16
16
  namespace :remote do
17
- desc "Run RSpec remote tests"
17
+ desc 'Run RSpec remote tests'
18
18
  RSpec::Core::RakeTask.new do |task|
19
19
  task.name = 'spec'
20
20
  task.pattern = './spec/*/remote/*_spec.rb'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.10.0
1
+ 2.0.0
data/config.ru CHANGED
@@ -1,4 +1,4 @@
1
1
  require 'litle'
2
- require 'litle/config/application'
2
+ require 'litle/application'
3
3
 
4
4
  run Sinatra::Application
data/db/ddl.sql CHANGED
@@ -1,14 +1,19 @@
1
1
  CREATE TABLE `litle_payment_methods` (
2
2
  `id` int(11) NOT NULL AUTO_INCREMENT,
3
- `kb_account_id` varchar(255) NOT NULL,
4
3
  `kb_payment_method_id` varchar(255) DEFAULT NULL,
5
- `litle_token` varchar(255) NOT NULL,
4
+ `token` varchar(255) DEFAULT NULL,
6
5
  `cc_first_name` varchar(255) DEFAULT NULL,
7
6
  `cc_last_name` varchar(255) DEFAULT NULL,
8
7
  `cc_type` varchar(255) DEFAULT NULL,
9
- `cc_exp_month` int(11) DEFAULT NULL,
10
- `cc_exp_year` int(11) DEFAULT NULL,
11
- `cc_last_4` int(11) DEFAULT NULL,
8
+ `cc_exp_month` varchar(255) DEFAULT NULL,
9
+ `cc_exp_year` varchar(255) DEFAULT NULL,
10
+ `cc_number` varchar(255) DEFAULT NULL,
11
+ `cc_last_4` varchar(255) DEFAULT NULL,
12
+ `cc_start_month` varchar(255) DEFAULT NULL,
13
+ `cc_start_year` varchar(255) DEFAULT NULL,
14
+ `cc_issue_number` varchar(255) DEFAULT NULL,
15
+ `cc_verification_value` varchar(255) DEFAULT NULL,
16
+ `cc_track_data` varchar(255) DEFAULT NULL,
12
17
  `address1` varchar(255) DEFAULT NULL,
13
18
  `address2` varchar(255) DEFAULT NULL,
14
19
  `city` varchar(255) DEFAULT NULL,
@@ -18,6 +23,8 @@ CREATE TABLE `litle_payment_methods` (
18
23
  `is_deleted` tinyint(1) NOT NULL DEFAULT '0',
19
24
  `created_at` datetime NOT NULL,
20
25
  `updated_at` datetime NOT NULL,
26
+ `kb_account_id` varchar(255) DEFAULT NULL,
27
+ `kb_tenant_id` varchar(255) DEFAULT NULL,
21
28
  PRIMARY KEY (`id`),
22
29
  KEY `index_litle_payment_methods_on_kb_account_id` (`kb_account_id`),
23
30
  KEY `index_litle_payment_methods_on_kb_payment_method_id` (`kb_payment_method_id`)
@@ -28,11 +35,16 @@ CREATE TABLE `litle_transactions` (
28
35
  `litle_response_id` int(11) NOT NULL,
29
36
  `api_call` varchar(255) NOT NULL,
30
37
  `kb_payment_id` varchar(255) NOT NULL,
31
- `litle_txn_id` varchar(255) NOT NULL,
32
- `amount_in_cents` int(11) NOT NULL,
33
- `currency` char(3) NOT NULL,
38
+ `kb_payment_transaction_id` varchar(255) NOT NULL,
39
+ `transaction_type` varchar(255) NOT NULL,
40
+ `payment_processor_account_id` varchar(255) DEFAULT NULL,
41
+ `txn_id` varchar(255) DEFAULT NULL,
42
+ `amount_in_cents` int(11) DEFAULT NULL,
43
+ `currency` varchar(255) DEFAULT NULL,
34
44
  `created_at` datetime NOT NULL,
35
45
  `updated_at` datetime NOT NULL,
46
+ `kb_account_id` varchar(255) NOT NULL,
47
+ `kb_tenant_id` varchar(255) NOT NULL,
36
48
  PRIMARY KEY (`id`),
37
49
  KEY `index_litle_transactions_on_kb_payment_id` (`kb_payment_id`)
38
50
  ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
@@ -41,23 +53,20 @@ CREATE TABLE `litle_responses` (
41
53
  `id` int(11) NOT NULL AUTO_INCREMENT,
42
54
  `api_call` varchar(255) NOT NULL,
43
55
  `kb_payment_id` varchar(255) DEFAULT NULL,
56
+ `kb_payment_transaction_id` varchar(255) DEFAULT NULL,
57
+ `transaction_type` varchar(255) DEFAULT NULL,
58
+ `payment_processor_account_id` varchar(255) DEFAULT NULL,
44
59
  `message` varchar(255) DEFAULT NULL,
45
60
  `authorization` varchar(255) DEFAULT NULL,
46
61
  `fraud_review` tinyint(1) DEFAULT NULL,
47
62
  `test` tinyint(1) DEFAULT NULL,
48
- `params_litleonelineresponse_message` varchar(255) DEFAULT NULL,
49
- `params_litleonelineresponse_response` varchar(255) DEFAULT NULL,
50
- `params_litleonelineresponse_version` varchar(255) DEFAULT NULL,
51
- `params_litleonelineresponse_xmlns` varchar(255) DEFAULT NULL,
52
- `params_litleonelineresponse_saleresponse_customer_id` varchar(255) DEFAULT NULL,
53
- `params_litleonelineresponse_saleresponse_id` varchar(255) DEFAULT NULL,
54
- `params_litleonelineresponse_saleresponse_report_group` varchar(255) DEFAULT NULL,
55
- `params_litleonelineresponse_saleresponse_litle_txn_id` varchar(255) DEFAULT NULL,
56
- `params_litleonelineresponse_saleresponse_order_id` varchar(255) DEFAULT NULL,
57
- `params_litleonelineresponse_saleresponse_response` varchar(255) DEFAULT NULL,
58
- `params_litleonelineresponse_saleresponse_response_time` varchar(255) DEFAULT NULL,
59
- `params_litleonelineresponse_saleresponse_message` varchar(255) DEFAULT NULL,
60
- `params_litleonelineresponse_saleresponse_auth_code` varchar(255) DEFAULT NULL,
63
+ `params_litle_txn_id` varchar(255) DEFAULT NULL,
64
+ `params_order_id` varchar(255) DEFAULT NULL,
65
+ `params_litle_token` varchar(255) DEFAULT NULL,
66
+ `params_auth_code` varchar(255) DEFAULT NULL,
67
+ `params_response` varchar(255) DEFAULT NULL,
68
+ `params_response_time` varchar(255) DEFAULT NULL,
69
+ `params_message` varchar(255) DEFAULT NULL,
61
70
  `avs_result_code` varchar(255) DEFAULT NULL,
62
71
  `avs_result_message` varchar(255) DEFAULT NULL,
63
72
  `avs_result_street_match` varchar(255) DEFAULT NULL,
@@ -67,5 +76,7 @@ CREATE TABLE `litle_responses` (
67
76
  `success` tinyint(1) DEFAULT NULL,
68
77
  `created_at` datetime NOT NULL,
69
78
  `updated_at` datetime NOT NULL,
79
+ `kb_account_id` varchar(255) DEFAULT NULL,
80
+ `kb_tenant_id` varchar(255) DEFAULT NULL,
70
81
  PRIMARY KEY (`id`)
71
82
  ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
data/db/schema.rb CHANGED
@@ -1,63 +1,73 @@
1
1
  require 'active_record'
2
2
 
3
- ActiveRecord::Schema.define(:version => 20130311153635) do
3
+ ActiveRecord::Schema.define(:version => 20140410153635) do
4
4
  create_table "litle_payment_methods", :force => true do |t|
5
- t.string "kb_account_id", :null => false
6
- t.string "kb_payment_method_id" # NULL before Killbill knows about it
7
- t.string "litle_token", :null => false
5
+ t.string "kb_payment_method_id" # NULL before Kill Bill knows about it
6
+ t.string "token" # litle id
8
7
  t.string "cc_first_name"
9
8
  t.string "cc_last_name"
10
9
  t.string "cc_type"
11
- t.integer "cc_exp_month"
12
- t.integer "cc_exp_year"
13
- t.integer "cc_last_4"
10
+ t.string "cc_exp_month"
11
+ t.string "cc_exp_year"
12
+ t.string "cc_number"
13
+ t.string "cc_last_4"
14
+ t.string "cc_start_month"
15
+ t.string "cc_start_year"
16
+ t.string "cc_issue_number"
17
+ t.string "cc_verification_value"
18
+ t.string "cc_track_data"
14
19
  t.string "address1"
15
20
  t.string "address2"
16
21
  t.string "city"
17
22
  t.string "state"
18
23
  t.string "zip"
19
24
  t.string "country"
20
- t.boolean "is_deleted", :null => false, :default => false
21
- t.datetime "created_at", :null => false
22
- t.datetime "updated_at", :null => false
25
+ t.boolean "is_deleted", :null => false, :default => false
26
+ t.datetime "created_at", :null => false
27
+ t.datetime "updated_at", :null => false
28
+ t.string "kb_account_id"
29
+ t.string "kb_tenant_id"
23
30
  end
24
31
 
25
32
  add_index(:litle_payment_methods, :kb_account_id)
26
33
  add_index(:litle_payment_methods, :kb_payment_method_id)
27
34
 
28
35
  create_table "litle_transactions", :force => true do |t|
29
- t.integer "litle_response_id", :null => false
30
- t.string "api_call", :null => false
31
- t.string "kb_payment_id", :null => false
32
- t.string "litle_txn_id", :null => false
33
- t.integer "amount_in_cents", :null => false
34
- t.string "currency", :null => false
35
- t.datetime "created_at", :null => false
36
- t.datetime "updated_at", :null => false
36
+ t.integer "litle_response_id", :null => false
37
+ t.string "api_call", :null => false
38
+ t.string "kb_payment_id", :null => false
39
+ t.string "kb_payment_transaction_id", :null => false
40
+ t.string "transaction_type", :null => false
41
+ t.string "payment_processor_account_id"
42
+ t.string "txn_id" # litle transaction id
43
+ # Both null for void
44
+ t.integer "amount_in_cents"
45
+ t.string "currency"
46
+ t.datetime "created_at", :null => false
47
+ t.datetime "updated_at", :null => false
48
+ t.string "kb_account_id", :null => false
49
+ t.string "kb_tenant_id", :null => false
37
50
  end
38
51
 
39
52
  add_index(:litle_transactions, :kb_payment_id)
40
53
 
41
54
  create_table "litle_responses", :force => true do |t|
42
- t.string "api_call", :null => false
55
+ t.string "api_call", :null => false
43
56
  t.string "kb_payment_id"
57
+ t.string "kb_payment_transaction_id"
58
+ t.string "transaction_type"
59
+ t.string "payment_processor_account_id"
44
60
  t.string "message"
45
61
  t.string "authorization"
46
62
  t.boolean "fraud_review"
47
63
  t.boolean "test"
48
- t.string "params_litleonelineresponse_message"
49
- t.string "params_litleonelineresponse_response"
50
- t.string "params_litleonelineresponse_version"
51
- t.string "params_litleonelineresponse_xmlns"
52
- t.string "params_litleonelineresponse_saleresponse_customer_id"
53
- t.string "params_litleonelineresponse_saleresponse_id"
54
- t.string "params_litleonelineresponse_saleresponse_report_group"
55
- t.string "params_litleonelineresponse_saleresponse_litle_txn_id"
56
- t.string "params_litleonelineresponse_saleresponse_order_id"
57
- t.string "params_litleonelineresponse_saleresponse_response"
58
- t.string "params_litleonelineresponse_saleresponse_response_time"
59
- t.string "params_litleonelineresponse_saleresponse_message"
60
- t.string "params_litleonelineresponse_saleresponse_auth_code"
64
+ t.string "params_litle_txn_id"
65
+ t.string "params_order_id"
66
+ t.string "params_litle_token"
67
+ t.string "params_auth_code"
68
+ t.string "params_response"
69
+ t.string "params_response_time"
70
+ t.string "params_message"
61
71
  t.string "avs_result_code"
62
72
  t.string "avs_result_message"
63
73
  t.string "avs_result_street_match"
@@ -67,5 +77,7 @@ ActiveRecord::Schema.define(:version => 20130311153635) do
67
77
  t.boolean "success"
68
78
  t.datetime "created_at", :null => false
69
79
  t.datetime "updated_at", :null => false
80
+ t.string "kb_account_id"
81
+ t.string "kb_tenant_id"
70
82
  end
71
83
  end
@@ -12,36 +12,40 @@ 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) }
21
- s.require_paths = ["lib"]
20
+ s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
21
+ s.require_paths = ['lib']
22
22
 
23
23
  s.rdoc_options << '--exclude' << '.'
24
24
 
25
- s.add_dependency 'killbill', '~> 3.0.0'
26
- s.add_dependency 'activemerchant', '~> 1.36.0'
27
- s.add_dependency 'activerecord', '~> 3.2.1'
28
- s.add_dependency 'money', '~> 6.0.0'
25
+ s.add_dependency 'killbill', '~> 4.0.0'
26
+
29
27
  s.add_dependency 'sinatra', '~> 1.3.4'
30
- # LitleOnline gem dependencies
31
- s.add_dependency 'LitleOnline', '~> 8.16.0'
32
- s.add_dependency 'xml-mapping', '~> 0.9.1'
33
- s.add_dependency 'xml-object', '~> 0.9.93'
28
+ s.add_dependency 'thread_safe', '~> 0.3.4'
29
+ s.add_dependency 'activerecord', '~> 4.1.0'
34
30
  if defined?(JRUBY_VERSION)
35
- s.add_dependency 'activerecord-jdbcmysql-adapter', '~> 1.2.9'
31
+ s.add_dependency 'activerecord-bogacs', '~> 0.3'
32
+ s.add_dependency 'activerecord-jdbc-adapter', '~> 1.3'
36
33
  # Required to avoid errors like java.lang.NoClassDefFoundError: org/bouncycastle/asn1/DERBoolean
37
- s.add_dependency 'jruby-openssl', '~> 0.9.4'
34
+ s.add_dependency 'jruby-openssl', '~> 0.9.6'
38
35
  end
39
-
40
- s.add_development_dependency 'jbundler', '~> 0.4.1'
36
+ s.add_dependency 'actionpack', '~> 4.1.0'
37
+ s.add_dependency 'actionview', '~> 4.1.0'
38
+ s.add_dependency 'activemerchant', '~> 1.48.0'
39
+ s.add_dependency 'offsite_payments', '~> 2.1.0'
40
+ s.add_dependency 'monetize', '~> 1.1.0'
41
+ s.add_dependency 'money', '~> 6.5.1'
42
+
43
+ s.add_development_dependency 'jbundler', '~> 0.4.3'
41
44
  s.add_development_dependency 'rake', '>= 10.0.0'
42
45
  s.add_development_dependency 'rspec', '~> 2.12.0'
43
46
  if defined?(JRUBY_VERSION)
44
- s.add_development_dependency 'activerecord-jdbcsqlite3-adapter', '~> 1.2.6'
47
+ s.add_development_dependency 'jdbc-sqlite3', '~> 3.7'
48
+ s.add_development_dependency 'jdbc-mariadb', '~> 1.1'
45
49
  else
46
50
  s.add_development_dependency 'sqlite3', '~> 1.3.7'
47
51
  end