Class: ActiveMerchant::Billing::JetpayGateway

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

Constant Summary collapse

ACTION_CODE_MESSAGES =
{
  "001" =>  "Refer to card issuer.",
  "002" =>  "Refer to card issuer, special condition.",
  "003" =>  "Pick up card.",
  "200" =>  "Deny - Pick up card.",
  "005" =>  "Do not honor.",
  "100" =>  "Deny.",
  "006" =>  "Error.",
  "181" =>  "Format error.",
  "007" =>  "Pickup card, special condition.",
  "104" =>  "Deny - New card issued.",
  "110" =>  "Invalid amount.",
  "014" =>  "Invalid account number (no such number).",
  "111" =>  "Invalid account.",
  "015" =>  "No such issuer.",
  "103" =>  "Deny - Invalid manual Entry 4DBC.",
  "182" =>  "Please wait.",
  "109" =>  "Invalid merchant.",
  "041" =>  "Pick up card (lost card).",
  "043" =>  "Pick up card (stolen card).",
  "051" =>  "Insufficient funds.",
  "052" =>  "No checking account.",
  "105" =>  "Deny - Account Cancelled.",
  "054" =>  "Expired Card.",
  "101" =>  "Expired Card.",
  "183" =>  "Invalid currency code.",
  "057" =>  "Transaction not permitted to cardholder.",
  "115" =>  "Service not permitted.",
  "062" =>  "Restricted card.",
  "189" =>  "Deny - Cancelled or Closed Merchant/SE.",
  "188" =>  "Deny - Expiration date required.",
  "125" =>  "Invalid effective date.",
  "122" =>  "Invalid card (CID) security code.",
  "400" =>  "Reversal accepted.",
  "992" =>  "DECLINE/TIMEOUT.",
  "107" =>  "Please Call Issuer.",
  "025" =>  "Transaction Not Found.",
  "981" =>  "AVS Error.",
  "913" =>  "Invalid Card Type.",
  "996" =>  "Terminal ID Not Found.",
  nil   =>  "No response returned (missing credentials?)."
}

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

#expdate, #format

Methods included from PostsData

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

Constructor Details

#initialize(options = {}) ⇒ JetpayGateway

Returns a new instance of JetpayGateway.



65
66
67
68
# File 'lib/active_merchant/billing/gateways/jetpay.rb', line 65

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

Instance Method Details

#authorize(money, credit_card, options = {}) ⇒ Object



74
75
76
# File 'lib/active_merchant/billing/gateways/jetpay.rb', line 74

def authorize(money, credit_card, options = {})
  commit(money, build_authonly_request(money, credit_card, options))
end

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



78
79
80
# File 'lib/active_merchant/billing/gateways/jetpay.rb', line 78

def capture(money, reference, options = {})
  commit(money, build_capture_request('CAPT', reference.split(";").first))
end

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



87
88
89
90
91
92
93
94
# File 'lib/active_merchant/billing/gateways/jetpay.rb', line 87

def credit(money, transaction_id_or_card, options = {})
  if transaction_id_or_card.is_a?(String)
    ActiveMerchant.deprecated CREDIT_DEPRECATION_MESSAGE
    refund(money, transaction_id_or_card, options)
  else
    commit(money, build_credit_request('CREDIT', money, nil, transaction_id_or_card))
  end
end

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



70
71
72
# File 'lib/active_merchant/billing/gateways/jetpay.rb', line 70

def purchase(money, credit_card, options = {})
  commit(money, build_sale_request(money, credit_card, options))
end

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



96
97
98
99
100
# File 'lib/active_merchant/billing/gateways/jetpay.rb', line 96

def refund(money, reference, options = {})
  transaction_id = reference.split(";").first
  credit_card = options[:credit_card]
  commit(money, build_credit_request('CREDIT', money, transaction_id, credit_card))
end

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



82
83
84
85
# File 'lib/active_merchant/billing/gateways/jetpay.rb', line 82

def void(reference, options = {})
  transaction_id, approval, amount = reference.split(";")
  commit(amount.to_i, build_void_request(amount.to_i, transaction_id, approval))
end