bluepay 1.0.3 → 1.0.4

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.
Files changed (89) hide show
  1. checksums.yaml +7 -7
  2. data/Rakefile +1 -1
  3. data/bluepay.gemspec +3 -3
  4. data/lib/api_request.rb +125 -0
  5. data/lib/api_response.rb +150 -0
  6. data/lib/bluepay.rb +94 -332
  7. data/lib/cacert.pem +3860 -0
  8. data/test/Get_Data/Retrieve_Settlement_Data.rb +34 -0
  9. data/test/Get_Data/Retrieve_Transaction_Data.rb +33 -0
  10. data/test/Get_Data/Single_Transaction_Query.rb +42 -0
  11. data/test/Get_Data/Transaction_Notification.rb +61 -0
  12. data/test/Rebill/Cancel_Recurring_Payment.rb +82 -0
  13. data/test/Rebill/Create_Recurring_Payment_ACH.rb +60 -0
  14. data/test/Rebill/Create_Recurring_Payment_CC.rb +62 -0
  15. data/test/Rebill/Get_Recurring_Payment_Status.rb +82 -0
  16. data/test/Rebill/Update_Recurring_Payment.rb +111 -0
  17. data/test/Transactions/Cancel_Transaction.rb +74 -0
  18. data/test/Transactions/Charge_Customer_ACH.rb +54 -0
  19. data/test/Transactions/Charge_Customer_CC.rb +60 -0
  20. data/test/Transactions/Check_Customer_Credit.rb +58 -0
  21. data/test/Transactions/Customer_Defined_Data.rb +71 -0
  22. data/test/Transactions/How_To_Use_Token.rb +42 -0
  23. data/test/Transactions/Return_Funds.rb +77 -0
  24. data/test/Transactions/Store_Payment_Information.rb +58 -0
  25. metadata +42 -93
  26. data/doc/BluePay.html +0 -2699
  27. data/doc/README.html +0 -174
  28. data/doc/created.rid +0 -3
  29. data/doc/fonts.css +0 -167
  30. data/doc/fonts/Lato-Light.ttf +0 -0
  31. data/doc/fonts/Lato-LightItalic.ttf +0 -0
  32. data/doc/fonts/Lato-Regular.ttf +0 -0
  33. data/doc/fonts/Lato-RegularItalic.ttf +0 -0
  34. data/doc/fonts/SourceCodePro-Bold.ttf +0 -0
  35. data/doc/fonts/SourceCodePro-Regular.ttf +0 -0
  36. data/doc/images/add.png +0 -0
  37. data/doc/images/arrow_up.png +0 -0
  38. data/doc/images/brick.png +0 -0
  39. data/doc/images/brick_link.png +0 -0
  40. data/doc/images/bug.png +0 -0
  41. data/doc/images/bullet_black.png +0 -0
  42. data/doc/images/bullet_toggle_minus.png +0 -0
  43. data/doc/images/bullet_toggle_plus.png +0 -0
  44. data/doc/images/date.png +0 -0
  45. data/doc/images/delete.png +0 -0
  46. data/doc/images/find.png +0 -0
  47. data/doc/images/loadingAnimation.gif +0 -0
  48. data/doc/images/macFFBgHack.png +0 -0
  49. data/doc/images/package.png +0 -0
  50. data/doc/images/page_green.png +0 -0
  51. data/doc/images/page_white_text.png +0 -0
  52. data/doc/images/page_white_width.png +0 -0
  53. data/doc/images/plugin.png +0 -0
  54. data/doc/images/ruby.png +0 -0
  55. data/doc/images/tag_blue.png +0 -0
  56. data/doc/images/tag_green.png +0 -0
  57. data/doc/images/transparent.png +0 -0
  58. data/doc/images/wrench.png +0 -0
  59. data/doc/images/wrench_orange.png +0 -0
  60. data/doc/images/zoom.png +0 -0
  61. data/doc/index.html +0 -92
  62. data/doc/js/darkfish.js +0 -140
  63. data/doc/js/jquery.js +0 -18
  64. data/doc/js/navigation.js +0 -142
  65. data/doc/js/search.js +0 -109
  66. data/doc/js/search_index.js +0 -1
  67. data/doc/js/searcher.js +0 -228
  68. data/doc/rdoc.css +0 -580
  69. data/doc/table_of_contents.html +0 -405
  70. data/test/get_data/retrieve_settlement_data.rb +0 -39
  71. data/test/get_data/retrieve_transaction_data.rb +0 -37
  72. data/test/get_data/transaction_query.rb +0 -48
  73. data/test/getting_stuff_done/get_transaction_data.rb +0 -37
  74. data/test/getting_stuff_done/run_ach_payment.rb +0 -75
  75. data/test/getting_stuff_done/run_cc_payment.rb +0 -73
  76. data/test/getting_stuff_done/set_up_rebill_ach.rb +0 -85
  77. data/test/getting_stuff_done/set_up_rebill_cc.rb +0 -84
  78. data/test/rebills/cancel_rebill.rb +0 -96
  79. data/test/rebills/create_rebill.rb +0 -84
  80. data/test/rebills/get_rebill.rb +0 -97
  81. data/test/rebills/update_rebill.rb +0 -128
  82. data/test/transactions/cancel_transaction.rb +0 -85
  83. data/test/transactions/charge_customer.rb +0 -74
  84. data/test/transactions/check_customer_credit.rb +0 -74
  85. data/test/transactions/credit_customer.rb +0 -75
  86. data/test/transactions/customer_defined_data.rb +0 -99
  87. data/test/transactions/return_funds.rb +0 -86
  88. data/test/transactions/store_payment_information.rb +0 -74
  89. data/test/transactions/use_token.rb +0 -44
