class DoctorStrange::Providers::Payment

Private Class Methods

configuration_class() click to toggle source
# File lib/doctor_strange/providers/payment.rb, line 22
def configuration_class
  ::DoctorStrange::Providers::Payment::Configuration
end

Public Instance Methods

check!() click to toggle source
# File lib/doctor_strange/providers/payment.rb, line 27
def check!
  check_required_values!
  check_communication!
rescue Exception => e
  raise PaymentException.new(e.message)
end

Private Instance Methods

check_communication!() click to toggle source
# File lib/doctor_strange/providers/payment.rb, line 40
def check_communication!
  Stripe.api_key = configuration.api_key
  Stripe::Customer.list(limit: 1)
rescue Stripe::AuthenticationError
  raise "Invalid API Key provided"
end
check_required_values!() click to toggle source
# File lib/doctor_strange/providers/payment.rb, line 36
def check_required_values!
  raise "The api_key is required" if configuration.api_key.empty?
end