bluepay 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
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,111 @@
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
+ # update the rebilling cycle. See comments below
8
+ # on the details of the initial setup of the rebilling cycle as well as the
9
+ # updated 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: "1234 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: "5", # Rebill # of Cycles: 5
47
+ reb_amount: "3.50" # Rebill Amount: $3.50
48
+ )
49
+
50
+ rebill.auth(amount: "0.00")
51
+
52
+ # Makes the API Request to create a rebill
53
+ rebill.process
54
+
55
+ # If transaction was approved..
56
+ if rebill.successful_response?
57
+
58
+ payment_information_update = BluePay.new(
59
+ account_id: ACCOUNT_ID,
60
+ secret_key: SECRET_KEY,
61
+ mode: MODE
62
+ )
63
+
64
+ # Sets an updated credit card expiration date
65
+ payment_information_update.set_cc_information(
66
+ cc_expiration: "0121" # Card Expiration
67
+ )
68
+
69
+ # Stores new card expiration date
70
+ payment_information_update.auth(
71
+ amount: "0.00",
72
+ trans_id: rebill.get_trans_id # the id of the rebill to update
73
+ )
74
+
75
+ # Makes the API Request to update the payment information
76
+ payment_information_update.process
77
+
78
+ # Creates a request to update the rebill
79
+ rebill_update = BluePay.new(
80
+ account_id: ACCOUNT_ID,
81
+ secret_key: SECRET_KEY,
82
+ mode: MODE
83
+ )
84
+
85
+ # Updates the rebill
86
+ rebill_update.update_rebill(
87
+ rebill_id: rebill.get_rebill_id, # The ID of the rebill to be updated.
88
+ template_id: payment_information_update.get_trans_id, # Updates the payment information portion of the rebilling cycle with the new card expiration date entered above
89
+ next_date: "2015-03-01", # Rebill Start Date: March 1, 2015
90
+ reb_expr: "1 MONTH", # Rebill Frequency: 1 MONTH
91
+ reb_cycles: "8", # Rebill # of Cycles: 8
92
+ reb_amount: "5.15", # Rebill Amount: $5.15
93
+ next_amount: "1.50" # Rebill Next Amount: $1.50
94
+ )
95
+
96
+ # Makes the API Request to update the rebill
97
+ rebill_update.process
98
+
99
+ # Reads the response from BluePay
100
+ puts "REBILL STATUS: " + rebill_update.get_rebill_status
101
+ puts "REBILL ID: " + rebill_update.get_reb_id
102
+ puts "REBILL CREATION DATE: " + rebill_update.get_creation_date
103
+ puts "REBILL NEXT DATE: " + rebill_update.get_next_date
104
+ puts "REBILL LAST DATE: " + rebill_update.get_last_date
105
+ puts "REBILL SCHEDULE EXPRESSION: " + rebill_update.get_sched_expression
106
+ puts "REBILL CYCLES REMAINING: " + rebill_update.get_cycles_remaining
107
+ puts "REBILL AMOUNT: " + rebill_update.get_rebill_amount
108
+ puts "REBILL NEXT AMOUNT: " + rebill_update.get_next_amount
109
+ else
110
+ puts rebill.get_message
111
+ end
@@ -0,0 +1,74 @@
1
+ ##
2
+ # BluePay Ruby Sample code.
3
+ #
4
+ # This code sample runs a $3.00 Credit Card Sale transaction
5
+ # against a customer using test payment information.
6
+ # If approved, a 2nd transaction is run to cancel this transaction.
7
+ # If using TEST mode, odd dollar amounts will return
8
+ # an approval and even dollar amounts will return a decline.
9
+ ##
10
+
11
+ require_relative "../../lib/bluepay.rb"
12
+
13
+ acct_id = "Merchant's Account ID Here"
14
+ sec_key = "Merchant's Secret Key Here"
15
+ trans_mode = "TEST" # Transaction Mode (can also be "LIVE")
16
+
17
+ payment = BluePay.new(
18
+ account_id: acct_id,
19
+ secret_key: sec_key,
20
+ mode: trans_mode
21
+ )
22
+
23
+ payment.set_customer_information(
24
+ first_name: "Bob",
25
+ last_name: "Tester",
26
+ address1: "1234 Test St.",
27
+ address2: "Apt #500",
28
+ city: "Testville",
29
+ state: "IL",
30
+ zip_code: "54321",
31
+ country: "USA",
32
+ phone: "123-123-1234",
33
+ email: "test@bluepay.com"
34
+ )
35
+
36
+ payment.set_cc_information(
37
+ cc_number: "4111111111111111", # Customer Credit Card Number
38
+ cc_expiration: "1215", # Card Expiration Date: MMYY
39
+ cvv2: "123" # Card CVV2
40
+ )
41
+
42
+
43
+ payment.sale(amount: "3.00") # Sale Amount: $3.00
44
+
45
+ # Makes the API Request to create a sale
46
+ payment.process
47
+
48
+ # If transaction was approved..
49
+ if payment.successful_response?
50
+
51
+ payment_void = BluePay.new(
52
+ account_id: acct_id,
53
+ secret_key: sec_key,
54
+ mode: trans_mode
55
+ )
56
+
57
+ # Finds the previous payment by ID and attempts to void it
58
+ payment_void.void(payment.get_trans_id)
59
+
60
+ # Makes the API Request to void the payment
61
+ payment_void.process
62
+
63
+ # Reads the response from BluePay
64
+ puts "TRANSACTION STATUS: " + payment_void.get_status
65
+ puts "TRANSACTION MESSAGE: " + payment_void.get_message
66
+ puts "TRANSACTION ID: " + payment_void.get_trans_id
67
+ puts "AVS RESPONSE: " + payment_void.get_avs_code
68
+ puts "CVV2 RESPONSE: " + payment_void.get_cvv2_code
69
+ puts "MASKED PAYMENT ACCOUNT: " + payment_void.get_masked_account
70
+ puts "CARD TYPE: " + payment_void.get_card_type
71
+ puts "AUTH CODE: " + payment_void.get_auth_code
72
+ else
73
+ puts payment.get_message
74
+ end
@@ -0,0 +1,54 @@
1
+ ##
2
+ # BluePay Ruby Sample code.
3
+ #
4
+ # This code sample runs a $3.00 ACH sales transaction
5
+ # against a customer using test payment information.
6
+ ##
7
+
8
+ require_relative "../../lib/bluepay.rb"
9
+
10
+ acct_id = "Merchant's Account ID Here"
11
+ sec_key = "Merchant's Secret Key Here"
12
+ trans_mode = "TEST" # Transaction Mode (can also be "LIVE")
13
+
14
+ payment = BluePay.new(
15
+ account_id: acct_id,
16
+ secret_key: sec_key,
17
+ mode: trans_mode
18
+ )
19
+
20
+ payment.set_customer_information(
21
+ first_name: "Bob",
22
+ last_name: "Tester",
23
+ address1: "123 Test St.",
24
+ address2: "Apt #500",
25
+ city: "Testville",
26
+ state: "IL",
27
+ zip_code: "54321",
28
+ country: "USA",
29
+ phone: "123-123-1234",
30
+ email: "test@bluepay.com"
31
+ )
32
+
33
+ payment.set_ach_information(
34
+ ach_routing: "123123123", # Routing Number: 123123123
35
+ ach_account: "123456789", # Account Number: 123456789
36
+ ach_account_type: 'C', # Account Type: Checking
37
+ doc_type: "WEB" # ACH Document Type: WEB
38
+ )
39
+
40
+ payment.sale(amount: "3.00") # Sale Amount: $3.00
41
+
42
+ # Makes the API Request with BluePay
43
+ payment.process
44
+
45
+ # Reads the response from BluePay
46
+ if payment.successful_response?
47
+ puts "TRANSACTION ID: " + payment.get_trans_id
48
+ puts "TRANSACTION STATUS: " + payment.get_status
49
+ puts "TRANSACTION MESSAGE: " + payment.get_message
50
+ puts "MASKED PAYMENT ACCOUNT: " + payment.get_masked_account
51
+ puts "CUSTOMER BANK NAME: " + payment.get_bank_name
52
+ else
53
+ puts payment.get_message
54
+ end
@@ -0,0 +1,60 @@
1
+ ##
2
+ # BluePay Ruby Sample code.
3
+ #
4
+ # This code sample runs a $3.00 Credit Card sales transaction
5
+ # against a customer using test payment information.
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_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
+ payment = BluePay.new(
17
+ account_id: acct_id,
18
+ secret_key: sec_key,
19
+ mode: trans_mode
20
+ )
21
+
22
+ payment.set_customer_information(
23
+ first_name: "Bob",
24
+ last_name: "Tester",
25
+ address1: "123 Test St.",
26
+ address2: "Apt #500",
27
+ city: "Testville",
28
+ state: "IL",
29
+ zip_code: "54321",
30
+ country: "USA",
31
+ phone: "123-123-1234",
32
+ email: "test@bluepay.com"
33
+ )
34
+
35
+ payment.set_cc_information(
36
+ cc_number: "4111111111111111", # Customer Credit Card Number
37
+ cc_expiration: "1215", # Card Expiration Date: MMYY
38
+ cvv2: "123" # Card CVV2
39
+ )
40
+
41
+ payment.sale(amount: "3.00") # Sale Amount: $3.00
42
+
43
+ # Makes the API Request with BluePay
44
+ payment.process
45
+
46
+ # If transaction was successful
47
+ if payment.successful_response?
48
+ # Reads the response from BluePay
49
+ puts "TRANSACTION STATUS: " + payment.get_status
50
+ puts "TRANSACTION MESSAGE: " + payment.get_message
51
+ puts "TRANSACTION ID: " + payment.get_trans_id
52
+ puts "AVS RESPONSE: " + payment.get_avs_code
53
+ puts "CVV2 RESPONSE: " + payment.get_cvv2_code
54
+ puts "MASKED PAYMENT ACCOUNT: " + payment.get_masked_account
55
+ puts "CARD TYPE: " + payment.get_card_type
56
+ puts "AUTH CODE: " + payment.get_auth_code
57
+ else
58
+ puts payment.get_message
59
+ end
60
+
@@ -0,0 +1,58 @@
1
+ ##
2
+ # BluePay Ruby Sample code.
3
+ #
4
+ # This code sample runs a $3.00 Credit Card Authorization transaction
5
+ # against a customer using test payment information.
6
+ # If using TEST mode, odd dollar amounts will return
7
+ # an approval and even dollar amounts will return a decline.
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
+ payment = BluePay.new(
16
+ account_id: acct_id,
17
+ secret_key: sec_key,
18
+ mode: trans_mode
19
+ )
20
+
21
+ payment.set_customer_information(
22
+ first_name: "Bob",
23
+ last_name: "Tester",
24
+ address1: "123 Test St.",
25
+ address2: "Apt #500",
26
+ city: "Testville",
27
+ state: "IL",
28
+ zip_code: "54321",
29
+ country: "USA",
30
+ phone: "123-123-1234",
31
+ email: "test@bluepay.com"
32
+ )
33
+
34
+ payment.set_cc_information(
35
+ cc_number: "4111111111111111", # Customer Credit Card Number
36
+ cc_expiration: "1215", # Card Expiration Date: MMYY
37
+ cvv2: "123" # Card CVV2
38
+ )
39
+
40
+ payment.auth(amount: "3.00") # Card authorization amount: $3.00
41
+
42
+ # Makes the API Request for a credit card authorization
43
+ payment.process
44
+
45
+ # If transaction was approved..
46
+ if payment.successful_response?
47
+ # Reads the response from BluePay
48
+ puts "TRANSACTION STATUS: " + payment.get_status
49
+ puts "TRANSACTION MESSAGE: " + payment.get_message
50
+ puts "TRANSACTION ID: " + payment.get_trans_id
51
+ puts "AVS RESPONSE: " + payment.get_avs_code
52
+ puts "CVV2 RESPONSE: " + payment.get_cvv2_code
53
+ puts "MASKED PAYMENT ACCOUNT: " + payment.get_masked_account
54
+ puts "CARD TYPE: " + payment.get_card_type
55
+ puts "AUTH CODE: " + payment.get_auth_code
56
+ else
57
+ puts payment.get_message
58
+ end
@@ -0,0 +1,71 @@
1
+ ##
2
+ # BluePay Ruby Sample code.
3
+ #
4
+ # This code sample runs a $25.00 Credit Card Sale transaction
5
+ # against a customer using test payment information.
6
+ # Optional transaction data is also sent.
7
+ # If using TEST mode, odd dollar amounts will return
8
+ # an approval and even dollar amounts will return a decline.
9
+ ##
10
+
11
+ require_relative "../../lib/bluepay.rb"
12
+
13
+ acct_id = "Merchant's Account ID Here"
14
+ sec_key = "Merchant's Secret Key Here"
15
+ trans_mode = "TEST" # Transaction Mode (can also be "LIVE")
16
+
17
+ payment = BluePay.new(
18
+ account_id: acct_id,
19
+ secret_key: sec_key,
20
+ mode: trans_mode
21
+ )
22
+
23
+ payment.set_customer_information(
24
+ first_name: "Bob",
25
+ last_name: "Tester",
26
+ address1: "123 Test St.",
27
+ address2: "Apt #500",
28
+ city: "Testville",
29
+ state: "IL",
30
+ zip_code: "54321",
31
+ country: "USA",
32
+ phone: "123-123-1234",
33
+ email: "test@bluepay.com"
34
+ )
35
+
36
+ payment.set_cc_information(
37
+ cc_number: "4111111111111111", # Customer Credit Card Number
38
+ cc_expiration: "1215", # Card Expiration Date: MMYY
39
+ cvv2: "123" # Card CVV2
40
+ )
41
+
42
+ # Optional fields users can set
43
+ payment.custom_id1 = "12345" # Custom ID1: 12345
44
+ payment.custom_id2 = "09866" # Custom ID2: 09866
45
+ payment.invoice_id = "500000" # Invoice ID: 50000
46
+ payment.order_id = "10023145" # Order ID: 10023145
47
+ payment.amount_tip = "6.00" # Tip Amount: $6.00
48
+ payment.amount_tax = "3.50" # Tax Amount: $3.50
49
+ payment.amount_food = "3.11" # Food Amount: $3.11
50
+ payment.amount_misc = "5.00" # Miscellaneous Amount: $5.00
51
+ payment.memo = "Enter any comments about the transaction here." # Comments
52
+
53
+ payment.sale(amount: "25.00") # Sale Amount: $25.00
54
+
55
+ # Makes the API request with BluePay
56
+ payment.process
57
+
58
+ # If transaction was approved..
59
+ if payment.successful_response?
60
+ # Reads the response from BluePay
61
+ puts "TRANSACTION STATUS: " + payment.get_status
62
+ puts "TRANSACTION MESSAGE: " + payment.get_message
63
+ puts "TRANSACTION ID: " + payment.get_trans_id
64
+ puts "AVS RESPONSE: " + payment.get_avs_code
65
+ puts "CVV2 RESPONSE: " + payment.get_cvv2_code
66
+ puts "MASKED PAYMENT ACCOUNT: " + payment.get_masked_account
67
+ puts "CARD TYPE: " + payment.get_card_type
68
+ puts "AUTH CODE: " + payment.get_auth_code
69
+ else
70
+ puts payment.get_message
71
+ end
@@ -0,0 +1,42 @@
1
+ ##
2
+ # BluePay Ruby Sample code.
3
+ #
4
+ # Charges a customer $3.00 using the payment and customer information from a previous transaction.
5
+ # If using TEST mode, odd dollar amounts will return
6
+ # an approval and even dollar amounts will return a decline.
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
+ token = "100012341234" # Transaction ID of previous auth or sale here
15
+
16
+ payment = BluePay.new(
17
+ account_id: acct_id,
18
+ secret_key: sec_key,
19
+ mode: trans_mode
20
+ )
21
+
22
+ payment.sale(
23
+ amount: "3.00",
24
+ trans_id: token # The transaction ID of a previous sale
25
+ )
26
+
27
+ # Makes the API Request
28
+ payment.process
29
+
30
+ if payment.successful_response?
31
+ # Reads the response from BluePay
32
+ puts "TRANSACTION STATUS: " + payment.get_status
33
+ puts "TRANSACTION MESSAGE: " + payment.get_message
34
+ puts "TRANSACTION ID: " + payment.get_trans_id
35
+ puts "AVS RESPONSE: " + payment.get_avs_code
36
+ puts "CVV2 RESPONSE: " + payment.get_cvv2_code
37
+ puts "MASKED PAYMENT ACCOUNT: " + payment.get_masked_account
38
+ puts "CARD TYPE: " + payment.get_card_type
39
+ puts "AUTH CODE: " + payment.get_auth_code
40
+ else
41
+ puts payment.get_message
42
+ end