bluepay 1.0.4 → 1.0.5
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 +4 -4
- data/README +2 -2
- data/Rakefile +1 -1
- data/bluepay.gemspec +3 -3
- data/lib/api_request.rb +15 -10
- data/lib/api_response.rb +1 -1
- data/lib/bluepay.rb +214 -3
- data/test/Get_Data/Retrieve_Settlement_Data.rb +10 -10
- data/test/Get_Data/Retrieve_Transaction_Data.rb +9 -9
- data/test/Get_Data/Single_Transaction_Query.rb +10 -9
- data/test/Get_Data/Transaction_Notification.rb +2 -2
- data/test/Rebill/Cancel_Recurring_Payment.rb +3 -4
- data/test/Rebill/Create_Recurring_Payment_ACH.rb +10 -9
- data/test/Rebill/Create_Recurring_Payment_CC.rb +11 -9
- data/test/Rebill/Get_Recurring_Payment_Status.rb +9 -8
- data/test/Rebill/Update_Recurring_Payment.rb +9 -8
- data/test/Transactions/{Charge_Customer_CC.rb → CHarge_Customer_CC.rb} +8 -9
- data/test/Transactions/Cancel_Transaction.rb +10 -10
- data/test/Transactions/Charge_Customer_ACH.rb +9 -9
- data/test/Transactions/Check_Customer_Credit.rb +8 -9
- data/test/Transactions/Customer_Defined_Data.rb +11 -12
- data/test/Transactions/How_To_Use_Token.rb +10 -10
- data/test/Transactions/Return_Funds.rb +12 -12
- data/test/Transactions/Store_Payment_Information.rb +8 -9
- data/test/Transactions/Swipe.rb +52 -0
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e9309e473e4b4e4d018ea206361d79c6f3b7f93a
|
4
|
+
data.tar.gz: c115b5735ab6eeb3cac081c5f256edebddde5675
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e758ef3d860bc9117dc8ea641f5b75364306141df5713ba5b28171b22c8a878fc848f5086e47978e797c8bd6f996e784fce458e362bdc80d51b3e5c2160659f0
|
7
|
+
data.tar.gz: b245d0e0dbe8a6a973a24710f5a807464948b6ef7a6c1367a5da59458f1f789022d357f7eaa6c4e8900d12a9eeaf51bd8faf0c95de278e91d6867c6a8420a862
|
data/README
CHANGED
@@ -10,7 +10,7 @@ Additional sample code available in the test directory of the gem.
|
|
10
10
|
|
11
11
|
== Example
|
12
12
|
|
13
|
-
require "
|
13
|
+
require "bluepay"
|
14
14
|
|
15
15
|
$ACCOUNT_ID = "MERCHANT'S ACCOUNT ID HERE"
|
16
16
|
$SECRET_KEY = "MERCHANT'S SECRET KEY HERE"
|
@@ -57,5 +57,5 @@ end
|
|
57
57
|
|
58
58
|
Author:: Justin Slingerland
|
59
59
|
ReadmeDoc:: Justin Slingerland
|
60
|
-
Copyright:: Copyright (c)
|
60
|
+
Copyright:: Copyright (c) 2016 BluePay, Inc.
|
61
61
|
License:: GPL - GNU General Public License - http://www.gnu.org/licenses/gpl.html
|
data/Rakefile
CHANGED
data/bluepay.gemspec
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'bluepay'
|
3
|
-
s.version = '1.0.
|
4
|
-
s.date = '
|
3
|
+
s.version = '1.0.5'
|
4
|
+
s.date = '2016-03-17'
|
5
5
|
s.summary = "BluePay gateway rubygem"
|
6
6
|
s.description = "This gem is intended to be used along with a BluePay gateway account to process credit card and ACH transactions"
|
7
|
-
s.authors = ["Justin Slingerland"]
|
7
|
+
s.authors = ["Justin Slingerland, Susan Schmidt"]
|
8
8
|
s.email = 'jslingerland@bluepay.com'
|
9
9
|
s.has_rdoc = true
|
10
10
|
s.files = Dir.glob("{lib,test,doc}/**/*") + %w(bluepay.gemspec Rakefile README)
|
data/lib/api_request.rb
CHANGED
@@ -4,12 +4,13 @@ class BluePay
|
|
4
4
|
def uri_query(param_hash)
|
5
5
|
array = []
|
6
6
|
param_hash.each_pair {|key, val| array << (URI.escape(key) + "=" + URI.escape(val))}
|
7
|
-
array.join("&")
|
7
|
+
uri_query_string = array.join("&")
|
8
|
+
return uri_query_string
|
8
9
|
end
|
9
10
|
|
10
11
|
# Sets TAMPER_PROOF_SEAL in @PARAM_HASH
|
11
12
|
def calc_tps
|
12
|
-
@PARAM_HASH["TAMPER_PROOF_SEAL"] = Digest::
|
13
|
+
@PARAM_HASH["TAMPER_PROOF_SEAL"] = Digest::SHA512.hexdigest(
|
13
14
|
@SECRET_KEY +
|
14
15
|
@ACCOUNT_ID +
|
15
16
|
(@PARAM_HASH["TRANSACTION_TYPE"] || '') +
|
@@ -47,10 +48,10 @@ class BluePay
|
|
47
48
|
# Calculates TAMPER_PROOF_SEAL to be used with Trans Notify API
|
48
49
|
def self.calc_trans_notify_tps(secret_key, trans_id, trans_status, trans_type, amount, batch_id, batch_status, total_count, total_amount, batch_upload_id, rebill_id, rebill_amount, rebill_status)
|
49
50
|
Digest::MD5.hexdigest(
|
50
|
-
|
51
|
+
@SECRET_KEY +
|
51
52
|
trans_id +
|
52
53
|
trans_status +
|
53
|
-
|
54
|
+
transtype +
|
54
55
|
amount +
|
55
56
|
batch_id +
|
56
57
|
batch_status +
|
@@ -65,8 +66,11 @@ class BluePay
|
|
65
66
|
|
66
67
|
# sends HTTPS POST to BluePay gateway for processing
|
67
68
|
def process
|
69
|
+
|
68
70
|
ua = Net::HTTP.new(SERVER, 443)
|
69
71
|
ua.use_ssl = true
|
72
|
+
|
73
|
+
# Checks presence of CA certificate
|
70
74
|
if File.directory?(RootCA)
|
71
75
|
ua.ca_path = RootCA
|
72
76
|
ua.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
@@ -75,13 +79,14 @@ class BluePay
|
|
75
79
|
puts "Invalid CA certificates directory. Exiting..."
|
76
80
|
exit
|
77
81
|
end
|
82
|
+
|
83
|
+
# Sets REMOTE_IP parameter
|
78
84
|
begin
|
79
85
|
@PARAM_HASH["REMOTE_IP"] = request.env['REMOTE_ADDR']
|
80
86
|
rescue Exception
|
81
87
|
end
|
82
|
-
|
83
|
-
|
84
|
-
# Chooses which API to make request to
|
88
|
+
|
89
|
+
# Generate the query string and headers. Chooses which API to make request to.
|
85
90
|
case @api
|
86
91
|
when "bpdailyreport2"
|
87
92
|
calc_report_tps
|
@@ -94,7 +99,7 @@ class BluePay
|
|
94
99
|
when "bp10emu"
|
95
100
|
calc_tps
|
96
101
|
path = "/interfaces/bp10emu"
|
97
|
-
query = "MERCHANT=#{@ACCOUNT_ID}&" + uri_query(@PARAM_HASH)
|
102
|
+
query = "MERCHANT=#{@ACCOUNT_ID}&" + uri_query(@PARAM_HASH) + "&TPS_HASH_TYPE=SHA512"
|
98
103
|
# puts "****"; puts uri_query(@PARAM_HASH).inspect
|
99
104
|
when "bp20rebadmin"
|
100
105
|
calc_rebill_tps
|
@@ -102,7 +107,7 @@ class BluePay
|
|
102
107
|
query = "ACCOUNT_ID=#{@ACCOUNT_ID}&" + uri_query(@PARAM_HASH)
|
103
108
|
end
|
104
109
|
queryheaders = {
|
105
|
-
'User-Agent' => '
|
110
|
+
'User-Agent' => 'Bluepay Ruby Client',
|
106
111
|
'Content-Type' => 'application/x-www-form-urlencoded'
|
107
112
|
}
|
108
113
|
# Response version to be returned
|
@@ -122,4 +127,4 @@ class BluePay
|
|
122
127
|
@RESPONSE_HASH[URI.unescape(key)] = URI.unescape(val)
|
123
128
|
end
|
124
129
|
end
|
125
|
-
end
|
130
|
+
end
|
data/lib/api_response.rb
CHANGED
data/lib/bluepay.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require "net/http"
|
2
2
|
require "net/https"
|
3
3
|
require "uri"
|
4
|
+
require "digest/sha2"
|
4
5
|
require "digest/md5"
|
5
6
|
|
6
7
|
# Files
|
@@ -10,8 +11,7 @@ require_relative "api_response"
|
|
10
11
|
class BluePay
|
11
12
|
SERVER = "secure.bluepay.com"
|
12
13
|
# Make sure this is the correct path to your CA certificates directory
|
13
|
-
|
14
|
-
RootCA = "."
|
14
|
+
RootCA = "/"
|
15
15
|
|
16
16
|
def initialize(params = {})
|
17
17
|
@ACCOUNT_ID = params[:account_id]
|
@@ -32,6 +32,8 @@ class BluePay
|
|
32
32
|
# routing: Bank routing number
|
33
33
|
# account: Customer's checking or savings account number
|
34
34
|
# doc_type: WEB, TEL, ARC, etc -- see docs. Optional.
|
35
|
+
# REMEMBER: Ach requires some other fields,
|
36
|
+
# such as address and phone
|
35
37
|
def set_ach_information(params = {})
|
36
38
|
@PARAM_HASH['PAYMENT_TYPE'] = 'ACH'
|
37
39
|
@PARAM_HASH['ACH_ROUTING'] = params[:ach_routing]
|
@@ -80,6 +82,14 @@ class BluePay
|
|
80
82
|
@api = "bp10emu"
|
81
83
|
end
|
82
84
|
|
85
|
+
# Sets payment information for a swiped credit card transaction
|
86
|
+
def swipe(track_data)
|
87
|
+
@PARAM_HASH['SWIPE'] = track_data
|
88
|
+
# Regex matchers
|
89
|
+
# track1_and_track2 = /(%B)\d{0,19}\^([\w\s]*)\/([\w\s]*)([\s]*)\^\d{7}\w*\?;\d{0,19}=\d{7}\w*\?/.match(track_data).to_s
|
90
|
+
# track2 = /;\d{0,19}=\d{7}\w*\?/.match(track_data).to_s
|
91
|
+
end
|
92
|
+
|
83
93
|
# Sets customer information for the transaction
|
84
94
|
def set_customer_information(params={})
|
85
95
|
@PARAM_HASH['NAME1'] = params[:first_name]
|
@@ -156,7 +166,6 @@ class BluePay
|
|
156
166
|
@PARAM_HASH['REB_EXPR'] = params[:reb_expr]
|
157
167
|
@PARAM_HASH['REB_CYCLES'] = params[:reb_cycles]
|
158
168
|
@PARAM_HASH['REB_AMOUNT'] = params[:reb_amount]
|
159
|
-
# @api = "bp10emu"
|
160
169
|
end
|
161
170
|
|
162
171
|
# Set fields to do an update on an existing rebilling cycle
|
@@ -223,6 +232,11 @@ class BluePay
|
|
223
232
|
@api = "stq"
|
224
233
|
end
|
225
234
|
|
235
|
+
# Queries by a specific Transaction ID. To be used with get_single_trans_query
|
236
|
+
def query_by_transaction_id(trans_id)
|
237
|
+
@PARAM_HASH["id"] = trans_id
|
238
|
+
end
|
239
|
+
|
226
240
|
# Queries by a specific Payment Type. To be used with get_single_trans_query
|
227
241
|
def query_by_payment_type(pay_type)
|
228
242
|
@PARAM_HASH["payment_type"] = payment_type
|
@@ -247,4 +261,201 @@ class BluePay
|
|
247
261
|
def query_by_name2(name2)
|
248
262
|
@PARAM_HASH["name2"] = name2
|
249
263
|
end
|
264
|
+
|
265
|
+
# Required arguments for generate_url:
|
266
|
+
# merchant_name: Merchant name that will be displayed in the payment page.
|
267
|
+
# return_url: Link to be displayed on the transacton results page. Usually the merchant's web site home page.
|
268
|
+
# transaction_type: SALE/AUTH -- Whether the customer should be charged or only check for enough credit available.
|
269
|
+
# accept_discover: Yes/No -- Yes for most US merchants. No for most Canadian merchants.
|
270
|
+
# accept_amex: Yes/No -- Has an American Express merchant account been set up?
|
271
|
+
# amount: The amount if the merchant is setting the initial amount.
|
272
|
+
# protect_amount: Yes/No -- Should the amount be protected from changes by the tamperproof seal?
|
273
|
+
# rebilling: Yes/No -- Should a recurring transaction be set up?
|
274
|
+
# paymentTemplate: Select one of our payment form template IDs or your own customized template ID. If the customer should not be allowed to change the amount, add a 'D' to the end of the template ID. Example: 'mobileform01D'
|
275
|
+
# mobileform01 -- Credit Card Only - White Vertical (mobile capable)
|
276
|
+
# default1v5 -- Credit Card Only - Gray Horizontal
|
277
|
+
# default7v5 -- Credit Card Only - Gray Horizontal Donation
|
278
|
+
# default7v5R -- Credit Card Only - Gray Horizontal Donation with Recurring
|
279
|
+
# default3v4 -- Credit Card Only - Blue Vertical with card swipe
|
280
|
+
# mobileform02 -- Credit Card & ACH - White Vertical (mobile capable)
|
281
|
+
# default8v5 -- Credit Card & ACH - Gray Horizontal Donation
|
282
|
+
# default8v5R -- Credit Card & ACH - Gray Horizontal Donation with Recurring
|
283
|
+
# mobileform03 -- ACH Only - White Vertical (mobile capable)
|
284
|
+
# receiptTemplate: Select one of our receipt form template IDs, your own customized template ID, or "remote_url" if you have one.
|
285
|
+
# mobileresult01 -- Default without signature line - White Responsive (mobile)
|
286
|
+
# defaultres1 -- Default without signature line – Blue
|
287
|
+
# V5results -- Default without signature line – Gray
|
288
|
+
# V5Iresults -- Default without signature line – White
|
289
|
+
# defaultres2 -- Default with signature line – Blue
|
290
|
+
# remote_url - Use a remote URL
|
291
|
+
# receipt_temp_remote_url: Your remote URL ** Only required if receipt_template = "remote_url".
|
292
|
+
|
293
|
+
# Optional arguments for generate_url:
|
294
|
+
# reb_protect: Yes/No -- Should the rebilling fields be protected by the tamperproof seal?
|
295
|
+
# reb_amount: Amount that will be charged when a recurring transaction occurs.
|
296
|
+
# reb_cycles: Number of times that the recurring transaction should occur. Not set if recurring transactions should continue until canceled.
|
297
|
+
# reb_start_date: Date (yyyy-mm-dd) or period (x units) until the first recurring transaction should occur. Possible units are DAY, DAYS, WEEK, WEEKS, MONTH, MONTHS, YEAR or YEARS. (ex. 2016-04-01 or 1 MONTH)
|
298
|
+
# reb_frequency: How often the recurring transaction should occur. Format is 'X UNITS'. Possible units are DAY, DAYS, WEEK, WEEKS, MONTH, MONTHS, YEAR or YEARS. (ex. 1 MONTH)
|
299
|
+
# custom_id: A merchant defined custom ID value.
|
300
|
+
# protect_custom_id: Yes/No -- Should the Custom ID value be protected from change using the tamperproof seal?
|
301
|
+
# custom_id2: A merchant defined custom ID 2 value.
|
302
|
+
# protect_custom_id2: Yes/No -- Should the Custom ID 2 value be protected from change using the tamperproof seal?
|
303
|
+
|
304
|
+
def generate_url(params={})
|
305
|
+
@PARAM_HASH['DBA'] = params[:merchant_name]
|
306
|
+
@PARAM_HASH['RETURN_URL'] = params[:return_url]
|
307
|
+
@PARAM_HASH['TRANSACTION_TYPE'] = params[:transaction_type]
|
308
|
+
@PARAM_HASH['DISCOVER_IMAGE'] = params[:accept_discover].start_with?("y","Y") ? "discvr.gif" : "spacer.gif"
|
309
|
+
@PARAM_HASH['AMEX_IMAGE'] = params[:accept_amex].start_with?("y","Y") ? "amex.gif" : "spacer.gif"
|
310
|
+
@PARAM_HASH['AMOUNT'] = params[:amount] || ''
|
311
|
+
@PARAM_HASH['PROTECT_AMOUNT'] = params[:protect_amount] || "No"
|
312
|
+
@PARAM_HASH['REBILLING'] = params[:rebilling].start_with?("y","Y") ? "1" : "0"
|
313
|
+
@PARAM_HASH['REB_PROTECT'] = params[:reb_protect] || 'Yes'
|
314
|
+
@PARAM_HASH['REB_AMOUNT'] = params[:reb_amount] || ''
|
315
|
+
@PARAM_HASH['REB_CYCLES'] = params[:reb_cycles] || ''
|
316
|
+
@PARAM_HASH['REB_FIRST_DATE'] = params[:reb_start_date] || ''
|
317
|
+
@PARAM_HASH['REB_EXPR'] = params[:reb_frequency] || ''
|
318
|
+
@PARAM_HASH['CUSTOM_ID'] = params[:custom_id] || ''
|
319
|
+
@PARAM_HASH['PROTECT_CUSTOM_ID'] = params[:protect_custom_id] || "No"
|
320
|
+
@PARAM_HASH['CUSTOM_ID2'] = params[:custom_id2] || ''
|
321
|
+
@PARAM_HASH['PROTECT_CUSTOM_ID2'] = params[:protect_custom_id2] || "No"
|
322
|
+
@PARAM_HASH['SHPF_FORM_ID'] = params[:payment_template] || "mobileform01"
|
323
|
+
@PARAM_HASH['RECEIPT_FORM_ID'] = params[:receipt_template] || "mobileresult01"
|
324
|
+
@PARAM_HASH['REMOTE_URL'] = params[:receipt_temp_remote_url] || ''
|
325
|
+
@card_types = set_card_types
|
326
|
+
@receipt_tps_def = 'SHPF_ACCOUNT_ID SHPF_FORM_ID RETURN_URL DBA AMEX_IMAGE DISCOVER_IMAGE SHPF_TPS_DEF'
|
327
|
+
@receipt_tps_string = set_receipt_tps_string
|
328
|
+
@receipt_tamper_proof_seal = calc_url_tps(@receipt_tps_string)
|
329
|
+
@receipt_url = set_receipt_url
|
330
|
+
@bp10emu_tps_def = add_def_protected_status('MERCHANT APPROVED_URL DECLINED_URL MISSING_URL MODE TRANSACTION_TYPE TPS_DEF')
|
331
|
+
@bp10emu_tps_string = set_bp10emu_tps_string
|
332
|
+
@bp10emu_tamper_proof_seal = calc_url_tps(@bp10emu_tps_string)
|
333
|
+
@shpf_tps_def = add_def_protected_status('SHPF_FORM_ID SHPF_ACCOUNT_ID DBA TAMPER_PROOF_SEAL AMEX_IMAGE DISCOVER_IMAGE TPS_DEF SHPF_TPS_DEF')
|
334
|
+
@shpf_tps_string = set_shpf_tps_string
|
335
|
+
@shpf_tamper_proof_seal = calc_url_tps(@shpf_tps_string)
|
336
|
+
return calc_url_response
|
337
|
+
end
|
338
|
+
|
339
|
+
# Sets the types of credit card images to use on the Simple Hosted Payment Form. Must be used with generate_url.
|
340
|
+
def set_card_types
|
341
|
+
credit_cards = 'vi-mc'
|
342
|
+
credit_cards.concat('-di') if @PARAM_HASH['DISCOVER_IMAGE'] == 'discvr.gif'
|
343
|
+
credit_cards.concat('-am') if @PARAM_HASH['AMEX_IMAGE'] == 'amex.gif'
|
344
|
+
return credit_cards
|
345
|
+
end
|
346
|
+
|
347
|
+
# Sets the receipt Tamperproof Seal string. Must be used with generate_url.
|
348
|
+
def set_receipt_tps_string
|
349
|
+
[@SECRET_KEY,
|
350
|
+
@ACCOUNT_ID,
|
351
|
+
@PARAM_HASH['RECEIPT_FORM_ID'],
|
352
|
+
@PARAM_HASH['RETURN_URL'],
|
353
|
+
@PARAM_HASH['DBA'],
|
354
|
+
@PARAM_HASH['AMEX_IMAGE'],
|
355
|
+
@PARAM_HASH['DISCOVER_IMAGE'],
|
356
|
+
@receipt_tps_def].join('')
|
357
|
+
end
|
358
|
+
|
359
|
+
# Sets the bp10emu string that will be used to create a Tamperproof Seal. Must be used with generate_url.
|
360
|
+
def set_bp10emu_tps_string
|
361
|
+
bp10emu = [
|
362
|
+
@SECRET_KEY,
|
363
|
+
@ACCOUNT_ID,
|
364
|
+
@receipt_url,
|
365
|
+
@receipt_url,
|
366
|
+
@receipt_url,
|
367
|
+
@PARAM_HASH['MODE'],
|
368
|
+
@PARAM_HASH['TRANSACTION_TYPE'],
|
369
|
+
@bp10emu_tps_def].join('')
|
370
|
+
return add_string_protected_status(bp10emu)
|
371
|
+
end
|
372
|
+
|
373
|
+
# Sets the Simple Hosted Payment Form string that will be used to create a Tamperproof Seal. Must be used with generate_url.
|
374
|
+
def set_shpf_tps_string
|
375
|
+
shpf = ([@SECRET_KEY,
|
376
|
+
@PARAM_HASH['SHPF_FORM_ID'],
|
377
|
+
@ACCOUNT_ID,
|
378
|
+
@PARAM_HASH['DBA'],
|
379
|
+
@bp10emu_tamper_proof_seal,
|
380
|
+
@PARAM_HASH['AMEX_IMAGE'],
|
381
|
+
@PARAM_HASH['DISCOVER_IMAGE'],
|
382
|
+
@bp10emu_tps_def,
|
383
|
+
@shpf_tps_def].join(''))
|
384
|
+
return add_string_protected_status(shpf)
|
385
|
+
end
|
386
|
+
|
387
|
+
# Sets the receipt url or uses the remote url provided. Must be used with generate_url.
|
388
|
+
def set_receipt_url
|
389
|
+
if @PARAM_HASH['RECEIPT_FORM_ID']== 'remote_url'
|
390
|
+
return @PARAM_HASH['REMOTE_URL']
|
391
|
+
else
|
392
|
+
return 'https://secure.bluepay.com/interfaces/shpf?SHPF_FORM_ID=' + @PARAM_HASH['RECEIPT_FORM_ID'] +
|
393
|
+
'&SHPF_ACCOUNT_ID=' + ACCOUNT_ID +
|
394
|
+
'&SHPF_TPS_DEF=' + url_encode(@receipt_tps_def) +
|
395
|
+
'&SHPF_TPS=' + url_encode(@receipt_tamper_proof_seal) +
|
396
|
+
'&RETURN_URL=' + url_encode(@PARAM_HASH['RETURN_URL']) +
|
397
|
+
'&DBA=' + url_encode(@PARAM_HASH['DBA']) +
|
398
|
+
'&AMEX_IMAGE=' + url_encode(@PARAM_HASH['AMEX_IMAGE']) +
|
399
|
+
'&DISCOVER_IMAGE=' + url_encode(@PARAM_HASH['DISCOVER_IMAGE'])
|
400
|
+
end
|
401
|
+
end
|
402
|
+
|
403
|
+
# Adds optional protected keys to a string. Must be used with generate_url.
|
404
|
+
def add_def_protected_status(string)
|
405
|
+
string.concat(' AMOUNT') if @PARAM_HASH['PROTECT_AMOUNT'] == 'Yes'
|
406
|
+
string.concat(' REBILLING REB_CYCLES REB_AMOUNT REB_EXPR REB_FIRST_DATE') if @PARAM_HASH['REB_PROTECT'] == 'Yes'
|
407
|
+
string.concat(' CUSTOM_ID') if @PARAM_HASH['PROTECT_CUSTOM_ID'] == 'Yes'
|
408
|
+
string.concat(' CUSTOM_ID2') if @PARAM_HASH['PROTECT_CUSTOM_ID2'] == 'Yes'
|
409
|
+
return string
|
410
|
+
end
|
411
|
+
|
412
|
+
# Adds optional protected values to a string. Must be used with generate_url.
|
413
|
+
def add_string_protected_status(string)
|
414
|
+
string.concat(@PARAM_HASH['AMOUNT']) if @PARAM_HASH['PROTECT_AMOUNT'] == 'Yes'
|
415
|
+
string.concat([@PARAM_HASH['REBILLING'], @PARAM_HASH['REB_CYCLES'], @PARAM_HASH['REB_AMOUNT'], @PARAM_HASH['REB_EXPR'], @PARAM_HASH['REB_FIRST_DATE']].join('')) if @PARAM_HASH['REB_PROTECT'] == 'Yes'
|
416
|
+
string.concat(@PARAM_HASH['CUSTOM_ID']) if @PARAM_HASH['PROTECT_CUSTOM_ID'] == 'Yes'
|
417
|
+
string.concat(@PARAM_HASH['CUSTOM_ID2']) if @PARAM_HASH['PROTECT_CUSTOM_ID2'] == 'Yes'
|
418
|
+
return string
|
419
|
+
end
|
420
|
+
|
421
|
+
# Encodes a string into a URL. Must be used with generate_url.
|
422
|
+
def url_encode(string)
|
423
|
+
encoded_string = ''
|
424
|
+
string.each_char do |char|
|
425
|
+
char = ("%%%02X" % char.ord) if char.match(/[A-Za-z0-9]/) == nil
|
426
|
+
encoded_string << char
|
427
|
+
end
|
428
|
+
return encoded_string
|
429
|
+
end
|
430
|
+
|
431
|
+
# Generates a Tamperproof Seal for a url. Must be used with generate_url.
|
432
|
+
def calc_url_tps(tps_type)
|
433
|
+
Digest::MD5.hexdigest(tps_type)
|
434
|
+
end
|
435
|
+
|
436
|
+
# Generates the final url for the Simple Hosted Payment Form. Must be used with generate_url.
|
437
|
+
def calc_url_response
|
438
|
+
'https://secure.bluepay.com/interfaces/shpf?' +
|
439
|
+
'SHPF_FORM_ID=' .concat(url_encode (@PARAM_HASH['SHPF_FORM_ID']) ) +
|
440
|
+
'&SHPF_ACCOUNT_ID=' .concat(url_encode (@ACCOUNT_ID) ) +
|
441
|
+
'&SHPF_TPS_DEF=' .concat(url_encode (@shpf_tps_def) ) +
|
442
|
+
'&SHPF_TPS=' .concat(url_encode (@shpf_tamper_proof_seal) ) +
|
443
|
+
'&MODE=' .concat(url_encode (@PARAM_HASH['MODE']) ) +
|
444
|
+
'&TRANSACTION_TYPE=' .concat(url_encode (@PARAM_HASH['TRANSACTION_TYPE']) ) +
|
445
|
+
'&DBA=' .concat(url_encode (@PARAM_HASH['DBA']) ) +
|
446
|
+
'&AMOUNT=' .concat(url_encode (@PARAM_HASH['AMOUNT']) ) +
|
447
|
+
'&TAMPER_PROOF_SEAL=' .concat(url_encode (@bp10emu_tamper_proof_seal) ) +
|
448
|
+
'&CUSTOM_ID=' .concat(url_encode (@PARAM_HASH['CUSTOM_ID']) ) +
|
449
|
+
'&CUSTOM_ID2=' .concat(url_encode (@PARAM_HASH['CUSTOM_ID2']) ) +
|
450
|
+
'&REBILLING=' .concat(url_encode (@PARAM_HASH['REBILLING']) ) +
|
451
|
+
'&REB_CYCLES=' .concat(url_encode (@PARAM_HASH['REB_CYCLES']) ) +
|
452
|
+
'&REB_AMOUNT=' .concat(url_encode (@PARAM_HASH['REB_AMOUNT']) ) +
|
453
|
+
'&REB_EXPR=' .concat(url_encode (@PARAM_HASH['REB_EXPR']) ) +
|
454
|
+
'&REB_FIRST_DATE=' .concat(url_encode (@PARAM_HASH['REB_FIRST_DATE']) ) +
|
455
|
+
'&AMEX_IMAGE=' .concat(url_encode (@PARAM_HASH['AMEX_IMAGE']) ) +
|
456
|
+
'&DISCOVER_IMAGE=' .concat(url_encode (@PARAM_HASH['DISCOVER_IMAGE']) ) +
|
457
|
+
'&REDIRECT_URL=' .concat(url_encode (@receipt_url) ) +
|
458
|
+
'&TPS_DEF=' .concat(url_encode (@bp10emu_tps_def) ) +
|
459
|
+
'&CARD_TYPES=' .concat(url_encode (@card_types) )
|
460
|
+
end
|
250
461
|
end
|
@@ -9,26 +9,26 @@
|
|
9
9
|
|
10
10
|
require_relative "../../lib/bluepay.rb"
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
ACCOUNT_ID = "Merchant's Account ID Here"
|
13
|
+
SECRET_KEY = "Merchant's Secret Key Here"
|
14
|
+
MODE = "TEST"
|
15
15
|
|
16
16
|
report = BluePay.new(
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
account_id: ACCOUNT_ID,
|
18
|
+
secret_key: SECRET_KEY,
|
19
|
+
mode: MODE
|
20
20
|
)
|
21
21
|
|
22
22
|
report.get_settled_transaction_report(
|
23
|
-
report_start_date: '2015-01-01', #YYYY-MM-DD
|
24
|
-
report_end_date: '2015-04-30', #YYYY-MM-DD
|
23
|
+
report_start_date: '2015-01-01', # YYYY-MM-DD
|
24
|
+
report_end_date: '2015-04-30', # YYYY-MM-DD
|
25
25
|
query_by_hierarchy: '1', # Also search subaccounts? Yes
|
26
26
|
do_not_escape: '1', # Output response without commas? Yes
|
27
27
|
exclude_errors: '1' # Do not include errored transactions? Yes
|
28
28
|
)
|
29
29
|
|
30
30
|
# Makes the API request with BluePay
|
31
|
-
|
31
|
+
report.process
|
32
32
|
|
33
33
|
# Reads the response from BluePay
|
34
|
-
puts
|
34
|
+
puts report.get_response
|
@@ -8,18 +8,18 @@
|
|
8
8
|
|
9
9
|
require_relative "../../lib/bluepay.rb"
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
ACCOUNT_ID = "Merchant's Account ID Here"
|
12
|
+
SECRET_KEY = "Merchant's Secret Key Here"
|
13
|
+
MODE = "TEST"
|
14
14
|
|
15
15
|
report = BluePay.new(
|
16
|
-
account_id:
|
17
|
-
secret_key:
|
18
|
-
mode:
|
16
|
+
account_id: ACCOUNT_ID,
|
17
|
+
secret_key: SECRET_KEY,
|
18
|
+
mode: MODE
|
19
19
|
)
|
20
20
|
|
21
21
|
report.get_transaction_report(
|
22
|
-
report_start_date: '2015-
|
22
|
+
report_start_date: '2015-01-01', #YYYY-MM-DD
|
23
23
|
report_end_date: '2015-04-30', #YYYY-MM-DD
|
24
24
|
query_by_hierarchy: '1', # Also search subaccounts? Yes
|
25
25
|
do_not_escape: '1', # Output response without commas? Yes
|
@@ -27,7 +27,7 @@ report.get_transaction_report(
|
|
27
27
|
)
|
28
28
|
|
29
29
|
# Makes the API request with BluePay
|
30
|
-
|
30
|
+
report.process
|
31
31
|
|
32
32
|
# Reads the response from BluePay
|
33
|
-
puts
|
33
|
+
puts report.get_response
|
@@ -9,25 +9,26 @@
|
|
9
9
|
|
10
10
|
require_relative "../../lib/bluepay.rb"
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
ACCOUNT_ID = "Merchant's Account ID Here"
|
13
|
+
SECRET_KEY = "Merchant's Secret Key Here"
|
14
|
+
MODE = "TEST"
|
15
15
|
|
16
16
|
query = BluePay.new(
|
17
|
-
account_id:
|
18
|
-
secret_key:
|
19
|
-
mode:
|
17
|
+
account_id: ACCOUNT_ID,
|
18
|
+
secret_key: SECRET_KEY,
|
19
|
+
mode: MODE
|
20
20
|
)
|
21
21
|
|
22
22
|
query.get_single_transaction_query(
|
23
|
-
transaction_id: "
|
24
|
-
report_start_date: '
|
25
|
-
report_end_date: '2015-
|
23
|
+
transaction_id: "Transaction ID here", # required
|
24
|
+
report_start_date: '2013-01-01', # YYYY-MM-DD; required
|
25
|
+
report_end_date: '2015-05-30', # YYYY-MM-DD; required
|
26
26
|
exclude_errors: '1' # Do not include errored transactions? Yes; optional
|
27
27
|
)
|
28
28
|
|
29
29
|
# Makes the API request with BluePay
|
30
30
|
response = query.process
|
31
|
+
|
31
32
|
if query.get_id
|
32
33
|
# Reads the response from BluePay
|
33
34
|
puts 'Transaction ID: ' + query.get_id
|
@@ -12,7 +12,7 @@ require "cgi"
|
|
12
12
|
|
13
13
|
vars = CGI.new
|
14
14
|
|
15
|
-
secret_key = "
|
15
|
+
secret_key = ""
|
16
16
|
|
17
17
|
# Assign values
|
18
18
|
trans_id = vars["trans_id"]
|
@@ -58,4 +58,4 @@ if bp_stamp == vars["bp_stamp"]
|
|
58
58
|
puts 'Rebill Status: ' + rebill_status
|
59
59
|
else
|
60
60
|
puts 'ERROR IN RECEIVING DATA FROM BLUEPAY'
|
61
|
-
end
|
61
|
+
end
|
@@ -12,7 +12,7 @@ require_relative "../../lib/bluepay.rb"
|
|
12
12
|
|
13
13
|
ACCOUNT_ID = "Merchant's Account ID Here"
|
14
14
|
SECRET_KEY = "Merchant's Secret Key Here"
|
15
|
-
MODE = "TEST"
|
15
|
+
MODE = "TEST"
|
16
16
|
|
17
17
|
rebill = BluePay.new(
|
18
18
|
account_id: ACCOUNT_ID,
|
@@ -20,7 +20,6 @@ rebill = BluePay.new(
|
|
20
20
|
mode: MODE
|
21
21
|
)
|
22
22
|
|
23
|
-
# Set Customer Information
|
24
23
|
rebill.set_customer_information(
|
25
24
|
first_name: "Bob",
|
26
25
|
last_name: "Tester",
|
@@ -34,7 +33,6 @@ rebill.set_customer_information(
|
|
34
33
|
email: "test@bluepay.com"
|
35
34
|
)
|
36
35
|
|
37
|
-
# Set Credit Card Information
|
38
36
|
rebill.set_cc_information(
|
39
37
|
cc_number: "4111111111111111", # Customer Credit Card Number
|
40
38
|
cc_expiration: "1215", # Card Expiration Date: MMYY
|
@@ -48,13 +46,14 @@ rebill.set_recurring_payment(
|
|
48
46
|
reb_amount: "15.00" # Rebill Amount: $15.00
|
49
47
|
)
|
50
48
|
|
49
|
+
# Sets a Card Authorization at $0.00
|
51
50
|
rebill.auth(amount: "0.00")
|
52
51
|
|
53
52
|
# Makes the API Request to create a rebill
|
54
53
|
rebill.process
|
55
54
|
|
56
55
|
# If transaction was approved..
|
57
|
-
if rebill.
|
56
|
+
if rebill.successful_transaction?
|
58
57
|
|
59
58
|
rebill_cancel = BluePay.new(
|
60
59
|
account_id: ACCOUNT_ID,
|
@@ -2,17 +2,18 @@
|
|
2
2
|
# BluePay Ruby Sample code.
|
3
3
|
#
|
4
4
|
# This code sample creates a recurring payment charging $15.00 per month for one year.
|
5
|
+
##
|
5
6
|
|
6
7
|
require_relative "../../lib/bluepay.rb"
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
9
|
+
ACCOUNT_ID = "Merchant's Account ID Here"
|
10
|
+
SECRET_KEY = "Merchant's Secret Key Here"
|
11
|
+
MODE = "TEST"
|
11
12
|
|
12
13
|
rebill = BluePay.new(
|
13
|
-
account_id:
|
14
|
-
secret_key:
|
15
|
-
mode:
|
14
|
+
account_id: ACCOUNT_ID ,
|
15
|
+
secret_key: SECRET_KEY,
|
16
|
+
mode: MODE
|
16
17
|
)
|
17
18
|
|
18
19
|
rebill.set_customer_information(
|
@@ -47,12 +48,12 @@ rebill.auth(amount: "0.00")
|
|
47
48
|
# Makes the API Request with BluePay
|
48
49
|
rebill.process
|
49
50
|
|
50
|
-
#
|
51
|
-
if rebill.
|
52
|
-
# Reads the response from BluePay
|
51
|
+
# If transaction was successful reads the responses from BluePay
|
52
|
+
if rebill.successful_transaction?
|
53
53
|
puts "TRANSACTION ID: " + rebill.get_trans_id
|
54
54
|
puts "REBILL ID: " + rebill.get_rebill_id
|
55
55
|
puts "TRANSACTION STATUS: " + rebill.get_status
|
56
|
+
puts "TRANSACTION MESSAGE: " + rebill.get_message
|
56
57
|
puts "MASKED PAYMENT ACCOUNT: " + rebill.get_masked_account
|
57
58
|
puts "CUSTOMER BANK NAME: " + rebill.get_bank_name
|
58
59
|
else
|
@@ -2,17 +2,18 @@
|
|
2
2
|
# BluePay Ruby Sample code.
|
3
3
|
#
|
4
4
|
# This code sample creates a recurring payment charging $15.00 per month for one year.
|
5
|
+
##
|
5
6
|
|
6
7
|
require_relative "../../lib/bluepay.rb"
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
9
|
+
ACCOUNT_ID = "Merchant's Account ID Here"
|
10
|
+
SECRET_KEY = "Merchant's Secret Key Here"
|
11
|
+
MODE = "TEST"
|
11
12
|
|
12
13
|
rebill = BluePay.new(
|
13
|
-
account_id:
|
14
|
-
secret_key:
|
15
|
-
mode:
|
14
|
+
account_id: ACCOUNT_ID ,
|
15
|
+
secret_key: SECRET_KEY,
|
16
|
+
mode: MODE
|
16
17
|
)
|
17
18
|
|
18
19
|
rebill.set_customer_information(
|
@@ -41,17 +42,18 @@ rebill.set_recurring_payment(
|
|
41
42
|
reb_amount: "15.00" # Rebill Amount: $15.00
|
42
43
|
)
|
43
44
|
|
45
|
+
# Sets a Card Authorization at $0.00
|
44
46
|
rebill.auth(amount: "0.00")
|
45
47
|
|
46
48
|
# Makes the API Request
|
47
49
|
rebill.process
|
48
50
|
|
49
|
-
#
|
50
|
-
if rebill.
|
51
|
-
# Reads the response from BluePay
|
51
|
+
# If transaction was successful reads the responses from BluePay
|
52
|
+
if rebill.successful_transaction?
|
52
53
|
puts "TRANSACTION ID: " + rebill.get_trans_id
|
53
54
|
puts "REBILL ID: " + rebill.get_rebill_id
|
54
55
|
puts "TRANSACTION STATUS: " + rebill.get_status
|
56
|
+
puts "TRANSACTION MESSAGE: " + rebill.get_message
|
55
57
|
puts "AVS RESPONSE: " + rebill.get_avs_code
|
56
58
|
puts "CVV2 RESPONSE: " + rebill.get_cvv2_code
|
57
59
|
puts "MASKED PAYMENT ACCOUNT: " + rebill.get_masked_account
|
@@ -11,14 +11,14 @@
|
|
11
11
|
|
12
12
|
require_relative "../../lib/bluepay.rb"
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
ACCOUNT_ID = "Merchant's Account ID Here"
|
15
|
+
SECRET_KEY = "Merchant's Secret Key Here"
|
16
|
+
MODE = "TEST"
|
17
17
|
|
18
18
|
rebill = BluePay.new(
|
19
|
-
account_id:
|
20
|
-
secret_key:
|
21
|
-
mode:
|
19
|
+
account_id: ACCOUNT_ID,
|
20
|
+
secret_key: SECRET_KEY,
|
21
|
+
mode: MODE
|
22
22
|
)
|
23
23
|
|
24
24
|
rebill.set_customer_information(
|
@@ -47,13 +47,14 @@ rebill.set_recurring_payment(
|
|
47
47
|
reb_amount: "15.00" # Rebill Amount: $15.00
|
48
48
|
)
|
49
49
|
|
50
|
+
# Sets a Card Authorization at $0.00
|
50
51
|
rebill.auth(amount: "0.00")
|
51
52
|
|
52
53
|
# Makes the API Request to create a recurring payment
|
53
54
|
rebill.process
|
54
55
|
|
55
56
|
# If transaction was successful..
|
56
|
-
if rebill.
|
57
|
+
if rebill.successful_transaction?
|
57
58
|
|
58
59
|
rebill_status = BluePay.new(
|
59
60
|
account_id: ACCOUNT_ID,
|
@@ -79,4 +80,4 @@ if rebill.successful_response?
|
|
79
80
|
puts "REBILL NEXT AMOUNT: " + rebill_status.get_next_amount
|
80
81
|
else
|
81
82
|
puts rebill.get_message
|
82
|
-
end
|
83
|
+
end
|
@@ -11,14 +11,14 @@
|
|
11
11
|
|
12
12
|
require_relative "../../lib/bluepay.rb"
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
ACCOUNT_ID = "Merchant's Account ID Here"
|
15
|
+
SECRET_KEY = "Merchant's Secret Key Here"
|
16
|
+
MODE = "TEST"
|
17
17
|
|
18
18
|
rebill = BluePay.new(
|
19
|
-
account_id:
|
20
|
-
secret_key:
|
21
|
-
mode:
|
19
|
+
account_id: ACCOUNT_ID,
|
20
|
+
secret_key: SECRET_KEY,
|
21
|
+
mode: MODE
|
22
22
|
)
|
23
23
|
|
24
24
|
rebill.set_customer_information(
|
@@ -47,13 +47,14 @@ rebill.set_recurring_payment(
|
|
47
47
|
reb_amount: "3.50" # Rebill Amount: $3.50
|
48
48
|
)
|
49
49
|
|
50
|
+
# Sets a Card Authorization at $0.00
|
50
51
|
rebill.auth(amount: "0.00")
|
51
52
|
|
52
53
|
# Makes the API Request to create a rebill
|
53
54
|
rebill.process
|
54
55
|
|
55
56
|
# If transaction was approved..
|
56
|
-
if rebill.
|
57
|
+
if rebill.successful_transaction?
|
57
58
|
|
58
59
|
payment_information_update = BluePay.new(
|
59
60
|
account_id: ACCOUNT_ID,
|
@@ -108,4 +109,4 @@ if rebill.successful_response?
|
|
108
109
|
puts "REBILL NEXT AMOUNT: " + rebill_update.get_next_amount
|
109
110
|
else
|
110
111
|
puts rebill.get_message
|
111
|
-
end
|
112
|
+
end
|
@@ -9,14 +9,14 @@
|
|
9
9
|
|
10
10
|
require_relative "../../lib/bluepay.rb"
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
ACCOUNT_ID = "Merchant's Account ID Here"
|
13
|
+
SECRET_KEY = "Merchant's Secret Key Here"
|
14
|
+
MODE = "TEST"
|
15
15
|
|
16
16
|
payment = BluePay.new(
|
17
|
-
account_id:
|
18
|
-
secret_key:
|
19
|
-
mode:
|
17
|
+
account_id: ACCOUNT_ID,
|
18
|
+
secret_key: SECRET_KEY,
|
19
|
+
mode: MODE
|
20
20
|
)
|
21
21
|
|
22
22
|
payment.set_customer_information(
|
@@ -43,9 +43,8 @@ payment.sale(amount: "3.00") # Sale Amount: $3.00
|
|
43
43
|
# Makes the API Request with BluePay
|
44
44
|
payment.process
|
45
45
|
|
46
|
-
# If transaction was successful
|
47
|
-
if payment.
|
48
|
-
# Reads the response from BluePay
|
46
|
+
# If transaction was successful reads the responses from BluePay
|
47
|
+
if payment.successful_transaction?
|
49
48
|
puts "TRANSACTION STATUS: " + payment.get_status
|
50
49
|
puts "TRANSACTION MESSAGE: " + payment.get_message
|
51
50
|
puts "TRANSACTION ID: " + payment.get_trans_id
|
@@ -10,14 +10,14 @@
|
|
10
10
|
|
11
11
|
require_relative "../../lib/bluepay.rb"
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ACCOUNT_ID = "Merchant's Account ID Here"
|
14
|
+
SECRET_KEY = "Merchant's Secret Key Here"
|
15
|
+
MODE = "TEST"
|
16
16
|
|
17
17
|
payment = BluePay.new(
|
18
|
-
account_id:
|
19
|
-
secret_key:
|
20
|
-
mode:
|
18
|
+
account_id: ACCOUNT_ID,
|
19
|
+
secret_key: SECRET_KEY,
|
20
|
+
mode: MODE
|
21
21
|
)
|
22
22
|
|
23
23
|
payment.set_customer_information(
|
@@ -46,12 +46,12 @@ payment.sale(amount: "3.00") # Sale Amount: $3.00
|
|
46
46
|
payment.process
|
47
47
|
|
48
48
|
# If transaction was approved..
|
49
|
-
if payment.
|
49
|
+
if payment.successful_transaction?
|
50
50
|
|
51
51
|
payment_void = BluePay.new(
|
52
|
-
account_id:
|
53
|
-
secret_key:
|
54
|
-
mode:
|
52
|
+
account_id: ACCOUNT_ID,
|
53
|
+
secret_key: SECRET_KEY,
|
54
|
+
mode: MODE
|
55
55
|
)
|
56
56
|
|
57
57
|
# Finds the previous payment by ID and attempts to void it
|
@@ -7,14 +7,14 @@
|
|
7
7
|
|
8
8
|
require_relative "../../lib/bluepay.rb"
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
ACCOUNT_ID = "Merchant's Account ID Here"
|
11
|
+
SECRET_KEY = "Merchant's Secret Key Here"
|
12
|
+
MODE = "TEST"
|
13
13
|
|
14
14
|
payment = BluePay.new(
|
15
|
-
account_id:
|
16
|
-
secret_key:
|
17
|
-
mode:
|
15
|
+
account_id: ACCOUNT_ID ,
|
16
|
+
secret_key: SECRET_KEY,
|
17
|
+
mode: MODE
|
18
18
|
)
|
19
19
|
|
20
20
|
payment.set_customer_information(
|
@@ -42,13 +42,13 @@ payment.sale(amount: "3.00") # Sale Amount: $3.00
|
|
42
42
|
# Makes the API Request with BluePay
|
43
43
|
payment.process
|
44
44
|
|
45
|
-
#
|
46
|
-
if payment.
|
45
|
+
# If transaction was successful reads the responses from BluePay
|
46
|
+
if payment.successful_transaction?
|
47
47
|
puts "TRANSACTION ID: " + payment.get_trans_id
|
48
48
|
puts "TRANSACTION STATUS: " + payment.get_status
|
49
49
|
puts "TRANSACTION MESSAGE: " + payment.get_message
|
50
50
|
puts "MASKED PAYMENT ACCOUNT: " + payment.get_masked_account
|
51
|
-
puts "
|
51
|
+
puts "BANK NAME: " + payment.get_bank_name
|
52
52
|
else
|
53
53
|
puts payment.get_message
|
54
54
|
end
|
@@ -8,14 +8,14 @@
|
|
8
8
|
|
9
9
|
require_relative "../../lib/bluepay.rb"
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
ACCOUNT_ID = "Merchant's Account ID Here"
|
12
|
+
SECRET_KEY = "Merchant's Secret Key Here"
|
13
|
+
MODE = "TEST"
|
14
14
|
|
15
15
|
payment = BluePay.new(
|
16
|
-
account_id:
|
17
|
-
secret_key:
|
18
|
-
mode:
|
16
|
+
account_id: ACCOUNT_ID,
|
17
|
+
secret_key: SECRET_KEY,
|
18
|
+
mode: MODE
|
19
19
|
)
|
20
20
|
|
21
21
|
payment.set_customer_information(
|
@@ -42,9 +42,8 @@ payment.auth(amount: "3.00") # Card authorization amount: $3.00
|
|
42
42
|
# Makes the API Request for a credit card authorization
|
43
43
|
payment.process
|
44
44
|
|
45
|
-
# If transaction was
|
46
|
-
if payment.
|
47
|
-
# Reads the response from BluePay
|
45
|
+
# If transaction was successful reads the responses from BluePay
|
46
|
+
if payment.successful_transaction?
|
48
47
|
puts "TRANSACTION STATUS: " + payment.get_status
|
49
48
|
puts "TRANSACTION MESSAGE: " + payment.get_message
|
50
49
|
puts "TRANSACTION ID: " + payment.get_trans_id
|
@@ -10,14 +10,14 @@
|
|
10
10
|
|
11
11
|
require_relative "../../lib/bluepay.rb"
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ACCOUNT_ID = "Merchant's Account ID Here"
|
14
|
+
SECRET_KEY = "Merchant's Secret Key Here"
|
15
|
+
MODE = "TEST"
|
16
16
|
|
17
17
|
payment = BluePay.new(
|
18
|
-
account_id:
|
19
|
-
secret_key:
|
20
|
-
mode:
|
18
|
+
account_id: ACCOUNT_ID,
|
19
|
+
secret_key: SECRET_KEY,
|
20
|
+
mode: MODE
|
21
21
|
)
|
22
22
|
|
23
23
|
payment.set_customer_information(
|
@@ -44,9 +44,9 @@ payment.custom_id1 = "12345" # Custom ID1: 12345
|
|
44
44
|
payment.custom_id2 = "09866" # Custom ID2: 09866
|
45
45
|
payment.invoice_id = "500000" # Invoice ID: 50000
|
46
46
|
payment.order_id = "10023145" # Order ID: 10023145
|
47
|
-
payment.
|
48
|
-
payment.amount_tax = "
|
49
|
-
payment.
|
47
|
+
payment.amount_food = "15.00" # Food Amount: $3.11
|
48
|
+
payment.amount_tax = "2.50" # Tax Amount: $3.50
|
49
|
+
payment.amount_tip = "2.50" # Tip Amount: $6.00
|
50
50
|
payment.amount_misc = "5.00" # Miscellaneous Amount: $5.00
|
51
51
|
payment.memo = "Enter any comments about the transaction here." # Comments
|
52
52
|
|
@@ -55,9 +55,8 @@ payment.sale(amount: "25.00") # Sale Amount: $25.00
|
|
55
55
|
# Makes the API request with BluePay
|
56
56
|
payment.process
|
57
57
|
|
58
|
-
# If transaction was
|
59
|
-
if payment.
|
60
|
-
# Reads the response from BluePay
|
58
|
+
# If transaction was successful reads the responses from BluePay
|
59
|
+
if payment.successful_transaction?
|
61
60
|
puts "TRANSACTION STATUS: " + payment.get_status
|
62
61
|
puts "TRANSACTION MESSAGE: " + payment.get_message
|
63
62
|
puts "TRANSACTION ID: " + payment.get_trans_id
|
@@ -8,27 +8,27 @@
|
|
8
8
|
|
9
9
|
require_relative "../../lib/bluepay.rb"
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
11
|
+
ACCOUNT_ID = "Merchant's Account ID Here"
|
12
|
+
SECRET_KEY = "Merchant's Secret Key Here"
|
13
|
+
MODE = "TEST"
|
14
|
+
TOKEN = "Transaction ID here"
|
15
15
|
|
16
16
|
payment = BluePay.new(
|
17
|
-
account_id:
|
18
|
-
secret_key:
|
19
|
-
mode:
|
17
|
+
account_id: ACCOUNT_ID,
|
18
|
+
secret_key: SECRET_KEY,
|
19
|
+
mode: MODE
|
20
20
|
)
|
21
21
|
|
22
22
|
payment.sale(
|
23
23
|
amount: "3.00",
|
24
|
-
trans_id:
|
24
|
+
trans_id: TOKEN
|
25
25
|
)
|
26
26
|
|
27
27
|
# Makes the API Request
|
28
28
|
payment.process
|
29
29
|
|
30
|
-
|
31
|
-
|
30
|
+
# If transaction was successful reads the responses from BluePay
|
31
|
+
if payment.successful_transaction?
|
32
32
|
puts "TRANSACTION STATUS: " + payment.get_status
|
33
33
|
puts "TRANSACTION MESSAGE: " + payment.get_message
|
34
34
|
puts "TRANSACTION ID: " + payment.get_trans_id
|
@@ -11,14 +11,14 @@
|
|
11
11
|
|
12
12
|
require_relative "../../lib/bluepay.rb"
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
ACCOUNT_ID = "Merchant's Account ID"
|
15
|
+
SECRET_KEY = "Merchant's Secret Key"
|
16
|
+
MODE = "TEST"
|
17
17
|
|
18
18
|
payment = BluePay.new(
|
19
|
-
account_id:
|
20
|
-
secret_key:
|
21
|
-
mode:
|
19
|
+
account_id: ACCOUNT_ID,
|
20
|
+
secret_key: SECRET_KEY,
|
21
|
+
mode: MODE
|
22
22
|
)
|
23
23
|
|
24
24
|
payment.set_customer_information(
|
@@ -36,7 +36,7 @@ payment.set_customer_information(
|
|
36
36
|
|
37
37
|
payment.set_cc_information(
|
38
38
|
cc_number: "4111111111111111", # Customer Credit Card Number
|
39
|
-
cc_expiration: "
|
39
|
+
cc_expiration: "1215", # Card Expiration Date: MMYY
|
40
40
|
cvv2: "123" # Card CVV2
|
41
41
|
)
|
42
42
|
|
@@ -46,12 +46,12 @@ payment.sale(amount: "3.00") # Sale Amount: $3.00
|
|
46
46
|
payment.process
|
47
47
|
|
48
48
|
# If transaction was approved..
|
49
|
-
if payment.
|
49
|
+
if payment.successful_transaction?
|
50
50
|
|
51
51
|
payment_return = BluePay.new(
|
52
|
-
account_id:
|
53
|
-
secret_key:
|
54
|
-
mode:
|
52
|
+
account_id: ACCOUNT_ID,
|
53
|
+
secret_key: SECRET_KEY,
|
54
|
+
mode: MODE
|
55
55
|
)
|
56
56
|
|
57
57
|
# Creates a refund transaction against previous sale
|
@@ -73,5 +73,5 @@ if payment.successful_response?
|
|
73
73
|
puts "CARD TYPE: " + payment_return.get_card_type
|
74
74
|
puts "AUTH CODE: " + payment_return.get_auth_code
|
75
75
|
else
|
76
|
-
puts
|
76
|
+
puts payment_return.get_message
|
77
77
|
end
|
@@ -8,14 +8,14 @@
|
|
8
8
|
|
9
9
|
require_relative "../../lib/bluepay.rb"
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
ACCOUNT_ID = "Merchant's Account ID Here"
|
12
|
+
SECRET_KEY = "Merchant's Secret Key Here"
|
13
|
+
MODE = "TEST"
|
14
14
|
|
15
15
|
payment = BluePay.new(
|
16
|
-
account_id:
|
17
|
-
secret_key:
|
18
|
-
mode:
|
16
|
+
account_id: ACCOUNT_ID,
|
17
|
+
secret_key: SECRET_KEY,
|
18
|
+
mode: MODE
|
19
19
|
)
|
20
20
|
|
21
21
|
payment.set_customer_information(
|
@@ -42,9 +42,8 @@ payment.auth(amount: "0.00") # Card Authorization amount: $0.00
|
|
42
42
|
# Makes the API request with BluePay
|
43
43
|
payment.process
|
44
44
|
|
45
|
-
# If transaction was successful
|
46
|
-
if payment.
|
47
|
-
# Reads the response from BluePay
|
45
|
+
# If transaction was successful reads the responses from BluePay
|
46
|
+
if payment.successful_transaction?
|
48
47
|
puts "TRANSACTION STATUS: " + payment.get_status
|
49
48
|
puts "TRANSACTION MESSAGE: " + payment.get_message
|
50
49
|
puts "TRANSACTION ID: " + payment.get_trans_id
|
@@ -0,0 +1,52 @@
|
|
1
|
+
##
|
2
|
+
# BluePay Ruby Sample code.
|
3
|
+
#
|
4
|
+
# This code sample runs a $3.00 sales transaction using the payment information obtained from a credit card swipe.
|
5
|
+
# If using TEST mode, odd dollar amounts will return an approval and even dollar amounts will return a decline.
|
6
|
+
|
7
|
+
require_relative "../../lib/bluepay.rb"
|
8
|
+
|
9
|
+
ACCOUNT_ID = "Merchant's Account ID Here"
|
10
|
+
SECRET_KEY = "Merchant's Secret Key Here"
|
11
|
+
MODE = "TEST"
|
12
|
+
|
13
|
+
payment = BluePay.new(
|
14
|
+
account_id: ACCOUNT_ID,
|
15
|
+
secret_key: SECRET_KEY,
|
16
|
+
mode: MODE
|
17
|
+
)
|
18
|
+
|
19
|
+
payment.set_customer_information(
|
20
|
+
first_name: "Bob",
|
21
|
+
last_name: "Tester",
|
22
|
+
address1: "123 Test St.",
|
23
|
+
address2: "Apt #500",
|
24
|
+
city: "Testville",
|
25
|
+
state: "IL",
|
26
|
+
zip_code: "54321",
|
27
|
+
country: "USA",
|
28
|
+
phone: "123-123-1234",
|
29
|
+
email: "test@bluepay.com"
|
30
|
+
)
|
31
|
+
|
32
|
+
# Set payment information for a swiped credit card transaction
|
33
|
+
payment.swipe("%B4111111111111111^TEST/BLUEPAY^1911101100001100000000667000000?;4111111111111111=191110110000667?")
|
34
|
+
|
35
|
+
payment.sale(amount: "3.00") # Sale Amount: $3.00
|
36
|
+
|
37
|
+
# Makes the API Request with BluePay
|
38
|
+
payment.process
|
39
|
+
|
40
|
+
# If transaction was successful reads the responses from BluePay
|
41
|
+
if payment.successful_transaction?
|
42
|
+
puts "TRANSACTION STATUS: " + payment.get_status
|
43
|
+
puts "TRANSACTION MESSAGE: " + payment.get_message
|
44
|
+
puts "TRANSACTION ID: " + payment.get_trans_id
|
45
|
+
puts "AVS RESPONSE: " + payment.get_avs_code
|
46
|
+
puts "CVV2 RESPONSE: " + payment.get_cvv2_code
|
47
|
+
puts "MASKED PAYMENT ACCOUNT: " + payment.get_masked_account
|
48
|
+
puts "CARD TYPE: " + payment.get_card_type
|
49
|
+
puts "AUTH CODE: " + payment.get_auth_code
|
50
|
+
else
|
51
|
+
puts payment.get_message
|
52
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bluepay
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
- Justin Slingerland
|
7
|
+
- Justin Slingerland, Susan Schmidt
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-03-17 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: This gem is intended to be used along with a BluePay gateway account
|
14
14
|
to process credit card and ACH transactions
|
@@ -33,14 +33,15 @@ files:
|
|
33
33
|
- test/Rebill/Create_Recurring_Payment_CC.rb
|
34
34
|
- test/Rebill/Get_Recurring_Payment_Status.rb
|
35
35
|
- test/Rebill/Update_Recurring_Payment.rb
|
36
|
+
- test/Transactions/CHarge_Customer_CC.rb
|
36
37
|
- test/Transactions/Cancel_Transaction.rb
|
37
38
|
- test/Transactions/Charge_Customer_ACH.rb
|
38
|
-
- test/Transactions/Charge_Customer_CC.rb
|
39
39
|
- test/Transactions/Check_Customer_Credit.rb
|
40
40
|
- test/Transactions/Customer_Defined_Data.rb
|
41
41
|
- test/Transactions/How_To_Use_Token.rb
|
42
42
|
- test/Transactions/Return_Funds.rb
|
43
43
|
- test/Transactions/Store_Payment_Information.rb
|
44
|
+
- test/Transactions/Swipe.rb
|
44
45
|
homepage: http://www.bluepay.com
|
45
46
|
licenses:
|
46
47
|
- GPL
|