Class: ActiveMerchant::Billing::IatsPaymentsGateway

Inherits:
Gateway
  • Object
show all
Defined in:
lib/active_merchant/billing/gateways/iats_payments.rb

Constant Summary collapse

ACTIONS =
{
  purchase: "ProcessCreditCardV1",
  purchase_check: "ProcessACHEFTV1",
  refund: "ProcessCreditCardRefundWithTransactionIdV1",
  refund_check: "ProcessACHEFTRefundWithTransactionIdV1",
  store: "CreateCreditCardCustomerCodeV1",
  unstore: "DeleteCustomerCodeV1"
}

Constants inherited from Gateway

Gateway::CREDIT_DEPRECATION_MESSAGE, Gateway::CURRENCIES_WITHOUT_FRACTIONS, Gateway::DEBIT_CARDS, Gateway::RECURRING_DEPRECATION_MESSAGE, Gateway::STANDARD_ERROR_CODE

Instance Attribute Summary

Attributes inherited from Gateway

#options

Instance Method Summary collapse

Methods inherited from Gateway

#card_brand, card_brand, #generate_unique_id, inherited, non_fractional_currency?, #scrub, supported_countries, #supported_countries, supported_countries=, supports?, #supports_network_tokenization?, #supports_scrubbing?, #test?

Methods included from CreditCardFormatting

#format

Methods included from PostsData

included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request

Constructor Details

#initialize(options = {}) ⇒ IatsPaymentsGateway

Returns a new instance of IatsPaymentsGateway.



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/active_merchant/billing/gateways/iats_payments.rb', line 25

def initialize(options={})
  if(options[:login])
    ActiveMerchant.deprecated("The 'login' option is deprecated in favor of 'agent_code' and will be removed in a future version.")
    options[:agent_code] = options[:login]
  end

  options[:region] = 'na' unless options[:region]

  requires!(options, :agent_code, :password, :region)
  super
end

Instance Method Details

#purchase(money, payment, options = {}) ⇒ Object



37
38
39
40
41
42
43
44
45
46
# File 'lib/active_merchant/billing/gateways/iats_payments.rb', line 37

def purchase(money, payment, options={})
  post = {}
  add_invoice(post, money, options)
  add_payment(post, payment)
  add_address(post, options)
  add_ip(post, options)
  add_description(post, options)

  commit((payment.is_a?(Check) ? :purchase_check : :purchase), post)
end

#refund(money, authorization, options = {}) ⇒ Object



48
49
50
51
52
53
54
55
56
57
# File 'lib/active_merchant/billing/gateways/iats_payments.rb', line 48

def refund(money, authorization, options={})
  post = {}
  transaction_id, payment_type = split_authorization(authorization)
  post[:transaction_id] = transaction_id
  add_invoice(post, -money, options)
  add_ip(post, options)
  add_description(post, options)

  commit((payment_type == 'check' ? :refund_check : :refund), post)
end

#store(credit_card, options = {}) ⇒ Object



59
60
61
62
63
64
65
66
67
68
# File 'lib/active_merchant/billing/gateways/iats_payments.rb', line 59

def store(credit_card, options = {})
  post = {}
  add_payment(post, credit_card)
  add_address(post, options)
  add_ip(post, options)
  add_description(post, options)
  add_store_defaults(post)

  commit(:store, post)
end

#unstore(authorization, options = {}) ⇒ Object



70
71
72
73
74
75
76
# File 'lib/active_merchant/billing/gateways/iats_payments.rb', line 70

def unstore(authorization, options = {})
  post = {}
  post[:customer_code] = authorization
  add_ip(post, options)

  commit(:unstore, post)
end