generated from spatie/package-skeleton-laravel
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new option to get the user success rate
- Loading branch information
Showing
6 changed files
with
101 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
|
||
namespace Enan\PathaoCourier\APIBase; | ||
|
||
|
||
use Illuminate\Support\Arr; | ||
use Enan\PathaoCourier\APIBase\PathaoBaseAPI; | ||
use Symfony\Component\HttpFoundation\Request; | ||
use Enan\PathaoCourier\Services\DataServiceOutput; | ||
|
||
|
||
class PathaoUserSuccess extends PathaoBaseAPI | ||
{ | ||
/** | ||
* Get User Success Rate | ||
* | ||
* @return mixed | ||
*/ | ||
public function get_user_success_rate(array $data) | ||
{ | ||
$url = "api/v1/user/success"; | ||
$API_response = $this->Pathao_API_Response(true, $url, Request::METHOD_POST, $data, true); | ||
|
||
$data = Arr::get($API_response, 'data.data') ?: []; | ||
$message = Arr::get($API_response, 'data.message') ?: null; | ||
$is_success = $this->isSuccessfulResponse(Arr::get($API_response, 'status')); | ||
$status_code = Arr::get($API_response, 'data.code') ?: []; | ||
|
||
return new DataServiceOutput($data, $message, $is_success, $status_code); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
|
||
namespace Enan\PathaoCourier\Requests; | ||
|
||
|
||
class PathaoUserSuccessRateRequest extends BasePathaoRequest | ||
{ | ||
public function rules() | ||
{ | ||
return [ | ||
'phone' => [ | ||
'required', | ||
'string', | ||
'regex:/^(?:\+880|880|01[3-9])\d{8}$/' | ||
], | ||
]; | ||
} | ||
} |