1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-28 17:52:21 +01:00
fab-manager/app/services/payment_gateway_service.rb
Sylvain e3187460ea create payment schedules on payzen
Also: make generic the creation of products on remote gateway
Also: make generic the call to gateway specific actions
2021-04-30 16:07:19 +02:00

34 lines
888 B
Ruby

# frozen_string_literal: true
# create remote items on currently active payment gateway
class PaymentGatewayService
def initialize
@gateway = if Stripe::Helper.enabled?
require 'stripe/service'
Stripe::Service
elsif PayZen::Helper.enabled?
require 'pay_zen/service'
PayZen::Service
else
require 'payment/service'
Payment::Service
end
end
def create_subscription(payment_schedule, gateway_object_id)
@gateway.create_subscription(payment_schedule, gateway_object_id)
end
def create_coupon(coupon_id)
@gateway.create_coupon(coupon_id)
end
def delete_coupon(coupon_id)
@gateway.delete_coupon(coupon_id)
end
def create_or_update_product(klass, id)
@gateway.create_or_update_product(klass, id)
end
end