first commit

This commit is contained in:
ExtraNetwork
2026-05-12 17:04:54 +03:00
commit e5c4b6aa13
1425 changed files with 284735 additions and 0 deletions

View File

@@ -0,0 +1,60 @@
<?php
namespace App\Core\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Config;
class AffiliateRequestMail extends Mailable
{
use Queueable, SerializesModels;
public $tries = 5;
public $timeout = 30;
protected $param;
public function __construct($param)
{
$this->param = $param;
}
public function build ()
{
try
{
$params = $this->param;
$mailParams = $params['mailViewParams'] ;
$mailData = $params['mailData'] ;
$mailSenderAddress = Config::get('app.mailSenderAddress') ;
$mailTitle = $mailData['to']["name"]. ' | Affiliate Request Mail';
app('translator')->setLocale(fillOnUndefined($params['mailViewParams'],'language', 'en'));
/*echo view('emails.affiliateRequestMail', compact('mailParams', 'mailTitle'));
die();*/
return $this->from($mailSenderAddress, 'Extranetwork')
->view('emails.affiliateRequestMail', compact('mailParams', 'mailTitle'))
->to($mailData['to']["email"], $mailData['to']["name"])
->bcc($mailData['bcc'])
->subject($mailTitle)
->with(['message' => $this]);
}
catch ( Exception $e )
{
$message = $e->getFile()." ".$e->getLine()." ".$e->getMessage();
Log::error($message);
return output( ['status' => -1, 'message' => $e->getMessage()] );
}
}
}

View File

@@ -0,0 +1,13 @@
<?php
namespace App\Core\Mail;
class BaseMail
{
public function __construct ()
{
}
}

View File

@@ -0,0 +1,85 @@
<?php
namespace App\Core\Mail;
use App\Exceptions\ApiErrorException;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Config;
class BookingCancellationConfirmCodeMail extends Mailable
{
use Queueable, SerializesModels;
public $tries = 5;
public $timeout = 30;
protected $param;
public function __construct($param)
{
$this->param = $param;
}
public function build()
{
try {
$params = $this->param;
$mailSenderAddress = Config::get('app.mailSenderAddress');
$bookingService = App::make('App\Core\Service\BookingService');
$userService = App::make('App\Core\Service\UserService');
$requestData = [
'criteria' => [
['field' => 'booking_code', 'condition' => '=', 'value' => $params['bookingCode']]
],
'with' => ['bookingProperty.propertyBrand', 'bookingContact'],
'firstRow' => true
];
$bookingDetail = $bookingService->select($requestData);
if ($bookingDetail['status'] != 'success' || empty($bookingDetail['data'])) {
throw new ApiErrorException('Booking not found.');
}
$bookingDetail = $bookingDetail['data'];
$mailParams = [
'to' => $bookingDetail['booking_contact']['email'],
'toNameSurname' => $bookingDetail['booking_contact']['nameSurname'],
'bcc' => [],
'confirmCode' => $params['confirmCode'],
'bookingId' => fillOnUndefined($bookingDetail, 'id'),
'propertyId' => fillOnUndefined($bookingDetail, 'property_id'),
'bookingCode' => fillOnUndefined($bookingDetail, 'booking_code'),
'locale' => fillOnUndefined($bookingDetail['booking_contact'], 'language_code', 'en'),
];
/*echo view('emails.bookingCancellationConfirmCode', compact('mailParams'));
die();*/
$mailParams['bcc'][] = 'channel@extranetwork.com';
return $this->from($mailSenderAddress, 'Extranetwork')
->view('emails.bookingCancellationConfirmCode', compact('mailParams'))
->to($mailParams['to'], $mailParams['toNameSurname'])
->bcc($mailParams['bcc'])
->subject(__('api-mailing-cancellation_confirm_code-subject', ['bookingCode' => $mailParams['bookingCode']], $mailParams['locale']));
} catch (Exception $e) {
$message = $e->getFile() . " " . $e->getLine() . " " . $e->getMessage();
Log::error($message);
return output(['status' => -1, 'message' => $e->getMessage()]);
}
}
}

View File

@@ -0,0 +1,123 @@
<?php
namespace App\Core\Mail;
use App\Exceptions\ApiErrorException;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Config;
class BookingCancellationRequestMail extends Mailable
{
use Queueable, SerializesModels;
public $tries = 5;
public $timeout = 30;
protected $param;
public function __construct($param)
{
$this->param = $param;
}
public function build()
{
try {
$params = $this->param;
$mailSenderAddress = Config::get('app.mailSenderAddress');
$bookingService = App::make('App\Core\Service\BookingService');
$userService = App::make('App\Core\Service\UserService');
$requestData = [
'criteria' => [
['field' => 'booking_code', 'condition' => '=', 'value' => $params['bookingCode']]
],
'with' => [
'bookingPayment', 'bookingRoom.roomRateMapping.propertyRoom', 'bookingRoom.roomRateMapping.propertyRoomRate',
'bookingContact', 'bookingProperty.propertyBrand', 'bookingProperty.propertyExecutive', 'bookingProperty.propertyUser.user',
'bookingPropertyWeb', 'propertyBookingEngine', 'propertyBookingChannel'
],
'firstRow' => true
];
$bookingDetail = $bookingService->select($requestData);
if ($bookingDetail['status'] != 'success' || empty($bookingDetail['data'])) {
throw new ApiErrorException('Booking not found.');
}
$bookingDetail = $bookingDetail['data'];
//Language
$userData = $bookingDetail['booking_property']['property_user'];
$firstUserData = reset($userData);
$bookingLanguageCode = fillOnUndefined($firstUserData['user'], 'language', 'en');
//Mail Contact Data
$bcc = [];
foreach ($userData as $user) {
if ($user['user']['email'] != $firstUserData['user']['email']) {
$bcc[] = $user['user']['email'];
}
}
$reservationExecutives = [];
if (isset($bookingDetail['booking_property']['property_executive'])) {
$reservationExecutives = collect($bookingDetail['booking_property']['property_executive'])
->where('executive_type_id', '=', '7')
->values()->all();
}
foreach ($reservationExecutives as $reservationExecutive) {
$bcc[] = $reservationExecutive['email'];
}
$mailData = [
'to' => [
'name' => $bookingDetail['booking_property']['name'],
'email' => $firstUserData['user']['email']
]
];
$mailParams = [
'to' => $firstUserData['user']['email'],
'bcc' => $bcc,
'toNameSurname' => $bookingDetail['booking_property']['name'],
'bookingContactNameSurname' => $bookingDetail['booking_contact']['nameSurname'],
'bookingCode' => fillOnUndefined($bookingDetail, 'booking_code'),
'locale' => $bookingLanguageCode,
];
$mailParams['detailUrl'] = config('app.client_server').'/app/network/reservation/'.$bookingDetail['id'].'?propertyid='.$bookingDetail['property_id'];
/*echo view('emails.bookingCancellationRequest', compact('mailParams'));
die();*/
$mailParams['bcc'][] = 'channel@extranetwork.com';
return $this->from($mailSenderAddress, 'Extranetwork')
->view('emails.bookingCancellationRequest', compact('mailParams'))
->to($mailParams['to'], $mailParams['toNameSurname'])
->bcc($mailParams['bcc'])
->subject(__('api-mailing-cancellation_request-subject', ['bookingCode' => $mailParams['bookingCode']], $mailParams['locale']));
} catch (Exception $e) {
$message = $e->getFile() . " " . $e->getLine() . " " . $e->getMessage();
Log::error($message);
return output(['status' => -1, 'message' => $e->getMessage()]);
}
}
}

View File

@@ -0,0 +1,54 @@
<?php
namespace App\Core\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Config;
class BookingEngineSearchReportMail extends Mailable
{
use Queueable, SerializesModels;
public $tries = 5;
public $timeout = 30;
protected $param;
public function __construct($param)
{
$this->param = $param;
}
public function build()
{
try {
$params = $this->param;
$mailSenderAddress = Config::get('app.mailSenderAddress');
/*echo view('emails.bookingEngineSearchReportMail', compact('params'));
die();*/
$bcc = $params['propertyUserEmail'];
return $this->from($mailSenderAddress, 'Extranetwork')
->view('emails.bookingEngineSearchReportMail', compact('params'))
->to($mailSenderAddress, 'Extranetwork')
->bcc($bcc)
->subject($params['propertyName'].' - Günlük İşlem Raporu : '. $params['date']);
} catch (Exception $e) {
$message = $e->getFile() . " " . $e->getLine() . " " . $e->getMessage();
Log::error($message);
return output(['status' => -1, 'message' => $e->getMessage()]);
}
}
}

View File

