Sha256: fc721c90d6fab961f9d02bcfa6e33f0e2c855b6b206bec7d90e81d365c6c9944
Contents?: true
Size: 1.27 KB
Versions: 3
Compression:
Stored size: 1.27 KB
Contents
require 'active_support/core_ext/hash' module Datatrans::XML class Transaction attr_accessor :request attr_reader :response, :params def initialize(params) @params = params.symbolize_keys end def authorize self.request = AuthorizeRequest.new(params) @response = AuthorizeResponse.new(request.process) @response.successful? end def void self.request = VoidRequest.new(params) @response = VoidResponse.new(request.process) @response.successful? end def capture self.request = CaptureRequest.new(params) @response = CaptureResponse.new(request.process) @response.successful? end def status self.request = StatusRequest.new(params) @response = StatusResponse.new(request.process) @response.successful? end # TODO: purchase, credit methods def method_missing(method, *args, &block) if response.respond_to? method.to_sym response.send(method) elsif request.respond_to? method.to_sym request.send(method) else super end end end end require 'datatrans/xml/transaction/authorize' require 'datatrans/xml/transaction/void' require 'datatrans/xml/transaction/capture' require 'datatrans/xml/transaction/status'
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
datatrans-2.4.0 | lib/datatrans/xml/transaction.rb |
datatrans-2.3.1 | lib/datatrans/xml/transaction.rb |
datatrans-2.3.0 | lib/datatrans/xml/transaction.rb |