1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-11-29 10:24:20 +01:00
fab-manager/lib/pay_zen/item.rb
2021-06-04 18:26:20 +02:00

38 lines
664 B
Ruby

# frozen_string_literal: true
require 'payment/item'
require 'pay_zen/order'
require 'pay_zen/subscription'
require 'pay_zen/token'
require 'pay_zen/transaction'
# PayZen payement gateway
module PayZen; end
## generic wrapper around PayZen classes
class PayZen::Item < Payment::Item
attr_accessor :id
def retrieve(id = nil, *args)
@id ||= id
@args ||= args
params = [@id].concat(@args)
params.compact!
client = klass.constantize.new
client.get(*params)
end
def payment_mean?
klass == 'PayZen::Token'
end
def subscription?
klass == 'PayZen::Subscription'
end
def order?
klass == 'PayZen::Order'
end
end