Class: ActiveMerchant::Billing::JetpayGateway

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

Constant Summary collapse

TEST_URL =
'https://test1.jetpay.com/jetpay'
LIVE_URL =
'https://gateway17.jetpay.com/jetpay'
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."
}

Constants inherited from Gateway

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 Utils

generate_unique_id

Methods included from CreditCardFormatting

#format

Methods included from RequiresParameters

#requires!

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.



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

def initialize(options = {})
  requires!(options, :login)
  @options = options
  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
95
96
97
98
# 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)
    transaction_id = transaction_id_or_card.split(";").first
    credit_card = options[:credit_card]
  else
    transaction_id = nil
    credit_card = transaction_id_or_card
  end

  commit(money, build_credit_request('CREDIT', money, transaction_id, credit_card))
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

#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