@@ -0,0 +1,120 @@
<?php
namespace App\Core\Mail;
use App\Exceptions\ApiErrorException;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Config;
class BookingInvoiceUpdateMail extends Mailable
{
use Queueable, SerializesModels;
public $tries = 5;
public $timeout = 30;
protected $param;
public function __construct($param)
{
$this->param = $param;
}
public function build()
{
try {
$params = $this->param;
$bookingService = App::make("App\Core\Service\BookingService");
$bookingDetailParam = [
'criteria' => [
['field' => 'booking_code', 'condition' => '=', 'value' => $params['bookingCode']],
],
'with' => ['property.propertyBrand', 'property.propertyExecutive', 'property.propertyUser.user','property.propertyBookingEngineToken'],
'firstRow' => true
];
$bookingDetail = $bookingService->select($bookingDetailParam);
if ($bookingDetail['status'] != 'success') {
throw new ApiErrorException($bookingDetail['message']);
}
$bookingDetail = $bookingDetail['status'] == 'success' && !empty($bookingDetail['data']) ? $bookingDetail['data'] : null;
$property = $bookingDetail['property'];
//Mail Contact Data
$reservationExecutives = [];
if (isset($property['property_executive'])) {
$reservationExecutives = collect($property['property_executive'])
->where('executive_type_id', '=', '7')
->values()->all();
}
foreach ($reservationExecutives as $reservationExecutive) {
$bcc[] = $reservationExecutive['email'];
}
$bcc[] = "channel@extranetwork.com";
$userData = $property['property_user'];
$firstUserData = reset($userData);
foreach ($userData as $user) {
if ($user['user']['email'] != $firstUserData['user']['email']) {
$bcc[] = $user['user']['email'];
}
}
$mailData = [
'to' => [
'name' => $firstUserData['user']['nameSurname'],
'email' => $firstUserData['user']['email'],
],
'bcc' => $bcc
];
$locale = fillOnUndefined($firstUserData['user'], 'language', 'tr');
$mailSenderAddress = Config::get('app.mailSenderAddress');
app('translator')->setLocale($locale);
$mailParams = [
'propertyName' => $property['name'],
'bookingCode' => $params['bookingCode'],
'logo' => $property['property_brand']['logoUrl'],
'btnUrl' => config('app.bookingEngineUrl') . '/' . $property['property_booking_engine_token']['token'] . '/' . $locale . '/booking-detail/' . $params['bookingCode'],
];
/*echo view('emails.bookingInvoiceUpdateMail', compact('mailParams'));
die();*/
return $this->from($mailSenderAddress, 'Extranetwork - ' . $mailParams['propertyName'])
->view('emails.bookingInvoiceUpdateMail', compact('mailParams'))
->to($mailData['to']["email"], $mailData['to']["name"])
->bcc($mailData['bcc'])
->subject(__('api-mailing-booking-invoice_update-title', ['bookingCode' => $mailParams['bookingCode']]))
->with(['message' => $this]);
} catch (Exception $e) {
$message = $e->getFile() . " " . $e->getLine() . " " . $e->getMessage();
Log::error($message);
return output(['status' => -1, 'message' => $e->getMessage()]);
}
}
}

View File

@@ -0,0 +1,101 @@
<?php
namespace App\Core\Mail;
use App\Exceptions\ApiErrorException;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Config;
class BookingPaymentDataCodeMail extends Mailable
{
use Queueable, SerializesModels;
public $tries = 5;
public $timeout = 30;
protected $param;
public function __construct($param)
{
$this->param = $param;
}
public function build()
{
try {
$params = $this->param;
$mailSenderAddress = Config::get('app.mailSenderAddress');
$bookingService = App::make('App\Core\Service\BookingService');
$userService = App::make('App\Core\Service\UserService');
$requestData = [
'criteria' => [
['field' => 'id', 'condition' => '=', 'value' => $params['booking_id']]
],
//'with' => ['bookingProperty.propertyExecutive', 'bookingProperty.propertyBookingEngineToken', 'bookingProperty.propertyBrand', 'bookingContact', 'bookingChannel', 'bookingPayment', 'bookingPaymentType', 'bookingStatus'],
'firstRow' => true
];
$booking = $bookingService->select($requestData);
if ($booking['status'] != 'success' || empty($booking['data'])) {
throw new ApiErrorException(lang('Booking not found'));
}
$booking = $booking['data'];
$requestData = [
'criteria' => [
['field' => 'id', 'condition' => '=', 'value' => $params['user_id']]
],
'firstRow' => true
];
$user = $userService->select($requestData);
if ($user['status'] != 'success' || empty($user['data'])) {
throw new ApiErrorException(lang('User not found'));
}
$user = $user['data'];
$mailParams = [
'to' => $user['email'],
'toNameSurname' => $user['nameSurname'],
'bcc' => [],
'unlockCode' => $params['unlock_code'],
'bookingId' => fillOnUndefined($booking, 'id'),
'propertyId' => fillOnUndefined($booking, 'property_id'),
'bookingCode' => fillOnUndefined($booking, 'booking_code'),
'locale' => fillOnUndefined($user, 'language', 'en'),
];
/*echo view('emails.bookingPaymentDataCode', compact('mailParams'));
die();*/
$mailParams['bcc'][] = 'burhan@extranetwork.com';
return $this->from($mailSenderAddress, 'Extranetwork')
->view('emails.bookingPaymentDataCode', compact('mailParams'))
->to($mailParams['to'], $mailParams['toNameSurname'])
->bcc($mailParams['bcc'])
->subject(__('api-mailing-payment_data_code-subject',['bookingCode' => $mailParams['bookingCode']],$mailParams['locale']));
} catch (Exception $e) {
$message = $e->getFile() . " " . $e->getLine() . " " . $e->getMessage();
Log::error($message);
return output(['status' => -1, 'message' => $e->getMessage()]);
}
}
}

View File

@@ -0,0 +1,113 @@
<?php
namespace App\Core\Mail;
use App\Exceptions\ApiErrorException;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Config;
class BookingPropertyAddonUpdateMail extends Mailable
{
use Queueable, SerializesModels;
public $tries = 5;
public $timeout = 30;
protected $param;
public function __construct($param)
{
$this->param = $param;
}
public function build()
{
try {
$params = $this->param;
$propertyService = App::make("App\Core\Service\PropertyService");
$propertyParam = [
'criteria' => [
['field' => 'id', 'condition' => '=', 'value' => $params['propertyId']],
],
'with' => ['propertyBrand', 'propertyExecutive', 'propertyUser.user','propertyBookingEngineToken'],
'firstRow' => true
];
$property = $propertyService->select($propertyParam);
if ($property['status'] != 'success') {
throw new ApiErrorException($property['message']);
}
$property = $property['data'];
//Mail Contact Data
$reservationExecutives = [];
if (isset($property['property_executive'])) {
$reservationExecutives = collect($property['property_executive'])
->where('executive_type_id', '=', '7')
->values()->all();
}
foreach ($reservationExecutives as $reservationExecutive) {
$bcc[] = $reservationExecutive['email'];
}
$bcc[] = "channel@extranetwork.com";
$userData = $property['property_user'];
$firstUserData = reset($userData);
foreach ($userData as $user) {
if ($user['user']['email'] != $firstUserData['user']['email']) {
$bcc[] = $user['user']['email'];
}
}
$mailData = [
'to' => [
'name' => $firstUserData['user']['nameSurname'],
'email' => $firstUserData['user']['email'],
],
'bcc' => $bcc
];
$locale = fillOnUndefined($firstUserData['user'], 'language', 'tr');
$mailSenderAddress = Config::get('app.mailSenderAddress');
app('translator')->setLocale($locale);
$mailParams = [
'propertyName' => $property['name'],
'bookingCode' => $params['bookingCode'],
'addonLanguageKey' => $params['addonLanguageKey'],
'logo' => $property['property_brand']['logoUrl'],
'btnUrl' => config('app.bookingEngineUrl') . '/' . $property['property_booking_engine_token']['token'] . '/' . $locale . '/booking-detail/' . $params['bookingCode'],
];
return $this->from($mailSenderAddress, 'Extranetwork - ' . $mailParams['propertyName'])
->view('emails.bookingPropertyAddonUpdateMail', compact('mailParams'))
->to($mailData['to']["email"], $mailData['to']["name"])
->bcc($mailData['bcc'])
->subject(__('api-mailing-booking-addon_update-title', ['bookingCode' => $mailParams['bookingCode'], 'addonLanguageKey' => __($mailParams['addonLanguageKey'])]))
->with(['message' => $this]);
} catch (Exception $e) {
$message = $e->getFile() . " " . $e->getLine() . " " . $e->getMessage();
Log::error($message);
return output(['status' => -1, 'message' => $e->getMessage()]);
}
}
}

View File

@@ -0,0 +1,140 @@
<?php
namespace App\Core\Mail;
use App\Exceptions\ApiErrorException;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Config;
use Exception;
class BookingTicketMail extends Mailable
{
use Queueable, SerializesModels;
public $tries = 5;
public $timeout = 30;
protected $param;
public function __construct($param)
{
$this->param = $param;
}
public function build()
{
try {
$params = $this->param;
$mailSenderAddress = Config::get('app.mailSenderAddress');
$bookingService = App::make('App\Core\Service\BookingService');
$requestData = [
'criteria' => [
['field' => 'id', 'condition' => '=', 'value' => $params['booking_id']]
],
'with' => ['bookingProperty.propertyExecutive', 'bookingProperty.propertyBookingEngineToken', 'bookingProperty.propertyBrand', 'bookingContact', 'bookingChannel', 'bookingPayment', 'bookingPaymentType', 'bookingStatus'],
'firstRow' => true
];
$booking = $bookingService->select($requestData);
if ($booking['status'] != 'success' || empty($booking['data'])) {
throw new ApiErrorException(lang('Booking not found'));
}
$booking = $booking['data'];
$locale = fillOnUndefined($params, 'locale', 'en');
if (!is_null($params['user'])) {
$locale = $booking['booking_contact']['language_code'];
}
app('translator')->setLocale($locale);
$propertyLogo = 'https://www.extranetwork.com/assets/img/logo/mini-logo.png';
if (isset($booking['booking_property']['property_brand']['logo_name'])) {
$propertyLogo = Config::get('app.imageUrl') . '/property-photos/' . $booking['booking_property']['id'] . "/logo/" . $booking['booking_property']['property_brand']['logo_name'] . '_250x250.' . $booking['booking_property']['property_brand']['logo_file_ext'];
}
$bookingContact = [
'mail' => $booking['booking_contact']['email'],
'nameSurname' => $booking['booking_contact']['nameSurname'],
];
if (!isset($booking['booking_property']['property_executive'])) {
throw new ApiErrorException(lang('Property Executive not found'));
}
$propertyExecutives = collect($booking['booking_property']['property_executive'])->where('status', 1)->where('executive_type_id', 7)->pluck('email')->toArray();
$params['subject'] = __('api-mailing-booking_ticket-subject', ['booking_code' => $booking['booking_code']]);//'Booking Ticket Message: ' . $booking['booking_code'];
$params['mailSenderName'] = 'Extranetwork - ' . $booking['booking_property']['name'];
if (!is_null($params['user'])) {
$mailParams = [
'to' => $bookingContact['mail'],
'toNameSurname' => $bookingContact['mail'],
'bcc' => [],
'title' => __('general-hi') . ', ' . $bookingContact['nameSurname'],
'logo' => $propertyLogo,
'message' => __('api-mailing-booking_ticket-message-user', ['booking_code' => $booking['booking_code']]),
'btnTitle' => __('api-mailing-booking_ticket-btn-message'),
'btnUrl' => config('app.bookingEngineUrl') . '/' . $booking['booking_property']['property_booking_engine_token']['token'] . '/' . $locale . '/booking-detail/' . $booking['booking_code'],
];
} else {
if (empty($propertyExecutives)) {
throw new ApiErrorException(lang('Property Executive not found'));
}
$mailParams = [
'to' => $propertyExecutives[0],
'toNameSurname' => null,
'bcc' => $propertyExecutives,
'title' => __('general-hi') . ',',
'logo' => $propertyLogo,
'message' => __('api-mailing-booking_ticket-message-enw-user', ['booking_code' => $booking['booking_code'], 'property_name' => $booking['booking_property']['name']]),
'btnTitle' => __('api-mailing-booking_ticket-btn-message'),
'btnUrl' => config('app.client_server') . '/app/network/reservation/' . $booking['id'].'?propertyid='.$booking['property_id'],
];
}
//$bcc[] = "sales@extranetwork.com";
$bcc = $mailParams['bcc'];
$bcc[] = "channel@extranetwork.com";
/*echo view('emails.bookingTicketMail', compact('mailParams'));
die();*/
return $this->from($mailSenderAddress, $params['mailSenderName'])
->view('emails.bookingTicketMail', compact('mailParams'))
->to($mailParams['to'], $mailParams['toNameSurname'])
->bcc($bcc)
->subject($params['subject']);
} catch (ApiErrorException $e) {
$message = $e->getFile() . " " . $e->getLine() . " " . $e->getMessage();
Log::error($message);
die();
} catch (Exception $e) {
$message = $e->getFile() . " " . $e->getLine() . " " . $e->getMessage();
Log::error($message);
die();
}
}
}

