killbill-orbital 0.0.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 ADDED
@@ -0,0 +1,2 @@
1
+ 0.0.1
2
+ Initial release
data/README.md ADDED
@@ -0,0 +1,156 @@
1
+ killbill-orbital-plugin
2
+ =======================
3
+
4
+ Plugin to use [Orbital](http://www.chasepaymentech.com/payment_gateway.html) 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%22orbital-plugin%22) with coordinates `org.kill-bill.billing.plugin.ruby:orbital-plugin`.
7
+
8
+ Kill Bill compatibility
9
+ -----------------------
10
+
11
+ | Plugin version | Kill Bill version |
12
+ | -------------: | ----------------: |
13
+ | 0.0.x | 0.16.z |
14
+
15
+ Requirements
16
+ ------------
17
+
18
+ The plugin needs a database. The latest version of the schema can be found [here](https://github.com/killbill/killbill-orbital-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 ':orbital:
32
+ - :account_id: "merchant_account_1"
33
+ :login: "your-login"
34
+ :password: "your-password"
35
+ :merchant_id: "your-merchant-id"
36
+ - :account_id: "merchant_account_2"
37
+ :login: "your-login"
38
+ :password: "your-password"
39
+ :merchant_id: "your-merchant-id"' \
40
+ http://127.0.0.1:8080/1.0/kb/tenants/uploadPluginConfig/killbill-orbital
41
+ ```
42
+
43
+ To go to production, create a `orbital.yml` configuration file under `/var/tmp/bundles/plugins/ruby/killbill-orbital/x.y.z/` containing the following:
44
+
45
+ ```
46
+ :orbital:
47
+ :test: false
48
+ ```
49
+
50
+ Usage
51
+ -----
52
+
53
+ To store a credit card:
54
+
55
+ ```
56
+ curl -v \
57
+ -X POST \
58
+ -u admin:password \
59
+ -H 'X-Killbill-ApiKey: bob' \
60
+ -H 'X-Killbill-ApiSecret: lazar' \
61
+ -H 'X-Killbill-CreatedBy: admin' \
62
+ -H 'Content-Type: application/json' \
63
+ -d '{
64
+ "pluginName": "killbill-orbital",
65
+ "pluginInfo": {
66
+ "properties": [
67
+ {
68
+ "key": "ccFirstName",
69
+ "value": "John"
70
+ },
71
+ {
72
+ "key": "ccLastName",
73
+ "value": "Doe"
74
+ },
75
+ {
76
+ "key": "address1",
77
+ "value": "5th Street"
78
+ },
79
+ {
80
+ "key": "city",
81
+ "value": "San Francisco"
82
+ },
83
+ {
84
+ "key": "zip",
85
+ "value": "94111"
86
+ },
87
+ {
88
+ "key": "state",
89
+ "value": "CA"
90
+ },
91
+ {
92
+ "key": "country",
93
+ "value": "USA"
94
+ },
95
+ {
96
+ "key": "ccExpirationMonth",
97
+ "value": 12
98
+ },
99
+ {
100
+ "key": "ccExpirationYear",
101
+ "value": 2017
102
+ },
103
+ {
104
+ "key": "ccNumber",
105
+ "value": "4111111111111111"
106
+ }
107
+ ]
108
+ }
109
+ }' \
110
+ "http://127.0.0.1:8080/1.0/kb/accounts/<ACCOUNT_ID>/paymentMethods?isDefault=true"
111
+ ```
112
+
113
+ To trigger a payment:
114
+
115
+ ```
116
+ curl -v \
117
+ -X POST \
118
+ -u admin:password \
119
+ -H 'X-Killbill-ApiKey: bob' \
120
+ -H 'X-Killbill-ApiSecret: lazar' \
121
+ -H 'X-Killbill-CreatedBy: admin' \
122
+ -H 'Content-Type: application/json' \
123
+ -d '{
124
+ "transactionType": "AUTHORIZE",
125
+ "amount": 5
126
+ }' \
127
+ http://127.0.0.1:8080/1.0/kb/accounts/<ACCOUNT_ID>/payments
128
+ ```
129
+
130
+ Plugin properties
131
+ -----------------
132
+
133
+ | Key | Description |
134
+ | ---------------------------: | ----------------------------------------------------------------- |
135
+ | skip_gw | If true, skip the call to Orbital |
136
+ | payment_processor_account_id | Config entry name of the merchant account to use |
137
+ | external_key_as_order_id | If true, set the payment external key as the Orbital order id |
138
+ | cc_first_name | Credit card holder first name |
139
+ | cc_last_name | Credit card holder last name |
140
+ | cc_type | Credit card brand |
141
+ | cc_expiration_month | Credit card expiration month |
142
+ | cc_expiration_year | Credit card expiration year |
143
+ | cc_verification_value | CVC/CVV/CVN |
144
+ | email | Purchaser email |
145
+ | address1 | Billing address first line |
146
+ | address2 | Billing address second line |
147
+ | city | Billing address city |
148
+ | zip | Billing address zip code |
149
+ | state | Billing address state |
150
+ | country | Billing address country |
151
+ | eci | Network tokenization attribute |
152
+ | payment_cryptogram | Network tokenization attribute |
153
+ | transaction_id | Network tokenization attribute |
154
+ | payment_instrument_name | ApplePay tokenization attribute |
155
+ | payment_network | ApplePay tokenization attribute |
156
+ | transaction_identifier | ApplePay tokenization attribute |
data/Rakefile ADDED
@@ -0,0 +1,30 @@
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 ADDED
@@ -0,0 +1 @@
1
+ 0.0.1
data/config.ru ADDED
@@ -0,0 +1,4 @@
1
+ require 'orbital'
2
+ require 'orbital/application'
3
+
4
+ run Sinatra::Application
data/db/ddl.sql ADDED
@@ -0,0 +1,133 @@
1
+ CREATE TABLE orbital_payment_methods (
2
+ id serial UNIQUE,
3
+ kb_payment_method_id varchar(255) DEFAULT NULL,
4
+ token varchar(255) DEFAULT NULL,
5
+ cc_first_name varchar(255) DEFAULT NULL,
6
+ cc_last_name varchar(255) DEFAULT NULL,
7
+ cc_type varchar(255) 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,
17
+ address1 varchar(255) DEFAULT NULL,
18
+ address2 varchar(255) DEFAULT NULL,
19
+ city varchar(255) DEFAULT NULL,
20
+ state varchar(255) DEFAULT NULL,
21
+ zip varchar(255) DEFAULT NULL,
22
+ country varchar(255) DEFAULT NULL,
23
+ is_deleted boolean NOT NULL DEFAULT '0',
24
+ created_at datetime NOT NULL,
25
+ updated_at datetime NOT NULL,
26
+ kb_account_id varchar(255) DEFAULT NULL,
27
+ kb_tenant_id varchar(255) DEFAULT NULL,
28
+ PRIMARY KEY (id)
29
+ ) /*! ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin */;
30
+ CREATE INDEX index_orbital_payment_methods_kb_account_id ON orbital_payment_methods(kb_account_id);
31
+ CREATE INDEX index_orbital_payment_methods_kb_payment_method_id ON orbital_payment_methods(kb_payment_method_id);
32
+
33
+ CREATE TABLE orbital_transactions (
34
+ id serial UNIQUE,
35
+ orbital_response_id bigint /*! unsigned */ NOT NULL,
36
+ api_call varchar(255) NOT NULL,
37
+ kb_payment_id varchar(255) 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 DEFAULT NULL,
43
+ currency varchar(255) DEFAULT NULL,
44
+ created_at datetime NOT NULL,
45
+ updated_at datetime NOT NULL,
46
+ kb_account_id varchar(255) NOT NULL,
47
+ kb_tenant_id varchar(255) NOT NULL,
48
+ PRIMARY KEY (id)
49
+ ) /*! ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin */;
50
+ CREATE INDEX index_orbital_transactions_kb_payment_id ON orbital_transactions(kb_payment_id);
51
+ CREATE INDEX index_orbital_transactions_orbital_response_id ON orbital_transactions(orbital_response_id);
52
+
53
+ CREATE TABLE orbital_responses (
54
+ id serial UNIQUE,
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(255) DEFAULT NULL,
61
+ authorisation varchar(255) DEFAULT NULL,
62
+ fraud_review boolean DEFAULT NULL,
63
+ test boolean DEFAULT NULL,
64
+ params_account_num varchar(255) DEFAULT NULL,
65
+ params_address_1 varchar(255) DEFAULT NULL,
66
+ params_address_2 varchar(255) DEFAULT NULL,
67
+ params_approval_status varchar(255) DEFAULT NULL,
68
+ params_auth_code varchar(255) DEFAULT NULL,
69
+ params_avs_resp_code varchar(255) DEFAULT NULL,
70
+ params_card_brand varchar(255) DEFAULT NULL,
71
+ params_cavv_resp_code varchar(255) DEFAULT NULL,
72
+ params_cc_account_num varchar(255) DEFAULT NULL,
73
+ params_cc_expire_date varchar(255) DEFAULT NULL,
74
+ params_country_fraud_filter_status varchar(255) DEFAULT NULL,
75
+ params_customer_bin varchar(255) DEFAULT NULL,
76
+ params_customer_city varchar(255) DEFAULT NULL,
77
+ params_customer_country_code varchar(255) DEFAULT NULL,
78
+ params_customer_email varchar(255) DEFAULT NULL,
79
+ params_customer_merchant_id varchar(255) DEFAULT NULL,
80
+ params_customer_name varchar(255) DEFAULT NULL,
81
+ params_customer_phone varchar(255) DEFAULT NULL,
82
+ params_customer_profile_action varchar(255) DEFAULT NULL,
83
+ params_customer_profile_message varchar(255) DEFAULT NULL,
84
+ params_customer_profile_order_override_ind varchar(255) DEFAULT NULL,
85
+ params_customer_ref_num varchar(255) DEFAULT NULL,
86
+ params_customer_state varchar(255) DEFAULT NULL,
87
+ params_customer_zip varchar(255) DEFAULT NULL,
88
+ params_cvv2_resp_code varchar(255) DEFAULT NULL,
89
+ params_ecp_account_dda varchar(255) DEFAULT NULL,
90
+ params_ecp_account_rt varchar(255) DEFAULT NULL,
91
+ params_ecp_account_type varchar(255) DEFAULT NULL,
92
+ params_ecp_bank_pmt_dlv varchar(255) DEFAULT NULL,
93
+ params_host_avs_resp_code varchar(255) DEFAULT NULL,
94
+ params_host_cvv2_resp_code varchar(255) DEFAULT NULL,
95
+ params_host_resp_code varchar(255) DEFAULT NULL,
96
+ params_industry_type varchar(255) DEFAULT NULL,
97
+ params_iso_country_code varchar(255) DEFAULT NULL,
98
+ params_merchant_id varchar(255) DEFAULT NULL,
99
+ params_message_type varchar(255) DEFAULT NULL,
100
+ params_order_default_amount varchar(255) DEFAULT NULL,
101
+ params_order_default_description varchar(255) DEFAULT NULL,
102
+ params_order_id varchar(255) DEFAULT NULL,
103
+ params_partial_auth_occurred varchar(255) DEFAULT NULL,
104
+ params_proc_status varchar(255) DEFAULT NULL,
105
+ params_profile_proc_status varchar(255) DEFAULT NULL,
106
+ params_recurring_advice_cd varchar(255) DEFAULT NULL,
107
+ params_redeemed_amount varchar(255) DEFAULT NULL,
108
+ params_remaining_balance varchar(255) DEFAULT NULL,
109
+ params_requested_amount varchar(255) DEFAULT NULL,
110
+ params_resp_code varchar(255) DEFAULT NULL,
111
+ params_resp_msg varchar(255) DEFAULT NULL,
112
+ params_resp_time varchar(255) DEFAULT NULL,
113
+ params_status varchar(255) DEFAULT NULL,
114
+ params_status_msg varchar(255) DEFAULT NULL,
115
+ params_switch_solo_issue_num varchar(255) DEFAULT NULL,
116
+ params_switch_solo_start_date varchar(255) DEFAULT NULL,
117
+ params_terminal_id varchar(255) DEFAULT NULL,
118
+ params_tx_ref_idx varchar(255) DEFAULT NULL,
119
+ params_tx_ref_num varchar(255) DEFAULT NULL,
120
+ avs_result_code varchar(255) DEFAULT NULL,
121
+ avs_result_message varchar(255) DEFAULT NULL,
122
+ avs_result_street_match varchar(255) DEFAULT NULL,
123
+ avs_result_postal_match varchar(255) DEFAULT NULL,
124
+ cvv_result_code varchar(255) DEFAULT NULL,
125
+ cvv_result_message varchar(255) DEFAULT NULL,
126
+ success boolean DEFAULT NULL,
127
+ created_at datetime NOT NULL,
128
+ updated_at datetime NOT NULL,
129
+ kb_account_id varchar(255) DEFAULT NULL,
130
+ kb_tenant_id varchar(255) DEFAULT NULL,
131
+ PRIMARY KEY (id)
132
+ ) /*! ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin */;
133
+ CREATE INDEX index_orbital_responses_kb_payment_id_kb_tenant_id ON orbital_responses(kb_payment_id, kb_tenant_id);
data/db/schema.rb ADDED
@@ -0,0 +1,134 @@
1
+ require 'active_record'
2
+
3
+ ActiveRecord::Schema.define(:version => 20140410153635) do
4
+ create_table "orbital_payment_methods", :force => true do |t|
5
+ t.string "kb_payment_method_id" # NULL before Kill Bill knows about it
6
+ t.string "token" # orbital id
7
+ t.string "cc_first_name"
8
+ t.string "cc_last_name"
9
+ t.string "cc_type"
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"
19
+ t.string "address1"
20
+ t.string "address2"
21
+ t.string "city"
22
+ t.string "state"
23
+ t.string "zip"
24
+ t.string "country"
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"
30
+ end
31
+
32
+ add_index(:orbital_payment_methods, :kb_account_id)
33
+ add_index(:orbital_payment_methods, :kb_payment_method_id)
34
+
35
+ create_table "orbital_transactions", :force => true do |t|
36
+ t.integer "orbital_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" # orbital 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
50
+ end
51
+
52
+ add_index(:orbital_transactions, :kb_payment_id)
53
+ add_index(:orbital_transactions, :orbital_response_id)
54
+
55
+ create_table "orbital_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_account_num"
66
+ t.string "params_address_1"
67
+ t.string "params_address_2"
68
+ t.string "params_approval_status"
69
+ t.string "params_auth_code"
70
+ t.string "params_avs_resp_code"
71
+ t.string "params_card_brand"
72
+ t.string "params_cavv_resp_code"
73
+ t.string "params_cc_account_num"
74
+ t.string "params_cc_expire_date"
75
+ t.string "params_country_fraud_filter_status"
76
+ t.string "params_customer_bin"
77
+ t.string "params_customer_city"
78
+ t.string "params_customer_country_code"
79
+ t.string "params_customer_email"
80
+ t.string "params_customer_merchant_id"
81
+ t.string "params_customer_name"
82
+ t.string "params_customer_phone"
83
+ t.string "params_customer_profile_action"
84
+ t.string "params_customer_profile_message"
85
+ t.string "params_customer_profile_order_override_ind"
86
+ t.string "params_customer_ref_num"
87
+ t.string "params_customer_state"
88
+ t.string "params_customer_zip"
89
+ t.string "params_cvv2_resp_code"
90
+ t.string "params_ecp_account_dda"
91
+ t.string "params_ecp_account_rt"
92
+ t.string "params_ecp_account_type"
93
+ t.string "params_host_avs_resp_code"
94
+ t.string "params_host_cvv2_resp_code"
95
+ t.string "params_host_resp_code"
96
+ t.string "params_industry_type"
97
+ t.string "params_iso_country_code"
98
+ t.string "params_merchant_id"
99
+ t.string "params_message_type"
100
+ t.string "params_order_default_amount"
101
+ t.string "params_order_default_description"
102
+ t.string "params_order_id"
103
+ t.string "params_partial_auth_occurred"
104
+ t.string "params_proc_status"
105
+ t.string "params_profile_proc_status"
106
+ t.string "params_recurring_advice_cd"
107
+ t.string "params_redeemed_amount"
108
+ t.string "params_remaining_balance"
109
+ t.string "params_requested_amount"
110
+ t.string "params_resp_code"
111
+ t.string "params_resp_msg"
112
+ t.string "params_resp_time"
113
+ t.string "params_status"
114
+ t.string "params_status_msg"
115
+ t.string "params_switch_solo_issue_num"
116
+ t.string "params_switch_solo_start_date"
117
+ t.string "params_terminal_id"
118
+ t.string "params_tx_ref_idx"
119
+ t.string "params_tx_ref_num"
120
+ t.string "avs_result_code"
121
+ t.string "avs_result_message"
122
+ t.string "avs_result_street_match"
123
+ t.string "avs_result_postal_match"
124
+ t.string "cvv_result_code"
125
+ t.string "cvv_result_message"
126
+ t.boolean "success"
127
+ t.datetime "created_at", :null => false
128
+ t.datetime "updated_at", :null => false
129
+ t.string "kb_account_id"
130
+ t.string "kb_tenant_id"
131
+ end
132
+
133
+ add_index(:orbital_responses, [:kb_payment_id, :kb_tenant_id])
134
+ end