Class: Netaxept::Service

Inherits:
Object
  • Object
show all
Extended by:
Configuration
Includes:
HTTParty
Defined in:
lib/netaxept/service.rb

Defined Under Namespace

Modules: Configuration

Instance Attribute Summary

Attributes included from Configuration

#merchant_id

Instance Method Summary collapse

Methods included from Configuration

authenticate, environment=

Instance Method Details

#register(amount, order_id, options = {}) ⇒ Object

Registers the order parameters with netaxept. Returns a Responses::RegisterResponse



44
45
46
47
48
49
50
51
52
53
54
# File 'lib/netaxept/service.rb', line 44

def register(amount, order_id, options = {})
  
  params = {}
  params[:query] = {
    :amount => amount,
    :orderNumber => order_id
    }.merge(options)
    
  Responses::RegisterResponse.new(self.class.get("/Netaxept/Register.aspx", params).parsed_response)
  
end

#sale(transaction_id, amount) ⇒ Object

Captures the whole amount instantly



59
60
61
62
63
64
65
66
67
68
69
# File 'lib/netaxept/service.rb', line 59

def sale(transaction_id, amount)
  params = {
    :query => {
      :amount => amount,
      :transactionId => transaction_id,
      :operation => "SALE"
    }
  }
  
  Responses::SaleResponse.new(self.class.get("/Netaxept/Process.aspx", params).parsed_response)
end