def cancel_booking_request(sender, receiver, listing): """Bad news! <a href="/artists/profile/{id}">{name}</a> cancelled your appointment for <a href="/listings/{listing_id}">{title}</a>. Your money will be refunded in 24 hours. As a little compensation from our side, your next booking will be with 5% discount from the regular price.""" """We are sorry to bring bad news! <a href="/users/profile/{id}">{name}</a> cancelled the appointment for <a href="/listings/{listing_id}">{title}</a>. As a compensation, in 24 hours you will receive 50% of the price of the booking.""" if sender.related_with == "artists": data = {"id": sender.artist.id, "name": sender.first_name, "listing_id": listing.id, "title": listing.title} Notification.objects.create( sender=sender, receiver=receiver, short_text=NOTIFICATIONS_SHORT[3].format(**data), long_text=NOTIFICATIONS_LONG[3].format(**data), ) # SMS profile = receiver.profile mobile = profile.mobile_number if profile.enable_sms and mobile and mobile[0] == "+": client = get_twilio() client.messages.create(to=mobile, from_=TWILIO_NUMBER, body=SMS[3].format(**data)) elif sender.related_with == "profiles": data = {"id": sender.profile.id, "name": sender.first_name, "listing_id": listing.id, "title": listing.title} Notification.objects.create( sender=sender, receiver=receiver, short_text=NOTIFICATIONS_SHORT[4].format(**data), long_text=NOTIFICATIONS_LONG[4].format(**data), ) # SMS artist = receiver.artist mobile = artist.mobile_number if artist.enable_sms and mobile and mobile[0] == "+": client = get_twilio() client.messages.create(to=mobile, from_=TWILIO_NUMBER, body=SMS[4].format(**data))
def cancel_booking_request(sender, receiver, listing): '''Bad news! <a href="/artists/profile/{id}">{name}</a> cancelled your appointment for <a href="/listings/{listing_id}">{title}</a>. Your money will be refunded in 24 hours. As a little compensation from our side, your next booking will be with 5% discount from the regular price.''' '''We are sorry to bring bad news! <a href="/users/profile/{id}">{name}</a> cancelled the appointment for <a href="/listings/{listing_id}">{title}</a>. As a compensation, in 24 hours you will receive 50% of the price of the booking.''' if sender.related_with == 'artists': data = { "id": sender.artist.id, "name": sender.first_name, "listing_id": listing.id, "title": listing.title, } Notification.objects.create( sender=sender, receiver=receiver, short_text=NOTIFICATIONS_SHORT[3].format(**data), long_text=NOTIFICATIONS_LONG[3].format(**data), ) # SMS profile = receiver.profile mobile = profile.mobile_number if profile.enable_sms and mobile and mobile[0] == '+': client = get_twilio() client.messages.create( to=mobile, from_=TWILIO_NUMBER, body=SMS[3].format(**data), ) elif sender.related_with == 'profiles': data = { "id": sender.profile.id, "name": sender.first_name, "listing_id": listing.id, "title": listing.title, } Notification.objects.create( sender=sender, receiver=receiver, short_text=NOTIFICATIONS_SHORT[4].format(**data), long_text=NOTIFICATIONS_LONG[4].format(**data), ) # SMS artist = receiver.artist mobile = artist.mobile_number if artist.enable_sms and mobile and mobile[0] == '+': client = get_twilio() client.messages.create( to=mobile, from_=TWILIO_NUMBER, body=SMS[4].format(**data), )
def decline_booking_request(sender, receiver, listing): data = {"id": sender.artist.id, "name": sender.first_name, "listing_id": listing.id, "title": listing.title} Notification.objects.create( sender=sender, receiver=receiver, short_text=NOTIFICATIONS_SHORT[2].format(**data), long_text=NOTIFICATIONS_LONG[2].format(**data), ) # SMS profile = receiver.profile mobile = profile.mobile_number if profile.enable_sms and mobile and mobile[0] == "+": client = get_twilio() client.messages.create(to=mobile, from_=TWILIO_NUMBER, body=SMS[2].format(**data))
def accept_booking_request(sender, receiver, listing): data = { "id": sender.artist.id, "name": sender.first_name, "listing_id": listing.id, "title": listing.title, } Notification.objects.create( sender=sender, receiver=receiver, short_text=NOTIFICATIONS_SHORT[1].format(**data), long_text=NOTIFICATIONS_LONG[1].format(**data), ) # SMS profile = receiver.profile mobile = profile.mobile_number if profile.enable_sms and mobile and mobile[0] == '+': client = get_twilio() client.messages.create( to=mobile, from_=TWILIO_NUMBER, body=SMS[1].format(**data), )