Remove FS services endpoint
This commit is contained in:
parent
bfb0612ead
commit
b70c4ed6b5
|
@ -3,7 +3,6 @@
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use App\Exports\RefundAmountExport;
|
use App\Exports\RefundAmountExport;
|
||||||
use App\Imports\RefundAmountImport;
|
|
||||||
use App\Jobs\TestJob;
|
use App\Jobs\TestJob;
|
||||||
use App\Models\AgentPlus;
|
use App\Models\AgentPlus;
|
||||||
use App\Models\ConfigWallet;
|
use App\Models\ConfigWallet;
|
||||||
|
@ -18,9 +17,7 @@ use App\Traits\ApiResponser;
|
||||||
use App\Traits\Helper;
|
use App\Traits\Helper;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
use Illuminate\Support\Facades\Log;
|
|
||||||
use Maatwebsite\Excel\Facades\Excel;
|
use Maatwebsite\Excel\Facades\Excel;
|
||||||
use Throwable;
|
|
||||||
|
|
||||||
class HelperController extends Controller
|
class HelperController extends Controller
|
||||||
{
|
{
|
||||||
|
@ -193,34 +190,34 @@ class HelperController extends Controller
|
||||||
return Excel::download($export, 'refund.xlsx');
|
return Excel::download($export, 'refund.xlsx');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function fixFSServicesAmounts()
|
// public function fixFSServicesAmounts()
|
||||||
{
|
// {
|
||||||
$data = Excel::toArray(new RefundAmountImport, storage_path('refund.xlsx'));
|
// $data = Excel::toArray(new RefundAmountImport, storage_path('refund.xlsx'));
|
||||||
$result = [];
|
// $result = [];
|
||||||
foreach ($data[0] as $key => $row) {
|
// foreach ($data[0] as $key => $row) {
|
||||||
if ($key > 0) {
|
// if ($key > 0) {
|
||||||
array_push($result, $row);
|
// array_push($result, $row);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
try {
|
// try {
|
||||||
DB::beginTransaction();
|
// DB::beginTransaction();
|
||||||
// Fix amount
|
// // Fix amount
|
||||||
foreach ($result as $r) {
|
// foreach ($result as $r) {
|
||||||
if (isset($r[6])) {
|
// if (isset($r[6])) {
|
||||||
if ($r[3] == 'hyper') continue;
|
// if ($r[3] == 'hyper') continue;
|
||||||
$refund = $r[3] == 'geolocated' ? 50 * $r[5] : 25 * $r[5];
|
// $refund = $r[3] == 'geolocated' ? 50 * $r[5] : 25 * $r[5];
|
||||||
$wallet = Wallet::find($r[0]);
|
// $wallet = Wallet::find($r[0]);
|
||||||
$wallet->balance_com += $refund;
|
// $wallet->balance_com += $refund;
|
||||||
$wallet->save();
|
// $wallet->save();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
DB::commit();
|
// DB::commit();
|
||||||
return $this->successResponse(trans('messages.success_treated_demand'));
|
// return $this->successResponse(trans('messages.success_treated_demand'));
|
||||||
} catch (Throwable $exception) {
|
// } catch (Throwable $exception) {
|
||||||
DB::rollBack();
|
// DB::rollBack();
|
||||||
Log::error($exception->getMessage());
|
// Log::error($exception->getMessage());
|
||||||
return $this->errorResponse(trans('errors.unexpected_error'));
|
// return $this->errorResponse(trans('errors.unexpected_error'));
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,7 @@ use Illuminate\Support\Facades\Input;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
use Illuminate\Support\Facades\Mail;
|
use Illuminate\Support\Facades\Mail;
|
||||||
use PDO;
|
use PDO;
|
||||||
|
use Throwable;
|
||||||
|
|
||||||
trait Helper
|
trait Helper
|
||||||
{
|
{
|
||||||
|
@ -45,7 +46,7 @@ trait Helper
|
||||||
$message->subject($title);
|
$message->subject($title);
|
||||||
$message->to($recipients);
|
$message->to($recipients);
|
||||||
});
|
});
|
||||||
} catch (\Throwable $t) {
|
} catch (Throwable $t) {
|
||||||
Log::error('-------- Mail not sent -----------');
|
Log::error('-------- Mail not sent -----------');
|
||||||
Log::error($t->getMessage());
|
Log::error($t->getMessage());
|
||||||
}
|
}
|
||||||
|
@ -68,7 +69,7 @@ trait Helper
|
||||||
$body->data = $data;
|
$body->data = $data;
|
||||||
try {
|
try {
|
||||||
$body->date = ($date instanceof \DateTime) ? $date->format('Y-m-d H:i:s') : $date;
|
$body->date = ($date instanceof \DateTime) ? $date->format('Y-m-d H:i:s') : $date;
|
||||||
} catch (\Throwable $t) {
|
} catch (Throwable $t) {
|
||||||
Log::error($t->getMessage());
|
Log::error($t->getMessage());
|
||||||
$body->date = $date;
|
$body->date = $date;
|
||||||
}
|
}
|
||||||
|
@ -83,7 +84,7 @@ trait Helper
|
||||||
// );
|
// );
|
||||||
$promise->wait();
|
$promise->wait();
|
||||||
// return $response->getBody()->getContents();
|
// return $response->getBody()->getContents();
|
||||||
} catch (\Throwable $t) {
|
} catch (Throwable $t) {
|
||||||
Log::error('-------- User notification not sent-----------');
|
Log::error('-------- User notification not sent-----------');
|
||||||
Log::error($t->getMessage());
|
Log::error($t->getMessage());
|
||||||
}
|
}
|
||||||
|
@ -105,13 +106,13 @@ trait Helper
|
||||||
$body->data = $data;
|
$body->data = $data;
|
||||||
try {
|
try {
|
||||||
$body->date = ($date instanceof \DateTime) ? $date->format('Y-m-d H:i:s') : $date;
|
$body->date = ($date instanceof \DateTime) ? $date->format('Y-m-d H:i:s') : $date;
|
||||||
} catch (\Throwable $t) {
|
} catch (Throwable $t) {
|
||||||
Log::error($t->getMessage());
|
Log::error($t->getMessage());
|
||||||
$body->date = $date;
|
$body->date = $date;
|
||||||
}
|
}
|
||||||
$promise = $client->requestAsync('POST', '/onesignal/pushToAgent', ['json' => $body, 'headers' => $headers])->then();
|
$promise = $client->requestAsync('POST', '/onesignal/pushToAgent', ['json' => $body, 'headers' => $headers])->then();
|
||||||
$promise->wait();
|
$promise->wait();
|
||||||
} catch (\Throwable $t) {
|
} catch (Throwable $t) {
|
||||||
Log::error('-------- Agent notification not sent-----------');
|
Log::error('-------- Agent notification not sent-----------');
|
||||||
Log::error($t->getMessage());
|
Log::error($t->getMessage());
|
||||||
}
|
}
|
||||||
|
@ -148,20 +149,20 @@ trait Helper
|
||||||
WHERE n.id = :id', ['id' => $id_network]))->first();
|
WHERE n.id = :id', ['id' => $id_network]))->first();
|
||||||
|
|
||||||
$money = Money::of(round($amount, 2), $currency ? $currency->code : 'XAF', new AutoContext());
|
$money = Money::of(round($amount, 2), $currency ? $currency->code : 'XAF', new AutoContext());
|
||||||
return $money->formatTo('fr_FR');
|
return $money->formatTo(app()->getLocale());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function toMoney($amount, $id_country)
|
public function toMoney($amount, $id_country)
|
||||||
{
|
{
|
||||||
$country = Country::findOrFail($id_country);
|
$country = Country::findOrFail($id_country);
|
||||||
$money = Money::of(round($amount, 2), $country->currency->code, new AutoContext());
|
$money = Money::of(round($amount, 2), $country->currency->code, new AutoContext());
|
||||||
return $money->formatTo('fr_FR');
|
return $money->formatTo(app()->getLocale());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function toMoneyWithCurrencyCode($amount, $currency_code)
|
public function toMoneyWithCurrencyCode($amount, $currency_code)
|
||||||
{
|
{
|
||||||
$money = Money::of(round($amount, 2), $currency_code, new AutoContext());
|
$money = Money::of(round($amount, 2), $currency_code, new AutoContext());
|
||||||
return $money->formatTo('fr_FR');
|
return $money->formatTo(app()->getLocale());
|
||||||
}
|
}
|
||||||
|
|
||||||
private function convertMoney($amount, $init_country, $final_country)
|
private function convertMoney($amount, $init_country, $final_country)
|
||||||
|
@ -195,7 +196,7 @@ trait Helper
|
||||||
|
|
||||||
public function toMoneyWithCurrency($amount, $init_country, $final_country)
|
public function toMoneyWithCurrency($amount, $init_country, $final_country)
|
||||||
{
|
{
|
||||||
return $this->convertMoney($amount, $init_country, $final_country)->formatTo('fr_FR');
|
return $this->convertMoney($amount, $init_country, $final_country)->formatTo(app()->getLocale());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function toMoneyAmount($amount, $init_country, $final_country)
|
public function toMoneyAmount($amount, $init_country, $final_country)
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
//});
|
//});
|
||||||
$router->group(['prefix' => '', 'middleware' => 'auth'], function () use ($router) {
|
$router->group(['prefix' => '', 'middleware' => 'auth'], function () use ($router) {
|
||||||
// Helper routes
|
// Helper routes
|
||||||
$router->get('fixFSServicesAmounts', 'HelperController@fixFSServicesAmounts');
|
// $router->get('fixFSServicesAmounts', 'HelperController@fixFSServicesAmounts');
|
||||||
$router->post('update_password', 'UserController@updatePassword');
|
$router->post('update_password', 'UserController@updatePassword');
|
||||||
$router->get('agent_codes/{agent_code}', 'HelperController@agentCodes');
|
$router->get('agent_codes/{agent_code}', 'HelperController@agentCodes');
|
||||||
$router->get('countries', 'HelperController@countries');
|
$router->get('countries', 'HelperController@countries');
|
||||||
|
@ -35,7 +35,7 @@ $router->group(['prefix' => '', 'middleware' => 'auth'], function () use ($route
|
||||||
$router->group(['prefix' => '/ilink'], function () use ($router) {
|
$router->group(['prefix' => '/ilink'], function () use ($router) {
|
||||||
$router->post('', 'iLinkTransactionController@add');
|
$router->post('', 'iLinkTransactionController@add');
|
||||||
$router->post('commission', 'iLinkTransactionController@calculateCommission');
|
$router->post('commission', 'iLinkTransactionController@calculateCommission');
|
||||||
$router->get('user/{id_wallet_user}', 'iLinkTransactionController@lastUserTransactions');
|
$router->get('user/{id_user}', 'iLinkTransactionController@lastUserTransactions');
|
||||||
$router->get('agent/{id_wallet_agent}', 'iLinkTransactionController@lastAgentTransactions');
|
$router->get('agent/{id_wallet_agent}', 'iLinkTransactionController@lastAgentTransactions');
|
||||||
$router->post('check_retraits', 'iLinkTransactionController@getTransactionRetrait');
|
$router->post('check_retraits', 'iLinkTransactionController@getTransactionRetrait');
|
||||||
$router->delete('{id_transaction}', 'iLinkTransactionController@cancel');
|
$router->delete('{id_transaction}', 'iLinkTransactionController@cancel');
|
||||||
|
|
Loading…
Reference in New Issue