mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-01-28 17:52:21 +01:00
e3187460ea
Also: make generic the creation of products on remote gateway Also: make generic the call to gateway specific actions
34 lines
888 B
Ruby
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
|