Skip to content

Instantly share code, notes, and snippets.

@gtan66
Last active October 5, 2020 21:53
Show Gist options
  • Save gtan66/c976cfc9f3a66f36dd8a to your computer and use it in GitHub Desktop.
Save gtan66/c976cfc9f3a66f36dd8a to your computer and use it in GitHub Desktop.
def cancel_future_move_in_with_active_sd_invoice(account_uuid, office_num)
a = Account.find_by(uuid: account_uuid)
pr = a.primary_reservations.all.detect { |r| r.reservable.name == office_num }
sdr = pr.children.where(reservable: Resource.security_deposit).last
sdr.invoices.can_delete.each{|ei| ei.destroy! }
sdr.reload.archive!
ReservationService.new.archive!(pr, nil, true)
pr.reservable.occupancy.refresh
pr.reservable.occupancy.publish_entity(true)
end
#https://weworkengine.zendesk.com/agent/tickets/998
#https://wework.atlassian.net/browse/SM-132
cancel_future_move_in_with_active_sd_invoice("c602d499-a653-4fb5-9c6a-742642c84445", "1137")
#https://weworkengine.zendesk.com/agent/tickets/994
#https://wework.atlassian.net/browse/SM-133
cancel_future_move_in_with_active_sd_invoice("9138e1d0-c46f-0132-0b1d-5a0957d574b3", "405")
#https://wework.atlassian.net/browse/SM-131
rake 'one_time:update_account_info[HMKWDU, IMN Holding B.V.]'
@Whitespace
Copy link

Please remove this or make it a private gist as this is publicly searchable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment