Module: Spree::Adyen::HPP

Defined in:
lib/spree/adyen/hpp.rb

Constant Summary collapse

HPP =
::Adyen::HPP
UrlHelper =
Object.new.extend ActionView::Helpers::UrlHelper

Class Method Summary collapse

Class Method Details

.details_url(order, payment_method, brand_code) ⇒ Object



26
27
28
29
# File 'lib/spree/adyen/hpp.rb', line 26

def details_url order, payment_method, brand_code
  endpoint_url(
    "details", order, payment_method, { brandCode: brand_code })
end

.details_url_with_issuer(order, payment_method, brand_code, issuer_id) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
# File 'lib/spree/adyen/hpp.rb', line 31

def details_url_with_issuer order, payment_method, brand_code, issuer_id
  endpoint_url(
    "details",
    order,
    payment_method,
    {
      brandCode: brand_code,
      issuerId: issuer_id
    }
  )
end

.directory_url(order, payment_method) ⇒ Object



22
23
24
# File 'lib/spree/adyen/hpp.rb', line 22

def directory_url order, payment_method
  endpoint_url "directory", order, payment_method
end

.endpoint_url(endpoint, order, payment_method, opts = {}) ⇒ Object



43
44
45
46
47
# File 'lib/spree/adyen/hpp.rb', line 43

def endpoint_url endpoint, order, payment_method, opts = {}
  adyen_request = hpp_request order, payment_method, opts

  URI::parse("#{adyen_request.url(endpoint)}?#{adyen_request.flat_payment_parameters.to_query}")
end

.pay_url(order, payment_method) ⇒ Object



14
15
16
# File 'lib/spree/adyen/hpp.rb', line 14

def pay_url order, payment_method
  endpoint_url "pay", order, payment_method
end

.payment_methods_from_directory(order, payment_method) ⇒ Object



10
11
12
# File 'lib/spree/adyen/hpp.rb', line 10

def payment_methods_from_directory order, payment_method
  payment_methods(order, payment_method)
end

.select_url(order, payment_method) ⇒ Object



18
19
20
# File 'lib/spree/adyen/hpp.rb', line 18

def select_url order, payment_method
  endpoint_url "select", order, payment_method
end