View File

@@ -0,0 +1,277 @@
<?php
namespace App\Core\Mail;
use App\Exceptions\ApiErrorException;
use Carbon\Carbon;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Config;
class CancelBookingMail extends Mailable
{
use Queueable, SerializesModels;
public $tries = 5;
public $timeout = 30;
protected $param;
public function __construct($param)
{
$this->param = $param;
}
public function build()
{
try {
$params = $this->param;
$propertyService = App::make("App\Core\Service\PropertyService");
$bookingService = App::make("App\Core\Service\BookingService");
$propertyBrandService = App::make("App\Core\Service\PropertyBrandService");
$bookingDetailParam = [
'criteria' => [
['field' => 'id', 'condition' => '=', 'value' => $params['booking_id']]
],
'with' => [
'bookingPayment', 'bookingRoom.roomRateMapping.propertyRoom','bookingRoom.roomRateMapping.propertyRoomRate',
'bookingContact','bookingProperty.propertyBrand', 'bookingProperty.propertyExecutive', 'bookingProperty.propertyUser.user',
'bookingPropertyWeb', 'propertyBookingEngine', 'propertyBookingChannel'
],
'firstRow' => true
];
$bookingData = $bookingService->select($bookingDetailParam);
$bookingData = $bookingData['data'];
$hostAddress = Config::get('app.bookingEngineUrl') . '/' . $bookingData['property_booking_engine']['token'] . '/' . $bookingData['booking_contact']['language_code'] . '/booking-detail/' . $bookingData['booking_code'];
$brandRequestData = ['property_id' => $bookingData['property_id']];
$getPropertyBrand = $propertyBrandService->getPropertyBrand($brandRequestData);
if ($getPropertyBrand['status'] != "success") {
throw new Exception($getPropertyBrand['message']);
}
$propertyBrand = $getPropertyBrand['data'];
$propertyBrandLogo = isset($propertyBrand['name'])
? Config::get('app.fileSystemDriver') . '/property-photos/' . $propertyBrand['property_id'] . "/logo/" . $propertyBrand['name'] . '_250x250.' . $propertyBrand['logo_file_ext']
: null;
$roomOrder = 1;
$bookingChannelRoom = [];
foreach ($bookingData['booking_room'] as $bookingRoom) {
if (!empty($bookingRoom['room_rate_mapping']['property_room'])) {
$bookingRoom['room_name'] = $bookingRoom['room_rate_mapping']['property_room']['name'];
}
if (!empty($bookingRoom['room_rate_mapping']['property_room_rate'])) {
$bookingRoom['room_rate_name'] = $bookingRoom['room_rate_mapping']['property_room_rate']['name'];
}
$extraParam = null;
if (!empty($bookingRoom['extra_param'])) {
$extraParamDecode = json_decode($bookingRoom['extra_param'], 1);
foreach ($extraParamDecode as $extraParamKey => $extraParamValue) {
$extraParamTitle = explode('_', $extraParamKey);
foreach ($extraParamTitle as $extraParamTitleKey => $extraParamTitleValue) {
$extraParamTitle[$extraParamTitleKey] = ucwords($extraParamTitleValue);
}
$extraParamTitle = implode(' ', $extraParamTitle);
$extraParam[$extraParamKey] = [
'title' => $extraParamTitle,
'value' => $extraParamValue,
];
}
}
$additionalFee = null;
if (!empty($bookingRoom['rate_detail'])) {
$rateDetail = json_decode($bookingRoom['rate_detail'], 1);
if(isset($rateDetail['taxes']) && $bookingData['channel_manager_id'] == 2) {
$additionalFee = $rateDetail['taxes'];
}
}
$bookingChannelRoom[] = [
'roomOrder' => $roomOrder,
'roomName' => $bookingRoom['room_name'],
'roomRateName' => $bookingRoom['room_rate_name'],
'occupancyCode' => $bookingRoom['occupancy_code'],
'occupancyText' => occupancyCodeFormatted($bookingRoom['occupancy_code']),
'amount' => $bookingRoom['amount'],
'discount_amount' => $bookingRoom['discount_amount'],
'total' => $bookingRoom['total'],
'currencyCode' => $bookingRoom['currency_code'],
'dailyAmount' => !empty($bookingRoom['daily_amount']) ? json_decode($bookingRoom['daily_amount'],1) : null,
'extraParam' => $extraParam,
'occupancyFormatted' => occupancyCodeFormatted($bookingRoom['occupancy_code']),
'additionalFee' => $additionalFee
];
//$bookingChannelRoom[] = $roomOrder . '. ' . $bookingRoom['room_name'] . ' - ' . $bookingRoom['room_rate_name'] . ' - ' . occupancyCodeFormatted($bookingRoom['occupancy_code']);
$roomOrder++;
}
$userData = $bookingData['booking_property']['property_user'];
$firstUserData = reset($userData);
if (in_array($bookingData['property_booking_channel']['channel_category_id'], [2,3])) {
$bookingLanguageCode = fillOnUndefined($bookingData['booking_contact'], 'language_code', 'en');
}else {
$bookingLanguageCode = fillOnUndefined($firstUserData['user'], 'language', 'en');
}
$bookingChannelPaymentType = __('property_booking_payment_type-pay_at_hotel',[],$bookingLanguageCode);
$bookingChannelPaymentSource = null;
if ($bookingData['booking_payment']['payment_type_code'] == 'CRD') {
$bookingChannelPaymentType = __('property_booking_payment_type-credit_card',[],$bookingLanguageCode);
if ($bookingData['booking_payment']['payment_source_code'] == 'OTA') {
$bookingChannelPaymentSource = __('enw-ota-credit_card',[],$bookingLanguageCode);
}
if ($bookingData['booking_payment']['payment_source_code'] == 'GST') {
$bookingChannelPaymentSource = __('enw-guest-credit_card',[],$bookingLanguageCode);
}
}
$creditCardInformation = null;
if (!is_null($bookingData['booking_payment']['extra_param'])) {
$paymentData = json_decode($bookingData['booking_payment']['extra_param'], 1);
if (isset($paymentData['attributes']['guarantee'])) {
$creditCardInformation['cardNumber'] = isset($paymentData['attributes']['guarantee']['card_number']) ? $paymentData['attributes']['guarantee']['card_number'] : null;
$creditCardInformation['cardHolderName'] = isset($paymentData['attributes']['guarantee']['cardholder_name']) ? $paymentData['attributes']['guarantee']['cardholder_name'] : null;
$creditCardInformation['expirationDate'] = isset($paymentData['attributes']['guarantee']['expiration_date']) ? $paymentData['attributes']['guarantee']['expiration_date'] : null;
$creditCardInformation['cvv'] = isset($paymentData['attributes']['guarantee']['cvv']) ? $paymentData['attributes']['guarantee']['cvv'] : null;
}
}
//Genius Member
$bookingContactExtraParam = null;
if(!empty($bookingData['booking_contact']['extra_param'])) {
$bookingContactExtraParam = json_decode($bookingData['booking_contact']['extra_param'],1);
}
$isBookingGenius = false;
if(isset($bookingContactExtraParam['is_genius']) && $bookingContactExtraParam['is_genius']) {
$isBookingGenius = true;
}
$mailParams = [
'bookingId' => $bookingData['id'],
'bookingCode' => $bookingData['booking_code'],
'propertyId' => $bookingData['booking_property']['id'],
'booking_code' => $bookingData['booking_code'],
'search_key' => $bookingData['search_key'],
'channel_token' => $bookingData['channel_token'],
'booking_engine_token' => $bookingData['booking_engine_token'],
'checkin_date' => Carbon::parse($bookingData['checkin_date'])->format('d.m.Y'),
'checkout_date' => Carbon::parse($bookingData['checkout_date'])->format('d.m.Y'),
'payment_type_code' => $bookingData['booking_payment']['payment_type_code'],
'payment_source_code' => $bookingData['booking_payment']['payment_source_code'],
'room_amount' => $bookingData['room_amount'],
'addon_amount' => $bookingData['addon_amount'],
'discount_amount' => $bookingData['discount_amount'],
'total' => $bookingData['total'],
'currency_code' => $bookingData['currency_code'],
'name_surname' => $bookingData['booking_contact']['nameSurname'],
'countryCode' => upperCase($bookingData['booking_contact']['country_code']),
'email' => $bookingData['booking_contact']['email'],
'property_name' => $bookingData['booking_property']['name'],
'url' => $hostAddress,
'logo' => $bookingData['booking_property']['property_brand']['logoUrl'],
'language_code' => $bookingData['booking_contact']['language_code'],
'bookingChannelId' => $bookingData['channel_id'],
'bookingChannelName' => fillOnUndefined($bookingData['property_booking_channel'], 'name'),
'bookingChannelCategoryId' => $bookingData['property_booking_channel']['channel_category_id'],
'bookingChannelCode' => $bookingData['channel_booking_code'],
'bookingChannelContactNameSurname' => $bookingData['booking_contact']['nameSurname'],
'bookingChannelContactEmail' => $bookingData['booking_contact']['email'],
'bookingChannelContactPhone' => $bookingData['booking_contact']['phone_number'],
'bookingChannelNote' => $bookingData['booking_contact']['note'],
'bookingChannelRoom' => $bookingChannelRoom,
'bookingChannelPaymentType' => $bookingChannelPaymentType,
'bookingChannelPaymentSource' => $bookingChannelPaymentSource,
'creditCardInformation' => $creditCardInformation,
'isBookingGenius' => $isBookingGenius
];
//Mail Contact Data
$reservationExecutives = [];
if (isset($bookingData['booking_property']['property_executive'])) {
$reservationExecutives = collect($bookingData['booking_property']['property_executive'])
->where('executive_type_id', '=', '7') // sadece rezervasyon yetkisi olanlar ...
->values()->all();
}
foreach ($reservationExecutives as $reservationExecutive) {
$bcc[] = $reservationExecutive['email'];
}
$bcc[] = "channel@extranetwork.com";
foreach ($userData as $user) {
if ($user['user']['email'] != $firstUserData['user']['email']) {
$bcc[] = $user['user']['email'];
}
}
//Booking Engine ve Offline Channel to Customer Info's
if (in_array($bookingData['property_booking_channel']['channel_category_id'], [2,3])) {
$mailData = [
'to' => [
'name' => $bookingData['booking_contact']['nameSurname'],
'email' => $bookingData['booking_contact']['email']
]
];
} else {
$mailData = [
'to' => [
'name' => $bookingData['booking_property']['name'],
'email' => $firstUserData['user']['email']
]
];
}
$mailData['bcc'] = $bcc;
$mailSenderAddress = Config::get('app.mailSenderAddress');
//app('translator')->setLocale(fillOnUndefined($firstUserData['user'], 'language', 'tr'));
app('translator')->setLocale($bookingLanguageCode);
$mailParams['showCreditCardUrl'] = null;
if(!empty($mailParams['creditCardInformation'])) {
$mailParams['showCreditCardUrl'] = Config::get('app.client_server').'/app/network/reservation/'.$mailParams['bookingId'].'?propertyid='.$mailParams['propertyId'];
}
/*echo view('emails.cancelBookingMail', compact('mailParams'));
die();*/
return $this->from($mailSenderAddress, 'Extranetwork - ' . $mailParams['property_name'])
->view('emails.cancelBookingMail', compact('mailParams'))
->to($mailData['to']["email"], $mailData['to']["name"])
->bcc($mailData['bcc'])
->subject(__('api-malling-booking-cancel_booking-title', ['channel' => $mailParams['bookingChannelName']]))
->with(['message' => $this]);
} catch (Exception $e) {
$message = $e->getFile() . " " . $e->getLine() . " " . $e->getMessage();
Log::error($message);
return output(['status' => -1, 'message' => $e->getMessage()]);
}
}
}

View File

@@ -0,0 +1,70 @@
<?php
namespace App\Core\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Config;
class ChannelManagerNotificationMail extends Mailable
{
use Queueable, SerializesModels;
public $tries = 5;
public $timeout = 30;
protected $param;
public function __construct($param)
{
$this->param = $param;
}
public function build()
{
try {
$params = $this->param;
$mailSenderAddress = Config::get('app.mailSenderAddress');
$propertyService = App::make('App\Core\Service\PropertyService');
$requestData = [
'criteria' => [
['field' => 'id', 'condition' => '=', 'value' => $params['propertyId']]
],
'with' => ['propertyUser.user'],
'firstRow' => true
];
$propertyDetail = $propertyService->select($requestData);
$propertyUser = [];
if($propertyDetail['status'] == 'success' && !empty($propertyDetail['data'])) {
$propertyUser = collect($propertyDetail['data']['property_user'])->where('status',1)->pluck('user.email')->toArray();
}
/*echo view('emails.channelManagerNotificationMail', compact('params'));
die();*/
return $this->from($mailSenderAddress, 'Extranetwork')
->view('emails.channelManagerNotificationMail', compact('params'))
->to('channel@extranetwork.com', 'Extranetwork Channel')
->bcc($propertyUser)
->subject('Channel Update Error: ' . $params['propertyName']);
} catch (Exception $e) {
$message = $e->getFile() . " " . $e->getLine() . " " . $e->getMessage();
Log::error($message);
return output(['status' => -1, 'message' => $e->getMessage()]);
}
}
}

View File

@@ -0,0 +1,58 @@
<?php
namespace App\Core\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Config;
class ContactFormMail extends Mailable
{
use Queueable, SerializesModels;
public $tries = 5;
public $timeout = 30;
protected $param;
public function __construct($param)
{
$this->param = $param;
}
public function build ()
{
try
{
$params = $this->param;
$mailParams = $params['mailViewParams'] ;
$mailData = $params['mailData'] ;
$mailSenderAddress = Config::get('app.mailSenderAddress') ;
$mailTitle = $mailData['to']["name"]. ' Contact Form (' . $mailParams['name']. ' '.$mailParams['surname']. ')' ;
app('translator')->setLocale('en');
return $this->from($mailSenderAddress, $mailParams['name']. ' '.$mailParams['surname'])
->view('emails.contactFormMail', compact('mailParams', 'mailTitle'))
->to($mailData['to']["email"], $mailData['to']["name"])
->bcc($mailData['bcc'])
->subject($mailTitle)
->with(['message' => $this]);
}
catch ( Exception $e )
{
$message = $e->getFile()." ".$e->getLine()." ".$e->getMessage();
Log::error($message);
return output( ['status' => -1, 'message' => $e->getMessage()] );
}
}
}

View File

@@ -0,0 +1,55 @@
<?php
namespace App\Core\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Config;
class DailyReportMail extends Mailable
{
use Queueable, SerializesModels;
public $tries = 5;
public $timeout = 30;
protected $param;
public function __construct($param)
{
$this->param = $param;
}
public function build()
{
try {
$params = $this->param;
$mailSenderAddress = Config::get('app.mailSenderAddress');
/*echo view('emails.dailyReportMail', compact('params'));
die();*/
$to = 'yoy@extranetwork.com';
$bcc[] = 'burhan@extranetwork.com';
return $this->from($mailSenderAddress, 'Extranetwork')
->view('emails.dailyReportMail', compact('params'))
->to($to, 'Extranetwork')
->bcc($bcc)
->subject('Extranetwork Summary Report - '. $params['daily']['period']);
} catch (Exception $e) {
$message = $e->getFile() . " " . $e->getLine() . " " . $e->getMessage();
Log::error($message);
return output(['status' => -1, 'message' => $e->getMessage()]);
}
}
}

View File

@@ -0,0 +1,58 @@
<?php
namespace App\Core\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Config;
class DailyReportMailSales extends Mailable
{
use Queueable, SerializesModels;
public $tries = 5;
public $timeout = 30;
protected $param;
public function __construct($param)
{
$this->param = $param;
}
public function build()
{
try {
$params = $this->param;
$mailSenderAddress = Config::get('app.mailSenderAddress');
/*echo view('emails.dailyReportMailSales', compact('params'));
die();*/
$to = $params['email'];
$bcc[] = 'yoy@extranetwork.com';
$bcc[] = 'burhan@extranetwork.com';
$bcc[] = 'cemile@extranetwork.com';
return $this->from($mailSenderAddress, 'Extranetwork')
->view('emails.dailyReportMailSales', compact('params'))
->to($to, 'Extranetwork')
->bcc($bcc)
->subject('Extranetwork Summary Report - '. $params['daily']['period'].' - '. $params['name']);
} catch (Exception $e) {
$message = $e->getFile() . " " . $e->getLine() . " " . $e->getMessage();
Log::error($message);
return output(['status' => -1, 'message' => $e->getMessage()]);
}
}
}

View File

@@ -0,0 +1,54 @@
<?php
namespace App\Core\Mail;
use Exception;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Config;
class EnwContactFormMail extends Mailable
{
use Queueable, SerializesModels;
public $tries = 5;
public $timeout = 30;
protected $param;
public function __construct($param)
{
$this->param = $param;
}
public function build ()
{
try
{
$params = $this->param;
$mailParams = $params['mailViewParams'] ;
$mailData = $params['mailData'] ;
$mailTitle = __('myweb-contact-contact_form-title');
app('translator')->setLocale($mailParams['language']);
return $this->view('emails.enwContactFormMail', compact('mailParams', 'mailTitle'))
->to($mailData['to']["email"], $mailData['to']["name"])
->bcc($mailData['bcc'])
->subject($mailTitle);
}
catch ( Exception $e )
{
$message = $e->getFile()." ".$e->getLine()." ".$e->getMessage();
Log::error($message);
return output( ['status' => -1, 'message' => $e->getMessage()] );
}
}
}

