Class: ActiveMerchant::Billing::QuickpayGateway

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

Constant Summary

MD5_CHECK_FIELDS =
{
  3 => {
    :authorize => %w(protocol msgtype merchant ordernumber amount
                     currency autocapture cardnumber expirationdate
                     cvd cardtypelock testmode),

    :capture   => %w(protocol msgtype merchant amount transaction),

    :cancel    => %w(protocol msgtype merchant transaction),

    :refund    => %w(protocol msgtype merchant amount transaction),

    :subscribe => %w(protocol msgtype merchant ordernumber cardnumber
                     expirationdate cvd cardtypelock description testmode),

    :recurring => %w(protocol msgtype merchant ordernumber amount
                     currency autocapture transaction),

    :status    => %w(protocol msgtype merchant transaction),

    :chstatus  => %w(protocol msgtype merchant)
  },

  4 => {
    :authorize => %w(protocol msgtype merchant ordernumber amount
                     currency autocapture cardnumber expirationdate cvd
                     cardtypelock testmode fraud_remote_addr
                     fraud_http_accept fraud_http_accept_language
                     fraud_http_accept_encoding fraud_http_accept_charset
                     fraud_http_referer fraud_http_user_agent apikey),

    :capture   => %w(protocol msgtype merchant amount transaction apikey),

    :cancel    => %w(protocol msgtype merchant transaction apikey),

    :refund    => %w(protocol msgtype merchant amount transaction apikey),

    :subscribe => %w(protocol msgtype merchant ordernumber cardnumber
                     expirationdate cvd cardtypelock description testmode
                     fraud_remote_addr fraud_http_accept fraud_http_accept_language
                     fraud_http_accept_encoding fraud_http_accept_charset
                     fraud_http_referer fraud_http_user_agent apikey),

    :recurring => %w(protocol msgtype merchant ordernumber amount currency
                     autocapture transaction apikey),

    :status    => %w(protocol msgtype merchant transaction apikey),

    :chstatus  => %w(protocol msgtype merchant apikey)
  },

  5 => {
    :authorize => %w(protocol msgtype merchant ordernumber amount
                     currency autocapture cardnumber expirationdate cvd
                     cardtypelock testmode fraud_remote_addr
                     fraud_http_accept fraud_http_accept_language
                     fraud_http_accept_encoding fraud_http_accept_charset
                     fraud_http_referer fraud_http_user_agent apikey),

    :capture   => %w(protocol msgtype merchant amount transaction apikey),

    :cancel    => %w(protocol msgtype merchant transaction apikey),

    :refund    => %w(protocol msgtype merchant amount transaction apikey),

    :subscribe => %w(protocol msgtype merchant ordernumber cardnumber
                     expirationdate cvd cardtypelock description testmode
                     fraud_remote_addr fraud_http_accept fraud_http_accept_language
                     fraud_http_accept_encoding fraud_http_accept_charset
                     fraud_http_referer fraud_http_user_agent apikey),

    :recurring => %w(protocol msgtype merchant ordernumber amount currency
                     autocapture transaction apikey),

    :status    => %w(protocol msgtype merchant transaction apikey),

    :chstatus  => %w(protocol msgtype merchant apikey)
  },

  6 => {
    :authorize => %w(protocol msgtype merchant ordernumber amount
                     currency autocapture cardnumber expirationdate cvd
                     cardtypelock testmode fraud_remote_addr
                     fraud_http_accept fraud_http_accept_language
                     fraud_http_accept_encoding fraud_http_accept_charset
                     fraud_http_referer fraud_http_user_agent apikey),

    :capture   => %w(protocol msgtype merchant amount transaction
                     apikey),

    :cancel    => %w(protocol msgtype merchant transaction apikey),

    :refund    => %w(protocol msgtype merchant amount transaction apikey),

    :subscribe => %w(protocol msgtype merchant ordernumber cardnumber
                     expirationdate cvd cardtypelock description testmode
                     fraud_remote_addr fraud_http_accept fraud_http_accept_language
                     fraud_http_accept_encoding fraud_http_accept_charset
                     fraud_http_referer fraud_http_user_agent apikey),

    :recurring => %w(protocol msgtype merchant ordernumber amount currency
                     autocapture transaction apikey),

    :status    => %w(protocol msgtype merchant transaction apikey),

    :chstatus  => %w(protocol msgtype merchant apikey)
  },
  
  7 => {
    :authorize => %w(protocol msgtype merchant ordernumber amount
                     currency autocapture cardnumber expirationdate cvd
                     acquirer cardtypelock testmode fraud_remote_addr
                     fraud_http_accept fraud_http_accept_language
                     fraud_http_accept_encoding fraud_http_accept_charset
                     fraud_http_referer fraud_http_user_agent apikey),

    :capture   => %w(protocol msgtype merchant amount transaction
                     apikey),

    :cancel    => %w(protocol msgtype merchant transaction apikey),

    :refund    => %w(protocol msgtype merchant amount transaction apikey),

    :subscribe => %w(protocol msgtype merchant ordernumber cardnumber
                     expirationdate cvd acquirer cardtypelock description testmode
                     fraud_remote_addr fraud_http_accept fraud_http_accept_language
                     fraud_http_accept_encoding fraud_http_accept_charset
                     fraud_http_referer fraud_http_user_agent apikey),

    :recurring => %w(protocol msgtype merchant ordernumber amount currency
                     autocapture transaction apikey),

    :status    => %w(protocol msgtype merchant transaction apikey),

    :chstatus  => %w(protocol msgtype merchant apikey)
  }        
}
APPROVED =
'000'

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 = {}) ⇒ QuickpayGateway

The login is the QuickpayId The password is the md5checkword from the Quickpay manager To use the API-key from the Quickpay manager, specify :api-key Using the API-key, requires that you use version 4+. Specify :version => 4/5/6/7 in options.



160
161
162
163
164
# File 'lib/active_merchant/billing/gateways/quickpay.rb', line 160

def initialize(options = {})
  requires!(options, :login, :password)
  @protocol = options.delete(:version) || 7 # default to protocol version 7
  super
end

Instance Method Details

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



166
167
168
169
170
171
172
173
174
175
176
177
178
179
# File 'lib/active_merchant/billing/gateways/quickpay.rb', line 166

def authorize(money, credit_card_or_reference, options = {})
  post = {}

  action = recurring_or_authorize(credit_card_or_reference)

  add_amount(post, money, options)
  add_invoice(post, options)
  add_creditcard_or_reference(post, credit_card_or_reference, options)
  add_autocapture(post, false)
  add_fraud_parameters(post, options) if action.eql?(:authorize)
  add_testmode(post)

  commit(action, post)
end

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



195
196
197
198
199
200
201
# File 'lib/active_merchant/billing/gateways/quickpay.rb', line 195

def capture(money, authorization, options = {})
  post = {}

  add_reference(post, authorization)
  add_amount_without_currency(post, money)
  commit(:capture, post)
end

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



220
221
222
223
# File 'lib/active_merchant/billing/gateways/quickpay.rb', line 220

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

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



181
182
183
184
185
186
187
188
189
190
191
192
193
# File 'lib/active_merchant/billing/gateways/quickpay.rb', line 181

def purchase(money, credit_card_or_reference, options = {})
  post = {}

  action = recurring_or_authorize(credit_card_or_reference)

  add_amount(post, money, options)
  add_creditcard_or_reference(post, credit_card_or_reference, options)
  add_invoice(post, options)
  add_fraud_parameters(post, options) if action.eql?(:authorize)
  add_autocapture(post, true)

  commit(action, post)
end

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



211
212
213
214
215
216
217
218
# File 'lib/active_merchant/billing/gateways/quickpay.rb', line 211

def refund(money, identification, options = {})
  post = {}

  add_amount_without_currency(post, money)
  add_reference(post, identification)

  commit(:refund, post)
end

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



225
226
227
228
229
230
231
232
233
234
235
# File 'lib/active_merchant/billing/gateways/quickpay.rb', line 225

def store(creditcard, options = {})
  post = {}

  add_creditcard(post, creditcard, options)
  add_invoice(post, options)
  add_description(post, options)
  add_fraud_parameters(post, options)
  add_testmode(post)

  commit(:subscribe, post)
end

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



203
204
205
206
207
208
209
# File 'lib/active_merchant/billing/gateways/quickpay.rb', line 203

def void(identification, options = {})
  post = {}

  add_reference(post, identification)

  commit(:cancel, post)
end