Sha256: 0006d3f8237883c20d8382d1f95815d4b02a5de1daaef1687dedf1d02d22cecd

Contents?: true

Size: 922 Bytes

Versions: 5

Compression:

Stored size: 922 Bytes

Contents

module EWayClient
  class QueryTxnStatusResponse < BaseResponse

    SUCCESS_RESPONSE_CODE = "0000"

    attribute(:response_code, String, {
      lazy: true,
      default: :default_response_code,
    })
    attribute(:error_message, String, {
      lazy: true,
      default: :default_error_message,
    })
    attribute(:transaction_status, String, {
      lazy: true,
      default: :default_transaction_status,
    })
    attribute(:cancel_reason, String, {
      lazy: true,
      default: :default_cancel_reason,
    })

    private

    def default_success
      response_code == SUCCESS_RESPONSE_CODE
    end

    def default_response_code
      data[:response_code]
    end

    def default_error_message
      "#{response_code}: unknown description"
    end

    def default_transaction_status
      data[:transaction_status]
    end

    def default_cancel_reason
      data[:cancel_reason]
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
e_way_client-2.1.0 lib/e_way_client/responses/query_txn_status_response.rb
e_way_client-2.0.0 lib/e_way_client/responses/query_txn_status_response.rb
e_way_client-1.2.1 lib/e_way_client/responses/query_txn_status_response.rb
e_way_client-1.2.0 lib/e_way_client/responses/query_txn_status_response.rb
e_way_client-1.1.0 lib/e_way_client/responses/query_txn_status_response.rb