View File

@@ -0,0 +1,60 @@
<?php
namespace App\Core\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Config;
class InventoryActionMail extends Mailable
{
use Queueable, SerializesModels;
public $tries = 5;
public $timeout = 30;
protected $param;
public function __construct($param)
{
$this->param = $param;
}
public function build()
{
try {
$params = $this->param;
$mailSenderAddress = Config::get('app.mailSenderAddress');
app('translator')->setLocale(fillOnUndefined($params, 'locale', 'en'));
$params['title'] = $params['propertyName'] . ' - ' . __('enw-action-mail-title');
$params['channelContact'] = $params['channelContact'];
if(empty($params['channelContact'])) {
return false;
}
/*echo view('emails.inventoryActionMail', compact('params'));
die();*/
return $this->from($mailSenderAddress, 'Extranetwork - '.$params['propertyName'])
->view('emails.inventoryActionMail', compact('params'))
//->to($logMailAddress, 'Development Team')
->bcc($params['channelContact'])
->subject($params['title']);
} catch (Exception $e) {
$message = $e->getFile() . " " . $e->getLine() . " " . $e->getMessage();
Log::error($message);
return output(['status' => -1, 'message' => $e->getMessage()]);
}
}
}

View File

@@ -0,0 +1,60 @@
<?php
namespace App\Core\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Config;
class InventoryPdfLinkMail extends Mailable
{
use Queueable, SerializesModels;
public $tries = 5;
public $timeout = 30;
protected $param;
public function __construct($param)
{
$this->param = $param;
}
public function build()
{
try {
$params = $this->param;
$mailSenderAddress = Config::get('app.mailSenderAddress');
app('translator')->setLocale(fillOnUndefined($params, 'locale', 'en'));
$params['title'] = $params['propertyName'] . ' - ' . __('enw-inventory-mail-pdf-link');
$params['channelContact'] = $params['channelContact'];
if(empty($params['channelContact'])) {
return false;
}
/*echo view('emails.inventoryActionMail', compact('params'));
die();*/
return $this->from($mailSenderAddress, 'Extranetwork - '.$params['propertyName'])
->view('emails.inventoryPdfLinkMail', compact('params'))
//->to($logMailAddress, 'Development Team')
->bcc($params['channelContact'])
->subject($params['title']);
} catch (Exception $e) {
$message = $e->getFile() . " " . $e->getLine() . " " . $e->getMessage();
Log::error($message);
return output(['status' => -1, 'message' => $e->getMessage()]);
}
}
}

52
app/Core/Mail/LogMail.php Normal file
View File

@@ -0,0 +1,52 @@
<?php
namespace App\Core\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Config;
class LogMail extends Mailable
{
use Queueable, SerializesModels;
public $tries = 2;
public $timeout = 20;
protected $param;
public function __construct($param)
{
$this->param = $param;
}
public function build()
{
try {
$params = $this->param;
$logMailAddress = Config::get('app.logMailAddress');
$mailSenderAddress = Config::get('app.mailSenderAddress');
$params['title'] = 'ENW LOG - ' . $params['title'];
app('translator')->setLocale('tr');
return $this->from($mailSenderAddress, 'Development Team')
->view('emails.logMail', compact('params'))
->to($logMailAddress, 'Development Team')
//->bcc(['bd@extranetwork.com'])
->subject($params['title']);
} catch (\Exception $e) {
$message = $e->getFile() . " " . $e->getLine() . " " . $e->getMessage();
Log::error($message);
return output(['status' => -1, 'message' => $e->getMessage()]);
}
}
}

View File

@@ -0,0 +1,64 @@
<?php
namespace App\Core\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Config;
class ManualPaymentMail extends Mailable
{
use Queueable, SerializesModels;
public $tries = 5;
public $timeout = 30;
protected $param;
public function __construct($param)
{
$this->param = $param;
}
public function build ()
{
try
{
$params = $this->param;
$mailParams = $params['mailViewParams'] ;
$mailData = $params['mailData'] ;
$mailSenderAddress = Config::get('app.mailSenderAddress') ;
app('translator')->setLocale($mailParams["language_code"]);
$description = __('api-manual_payment_mail-desc',[
'title' => $mailParams['process_title'] ,
'date' => $mailParams['date_time'],
'amount' => $mailParams['amount'],
'currency' => $mailParams['currency']
]);
return $this->from($mailSenderAddress, 'Extranetwork - '.$mailParams['property_name'])
->view('emails.manualPaymentMail', compact('mailParams', 'description'))
->to($mailData['to']["email"])
->bcc($mailData['bcc'])
->subject(__('api-manual_payment_mail-subject'))
->with(['message' => $this]);
}
catch ( Exception $e )
{
$message = $e->getFile()." ".$e->getLine()." ".$e->getMessage();
Log::error($message);
return output( ['status' => -1, 'message' => $e->getMessage()] );
}
}
}

View File

