Sha256: 5454697ae1141022e6dae8f116dd66137afa01df04bdbec07039721b79877d0f

Contents?: true

Size: 1.98 KB

Versions: 1

Compression:

Stored size: 1.98 KB

Contents

module Cardflex
  class Transaction
    include BaseModule

    module Type
      Capture = 'capture'
      Void = 'void'
      Refund = 'refund'
    end

    attr_reader :result, :result_code, :result_text, :authorization_code
    attr_reader :avs_result, :cvv_result, :avs_reject, :cvv_reject
    attr_reader :amount, :currency
    attr_reader :ip_address
    attr_reader :industry
    attr_reader :billing_method
    attr_reader :processor_id
    attr_reader :sec_code
    attr_reader :descriptor, :descriptor_phone, :descriptor_address, :descriptor_city, :descriptor_state,
      :descriptor_postal, :descriptor_country, :descriptor_mcc, :descriptor_merchant_id, :descriptor_url
    attr_reader :order_description, :order_date
    attr_reader :subscription_id
    attr_reader :customer_id, :customer_vault_id
    attr_reader :merchant_receipt_email
    attr_reader :customer_receipt
    attr_reader :tracking_number, :shipping_carrier, :shipping_amount, :ship_from_postal
    attr_reader :po_number, :order_id
    attr_reader :tax_amount, :duty_amount, :national_tax_amount, :alternate_tax_amount, :alternate_tax_id
    attr_reader :vat_tax_amount, :vat_tax_rate, :vat_invoice_reference_number, :customer_vat_registration,
      :merchant_vat_registration
    attr_reader :summary_commodity_code
    attr_reader :discount_amount
    attr_reader :cardholder_auth
    attr_reader :eci
    attr_reader :cavv, :xid
    attr_reader :dup_seconds
    attr_reader :type, :action_type, :transaction_id, :billing, :plan, :shipping, :product

    def initialize(gateway, attributes)
      @gateway = gateway
      @type = attributes[:action_type]
      set_instance_variables_from_hash(attributes)
    end

    # Three Step API
    def self.request(attributes)
      Configuration.gateway.transaction.request(attributes)
    end

    create_helper_methods(Type) do |attributes|
      request(attributes)
    end

    # Query API
    def self.query(attributes)
      Configuration.gateway.transaction.query(attributes)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cardflex-ruby-0.1.2 lib/cardflex/transaction.rb