Class: ActiveMerchant::Billing::FirstPayGateway

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

Defined Under Namespace

Classes: FirstPayPostData

Constant Summary collapse

ACTIONS =
{
  'sale' => 1,
  'credit' => 2,
  'void' => 3
}

Constants inherited from Gateway

Gateway::CREDIT_DEPRECATION_MESSAGE, Gateway::CURRENCIES_WITHOUT_FRACTIONS, Gateway::DEBIT_CARDS

Instance Attribute Summary

Attributes inherited from Gateway

#options

Instance Method Summary collapse

Methods inherited from Gateway

#card_brand, card_brand, inherited, supports?, #test?

Methods included from CreditCardFormatting

#format

Constructor Details

#initialize(options = {}) ⇒ FirstPayGateway

Returns a new instance of FirstPayGateway.



34
35
36
37
# File 'lib/active_merchant/billing/gateways/first_pay.rb', line 34

def initialize(options = {})
  requires!(options, :login, :password)
  super
end

Instance Method Details

#credit(money, reference, options = {}) ⇒ Object



62
63
64
65
# File 'lib/active_merchant/billing/gateways/first_pay.rb', line 62

def credit(money, reference, options = {})
  deprecated CREDIT_DEPRECATION_MESSAGE
  refund(money, reference, options)
end

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



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

def purchase(money, creditcard, options = {})
  post = FirstPayPostData.new
  add_invoice(post, options)
  add_creditcard(post, creditcard)
  add_address(post, options)
  add_customer_data(post, options)

  commit('sale', money, post)
end

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



49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/active_merchant/billing/gateways/first_pay.rb', line 49

def refund(money, reference, options = {})
  requires!(options, :credit_card)

  post = FirstPayPostData.new
  add_invoice(post, options)
  add_creditcard(post, options[:credit_card])
  add_address(post, options)
  add_customer_data(post, options)
  add_credit_data(post, reference)

  commit('credit', money, post)
end

#void(money, creditcard, options = {}) ⇒ Object



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

def void(money, creditcard, options = {})
  post = FirstPayPostData.new
  add_creditcard(post, creditcard)
  add_void_data(post, options)
  add_invoice(post, options)
  add_customer_data(post, options)

  commit('void', money, post)
end