authorizenet 1.9.4 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/app/helpers/authorize_net_helper.rb +2 -3
- data/lib/authorize_net.rb +11 -56
- data/lib/authorize_net/api/LogHelper.rb +97 -0
- data/lib/authorize_net/api/SensitiveDataFilter.rb +92 -0
- data/lib/authorize_net/api/api_transaction.rb +95 -90
- data/lib/authorize_net/api/constants.yml +1 -1
- data/lib/authorize_net/api/schema.rb +1353 -994
- data/lib/authorize_net/api/transaction.rb +104 -102
- data/lib/authorize_net/authorize_net.rb +20 -27
- data/lib/authorize_net/response.rb +9 -15
- data/lib/authorize_net/transaction.rb +18 -26
- data/lib/authorize_net/xml_response.rb +36 -54
- data/lib/authorize_net/xml_transaction.rb +115 -134
- metadata +59 -73
- data/lib/authorize_net/addresses/address.rb +0 -29
- data/lib/authorize_net/addresses/shipping_address.rb +0 -26
- data/lib/authorize_net/aim/response.rb +0 -131
- data/lib/authorize_net/aim/transaction.rb +0 -190
- data/lib/authorize_net/arb/fields.rb +0 -24
- data/lib/authorize_net/arb/paging.rb +0 -33
- data/lib/authorize_net/arb/response.rb +0 -34
- data/lib/authorize_net/arb/sorting.rb +0 -43
- data/lib/authorize_net/arb/subscription.rb +0 -72
- data/lib/authorize_net/arb/subscription_detail.rb +0 -14
- data/lib/authorize_net/arb/subscription_list_response.rb +0 -43
- data/lib/authorize_net/arb/transaction.rb +0 -177
- data/lib/authorize_net/cim/customer_profile.rb +0 -19
- data/lib/authorize_net/cim/payment_profile.rb +0 -37
- data/lib/authorize_net/cim/response.rb +0 -116
- data/lib/authorize_net/cim/transaction.rb +0 -727
- data/lib/authorize_net/customer.rb +0 -27
- data/lib/authorize_net/email_receipt.rb +0 -24
- data/lib/authorize_net/fields.rb +0 -779
- data/lib/authorize_net/key_value_response.rb +0 -117
- data/lib/authorize_net/key_value_transaction.rb +0 -291
- data/lib/authorize_net/line_item.rb +0 -25
- data/lib/authorize_net/order.rb +0 -42
- data/lib/authorize_net/payment_methods/credit_card.rb +0 -62
- data/lib/authorize_net/payment_methods/echeck.rb +0 -72
- data/lib/authorize_net/reporting/batch.rb +0 -19
- data/lib/authorize_net/reporting/batch_statistics.rb +0 -19
- data/lib/authorize_net/reporting/fds_filter.rb +0 -11
- data/lib/authorize_net/reporting/response.rb +0 -163
- data/lib/authorize_net/reporting/returned_item.rb +0 -46
- data/lib/authorize_net/reporting/transaction.rb +0 -133
- data/lib/authorize_net/reporting/transaction_details.rb +0 -25
- data/lib/authorize_net/sim/hosted_payment_form.rb +0 -38
- data/lib/authorize_net/sim/hosted_receipt_page.rb +0 -37
- data/lib/authorize_net/sim/response.rb +0 -142
- data/lib/authorize_net/sim/transaction.rb +0 -138
- data/lib/generators/authorize_net/direct_post/direct_post_generator.rb +0 -53
- data/lib/generators/authorize_net/direct_post/templates/README-AuthorizeNet +0 -49
- data/lib/generators/authorize_net/direct_post/templates/config.yml.erb +0 -8
- data/lib/generators/authorize_net/direct_post/templates/config.yml.rails3.erb +0 -8
- data/lib/generators/authorize_net/direct_post/templates/controller.rb.erb +0 -31
- data/lib/generators/authorize_net/direct_post/templates/initializer.rb +0 -4
- data/lib/generators/authorize_net/direct_post/templates/layout.erb +0 -18
- data/lib/generators/authorize_net/direct_post/templates/payment.erb +0 -10
- data/lib/generators/authorize_net/direct_post/templates/payment.rails3.erb +0 -10
- data/lib/generators/authorize_net/direct_post/templates/receipt.erb +0 -1
- data/lib/generators/authorize_net/direct_post/templates/relay_response.erb +0 -1
- data/lib/generators/authorize_net/sim/sim_generator.rb +0 -47
- data/lib/generators/authorize_net/sim/templates/README-AuthorizeNet +0 -52
- data/lib/generators/authorize_net/sim/templates/config.yml.erb +0 -8
- data/lib/generators/authorize_net/sim/templates/config.yml.rails3.erb +0 -8
- data/lib/generators/authorize_net/sim/templates/controller.rb.erb +0 -21
- data/lib/generators/authorize_net/sim/templates/initializer.rb +0 -4
- data/lib/generators/authorize_net/sim/templates/layout.erb +0 -18
- data/lib/generators/authorize_net/sim/templates/payment.erb +0 -6
- data/lib/generators/authorize_net/sim/templates/payment.rails3.erb +0 -6
- data/lib/generators/authorize_net/sim/templates/thank_you.erb +0 -1
- data/lib/generators/generator_extensions.rb +0 -75
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 97d213dfc079edcb493e06b538e45ea48b7109dcc8a9ee0048c19a37f810b677
|
4
|
+
data.tar.gz: 384c4b78ca409bd61f0b19dd7aa0291ec26a47e5687fc68a6e5938e620cc8b4d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e08e6c0a987090ffd06ba7abfa855bee01fb1d6dedbef668a78c106a0bac0a4fdf6da2ec733f2882d8fd276caac87aaf2fcbad0a414c238e72fff6e3aa49b1b3
|
7
|
+
data.tar.gz: 6f774b50617975905fda052796d92f0c00c576d48e4b446183c3c5f4ed99433bbd8b2eab8082ee13988aee9d598901b8f12dec5f05269c3d02d7a88cf8011129
|
@@ -1,13 +1,12 @@
|
|
1
1
|
# The Authorize.Net Rails Helper module. Provides methods to assist with integrating the various APIs.
|
2
2
|
|
3
3
|
module AuthorizeNetHelper
|
4
|
-
|
5
4
|
# Generates a collection of hidden form fields (as a raw HTML string) for a AuthorizeNet::SIM::Transaction
|
6
5
|
# (sim_transaction). You can specify any html_options that hidden_field_tag accepts, and the
|
7
6
|
# hidden fields will be built with those options.
|
8
7
|
def sim_fields(sim_transaction, html_options = {})
|
9
8
|
fields = sim_transaction.form_fields.collect do |k, v|
|
10
|
-
if v.
|
9
|
+
if v.is_a? Array
|
11
10
|
v.collect { |val| hidden_field_tag(k, val, html_options) }
|
12
11
|
else
|
13
12
|
hidden_field_tag(k, v, html_options)
|
@@ -21,4 +20,4 @@ module AuthorizeNetHelper
|
|
21
20
|
return field_str
|
22
21
|
end
|
23
22
|
end
|
24
|
-
end
|
23
|
+
end
|
data/lib/authorize_net.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
# the current runtime to see if Rails is present. If it is, we inject our helper into
|
3
3
|
# ActiveSupport.
|
4
4
|
|
5
|
-
#coverall
|
5
|
+
# coverall
|
6
6
|
# require 'coveralls'
|
7
7
|
# Coveralls.wear!
|
8
8
|
|
@@ -16,78 +16,33 @@ require 'date'
|
|
16
16
|
|
17
17
|
# TODO: Add local data validation where possible
|
18
18
|
|
19
|
-
|
19
|
+
$LOAD_PATH.unshift File.dirname(__FILE__)
|
20
20
|
|
21
21
|
require "authorize_net/authorize_net"
|
22
|
-
require "authorize_net/
|
23
|
-
require "authorize_net/
|
24
|
-
require "authorize_net/
|
25
|
-
require "authorize_net/
|
26
|
-
require "authorize_net/customer"
|
27
|
-
require "authorize_net/email_receipt"
|
28
|
-
require "authorize_net/order"
|
29
|
-
require "authorize_net/line_item"
|
30
|
-
require "authorize_net/cim/payment_profile"
|
31
|
-
require "authorize_net/cim/customer_profile"
|
32
|
-
require "authorize_net/reporting/batch"
|
33
|
-
require "authorize_net/reporting/batch_statistics"
|
34
|
-
require "authorize_net/reporting/transaction_details"
|
35
|
-
require "authorize_net/reporting/fds_filter"
|
36
|
-
require "authorize_net/reporting/returned_item"
|
22
|
+
# require "authorize_net/customer"
|
23
|
+
# require "authorize_net/email_receipt"
|
24
|
+
# require "authorize_net/order"
|
25
|
+
# require "authorize_net/line_item"
|
37
26
|
require "authorize_net/response"
|
38
|
-
require "authorize_net/key_value_response"
|
27
|
+
# require "authorize_net/key_value_response"
|
39
28
|
require "authorize_net/xml_response"
|
40
29
|
require "authorize_net/transaction"
|
41
|
-
require "authorize_net/key_value_transaction"
|
30
|
+
# require "authorize_net/key_value_transaction"
|
42
31
|
require "authorize_net/xml_transaction"
|
43
|
-
require "authorize_net/fields"
|
44
|
-
|
45
|
-
# AIM
|
46
|
-
|
47
|
-
require "authorize_net/aim/transaction"
|
48
|
-
require "authorize_net/aim/response"
|
49
32
|
|
50
33
|
# API
|
51
34
|
require "authorize_net/api/schema"
|
52
35
|
require "authorize_net/api/api_transaction"
|
53
36
|
require "authorize_net/api/transaction"
|
54
37
|
|
55
|
-
# SIM
|
56
|
-
|
57
|
-
require "authorize_net/sim/hosted_payment_form"
|
58
|
-
require "authorize_net/sim/hosted_receipt_page"
|
59
|
-
require "authorize_net/sim/transaction"
|
60
|
-
require "authorize_net/sim/response"
|
61
|
-
|
62
|
-
# ARB
|
63
|
-
|
64
|
-
require "authorize_net/arb/paging"
|
65
|
-
require "authorize_net/arb/sorting"
|
66
|
-
require "authorize_net/arb/subscription_list_response"
|
67
|
-
require "authorize_net/arb/subscription_detail"
|
68
|
-
require "authorize_net/arb/fields"
|
69
|
-
require "authorize_net/arb/subscription"
|
70
|
-
require "authorize_net/arb/response"
|
71
|
-
require "authorize_net/arb/transaction"
|
72
|
-
|
73
|
-
# CIM
|
74
|
-
|
75
|
-
require "authorize_net/cim/response"
|
76
|
-
require "authorize_net/cim/transaction"
|
77
|
-
|
78
|
-
# Reporting
|
79
|
-
|
80
|
-
require "authorize_net/reporting/response"
|
81
|
-
require "authorize_net/reporting/transaction"
|
82
|
-
|
83
38
|
# Load our Rails plugin
|
84
39
|
|
85
40
|
if defined?(Rails)
|
86
41
|
if defined?(Rails::Railtie)
|
87
42
|
module AuthorizeNet
|
88
43
|
class Railtie < Rails::Railtie
|
89
|
-
initializer "authorize_net.load_path_initialize" do |
|
90
|
-
%w
|
44
|
+
initializer "authorize_net.load_path_initialize" do |_app|
|
45
|
+
%w[models controllers helpers].each do |dir|
|
91
46
|
path = File.join(File.dirname(__FILE__), 'app', dir)
|
92
47
|
$LOAD_PATH << path
|
93
48
|
ActiveSupport::Dependencies.autoload_paths << path
|
@@ -97,7 +52,7 @@ if defined?(Rails)
|
|
97
52
|
end
|
98
53
|
end
|
99
54
|
else
|
100
|
-
%w
|
55
|
+
%w[models controllers helpers].each do |dir|
|
101
56
|
path = File.join(File.dirname(__FILE__), 'app', dir)
|
102
57
|
$LOAD_PATH << path
|
103
58
|
ActiveSupport::Dependencies.load_paths << path
|
@@ -0,0 +1,97 @@
|
|
1
|
+
require 'logger'
|
2
|
+
require 'yaml'
|
3
|
+
require File.join File.dirname(__FILE__), 'SensitiveDataFilter'
|
4
|
+
|
5
|
+
module AuthorizeNet::API
|
6
|
+
class Log
|
7
|
+
@@shouldLog = false
|
8
|
+
@@loglevels = ['debug','info','warn','error']
|
9
|
+
def initialize()
|
10
|
+
begin
|
11
|
+
filepath = './LogConfig.yml'
|
12
|
+
if(File.file?(filepath))
|
13
|
+
cnf = YAML::load(File.open(filepath))
|
14
|
+
if(@@loglevels.include? cnf['loglevel'].downcase)
|
15
|
+
@@shouldLog = true
|
16
|
+
@logger = Logger.new(cnf['filepath'])
|
17
|
+
@logger.level = LogLevelMapper(cnf['loglevel'].downcase)
|
18
|
+
if(cnf['maskSensitiveData'])
|
19
|
+
@logger.formatter = SensitiveDataFilter.new
|
20
|
+
else
|
21
|
+
constants = YAML.load_file(File.dirname(__FILE__) + "/constants.yml")
|
22
|
+
@logger.formatter = proc do |severity, datetime, progname, msg|
|
23
|
+
progname = constants['clientId']
|
24
|
+
date_format = datetime.strftime("%Y-%m-%d %H:%M:%S")
|
25
|
+
if severity == "INFO" or severity == "WARN"
|
26
|
+
"[#{date_format}] #{severity} (#{progname}): #{msg}\n"
|
27
|
+
else
|
28
|
+
"[#{date_format}] #{severity} (#{progname}): #{msg}\n"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
else
|
33
|
+
raise "Invalid log levels"
|
34
|
+
end
|
35
|
+
else
|
36
|
+
@@shouldLog = false
|
37
|
+
end
|
38
|
+
rescue
|
39
|
+
@@shouldLog = false
|
40
|
+
end
|
41
|
+
end
|
42
|
+
def debug(message)
|
43
|
+
if(@@shouldLog)
|
44
|
+
begin
|
45
|
+
@logger.debug message
|
46
|
+
rescue Exception => ex
|
47
|
+
ex
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
def info(message)
|
52
|
+
if(@@shouldLog)
|
53
|
+
begin
|
54
|
+
@logger.info message
|
55
|
+
rescue Exception => ex
|
56
|
+
ex
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
def warn(message)
|
61
|
+
if(@@shouldLog)
|
62
|
+
begin
|
63
|
+
@logger.warn message
|
64
|
+
rescue Exception => ex
|
65
|
+
ex
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
def error(message)
|
70
|
+
if(@@shouldLog)
|
71
|
+
begin
|
72
|
+
@logger.error message
|
73
|
+
rescue Exception => ex
|
74
|
+
ex
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
def LogLevelMapper(loglevel)
|
79
|
+
case loglevel
|
80
|
+
when 'debug'
|
81
|
+
Logger::DEBUG
|
82
|
+
when 'info'
|
83
|
+
Logger::INFO
|
84
|
+
when 'warn'
|
85
|
+
Logger::WARN
|
86
|
+
when 'error'
|
87
|
+
Logger::ERROR
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
class LogHelper
|
93
|
+
def self.log
|
94
|
+
Log.new
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
@@ -0,0 +1,92 @@
|
|
1
|
+
require 'logger'
|
2
|
+
|
3
|
+
module AuthorizeNet::API
|
4
|
+
class SensitiveTag
|
5
|
+
attr_accessor :tagName, :pattern, :replacement, :disableMask
|
6
|
+
def initialize(tagName, pattern, replacement, disableMask)
|
7
|
+
@tagName = tagName
|
8
|
+
@pattern = pattern
|
9
|
+
@replacement = replacement
|
10
|
+
@disableMask = disableMask
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
class SensitiveDataConfigType
|
15
|
+
attr_accessor :sensitiveTags, :sensitiveStringRegexes
|
16
|
+
def initialize
|
17
|
+
@sensitiveTags = Array.new([SensitiveTag.new("cardCode", "", "XXX", false),
|
18
|
+
SensitiveTag.new("cardNumber", "(\\p{N}+)(\\p{N}{4})", "XXXX-\\2", false),
|
19
|
+
SensitiveTag.new("expirationDate", "", "XXX", false),
|
20
|
+
SensitiveTag.new("accountNumber", "(\\p{N}+)(\\p{N}{4})", "XXXX-\\2", false),
|
21
|
+
SensitiveTag.new("nameOnAccount", "", "XXX", false),
|
22
|
+
SensitiveTag.new("transactionKey", "", "XXX", false)]).freeze
|
23
|
+
@sensitiveStringRegexes = ["4\\p{N}{3}([\\ \\-]?)\\p{N}{4}\\1\\p{N}{4}\\1\\p{N}{4}",
|
24
|
+
"4\\p{N}{3}([\\ \\-]?)(?:\\p{N}{4}\\1){2}\\p{N}(?:\\p{N}{3})?",
|
25
|
+
"5[1-5]\\p{N}{2}([\\ \\-]?)\\p{N}{4}\\1\\p{N}{4}\\1\\p{N}{4}",
|
26
|
+
"6(?:011|22(?:1(?=[\\ \\-]?(?:2[6-9]|[3-9]))|[2-8]|9(?=[\\ \\-]?(?:[01]|2[0-5])))|4[4-9]\\p{N}|5\\p{N}\\p{N})([\\ \\-]?)\\p{N}{4}\\1\\p{N}{4}\\1\\p{N}{4}",
|
27
|
+
"35(?:2[89]|[3-8]\\p{N})([\\ \\-]?)\\p{N}{4}\\1\\p{N}{4}\\1\\p{N}{4}",
|
28
|
+
"3[47]\\p{N}\\p{N}([\\ \\-]?)\\p{N}{6}\\1\\p{N}{5}"].freeze
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
class SensitiveDataFilter < Logger::Formatter
|
33
|
+
@@sensitiveTagConfig = nil
|
34
|
+
@@tagPatterns = nil
|
35
|
+
@@tagReplacements = nil
|
36
|
+
@@cardPatterns = nil
|
37
|
+
|
38
|
+
def initialize
|
39
|
+
@@sensitiveTagConfig = SensitiveDataConfigType.new
|
40
|
+
@@cardPatterns = @@sensitiveTagConfig.sensitiveStringRegexes
|
41
|
+
@@tagPatterns = Array.new(@@sensitiveTagConfig.sensitiveStringRegexes.length)
|
42
|
+
@@tagReplacements = Array.new(@@sensitiveTagConfig.sensitiveTags.length)
|
43
|
+
|
44
|
+
@@sensitiveTagConfig.sensitiveTags.each_with_index do |sensitiveTag, index|
|
45
|
+
tagName = sensitiveTag.tagName
|
46
|
+
replacement = sensitiveTag.replacement
|
47
|
+
|
48
|
+
if sensitiveTag.pattern.nil? || sensitiveTag.pattern.empty?
|
49
|
+
pattern = "(.*)"
|
50
|
+
else
|
51
|
+
pattern = sensitiveTag.pattern
|
52
|
+
end
|
53
|
+
|
54
|
+
@@tagPatterns[index] = "<"+tagName+">"+pattern+"</"+tagName+">"
|
55
|
+
@@tagReplacements[index] = "<"+tagName+">"+replacement+"</"+tagName+">"
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def call(severity, time, progname, msg)
|
60
|
+
xmlMaskedLog = maskSensitiveXmlString(msg)
|
61
|
+
ccMasked = maskCreditCards(xmlMaskedLog)
|
62
|
+
return formatLogEntry(severity, time, progname, ccMasked)
|
63
|
+
end
|
64
|
+
|
65
|
+
def maskCreditCards(input)
|
66
|
+
input = input.force_encoding("UTF-8")
|
67
|
+
@@cardPatterns.each {|cardNumberRegex|
|
68
|
+
input = input.gsub(/#{cardNumberRegex}/, "XXX")
|
69
|
+
}
|
70
|
+
return input
|
71
|
+
end
|
72
|
+
|
73
|
+
def maskSensitiveXmlString(input)
|
74
|
+
input = input.force_encoding("UTF-8")
|
75
|
+
@@tagPatterns.each_with_index do |item, index|
|
76
|
+
input = input.gsub(/#{item}/,@@tagReplacements[index])
|
77
|
+
end
|
78
|
+
return input
|
79
|
+
end
|
80
|
+
|
81
|
+
def formatLogEntry(severity, time, progname, msg)
|
82
|
+
constants = YAML.load_file(File.dirname(__FILE__) + "/constants.yml")
|
83
|
+
progname = constants['clientId']
|
84
|
+
date_format = time.strftime("%Y-%m-%d %H:%M:%S")
|
85
|
+
if severity == "INFO" or severity == "WARN"
|
86
|
+
"[#{date_format}] #{severity} (#{progname}): #{msg}\n"
|
87
|
+
else
|
88
|
+
"[#{date_format}] #{severity} (#{progname}): #{msg}\n"
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
@@ -1,105 +1,110 @@
|
|
1
|
+
require File.join File.dirname(__FILE__), 'LogHelper'
|
2
|
+
|
1
3
|
module AuthorizeNet::API
|
2
4
|
class ApiTransaction < AuthorizeNet::XmlTransaction
|
3
|
-
|
4
5
|
module Type
|
5
|
-
API_CREATE_TRANSACTION = "createTransactionRequest"
|
6
|
-
API_UPDATE_SPLIT_TENDER_GROUP = "updateSplitTenderGroupRequest"
|
7
|
-
|
8
|
-
API_CREATE_SUBSCRIPTION = "ARBCreateSubscriptionRequest"
|
9
|
-
API_UPDATE_SUBSCRIPTION = "ARBUpdateSubscriptionRequest"
|
10
|
-
API_CANCEL_SUBSCRIPTION = "ARBCancelSubscriptionRequest"
|
11
|
-
API_GET_SUBSCRIPTION_STATUS = "ARBGetSubscriptionStatusRequest"
|
12
|
-
API_GET_SUBSCRIPTION_LIST = "ARBGetSubscriptionListRequest"
|
13
|
-
|
14
|
-
API_GET_CUSTOMER_PROFILE_IDS = "getCustomerProfileIdsRequest"
|
15
|
-
|
16
|
-
API_CREATE_CUSTOMER_PROFILE = "createCustomerProfileRequest"
|
17
|
-
API_GET_CUSTOMER_PROFILE = "getCustomerProfileRequest"
|
18
|
-
API_UPDATE_CUSTOMER_PROFILE = "updateCustomerProfileRequest"
|
19
|
-
API_DELETE_CUSTOMER_PROFILE = "deleteCustomerProfileRequest"
|
20
|
-
|
21
|
-
API_CREATE_CUSTOMER_PAYMENT_PROFILE = "createCustomerPaymentProfileRequest"
|
22
|
-
API_GET_CUSTOMER_PAYMENT_PROFILE = "getCustomerPaymentProfileRequest"
|
23
|
-
API_UPDATE_CUSTOMER_PAYMENT_PROFILE = "updateCustomerPaymentProfileRequest"
|
24
|
-
API_VALIDATE_CUSTOMER_PAYMENT_PROFILE = "validateCustomerPaymentProfileRequest"
|
25
|
-
API_DELETE_CUSTOMER_PAYMENT_PROFILE = "deleteCustomerPaymentProfileRequest"
|
26
|
-
|
27
|
-
API_CREATE_CUSTOMER_SHIPPING_PROFILE = "createCustomerShippingAddressRequest"
|
28
|
-
API_GET_CUSTOMER_SHIPPING_PROFILE = "getCustomerShippingAddressRequest"
|
29
|
-
API_UPDATE_CUSTOMER_SHIPPING_PROFILE = "updateCustomerShippingAddressRequest"
|
30
|
-
API_DELETE_CUSTOMER_SHIPPING_PROFILE = "deleteCustomerShippingAddressRequest"
|
31
|
-
|
32
|
-
API_CREATE_CUSTOMER_PROFILE_FROM_TRANSACTION = "createCustomerProfileFromTransactionRequest"
|
33
|
-
|
34
|
-
API_GET_SETTLED_BATCH_LIST = "getSettledBatchListRequest"
|
35
|
-
API_GET_TRANSACTION_LIST = "getTransactionListRequest"
|
36
|
-
API_GET_TRANSACTION_DETAILS = "getTransactionDetailsRequest"
|
37
|
-
API_GET_UNSETTLED_TRANSACTION_LIST = "getUnsettledTransactionListRequest"
|
38
|
-
API_GET_BATCH_STATISTICS = "getBatchStatisticsRequest"
|
39
|
-
|
40
|
-
|
41
|
-
API_GET_HOSTED_PROFILE_PAGE = "getHostedProfilePageRequest"
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
API_ARB_GET_SUBSCRIPTION_REQUEST = "ARBGetSubscriptionRequest"
|
50
|
-
|
51
|
-
API_GET_MERCHANT_DETAILS = "getMerchantDetailsRequest"
|
52
|
-
API_GET_HOSTED_PAYMENT_PAGE = "getHostedPaymentPageRequest"
|
53
|
-
API_UDPATE_HELD_TRANSACTION = "updateHeldTransactionRequest"
|
54
|
-
API_UPDATE_MERCHANT_DETAILS = "updateMerchantDetailsRequest"
|
6
|
+
API_CREATE_TRANSACTION = "createTransactionRequest".freeze
|
7
|
+
API_UPDATE_SPLIT_TENDER_GROUP = "updateSplitTenderGroupRequest".freeze
|
8
|
+
|
9
|
+
API_CREATE_SUBSCRIPTION = "ARBCreateSubscriptionRequest".freeze
|
10
|
+
API_UPDATE_SUBSCRIPTION = "ARBUpdateSubscriptionRequest".freeze
|
11
|
+
API_CANCEL_SUBSCRIPTION = "ARBCancelSubscriptionRequest".freeze
|
12
|
+
API_GET_SUBSCRIPTION_STATUS = "ARBGetSubscriptionStatusRequest".freeze
|
13
|
+
API_GET_SUBSCRIPTION_LIST = "ARBGetSubscriptionListRequest".freeze
|
14
|
+
|
15
|
+
API_GET_CUSTOMER_PROFILE_IDS = "getCustomerProfileIdsRequest".freeze
|
16
|
+
|
17
|
+
API_CREATE_CUSTOMER_PROFILE = "createCustomerProfileRequest".freeze
|
18
|
+
API_GET_CUSTOMER_PROFILE = "getCustomerProfileRequest".freeze
|
19
|
+
API_UPDATE_CUSTOMER_PROFILE = "updateCustomerProfileRequest".freeze
|
20
|
+
API_DELETE_CUSTOMER_PROFILE = "deleteCustomerProfileRequest".freeze
|
21
|
+
|
22
|
+
API_CREATE_CUSTOMER_PAYMENT_PROFILE = "createCustomerPaymentProfileRequest".freeze
|
23
|
+
API_GET_CUSTOMER_PAYMENT_PROFILE = "getCustomerPaymentProfileRequest".freeze
|
24
|
+
API_UPDATE_CUSTOMER_PAYMENT_PROFILE = "updateCustomerPaymentProfileRequest".freeze
|
25
|
+
API_VALIDATE_CUSTOMER_PAYMENT_PROFILE = "validateCustomerPaymentProfileRequest".freeze
|
26
|
+
API_DELETE_CUSTOMER_PAYMENT_PROFILE = "deleteCustomerPaymentProfileRequest".freeze
|
27
|
+
|
28
|
+
API_CREATE_CUSTOMER_SHIPPING_PROFILE = "createCustomerShippingAddressRequest".freeze
|
29
|
+
API_GET_CUSTOMER_SHIPPING_PROFILE = "getCustomerShippingAddressRequest".freeze
|
30
|
+
API_UPDATE_CUSTOMER_SHIPPING_PROFILE = "updateCustomerShippingAddressRequest".freeze
|
31
|
+
API_DELETE_CUSTOMER_SHIPPING_PROFILE = "deleteCustomerShippingAddressRequest".freeze
|
32
|
+
|
33
|
+
API_CREATE_CUSTOMER_PROFILE_FROM_TRANSACTION = "createCustomerProfileFromTransactionRequest".freeze
|
34
|
+
|
35
|
+
API_GET_SETTLED_BATCH_LIST = "getSettledBatchListRequest".freeze
|
36
|
+
API_GET_TRANSACTION_LIST = "getTransactionListRequest".freeze
|
37
|
+
API_GET_TRANSACTION_DETAILS = "getTransactionDetailsRequest".freeze
|
38
|
+
API_GET_UNSETTLED_TRANSACTION_LIST = "getUnsettledTransactionListRequest".freeze
|
39
|
+
API_GET_BATCH_STATISTICS = "getBatchStatisticsRequest".freeze
|
40
|
+
API_GET_TRANSACTION_LIST_FOR_CUSTOMER = "getTransactionListForCustomerRequest".freeze
|
41
|
+
|
42
|
+
API_GET_HOSTED_PROFILE_PAGE = "getHostedProfilePageRequest".freeze
|
43
|
+
|
44
|
+
API_DECRYPT_PAYMENT_DATA = "decryptPaymentDataRequest".freeze
|
45
|
+
API_AUTHENTICATE_TEST_REQUEST = "authenticateTestRequest".freeze
|
46
|
+
|
47
|
+
API_GET_CUSTOMER_PAYMENT_PROFILE_LIST = "getCustomerPaymentProfileListRequest".freeze
|
48
|
+
|
49
|
+
API_ARB_GET_SUBSCRIPTION_REQUEST = "ARBGetSubscriptionRequest".freeze
|
55
50
|
|
51
|
+
API_GET_MERCHANT_DETAILS = "getMerchantDetailsRequest".freeze
|
52
|
+
API_GET_HOSTED_PAYMENT_PAGE = "getHostedPaymentPageRequest".freeze
|
53
|
+
API_UDPATE_HELD_TRANSACTION = "updateHeldTransactionRequest".freeze
|
54
|
+
API_UPDATE_MERCHANT_DETAILS = "updateMerchantDetailsRequest".freeze
|
55
|
+
API_GET_CUSTOMER_PAYMENT_PROFILE_NONCE = "getCustomerPaymentProfileNonceRequest".freeze
|
56
|
+
|
56
57
|
end
|
57
|
-
|
58
|
+
|
58
59
|
def initialize(api_login_id = nil, api_transaction_key = nil, options = {})
|
59
|
-
|
60
|
-
end
|
61
|
-
|
62
|
-
def setOAuthOptions()
|
63
|
-
super
|
64
|
-
end
|
65
|
-
|
66
|
-
def make_request(request,responseClass,type)
|
67
|
-
setOAuthOptions()
|
68
|
-
unless responseClass.nil? or request.nil?
|
69
|
-
begin
|
70
|
-
@xml = serialize(request,type)
|
71
|
-
respXml = send_request(@xml)
|
72
|
-
@response = deserialize(respXml.body,responseClass)
|
73
|
-
rescue Exception => ex
|
74
|
-
ex
|
75
|
-
end
|
76
|
-
end
|
60
|
+
super
|
77
61
|
end
|
62
|
+
|
63
|
+
def setOAuthOptions
|
64
|
+
super
|
65
|
+
end
|
78
66
|
|
79
|
-
def
|
67
|
+
def make_request(request, responseClass, type)
|
68
|
+
setOAuthOptions
|
69
|
+
unless responseClass.nil? || request.nil?
|
70
|
+
begin
|
71
|
+
@xml = serialize(request, type)
|
72
|
+
LogHelper.log.debug(@xml)
|
73
|
+
respXml = send_request(@xml)
|
74
|
+
@response = deserialize(respXml.body, responseClass)
|
75
|
+
LogHelper.log.debug(respXml.body)
|
76
|
+
return @response
|
77
|
+
rescue Exception => ex
|
78
|
+
LogHelper.log.error(ex.message)
|
79
|
+
ex.backtrace.each {|line| LogHelper.log.error(line)}
|
80
|
+
ex
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
def serialize(object, type)
|
80
86
|
doc = Nokogiri::XML::Document.new
|
81
87
|
doc.root = object.to_xml
|
82
88
|
constants = YAML.load_file(File.dirname(__FILE__) + "/constants.yml")
|
83
89
|
clientId = constants['clientId']
|
84
90
|
|
85
|
-
builder = Nokogiri::XML::Builder.new(:
|
86
|
-
x.send(type.to_sym, :
|
87
|
-
x.merchantAuthentication
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
end
|
95
|
-
}
|
91
|
+
builder = Nokogiri::XML::Builder.new(encoding: 'utf-8') do |x|
|
92
|
+
x.send(type.to_sym, xmlns: XML_NAMESPACE) do
|
93
|
+
x.merchantAuthentication do
|
94
|
+
x.accessToken @access_token unless @access_token.blank?
|
95
|
+
if !@api_login_id.blank? || (@access_token.blank? && @api_login_id.blank?)
|
96
|
+
x.name @api_login_id
|
97
|
+
x.transactionKey @api_transaction_key
|
98
|
+
end
|
99
|
+
end
|
96
100
|
x.clientId clientId
|
97
|
-
|
98
|
-
|
101
|
+
x.send :insert, doc.root.element_children
|
102
|
+
end
|
99
103
|
end
|
100
|
-
builder.to_xml
|
104
|
+
builder.to_xml
|
101
105
|
end
|
102
|
-
|
106
|
+
|
107
|
+
|
103
108
|
def send_request(xml)
|
104
109
|
url = URI.parse(@gateway)
|
105
110
|
|
@@ -113,11 +118,11 @@ module AuthorizeNet::API
|
|
113
118
|
else
|
114
119
|
connection.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
115
120
|
end
|
116
|
-
|
117
|
-
response = connection.start {|http| http.request(httpRequest)}
|
121
|
+
|
122
|
+
response = connection.start { |http| http.request(httpRequest) }
|
118
123
|
end
|
119
|
-
|
120
|
-
def deserialize(xml,responseClass)
|
124
|
+
|
125
|
+
def deserialize(xml, responseClass)
|
121
126
|
responseClass.from_xml(xml)
|
122
127
|
end
|
123
128
|
end
|