Sha256: 2e26638d3a983fe7a0bba173e126ef0002a551b7a22f12ee30c4c138c8828057

Contents?: true

Size: 1.01 KB

Versions: 3

Compression:

Stored size: 1.01 KB

Contents

require 'time'

require 'killbill'

module Killbill
  module CurrencyPlugin
    class TestPlugin < Killbill::Plugin::Currency

      def initialize()
        @raise_exception = false
        super()
      end


      def start_plugin
        super
      end

      # return DB connections to the Pool if required
      def after_request
      end

      def get_base_currencies(options = {})
        ['USD']
      end

      def get_latest_conversion_date(base_currency, options = {})
        Time.now.utc
      end

      def get_conversion_dates(base_currency, options = {})
        [Time.now.utc]
      end

      def get_current_rates(base_currency, options = {})

        rate = Killbill::Plugin::Model::Rate.new
        rate.base_currency = base_currency
        rate.currency = 'BRL'
        rate.value = 12.3
        rate.conversion_date = Time.now.utc
        [rate]
      end

      def get_rates(base_currency, conversion_date, options = {})
        get_current_rates(base_currency, options)
      end

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
killbill-currency-plugin-test-1.1.1 lib/currency_plugin_test/api.rb
killbill-currency-plugin-test-1.1.0 lib/currency_plugin_test/api.rb
killbill-currency-plugin-test-1.0.0 lib/currency_plugin_test/api.rb