bluepay 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +7 -0
  2. data/README +47 -15
  3. data/Rakefile +11 -63
  4. data/bluepay.gemspec +13 -0
  5. data/doc/BluePay.html +2699 -0
  6. data/doc/README.html +173 -0
  7. data/doc/created.rid +3 -0
  8. data/doc/fonts.css +167 -0
  9. data/doc/fonts/Lato-Light.ttf +0 -0
  10. data/doc/fonts/Lato-LightItalic.ttf +0 -0
  11. data/doc/fonts/Lato-Regular.ttf +0 -0
  12. data/doc/fonts/Lato-RegularItalic.ttf +0 -0
  13. data/doc/fonts/SourceCodePro-Bold.ttf +0 -0
  14. data/doc/fonts/SourceCodePro-Regular.ttf +0 -0
  15. data/doc/images/add.png +0 -0
  16. data/doc/images/arrow_up.png +0 -0
  17. data/doc/images/brick.png +0 -0
  18. data/doc/images/brick_link.png +0 -0
  19. data/doc/images/bug.png +0 -0
  20. data/doc/images/bullet_black.png +0 -0
  21. data/doc/images/bullet_toggle_minus.png +0 -0
  22. data/doc/images/bullet_toggle_plus.png +0 -0
  23. data/doc/images/date.png +0 -0
  24. data/doc/images/delete.png +0 -0
  25. data/doc/images/find.png +0 -0
  26. data/doc/images/loadingAnimation.gif +0 -0
  27. data/doc/images/macFFBgHack.png +0 -0
  28. data/doc/images/package.png +0 -0
  29. data/doc/images/page_green.png +0 -0
  30. data/doc/images/page_white_text.png +0 -0
  31. data/doc/images/page_white_width.png +0 -0
  32. data/doc/images/plugin.png +0 -0
  33. data/doc/images/ruby.png +0 -0
  34. data/doc/images/tag_blue.png +0 -0
  35. data/doc/images/tag_green.png +0 -0
  36. data/doc/images/transparent.png +0 -0
  37. data/doc/images/wrench.png +0 -0
  38. data/doc/images/wrench_orange.png +0 -0
  39. data/doc/images/zoom.png +0 -0
  40. data/doc/index.html +92 -0
  41. data/doc/js/darkfish.js +140 -0
  42. data/doc/js/jquery.js +18 -0
  43. data/doc/js/navigation.js +142 -0
  44. data/doc/js/search.js +109 -0
  45. data/doc/js/search_index.js +1 -0
  46. data/doc/js/searcher.js +228 -0
  47. data/doc/rdoc.css +580 -0
  48. data/doc/table_of_contents.html +405 -0
  49. data/lib/bluepay.rb +488 -0
  50. data/test/get_data/retrieve_settlement_data.rb +39 -0
  51. data/test/get_data/retrieve_transaction_data.rb +37 -0
  52. data/test/get_data/transaction_query.rb +48 -0
  53. data/test/getting_stuff_done/get_transaction_data.rb +37 -0
  54. data/test/getting_stuff_done/run_ach_payment.rb +75 -0
  55. data/test/getting_stuff_done/run_cc_payment.rb +73 -0
  56. data/test/getting_stuff_done/set_up_rebill_ach.rb +85 -0
  57. data/test/getting_stuff_done/set_up_rebill_cc.rb +84 -0
  58. data/test/rebills/cancel_rebill.rb +96 -0
  59. data/test/rebills/create_rebill.rb +84 -0
  60. data/test/rebills/get_rebill.rb +97 -0
  61. data/test/rebills/update_rebill.rb +128 -0
  62. data/test/transactions/cancel_transaction.rb +85 -0
  63. data/test/transactions/charge_customer.rb +74 -0
  64. data/test/transactions/check_customer_credit.rb +74 -0
  65. data/test/transactions/credit_customer.rb +75 -0
  66. data/test/transactions/customer_defined_data.rb +99 -0
  67. data/test/transactions/return_funds.rb +86 -0
  68. data/test/transactions/store_payment_information.rb +74 -0
  69. data/test/transactions/use_token.rb +44 -0
  70. metadata +106 -35
  71. data/lib/Bluepay.rb +0 -206
  72. data/test/bp20post_test.rb +0 -12
