class Securetrading::Refund
Public Class Methods
new(amount, parent_transaction, opts = {}, config_opts = {})
click to toggle source
# File lib/securetrading/refund.rb, line 3 def initialize(amount, parent_transaction, opts = {}, config_opts = {}) @amount = amount @parent_transaction = parent_transaction @account_type = opts[:account_type].presence || 'ECOM' @options = opts @config_options = config_opts end
Public Instance Methods
perform(options = {})
click to toggle source
# File lib/securetrading/refund.rb, line 11 def perform(options = {}) perform_with(:post, to_xml, options) end
Private Instance Methods
billing()
click to toggle source
# File lib/securetrading/refund.rb, line 36 def billing Billing.new(amount: { content: @amount }).ox_xml end
merchant()
click to toggle source
# File lib/securetrading/refund.rb, line 40 def merchant return '' unless @options[:merchant].present? Merchant.new(@options[:merchant]).ox_xml end
operation()
click to toggle source
# File lib/securetrading/refund.rb, line 28 def operation Operation.new( sitereference: config.site_reference, accounttypedescription: @account_type, parenttransactionreference: @parent_transaction ).ox_xml end
ox_xml()
click to toggle source
# File lib/securetrading/refund.rb, line 17 def ox_xml prepare_doc do req = doc.requestblock.request req << merchant << operation << billing end end
request_type()
click to toggle source
# File lib/securetrading/refund.rb, line 24 def request_type 'REFUND'.freeze end