killbill-braintree_blue 0.3.0 → 0.3.1

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.
data/NEWS DELETED
@@ -1,17 +0,0 @@
1
- 0.3.0
2
- Initial release for Kill Bill 0.18.x
3
-
4
- 0.2.1
5
- Fix merchant_id look-up in multi-tenancy configuration
6
- Increase default message field length to 510
7
- Add endpoint to generate token
8
- Add ability to add additional cards on existing customer using nonce
9
-
10
- 0.2.0
11
- Initial release for Kill Bill 0.16.x
12
-
13
- 0.1.0
14
- Initial release for Kill Bill 0.15.x
15
-
16
- 0.0.1
17
- Initial release
data/README.md DELETED
@@ -1,265 +0,0 @@
1
- killbill-braintree-plugin
2
- =========================
3
-
4
- Plugin to use [Braintree](https://www.braintreepayments.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%22braintree_blue-plugin%22) with coordinates `org.kill-bill.billing.plugin.ruby:braintree_blue-plugin`.
7
-
8
- This plugin was originally developed by [Ardura sp. z o.o.](https://bitbucket.org/safekiddo/killbill-braintree-blue-plugin.git).
9
-
10
- Kill Bill compatibility
11
- -----------------------
12
-
13
- | Plugin version | Kill Bill version |
14
- | -------------: | ----------------: |
15
- | 0.0.y | 0.14.z |
16
- | 0.2.y | 0.16.z |
17
- | 0.3.y | 0.18.z |
18
-
19
- Requirements
20
- ------------
21
-
22
- 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).
23
-
24
- Configuration
25
- -------------
26
-
27
- ```
28
- curl -v \
29
- -X POST \
30
- -u admin:password \
31
- -H 'X-Killbill-ApiKey: bob' \
32
- -H 'X-Killbill-ApiSecret: lazar' \
33
- -H 'X-Killbill-CreatedBy: admin' \
34
- -H 'Content-Type: text/plain' \
35
- -d ':braintree_blue:
36
- :merchant_id: ABC
37
- :public_key: DEF
38
- :private_key: GHI' \
39
- http://127.0.0.1:8080/1.0/kb/tenants/uploadPluginConfig/killbill-braintree_blue
40
- ```
41
-
42
- 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:
43
-
44
- ```
45
- :braintree_blue:
46
- :test: false
47
- ```
48
-
49
- Usage
50
- -----
51
-
52
- To create a customer and tokenize a credit card:
53
-
54
- ```
55
- curl -v \
56
- -X POST \
57
- -u admin:password \
58
- -H 'X-Killbill-ApiKey: bob' \
59
- -H 'X-Killbill-ApiSecret: lazar' \
60
- -H 'X-Killbill-CreatedBy: admin' \
61
- -H 'Content-Type: application/json' \
62
- -d '{
63
- "pluginName": "killbill-braintree_blue",
64
- "pluginInfo": {
65
- "properties": [
66
- {
67
- "key": "ccFirstName",
68
- "value": "John"
69
- },
70
- {
71
- "key": "ccLastName",
72
- "value": "Doe"
73
- },
74
- {
75
- "key": "address1",
76
- "value": "5th Street"
77
- },
78
- {
79
- "key": "city",
80
- "value": "San Francisco"
81
- },
82
- {
83
- "key": "zip",
84
- "value": "94111"
85
- },
86
- {
87
- "key": "state",
88
- "value": "CA"
89
- },
90
- {
91
- "key": "country",
92
- "value": "US"
93
- },
94
- {
95
- "key": "ccExpirationMonth",
96
- "value": 12
97
- },
98
- {
99
- "key": "ccExpirationYear",
100
- "value": 2017
101
- },
102
- {
103
- "key": "ccNumber",
104
- "value": "4111111111111111"
105
- }
106
- ]
107
- }
108
- }' \
109
- "http://127.0.0.1:8080/1.0/kb/accounts/<ACCOUNT_ID>/paymentMethods?isDefault=true"
110
- ```
111
-
112
- The token can then be used for payments:
113
-
114
- ```
115
- curl -v \
116
- -X POST \
117
- -u admin:password \
118
- -H 'X-Killbill-ApiKey: bob' \
119
- -H 'X-Killbill-ApiSecret: lazar' \
120
- -H 'X-Killbill-CreatedBy: admin' \
121
- -H 'Content-Type: application/json' \
122
- -d '{
123
- "transactionType": "AUTHORIZE",
124
- "amount": 5
125
- }' \
126
- http://127.0.0.1:8080/1.0/kb/accounts/<ACCOUNT_ID>/payments
127
- ```
128
-
129
- Alternatively, if you are using the JS v2 SDK, generate a nonce as follows:
130
-
131
- ```
132
- <!DOCTYPE html>
133
- <html>
134
- <head>
135
- <script src="https://js.braintreegateway.com/v2/braintree.js"></script>
136
- </head>
137
- <body>
138
- <script>
139
- var client = new braintree.api.Client({clientToken: token});
140
-
141
- client.tokenizeCard({
142
- number: "4111111111111111",
143
- expirationDate: "10/20"
144
- }, function (err, nonce) {
145
- console.log(nonce);
146
- });
147
- </script>
148
- </body>
149
- </html>
150
- ```
151
-
152
- where `token` is the server-side generated client token. For convenience, the plugin provides an endpoint to generate it:
153
-
154
- ```
155
- curl http://127.0.0.1:8080/plugins/killbill-braintree_blue/token?kb_tenant_id=<TENANT_ID>
156
- ```
157
-
158
- You can then create the customer with the nonce:
159
-
160
- ```
161
- curl -v \
162
- -X POST \
163
- -u admin:password \
164
- -H 'X-Killbill-ApiKey: bob' \
165
- -H 'X-Killbill-ApiSecret: lazar' \
166
- -H 'X-Killbill-CreatedBy: admin' \
167
- -H 'Content-Type: application/json' \
168
- -d '{
169
- "pluginName": "killbill-braintree_blue",
170
- "pluginInfo": {
171
- "properties": [
172
- {
173
- "key": "ccFirstName",
174
- "value": "John"
175
- },
176
- {
177
- "key": "ccLastName",
178
- "value": "Doe"
179
- },
180
- {
181
- "key": "address1",
182
- "value": "5th Street"
183
- },
184
- {
185
- "key": "city",
186
- "value": "San Francisco"
187
- },
188
- {
189
- "key": "zip",
190
- "value": "94111"
191
- },
192
- {
193
- "key": "state",
194
- "value": "CA"
195
- },
196
- {
197
- "key": "country",
198
- "value": "US"
199
- },
200
- {
201
- "key": "token",
202
- "value": "<NONCE>"
203
- }
204
- ]
205
- }
206
- }' \
207
- "http://127.0.0.1:8080/1.0/kb/accounts/<ACCOUNT_ID>/paymentMethods?isDefault=true"
208
- ```
209
-
210
- To add a second card on an existing customer using a nonce:
211
-
212
- ```
213
- curl -v \
214
- -X POST \
215
- -u admin:password \
216
- -H 'X-Killbill-ApiKey: bob' \
217
- -H 'X-Killbill-ApiSecret: lazar' \
218
- -H 'X-Killbill-CreatedBy: admin' \
219
- -H 'Content-Type: application/json' \
220
- -d '{
221
- "pluginName": "killbill-braintree_blue",
222
- "pluginInfo": {
223
- "properties": [
224
- {
225
- "key": "token",
226
- "value": "<NONCE>"
227
- }
228
- ]
229
- }
230
- }' \
231
- "http://127.0.0.1:8080/1.0/kb/accounts/<ACCOUNT_ID>/paymentMethods?isDefault=true"
232
- ```
233
-
234
- A full end-to-end integration demo is also available [here](https://github.com/killbill/killbill-braintree-demo).
235
-
236
- Plugin properties
237
- -----------------
238
-
239
- | Key | Description |
240
- | ---------------------------: | ----------------------------------------------------------------- |
241
- | skip_gw | If true, skip the call to Braintree |
242
- | payment_processor_account_id | Config entry name of the merchant account to use |
243
- | external_key_as_order_id | If true, set the payment external key as the Braintree order id |
244
- | customer | Braintree customer id |
245
- | payment_method_nonce | Payment method nonce |
246
- | token | Braintree token |
247
- | cc_first_name | Credit card holder first name |
248
- | cc_last_name | Credit card holder last name |
249
- | cc_type | Credit card brand |
250
- | cc_expiration_month | Credit card expiration month |
251
- | cc_expiration_year | Credit card expiration year |
252
- | cc_verification_value | CVC/CVV/CVN |
253
- | email | Purchaser email |
254
- | address1 | Billing address first line |
255
- | address2 | Billing address second line |
256
- | city | Billing address city |
257
- | zip | Billing address zip code |
258
- | state | Billing address state |
259
- | country | Billing address country |
260
- | eci | Network tokenization attribute |
261
- | payment_cryptogram | Network tokenization attribute |
262
- | transaction_id | Network tokenization attribute |
263
- | payment_instrument_name | ApplePay tokenization attribute |
264
- | payment_network | ApplePay tokenization attribute |
265
- | transaction_identifier | ApplePay tokenization attribute |
data/Rakefile DELETED
@@ -1,30 +0,0 @@
1
- #!/usr/bin/env rake
2
-
3
- # Install tasks to build and release the plugin
4
- require 'bundler/setup'
5
- Bundler::GemHelper.install_tasks
6
-
7
- # Install test tasks
8
- require 'rspec/core/rake_task'
9
- namespace :test do
10
- desc 'Run RSpec tests'
11
- RSpec::Core::RakeTask.new do |task|
12
- task.name = 'spec'
13
- task.pattern = './spec/*/*_spec.rb'
14
- end
15
-
16
- namespace :remote do
17
- desc 'Run RSpec remote tests'
18
- RSpec::Core::RakeTask.new do |task|
19
- task.name = 'spec'
20
- task.pattern = './spec/*/remote/*_spec.rb'
21
- end
22
- end
23
- end
24
-
25
- # Install tasks to package the plugin for Killbill
26
- require 'killbill/rake_task'
27
- Killbill::PluginHelper.install_tasks
28
-
29
- # Run tests by default
30
- task :default => 'test:spec'
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.3.0
@@ -1,34 +0,0 @@
1
- :braintree_blue:
2
- :merchant_id: <%= ENV['MERCHANT_ID'] %>
3
- :public_key: <%= ENV['PUBLIC_KEY'] %>
4
- :private_key: <%= ENV['PRIVATE_KEY'] %>
5
- :test: true
6
- :multicurrency: true
7
-
8
- :multicurrency:
9
- :USD: USD
10
-
11
- :database:
12
- # SQLite (development)
13
- :adapter: sqlite3
14
- :database: test.db
15
- # For MySQL
16
- # :adapter: mysql
17
- # :username: 'killbill'
18
- # :password: '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
23
- # In Kill Bill
24
- # :adapter: mysql
25
- # :jndi: 'killbill/osgi/jdbc'
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
data/config.ru DELETED
@@ -1,4 +0,0 @@
1
- require 'braintree_blue'
2
- require 'braintree_blue/application'
3
-
4
- run Sinatra::Application
data/db/ddl.sql DELETED
@@ -1,88 +0,0 @@
1
- CREATE TABLE `braintree_blue_payment_methods` (
2
- `id` int(11) NOT NULL AUTO_INCREMENT,
3
- `kb_payment_method_id` varchar(255) DEFAULT NULL,
4
- `token` varchar(255) DEFAULT NULL,
5
- `braintree_customer_id` varchar(255) DEFAULT NULL,
6
- `cc_first_name` varchar(255) DEFAULT NULL,
7
- `cc_last_name` varchar(255) DEFAULT NULL,
8
- `cc_type` varchar(255) DEFAULT NULL,
9
- `cc_exp_month` varchar(255) DEFAULT NULL,
10
- `cc_exp_year` varchar(255) DEFAULT NULL,
11
- `cc_number` varchar(255) DEFAULT NULL,
12
- `cc_last_4` varchar(255) DEFAULT NULL,
13
- `cc_start_month` varchar(255) DEFAULT NULL,
14
- `cc_start_year` varchar(255) DEFAULT NULL,
15
- `cc_issue_number` varchar(255) DEFAULT NULL,
16
- `cc_verification_value` varchar(255) DEFAULT NULL,
17
- `cc_track_data` varchar(255) DEFAULT NULL,
18
- `address1` varchar(255) DEFAULT NULL,
19
- `address2` varchar(255) DEFAULT NULL,
20
- `city` varchar(255) DEFAULT NULL,
21
- `state` varchar(255) DEFAULT NULL,
22
- `zip` varchar(255) DEFAULT NULL,
23
- `country` varchar(255) DEFAULT NULL,
24
- `is_deleted` tinyint(1) NOT NULL DEFAULT '0',
25
- `created_at` datetime NOT NULL,
26
- `updated_at` datetime NOT NULL,
27
- `kb_account_id` varchar(255) DEFAULT NULL,
28
- `kb_tenant_id` varchar(255) DEFAULT NULL,
29
- PRIMARY KEY (`id`),
30
- KEY `index_braintree_blue_payment_methods_on_kb_account_id` (`kb_account_id`),
31
- KEY `index_braintree_blue_payment_methods_on_kb_payment_method_id` (`kb_payment_method_id`)
32
- ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
33
-
34
- CREATE TABLE `braintree_blue_transactions` (
35
- `id` int(11) NOT NULL AUTO_INCREMENT,
36
- `braintree_blue_response_id` int(11) NOT NULL,
37
- `api_call` varchar(255) NOT NULL,
38
- `kb_payment_id` varchar(255) NOT NULL,
39
- `kb_payment_transaction_id` varchar(255) NOT NULL,
40
- `transaction_type` varchar(255) NOT NULL,
41
- `payment_processor_account_id` varchar(255) DEFAULT NULL,
42
- `txn_id` varchar(255) DEFAULT NULL,
43
- `amount_in_cents` int(11) DEFAULT NULL,
44
- `currency` varchar(255) DEFAULT NULL,
45
- `created_at` datetime NOT NULL,
46
- `updated_at` datetime NOT NULL,
47
- `kb_account_id` varchar(255) NOT NULL,
48
- `kb_tenant_id` varchar(255) NOT NULL,
49
- PRIMARY KEY (`id`),
50
- KEY `index_braintree_blue_transactions_on_kb_payment_id` (`kb_payment_id`)
51
- ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
52
-
53
- CREATE TABLE `braintree_blue_responses` (
54
- `id` int(11) NOT NULL AUTO_INCREMENT,
55
- `api_call` varchar(255) NOT NULL,
56
- `kb_payment_id` varchar(255) DEFAULT NULL,
57
- `kb_payment_transaction_id` varchar(255) DEFAULT NULL,
58
- `transaction_type` varchar(255) DEFAULT NULL,
59
- `payment_processor_account_id` varchar(255) DEFAULT NULL,
60
- `message` varchar(510) DEFAULT NULL,
61
- `authorization` varchar(255) DEFAULT NULL,
62
- `fraud_review` tinyint(1) DEFAULT NULL,
63
- `test` tinyint(1) DEFAULT NULL,
64
- `params_braintree_customer_email` varchar(255) DEFAULT NULL,
65
- `params_braintree_customer_first_name` varchar(255) DEFAULT NULL,
66
- `params_braintree_customer_last_name` varchar(255) DEFAULT NULL,
67
- `params_braintree_customer_id` varchar(255) DEFAULT NULL,
68
- `params_braintree_customer_customer_vault_id` varchar(255) DEFAULT NULL,
69
- `params_braintree_customer_credit_card_token` varchar(255) DEFAULT NULL,
70
- `params_braintree_customer_credit_card_bin` varchar(255) DEFAULT NULL,
71
- `params_braintree_customer_credit_card_expiration_date` varchar(255) DEFAULT NULL,
72
- `params_braintree_customer_credit_card_last_4` varchar(255) DEFAULT NULL,
73
- `params_braintree_customer_credit_card_card_type` varchar(255) DEFAULT NULL,
74
- `params_braintree_customer_credit_card_masked_number` varchar(255) DEFAULT NULL,
75
- `paramt_exists` tinyint(1) DEFAULT NULL,
76
- `avs_result_code` varchar(255) DEFAULT NULL,
77
- `avs_result_message` varchar(255) DEFAULT NULL,
78
- `avs_result_street_match` varchar(255) DEFAULT NULL,
79
- `avs_result_postal_match` varchar(255) DEFAULT NULL,
80
- `cvv_result_code` varchar(255) DEFAULT NULL,
81
- `cvv_result_message` varchar(255) DEFAULT NULL,
82
- `success` tinyint(1) DEFAULT NULL,
83
- `created_at` datetime NOT NULL,
84
- `updated_at` datetime NOT NULL,
85
- `kb_account_id` varchar(255) DEFAULT NULL,
86
- `kb_tenant_id` varchar(255) DEFAULT NULL,
87
- PRIMARY KEY (`id`)
88
- ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
@@ -1,89 +0,0 @@
1
- require 'active_record'
2
-
3
- ActiveRecord::Schema.define(:version => 20140410153635) do
4
- create_table "braintree_blue_payment_methods", :force => true do |t|
5
- t.string "kb_payment_method_id" # NULL before Kill Bill knows about it
6
- t.string "token" # braintree_blue id
7
- t.string "braintree_customer_id"
8
- t.string "cc_first_name"
9
- t.string "cc_last_name"
10
- t.string "cc_type"
11
- t.string "cc_exp_month"
12
- t.string "cc_exp_year"
13
- t.string "cc_number"
14
- t.string "cc_last_4"
15
- t.string "cc_start_month"
16
- t.string "cc_start_year"
17
- t.string "cc_issue_number"
18
- t.string "cc_verification_value"
19
- t.string "cc_track_data"
20
- t.string "address1"
21
- t.string "address2"
22
- t.string "city"
23
- t.string "state"
24
- t.string "zip"
25
- t.string "country"
26
- t.boolean "is_deleted", :null => false, :default => false
27
- t.datetime "created_at", :null => false
28
- t.datetime "updated_at", :null => false
29
- t.string "kb_account_id"
30
- t.string "kb_tenant_id"
31
- end
32
-
33
- add_index(:braintree_blue_payment_methods, :kb_account_id)
34
- add_index(:braintree_blue_payment_methods, :kb_payment_method_id)
35
-
36
- create_table "braintree_blue_transactions", :force => true do |t|
37
- t.integer "braintree_blue_response_id", :null => false
38
- t.string "api_call", :null => false
39
- t.string "kb_payment_id", :null => false
40
- t.string "kb_payment_transaction_id", :null => false
41
- t.string "transaction_type", :null => false
42
- t.string "payment_processor_account_id"
43
- t.string "txn_id" # braintree_blue transaction id
44
- # Both null for void
45
- t.integer "amount_in_cents"
46
- t.string "currency"
47
- t.datetime "created_at", :null => false
48
- t.datetime "updated_at", :null => false
49
- t.string "kb_account_id", :null => false
50
- t.string "kb_tenant_id", :null => false
51
- end
52
-
53
- add_index(:braintree_blue_transactions, :kb_payment_id)
54
-
55
- create_table "braintree_blue_responses", :force => true do |t|
56
- t.string "api_call", :null => false
57
- t.string "kb_payment_id"
58
- t.string "kb_payment_transaction_id"
59
- t.string "transaction_type"
60
- t.string "payment_processor_account_id"
61
- t.string "message"
62
- t.string "authorization"
63
- t.boolean "fraud_review"
64
- t.boolean "test"
65
- t.string "params_braintree_customer_email"
66
- t.string "params_braintree_customer_first_name"
67
- t.string "params_braintree_customer_last_name"
68
- t.string "params_braintree_customer_id"
69
- t.string "params_braintree_customer_customer_vault_id"
70
- t.string "params_braintree_customer_credit_card_token"
71
- t.string "params_braintree_customer_credit_card_bin"
72
- t.string "params_braintree_customer_credit_card_expiration_date"
73
- t.string "params_braintree_customer_credit_card_last_4"
74
- t.string "params_braintree_customer_credit_card_card_type"
75
- t.string "params_braintree_customer_credit_card_masked_number"
76
- t.boolean "paramt_exists"
77
- t.string "avs_result_code"
78
- t.string "avs_result_message"
79
- t.string "avs_result_street_match"
80
- t.string "avs_result_postal_match"
81
- t.string "cvv_result_code"
82
- t.string "cvv_result_message"
83
- t.boolean "success"
84
- t.datetime "created_at", :null => false
85
- t.datetime "updated_at", :null => false
86
- t.string "kb_account_id"
87
- t.string "kb_tenant_id"
88
- end
89
- end