Class: Gateway::AdyenHPP
- Inherits:
-
Gateway
- Object
- Gateway
- Gateway::AdyenHPP
- Defined in:
- app/models/spree/gateway/adyen_hpp.rb
Overview
Gateway for Adyen Hosted Payment Pages solution
Instance Method Summary collapse
- #authorize(amount, source, gateway_options) ⇒ Object
- #cancel(psp_reference, _gateway_options = {}) ⇒ Object
- #capture(amount, psp_reference, currency:, **_opts) ⇒ Object
- #credit(amount, psp_reference, currency:, **_opts) ⇒ Object
- #merchant_account ⇒ Object
- #method_type ⇒ Object
- #provider ⇒ Object
- #provider_class ⇒ Object
- #shared_secret ⇒ Object
- #ship_before_date ⇒ Object
- #skin_code ⇒ Object
Instance Method Details
#authorize(amount, source, gateway_options) ⇒ Object
46 47 48 49 50 51 52 |
# File 'app/models/spree/gateway/adyen_hpp.rb', line 46 def (amount, source, ) # to get around the order checking for processed payments we create payments # in the checkout state and allow the payment method to attempt to auth # them here. We just return a dummy response here because the payment has # already been authorized ActiveMerchant::Billing::Response.new(true, "successful hpp payment") end |
#cancel(psp_reference, _gateway_options = {}) ⇒ Object
62 63 64 65 66 |
# File 'app/models/spree/gateway/adyen_hpp.rb', line 62 def cancel(psp_reference, = {}) handle_response( provider.cancel_or_refund_payment(psp_reference), psp_reference) end |
#capture(amount, psp_reference, currency:, **_opts) ⇒ Object
54 55 56 57 58 59 60 |
# File 'app/models/spree/gateway/adyen_hpp.rb', line 54 def capture(amount, psp_reference, currency:, **_opts) value = { currency: currency, value: amount } handle_response( provider.capture_payment(psp_reference, value), psp_reference) end |
#credit(amount, psp_reference, currency:, **_opts) ⇒ Object
68 69 70 71 72 73 74 |
# File 'app/models/spree/gateway/adyen_hpp.rb', line 68 def credit(amount, psp_reference, currency:, **_opts) amount = { currency: currency, value: amount } handle_response( provider.refund_payment(psp_reference, amount), psp_reference) end |
#merchant_account ⇒ Object
11 12 13 |
# File 'app/models/spree/gateway/adyen_hpp.rb', line 11 def merchant_account ENV["ADYEN_MERCHANT_ACCOUNT"] || preferred_merchant_account end |
#method_type ⇒ Object
30 31 32 |
# File 'app/models/spree/gateway/adyen_hpp.rb', line 30 def method_type "adyen" end |
#provider ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'app/models/spree/gateway/adyen_hpp.rb', line 19 def provider ::Adyen.configuration.api_username = (ENV["ADYEN_API_USERNAME"] || preferred_api_username) ::Adyen.configuration.api_password = (ENV["ADYEN_API_PASSWORD"] || preferred_api_password) ::Adyen.configuration.default_api_params[:merchant_account] = merchant_account provider_class end |
#provider_class ⇒ Object
15 16 17 |
# File 'app/models/spree/gateway/adyen_hpp.rb', line 15 def provider_class ::Adyen::API end |
#shared_secret ⇒ Object
34 35 36 |
# File 'app/models/spree/gateway/adyen_hpp.rb', line 34 def shared_secret ENV["ADYEN_SHARED_SECRET"] || preferred_shared_secret end |
#ship_before_date ⇒ Object
42 43 44 |
# File 'app/models/spree/gateway/adyen_hpp.rb', line 42 def ship_before_date preferred_days_to_ship.days.from_now end |
#skin_code ⇒ Object
38 39 40 |
# File 'app/models/spree/gateway/adyen_hpp.rb', line 38 def skin_code ENV["ADYEN_SKIN_CODE"] || preferred_skin_code end |