Class: OffsitePayments::Integrations::MollieIdeal::Helper
- Inherits:
-
OffsitePayments::Integrations::Mollie::Helper
- Object
- Helper
- OffsitePayments::Integrations::Mollie::Helper
- OffsitePayments::Integrations::MollieIdeal::Helper
- Defined in:
- lib/offsite_payments/integrations/mollie_ideal.rb
Instance Attribute Summary collapse
-
#redirect_parameters ⇒ Object
readonly
Returns the value of attribute redirect_parameters.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
-
#transaction_id ⇒ Object
readonly
Returns the value of attribute transaction_id.
Attributes inherited from Helper
Instance Method Summary collapse
-
#initialize(order, account, options = {}) ⇒ Helper
constructor
A new instance of Helper.
- #request_redirect ⇒ Object
Methods inherited from OffsitePayments::Integrations::Mollie::Helper
#credential_based_url, #form_method
Methods inherited from Helper
#add_field, #add_fields, #add_raw_html_field, #billing_address, #form_fields, #form_method, inherited, mapping, #raw_html_fields, #shipping_address, #test?
Methods included from MoneyCompatibility
Constructor Details
#initialize(order, account, options = {}) ⇒ Helper
Returns a new instance of Helper.
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/offsite_payments/integrations/mollie_ideal.rb', line 67 def initialize(order, account, = {}) @token = account @redirect_parameters = { :amount => [:amount], :description => [:description], :issuer => [:redirect_param], :redirectUrl => [:return_url], :method => 'ideal', :metadata => { :order => order } } @redirect_parameters[:webhookUrl] = [:notify_url] if [:notify_url] super raise ArgumentError, "The redirect_param option needs to be set to the bank_id the customer selected." if [:redirect_param].blank? raise ArgumentError, "The return_url option needs to be set." if [:return_url].blank? raise ArgumentError, "The description option needs to be set." if [:description].blank? end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class OffsitePayments::Helper
Instance Attribute Details
#redirect_parameters ⇒ Object (readonly)
Returns the value of attribute redirect_parameters.
65 66 67 |
# File 'lib/offsite_payments/integrations/mollie_ideal.rb', line 65 def redirect_parameters @redirect_parameters end |
#token ⇒ Object (readonly)
Returns the value of attribute token.
65 66 67 |
# File 'lib/offsite_payments/integrations/mollie_ideal.rb', line 65 def token @token end |
#transaction_id ⇒ Object (readonly)
Returns the value of attribute transaction_id.
65 66 67 |
# File 'lib/offsite_payments/integrations/mollie_ideal.rb', line 65 def transaction_id @transaction_id end |
Instance Method Details
#request_redirect ⇒ Object
87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/offsite_payments/integrations/mollie_ideal.rb', line 87 def request_redirect MollieIdeal.create_payment(token, redirect_parameters) rescue ActiveUtils::ResponseError => e case e.response.code when '401', '403', '422' error = JSON.parse(e.response.body)['error']['message'] raise ActionViewHelperError, error when '503' raise ActionViewHelperError, 'Service temporarily unavailable. Please try again.' else raise end end |