2020-12-22 14:43:08 +01:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
# SuperClass for models that provides legal PDF documents concerning sales
|
|
|
|
class PaymentDocument < Footprintable
|
|
|
|
self.abstract_class = true
|
|
|
|
|
2023-03-21 15:11:08 +01:00
|
|
|
def generate_reference(date = created_at)
|
2020-12-22 14:43:08 +01:00
|
|
|
self.reference = PaymentDocumentService.generate_reference(self, date: date)
|
|
|
|
end
|
|
|
|
|
2023-03-24 17:21:44 +01:00
|
|
|
def generate_order_number
|
|
|
|
self.order_number = PaymentDocumentService.generate_order_number(self)
|
|
|
|
end
|
|
|
|
|
2020-12-22 14:43:08 +01:00
|
|
|
def update_reference
|
2023-03-27 17:18:44 +02:00
|
|
|
generate_reference if reference.blank?
|
2020-12-22 14:43:08 +01:00
|
|
|
save
|
|
|
|
end
|
|
|
|
|
|
|
|
def add_environment
|
|
|
|
self.environment = Rails.env
|
|
|
|
end
|
|
|
|
|
|
|
|
def set_wallet_transaction(amount, transaction_id)
|
2020-12-29 18:55:00 +01:00
|
|
|
self.wallet_amount = amount
|
|
|
|
self.wallet_transaction_id = transaction_id
|
2020-12-22 14:43:08 +01:00
|
|
|
end
|
2020-12-29 18:55:00 +01:00
|
|
|
|
2021-10-15 17:31:01 +02:00
|
|
|
def post_save(*args); end
|
2021-05-28 17:34:20 +02:00
|
|
|
|
|
|
|
def render_resource; end
|
2020-12-22 14:43:08 +01:00
|
|
|
end
|