@@ -0,0 +1,44 @@
1
+ ##
2
+ # BluePay Ruby Sample code.
3
+ #
4
+ # This code sample uses a token from a previously run transaction
5
+ # to charge the same customer $3.00.
6
+ # If using TEST mode, odd dollar amounts will return
7
+ # an approval and even dollar amounts will return a decline.
8
+ ##
9
+
10
+ require "bluepay"
11
+
12
+ $ACCOUNT_ID = "MERCHANT'S ACCOUNT ID HERE"
13
+ $SECRET_KEY = "MERCHANT'S SECRET KEY HERE"
14
+ $MODE = "TEST"
15
+ $TOKEN = "TRANSACTION ID HERE"
16
+
17
+ # Merchant's Account ID
18
+ # Merchant's Secret Key
19
+ # Transaction Mode: TEST (can also be LIVE)
20
+ payment = BluePay.new(
21
+ $ACCOUNT_ID,
22
+ $SECRET_KEY,
23
+ $MODE)
24
+
25
+ # Sale Amount: $3.00
26
+ payment.sale("3.00", $TOKEN)
27
+
28
+ response = payment.process()
29
+
30
+ # If transaction was approved..
31
+ if (payment.get_status() == "APPROVED") then
32
+
33
+ # Read response from BluePay
34
+ puts "TRANSACTION STATUS: " + payment.get_status()
35
+ puts "TRANSACTION MESSAGE: " + payment.get_message()
36
+ puts "TRANSACTION ID: " + payment.get_trans_id()
37
+ puts "AVS RESPONSE: " + payment.get_avs_code()
38
+ puts "CVV2 RESPONSE: " + payment.get_cvv2_code()
39
+ puts "MASKED PAYMENT ACCOUNT: " + payment.get_masked_account()
40
+ puts "CARD TYPE: " + payment.get_card_type()
41
+ puts "AUTH CODE: " + payment.get_auth_code()
42
+ else
43
+ puts payment.get_message()
44
+ end
metadata CHANGED
@@ -1,49 +1,120 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.4
3
- specification_version: 1
4
2
  name: bluepay
5
3
  version: !ruby/object:Gem::Version
6
- version: 1.0.1
7
- date: 2008-05-23 00:00:00 -05:00
8
- summary: Bluepay is used to process credit card and ach transactions through the BluePay 2.0 Gateway.
9
- require_paths:
10
- - lib
11
- email: cjansen@bluepay.com
12
- homepage: http://www.bluepay.com/
13
- rubyforge_project:
14
- description: "This package allows a user to run credit card and ach transactions through the BluePay 2.0 Gateway. BluePay is a merchant account provider and payment gateway. BluePay, Inc. is a one-stop shop merchant services provider. For more information, visit: http://www.bluepay.com"
15
- autorequire: bluepay
16
- default_executable:
17
- bindir: bin
18
- has_rdoc: true
19
- required_ruby_version: !ruby/object:Gem::Version::Requirement
20
- requirements:
21
- - - ">"
22
- - !ruby/object:Gem::Version
23
- version: 0.0.0
24
- version:
4
+ version: 1.0.2
25
5
  platform: ruby
26
- signing_key:
27
- cert_chain:
28
- post_install_message:
29
6
  authors:
30
- - Chris Jansen
31
- files:
32
- - lib/Bluepay.rb
33
- - test/bp20post_test.rb
34
- - README
35
- - Rakefile
36
- test_files: []
37
-
38
- rdoc_options: []
7
+ - Justin Slingerland
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
39
11
 
40
- extra_rdoc_files: []
12
+ date: 2014-06-16 00:00:00 Z
13
+ dependencies: []
41
14
 
15
+ description: This gem is intended to be used along with a BluePay gateway account to test credit card and ACH transaction processing
16
+ email: jslingerland@blueapy.com
42
17
  executables: []
43
18
 
44
19
  extensions: []
45
20
 
