Sha256: b78fb31793bbddfa97f817e8e35a63238e97156f4b3ef157d93b1e9cd914c120
Contents?: true
Size: 1007 Bytes
Versions: 2
Compression:
Stored size: 1007 Bytes
Contents
module Securetrading class Refund < Connection def initialize(amount, parent_transaction, options = {}) @amount = amount @parent_transaction = parent_transaction @account_type = options[:account_type].presence || 'ECOM' @options = options end def perform(options = {}) perform_with(:post, to_xml, options) end private def ox_xml prepare_doc do req = doc.requestblock.request req << merchant << operation << billing end end def request_type 'REFUND'.freeze end def operation Operation.new( sitereference: Securetrading.config.site_reference, accounttypedescription: @account_type, parenttransactionreference: @parent_transaction ).ox_xml end def billing Billing.new(amount: { content: @amount }).ox_xml end def merchant return '' unless @options[:merchant].present? Merchant.new(@options[:merchant]).ox_xml end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
securetrading-0.3.2 | lib/securetrading/refund.rb |
securetrading-0.3.1 | lib/securetrading/refund.rb |