Skip to content

Commit

Permalink
setInsurance must be an int. Set version 0.2.8
Browse files Browse the repository at this point in the history
  • Loading branch information
reindertvetter committed Feb 22, 2017
1 parent 800da2d commit 07d4bab
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "myparcelnl/sdk",
"version": "v0.2.7",
"version": "v0.2.8",
"description": "This package is designed to send and receive data from MyParcel by means of an API.",
"homepage": "https://www.myparcel.nl",
"tags": ["MyParcel", "My Parcel", "Post NL", "PostNL"],
Expand Down
8 changes: 6 additions & 2 deletions src/Model/MyParcelConsignment.php
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,11 @@ public function getInsurance()
*/
public function setInsurance($insurance)
{
$this->insurance = $this->canHaveOption($insurance);
if (!$this->canHaveOption()) {
$insurance = 0;
}

$this->insurance = $insurance;

return $this;
}
Expand Down Expand Up @@ -919,7 +923,7 @@ public function addItems($item)
* @return bool
* @throws \Exception
*/
private function canHaveOption($option)
private function canHaveOption($option = true)
{
if ($this->getPackageType() === null) {
throw new \Exception('Set package type before ' . $option);
Expand Down
1 change: 0 additions & 1 deletion src/Model/Repository/MyParcelConsignmentRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@ public function apiDecode($data)

if (key_exists('insurance', $data['options']))
$this->setInsurance($data['options']['insurance']['amount'] / 100);
;

if (key_exists('delivery_date', $data['options']))
$this->setDeliveryDate($data['options']['delivery_date']);
Expand Down

0 comments on commit 07d4bab

Please sign in to comment.