Sha256: 1fe0095212f6172ffc7e4dade8846206ab023c0443e7f441016c6c239ffe8ef3

Contents?: true

Size: 1.23 KB

Versions: 3

Compression:

Stored size: 1.23 KB

Contents

module Erede
  class Sdk
    attr_accessor :store

    def initialize(store)
      @store = store
    end

    def create(transaction)
      service = ::Erede::Services::CreateTransaction.new(@store, transaction)
      service.execute
    end

    def cancel(transaction)
      service = ::Erede::Services::CancelTransaction.new(@store, transaction)
      service.execute
    end

    def capture(transaction)
      service = ::Erede::Services::CaptureTransaction.new(@store, transaction)
      service.execute
    end

    def get_by_tid(tid)
      service     = ::Erede::Services::GetTransaction.new(@store)
      service.tid = tid
      service.execute
    end

    def get_by_reference(reference)
      service           = ::Erede::Services::GetTransaction.new(@store)
      service.reference = reference
      service.execute
    end

    def get_refunds(tid)
      service         = ::Erede::Services::GetTransaction.new(@store)
      service.tid     = tid
      service.refunds = true
      service.execute
    end

    def get_refund(tid, refundId)
      service         = ::Erede::Services::GetTransaction.new(@store)
      service.tid     = tid
      service.refunds = true
      service.refundId = refundId
      service.execute
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
erede-ruby-sdk-3.0.2 lib/erede/sdk.rb
erede-ruby-sdk-3.0.1 lib/erede/sdk.rb
erede-ruby-sdk-3.0.0 lib/erede/sdk.rb