mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2024-12-01 12:24:28 +01:00
38 lines
664 B
Ruby
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
|