class ActiveMerchant::Billing::ModernPaymentsGateway

Public Class Methods

new(options = {}) click to toggle source
Calls superclass method ActiveMerchant::Billing::Gateway::new
# File lib/active_merchant/billing/gateways/modern_payments.rb, line 13
def initialize(options = {})
  requires!(options, :login, :password)
  super
end

Public Instance Methods

purchase(money, credit_card, options = {}) click to toggle source
# File lib/active_merchant/billing/gateways/modern_payments.rb, line 18
def purchase(money, credit_card, options = {})
  customer_response = cim.create_customer(options)
  return customer_response unless customer_response.success?

  customer_id = customer_response.params["create_customer_result"]

  card_response = cim.modify_customer_credit_card(customer_id, credit_card)
  return card_response unless card_response.success?

  cim.authorize_credit_card_payment(customer_id, money)
end

Private Instance Methods

cim() click to toggle source
# File lib/active_merchant/billing/gateways/modern_payments.rb, line 31
def cim
  @cim ||= ModernPaymentsCimGateway.new(@options)
end