Sha256: 84acfca1fd4fa03225713945d44073784a1401ec6f233ec210339fbdb70af28e

Contents?: true

Size: 910 Bytes

Versions: 1

Compression:

Stored size: 910 Bytes

Contents

module Oschadbank
  class Client
    include Constants

    extend Dry::Initializer::Mixin

    option :api_url, default: proc { DEFAULT_API_URL }
    option :mac_key
    option :terminal_id
    option :merchant_id
    option :merchant_name
    option :merchant_url
    option :merchant_gmt
    option :country_code
    option :email, default: proc { nil }

    def pre_auth_params(args)
      ParamsBuilder.new(self, :pre_auth, args).build
    end

    def auth_params(args)
      ParamsBuilder.new(self, :auth, args).build
    end

    def charge(args)
      request_params = ParamsBuilder.new(self, :complete, args).build
      Request.new(api_url, request_params).perform
    end

    def refund(args)
      request_params = ParamsBuilder.new(self, :refund, args).build
      Request.new(api_url, request_params).perform
    end

    def response(params)
      Response.new(self, params)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
oschadbank-0.1.1 lib/oschadbank/client.rb