Class: ActiveMerchant::Billing::PayeezyGateway

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

Constant Summary collapse

CREDIT_CARD_BRAND =
{
  'visa' => 'Visa',
  'master' => 'Mastercard',
  'american_express' => 'American Express',
  'discover' => 'Discover',
  'jcb' => 'JCB',
  'diners_club' => 'Diners Club'
}

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, #scrub, supported_countries, #supported_countries, supported_countries=, supports?, #supports_network_tokenization?, #supports_scrubbing?, #test?

Methods included from CreditCardFormatting

#expdate, #format

Methods included from PostsData

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

Constructor Details

#initialize(options = {}) ⇒ PayeezyGateway

Returns a new instance of PayeezyGateway.



28
29
30
31
# File 'lib/active_merchant/billing/gateways/payeezy.rb', line 28

def initialize(options = {})
  requires!(options, :apikey, :apisecret, :token)
  super
end

Instance Method Details

#authorize(amount, creditcard, options = {}) ⇒ Object



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

def authorize(amount, creditcard, options = {})
  params = {transaction_type: 'authorize'}

  add_invoice(params, options)
  add_creditcard(params, creditcard)
  add_address(params, options)
  add_amount(params, amount, options)

  commit(params, options)
end

#capture(amount, authorization, options = {}) ⇒ Object



55
56
57
58
59
60
61
62
# File 'lib/active_merchant/billing/gateways/payeezy.rb', line 55

def capture(amount, authorization, options = {})
  params = {transaction_type: 'capture'}

  add_authorization_info(params, authorization)
  add_amount(params, amount, options)

  commit(params, options)
end

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



33
34
35
36
37
38
39
40
41
42
# File 'lib/active_merchant/billing/gateways/payeezy.rb', line 33

def purchase(amount, creditcard, options = {})
  params = {transaction_type: 'purchase'}

  add_invoice(params, options)
  add_creditcard(params, creditcard)
  add_address(params, options)
  add_amount(params, amount, options)

  commit(params, options)
end

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



64
65
66
67
68
69
70
71
# File 'lib/active_merchant/billing/gateways/payeezy.rb', line 64

def refund(amount, authorization, options = {})
  params = {transaction_type: 'refund'}

  add_authorization_info(params, authorization)
  add_amount(params, (amount || amount_from_authorization(authorization)), options)

  commit(params, options)
end

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



73
74
75
76
77
78
79
80
# File 'lib/active_merchant/billing/gateways/payeezy.rb', line 73

def void(authorization, options = {})
  params = {transaction_type: 'refund'}

  add_authorization_info(params, authorization)
  add_amount(params, amount_from_authorization(authorization), options)

  commit(params, options)
end