Skip to content

Commit 801d3d1

Browse files
r4m-juanh2rd
andauthored
fix: missing field address stop type (#37)
* fix: missing field address stop type * fix: set default value for address_stop_type * feat: add address types enum * feat: add example for creating order with address type * style: fix indentation --------- Co-authored-by: Skrynkovskyy Igor <[email protected]>
1 parent c183ba9 commit 801d3d1

File tree

4 files changed

+51
-8
lines changed

4 files changed

+51
-8
lines changed

composer.json

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,23 @@
55
"version": "1.3.1",
66
"authors": [
77
{
8-
"name": "Igor Route4Me",
9-
"email": "[email protected]"
8+
"name": "Igor Route4Me",
9+
"email": "[email protected]"
1010
},
11-
{
12-
"name": "Oleg Route4Me",
13-
"email": "[email protected]"
11+
{
12+
"name": "Oleg Route4Me",
13+
"email": "[email protected]"
1414
}
1515
],
16-
1716
"require": {
1817
"php": ">=7",
1918
"ext-json": "*",
2019
"ext-sockets": "*",
2120
"symfony/process": "*"
2221
},
23-
2422
"require-dev": {
2523
"phpunit/phpunit": "7.5.20"
2624
},
27-
2825
"autoload": {
2926
"psr-4": {
3027
"Route4Me\\": "src/Route4Me"
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
namespace Route4Me;
4+
5+
use Route4Me\Enum\AddressType;
6+
7+
$root = realpath(dirname(__FILE__) . '/../../');
8+
require $root . '/vendor/autoload.php';
9+
10+
// Example refers to creating a new Order.
11+
12+
// Set the api key in the Route4me class
13+
// This example not available for demo API key
14+
Route4Me::setApiKey(Constants::API_KEY);
15+
16+
$orderParameters = Order::fromArray([
17+
'address_1' => '1358 E Luzerne St, Philadelphia, PA 19124, US',
18+
'cached_lat' => 48.335991,
19+
'cached_lng' => 31.18287,
20+
'address_alias' => 'Auto test address',
21+
'address_city' => 'Philadelphia',
22+
'day_scheduled_for_YYMMDD' => date('Y-m-d'),
23+
'address_stop_type' => AddressType::VISIT,
24+
]);
25+
26+
$order = new Order();
27+
28+
$response = $order->addOrder($orderParameters);
29+
30+
Route4Me::simplePrint($response);

src/Route4Me/Enum/AddressType.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
namespace Route4Me\Enum;
4+
5+
class AddressType
6+
{
7+
const PICKUP = 'PICKUP';
8+
const DELIVERY = 'DELIVERY';
9+
const BREAK = 'BREAK';
10+
const MEETUP = 'MEETUP';
11+
const VISIT = 'VISIT';
12+
const SERVICE = 'SERVICE';
13+
const DRIVEBY = 'DRIVEBY';
14+
}

src/Route4Me/Order.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ class Order extends Common
6161
public $is_completed;
6262
public $custom_user_fields;
6363

64+
public $address_stop_type = \Route4Me\Enum\AddressType::DELIVERY;
65+
6466
public $addresses = [];
6567

6668
/**

0 commit comments

Comments
 (0)