Class: ActiveMerchant::Billing::AdyenGateway
- Inherits:
-
Gateway
- Object
- Gateway
- ActiveMerchant::Billing::AdyenGateway
show all
- Defined in:
- lib/active_merchant/billing/gateways/adyen.rb
Constant Summary
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
-
#authorize(money, creditcard, options = {}) ⇒ Object
-
#capture(money, authorization, options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ AdyenGateway
constructor
A new instance of AdyenGateway.
-
#purchase(money, creditcard, options = {}) ⇒ Object
-
#refund(money, authorization, options = {}) ⇒ Object
-
#verify(creditcard, options = {}) ⇒ Object
-
#void(identification, options = {}) ⇒ Object
Methods inherited from Gateway
#card_brand, card_brand, #generate_unique_id, inherited, non_fractional_currency?, #scrub, supported_countries, #supported_countries, supported_countries=, supports?, #supports_scrubbing?, #test?
#expdate, #format
Methods included from PostsData
included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request
Constructor Details
#initialize(options = {}) ⇒ AdyenGateway
Returns a new instance of AdyenGateway.
15
16
17
18
|
# File 'lib/active_merchant/billing/gateways/adyen.rb', line 15
def initialize(options = {})
requires!(options, :company, :merchant, :password)
super
end
|
Instance Method Details
#authorize(money, creditcard, options = {}) ⇒ Object
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/active_merchant/billing/gateways/adyen.rb', line 29
def authorize(money, creditcard, options = {})
requires!(options, :order_id)
post = {}
post[:paymentRequest] = payment_request(money, options)
post[:paymentRequest][:amount] = amount_hash(money, options[:currency])
post[:paymentRequest][:card] = credit_card_hash(creditcard)
if address = (options[:billing_address] || options[:address])
post[:paymentRequest][:billingAddress] = address_hash(address)
end
if options[:shipping_address]
post[:paymentRequest][:deliveryAddress] = address_hash(options[:shipping_address])
end
commit('Payment.authorise', post)
end
|
#capture(money, authorization, options = {}) ⇒ Object
48
49
50
51
52
53
54
55
56
|
# File 'lib/active_merchant/billing/gateways/adyen.rb', line 48
def capture(money, authorization, options = {})
requires!(options, :order_id)
post = {}
post[:modificationRequest] = modification_request(authorization, options)
post[:modificationRequest][:modificationAmount] = amount_hash(money, options[:currency])
commit('Payment.capture', post)
end
|
#purchase(money, creditcard, options = {}) ⇒ Object
20
21
22
23
24
25
26
27
|
# File 'lib/active_merchant/billing/gateways/adyen.rb', line 20
def purchase(money, creditcard, options = {})
requires!(options, :order_id)
MultiResponse.run do |r|
r.process { authorize(money, creditcard, options) }
r.process { capture(money, r.authorization, options) }
end
end
|
#refund(money, authorization, options = {}) ⇒ Object
58
59
60
61
62
63
64
65
66
|
# File 'lib/active_merchant/billing/gateways/adyen.rb', line 58
def refund(money, authorization, options = {})
requires!(options, :order_id)
post = {}
post[:modificationRequest] = modification_request(authorization, options)
post[:modificationRequest][:modificationAmount] = amount_hash(money, options[:currency])
commit('Payment.refund', post)
end
|
#verify(creditcard, options = {}) ⇒ Object
77
78
79
|
# File 'lib/active_merchant/billing/gateways/adyen.rb', line 77
def verify(creditcard, options = {})
authorize(0, creditcard, options)
end
|
#void(identification, options = {}) ⇒ Object
68
69
70
71
72
73
74
75
|
# File 'lib/active_merchant/billing/gateways/adyen.rb', line 68
def void(identification, options = {})
requires!(options, :order_id)
post = {}
post[:modificationRequest] = modification_request(identification, options)
commit('Payment.cancel', post)
end
|