21
+ extra_rdoc_files: []
22
+
23
+ files:
24
+ - README
25
+ - Rakefile
26
+ - bluepay.gemspec
27
+ - doc/BluePay.html
28
+ - doc/README.html
29
+ - doc/created.rid
30
+ - doc/fonts.css
31
+ - doc/fonts/Lato-Light.ttf
32
+ - doc/fonts/Lato-LightItalic.ttf
33
+ - doc/fonts/Lato-Regular.ttf
34
+ - doc/fonts/Lato-RegularItalic.ttf
35
+ - doc/fonts/SourceCodePro-Bold.ttf
36
+ - doc/fonts/SourceCodePro-Regular.ttf
37
+ - doc/images/add.png
38
+ - doc/images/arrow_up.png
39
+ - doc/images/brick.png
40
+ - doc/images/brick_link.png
41
+ - doc/images/bug.png
42
+ - doc/images/bullet_black.png
43
+ - doc/images/bullet_toggle_minus.png
44
+ - doc/images/bullet_toggle_plus.png
45
+ - doc/images/date.png
46
+ - doc/images/delete.png
47
+ - doc/images/find.png
48
+ - doc/images/loadingAnimation.gif
49
+ - doc/images/macFFBgHack.png
50
+ - doc/images/package.png
51
+ - doc/images/page_green.png
52
+ - doc/images/page_white_text.png
53
+ - doc/images/page_white_width.png
54
+ - doc/images/plugin.png
55
+ - doc/images/ruby.png
56
+ - doc/images/tag_blue.png
57
+ - doc/images/tag_green.png
58
+ - doc/images/transparent.png
59
+ - doc/images/wrench.png
60
+ - doc/images/wrench_orange.png
61
+ - doc/images/zoom.png
62
+ - doc/index.html
63
+ - doc/js/darkfish.js
64
+ - doc/js/jquery.js
65
+ - doc/js/navigation.js
66
+ - doc/js/search.js
67
+ - doc/js/search_index.js
68
+ - doc/js/searcher.js
69
+ - doc/rdoc.css
70
+ - doc/table_of_contents.html
71
+ - lib/bluepay.rb
72
+ - test/get_data/retrieve_settlement_data.rb
73
+ - test/get_data/retrieve_transaction_data.rb
74
+ - test/get_data/transaction_query.rb
75
+ - test/getting_stuff_done/get_transaction_data.rb
76
+ - test/getting_stuff_done/run_ach_payment.rb
77
+ - test/getting_stuff_done/run_cc_payment.rb
78
+ - test/getting_stuff_done/set_up_rebill_ach.rb
79
+ - test/getting_stuff_done/set_up_rebill_cc.rb
80
+ - test/rebills/cancel_rebill.rb
81
+ - test/rebills/create_rebill.rb
82
+ - test/rebills/get_rebill.rb
83
+ - test/rebills/update_rebill.rb
84
+ - test/transactions/cancel_transaction.rb
85
+ - test/transactions/charge_customer.rb
86
+ - test/transactions/check_customer_credit.rb
87
+ - test/transactions/credit_customer.rb
88
+ - test/transactions/customer_defined_data.rb
89
+ - test/transactions/return_funds.rb
90
+ - test/transactions/store_payment_information.rb
91
+ - test/transactions/use_token.rb
92
+ homepage: http://www.bluepay.com
93
+ licenses:
94
+ - GPL
95
+ metadata: {}
96
+
97
+ post_install_message:
98
+ rdoc_options: []
99
+
100
+ require_paths:
101
+ - lib
102
+ required_ruby_version: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - &id001
105
+ - ">="
106
+ - !ruby/object:Gem::Version
107
+ version: "0"
108
+ required_rubygems_version: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - *id001
46
111
  requirements: []
47
112
 
48
- dependencies: []
113
+ rubyforge_project:
114
+ rubygems_version: 2.3.0
115
+ signing_key:
116
+ specification_version: 4
117
+ summary: BluePay gateway rubygem.
118
+ test_files: []
49
119
 