@@ -0,0 +1,264 @@
<?php
namespace App\Core\Mail;
use App\Core\Service\PropertyBrandService;
use App\Exceptions\ApiErrorException;
use Carbon\Carbon;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Config;
class ModifiedBookingMail extends Mailable
{
use Queueable, SerializesModels;
public $tries = 5;
public $timeout = 30;
protected $param;
public function __construct($param)
{
$this->param = $param;
}
public function build()
{
try {
$params = $this->param;
$propertyService = App::make("App\Core\Service\PropertyService");
$bookingService = App::make("App\Core\Service\BookingService");
$propertyBrandService = App::make("App\Core\Service\PropertyBrandService");
$bookingDetailParam = [
'criteria' => [
['field' => 'id', 'condition' => '=', 'value' => $params['booking_id']]
],
'with' => [
'bookingPayment', 'bookingRoom.roomRateMapping.propertyRoom','bookingRoom.roomRateMapping.propertyRoomRate',
'bookingContact','bookingProperty.propertyBrand', 'bookingProperty.propertyExecutive', 'bookingProperty.propertyUser.user',
'bookingPropertyWeb', 'propertyBookingEngine', 'propertyBookingChannel'
],
'firstRow' => true
];
$bookingData = $bookingService->select($bookingDetailParam);
$bookingData = $bookingData['data'];
$hostAddress = Config::get('app.bookingEngineUrl') . '/' . $bookingData['property_booking_engine']['token'] . '/' . $bookingData['booking_contact']['language_code'] . '/booking-detail/' . $bookingData['booking_code'];
$brandRequestData = ['property_id' => $bookingData['property_id']];
$getPropertyBrand = $propertyBrandService->getPropertyBrand($brandRequestData);
if ($getPropertyBrand['status'] != "success") {
throw new Exception($getPropertyBrand['message']);
}
$propertyBrand = $getPropertyBrand['data'];
$propertyBrandLogo = isset($propertyBrand['name'])
? Config::get('app.fileSystemDriver') . '/property-photos/' . $propertyBrand['property_id'] . "/logo/" . $propertyBrand['name'] . '_250x250.' . $propertyBrand['logo_file_ext']
: null;
$roomOrder = 1;
$bookingChannelRoom = [];
foreach ($bookingData['booking_room'] as $bookingRoom) {
if (!empty($bookingRoom['room_rate_mapping']['property_room'])) {
$bookingRoom['room_name'] = $bookingRoom['room_rate_mapping']['property_room']['name'];
}
if (!empty($bookingRoom['room_rate_mapping']['property_room_rate'])) {
$bookingRoom['room_rate_name'] = $bookingRoom['room_rate_mapping']['property_room_rate']['name'];
}
$extraParam = null;
if (!empty($bookingRoom['extra_param'])) {
$extraParamDecode = json_decode($bookingRoom['extra_param'], 1);
foreach ($extraParamDecode as $extraParamKey => $extraParamValue) {
$extraParamTitle = explode('_', $extraParamKey);
foreach ($extraParamTitle as $extraParamTitleKey => $extraParamTitleValue) {
$extraParamTitle[$extraParamTitleKey] = ucwords($extraParamTitleValue);
}
$extraParamTitle = implode(' ', $extraParamTitle);
$extraParam[$extraParamKey] = [
'title' => $extraParamTitle,
'value' => $extraParamValue,
];
}
}
$additionalFee = null;
if (!empty($bookingRoom['rate_detail'])) {
$rateDetail = json_decode($bookingRoom['rate_detail'], 1);
if(isset($rateDetail['taxes']) && $bookingData['channel_manager_id'] == 2) {
$additionalFee = $rateDetail['taxes'];
}
}
$bookingChannelRoom[] = [
'roomOrder' => $roomOrder,
'roomName' => $bookingRoom['room_name'],
'roomRateName' => $bookingRoom['room_rate_name'],
'occupancyCode' => $bookingRoom['occupancy_code'],
'occupancyText' => occupancyCodeFormatted($bookingRoom['occupancy_code']),
'amount' => $bookingRoom['amount'],
'discount_amount' => $bookingRoom['discount_amount'],
'total' => $bookingRoom['total'],
'currencyCode' => $bookingRoom['currency_code'],
'dailyAmount' => !empty($bookingRoom['daily_amount']) ? json_decode($bookingRoom['daily_amount'],1) : null,
'extraParam' => $extraParam,
'occupancyFormatted' => occupancyCodeFormatted($bookingRoom['occupancy_code']),
'additionalFee' => $additionalFee
];
//$bookingChannelRoom[] = $roomOrder . '. ' . $bookingRoom['room_name'] . ' - ' . $bookingRoom['room_rate_name'] . ' - ' . occupancyCodeFormatted($bookingRoom['occupancy_code']);
$roomOrder++;
}
$userData = $bookingData['booking_property']['property_user'];
$firstUserData = reset($userData);
$bookingLanguageCode = fillOnUndefined($firstUserData['user'], 'language', 'en');
$bookingChannelPaymentType = __('property_booking_payment_type-pay_at_hotel',[],$bookingLanguageCode);
$bookingChannelPaymentSource = null;
if ($bookingData['booking_payment']['payment_type_code'] == 'CRD') {
$bookingChannelPaymentType = __('property_booking_payment_type-credit_card',[],$bookingLanguageCode);
if ($bookingData['booking_payment']['payment_source_code'] == 'OTA') {
$bookingChannelPaymentSource = __('enw-ota-credit_card',[],$bookingLanguageCode);
}
if ($bookingData['booking_payment']['payment_source_code'] == 'GST') {
$bookingChannelPaymentSource = __('enw-guest-credit_card',[],$bookingLanguageCode);
}
}
$creditCardInformation = null;
if (!is_null($bookingData['booking_payment']['extra_param'])) {
$paymentData = json_decode($bookingData['booking_payment']['extra_param'], 1);
if (isset($paymentData['attributes']['guarantee'])) {
$creditCardInformation['cardNumber'] = isset($paymentData['attributes']['guarantee']['card_number']) ? $paymentData['attributes']['guarantee']['card_number'] : null;
$creditCardInformation['cardHolderName'] = isset($paymentData['attributes']['guarantee']['cardholder_name']) ? $paymentData['attributes']['guarantee']['cardholder_name'] : null;
$creditCardInformation['expirationDate'] = isset($paymentData['attributes']['guarantee']['expiration_date']) ? $paymentData['attributes']['guarantee']['expiration_date'] : null;
$creditCardInformation['cvv'] = isset($paymentData['attributes']['guarantee']['cvv']) ? $paymentData['attributes']['guarantee']['cvv'] : null;
}
}
//Genius Member
$bookingContactExtraParam = null;
if(!empty($bookingData['booking_contact']['extra_param'])) {
$bookingContactExtraParam = json_decode($bookingData['booking_contact']['extra_param'],1);
}
$isBookingGenius = false;
if(isset($bookingContactExtraParam['is_genius']) && $bookingContactExtraParam['is_genius']) {
$isBookingGenius = true;
}
$mailParams = [
'bookingId' => $bookingData['id'],
'bookingCode' => $bookingData['booking_code'],
'propertyId' => $bookingData['booking_property']['id'],
'booking_code' => $bookingData['booking_code'],
'search_key' => $bookingData['search_key'],
'channel_token' => $bookingData['channel_token'],
'booking_engine_token' => $bookingData['booking_engine_token'],
'checkin_date' => Carbon::parse($bookingData['checkin_date'])->format('d.m.Y'),
'checkout_date' => Carbon::parse($bookingData['checkout_date'])->format('d.m.Y'),
'payment_type_code' => $bookingData['booking_payment']['payment_type_code'],
'payment_source_code' => $bookingData['booking_payment']['payment_source_code'],
'room_amount' => $bookingData['room_amount'],
'addon_amount' => $bookingData['addon_amount'],
'discount_amount' => $bookingData['discount_amount'],
'total' => $bookingData['total'],
'currency_code' => $bookingData['currency_code'],
'name_surname' => $bookingData['booking_contact']['nameSurname'],
'countryCode' => upperCase($bookingData['booking_contact']['country_code']),
'email' => $bookingData['booking_contact']['email'],
'property_name' => $bookingData['booking_property']['name'],
'url' => $hostAddress,
'logo' => $bookingData['booking_property']['property_brand']['logoUrl'],
'language_code' => $bookingData['booking_contact']['language_code'],
'bookingChannelId' => $bookingData['channel_id'],
'bookingChannelName' => fillOnUndefined($bookingData['property_booking_channel'], 'name'),
'bookingChannelCategoryId' => $bookingData['property_booking_channel']['channel_category_id'],
'bookingChannelCode' => $bookingData['channel_booking_code'],
'bookingChannelContactNameSurname' => $bookingData['booking_contact']['nameSurname'],
'bookingChannelContactEmail' => $bookingData['booking_contact']['email'],
'bookingChannelContactPhone' => $bookingData['booking_contact']['phone_number'],
'bookingChannelNote' => $bookingData['booking_contact']['note'],
'bookingChannelRoom' => $bookingChannelRoom,
'bookingChannelPaymentType' => $bookingChannelPaymentType,
'bookingChannelPaymentSource' => $bookingChannelPaymentSource,
'creditCardInformation' => $creditCardInformation,
'isBookingGenius' => $isBookingGenius
];
//Mail Contact Data
$reservationExecutives = [];
if (isset($bookingData['booking_property']['property_executive'])) {
$reservationExecutives = collect($bookingData['booking_property']['property_executive'])
->where('executive_type_id', '=', '7') // sadece rezervasyon yetkisi olanlar ...
->values()->all();
}
foreach ($reservationExecutives as $reservationExecutive) {
$bcc[] = $reservationExecutive['email'];
}
$bcc[] = "channel@extranetwork.com";
foreach ($userData as $user) {
if ($user['user']['email'] != $firstUserData['user']['email']) {
$bcc[] = $user['user']['email'];
}
}
$mailData = [
'to' => [
'name' => $firstUserData['user']['nameSurname'],
'email' => $firstUserData['user']['email'],
],
'bcc' => $bcc
];
$mailSenderAddress = Config::get('app.mailSenderAddress');
//app('translator')->setLocale(fillOnUndefined($firstUserData['user'], 'language', 'tr'));
app('translator')->setLocale($bookingLanguageCode);
$mailParams['showCreditCardUrl'] = null;
if(!empty($mailParams['creditCardInformation'])) {
$mailParams['showCreditCardUrl'] = Config::get('app.client_server').'/app/network/reservation/'.$mailParams['bookingId'].'?propertyid='.$mailParams['propertyId'];
}
/*echo view('emails.modifiedBookingMail', compact('mailParams'));
die();*/
return $this->from($mailSenderAddress, 'Extranetwork - ' . $mailParams['property_name'])
->view('emails.modifiedBookingMail', compact('mailParams'))
->to($mailData['to']["email"], $mailData['to']["name"])
->bcc($mailData['bcc'])
->subject(__('api-mailing-booking-modified_booking-title', ['channel' => $mailParams['bookingChannelName']]))
->with(['message' => $this]);
} catch (Exception $e) {
$message = $e->getFile() . " " . $e->getLine() . " " . $e->getMessage();
Log::error($message);
return output(['status' => -1, 'message' => $e->getMessage()]);
}
}
}

View File

@@ -0,0 +1,68 @@
<?php
namespace App\Core\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Config;
class NewBookingMail extends Mailable
{
use Queueable, SerializesModels;
public $tries = 5;
public $timeout = 30;
protected $param;
public function __construct($param)
{
$this->param = $param;
}
public function build()
{
try {
$params = $this->param;
$mailParams = $params['mailViewParams'];
$mailData = $params['mailData'];
$mailSenderAddress = Config::get('app.mailSenderAddress');
app('translator')->setLocale($mailParams["language_code"]);
$bookingData = __('api-mailling-booking-desc', [
'booking_code' => $mailParams['booking_code'],
'property_name' => $mailParams['property_name'],
'checkin_date' => $mailParams['checkin_date'],
'checkout_date' => $mailParams['checkout_date']
]);
$mailSubject = __('api-malling-booking-new_booking_info-title');
if (isset($mailParams['bookingChannelCategoryId']) && $mailParams['bookingChannelCategoryId'] != 3) {
$mailSubject = $mailParams['bookingChannelName'] . ' - ' . $mailSubject;
}
/*echo view('emails.newBookingMail', compact('mailParams', 'bookingData'));
die();*/
return $this->from($mailSenderAddress, 'Extranetwork - ' . $mailParams['property_name'])
->view('emails.newBookingMail', compact('mailParams', 'bookingData'))
->to($mailData['to']["email"], $mailData['to']["name"])
->bcc($mailData['bcc'])
->subject('🛎️ '.$mailSubject)
->with(['message' => $this]);
} catch (Exception $e) {
$message = $e->getFile() . " " . $e->getLine() . " " . $e->getMessage();
Log::error($message);
return output(['status' => -1, 'message' => $e->getMessage()]);
}
}
}

View File

@@ -0,0 +1,106 @@
<?php
namespace App\Core\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Config;
class OfferAcceptMail extends Mailable
{
use Queueable, SerializesModels;
public $tries = 5;
public $timeout = 30;
protected $param;
public function __construct($param)
{
$this->param = $param;
}
public function build()
{
try {
$params = $this->param;
$propertyService = App::make("App\Core\Service\OfferService");
$requestParams = [
'offer_id' => fillOnUndefined($params, 'offer_id'),
'property_id' => fillOnUndefined($params, 'property_id'),
];
$offerDetail = $propertyService->findOffer($requestParams);
$offerDetail = fillOnUndefined($offerDetail, 'data');
app('translator')->setLocale($offerDetail["language"]);
$mailSenderAddress = Config::get('app.mailSenderAddress');
$mailParams['to'] = [];
$mailParams['to'] = $offerDetail['email'];
$mailParams['cc'] = [];
if (!empty($offerDetail['create_user'])) {
$mailParams['cc'][] = $offerDetail['create_user']['email'];
}
$mailParams['bcc'] = [];
$mailParams['bcc'][] = Config::get('app.logMailAddress');
$mailParams['property_name'] = $offerDetail['property']['name'];
$mailParams['url'] = Config::get('app.client_server').'/offer/'.$offerDetail['offer_code'];
$mailParams['paymentUrl'] = null;
if(isset($params['paymentUrl']) && !is_null($params['paymentUrl'])) {
$mailParams['paymentUrl'] = $params['paymentUrl'];
}
$description = [];
//$description[] = '<b>'.$offerDetail['property']['name'].'</b> tarafından oluşturulan <b>'.$offerDetail['ticket_code'].'</b> kodlu teklif onaylanmıştır.';
$description[] = __('api-mailing-offer_accept_mail-description', ['propertyName' => $offerDetail['property']['name'], 'code' => $offerDetail['ticket_code']]);
if(!is_null($offerDetail['payment_type_mapping_id']) && !empty($mailParams['paymentUrl'])) {
//$description[] = 'Teklife ait ödemenizi aşağıdaki <b>Ödeme Linki</b> üzerinden güvenle gerçekleştirebilirsiniz.';
$description[] = __('api-mailing-offer_accept_mail-payment');
}
$description = implode('<br><br>', $description);
$mailParams['logo'] = Config::get('app.webUrl').'/assets/img/logo/mini-logo.png';
if(isset($offerDetail['property_brand']['logoUrl'])) {
$mailParams['logo'] = $offerDetail['property_brand']['logoUrl'];
}
/*echo view('emails.offerAcceptMail', compact('mailParams', 'description'));
die();*/
return $this->from($mailSenderAddress, 'Extranetwork - ' . $mailParams['property_name'])
->view('emails.offerAcceptMail', compact('mailParams', 'description'))
->to($mailParams['to'])
->cc($mailParams['cc'])
->bcc($mailParams['bcc'])
->subject(__('api-mailing-offer_accept_mail-title', ['code' => $offerDetail['ticket_code']]))
->with(['message' => $this]);
} catch (Exception $e) {
$message = $e->getFile() . " " . $e->getLine() . " " . $e->getMessage();
Log::error($message);
return output(['status' => -1, 'message' => $e->getMessage()]);
}
}
}

