Class: ActiveMerchant::Billing::QuickpayV10Gateway

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

Constant Summary collapse

API_VERSION =
10

Constants included from QuickpayCommon

QuickpayCommon::MD5_CHECK_FIELDS, QuickpayCommon::RESPONSE_CODES

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 included from QuickpayCommon

#expdate, included

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

Returns a new instance of QuickpayV10Gateway.



12
13
14
15
# File 'lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb', line 12

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

Instance Method Details

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



28
29
30
31
32
33
34
35
36
# File 'lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb', line 28

def authorize(money, credit_card, options = {})
  MultiResponse.run(true) do |r|
    r.process { create_payment(money, options) }
    r.process {
      post = authorization_params(money, credit_card, options)
      commit(synchronized_path("/payments/#{r.authorization}/authorize"), post)
    }
  end
end

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



47
48
49
50
51
52
# File 'lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb', line 47

def capture(money, identification, options = {})
  post = {}
  add_amount(post, money, options)
  add_additional_params(:capture, post, options)
  commit(synchronized_path("/payments/#{identification}/capture"), post)
end

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



42
43
44
45
# File 'lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb', line 42

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

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



17
18
19
20
21
22
23
24
25
26
# File 'lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb', line 17

def purchase(money, credit_card, options = {})
  MultiResponse.run(true) do |r|
    r.process { create_payment(money, options) }
    r.process {
      post = authorization_params(money, credit_card, options)
      add_autocapture(post, true)
      commit(synchronized_path("/payments/#{r.authorization}/authorize"), post)
    }
  end
end

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



54
55
56
57
58
59
# File 'lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb', line 54

def refund(money, identification, options = {})
  post = {}
  add_amount(post, money, options)
  add_additional_params(:refund, post, options)
  commit(synchronized_path("/payments/#{identification}/refund"), post)
end

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



61
62
63
64
65
66
67
68
# File 'lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb', line 61

def store(credit_card, options = {})
  MultiResponse.run(true) do |r|  
    r.process { create_subscription(options) }
    r.process { 
      authorize_subscription(r.authorization, credit_card, options) 
    }
  end
end

#unstore(identification) ⇒ Object



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

def unstore(identification)
  commit(synchronized_path "/subscriptions/#{identification}/cancel")
end

#void(identification) ⇒ Object



38
39
40
# File 'lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb', line 38

def void(identification)
  commit(synchronized_path "/payments/#{identification}/cancel")
end