Sha256: c60dc5327fa55fd7e809f08ce47401ce3e90d0e7fccf712eb4c3e1662d62a538

Contents?: true

Size: 704 Bytes

Versions: 3

Compression:

Stored size: 704 Bytes

Contents

module Fpswax
  class PayResponse < Response
    attr_reader :transaction_id
    attr_reader :transaction_status

    def initialize(xml)
      super(xml)
      if valid?
        @transaction_id = xml.css('PayResult TransactionId')[0].content rescue nil
        @transaction_status = xml.css('PayResult TransactionStatus')[0].content rescue nil
      end
    end

    def cancelled?
      @transaction_status == 'Cancelled'
    end

    def failure?
      @transaction_status == 'Failure'
    end

    def pending?
      @transaction_status == 'Pending'
    end

    def reserved?
      @transaction_status == 'Reserved'
    end

    def success?
      @transaction_status == 'Success'
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
dbalatero-fpswax-0.0.2 lib/fpswax/pay_response.rb
dbalatero-fpswax-0.0.3 lib/fpswax/pay_response.rb
dbalatero-fpswax-0.0.4 lib/fpswax/pay_response.rb