View File

@@ -0,0 +1,91 @@
<?php
namespace App\Core\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Config;
class OfferPreConfirmCustomerMail extends Mailable
{
use Queueable, SerializesModels;
public $tries = 5;
public $timeout = 30;
protected $param;
public function __construct($param)
{
$this->param = $param;
}
public function build()
{
try {
$params = $this->param;
$propertyService = App::make("App\Core\Service\OfferService");
$requestParams = [
'offer_id' => fillOnUndefined($params, 'offer_id'),
'property_id' => fillOnUndefined($params, 'property_id'),
];
$offerDetail = $propertyService->findOffer($requestParams);
$offerDetail = fillOnUndefined($offerDetail, 'data');
app('translator')->setLocale($offerDetail["language"]);
$mailSenderAddress = Config::get('app.mailSenderAddress');
$mailParams['to'] = [];
$mailParams['to'] = $offerDetail['email'];
$mailParams['bcc'] = [];
$mailParams['bcc'][] = Config::get('app.logMailAddress');
$mailParams['property_name'] = $offerDetail['property']['name'];
$mailParams['url'] = Config::get('app.client_server').'/offer/'.$offerDetail['offer_code'];
$mailParams['logo'] = Config::get('app.webUrl').'/assets/img/logo/mini-logo.png';
if(isset($offerDetail['property_brand']['logoUrl'])) {
$mailParams['logo'] = $offerDetail['property_brand']['logoUrl'];
}
$description = [];
//$description[] = '<b>'.$offerDetail['property']['name'].'</b> tarafından oluşturulan <b>'.$offerDetail['ticket_code'].'</b> kodlu teklifi onayladınız.';
$description[] = __('api-mailing-offer_preconfirm_customer_mail-description-one', ['propertyName' => $offerDetail['property']['name'], 'code' => $offerDetail['ticket_code']]);
//$description[] = 'Onayınız tesisimize bildirilmiştir. Tesisin teklifi onaylaması beklenmektedir, onaya istinaden size dönüş yapılacaktır.';
$description[] = __('api-mailing-offer_preconfirm_customer_mail-description-two');
$description = implode('<br><br>', $description);
/*echo view('emails.offerPreConfirmCustomerMail', compact('mailParams', 'description'));
die();*/
return $this->from($mailSenderAddress, 'Extranetwork - ' . $mailParams['property_name'])
->view('emails.offerPreConfirmCustomerMail', compact('mailParams', 'description'))
->to($mailParams['to'])
->bcc($mailParams['bcc'])
//->subject($offerDetail['ticket_code'].' Kodlu Teklifiniz Tesis Onayı Bekliyor')
->subject(__('api-mailing-offer_preconfirm_customer_mail-title', ['code' => $offerDetail['ticket_code']]))
->with(['message' => $this]);
} catch (Exception $e) {
$message = $e->getFile() . " " . $e->getLine() . " " . $e->getMessage();
Log::error($message);
return output(['status' => -1, 'message' => $e->getMessage()]);
}
}
}

View File

@@ -0,0 +1,91 @@
<?php
namespace App\Core\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Config;
class OfferPreConfirmPropertyMail extends Mailable
{
use Queueable, SerializesModels;
public $tries = 5;
public $timeout = 30;
protected $param;
public function __construct($param)
{
$this->param = $param;
}
public function build()
{
try {
$params = $this->param;
$propertyService = App::make("App\Core\Service\OfferService");
$requestParams = [
'offer_id' => fillOnUndefined($params, 'offer_id'),
'property_id' => fillOnUndefined($params, 'property_id'),
];
$offerDetail = $propertyService->findOffer($requestParams);
$offerDetail = fillOnUndefined($offerDetail, 'data');
app('translator')->setLocale($offerDetail["language"]);
$mailSenderAddress = Config::get('app.mailSenderAddress');
$mailParams['to'] = [];
$mailParams['to'] = $offerDetail['create_user']['email'];
$mailParams['bcc'] = [];
$mailParams['bcc'][] = Config::get('app.logMailAddress');
$mailParams['property_name'] = $offerDetail['property']['name'];
$mailParams['url'] = Config::get('app.client_server').'/offer/'.$offerDetail['offer_code'];
$mailParams['logo'] = Config::get('app.webUrl').'/assets/img/logo/mini-logo.png';
if(isset($offerDetail['property_brand']['logoUrl'])) {
$mailParams['logo'] = $offerDetail['property_brand']['logoUrl'];
}
$description = [];
//$description[] = 'Misafir, <b>'.$offerDetail['ticket_code'].'</b> kodlu teklifi onaylamıştır.';
$description[] = __('api-mailing-offer_preconfirm_property_mail-description-one', ['code' => $offerDetail['ticket_code']]);
//$description[] = 'Teklif türü otel onaylı olduğu için, tesis onayı beklenmektedir. Tesis onayını Extranetwork üzerinden verebilirsiniz.';
$description[] = __('api-mailing-offer_preconfirm_property_mail-description-two');
$description = implode('<br><br>', $description);
/*echo view('emails.offerPreConfirmPropertyMail', compact('mailParams', 'description'));
die();*/
return $this->from($mailSenderAddress, 'Extranetwork - ' . $mailParams['property_name'])
->view('emails.offerPreConfirmPropertyMail', compact('mailParams', 'description'))
->to($mailParams['to'])
->bcc($mailParams['bcc'])
//->subject($offerDetail['ticket_code'].' Kodlu Teklif Misafir Onayı')
->subject(__('api-mailing-offer_preconfirm_property_mail-title', ['code' => $offerDetail['ticket_code']]))
->with(['message' => $this]);
} catch (Exception $e) {
$message = $e->getFile() . " " . $e->getLine() . " " . $e->getMessage();
Log::error($message);
return output(['status' => -1, 'message' => $e->getMessage()]);
}
}
}

View File

@@ -0,0 +1,86 @@
<?php
namespace App\Core\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Config;
class OfferSendMail extends Mailable
{
use Queueable, SerializesModels;
public $tries = 5;
public $timeout = 30;
protected $param;
public function __construct($param)
{
$this->param = $param;
}
public function build()
{
try {
$params = $this->param;
$propertyService = App::make("App\Core\Service\OfferService");
$requestParams = [
'offer_id' => fillOnUndefined($params, 'offer_id'),
'property_id' => fillOnUndefined($params, 'property_id'),
];
$offerDetail = $propertyService->findOffer($requestParams);
$offerDetail = fillOnUndefined($offerDetail, 'data');
app('translator')->setLocale($offerDetail["language"]);
$mailSenderAddress = Config::get('app.mailSenderAddress');
$mailParams['to'] = [];
$mailParams['to'] = $offerDetail['email'];
$mailParams['bcc'] = [];
$mailParams['bcc'][] = Config::get('app.logMailAddress');
$mailParams['property_name'] = $offerDetail['property']['name'];
$mailParams['url'] = Config::get('app.client_server').'/offer/'.$offerDetail['offer_code'];
$mailParams['logo'] = Config::get('app.webUrl').'/assets/img/logo/mini-logo.png';
if(isset($offerDetail['property_brand']['logoUrl'])) {
$mailParams['logo'] = $offerDetail['property_brand']['logoUrl'];
}
$description = [];
$description[] = __('api-mailing-offer_mail-description', ['propertyName' => $offerDetail['property']['name'], 'code' => $offerDetail['ticket_code']]);
$description = implode('<br><br>', $description);
/*echo view('emails.offerMail', compact('mailParams', 'description'));
die();*/
return $this->from($mailSenderAddress, 'Extranetwork - ' . $mailParams['property_name'])
->view('emails.offerMail', compact('mailParams', 'description'))
->to($mailParams['to'])
->bcc($mailParams['bcc'])
->subject(__('api-mailing-offer_mail-title', ['propertyName' => $offerDetail['property']['name'], 'code' => $offerDetail['ticket_code']]))
->with(['message' => $this]);
} catch (Exception $e) {
$message = $e->getFile() . " " . $e->getLine() . " " . $e->getMessage();
Log::error($message);
return output(['status' => -1, 'message' => $e->getMessage()]);
}
}
}

View File

