Class: ActiveMerchant::Billing::FirstData::Gateway
- Inherits:
-
Gateway
- Object
- Gateway
- ActiveMerchant::Billing::FirstData::Gateway
- Defined in:
- lib/active_merchant/billing/first_data/gateway.rb
Defined Under Namespace
Classes: Error
Instance Method Summary collapse
-
#authorize(amount, params = {}) ⇒ ActiveSupport::HashWithIndifferentAccess
Performs an authorization, which reserves the funds on the customer’s credit card, but does not charge the card.
-
#capture(amount, trans_id, params = {}) ⇒ ActiveSupport::HashWithIndifferentAccess
Captures the funds from an authorized transaction.
-
#close_day ⇒ Object
Close business day.
- #credit(amount, trans_id = nil) ⇒ Object
- #endpoint_url ⇒ Object
-
#execute_recurring(amount, params = {}) ⇒ ActiveSupport::HashWithIndifferentAccess
Execute subsequent recurring payment.
-
#initialize(options = {}) ⇒ Gateway
constructor
Creates a new FirstDataGateway.
-
#purchase(amount, params = {}) ⇒ ActiveSupport::HashWithIndifferentAccess
Perform a purchase, which is essentially an authorization and capture in a single operation.
-
#recurring(amount, params = {}) ⇒ ActiveSupport::HashWithIndifferentAccess
Register new recurring payment along with the first payment.
- #redirect_url(trans_id = nil) ⇒ Object
-
#refund(amount, trans_id = nil) ⇒ ActiveSupport::HashWithIndifferentAccess
refund() allows you to return money to a card that was previously billed.
-
#result(trans_id, params = {}) ⇒ ActiveSupport::HashWithIndifferentAccess
Transaction result.
-
#update_recurring(params = {}) ⇒ ActiveSupport::HashWithIndifferentAccess
Overwriting existing recurring payment card data without payment.
Constructor Details
#initialize(options = {}) ⇒ Gateway
Creates a new FirstDataGateway
The gateway requires that a valid pem and password be passed in the options hash.
37 38 39 40 41 |
# File 'lib/active_merchant/billing/first_data/gateway.rb', line 37 def initialize( = {}) requires!(, :pem, :pem_password) = super end |
Instance Method Details
#authorize(amount, params = {}) ⇒ ActiveSupport::HashWithIndifferentAccess
Performs an authorization, which reserves the funds on the customer’s credit card, but does not charge the card.
Registering of DMS authorisation
77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/active_merchant/billing/first_data/gateway.rb', line 77 def (amount, params = {}) params = params.reverse_merge( :command => :a, :msg_type => 'DMS', :amount => amount, :currency => default_currency ) lookup_currency(params) requires!(params, :amount, :currency, :client_ip_addr, :msg_type) commit(params) end |
#capture(amount, trans_id, params = {}) ⇒ ActiveSupport::HashWithIndifferentAccess
Captures the funds from an authorized transaction.
Making of DMS transaction
100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/active_merchant/billing/first_data/gateway.rb', line 100 def capture(amount, trans_id, params = {}) params = params.reverse_merge( :command => :t, :msg_type => 'DMS', :trans_id => trans_id, :amount => amount, :currency => default_currency ) lookup_currency(params) requires!(params, :trans_id, :amount, :currency, :client_ip_addr) commit(params) end |
#close_day ⇒ Object
Close business day.
235 236 237 |
# File 'lib/active_merchant/billing/first_data/gateway.rb', line 235 def close_day commit({ :command => :b }) end |
#credit(amount, trans_id = nil) ⇒ Object
146 147 148 149 |
# File 'lib/active_merchant/billing/first_data/gateway.rb', line 146 def credit(amount, trans_id = nil) deprecated CREDIT_DEPRECATION_MESSAGE refund(amount, trans_id) end |
#endpoint_url ⇒ Object
239 240 241 |
# File 'lib/active_merchant/billing/first_data/gateway.rb', line 239 def endpoint_url test? ? test_url : live_url end |
#execute_recurring(amount, params = {}) ⇒ ActiveSupport::HashWithIndifferentAccess
Execute subsequent recurring payment
193 194 195 196 197 198 199 200 201 202 |
# File 'lib/active_merchant/billing/first_data/gateway.rb', line 193 def execute_recurring(amount, params = {}) params = params.reverse_merge( :command => :e, :amount => amount, :currency => default_currency ) lookup_currency(params) requires!(params, :amount, :currency, :client_ip_addr, :description, :biller_client_id) commit(params) end |
#purchase(amount, params = {}) ⇒ ActiveSupport::HashWithIndifferentAccess
Perform a purchase, which is essentially an authorization and capture in a single operation.
Registering of SMS transaction
54 55 56 57 58 59 60 61 62 63 |
# File 'lib/active_merchant/billing/first_data/gateway.rb', line 54 def purchase(amount, params = {}) params = params.reverse_merge( :command => :v, :amount => amount, :currency => default_currency ) lookup_currency(params) requires!(params, :amount, :currency, :client_ip_addr) commit(params) end |
#recurring(amount, params = {}) ⇒ ActiveSupport::HashWithIndifferentAccess
Register new recurring payment along with the first payment
Afterwards when transaction result is requested then result response includes also RECC_PMNT_ID and RECC_PMNT_EXPIRY
170 171 172 173 174 175 176 177 178 179 180 181 |
# File 'lib/active_merchant/billing/first_data/gateway.rb', line 170 def recurring(amount, params = {}) params = params.reverse_merge( :command => :z, :amount => amount, :currency => default_currency, :msg_type => 'SMS', :perspayee_gen => 1 ) lookup_currency(params) requires!(params, :amount, :currency, :client_ip_addr, :description, :biller_client_id, :perspayee_expiry) commit(params) end |
#redirect_url(trans_id = nil) ⇒ Object
243 244 245 246 247 |
# File 'lib/active_merchant/billing/first_data/gateway.rb', line 243 def redirect_url(trans_id = nil) url = test? ? test_redirect_url : live_redirect_url url += "?trans_id=#{CGI.escape trans_id}" if trans_id url end |
#refund(amount, trans_id = nil) ⇒ ActiveSupport::HashWithIndifferentAccess
refund() allows you to return money to a card that was previously billed.
Transaction reversal
136 137 138 139 140 141 142 143 144 |
# File 'lib/active_merchant/billing/first_data/gateway.rb', line 136 def refund(amount, trans_id = nil) params = { :command => :r, :trans_id => trans_id, :amount => amount } requires!(params, :command, :trans_id, :amount) commit(params) end |
#result(trans_id, params = {}) ⇒ ActiveSupport::HashWithIndifferentAccess
Transaction result
119 120 121 122 123 124 125 126 |
# File 'lib/active_merchant/billing/first_data/gateway.rb', line 119 def result(trans_id, params = {}) params = params.reverse_merge( :command => :c, :trans_id => trans_id ) requires!(params, :trans_id, :client_ip_addr) commit(params) end |
#update_recurring(params = {}) ⇒ ActiveSupport::HashWithIndifferentAccess
Overwriting existing recurring payment card data without payment
Afterwards when transaction result is requested then result response includes also RECC_PMNT_ID and RECC_PMNT_EXPIRY
220 221 222 223 224 225 226 227 228 229 230 231 232 |
# File 'lib/active_merchant/billing/first_data/gateway.rb', line 220 def update_recurring(params = {}) params = params.reverse_merge( :command => :p, :amount => 0, :currency => default_currency, :msg_type => 'AUTH', :perspayee_gen => 1, :perspayee_overwrite => 1 ) lookup_currency(params) requires!(params, :currency, :client_ip_addr, :description, :biller_client_id, :perspayee_expiry) commit(params) end |