Class: ActiveMerchant::Billing::MollieGateway
- Includes:
- Empty
- Defined in:
- lib/active_merchant/billing/gateways/mollie.rb
Constant Summary collapse
- SOFT_DECLINE_REASONS =
%w[ insufficient_funds card_expired card_declined temporary_failure verification_required ].freeze
- AUTHORIZATION_PREFIX =
'Bearer '.freeze
- CONTENT_TYPE =
'application/json'.freeze
Constants inherited from Gateway
Gateway::CREDIT_DEPRECATION_MESSAGE, Gateway::RECURRING_DEPRECATION_MESSAGE, Gateway::STANDARD_ERROR_CODE
Instance Attribute Summary
Attributes inherited from Gateway
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ MollieGateway
constructor
A new instance of MollieGateway.
- #purchase(amount, payment_method, options = {}) ⇒ Object
- #recurring(amount, payment_method, options = {}) ⇒ Object
- #refund(amount, authorization, options = {}) ⇒ Object
- #void(authorization, options = {}) ⇒ Object
Methods inherited from Gateway
#add_field_to_post_if_present, #add_fields_to_post_if_present, #card_brand, card_brand, #generate_unique_id, inherited, #scrub, #supported_countries, supported_countries, supported_countries=, supports?, #supports_network_tokenization?, #supports_scrubbing?, #test?
Methods included from CreditCardFormatting
Methods included from PostsData
included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request
Constructor Details
#initialize(options = {}) ⇒ MollieGateway
Returns a new instance of MollieGateway.
26 27 28 29 30 |
# File 'lib/active_merchant/billing/gateways/mollie.rb', line 26 def initialize( = {}) requires!(, :api_key) super @api_key = [:api_key] end |
Instance Method Details
#purchase(amount, payment_method, options = {}) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/active_merchant/billing/gateways/mollie.rb', line 32 def purchase(amount, payment_method, = {}) return recurring(amount, payment_method, ) if recurring_payment?(payment_method, ) result = add_customer_to_payment(payment_method, ) return result if result.is_a?(Response) && !result.success? post = {} add_purchase_data(post, amount, payment_method, ) add_customer_data(post, result, ) add_payment_token(post, payment_method, ) add_addresses(post, ) commit('payments', post, ) end |
#recurring(amount, payment_method, options = {}) ⇒ Object
47 48 49 50 51 52 |
# File 'lib/active_merchant/billing/gateways/mollie.rb', line 47 def recurring(amount, payment_method, = {}) post = {} add_recurring_data(post, amount, payment_method, ) commit('payments', post, ) end |
#refund(amount, authorization, options = {}) ⇒ Object
54 55 56 57 58 59 |
# File 'lib/active_merchant/billing/gateways/mollie.rb', line 54 def refund(amount, , = {}) post = {} add_refund_data(post, amount, , ) commit("payments/#{}/refunds", post, ) end |
#void(authorization, options = {}) ⇒ Object
61 62 63 |
# File 'lib/active_merchant/billing/gateways/mollie.rb', line 61 def void(, = {}) commit("payments/#{}/cancel", {}, ) end |