1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-02-08 02:54:18 +01:00
fab-manager/app/services/payment_gateway_service.rb

38 lines
955 B
Ruby

# frozen_string_literal: true
require 'stripe/helper'
require 'pay_zen/helper'
# create remote items on currently active payment gateway
class PaymentGatewayService
def initialize
service = 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
@gateway = service.new
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