lib/active_merchant/billing/gateways/creditcall.rb in activemerchant-1.79.2 vs lib/active_merchant/billing/gateways/creditcall.rb in activemerchant-1.80.0
- old
+ new
@@ -14,33 +14,33 @@
self.homepage_url = 'https://www.creditcall.com'
self.display_name = 'Creditcall'
CVV_CODE = {
- "matched" => "M",
- "notmatched" => "N",
- "notchecked" => "P",
- "partialmatch" => "N"
+ 'matched' => 'M',
+ 'notmatched' => 'N',
+ 'notchecked' => 'P',
+ 'partialmatch' => 'N'
}
AVS_CODE = {
- "matched;matched" => "D",
- "matched;notchecked" =>"B",
- "matched;notmatched" => "A",
- "matched;partialmatch" => "A",
- "notchecked;matched" => "P",
- "notchecked;notchecked" =>"I",
- "notchecked;notmatched" => "I",
- "notchecked;partialmatch" => "I",
- "notmatched;matched" => "W",
- "notmatched;notchecked" =>"C",
- "notmatched;notmatched" => "C",
- "notmatched;partialmatch" => "C",
- "partialmatched;matched" => "W",
- "partialmatched;notchecked" =>"C",
- "partialmatched;notmatched" => "C",
- "partialmatched;partialmatch" => "C"
+ 'matched;matched' => 'D',
+ 'matched;notchecked' =>'B',
+ 'matched;notmatched' => 'A',
+ 'matched;partialmatch' => 'A',
+ 'notchecked;matched' => 'P',
+ 'notchecked;notchecked' =>'I',
+ 'notchecked;notmatched' => 'I',
+ 'notchecked;partialmatch' => 'I',
+ 'notmatched;matched' => 'W',
+ 'notmatched;notchecked' =>'C',
+ 'notmatched;notmatched' => 'C',
+ 'notmatched;partialmatch' => 'C',
+ 'partialmatched;matched' => 'W',
+ 'partialmatched;notchecked' =>'C',
+ 'partialmatched;notmatched' => 'C',
+ 'partialmatched;partialmatch' => 'C'
}
def initialize(options={})
requires!(options, :terminal_id, :transaction_key)
super
@@ -66,39 +66,39 @@
)
end
def authorize(money, payment_method, options={})
request = build_xml_request do |xml|
- add_transaction_details(xml, money, nil, "Auth", options)
+ add_transaction_details(xml, money, nil, 'Auth', options)
add_terminal_details(xml, options)
add_card_details(xml, payment_method, options)
end
commit(request)
end
def capture(money, authorization, options={})
request = build_xml_request do |xml|
- add_transaction_details(xml, money, authorization, "Conf", options)
+ add_transaction_details(xml, money, authorization, 'Conf', options)
add_terminal_details(xml, options)
end
commit(request)
end
def refund(money, authorization, options={})
request = build_xml_request do |xml|
- add_transaction_details(xml, money, authorization, "Refund", options)
+ add_transaction_details(xml, money, authorization, 'Refund', options)
add_terminal_details(xml, options)
end
commit(request)
end
def void(authorization, options={})
request = build_xml_request do |xml|
- add_transaction_details(xml, nil, authorization, "Void", options)
+ add_transaction_details(xml, nil, authorization, 'Void', options)
add_terminal_details(xml, options)
end
commit(request)
end
@@ -126,40 +126,40 @@
def avs_result_code_from(params)
AVS_CODE["#{params['Address']};#{params['Zip']}"]
end
def cvv_result_code_from(params)
- CVV_CODE[params["CSC"]]
+ CVV_CODE[params['CSC']]
end
def error_result_code_from(params)
- params["ErrorCode"]
+ params['ErrorCode']
end
def build_xml_request
builder = Nokogiri::XML::Builder.new do |xml|
- xml.Request(type: "CardEaseXML", version: "1.0.0") do
+ xml.Request(type: 'CardEaseXML', version: '1.0.0') do
yield(xml)
end
end
builder.to_xml
end
def add_transaction_details(xml, amount, authorization, type, options={})
xml.TransactionDetails do
xml.MessageType type
- xml.Amount(unit: "Minor"){ xml.text(amount) } if amount
+ xml.Amount(unit: 'Minor'){ xml.text(amount) } if amount
xml.CardEaseReference authorization if authorization
- xml.VoidReason "01" if type == "Void"
+ xml.VoidReason '01' if type == 'Void'
end
end
def add_terminal_details(xml, options={})
xml.TerminalDetails do
xml.TerminalID @options[:terminal_id]
xml.TransactionKey @options[:transaction_key]
- xml.Software(version: "SoftwareVersion"){ xml.text("SoftwareName") }
+ xml.Software(version: 'SoftwareVersion'){ xml.text('SoftwareName') }
end
end
def add_card_details(xml, payment_method, options={})
xml.CardDetails do
@@ -189,25 +189,25 @@
def parse(body)
response = {}
xml = Nokogiri::XML(body)
- node = xml.xpath("//Response/TransactionDetails")
+ node = xml.xpath('//Response/TransactionDetails')
node.children.each do |childnode|
response[childnode.name] = childnode.text
end
- node = xml.xpath("//Response/Result")
+ node = xml.xpath('//Response/Result')
node.children.each do |childnode|
if childnode.elements.empty?
response[childnode.name] = childnode.text
else
childnode_to_response(response, childnode)
end
end
- node = xml.xpath("//Response/CardDetails")
+ node = xml.xpath('//Response/CardDetails')
node.children.each do |childnode|
if childnode.elements.empty?
response[childnode.name] = childnode.text
else
childnode_to_response(response, childnode)
@@ -218,13 +218,13 @@
response
end
def childnode_to_response(response, childnode)
childnode.elements.each do |element|
- if element.name == "Error"
- response["ErrorCode"] = element.attr("code")
- response["ErrorMessage"] = element.text
+ if element.name == 'Error'
+ response['ErrorCode'] = element.attr('code')
+ response['ErrorMessage'] = element.text
else
response[element.name] = element.text
end
end
end
@@ -247,26 +247,26 @@
def url
test? ? test_url : live_url
end
def success_from(response)
- response["LocalResult"] == "0" || response["LocalResult"] == "00"
+ response['LocalResult'] == '0' || response['LocalResult'] == '00'
end
def message_from(response)
if success_from(response)
- "Succeeded"
+ 'Succeeded'
else
- response["ErrorMessage"]
+ response['ErrorMessage']
end
end
def authorization_from(response)
- response["CardEaseReference"]
+ response['CardEaseReference']
end
def manual_type(options)
- options[:manual_type] ? options[:manual_type] : "ecommerce"
+ options[:manual_type] || 'ecommerce'
end
end
end
end