Sha256: a72e48fe2d62a7ba66abb092f53348fb69e5dabfc3dc2545a56b9c8aaaa89855

Contents?: true

Size: 1.47 KB

Versions: 8

Compression:

Stored size: 1.47 KB

Contents

require 'net/http'

module ActiveMerchant #:nodoc:
  module Billing #:nodoc:
    module Integrations #:nodoc:
      module Doku
        class Notification < ActiveMerchant::Billing::Integrations::Notification

          self.production_ips = ['103.10.128.11', '103.10.128.14']

          def complete?
            status.present?
          end

          def item_id
            params['TRANSIDMERCHANT']
          end

          def gross
            params['AMOUNT']
          end

          def status
            case params['RESULT']
            when 'Success'
              'Completed'
            when 'Fail'
              'Failed'
            end
          end

          def currency
            'IDR'
          end

          def words
            params['WORDS']
          end

          def type
            if words && params['STOREID']
              'verify'
            elsif status
              'notify'
            end
          end

          # no unique ID is generated by Doku at any point in the process,
          # so use the same as the original order number.
          def transaction_id
            params['TRANSIDMERCHANT']
          end

          def acknowledge(authcode = nil)
            case type
            when 'verify'
              words == Digest::SHA1.hexdigest("#{gross}#{@options[:credential2]}#{item_id}")
            when 'notify'
              true
            else
              false
            end

          end
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
activemerchant-1.43.3 lib/active_merchant/billing/integrations/doku/notification.rb
activemerchant-1.43.1 lib/active_merchant/billing/integrations/doku/notification.rb
activemerchant-1.43.0 lib/active_merchant/billing/integrations/doku/notification.rb
activemerchant-1.42.9 lib/active_merchant/billing/integrations/doku/notification.rb
activemerchant-1.42.8 lib/active_merchant/billing/integrations/doku/notification.rb
activemerchant-1.42.7 lib/active_merchant/billing/integrations/doku/notification.rb
activemerchant-1.42.6 lib/active_merchant/billing/integrations/doku/notification.rb
activemerchant-1.42.5 lib/active_merchant/billing/integrations/doku/notification.rb