Class: NMIGateway::Transaction
- Defined in:
- lib/nmi_gateway/transaction.rb
Constant Summary
Constants inherited from Api
Api::QUERY_URL, Api::TRANSACTION_URL
Instance Attribute Summary
Attributes inherited from Api
Instance Method Summary collapse
-
#authorize(options = {}) ⇒ Object
NMIGateway::Transaction.new.authorize ccnumber: ‘4111111111111111’, ccexp: “0219”, first_name: “John”, last_name: “Doe”, amount: 22.25, email: “[email protected]”, country: “US” NMIGateway::Transaction.new.authorize payment_token: ‘abc123’, first_name: “John”, last_name: “Doe”, amount: 22.25, email: “[email protected]”, country: “US” NMIGateway::Transaction.new.authorize customer_vault_id: ‘123456789’, amount: 22.25.
-
#capture(options = {}) ⇒ Object
NMIGateway::Transaction.new.capture transactionid: 3261830498, amount: 22.30.
-
#credit(options = {}) ⇒ Object
Disabled for our merchant account NMIGateway::Transaction.new.credit ccnumber: ‘4111111111111111’, ccexp: “0219”, first_name: “John”, last_name: “Doe”, amount: 22.30, email: “[email protected]”, country: “US” NMIGateway::Transaction.new.credit payment_token: ‘abc123’, first_name: “John”, last_name: “Doe”, amount: 22.30, email: “[email protected]”, country: “US” NMIGateway::Transaction.new.credit customer_vault_id: ‘123456789’, amount: 22.30.
-
#find(options = {}) ⇒ Object
NMIGateway::Transaction.new.find transaction_id: 3261844010.
-
#refund(options = {}) ⇒ Object
NMIGateway::Transaction.new.refund transactionid: 3261844010, amount: 5.
-
#sale(options = {}) ⇒ Object
NMIGateway::Transaction.new.sale ccnumber: ‘4111111111111111’, ccexp: “0219”, first_name: “John”, last_name: “Doe”, amount: 22.30, email: “[email protected]”, country: “US” NMIGateway::Transaction.new.sale payment_token: ‘abc123’, first_name: “John”, last_name: “Doe”, amount: 22.30, email: “[email protected]”, country: “US” NMIGateway::Transaction.new.sale customer_vault_id: ‘123456789’, amount: 22.30.
-
#update(options = {}) ⇒ Object
NMIGateway::Transaction.new.update transactionid: 3261844010, first_name: “joe”.
-
#validate(options = {}) ⇒ Object
Disabled for our merchant account NMIGateway::Transaction.new.validate ccnumber: ‘4111111111111111’, ccexp: “0219”, first_name: “John”, last_name: “Doe”, email: “[email protected]”, country: “US” NMIGateway::Transaction.new.validate payment_token: ‘abc123’, first_name: “John”, last_name: “Doe”, email: “[email protected]”, country: “US” NMIGateway::Transaction.new.validate customer_vault_id: ‘123456789’.
-
#void(options = {}) ⇒ Object
NMIGateway::Transaction.new.void transactionid: 3261830498, amount: 22.30.
Methods inherited from Api
Constructor Details
This class inherits a constructor from NMIGateway::Api
Instance Method Details
#authorize(options = {}) ⇒ Object
NMIGateway::Transaction.new.authorize ccnumber: ‘4111111111111111’, ccexp: “0219”, first_name: “John”, last_name: “Doe”, amount: 22.25, email: “[email protected]”, country: “US” NMIGateway::Transaction.new.authorize payment_token: ‘abc123’, first_name: “John”, last_name: “Doe”, amount: 22.25, email: “[email protected]”, country: “US” NMIGateway::Transaction.new.authorize customer_vault_id: ‘123456789’, amount: 22.25
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/nmi_gateway/transaction.rb', line 23 def ( = {}) query = set_query() query[:type] = 'auth' if query[:customer_vault_id] require_fields(:customer_vault_id, :amount) elsif query[:payment_token] require_fields(:payment_token, :first_name, :last_name, :email, :amount) else require_fields(:ccnumber, :ccexp, :first_name, :last_name, :email, :amount) end post query end |
#capture(options = {}) ⇒ Object
NMIGateway::Transaction.new.capture transactionid: 3261830498, amount: 22.30
37 38 39 40 41 42 |
# File 'lib/nmi_gateway/transaction.rb', line 37 def capture( = {}) query = set_query() query[:type] = 'capture' require_fields(:transactionid, :amount ) post query end |
#credit(options = {}) ⇒ Object
Disabled for our merchant account NMIGateway::Transaction.new.credit ccnumber: ‘4111111111111111’, ccexp: “0219”, first_name: “John”, last_name: “Doe”, amount: 22.30, email: “[email protected]”, country: “US” NMIGateway::Transaction.new.credit payment_token: ‘abc123’, first_name: “John”, last_name: “Doe”, amount: 22.30, email: “[email protected]”, country: “US” NMIGateway::Transaction.new.credit customer_vault_id: ‘123456789’, amount: 22.30
79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/nmi_gateway/transaction.rb', line 79 def credit( = {}) query = set_query() query[:type] = 'credit' if query[:customer_vault_id] require_fields(:customer_vault_id, :amount) elsif query[:payment_token] require_fields(:payment_token, :first_name, :last_name, :email, :amount) else require_fields(:ccnumber, :ccexp, :first_name, :last_name, :email, :amount) end post query end |
#find(options = {}) ⇒ Object
NMIGateway::Transaction.new.find transaction_id: 3261844010
69 70 71 72 73 |
# File 'lib/nmi_gateway/transaction.rb', line 69 def find( = {}) query = set_query() query[:report_type] ||= 'transaction' get query end |
#refund(options = {}) ⇒ Object
NMIGateway::Transaction.new.refund transactionid: 3261844010, amount: 5
53 54 55 56 57 58 |
# File 'lib/nmi_gateway/transaction.rb', line 53 def refund( = {}) query = set_query() query[:type] = 'refund' require_fields(:transactionid) # amount post query end |
#sale(options = {}) ⇒ Object
NMIGateway::Transaction.new.sale ccnumber: ‘4111111111111111’, ccexp: “0219”, first_name: “John”, last_name: “Doe”, amount: 22.30, email: “[email protected]”, country: “US” NMIGateway::Transaction.new.sale payment_token: ‘abc123’, first_name: “John”, last_name: “Doe”, amount: 22.30, email: “[email protected]”, country: “US” NMIGateway::Transaction.new.sale customer_vault_id: ‘123456789’, amount: 22.30
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/nmi_gateway/transaction.rb', line 7 def sale( = {}) query = set_query() query[:type] = 'sale' if query[:customer_vault_id] require_fields(:customer_vault_id, :amount) elsif query[:payment_token] require_fields(:payment_token, :first_name, :last_name, :email, :amount) else require_fields(:ccnumber, :ccexp, :first_name, :last_name, :email, :amount) end post query end |
#update(options = {}) ⇒ Object
NMIGateway::Transaction.new.update transactionid: 3261844010, first_name: “joe”
61 62 63 64 65 66 |
# File 'lib/nmi_gateway/transaction.rb', line 61 def update( = {}) query = set_query() query[:type] = 'update' require_fields(:transactionid) post query end |
#validate(options = {}) ⇒ Object
Disabled for our merchant account NMIGateway::Transaction.new.validate ccnumber: ‘4111111111111111’, ccexp: “0219”, first_name: “John”, last_name: “Doe”, email: “[email protected]”, country: “US” NMIGateway::Transaction.new.validate payment_token: ‘abc123’, first_name: “John”, last_name: “Doe”, email: “[email protected]”, country: “US” NMIGateway::Transaction.new.validate customer_vault_id: ‘123456789’
96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/nmi_gateway/transaction.rb', line 96 def validate( = {}) query = set_query() query[:type] = 'validate' if query[:customer_vault_id] require_fields(:customer_vault_id) elsif query[:payment_token] require_fields(:payment_token, :first_name, :last_name, :email) else require_fields(:ccnumber, :ccexp, :first_name, :last_name, :email) end post query end |
#void(options = {}) ⇒ Object
NMIGateway::Transaction.new.void transactionid: 3261830498, amount: 22.30
45 46 47 48 49 50 |
# File 'lib/nmi_gateway/transaction.rb', line 45 def void( = {}) query = set_query() query[:type] = 'void' require_fields(:transactionid) post query end |