120
+ has_rdoc: true
@@ -1,206 +0,0 @@
1
- #!/usr/bin/ruby
2
- #--
3
- # Copyright (c) 2008 BluePay, Inc.
4
- # Author: Chris Jansen
5
- #
6
- # Permission is hereby granted, free of charge, to any person obtaining
7
- # a copy of this software and associated documentation files (the
8
- # "Software"), to deal in the Software without restriction, including
9
- # without limitation the rights to use, copy, modify, merge, publish,
10
- # distribute, sublicense, and/or sell copies of the Software, and to
11
- # permit persons to whom the Software is furnished to do so, subject to
12
- # the following conditions:
13
- #
14
- # The above copyright notice and this permission notice shall be
15
- # included in all copies or substantial portions of the Software.
16
- #
17
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18
- # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19
- # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20
- # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
21
- # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22
- # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23
- # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24
- #++
25
- #
26
- # See Bluepay documentation.
27
-
28
- require "net/http"
29
- require "net/https"
30
- require "uri"
31
- require "md5"
32
-
33
-
34
-
35
- class Bluepay
36
-
37
- @@SERVER = "secure.bluepay.com"
38
- @@PATH = "/interfaces/bp20post"
39
-
40
- def initialize(account,key,mode='TEST')
41
- @ACCOUNT_ID = account
42
- @SECRET_KEY = key
43
- @PARAM_HASH = { 'MODE' => mode }
44
- @RETURN_HASH = Hash.new()
45
- end
46
-
47
- # used to set all other parameters... there's a lot of them.
48
- # See Bluepay20post.txt
49
- def set_param(key, val)
50
- @PARAM_HASH[key] = val
51
- end
52
-
53
- # Set up an ACH transaction. Expects:
54
- # acc_type: C for Checking, S for Savings
55
- # routing: Bank routing number
56
- # account: Customer's checking or savings account number
57
- # doc_type: WEB, TEL, ARC, etc -- see docs. Optional.
58
- # REMEMBER: Ach requires some other fields,
59
- # such as address and phone
60
- def use_check(acc_type, routing, account, doc_type)
61
- @PARAM_HASH['PAYMENT_ACCOUNT'] = "#{acc_type}:#{routing}:#{account}"
62
- @PARAM_HASH['DOC_TYPE'] = doc_type
63
- @PARAM_HASH['PAYMENT_TYPE'] = "ACH"
64
- end
65
-
66
- # Set up a credit card payment.
67
- def use_card(account, expire, cvv)
68
- @PARAM_HASH['PAYMENT_ACCOUNT'] = account
69
- @PARAM_HASH['CARD_EXPIRE'] = expire
70
- @PARAM_HASH['CARD_CVV2'] = cvv
71
- end
72
-
73
- # Set up a sale
74
- def easy_sale(amount)
75
- @PARAM_HASH['TRANS_TYPE'] = 'SALE'
76
- @PARAM_HASH['AMOUNT'] = amount
77
- end
78
-
79
- # Set up an Auth-only
80
- def easy_auth(amount)
81
- @PARAM_HASH['TRANS_TYPE'] = 'AUTH'
82
- @PARAM_HASH['AMOUNT'] = amount
83
- end
84
-
85
- # Capture an auth
86
- def easy_capture(trans_id)
87
- @PARAM_HASH['TRANS_TYPE'] = 'CAPTURE'
88
- @PARAM_HASH['MASTER_ID'] = trans_id
89
- end
90
-
91
- # Refund
92
- def easy_refund(trans_id)
93
- @PARAM_HASH['TRANS_TYPE'] = 'REFUND'
94
- @PARAM_HASH['MASTER_ID'] = trans_id
95
- end
96
-
97
- # This is the important stuff to get
98
- # the best rates on CC transactions.
99
- def customer_data(name1, name2, addr1, city, state, zip)
100
- @PARAM_HASH['NAME1'] = name1
101
- @PARAM_HASH['NAME2'] = name2
102
- @PARAM_HASH['ADDR1'] = addr1
103
- @PARAM_HASH['CITY'] = city
104
- @PARAM_HASH['STATE'] = state
105
- @PARAM_HASH['ZIP'] = zip
106
- end
107
-
108
- # Turns a hash into a foo=bar&baz=bat style string
109
- def uri_query(h)
110
- a = Array.new()
111
- h.each_pair {|key, val| a.push(URI.escape(key) + "=" + URI.escape(val)) }
112
- return a.join("&")
113
- end
114
-
115
- # Sets TAMPER_PROOF_SEAL in @PARAM_HASH
116
- def calc_tps()
117
- # Take the cheap way out. I wrote bp20post and I hereby publically
118
- # state the TPS in bp20post is stupid.
119
- @PARAM_HASH["TPS_DEF"] = "HELLO_MOTHER"
120
- @PARAM_HASH["TAMPER_PROOF_SEAL"] = MD5.new(@SECRET_KEY).hexdigest
121
- end
122
-
123
- # Run a transaction - you must have called appropriate functions
124
- # to set the transaction type, etc before calling this.
125
- def process()
126
- ua = Net::HTTP.new(@@SERVER, 443)
127
- ua.use_ssl = true
128
-
129
- # Generate the query string and headers
130
- calc_tps()
131
- query = "ACCOUNT_ID=#{@ACCOUNT_ID}&"
132
- query += uri_query(@PARAM_HASH)
133
-
134
- queryheaders = {
135
- 'User-Agent' => 'Bluepay Ruby Client',
136
- 'Content-Type' => 'application/x-www-form-urlencoded'
137
- }
138
-
139
- # Make Bluepay do Super CreditCard Magic
140
- headers, body = ua.post(@@PATH, query, queryheaders)
141
-
142
- # Split the response into the response hash.
143
- # Also, we stuff in RESPONSE_CODE expected to be 200 or 400...
144
- @RESPONSE_HASH = { "RESPONSE_CODE" => headers.code }
145
- body.split("&").each { |pair|
146
- (key, val) = pair.split("=")
147
- val = "" if(val == nil)
148
- @RESPONSE_HASH[URI.unescape(key)] = URI.unescape(val)
149
- }
150
- end
151
-
152
- # Returns ! on WTF, E for Error, 1 for Approved, 0 for Decline
153
- def get_status()
154
- return 'E' if(@RESPONSE_HASH['RESPONSE_CODE'] == 400)
155
- return '1' if(@RESPONSE_HASH['STATUS'] == '1');
156
- return '0' if(@RESPONSE_HASH['STATUS'] == '0');
157
- return 'E' if(@RESPONSE_HASH['STATUS'] == 'E');
158
- return '!'
159
- end
160
-
161
- # Returns the human-readable response from Bluepay.
162
- # Or a nasty error.
163
- def get_message()
164
- m = @RESPONSE_HASH['MESSAGE']
165
- if (m == nil or m == "")
166
- return "ERROR - NO MESSAGE FROM BLUEPAY"
167
- end
168
- return m
169
- end
170
-
171
- # Returns the single-character AVS response from the
172
- # Card Issuing Bank
173
- def get_avs_code()
174
- return @RESPONSE_HASH['AVS']
175
- end
176
-
177
- # Same as avs_code, but for CVV2
178
- def get_cvv2_code()
179
- return @RESPONSE_HASH['CVV2']
180
- end
181
-
182
- # In the case of an approved transaction, contains the
183
- # 6-character authorization code from the processing network.
184
- # In the case of a decline or error, the contents may be junk.
185
- def get_auth_code()
186
- return @RESPONSE_HASH['AUTH_CODE']
187
- end
188
-
189
- # The all-important transaction ID.
190
- def get_trans_id()
191
- return @RESPONSE_HASH['TRANS_ID']
192
- end
193
-
194
- # If you set up a rebilling, this'll get it's ID.
195
- def get_rebill_id()
196
- return @RESPONSE_HASH['REBID']
197
- end
198
-
199
- end
200
-
201
-
202
-
203
-
204
-
205
-
206
-
@@ -1,12 +0,0 @@
1
- #!/usr/bin/ruby
2
-
3
- require "Bluepay"
4
-
5
- tob = Bluepay.new("123123123123", "ABCDabcdABCDabcdABCDabcdABCDabcd")
6
- tob.easy_sale("1.00")
7
- tob.use_card("4111111111111111", "1109", "123")
8
- tob.process()
9
- puts "Status: " + tob.get_status()
10
- puts "Message: " + tob.get_message()
11
- puts "Transaction ID: " + tob.get_trans_id()
12
-