2021-04-20 17:22:53 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'payment/item'
|
|
|
|
|
|
|
|
# Stripe payement gateway
|
|
|
|
module Stripe; end
|
|
|
|
|
|
|
|
## generic wrapper around Stripe classes
|
|
|
|
class Stripe::Item < Payment::Item
|
|
|
|
attr_accessor :id
|
|
|
|
|
2021-06-03 09:48:21 +02:00
|
|
|
def retrieve(id = nil, *_args)
|
2021-04-20 17:22:53 +02:00
|
|
|
@id ||= id
|
|
|
|
klass.constantize.retrieve(@id, api_key: Setting.get('stripe_secret_key'))
|
|
|
|
end
|
2021-04-23 12:52:06 +02:00
|
|
|
|
|
|
|
def payment_mean?
|
2021-09-30 14:46:47 +02:00
|
|
|
klass == 'Stripe::PaymentMethod'
|
2021-04-23 12:52:06 +02:00
|
|
|
end
|
2021-06-04 18:26:20 +02:00
|
|
|
|
|
|
|
def subscription?
|
|
|
|
klass == 'Stripe::Subscription'
|
|
|
|
end
|
2021-04-20 17:22:53 +02:00
|
|
|
end
|