Class: Netaxept::Service
- Inherits:
-
Object
- Object
- Netaxept::Service
- Extended by:
- Configuration
- Includes:
- HTTParty
- Defined in:
- lib/netaxept/service.rb
Defined Under Namespace
Modules: Configuration
Instance Attribute Summary
Attributes included from Configuration
Class Method Summary collapse
-
.terminal_url(transaction_id) ⇒ Object
The terminal url for a given transaction id.
Instance Method Summary collapse
- #annul(transaction_id) ⇒ Object
-
#auth(transaction_id, amount) ⇒ Object
Authorize the whole amount on the credit card.
-
#capture(transaction_id, amount) ⇒ Object
Captures the whole amount on the credit card.
-
#credit(transaction_id, amount) ⇒ Object
Credits an amount of an already captured order to the credit card.
-
#register(amount, order_id, options = {}) ⇒ Object
Registers the order parameters with netaxept.
-
#sale(transaction_id, amount) ⇒ Object
Captures the whole amount instantly.
Methods included from Configuration
Class Method Details
.terminal_url(transaction_id) ⇒ Object
The terminal url for a given transaction id
130 131 132 |
# File 'lib/netaxept/service.rb', line 130 def self.terminal_url(transaction_id) "#{self.base_uri}/terminal/default.aspx?MerchantID=#{self.merchant_id}&TransactionID=#{transaction_id}" end |
Instance Method Details
#annul(transaction_id) ⇒ Object
116 117 118 119 120 121 122 123 124 125 |
# File 'lib/netaxept/service.rb', line 116 def annul(transaction_id) params = { :query => { :transactionId => transaction_id, :operation => "ANNUL" } } Responses::AnnulResponse.new(self.class.get("/Netaxept/Process.aspx", params).parsed_response) end |
#auth(transaction_id, amount) ⇒ Object
Authorize the whole amount on the credit card
74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/netaxept/service.rb', line 74 def auth(transaction_id, amount) params = { :query => { :amount => amount, :transactionId => transaction_id, :operation => "AUTH" } } Responses::AuthResponse.new(self.class.get("/Netaxept/Process.aspx", params).parsed_response) end |
#capture(transaction_id, amount) ⇒ Object
Captures the whole amount on the credit card
89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/netaxept/service.rb', line 89 def capture(transaction_id, amount) params = { :query => { :amount => amount, :transactionId => transaction_id, :operation => "CAPTURE", } } Responses::CaptureResponse.new(self.class.get("/Netaxept/Process.aspx", params).parsed_response) end |
#credit(transaction_id, amount) ⇒ Object
Credits an amount of an already captured order to the credit card
104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/netaxept/service.rb', line 104 def credit(transaction_id, amount) params = { :query => { :amount => amount, :transactionId => transaction_id, :operation => "CREDIT" } } Responses::CreditResponse.new(self.class.get("/Netaxept/Process.aspx", params).parsed_response) end |
#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, = {}) params = {} params[:query] = { :amount => amount, :orderNumber => order_id }.merge() 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 |