|
1
|
|
|
<?php namespace Stevenmaguire\Uber\Resources; |
|
2
|
|
|
|
|
3
|
|
|
trait Drivers |
|
4
|
|
|
{ |
|
5
|
|
|
/** |
|
6
|
|
|
* Fetches the profile for the current driver. |
|
7
|
|
|
* |
|
8
|
|
|
* The Profile endpoint returns the profile of the authenticated driver. |
|
9
|
|
|
* A profile includes information such as name, email, rating, and activation status. |
|
10
|
|
|
* |
|
11
|
|
|
* @return stdClass The JSON response from the request |
|
12
|
|
|
* |
|
13
|
|
|
* @see https://developer.uber.com/docs/drivers/references/api/v1/partners-me-get |
|
14
|
|
|
*/ |
|
15
|
2 |
|
public function getDriverProfile() |
|
16
|
|
|
{ |
|
17
|
2 |
|
return $this->request('get', 'partners/me'); |
|
18
|
|
|
} |
|
19
|
|
|
|
|
20
|
|
|
/** |
|
21
|
|
|
* Makes a request to the Uber API and returns the response. |
|
22
|
|
|
* |
|
23
|
|
|
* @param string $verb The Http verb to use |
|
24
|
|
|
* @param string $path The path of the APi after the domain |
|
25
|
|
|
* @param array $parameters Parameters |
|
26
|
|
|
* |
|
27
|
|
|
* @return stdClass The JSON response from the request |
|
28
|
|
|
* @throws Exception |
|
29
|
|
|
*/ |
|
30
|
|
|
abstract protected function request($verb, $path, $parameters = []); |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* Lists payments for the current driver. |
|
34
|
|
|
* |
|
35
|
|
|
* The Earnings endpoint returns an array of payments for the given driver. |
|
36
|
|
|
* Payments are available at this endpoint in near real-time. Some entries, |
|
37
|
|
|
* such as device_subscription will appear on a periodic basis when actually |
|
38
|
|
|
* billed to the partner. |
|
39
|
|
|
* |
|
40
|
|
|
* If a trip is cancelled (either by rider or driver) and there is no payment |
|
41
|
|
|
* made, the corresponding trip_id of that cancelled trip will not appear in |
|
42
|
|
|
* this endpoint. If the given driver works for a fleet manager, there will |
|
43
|
|
|
* be no payments associated and the response will always be an empty array. |
|
44
|
|
|
* Drivers working for fleet managers will receive payments from the fleet |
|
45
|
|
|
* manager and not from Uber. |
|
46
|
|
|
* |
|
47
|
|
|
* @param array $attributes |
|
48
|
|
|
* |
|
49
|
|
|
* @return stdClass The JSON response from the request |
|
50
|
|
|
* |
|
51
|
|
|
* @see https://developer.uber.com/docs/drivers/references/api/v1/partners-payments-get |
|
52
|
|
|
*/ |
|
53
|
2 |
|
public function getDriverPayments($attributes = []) |
|
54
|
|
|
{ |
|
55
|
2 |
|
return $this->request('get', '/partners/payments', $attributes); |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
/** |
|
59
|
|
|
* Lists trips for the current driver. |
|
60
|
|
|
* |
|
61
|
|
|
* The Trip History endpoint returns an array of trips for the authenticated |
|
62
|
|
|
* driver. |
|
63
|
|
|
* |
|
64
|
|
|
* @param array $attributes |
|
65
|
|
|
* |
|
66
|
|
|
* @return stdClass The JSON response from the request |
|
67
|
|
|
* |
|
68
|
|
|
* @see https://developer.uber.com/docs/drivers/references/api/v1/partners-trips-get |
|
69
|
|
|
*/ |
|
70
|
2 |
|
public function getDriverTrips($attributes = []) |
|
71
|
|
|
{ |
|
72
|
2 |
|
return $this->request('get', '/partners/trips', $attributes); |
|
73
|
|
|
} |
|
74
|
|
|
} |
|
75
|
|
|
|