@@ -0,0 +1,34 @@
1
+ ##
2
+ # BluePay Ruby Sample code.
3
+ #
4
+ # This code sample runs a report that grabs data from the
5
+ # BluePay gateway based on certain criteria. This will ONLY return
6
+ # transactions that have already settled. See comments below
7
+ # on the details of the report.
8
+ # If using TEST mode, only TEST transactions will be returned.
9
+
10
+ require_relative "../../lib/bluepay.rb"
11
+
12
+ acct_id = "Merchant's Account ID Here"
13
+ sec_key = "Merchant's Secret Key Here"
14
+ trans_mode = "TEST" # Transaction Mode (can also be "LIVE")
15
+
16
+ report = BluePay.new(
17
+ account_id: acct_id,
18
+ secret_key: sec_key,
19
+ mode: trans_mode
20
+ )
21
+
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
25
+ query_by_hierarchy: '1', # Also search subaccounts? Yes
26
+ do_not_escape: '1', # Output response without commas? Yes
27
+ exclude_errors: '1' # Do not include errored transactions? Yes
28
+ )
29
+
30
+ # Makes the API request with BluePay
31
+ response = report.process
32
+
33
+ # Reads the response from BluePay
34
+ puts response
@@ -0,0 +1,33 @@
1
+ ##
2
+ # BluePay Ruby Sample code.
3
+ #
4
+ # This code sample runs a report that grabs data from the
5
+ # BluePay gateway based on certain criteria.
6
+ # If using TEST mode, only TEST transactions will be returned.
7
+ ##
8
+
9
+ require_relative "../../lib/bluepay.rb"
10
+
11
+ acct_id = "Merchant's Account ID Here"
12
+ sec_key = "Merchant's Secret Key Here"
13
+ trans_mode = "TEST" # Transaction Mode (can also be "LIVE")
14
+
15
+ report = BluePay.new(
16
+ account_id: acct_id,
17
+ secret_key: sec_key,
18
+ mode: trans_mode
19
+ )
20
+
21
+ report.get_transaction_report(
22
+ report_start_date: '2015-04-27', #YYYY-MM-DD
23
+ report_end_date: '2015-04-30', #YYYY-MM-DD
24
+ query_by_hierarchy: '1', # Also search subaccounts? Yes
25
+ do_not_escape: '1', # Output response without commas? Yes
26
+ exclude_errors: '1' # Do not include errored transactions? Yes
27
+ )
28
+
29
+ # Makes the API request with BluePay
30
+ response = report.process
31
+
32
+ # Reads the response from BluePay
33
+ puts response
@@ -0,0 +1,42 @@
1
+ ##
2
+ # BluePay Ruby Sample code.
3
+ #
4
+ # This code sample runs a report that grabs a single transaction
5
+ # from the BluePay gateway based on certain criteria.
6
+ # See comments below on the details of the report.
7
+ # If using TEST mode, only TEST transactions will be returned.
8
+ ##
9
+
10
+ require_relative "../../lib/bluepay.rb"
11
+
12
+ acct_id = "Merchant's Account ID Here"
13
+ sec_key = "Merchant's Secret Key Here"
14
+ trans_mode = "TEST" # Transaction Mode (can also be "LIVE")
15
+
16
+ query = BluePay.new(
17
+ account_id: acct_id,
18
+ secret_key: sec_key,
19
+ mode: trans_mode
20
+ )
21
+
22
+ query.get_single_transaction_query(
23
+ transaction_id: "100012341234", # required
24
+ report_start_date: '2015-12-01', #YYYY-MM-DD; required
25
+ report_end_date: '2015-12-30', #YYYY-MM-DD; required
26
+ exclude_errors: '1' # Do not include errored transactions? Yes; optional
27
+ )
28
+
29
+ # Makes the API request with BluePay
30
+ response = query.process
31
+ if query.get_id
32
+ # Reads the response from BluePay
33
+ puts 'Transaction ID: ' + query.get_id
34
+ puts 'First Name: ' + query.get_name1
35
+ puts 'Last Name: ' + query.get_name2
36
+ puts 'Payment Type: ' + query.get_payment_type
37
+ puts 'Transaction Type: ' + query.get_trans_type
38
+ puts 'Amount: ' + query.get_amount
39
+ else
40
+ puts response
41
+ end
42
+
@@ -0,0 +1,61 @@
1
+ ##
2
+ # BluePay Ruby Sample code.
3
+ #
4
+ # This code sample shows a very based approach
5
+ # on handling data that is posted to a script running
6
+ # a merchant's server after a transaction is processed
7
+ # through their BluePay gateway account.
8
+ ##
9
+
10
+ require_relative "../../lib/bluepay.rb"
11
+ require "cgi"
12
+
13
+ vars = CGI.new
14
+
15
+ secret_key = "MERCHANT'S SECRET KEY HERE"
16
+
17
+ # Assign values
18
+ trans_id = vars["trans_id"]
19
+ trans_status = vars["trans_status"]
20
+ trans_type = vars["trans_type"]
21
+ amount = vars["amount"]
22
+ batch_id = vars["batch_id"]
23
+ batch_status = vars["batch_status"]
24
+ total_count = vars["total_count"]
25
+ total_amount = vars["total_amount"]
26
+ batch_upload_id = vars["batch_upload_id"]
27
+ rebill_id = vars["rebill_id"]
28
+ rebill_amount = vars["reb_amount"]
29
+ rebill_status = vars["status"]
30
+
31
+ # Calculate expected bp_stamp
32
+ bp_stamp = BluePay.calc_trans_notify_tps(
33
+ secret_key,
34
+ trans_id,
35
+ trans_status,
36
+ trans_type,
37
+ amount,
38
+ batch_id,
39
+ batch_status,
40
+ total_count,
41
+ total_amount,
42
+ batch_upload_id,
43
+ rebill_id,
44
+ rebill_amount,
45
+ rebill_status
46
+ )
47
+
48
+ # check if expected bp_stamp = actual bp_stamp
49
+ if bp_stamp == vars["bp_stamp"]
50
+
51
+ # Reads the response from BluePay
52
+ puts 'Transaction ID: ' + trans_id
53
+ puts 'Transaction Status: ' + trans_status
54
+ puts 'Transaction Type: ' + trans_type
55
+ puts 'Transaction Amount: ' + amount
56
+ puts 'Rebill ID: ' + rebill_id
57
+ puts 'Rebill Amount: ' + rebill_amount
58
+ puts 'Rebill Status: ' + rebill_status
59
+ else
60
+ puts 'ERROR IN RECEIVING DATA FROM BLUEPAY'
61
+ end
@@ -0,0 +1,82 @@
1
+ ##
2
+ # BluePay Ruby Sample code.
3
+ #
4
+ # This code sample runs a $0.00 Credit Card Auth transaction
5
+ # against a customer using test payment information, sets up
6
+ # a rebilling cycle, and also shows how to cancel that rebilling cycle.
7
+ # See comments below on the details of the initial setup of the
8
+ # rebilling cycle.
9
+ ##
10
+
11
+ require_relative "../../lib/bluepay.rb"
12
+
13
+ ACCOUNT_ID = "Merchant's Account ID Here"
14
+ SECRET_KEY = "Merchant's Secret Key Here"
15
+ MODE = "TEST" # Transaction Mode (can also be "LIVE")
16
+
17
+ rebill = BluePay.new(
18
+ account_id: ACCOUNT_ID,
19
+ secret_key: SECRET_KEY,
20
+ mode: MODE
21
+ )
22
+
23
+ # Set Customer Information
24
+ rebill.set_customer_information(
25
+ first_name: "Bob",
26
+ last_name: "Tester",
27
+ address1: "123 Test St.",
28
+ address2: "Apt #500",
29
+ city: "Testville",
30
+ state: "IL",
31
+ zip_code: "54321",
32
+ country: "USA",
33
+ phone: "123-123-1234",
34
+ email: "test@bluepay.com"
35
+ )
36
+
37
+ # Set Credit Card Information
38
+ rebill.set_cc_information(
39
+ cc_number: "4111111111111111", # Customer Credit Card Number
40
+ cc_expiration: "1215", # Card Expiration Date: MMYY
41
+ cvv2: "123" # Card CVV2
42
+ )
43
+
44
+ rebill.set_recurring_payment(
45
+ reb_first_date: "2015-01-01", # Rebill Start Date: Jan. 1, 2015
46
+ reb_expr: "1 MONTH", # Rebill Frequency: 1 MONTH
47
+ reb_cycles: "12", # Rebill # of Cycles: 12
48
+ reb_amount: "15.00" # Rebill Amount: $15.00
49
+ )
50
+
51
+ rebill.auth(amount: "0.00")
52
+
53
+ # Makes the API Request to create a rebill
54
+ rebill.process
55
+
56
+ # If transaction was approved..
57
+ if rebill.successful_response?
58
+
59
+ rebill_cancel = BluePay.new(
60
+ account_id: ACCOUNT_ID,
61
+ secret_key: SECRET_KEY,
62
+ mode: MODE
63
+ )
64
+
65
+ # Find rebill by id and cancel rebilling cycle
66
+ rebill_cancel.cancel_rebilling_cycle(rebill.get_rebill_id)
67
+
68
+ # Makes the API request to cancel the rebill
69
+ rebill_cancel.process
70
+
71
+ # Reads the response from BluePay
72
+ puts "REBILL STATUS: " + rebill_cancel.get_rebill_status
73
+ puts "REBILL ID: " + rebill_cancel.get_reb_id
74
+ puts "REBILL CREATION DATE: " + rebill_cancel.get_creation_date
75
+ puts "REBILL NEXT DATE: " + rebill_cancel.get_next_date
76
+ puts "REBILL SCHEDULE EXPRESSION: " + rebill_cancel.get_sched_expression
77
+ puts "REBILL CYCLES REMAINING: " + rebill_cancel.get_cycles_remaining
78
+ puts "REBILL AMOUNT: " + rebill_cancel.get_rebill_amount
79
+ puts "REBILL NEXT AMOUNT: " + rebill_cancel.get_next_amount
80
+ else
81
+ puts rebill.get_message
82
+ end
@@ -0,0 +1,60 @@
1
+ ##
2
+ # BluePay Ruby Sample code.
3
+ #
4
+ # This code sample creates a recurring payment charging $15.00 per month for one year.
5
+
6
+ require_relative "../../lib/bluepay.rb"
7
+
8
+ acct_id = "Merchant's Account ID Here"
9
+ sec_key = "Merchant's Secret Key Here"
10
+ trans_mode = "TEST" # Transaction Mode (can also be "LIVE")
11
+
12
+ rebill = BluePay.new(
13
+ account_id: acct_id,
14
+ secret_key: sec_key,
15
+ mode: trans_mode
16
+ )
17
+
18
+ rebill.set_customer_information(
19
+ first_name: "Bob",
20
+ last_name: "Tester",
21
+ address1: "123 Test St.",
22
+ address2: "Apt #500",
23
+ city: "Testville",
24
+ state: "IL",
25
+ zip_code: "54321",
26
+ country: "USA",
27
+ phone: "123-123-1234",
28
+ email: "test@bluepay.com"
29
+ )
30
+
31
+ rebill.set_ach_information(
32
+ ach_routing: "123123123", # Routing Number: 123123123
33
+ ach_account: "123456789", # Account Number: 123456789
34
+ ach_account_type: 'C', # Account Type: Checking
35
+ doc_type: "WEB" # ACH Document Type: WEB
36
+ )
37
+
38
+ rebill.set_recurring_payment(
39
+ reb_first_date: "2015-01-01", # Rebill Start Date: Jan. 1, 2015
40
+ reb_expr: "1 MONTH", # Rebill Frequency: 1 MONTH
41
+ reb_cycles: "12", # Rebill # of Cycles: 12
42
+ reb_amount: "15.00" # Rebill Amount: $15.00
43
+ )
44
+
45
+ rebill.auth(amount: "0.00")
46
+
47
+ # Makes the API Request with BluePay
48
+ rebill.process
49
+
50
+ # if transaction was successful
51
+ if rebill.successful_response?
52
+ # Reads the response from BluePay
53
+ puts "TRANSACTION ID: " + rebill.get_trans_id
54
+ puts "REBILL ID: " + rebill.get_rebill_id
55
+ puts "TRANSACTION STATUS: " + rebill.get_status
56
+ puts "MASKED PAYMENT ACCOUNT: " + rebill.get_masked_account
57
+ puts "CUSTOMER BANK NAME: " + rebill.get_bank_name
58
+ else
59
+ puts rebill.get_message
60
+ end
@@ -0,0 +1,62 @@
1
+ ##
2
+ # BluePay Ruby Sample code.
3
+ #
4
+ # This code sample creates a recurring payment charging $15.00 per month for one year.
5
+
6
+ require_relative "../../lib/bluepay.rb"
7
+
8
+ acct_id = "Merchant's Account ID Here"
9
+ sec_key = "Merchant's Secret Key Here"
10
+ trans_mode = "TEST" # Transaction Mode (can also be "LIVE")
11
+
12
+ rebill = BluePay.new(
13
+ account_id: acct_id,
14
+ secret_key: sec_key,
15
+ mode: trans_mode
16
+ )
17
+
18
+ rebill.set_customer_information(
19
+ first_name: "Bob",
20
+ last_name: "Tester",
21
+ address1: "123 Test St.",
22
+ address2: "Apt #500",
23
+ city: "Testville",
24
+ state: "IL",
25
+ zip_code: "54321",
26
+ country: "USA",
27
+ phone: "123-123-1234",
28
+ email: "test@bluepay.com"
29
+ )
30
+
31
+ rebill.set_cc_information(
32
+ cc_number: "4111111111111111", # Customer Credit Card Number
33
+ cc_expiration: "1215", # Card Expiration Date: MMYY
34
+ cvv2: "123" # Card CVV2
35
+ )
36
+
37
+ rebill.set_recurring_payment(
38
+ reb_first_date: "2015-01-01", # Rebill Start Date: Jan. 1, 2015
39
+ reb_expr: "1 MONTH", # Rebill Frequency: 1 MONTH
40
+ reb_cycles: "12", # Rebill # of Cycles: 12
41
+ reb_amount: "15.00" # Rebill Amount: $15.00
42
+ )
43
+
44
+ rebill.auth(amount: "0.00")
45
+
46
+ # Makes the API Request
47
+ rebill.process
48
+
49
+ # if transaction was successful
50
+ if rebill.successful_response?
51
+ # Reads the response from BluePay
52
+ puts "TRANSACTION ID: " + rebill.get_trans_id
53
+ puts "REBILL ID: " + rebill.get_rebill_id
54
+ puts "TRANSACTION STATUS: " + rebill.get_status
55
+ puts "AVS RESPONSE: " + rebill.get_avs_code
56
+ puts "CVV2 RESPONSE: " + rebill.get_cvv2_code
57
+ puts "MASKED PAYMENT ACCOUNT: " + rebill.get_masked_account
58
+ puts "CARD TYPE: " + rebill.get_card_type
59
+ puts "AUTH CODE: " + rebill.get_auth_code
60
+ else
61
+ puts rebill.get_message
62
+ end
@@ -0,0 +1,82 @@
1
+ ##
2
+ # BluePay Ruby Sample code.
3
+ #
4
+ # This code sample runs a $0.00 Credit Card Auth transaction
5
+ # against a customer using test payment information.
6
+ # Once the rebilling cycle is created, this sample shows how to
7
+ # get information back on this rebilling cycle.
8
+ # See comments below on the details of the initial setup of the
9
+ # rebilling cycle.
10
+ ##
11
+
12
+ require_relative "../../lib/bluepay.rb"
13
+
14
+ acct_id = "Merchant's Account ID Here"
15
+ sec_key = "Merchant's Secret Key Here"
16
+ trans_mode = "TEST" # Transaction Mode (can also be "LIVE")
17
+
18
+ rebill = BluePay.new(
19
+ account_id: acct_id,
20
+ secret_key: sec_key,
21
+ mode: trans_mode
22
+ )
23
+
24
+ rebill.set_customer_information(
25
+ first_name: "Bob",
26
+ last_name: "Tester",
27
+ address1: "123 Test St.",
28
+ address2: "Apt #500",
29
+ city: "Testville",
30
+ state: "IL",
31
+ zip_code: "54321",
32
+ country: "USA",
33
+ phone: "123-123-1234",
34
+ email: "test@bluepay.com"
35
+ )
36
+
37
+ rebill.set_cc_information(
38
+ cc_number: "4111111111111111", # Customer Credit Card Number
39
+ cc_expiration: "1215", # Card Expiration Date: MMYY
40
+ cvv2: "123" # Card CVV2
41
+ )
42
+
43
+ rebill.set_recurring_payment(
44
+ reb_first_date: "2015-01-05", # Rebill Start Date: Jan. 5, 2015
45
+ reb_expr: "1 MONTH", # Rebill Frequency: 1 MONTH
46
+ reb_cycles: "11", # Rebill # of Cycles: 11
47
+ reb_amount: "15.00" # Rebill Amount: $15.00
48
+ )
49
+
50
+ rebill.auth(amount: "0.00")
51
+
52
+ # Makes the API Request to create a recurring payment
53
+ rebill.process
54
+
55
+ # If transaction was successful..
56
+ if rebill.successful_response?
57
+
58
+ rebill_status = BluePay.new(
59
+ account_id: ACCOUNT_ID,
60
+ secret_key: SECRET_KEY,
61
+ mode: MODE
62
+ )
63
+
64
+ # Find the rebill by ID and get rebill status
65
+ rebill_status.get_rebilling_cycle_status(rebill.get_rebill_id)
66
+
67
+ # Makes the API Request to get the rebill status
68
+ rebill_status.process
69
+
70
+ # Reads the response from BluePay
71
+ puts "REBILL STATUS: " + rebill_status.get_rebill_status
72
+ puts "REBILL ID: " + rebill_status.get_reb_id
73
+ puts "REBILL CREATION DATE: " + rebill_status.get_creation_date
74
+ puts "REBILL NEXT DATE: " + rebill_status.get_next_date
75
+ puts "REBILL LAST DATE: " + rebill_status.get_last_date
76
+ puts "REBILL SCHEDULE EXPRESSION: " + rebill_status.get_sched_expression
77
+ puts "REBILL CYCLES REMAINING: " + rebill_status.get_cycles_remaining
78
+ puts "REBILL AMOUNT: " + rebill_status.get_rebill_amount
79
+ puts "REBILL NEXT AMOUNT: " + rebill_status.get_next_amount
80
+ else
81
+ puts rebill.get_message
82
+ end