+ Timezone of dates is now providing by user : Fixed v3
This commit is contained in:
parent
24fab34805
commit
bf2e38508d
|
@ -82,7 +82,7 @@ class CreditController extends Controller
|
|||
|
||||
$this->sendPushNotificationToAgent($agent->code_membre,
|
||||
trans('notifications.accepted_credit_request',
|
||||
['amount' => $this->toMoneyWithCurrencyCode($demand->montant, $walletAgentParrain->currency_code), "godfather" => $parrain->lastname . ' ' . $parrain->lastname]), $data);
|
||||
['amount' => $this->toMoneyWithCurrencyCode($demand->montant, $walletAgentParrain->currency_code), "godfather" => $parrain->lastname . ' ' . $parrain->lastname]), $data, $datetime);
|
||||
return $this->successResponse(trans('messages.success_treated_demand'));
|
||||
}
|
||||
|
||||
|
@ -103,7 +103,10 @@ class CreditController extends Controller
|
|||
$agent = AgentPlus::where('code_membre', $demand->code_membre)->firstOrFail();
|
||||
$parrain = AgentPlus::where('code_membre', $demand->code_parrain)->firstOrFail();
|
||||
|
||||
|
||||
$walletAgentParrain = WalletAgent::where('agent_id', $parrain->id)->firstOrFail();
|
||||
$datetime = $this->getCurrentTime($walletAgentParrain->network->country_id);
|
||||
|
||||
|
||||
$data = new \stdClass();
|
||||
$data->screen = "notificationview";
|
||||
|
@ -112,7 +115,7 @@ class CreditController extends Controller
|
|||
|
||||
$this->sendPushNotificationToAgent($agent->code_membre,
|
||||
trans('notifications.refused_credit_request',
|
||||
['amount' => $this->toMoneyWithCurrencyCode($demand->montant, $walletAgentParrain->currency_code), "godfather" => $parrain->lastname . ' ' . $parrain->lastname]), $data);
|
||||
['amount' => $this->toMoneyWithCurrencyCode($demand->montant, $walletAgentParrain->currency_code), "godfather" => $parrain->lastname . ' ' . $parrain->lastname]), $data, $datetime);
|
||||
return $this->successResponse(trans('messages.canceled_demand'));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -134,7 +134,7 @@ class NanoCreditController extends Controller
|
|||
$data->data->id = $demande->id;
|
||||
|
||||
$this->sendPushNotificationToAgent($walletHyper->codeMembre,
|
||||
trans('notifications.group_nano_credit_request', ['name' => $group->nom]), $data);
|
||||
trans('notifications.group_nano_credit_request', ['name' => $group->nom]), $data, $demande->date_creation);
|
||||
return $this->successResponse(trans('messages.successful_nano_credit_sent_to_hypervisor'));
|
||||
|
||||
} else {
|
||||
|
|
|
@ -184,7 +184,7 @@ class UserGroupController extends Controller
|
|||
$data->data = new \stdClass();;
|
||||
$data->data->id = $request->id_demande;
|
||||
$this->sendPushNotificationToUser($group->createur->user_code,
|
||||
trans('notifications.accepted_group_validation_request', ['name' => $sponsor->lastname . ' ' . $sponsor->firstname]), $data);
|
||||
trans('notifications.accepted_group_validation_request', ['name' => $sponsor->lastname . ' ' . $sponsor->firstname]), $data, $demande->date_validation);
|
||||
|
||||
return $this->successResponse(trans_choice('messages.successful_group_validation', 3 - $group->nombre_validation, ['count' => (3 - $group->nombre_validation)]));
|
||||
|
||||
|
@ -219,14 +219,14 @@ class UserGroupController extends Controller
|
|||
|
||||
if ($demande->type == 'creation') {
|
||||
$this->sendPushNotificationToUser($group->createur->user_code,
|
||||
trans('notifications.refused_group_validation_request', ['name' => $sponsor->lastname . ' ' . $sponsor->firstname]), $data);
|
||||
trans('notifications.refused_group_validation_request', ['name' => $sponsor->lastname . ' ' . $sponsor->firstname]), $data, $demande->date_validation);
|
||||
|
||||
return $this->successResponse(trans('messages.successful_refused_group_validation'));
|
||||
}
|
||||
|
||||
if ($demande->type == 'suppression') {
|
||||
$this->sendPushNotificationToUser($group->createur->user_code,
|
||||
trans('notifications.refused_group_deleting_request', ['name' => $sponsor->lastname . ' ' . $sponsor->firstname]), $data);
|
||||
trans('notifications.refused_group_deleting_request', ['name' => $sponsor->lastname . ' ' . $sponsor->firstname]), $data, $demande->date_validation);
|
||||
|
||||
return $this->successResponse(trans('messages.successful_refused_group_deleting'));
|
||||
}
|
||||
|
@ -234,14 +234,14 @@ class UserGroupController extends Controller
|
|||
if ($demande->type == 'adhesion') {
|
||||
$user = User::findOrFail($demande->id_user);
|
||||
$this->sendPushNotificationToUser($user->user_code,
|
||||
trans('notifications.successful_canceled_group_membership_request', ['name' => $sponsor->lastname . ' ' . $sponsor->firstname]), $data);
|
||||
trans('notifications.successful_canceled_group_membership_request', ['name' => $sponsor->lastname . ' ' . $sponsor->firstname]), $data, $demande->date_validation);
|
||||
|
||||
return $this->successResponse(trans('messages.successful_canceled_group_membership_request'));
|
||||
}
|
||||
|
||||
if ($demande->type == 'nano_credit') {
|
||||
$user = User::findOrFail($demande->id_user);
|
||||
$this->sendPushNotificationToUser($user->user_code, trans('notifications.refused_group_nano_credit_request'), $data);
|
||||
$this->sendPushNotificationToUser($user->user_code, trans('notifications.refused_group_nano_credit_request'), $data, $demande->date_validation);
|
||||
|
||||
return $this->successResponse(trans('messages.successful_canceled_nano_credit_request'));
|
||||
}
|
||||
|
@ -383,7 +383,7 @@ class UserGroupController extends Controller
|
|||
$data->data->id = $demande->id;
|
||||
|
||||
$this->sendPushNotificationToUser($sponsor_code,
|
||||
trans($message_id, ['name' => $sender->lastname . ' ' . $sender->firstname]), $data);
|
||||
trans($message_id, ['name' => $sender->lastname . ' ' . $sender->firstname]), $data, $demande->date_creation);
|
||||
|
||||
}
|
||||
|
||||
|
@ -474,7 +474,7 @@ ug.date_creation as date_creation_groupe , ug.createur , ug.sponsor1 , ug.sponso
|
|||
$data->data = new \stdClass();;
|
||||
$data->data->id = $request->id_demande;
|
||||
$this->sendPushNotificationToUser($user->user_code,
|
||||
trans('notifications.accepted_group_membership_request', ['name' => $sponsor->lastname . ' ' . $sponsor->firstname]), $data);
|
||||
trans('notifications.accepted_group_membership_request', ['name' => $sponsor->lastname . ' ' . $sponsor->firstname]), $data, $demande->date_validation);
|
||||
|
||||
return $this->successResponse(trans('messages.successful_accepted_group_membership_request'));
|
||||
|
||||
|
@ -533,7 +533,7 @@ ug.date_creation as date_creation_groupe , ug.createur , ug.sponsor1 , ug.sponso
|
|||
$data->data = new \stdClass();;
|
||||
$data->data->id = $request->id_demande;
|
||||
$this->sendPushNotificationToUser($group->createur->user_code,
|
||||
trans('notifications.accepted_group_deleting_request', ['name' => $sponsor->lastname . ' ' . $sponsor->firstname]), $data);
|
||||
trans('notifications.accepted_group_deleting_request', ['name' => $sponsor->lastname . ' ' . $sponsor->firstname]), $data, $demande->date_validation);
|
||||
|
||||
return $this->successResponse(trans_choice('messages.successful_group_deleting', 3 - $group->nombre_validation, ['count' => (3 - $group->nombre_validation)]));
|
||||
|
||||
|
@ -615,7 +615,7 @@ ug.date_creation , ug.createur , ug.sponsor1 , ug.sponsor2 , ug.sponsor3, ug.cou
|
|||
$data->screen = "notificationview";
|
||||
$data->data = new \stdClass();;
|
||||
$data->data->id = $request->id_demande;
|
||||
$this->sendPushNotificationToUser($user->user_code, trans('notifications.accepted_group_nano_credit_request'), $data);
|
||||
$this->sendPushNotificationToUser($user->user_code, trans('notifications.accepted_group_nano_credit_request'), $data, $demande->date_validation);
|
||||
|
||||
$message = trans('messages.successful_user_group_nano_credit_demand',
|
||||
['id_demand' => $demande_credit->id_demande, 'amount' => $this->toMoneyWithCurrencyCode($montant_total, $currency_code),
|
||||
|
|
|
@ -64,4 +64,9 @@ class WalletAgent extends Model
|
|||
'currency_code',
|
||||
'transactionNumber'
|
||||
];
|
||||
|
||||
public function network()
|
||||
{
|
||||
return $this->belongsTo(Network::class, 'network_id');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ trait Helper
|
|||
// return $this->successResponse("mail envoye");
|
||||
}
|
||||
|
||||
public function sendPushNotificationToUser($user_code, $message, $data = null)
|
||||
public function sendPushNotificationToUser($user_code, $message, $data = null, $date = null)
|
||||
{
|
||||
$client = new \GuzzleHttp\Client([
|
||||
'base_uri' => env('NOTIFICATION_SERVICE_URL'),
|
||||
|
@ -59,6 +59,7 @@ trait Helper
|
|||
$body->user_code = $user_code;
|
||||
$body->message = $message;
|
||||
$body->data = $data;
|
||||
$body->date = $date;
|
||||
$promise = $client->requestAsync('POST', '/onesignal/pushToUser', ['json' => $body, 'headers' => $headers])->then();
|
||||
// function (ResponseInterface $res) {
|
||||
// echo $res->getStatusCode() . "\n";
|
||||
|
@ -72,7 +73,7 @@ trait Helper
|
|||
// return $response->getBody()->getContents();
|
||||
}
|
||||
|
||||
public function sendPushNotificationToAgent($agent_code, $message, $data = null)
|
||||
public function sendPushNotificationToAgent($agent_code, $message, $data = null, $date = null)
|
||||
{
|
||||
$client = new \GuzzleHttp\Client([
|
||||
'base_uri' => env('NOTIFICATION_SERVICE_URL'),
|
||||
|
@ -84,6 +85,7 @@ trait Helper
|
|||
$body->agent_code = $agent_code;
|
||||
$body->message = $message;
|
||||
$body->data = $data;
|
||||
$body->date = $date;
|
||||
$promise = $client->requestAsync('POST', '/onesignal/pushToAgent', ['json' => $body, 'headers' => $headers])->then();
|
||||
$promise->wait();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue