Skip to content

Commit

Permalink
Merge branch 'MAR-6031-first-delivery-attempt' into 'master'
Browse files Browse the repository at this point in the history
[MAR-6031] Added support for new First delivery attempt field

See merge request marketplace-team/marketplace-api-client!50
  • Loading branch information
michalsalon-mall committed Oct 7, 2019
2 parents 6d74744 + 8f0bac0 commit 7b2f595
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 11 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Marketplace API client - change log

## 3.11.6
- added support for `first_delivery_attempt` order field

## 3.11.5
- reverted the changes from 3.11.1 - 3.11.4

Expand Down
5 changes: 3 additions & 2 deletions Example/OrdersExample.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,12 @@

/**
* ##################################
* Update order status with delivered at datetime
* Update order status with delivered at and first delivery attempt datetime
* ##################################
*/
$firstDeliveryAttempt = new \DateTime('2017-08-29 10:09:25');
$deliveredToCustomer = new \DateTime('2017-08-30 12:03:32');
$responseStatus = $orders->put()->status($order->getOrderId(), Order::STATUS_DELIVERED, true, '', $deliveredToCustomer);
$responseStatus = $orders->put()->status($order->getOrderId(), Order::STATUS_DELIVERED, true, '', $deliveredToCustomer, $firstDeliveryAttempt);
print('New order status: ');
var_dump($responseStatus);
print(PHP_EOL);
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name" : "mallgroup/mpapi-client",
"description" : "Mall marketplace API client",
"version" : "3.11.5",
"version" : "3.11.6",
"require" : {
"php" : "^5.5 || ^7.0",
"guzzlehttp/guzzle" : ">=6.2.3",
Expand Down
28 changes: 21 additions & 7 deletions src/Endpoints/OrderUpdateEndpoints.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,24 +58,38 @@ class OrderUpdateEndpoints extends AbstractEndpoints
/**
* Update order status
*
* @param integer $orderId
* @param string $status
* @param boolean $confirmed
* @param string $trackingNumber
* @param integer $orderId
* @param string $status
* @param boolean $confirmed
* @param string $trackingNumber
* @param \DateTimeInterface|null $deliveredAt
* @param \DateTimeInterface|null $firstDeliveryAttempt
* @return bool
* @throws \MPAPI\Exceptions\ClientIdException
* @throws \MPAPI\Exceptions\ForceTokenException
*/
public function status($orderId, $status, $confirmed = true, $trackingNumber = '', \DateTimeInterface $deliveredAt = null)
public function status(
$orderId,
$status,
$confirmed = true,
$trackingNumber = '',
\DateTimeInterface $deliveredAt = null,
\DateTimeInterface $firstDeliveryAttempt = null
)
{
$requestData = [
'status' => $status,
'confirmed' => $confirmed
'status' => $status,
'confirmed' => $confirmed,
];

if ($deliveredAt !== null) {
$requestData['delivered_at'] = $deliveredAt->format(self::DATETIME_FORMAT);
}

if ($firstDeliveryAttempt !== null) {
$requestData['first_delivery_attempt'] = $firstDeliveryAttempt->format(self::DATETIME_FORMAT);
}

if (!empty($trackingNumber)) {
$requestData['tracking_number'] = $trackingNumber;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Services/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Client
*
* @var string
*/
const APPLICATION_NAME = 'mpapic-v3.11.5';
const APPLICATION_NAME = 'mpapic-v3.11.6';

/**
*
Expand Down

0 comments on commit 7b2f595

Please sign in to comment.