@@ -0,0 +1,100 @@
<?php
namespace App\Core\Mail;
use App\Exceptions\ApiErrorException;
use App\Models\PropertyProductOffer;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Config;
class PropertyProductOfferMail extends Mailable
{
use Queueable, SerializesModels;
public $tries = 5;
public $timeout = 30;
protected $param;
public function __construct($param)
{
$this->param = $param;
}
public function build()
{
try {
$params = $this->param;
$propertyProductOffer = PropertyProductOffer::where('offer_key', $params['offerKey'])->first();
$propertyProductOffer = $propertyProductOffer ? $propertyProductOffer->toArray() : null;
if (!$propertyProductOffer) {
throw new ApiErrorException('The offer was not found');
}
$mailData = [
'to' => [
'name' => $propertyProductOffer['executive_name'],
'email' => $propertyProductOffer['executive_email'],
],
'bcc' => ['sales@extranetwork.com']
];
$mailData['cc'] = [];
if (isset($propertyProductOffer['account_manager_email'])) {
$mailData['cc'][] = $propertyProductOffer['account_manager_email'];
}
$mailSenderAddress = Config::get('app.mailSenderAddress');
$mailParams = [
'property_name' => $propertyProductOffer['property_name'],
'executive_name' => $propertyProductOffer['executive_name'],
'executive_email' => $propertyProductOffer['executive_email'],
'executive_phone' => $propertyProductOffer['executive_phone'],
'offer_expire_date' => $propertyProductOffer['offerExpireTimeFormatted'],
'logo' => 'https://www.extranetwork.com/assets/img/logo/mini-logo.png',
'btnUrl' => config('app.url') . '/property-product-offer/' . $propertyProductOffer['offer_key']
];
if ($propertyProductOffer['version'] == 'v2') {
$mailParams['btnUrl'] = config('app.webUrl') . '/property-product-offer/' . $propertyProductOffer['offer_key'];
}
/*echo view('emails.propertyProductOfferMail', compact('mailParams'));
die();*/
$subjectMail = 'Extranetwork ' . $mailParams['property_name'] . ' Fiyat Teklifi';
if (isset($propertyProductOffer['detailArray']['paket'])) {
$subjectMail = 'Extranetwork ' . $mailParams['property_name'] . ' - ' . $propertyProductOffer['detailArray']['paket'] . ' Fiyat Teklifi';
}
return $this->from($mailSenderAddress, 'Extranetwork')
->view('emails.propertyProductOfferMail', compact('mailParams'))
->to($mailData['to']['email'], $mailData['to']['name'])
->cc($mailData['cc'])
->bcc($mailData['bcc'])
->subject($subjectMail)
->with(['message' => $this]);
} catch (Exception $e) {
$message = $e->getFile() . " " . $e->getLine() . " " . $e->getMessage();
Log::error($message);
return output(['status' => -1, 'message' => $e->getMessage()]);
}
}
}

View File

@@ -0,0 +1,104 @@
<?php
namespace App\Core\Mail;
use App\Exceptions\ApiErrorException;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Config;
class TrialFirstMail extends Mailable
{
use Queueable, SerializesModels;
public $tries = 5;
public $timeout = 30;
protected $param;
public function __construct($param)
{
$this->param = $param;
}
public function build()
{
try {
$params = $this->param;
$mailSenderAddress = Config::get('app.mailSenderAddress');
$propertyService = App::make('App\Core\Service\PropertyService');
$propertySelectCriteria = [
'criteria' => [
['field' => 'id', 'condition' => '=', 'value' => $params['propertyId']],
],
'with' => ['userPropertyMapping.user'],
'firstRow' => true
];
$propertyData = $propertyService->select($propertySelectCriteria);
if($propertyData['status'] == 'success') {
$userPropertyMappingCollect = collect($propertyData['data']['user_property_mapping']);
$userPropertyMapping = $userPropertyMappingCollect->where('status',1)->where('user.status',1)->sortBy('id');
$userPropertyMapping = $userPropertyMapping ? $userPropertyMapping->toArray() : [];
$defaultUser = reset($userPropertyMapping);
$mailData['to'] = [
'email' => $defaultUser['user']['email'],
'nameSurname' => $defaultUser['user']['nameSurname'],
];
$mailData['bcc'] = [];
foreach ($userPropertyMapping as $user) {
//$mailData['bcc'][] = $user['user']['email'];
}
$mailData['bcc'] = 'channel@extranetwork.com';//TODO: Delete
$mailParams= [
'email' => $mailData['to']['email'],
'nameSurname' => $mailData['to']['nameSurname'],
'propertyName' => $propertyData['data']['name'],
];
$mailTitle = 'Rezervasyonlarını ikiye katlamaya hazır mısın? 🚀';
//app('translator')->setLocale('en');
//echo view('emails.reminder.trialFirstMail', compact('mailParams')); die();
return $this->from($mailSenderAddress, 'Extranetwork')
->view('emails.reminder.trialFirstMail', compact('mailParams'))
->to($mailData['to']['email'], $mailData['to']['nameSurname'])
->bcc($mailData['bcc'])
->subject($mailTitle)
->with(['message' => $this]);
}
} catch (ApiErrorException $e) {
return output(['status' => -1, 'message' => $e->getMessage()]);
} catch (Exception $e) {
$message = $e->getFile() . " " . $e->getLine() . " " . $e->getMessage();
Log::error($message);
return output(['status' => -1, 'message' => $e->getMessage()]);
}
}
}

View File

@@ -0,0 +1,104 @@
<?php
namespace App\Core\Mail;
use App\Exceptions\ApiErrorException;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Config;
class TrialSecondMail extends Mailable
{
use Queueable, SerializesModels;
public $tries = 5;
public $timeout = 30;
protected $param;
public function __construct($param)
{
$this->param = $param;
}
public function build()
{
try {
$params = $this->param;
$mailSenderAddress = Config::get('app.mailSenderAddress');
$propertyService = App::make('App\Core\Service\PropertyService');
$propertySelectCriteria = [
'criteria' => [
['field' => 'id', 'condition' => '=', 'value' => $params['propertyId']],
],
'with' => ['userPropertyMapping.user'],
'firstRow' => true
];
$propertyData = $propertyService->select($propertySelectCriteria);
if($propertyData['status'] == 'success') {
$userPropertyMappingCollect = collect($propertyData['data']['user_property_mapping']);
$userPropertyMapping = $userPropertyMappingCollect->where('status',1)->where('user.status',1)->sortBy('id');
$userPropertyMapping = $userPropertyMapping ? $userPropertyMapping->toArray() : [];
$defaultUser = reset($userPropertyMapping);
$mailData['to'] = [
'email' => $defaultUser['user']['email'],
'nameSurname' => $defaultUser['user']['nameSurname'],
];
$mailData['bcc'] = [];
foreach ($userPropertyMapping as $user) {
//$mailData['bcc'][] = $user['user']['email'];
}
$mailData['bcc'] = 'channel@extranetwork.com';//TODO: Delete
$mailParams= [
'email' => $mailData['to']['email'],
'nameSurname' => $mailData['to']['nameSurname'],
'propertyName' => $propertyData['data']['name'],
];
$mailTitle = 'Çok görünürlük, daha çok satış.😎';
//app('translator')->setLocale('en');
//echo view('emails.reminder.trialSecondMail', compact('mailParams')); die();
return $this->from($mailSenderAddress, 'Extranetwork')
->view('emails.reminder.trialSecondMail', compact('mailParams'))
->to($mailData['to']['email'], $mailData['to']['nameSurname'])
->bcc($mailData['bcc'])
->subject($mailTitle)
->with(['message' => $this]);
}
} catch (ApiErrorException $e) {
return output(['status' => -1, 'message' => $e->getMessage()]);
} catch (Exception $e) {
$message = $e->getFile() . " " . $e->getLine() . " " . $e->getMessage();
Log::error($message);
return output(['status' => -1, 'message' => $e->getMessage()]);
}
}
}

View File

@@ -0,0 +1,46 @@
<?php
namespace App\Core\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Log;
class UserCreateMail extends Mailable
{
use Queueable, SerializesModels;
public $tries = 5;
public $timeout = 30;
protected $param;
public function __construct($param)
{
$this->param = $param;
}
public function build()
{
try {
$params = $this->param;
app('translator')->setLocale($params["language"]);
return $this->view('emails.createUserMail', compact('params'))
->to($params["email"], $params["name_surname"])
->subject(__('api-mailing-new_user_subject'));
} catch (Exception $e) {
$message = $e->getFile() . " " . $e->getLine() . " " . $e->getMessage();
Log::error($message);
return output(['status' => -1, 'message' => $e->getMessage()]);
}
}
}

View File

@@ -0,0 +1,48 @@
<?php
namespace App\Core\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Log;
class UserForgotPassword extends Mailable
{
use Queueable, SerializesModels;
public $tries = 5;
public $timeout = 30;
protected $param;
public function __construct($param)
{
$this->param = $param;
}
public function build ()
{
try
{
$params = $this->param;
app('translator')->setLocale($params["language"]);
return $this->view('emails.userForgotPassword', compact('params'))
->to($params["email"], $params["name_surname"])
->subject(__('api-mailing-user_forgot_password_subject'))
->with(['message' => $this]);
}
catch ( Exception $e )
{
$message = $e->getFile()." ".$e->getLine()." ".$e->getMessage();
Log::error($message);
return output( ['status' => -1, 'message' => $e->getMessage()] );
}
}
}

View File

@@ -0,0 +1,47 @@
<?php
namespace App\Core\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Support\Facades\Log ;
class WellcomeMail extends Mailable
{
use Queueable, SerializesModels;
/**
* Create a new message instance.
*
* @return void
*/
protected $param;
public function __construct($param)
{
$this->param = $param;
}
/**
* Build the message.
*
* @return $this
*/
public function build()
{
$val = $this->param;
Log::debug($val);
return $this->view('emails.wellCome', compact('val'))
->to('ygundogdu@rezervasyon.com', 'yadican')
->bcc('ygundogdu@rezervasyon.com', 'Burhan YUMAK')
->bcc('ygundogdu@rezervasyon.com', 'Operasyon')
->subject("WellCome Mail");
}
}