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",
  refund: "ProcessCreditCardRefundWithTransactionIdV1",
  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_scrubbing?, #test?

Methods included from CreditCardFormatting

#format

Constructor Details

#initialize(options = {}) ⇒ IatsPaymentsGateway

Returns a new instance of IatsPaymentsGateway


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

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


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

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(:purchase, post)
end

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


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

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

  commit(:refund, post)
end

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


56
57
58
59
60
61
62
63
64
65
# File 'lib/active_merchant/billing/gateways/iats_payments.rb', line 56

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


67
68
69
70
71
72
73
# File 'lib/active_merchant/billing/gateways/iats_payments.rb', line 67

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

  commit(:unstore, post)
end