Class: PartnerService::Bills::CalculateService

Inherits:
ApplicationService show all
Defined in:
app/services/partner_service/bills/calculate_service.rb

Instance Attribute Summary

Attributes inherited from ApplicationService

#object

Instance Method Summary collapse

Methods inherited from ApplicationService

#execute, #execute!

Constructor Details

#initialize(reservations, date) ⇒ CalculateService

Returns a new instance of CalculateService.



7
8
9
10
11
# File 'app/services/partner_service/bills/calculate_service.rb', line 7

def initialize(reservations, date)
  @start_date = date.beginning_of_month
  @end_date = date.end_of_month
  @reservations = reservations.where(date: @start_date..@end_date)
end

Instance Method Details

#calculateObject



13
14
15
16
17
18
19
20
# File 'app/services/partner_service/bills/calculate_service.rb', line 13

def calculate
  {
    total_price: total_price,
    total_due_amount: total_due_amount,
    package: package,
    total_prepayment_and_codes: total_prepayment_and_codes,
  }
end