2021-04-20 17:22:53 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'payment/item'
|
2021-06-02 20:07:53 +02:00
|
|
|
require 'pay_zen/order'
|
|
|
|
require 'pay_zen/subscription'
|
|
|
|
require 'pay_zen/token'
|
|
|
|
require 'pay_zen/transaction'
|
2021-04-20 17:22:53 +02:00
|
|
|
|
|
|
|
# PayZen payement gateway
|
|
|
|
module PayZen; end
|
|
|
|
|
|
|
|
## generic wrapper around PayZen classes
|
|
|
|
class PayZen::Item < Payment::Item
|
|
|
|
attr_accessor :id
|
|
|
|
|
2021-06-02 20:07:53 +02:00
|
|
|
def retrieve(id = nil, *args)
|
2021-04-20 17:22:53 +02:00
|
|
|
@id ||= id
|
2021-06-02 20:07:53 +02:00
|
|
|
@args ||= args
|
2021-06-03 09:48:21 +02:00
|
|
|
params = [@id].concat(@args)
|
|
|
|
params.compact!
|
|
|
|
|
2021-06-02 20:07:53 +02:00
|
|
|
client = klass.constantize.new
|
2021-06-03 09:48:21 +02:00
|
|
|
client.get(*params)
|
2021-04-20 17:22:53 +02:00
|
|
|
end
|
2021-04-23 12:52:06 +02:00
|
|
|
|
|
|
|
def payment_mean?
|
|
|
|
klass == 'PayZen::Token'
|
|
|
|
end
|
2021-06-04 18:26:20 +02:00
|
|
|
|
|
|
|
def subscription?
|
|
|
|
klass == 'PayZen::Subscription'
|
|
|
|
end
|
|
|
|
|
|
|
|
def order?
|
|
|
|
klass == 'PayZen::Order'
|
|
|
|
end
|
2021-04-20 17:22:53 +02:00
|
|
|
end
|