lib/active_merchant/billing/gateways/cyber_source.rb in activemerchant-1.15.0 vs lib/active_merchant/billing/gateways/cyber_source.rb in activemerchant-1.16.0
- old
+ new
@@ -107,10 +107,14 @@
def authorize(money, creditcard, options = {})
requires!(options, :order_id, :email)
setup_address_hash(options)
commit(build_auth_request(money, creditcard, options), options )
end
+
+ def auth_reversal(money, identification, options = {})
+ commit(build_auth_reversal_request(money, identification, options), options)
+ end
# Capture an authorization that has previously been requested
def capture(money, authorization, options = {})
setup_address_hash(options)
commit(build_capture_request(money, authorization, options), options)
@@ -223,10 +227,19 @@
xml = Builder::XmlMarkup.new :indent => 2
add_void_service(xml, request_id, request_token)
xml.target!
end
+ def build_auth_reversal_request(money, identification, options)
+ order_id, request_id, request_token = identification.split(";")
+ options[:order_id] = order_id
+ xml = Builder::XmlMarkup.new :indent => 2
+ add_purchase_data(xml, money, true, options)
+ add_auth_reversal_service(xml, request_id, request_token)
+ xml.target!
+ end
+
def build_credit_request(money, identification, options)
order_id, request_id, request_token = identification.split(";")
options[:order_id] = order_id
xml = Builder::XmlMarkup.new :indent => 2
@@ -319,9 +332,16 @@
def add_void_service(xml, request_id, request_token)
xml.tag! 'voidService', {'run' => 'true'} do
xml.tag! 'voidRequestID', request_id
xml.tag! 'voidRequestToken', request_token
+ end
+ end
+
+ def add_auth_reversal_service(xml, request_id, request_token)
+ xml.tag! 'ccAuthReversalService', {'run' => 'true'} do
+ xml.tag! 'authRequestID', request_id
+ xml.tag! 'authRequestToken', request_token
end
end
def add_credit_service(xml, request_id, request_token)
xml.tag! 'ccCreditService', {'run' => 'true'} do